Java API Documentation¶
hk.hku.cecid.corvus.http¶
AS2EnvelopQuerySender¶
-
public class
AS2EnvelopQuerySender
extends EnvelopQuerySender¶ The
AS2EnvelopQuerySender
is a client service sender using HTTP protocol for query the message envelop (i.e EDI Header + payload) from the Hermes 2 Messaging Gateway. To use it you have to provide the configuration instance calledAS2AdminData
. it defines the URL end-point and credential for connecting to your Hermes 2 Restricted area. An Example for adding partnership :// Create an admin data for configuration. AS2AdminData adminData = new AS2AdminData(); adminData.setManagePartnershipEndpoint("Your H2O location"); adminData.setUsername("Your username for logging H2O"); adminData.setPassword("Your password for logging H2O"); AS2EnvelopQuerySender sender = new AS2EnvelopQuerySender(someLogger, adminData, pData); sender.setMessageCriteriaToDownload("The message id you want to query", "INBOX or OUTBOX"); sender.run(); InputStream ins = sender.getEnvelopStream(); // The envelop content ... process it.
Note for setting the manage partnership end-point You should add /admin/as2/partnership to your H2O host. For example, ‘http://localhost:8080/admin/as2/partnership‘. Note that the client service does not guarantee transactional behavior meaning you are always able to down-load the envelop when invoking the client. (Different from the receiver Web service).
Author: Twinsen Tsang See also:
hk.hku.cecid.corvus.ws.data.AS2AdminData
Constructors¶
AS2EnvelopQuerySender¶
-
public
AS2EnvelopQuerySender
(FileLogger logger, AS2AdminData ad)¶ Explicit Constructor. Create an instance of
AS2EnvelopQuerySender
.Parameters: - logger – The logger for log the sending process.
- ad – The
AS2AdminData
for locating the HTTP end-point the request send to.
Throws: - NullPointerException – When
p
is null. When the manage partnership end-point fromad
is null or empty.
AS2EnvelopQuerySenderUnitTest¶
-
public class
AS2EnvelopQuerySenderUnitTest
extends EnvelopQuerySenderUnitTest¶ The
AS2EnvelopQuerySenderUnitTest
is unit test ofAS2EnvelopQuerySender
.Author: Twinsen Tsang
AS2PartnershipSender¶
-
public class
AS2PartnershipSender
extends PartnershipSender¶ The
AS2PartnershipSender
is a client service sender using HTTP protocol for maintaining the set of AS2 Partnership in Hermes 2 Messaging Gateway. To use it you have to provide the configuration instance calledAS2AdminData
. it defines the URL end-point and credential for connecting to your Hermes 2 Restricted area. An Example for adding partnership :// Create an administrative data for configuration. AS2AdminData adminData = new AS2AdminData(); adminData.setManagePartnershipEndpoint("Your H2O location"); adminData.setUsername("Your username for logging H2O"); adminData.setPassword("Your password for logging H2O"); // Create a partnership data for doing maintenance operation. AS2PartnershipData pData = new AS2PartnershipData(); . . . AS2PartnershipSender sender = new AS2PartnershipSender(someLogger, adminData, pData); sender.setExecuteOperation(PartnershipOp.Add); sender.run();
Note for setting the manage partnership end-point You should add /admin/as2/partnership to your H2O host. For example, ‘http://localhost:8080/admin/as2/partnership‘. Technical Information The
AS2PartnershipSender
will generate a HTTP multi-part request to the manage partnership end-point. The request includes all parameter extracted from theAS2Partnership
, each of them is represented as either text/plain multi-part, or application binary multi-part (for thecertificates
). The type of partnership operation to execute also append at the end of the HTTP request in a text multi-part form.Author: Twinsen Tsang See also:
hk.hku.cecid.corvus.ws.data.AS2AdminData
,hk.hku.cecid.corvus.ws.data.AS2PartnershipData
,hk.hku.cecid.corvus.http.PartnershipOp
Constructors¶
AS2PartnershipSender¶
-
public
AS2PartnershipSender
(FileLogger logger, AS2AdminData ad, AS2PartnershipData p)¶ Explicit Constructor. Create an instance of
AS2PartnershipSender
.Parameters: - logger – The logger for log the sending process.
- ad – The
AS2AdminData
for locating the HTTP end-point the request send to. - p – The
AS2PartnershipData
you want to add/delete/update.
Throws: - NullPointerException – When
p
is null. When the manage partnership end-point fromad
is null or empty.
AS2PartnershipSenderUnitTest¶
-
public class
AS2PartnershipSenderUnitTest
extends PartnershipSenderUnitTest¶ The
AS2PartnershipSenderUnitTest
is unit test ofAS2PartnershipSender
.Author: Twinsen Tsang
EBMSEnvelopQuerySender¶
-
public class
EBMSEnvelopQuerySender
extends EnvelopQuerySender¶ The
EBMSEnvelopQuerySender
is a client service sender using HTTP protocol for query the message envelop (i.e EDI Header + payload) from the Hermes 2 Messaging Gateway. To use it you have to provide the configuration instance calledAS2AdminData
. it defines the URL end-point and credential for connecting to your Hermes 2 Restricted area. An Example for adding partnership :// Create an admin data for configuration. EBMSAdminData adminData = new EBMSAdminData(); adminData.setManagePartnershipEndpoint("Your H2O location"); adminData.setUsername("Your username for logging H2O"); adminData.setPassword("Your password for logging H2O"); EBMSEnvelopQuerySender sender = new EBMSEnvelopQuerySender(someLogger, adminData, pData); sender.setMessageCriteriaToDownload("The message id you want to query", "INBOX or OUTBOX"); sender.run(); InputStream ins = sender.getEnvelopStream(); // The envelop content ... process it.
Note for setting the manage partnership end-point You should add /admin/ebms/partnership to your H2O host. For example, ‘http://localhost:8080/admin/ebms/partnership‘. Note that the client service does not guarantee transactional behavior meaning you are always able to down-load the envelop when invoking the client. (Different from the receiver Web service).
Author: Twinsen Tsang
Constructors¶
EBMSEnvelopQuerySender¶
-
public
EBMSEnvelopQuerySender
(FileLogger logger, EBMSAdminData ad)¶ Explicit Constructor. Create an instance of
AS2EnvelopQuerySender
.Parameters: - logger – The logger for log the sending process.
- ad – The
EBMSAdminData
for locating the HTTP end-point the request send to.
Throws: - NullPointerException – When
p
is null. When the manage partnership end-point fromad
is null or empty.
EBMSEnvelopQuerySenderUnitTest¶
-
public class
EBMSEnvelopQuerySenderUnitTest
extends EnvelopQuerySenderUnitTest¶ The
EBMSEnvelopQuerySenderUnitTest
is unit test ofEBMSEnvelopQuerySender
.Author: Twinsen Tsang
EBMSPartnershipSender¶
-
public class
EBMSPartnershipSender
extends PartnershipSender¶ The
EBMSPartnershipSender
is a client service sender using HTTP protocol for maintaining the set of EBMS Partnership in Hermes 2 Messaging Gateway. To use it you have to provide the configuration instance calledEBMSAdminData
. it defines the URL end-point and credential for connecting to your Hermes 2 Restricted area. An Example for adding partnership :// Create an administrative data for configuration. EBMSAdminData adminData = new EBMSAdminData(); adminData.setManagePartnershipEndpoint("Your H2O location"); adminData.setUsername("Your username for logging H2O"); adminData.setPassword("Your password for logging H2O"); // Create a partnership data for doing maintenance operation. EBMSPartnershipData pData = new EBMSPartnershipData(); . . . EBMSPartnershipData sender = new EBMSPartnershipData(someLogger, adminData, pData); sender.setExecuteOperation(PartnershipOp.Add); sender.run();
Note for setting the manage partnership end-point You should add /admin/ebms/partnership to your H2O host. For example, ‘http://localhost:8080/admin/ebms/partnership‘. Technical Information The
EBMSPartnershipSender
will generate a HTTP multi-part request to the manage partnership end-point. The request includes all parameter extracted from theEBMSPartnershipData
, each of them is represented as either text/plain multi-part, or application binary multi-part (for thecertificates
). The type of partnership operation to execute also append at the end of the HTTP request in a text multi-part form.Author: Twinsen Tsang See also:
hk.hku.cecid.corvus.ws.data.EBMSAdminData
,hk.hku.cecid.corvus.ws.data.EBMSPartnershipData
,hk.hku.cecid.corvus.http.PartnershipOp
Constructors¶
EBMSPartnershipSender¶
-
public
EBMSPartnershipSender
(FileLogger logger, EBMSAdminData ad, EBMSPartnershipData p)¶ Explicit Constructor. Create an instance of
EBMSPartnershipSender
Parameters: - logger – The logger for log the sending process.
- ad – The
EBMSAdminData
for locating the HTTP end-point the request send to. - p – The
EBMSPartnershipData
EBMSPartnershipSenderUnitTest¶
-
public class
EBMSPartnershipSenderUnitTest
extends PartnershipSenderUnitTest¶ The
EBMSPartnershipSenderUnitTest
is unit test ofEBMSPartnershipSender
.Author: Twinsen Tsang
EnvelopQuerySender¶
-
public class
EnvelopQuerySender
extends HttpSender¶ The
EnvelopSender
is abstract base class for sending HTTP remote request to H2O for querying the message envelop through the administration page.Author: Twinsen Tsang
Constructors¶
EnvelopQuerySender¶
-
protected
EnvelopQuerySender
(FileLogger logger, Data d)¶ Explicit Constructor. Create an instance of
EnvelopQuerySender
Parameters: - logger – The logger for log the sending process.
- d – The data used for generate Envelop query request. It must be a kind of Admin data.
EnvelopQuerySender¶
-
protected
EnvelopQuerySender
(FileLogger logger, Data d, String username, String password)¶ Explicit Constructor. Create an instance of
EnvelopQuerySender
Parameters: - logger – The logger for log the sending process.
- d – The data used for generate Envelop query request. It must be a kind of Admin data.
- username – The username for authentication
- password – The password for authentication
Methods¶
getEnvelopStream¶
-
public final InputStream
getEnvelopStream
()¶ This method should be called after executed
run()
successfully.Returns: The message envelop stream.
getMessageBoxMapping¶
-
protected Map
getMessageBoxMapping
()¶ Get the message box mapping from standardized representation to proprietary representation. It should return a HashMap like this:
HashMap m = new HashMap(); m.put(MSGBOX_IN , "Your Inbox representation"); m.put(MSGBOX_OUT, "Your outbox representation");
Returns: the message box mapping. See also:
EnvelopQuerySender.MSGBOX_IN
,EnvelopQuerySender.MSGBOX_OUT
getMessageBoxToDownload¶
getMessageIdToDownload¶
onCreateRequest¶
-
protected HttpRequestBase
onCreateRequest
()¶ [@EVENT] This method is invoked when the sender is required to create a HTTP Request from configuration. It generates a form-url-encoded content embedded in the HTTP POST request. It contains two parameters, message_id and message_box. The value of these parameters are extracted from
getMessageIdToDownload()
andgetMessageBoxToDownload()
respectively. NOTE: The values of message_box parameter may differ to what you see because it may transformgetMessageBoxMapping()
.Throws: - NullPointerException – When
getMessageIdToDownload()
return null. WhengetMessageBoxToDownload()
return empty or null. - IllegalArgumentException – When
getMessageBoxToDownload()
return string not equal to ‘INBOX’ and ‘OUTBOX’
- NullPointerException – When
onResponse¶
-
protected void
onResponse
()¶ [@EVENT] This method is invoked when received the reply HTTP response from the server. It saves the response body stream and then available to get through by
getEnvelopStream()
setMessageCriteriaToDownload¶
-
public final void
setMessageCriteriaToDownload
(String messageId, String messageBox)¶ Set the message criteria for down-load the message envelop (and payload).
Parameters: - messageId – The message id to down-load the message envelop.
- messageBox – The message box to down-load the message envelop. either INBOX or OUTBOX.
Throws: - NullPointerException – When
getMessageIdToDownload()
return null. WhengetMessageBoxToDownload()
return empty or null. - IllegalArgumentException – When
getMessageBoxToDownload()
return string not equal to ‘INBOX’ and ‘OUTBOX’
EnvelopQuerySenderUnitTest¶
-
public class
EnvelopQuerySenderUnitTest
extends TestCase¶ The
EnvelopQuerySenderUnitTest
is unit test ofEnvelopQuerySender
.Author: Twinsen Tsang
Fields¶
kvData¶
-
protected KVPairData
kvData
¶
target¶
-
protected EnvelopQuerySender
target
¶ The testing target which is an PartnershipSender and the associated data
testClassLogger¶
-
protected FileLogger
testClassLogger
¶
Methods¶
initTestTarget¶
-
public void
initTestTarget
()¶ Initialize the test target which is a PartnershipSender.
testSetMessageCriteriaProperty¶
-
public void
testSetMessageCriteriaProperty
()¶ Test whether the setMessageCriteriaToDownload works well under valid data. *
testSetMessageCriteriaWithInvalid¶
-
public void
testSetMessageCriteriaWithInvalid
()¶ Test whether the setMessageCriteriaToDownload throw exception when second argument is invalid. *
HttpSender¶
-
public class
HttpSender
implements Runnable¶ The
HttpSender
is top base class for sending HTTP request. TODO: javadocAuthor: Twinsen Tsang
Fields¶
log¶
-
protected FileLogger
log
¶
Constructors¶
HttpSender¶
-
public
HttpSender
()¶ SPA Constructor. It is used when the HTTP Sender is a component in the SPA.
HttpSender¶
-
public
HttpSender
(FileLogger logger, Data d)¶ Explicit Constructor.
Parameters: - logger – The logger used for log message and exception.
- d – The data used for sending HTTP request.
HttpSender¶
-
public
HttpSender
(FileLogger logger, Data d, String username, String password)¶ Explicit Constructor.
Parameters: - logger – The logger used for log message and exception.
- d – The data used for sending HTTP request.
- username – The username for authentication
- password – The password for authentication
HttpSender¶
-
public
HttpSender
(FileLogger l, Data d, String endpoint)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- d – The data used for sending HTTP request.
- endpoint – The URL of service end point.
HttpSender¶
-
public
HttpSender
(FileLogger l, Data d, URL endpoint)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- d – The data used for sending HTTP request.
- endpoint – The URL of service end point.
HttpSender¶
-
public
HttpSender
(FileLogger l, Data d, String endpoint, String username, String password)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- d – The data used for sending HTTP request.
- endpoint – The URL of service end point.
- username – The username for authentication
- password – The password for authentication
HttpSender¶
-
public
HttpSender
(FileLogger l, Data d, URL endpoint, String username, String password)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- d – The data used for sending HTTP request.
- endpoint – The URL of service end point.
- username – The username for authentication
- password – The password for authentication
Methods¶
closeResponse¶
-
public void
closeResponse
(CloseableHttpResponse response)¶ Close http response with exception handling
Parameters: - response – the response to close
getCurrentLoopTimes¶
-
public int
getCurrentLoopTimes
()¶ Get what is the current loop times for looping
getExecutedMethod¶
-
public HttpRequestBase
getExecutedMethod
()¶ Get the last executed HTTP method. This method should be invoked during
onResponse()
.Returns: the last executed HTTP method.
getResponse¶
-
public CloseableHttpResponse
getResponse
()¶ Get the response of the last executed HTTP method. This method should be invoked during
onResponse()
.Returns: the response of the last executed HTTP method
getServiceEndPoint¶
initializeMessage¶
-
protected void
initializeMessage
()¶ Implements this method if you want to send messages without much different between other message to sent.
isAuthenticationRequired¶
-
public boolean
isAuthenticationRequired
()¶ Returns: true if HTTP authentication is required.
onBeforeRequest¶
-
protected void
onBeforeRequest
(HttpClient client, HttpRequestBase request)¶ [@EVENT] This method is invoked just before sending the request to HTTP service end-point.
Parameters: - client – The HTTP Connection used for sending SOAP request.
- request – The request created by
onCreateRequest()
.
Throws: - Exception – Any type of exception will be processed at onError(throwable t).
onCreateRequest¶
-
protected HttpRequestBase
onCreateRequest
()¶ [@EVENT] This method is invoked when the sender is required to create a HTTP Request from configuration. By default, this method return a PostMethod pointing to
getServiceEndPoint()
.Throws: - Exception – Sub-class implementation-specific exception
onEachLoopStart¶
onError¶
onResponse¶
-
protected void
onResponse
()¶ [@EVENT] This method is invoked when received the reply HTTP response from the server. Developer can use
getExecutedMethod()
to get the HTTP method generated thruonCreateRequest()
Throws: - Exception – Any type of exception will be processed at onError(throwable t).
onStart¶
-
protected void
onStart
()¶ [@EVENT] This method is invoked when the sender begins to execute the run method.
setLoopTimes¶
-
public void
setLoopTimes
(int loopTimes)¶ Set how many times should the sender to be send.
Parameters: - loopTimes – the new loopTimes.
setServiceEndPoint¶
setServiceEndPoint¶
HttpSenderUnitTest¶
-
public class
HttpSenderUnitTest
extends TestCase¶ The
HttpSenderUnitTest
is unit test ofHttpSender
. TODO: Inadequate Test-case for testing looping.Author: Twinsen Tsang
Fields¶
Methods¶
testLoopTimeProperty¶
-
public void
testLoopTimeProperty
()¶ Test
HttpSender.getLoopTimes()
andHttpSender.setLoopTimes(int)
*
testSendWithBasicAuthentication¶
-
public void
testSendWithBasicAuthentication
()¶ Test wether the HTTP sender able to send the HTTP header with ‘Authorization’ header.
testSendWithMultipart¶
-
public void
testSendWithMultipart
()¶ Test whether the HTTP sender able to send the HTTP header with multi-part to our monitor successfully.
testSendWithNoContent¶
-
public void
testSendWithNoContent
()¶ Test whether the HTTP sender able to send the HTTP header to our monitor successfully.
testSendWithParameter¶
-
public void
testSendWithParameter
()¶ Test whether the HTTP sender able to send the HTTP header with POST parameter to our monitor successfully.
testServiceEndpointPropertyWithInvalidData¶
-
public void
testServiceEndpointPropertyWithInvalidData
()¶ Test whether
HttpSender.setServiceEndPoint(String)
with invalid data.
testUserObjectProperty¶
-
public void
testUserObjectProperty
()¶ Test
HttpSender.getUserObject()
*
PartnershipOp¶
-
public interface
PartnershipOp
¶ The
PartnershipOperation
is the signature interface for providing a clue that the implemented class should able to handle add/delete/update operation one or more kind of partnerships.Author: Twinsen Tsang
Fields¶
PartnershipOpVerifer¶
-
public class
PartnershipOpVerifer
¶ The
PartnershipOpVerifer
is an helper class for verifying whether the partnership operation has been executed successfully. Since H2O does not have any build-in SOAP-based web service for managing the partnerships under remote behavior, The PartnershipOpVerifer acts as a validator for validating the HTML content returning from the H2O administration web page. The main method of this class isvalidate(InputStream)
and the arugment is the input stream. The input stream SHOULD contains the HTML content after you executed add/delete/update partnership in either AS2/EBMS partnership administration page.Author: Twinsen Tsang
Fields¶
Methods¶
validate¶
-
public void
validate
(InputStream ins)¶ Validate the HTML content received after executed partnership operation. The content is passed as a input stream
ins
. This operation is quite expensive because it first transform the whole HTML content received to a well-formed XHTML before parsing by the SAX Parser.Parameters: - ins – The HTML content to validate the result of partnership operation
Throws: - SAXException –
- When unable to down-load the HTML DTD from the web. Check your Internet connectivity
- When IO related problems occur
- ParserConfigurationException – When SAX parser mis-configures.
PartnershipOpVeriferUnitTest¶
-
public class
PartnershipOpVeriferUnitTest
extends TestCase¶ The
PartnershipOpVeriferUnitTest
is unit test ofPartnershipOpVerifer
.Author: Twinsen Tsang
Fields¶
Methods¶
initTestTarget¶
-
public void
initTestTarget
()¶ Initialize the test target which is a Partnership Operation Verifier.
testValidateAddSuccess¶
-
public void
testValidateAddSuccess
()¶ Test whether the validation process execute property for add operation executed properly. *
testValidateDeleteSuccess¶
-
public void
testValidateDeleteSuccess
()¶ Test whether the validation process execute property for delete operation executed properly. *
testValidateUpdateSuccess¶
-
public void
testValidateUpdateSuccess
()¶ Test whether the validation process execute property for update operation executed properly. *
testValidateWithErrorSample0¶
-
public void
testValidateWithErrorSample0
()¶ Test whether the validation process throw exception when the HTML content violate the field constraint (this case, ‘Retry Interval must be integer’);
PartnershipSender¶
-
public abstract class
PartnershipSender
extends HttpSender implements PartnershipOp¶ The
PartnershipSender
is abstract base class for sending HTTP remote request to H2O for executing partnership maintenance operation.Author: Twinsen Tsang
Constructors¶
PartnershipSender¶
-
protected
PartnershipSender
(FileLogger logger, KVPairData d)¶ Explicit Constructor. Create an instance of
PartnershipSender
Parameters: - logger – The logger for log the sending process.
- d – The data used for generate HTTP multi-part request. It must be a kind of partnership data.
PartnershipSender¶
-
protected
PartnershipSender
(FileLogger logger, KVPairData d, String username, String password)¶ Explicit Constructor. Create an instance of
PartnershipSender
Parameters: - logger – The logger for log the sending process.
- d – The data used for generate HTTP multi-part request. It must be a kind of partnership data.
- username – The username for authentication
- password – The password for authentication
Methods¶
getPartnershipMapping¶
-
public abstract Map
getPartnershipMapping
()¶ Get the mapping of the partnership data key to HTTP form parameter name. For example, if there are 3 data (with keys) in your partnership data and they are named as “dataKey0”, “dataKey1” and “dataKey2”, and you want the HTTP request going to execute containing multi-part parameters “formParam0”, “formParam1” and “formParam2” with the value equal to the data value from “dataKey0”, “dataKey1”, “dataKey2” respectively, Then you should return the Map listed below:
Map m = new HashMap(); // Or LinkedHashMap() if you want to preserve the order. m.put("dataKey0", "fromParam0"); m.put("dataKey1", "fromParam1"); m.put("dataKey2", "fromParam2"); return m;
Returns: The mapping of the partnership data key to HTTP form parameter name.
getPartnershipOperationMapping¶
-
public abstract Map
getPartnershipOperationMapping
()¶ Get the mapping of the partnership operation from integer to words. By default, it is recommended to return a HashMap(Integer, String) with 3 mappings. HashMap.get(0) = A word representing the add partnership action. HashMap.get(1) = A word representing the delete partnership action. HashMap.get(2) = A word representing the update partnership action.
Returns: The mapping of the partnership operation from integer to words.
getStatus¶
onCreateRequest¶
-
protected HttpRequestBase
onCreateRequest
()¶ [@EVENT] This method is invoked when the sender is required to create a HTTP Request from configuration. It generates a multi-part content embedded in the HTTP POST request. The multi-part content contains all partnership data with the parameter name retrieved from the partnership mapping.
getPartnershipMapping()
. Also the type of partnership operation is appended at the end of multi-part with parameter name equal to ‘request_action’ and it’s value is extracted thrugetPartnershipOperationMapping()
.
onResponse¶
-
protected void
onResponse
()¶ [@EVENT] This method is invoked when receivedas2 the reply HTTP response from the server. Verify the HTTP response (expected a HTML content) by PartnershipOpVerifer to check whether the partnership operation execute successfully or not.
Throws: - SAXException – When fail to verify by PartnershipOpVerifer.
PartnershipSenderUnitTest¶
-
public class
PartnershipSenderUnitTest
extends TestCase¶ The
PartnershipSenderUnitTest
is unit test ofPartnershipSender
. TODO: Inadequate Test-case for error path.Author: Twinsen Tsang
Fields¶
kvData¶
-
protected KVPairData
kvData
¶
target¶
-
protected PartnershipSender
target
¶ The testing target which is an PartnershipSender and the associated data
testClassLogger¶
-
protected FileLogger
testClassLogger
¶
Methods¶
initTestTarget¶
-
public void
initTestTarget
()¶ Initialize the test target which is a PartnershipSender.
testAddPartnership¶
-
public void
testAddPartnership
()¶ Test whether the add partnership request operation perform correctly *
hk.hku.cecid.corvus.partnership¶
AS2Partnership¶
-
public class
AS2Partnership
¶ The
AS2Partnership
is the utilities for maintaining the partnership of AS2. In current version, it support addition or deletion of the partnership.Author: kochiu, Twinsen Tsang (modifiers) See also:
.createAS2Partnership(String)
,.removeAS2Partnership(String)
Methods¶
createAS2Partnership¶
-
public static boolean
createAS2Partnership
(String xmlFile)¶ Create a AS2 partnership with the configuration defined in the
XMLFile
.Parameters: - xmlFile – The partnership XML instance file. It is located at “/data/as2.xml”.
Throws: - DAOException – Error in persistence connectivity.
- DocumentException – Error in reading the parameter in the
xmlFile
. - SAXException – Error in parsing the
xmlFile
. - IOException –
Returns: true if the removal operation ran successfully.
main¶
-
public static void
main
(String[] args)¶ The entry point for CLI.
Parameters: - args – The arguments have two parametes. The first one is the partnership maintenance which is either “-a” (add) or “-d” (delete). The second one is the xml file containing the partnership information. They are located at the “conf/as2.xml” relative to the program folders.
removeAS2Partnership¶
-
public static boolean
removeAS2Partnership
(String xmlFile)¶ Remove a particular partnership defined in the
xmlFile
. Only the attributes <id> in thexmlFile
will be used for removing partnership.Parameters: - xmlFile – The partnership XML instance file. It is located at “/data/ebms.xml”.
Throws: - DAOException – Error in persistence connectivity.
- DocumentException – Error in reading the parameter in the
xmlFile
. - SAXException – Error in parsing the
xmlFile
. - IOException –
Returns: true if the removal operation ran successfully.
EbmsPartnership¶
-
public class
EbmsPartnership
¶ The
EbmsPartnership
is the utilities for maintaining the partnership of EbMS. In current version, it support addition or deletion of the partnership.Author: kochiu, Twinsen Tsang (modifiers) See also:
.createEbmsPartnership(String)
,.removeEbmsPartnership(String)
Methods¶
createEbmsPartnership¶
-
public static boolean
createEbmsPartnership
(String xmlFile)¶ Create a EbMS partnership with the configuration defined in the
XMLFile
.Parameters: - xmlFile – The partnership XML instance file. It is located at “/data/ebms.xml”.
Throws: - DAOException – Error in persistence connectivity.
- DocumentException – Error in reading the parameter in the
xmlFile
. - SAXException – Error in parsing the
xmlFile
. - IOException –
Returns: true if the removal operation ran successfully.
main¶
-
public static void
main
(String[] args)¶ The entry point for CLI.
Parameters: - args – The arguments have two parametes. The first one is the partnership maintenance which is either “-a” (add) or “-d” (delete). The second one is the xml file containing the partnership information. They are located at the “conf/ebms.xml” relative to the program folders.
removeEbmsPartnership¶
-
public static boolean
removeEbmsPartnership
(String xmlFile)¶ Remove a particular partnership defined in the
xmlFile
. Only the attributes <id> in thexmlFile
will be used for removing partnership.Parameters: - xmlFile – The partnership XML instance file. It is located at “/data/ebms.xml”.
Throws: - DAOException – Error in persistence connectivity.
- DocumentException – Error in reading the parameter in the
xmlFile
. - SAXException – Error in parsing the
xmlFile
. - IOException –
Returns: true if the removal operation ran successfully.
hk.hku.cecid.corvus.util¶
DateUtil¶
-
public class
DateUtil
¶ An utility for converting from java datetime to UTC conformed datetime and vice versa.
- Fixed a bug that it parses UTC datetime with ‘Z’ timezone incorrectly becasue it used wrong timezone (GMT, but not UTC). (Thank Martin Kalen for figure out this)
- Added datetime / calendar two UTC convertion.
Author: Twinsen Tsang, (modifier Philip Wong)
Methods¶
GMT2Calender¶
-
public static Calendar
GMT2Calender
(String dateTime)¶ Convert an GMT representation of string
dateTime
to java calendar object.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: The millisecond representing the
dateTime
GMT2Date¶
-
public static Date
GMT2Date
(String dateTime)¶ Convert an GMT representation of string
dateTime
to java Date object.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java date object representing the
dateTime
GMT2MS¶
-
public static long
GMT2MS
(String dateTime)¶ Convert an GMT representation of string
dateTime
to millisecond.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: The millisecond representing the
dateTime
GMT2Timestamp¶
-
public static Timestamp
GMT2Timestamp
(String dateTime)¶ Convert an GMT representation of string
dateTime
to java Timestamp object.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java timestamp object representing the
dateTime
UTC2Calendar¶
-
public static Calendar
UTC2Calendar
(String dateTime)¶ Convert an UTC representation of string
dateTime
to java calendar object. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java clendar object representing the
dateTime
UTC2Date¶
-
public static Date
UTC2Date
(String dateTime)¶ Convert an UTC representation of string
dateTime
to java Date object. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java date object representing the
dateTime
.
UTC2MS¶
-
public static long
UTC2MS
(String dateTime)¶ Convert an UTC representation of string
dateTime
to millisecond. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: The millisecond representing by
dateTime
.
UTC2Timestamp¶
-
public static Timestamp
UTC2Timestamp
(String dateTime)¶ Convert an UTC representation of string
dateTime
to java Timestamp object. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java timestamp object representing the
dateTime
.
calendar2UTC¶
-
public static String
calendar2UTC
(Calendar dateTime)¶ Convert a calendar
dateTime
to UTC conformed representation of string.Parameters: - dateTime – A java calendar representing the time you want to convert.
Throws: - UtilitiesException – When unable to convert the
dateTime
to UTC.
Returns: an UTC conformed representation with time specified by
dateTime
date2UTC¶
-
public static String
date2UTC
(Date dateTime, TimeZone timeZone)¶ Convert a date
dateTime
to UTC conformed representation of string. (e.g. 2007-07-16T13:24:56.789+13:00)Parameters: - dateTime – A java date representing the time you want to convert.
- timeZone – The timezone of the
dateTime
. If it is null, it use the default timezone in the machine.
Throws: - UtilitiesException – When unable to convert the
dateTime
to UTC.
Returns: an UTC conformed representation with time specified by
dateTime
FileLogger¶
-
public class
FileLogger
extends Component implements Logger¶ The file logger is a simple logger that log everything to the desired file. Dependency : Piazza Common The sample usage is shown on the below:
FileLogger log = new FileLogger("../logs/testlog.txt"); log.debug("Test debug statement"); log.error("Test error statement"); log.fatal("Test fatal statement"); log.info ("Test info statement"); log.warn ("Test warn statement");
The output in the file logger should be liked these:
[Debug] Test debug statement [Error] Test error statement [Fatal] Test fatal statement [Info] Test info statement [Warn] Test warn statement
SPA Component Guideline:.
Author: Twinsen Tsang
Constructors¶
FileLogger¶
FileLogger¶
-
public
FileLogger
(File f)¶ Constructor. The file logger open a file output stream for writing the log to the file. It use the default log file name “log.txt” for logging if the file object is a directory.
Parameters: - f – The file object specified.
Throws: - UtilitiesException – Throw if any IO Operations fail like can not open file or print stream.
SOAPUtilities¶
-
public class
SOAPUtilities
¶ The SOAPUtilities acts as a SOAP Helper for some operations that frequently used. Currently supported operations:
- create a SOAP Element with specified tag name, value, ns prefix and uri (Also an attributes set).
- get a SOAP Element with specified tag name, ns prefix and uri and which nth tag from a SOAP Message.
- get a list of SOAP Element with specified tag name, ns prefix and uri from a SOAP Message.
Author: Twinsen
Methods¶
countElement¶
-
public static int
countElement
(SOAPMessage message, String tagname, String nsURI)¶ Count how many element with
tagname
andnsURI
is in SOAPMessagemessage
.Parameters: - message – The SOAP message
- tagname – The name of the tag to be counted.
- nsURI – The namespace URI of the tag.
Throws: - SOAPException –
Returns: The number of element in the SOAP message.
createElement¶
-
public static SOAPElement
createElement
(String tagName, String tagValue, String nsPrefix, String nsURI)¶ Create a SOAP Element with the specified parameters.
Parameters: - tagName – the name of XML tag.
- tagValue – the value of XML tag.
- nsPrefix – the namespace prefix.
- nsURI – the namespace URL.
Returns: the new SOAP element created.
createElement¶
-
public static SOAPElement
createElement
(String tagName, String tagValue, String nsPrefix, String nsURI, Hashtable attrSet)¶ Create a SOAP Element with the specified parameters.
Also it create the attributes set as the parameter properties.
Parameters: - tagName – the name of XML tag.
- tagValue – the value of XML tag.
- nsPrefix – the namespace prefix.
- nsURI – the namespace URL.
- attrSet – the attributes set in the element.
Returns: the new SOAP element created.
getElement¶
-
public static SOAPElement
getElement
(SOAPMessage message, String tagname, String nsURI, int whichOne)¶ Get a SOAP Element from the SOAPMessage (SOAPbody inside).
Parameters: - message – The SOAP message to be searched with.
- tagname – The tag name of element to be retrieved.
- nsURI – The namespace URI.
- whichOne – The nth child element to be returned.
Returns: The element in the tagname specified.
getElementList¶
-
public static List
getElementList
(SOAPMessage message, String tagname, String nsURI)¶ Get a SOAP Element list from the SOAPMessage (SOAPbody inside).
Parameters: - message – The SOAP message to be searched with.
- tagname – The tag name of element to be retrieved.
- nsURI – The namespace URI.
Throws: - SOAPException –
Returns: list of SOAP element
linkElements¶
-
public static boolean
linkElements
(SOAPMessage message, String parentTagName, String parentNsURI, String childTagName, String childNsURI)¶ Validate the existence of child SOAP element given the parent element.
Parameters: - message –
- parentTagName –
- parentNsURI –
- childTagName –
- childNsURI –
Throws: - SOAPException –
Returns: true if child element exists
hk.hku.cecid.corvus.ws¶
AS2ConfigSender¶
-
public class
AS2ConfigSender
extends SOAPSender¶ The
AS2ConfigSender
is a client sender sending SOAP web services request to B2BCollectorAS2
plugin for configurating the performance factor. The web service parameters are defined in the below:<active-module-status> true | false </active-module-status> <inmessage-interval>15000</inmessage-interval> <inmessage-maxthread>0</inmessage-maxthread> <outmessage-interval>15000</outmessage-interval> <outmessage-maxthread>0</outmessage-maxthread> <outpayload-interval>15000</outpayload-interval> <outpayload-maxthread>0</outpayload-maxthread>
Author: Twinsen Tsang
Constructors¶
AS2ConfigSender¶
-
public
AS2ConfigSender
(FileLogger l, AS2ConfigData data)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- data – The AS2 Configuration parameters.
Methods¶
getStatus¶
initializeMessage¶
-
public void
initializeMessage
()¶ The SOAPRequest in the creation stage should be liked this.
Throws: - Exceptions –
AS2MessageHistoryQuerySender¶
-
public class
AS2MessageHistoryQuerySender
extends SOAPSender¶
Constructors¶
AS2MessageHistoryQuerySender¶
-
public
AS2MessageHistoryQuerySender
(FileLogger l, AS2MessageHistoryRequestData m)¶
AS2MessageReceiver¶
-
public class
AS2MessageReceiver
extends MessageReceiver¶
Constructors¶
AS2MessageReceiver¶
-
public
AS2MessageReceiver
(FileLogger l, AS2MessageData m)¶
Methods¶
getOutputDirectory¶
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the MessageProps.
onResponse¶
-
public void
onResponse
()¶ Retrieve the payload from the message. The default receiver stores the payload as a files at the particular place specified in the configuration.
setMessageIdToRetreive¶
AS2MessageSender¶
-
public class
AS2MessageSender
extends MessageSender¶ The
AS2MessageSender
is a client sender sending SOAP web services request to B2BCollectorAS2
plugin for transmission a AS2 message to other parnter. The web service parameters are defined in the below:<part name="as2_from" type="s:string" /> <part name="as2_to" type="s:string" /> <part name="type" type="s:string" />
Author: Twinsen Tsang
Constructors¶
AS2MessageSender¶
-
public
AS2MessageSender
(FileLogger l, AS2MessageData m, AS2PartnershipData p)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message data for party information and send/recv configuration.
- p – The partnership data.
Methods¶
getResponseMessageId¶
-
public String
getResponseMessageId
()¶ Get the message id of last successful web service query. This should be called only after
onResponse()
Returns: the message id
AS2PermitRedownloadSender¶
-
public class
AS2PermitRedownloadSender
extends PermitRedownloadServiceSender¶
Constructors¶
AS2PermitRedownloadSender¶
-
public
AS2PermitRedownloadSender
(FileLogger l, Data m)¶
AS2ReceiverListSender¶
-
public class
AS2ReceiverListSender
extends MessageSender¶ The
AS2ReceiverListSender
is a client sender sending SOAP web services request to B2BCollectorAS2
plugin for query whether if there is any message that are available. The web service parameters are defined in the below:<part name="as2From" type="s:string" /> <part name="as2To" type="s:string" /> <part name="numOfMessages" type="s:int" />
Author: Twinsen Tsang
Constructors¶
AS2ReceiverListSender¶
-
public
AS2ReceiverListSender
(FileLogger l, AS2MessageData m, AS2PartnershipData p)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message data for party information and send/recv configuration.
- p – The partnership data.
Methods¶
getAvailableMessages¶
-
public List
getAvailableMessages
()¶ This method should be called after the event
onResponse()
Returns: a list of message id that are ready to download.
getNumOfMessageToRetrieve¶
-
public int
getNumOfMessageToRetrieve
()¶ Returns: number of message to retrieve for one soap call.
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the MessageProps.
onResponse¶
-
public void
onResponse
()¶ [@EVENT] Record all the AS2 message that ready to download. Developer should invocate
getAvailableMessages()
to get a list of all ready AS2 message.
AS2ReceiverSender¶
-
public class
AS2ReceiverSender
extends AS2MessageSender¶ The
AS2ReceiverSender
is a client sender sending SOAP web services request to Hermes Messaging GatewayAS2
plugin for down-loading the AS2 message and it’s corresponding payload.Author: Twinsen Tsang
Constructors¶
AS2ReceiverSender¶
-
public
AS2ReceiverSender
(FileLogger l, AS2MessageData m, AS2PartnershipData ps)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message data for party information and send/recv configuration.
- ps – The partnership data.
Methods¶
getOutputDirectory¶
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the MessageProps.
onResponse¶
-
public void
onResponse
()¶ Retrieve the payload from the message. The default receiver stores the payload as a files at the particular place specified in the configuration.
setMessageIdToRetreive¶
AS2StatusQuerySender¶
-
public class
AS2StatusQuerySender
extends SOAPSender¶ The
AS2StatusQuerySender
is a client sender sending SOAP web services request to CorvusAS2
plugin for query the status of particular message. The web service parameters are defined in the below:<messageId> 20070418-124233-75006@147.8.177.42 </messageId>
Creation Date: 02/05/2007
Author: Twinsen Tsang
Constructors¶
AS2StatusQuerySender¶
-
public
AS2StatusQuerySender
(FileLogger l, AS2StatusQueryData data)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- data – The AS2 Status query parameter.
Methods¶
getLastResponseData¶
-
public AS2StatusQueryResponseData
getLastResponseData
()¶ Returns: The AS2 status response data by the last SFRM status query SOAP Call.
initializeMessage¶
-
public void
initializeMessage
()¶ The SOAPRequest in the creation stage should be liked this.
Throws: - Exceptions –
onResponse¶
-
public void
onResponse
()¶ Get the SOAP Body and analyze the result of configuration.
The result of SOAP body:
<status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <ackMessageId> The message id of acknowledgment / receipt if any </ackMessageId> <ackStatus> The status of acknowledgment / receipt if any </ackStatus> <ackStatusDescription> The status description of acknowledgment / receipt if any </ackStatusDescription>
EBMSConfigSender¶
-
public class
EBMSConfigSender
extends SOAPSender¶ The
EBMSConfigSender
is a client sender sending SOAP web services request to B2BCollectorEBMS
plugin for configurating the performance factor. The web service parameters are defined in the below:<active-module-status> true | false </active-module-status> <incollector-interval>15000</incollector-interval> <incollector-maxthread>0</incollector-maxthread> <outcollector-interval>15000</outcollector-interval> <outcollector-maxthread>0</outcollector-maxthread> <mailcollector-interval>15000</mailcollector-interval> <mailcollector-maxthread>0</mailcollector-maxthread>
Author: Twinsen Tsang
Constructors¶
EBMSConfigSender¶
-
public
EBMSConfigSender
(FileLogger l, EBMSConfigData data)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- data – The EBMS Configuration parameters.
Methods¶
getStatus¶
initializeMessage¶
-
public void
initializeMessage
()¶ The SOAPRequest in the creation stage should be liked this.
Throws: - Exceptions –
EBMSMessageHistoryQuerySender¶
-
public class
EBMSMessageHistoryQuerySender
extends SOAPSender¶
Constructors¶
EBMSMessageHistoryQuerySender¶
-
public
EBMSMessageHistoryQuerySender
(FileLogger l, EBMSMessageHistoryRequestData m)¶
EBMSMessageHistoryQuerySenderTest¶
-
public class
EBMSMessageHistoryQuerySenderTest
extends TestCase¶
Fields¶
kvData¶
-
protected KVPairData
kvData
¶
target¶
-
protected EBMSMessageHistoryQuerySender
target
¶ The testing target which is an PartnershipSender and the associated data
testClassLogger¶
-
protected FileLogger
testClassLogger
¶
Methods¶
EBMSMessageReceiver¶
-
public class
EBMSMessageReceiver
extends MessageReceiver¶ The
EBMSMessageReceiver
is a client sender sending SOAP web services request to B2BCollectorEbMS
plugin for retrieving a ebMS message according to provided message id. The web service parameters are defined in the below:<part name="messageId" type="s:string" /> *
Author: Jumbo Cheung
Constructors¶
EBMSMessageReceiver¶
-
public
EBMSMessageReceiver
(FileLogger l, EBMSMessageData m)¶
Methods¶
getOutputDirectory¶
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the MessageProps.
EBMSMessageSender¶
-
public class
EBMSMessageSender
extends MessageSender¶ The
EBMSMessageSender
is a client sender sending SOAP web services request to B2BCollectorEbMS
plugin for transmission a ebMS message to other parnter. The web service parameters are defined in the below:<part name="cpaId" type="s:string" /> <part name="service" type="s:string" /> <part name="action" type="s:string" /> <part name="convId" type="s:string" /> <part name="fromPartyId" type="s:string" /> <part name="fromPartyType" type="s:string" /> <part name="toPartyId" type="s:string" /> <part name="toPartyType" type="s:string" /> <part name="refToMessageId" type="s:string" /> <part name="serviceType" type="s:string" />
Author: Twinsen Tsang See also:
hk.hku.cecid.corvus.ws.data.EBMSMessageData
,hk.hku.cecid.corvus.ws.data.EBMSPartnershipData
Constructors¶
EBMSMessageSender¶
-
public
EBMSMessageSender
(FileLogger l, EBMSMessageData m, EBMSPartnershipData p)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message data for party information and send/recv configuration.
- p – The partnership data.
Methods¶
getResponseMessageId¶
-
public String
getResponseMessageId
()¶ Get the message id of last successful web service query. This should be called only after
onResponse()
Returns: the message id
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the MessageProps.
EBMSPermitRedownloadSender¶
-
public class
EBMSPermitRedownloadSender
extends PermitRedownloadServiceSender¶
Constructors¶
EBMSPermitRedownloadSender¶
-
public
EBMSPermitRedownloadSender
(FileLogger l, Data m)¶
EBMSReceiverListSender¶
-
public class
EBMSReceiverListSender
extends MessageSender¶ The
EBMSReceiverListSender
is a client sender sending SOAP web services request to H2OEbMS
plugin for query whether if there is any message that are available. The web service parameters are defined in the below:<part name="cpaId" type="s:string" /> <part name="service" type="s:string" /> <part name="action" type="s:string" /> <part name="convId" type="s:string" /> <part name="fromPartyId" type="s:string" /> <part name="fromPartyType" type="s:string" /> <part name="toPartyId" type="s:string" /> <part name="toPartyType" type="s:string" /> <part name="numOfMessages" type="s:int" />
Author: Twinsen Tsang
Constructors¶
EBMSReceiverListSender¶
-
public
EBMSReceiverListSender
(FileLogger l, EBMSMessageData m, EBMSPartnershipData p)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message data for party information and send/recv configuration.
- p – The partnership data.
Methods¶
getAvailableMessages¶
-
public List
getAvailableMessages
()¶ This method should be called after the event
onResponse()
Returns: a list of message id that are ready to download.
getNumOfMessageToRetrieve¶
-
public int
getNumOfMessageToRetrieve
()¶ Returns: number of message to retrieve for one soap call.
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the MessageProps.
onResponse¶
-
public void
onResponse
()¶ [@EVENT] Record all the EbMS message that ready to download. Developer should invocate
getAvailableMessages()
to get a list of all ready EbMS message.
EBMSReceiverSender¶
-
public class
EBMSReceiverSender
extends EBMSMessageSender¶ The
EBMSReceiverSender
is a client sender sending SOAP web services request to B2BCollectorEbMS
plugin for downloading the EbMS message and it’s corresponding payload.Author: Twinsen Tsang
Constructors¶
EBMSReceiverSender¶
-
public
EBMSReceiverSender
(FileLogger l, EBMSMessageData m, EBMSPartnershipData ps)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message data for party information and send/recv configuration.
- ps – The partnership data.
Methods¶
getOutputDirectory¶
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the MessageProps.
onResponse¶
-
public void
onResponse
()¶ Retrieve the payload from the message. The default receiver stores the payload as a files at the particular place specified in the configuration.
setMessageIdToRetreive¶
EBMSStatusQuerySender¶
-
public class
EBMSStatusQuerySender
extends SOAPSender¶ The
EBMSStatusQuerySender
is a client sender sending SOAP web services request to CorvusEBMS
plugin for query the status of particular message. The web service parameters are defined in the below:<messageId> 20070418-124233-75006@147.8.177.42 </messageId>
Creation Date: 02/05/2007
Author: Twinsen Tsang
Constructors¶
EBMSStatusQuerySender¶
-
public
EBMSStatusQuerySender
(FileLogger l, EBMSStatusQueryData data)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- data – The EBMS Status query parameter.
Methods¶
getLastResponseData¶
-
public EBMSStatusQueryResponseData
getLastResponseData
()¶ Returns: The EBMS status response data by the last SFRM status query SOAP Call.
initializeMessage¶
-
public void
initializeMessage
()¶ The SOAPRequest in the creation stage should be liked this.
Throws: - Exceptions –
onResponse¶
-
public void
onResponse
()¶ Get the SOAP Body and analyze the result of configuration.
The result of SOAP body:
<status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <ackMessageId> The message id of acknowledgment / receipt if any </ackMessageId> <ackStatus> The status of acknowledgment / receipt if any </ackStatus> <ackStatusDescription> The status description of acknowledgment / receipt if any </ackStatusDescription>
MessageReceiver¶
-
public class
MessageReceiver
extends SOAPSender¶ The
MessageReceiver
is the abstract class which is used to send SOAP messsage request to B2B Collector series product.Author: Jumbo Cheung
Constructors¶
MessageReceiver¶
-
public
MessageReceiver
(FileLogger l, Data m)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message properties including how many message need to be sent and some performance parameter.
Methods¶
getContentType¶
getElapsedTime¶
-
public long
getElapsedTime
()¶ Get how long it tasks for the sender to do it’s tasks.
Returns: The times for the task from start to end in milleseconds.
getResponsePayloads¶
-
public Payload[]
getResponsePayloads
()¶ Get the payload from the SOAP response. This should be called during
onResponse()
.Throws: - SOAPException – When unable to extract the payload in the SOAP Response.
- IOException – When unable to open the input stream for the payload.
Returns: A set of payload in SOAP message.
onError¶
MessageSender¶
-
public abstract class
MessageSender
extends SOAPSender¶ The
MessageSender
is the abstract class which is used to send SOAP messsage request to B2B Collector series product.Author: Joel Matsumoto, Twinsen Tsang
Constructors¶
MessageSender¶
-
public
MessageSender
(FileLogger l, Data m, Data p)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message properties including how many message need to be sent and some performance parameter.
- p – The partnership properties used for sending.
Methods¶
addRequestPayload¶
getContentType¶
getElapsedTime¶
-
public long
getElapsedTime
()¶ Get how long it tasks for the sender to do it’s tasks.
Returns: The times for the task from start to end in milleseconds.
getResponsePayloads¶
-
public Payload[]
getResponsePayloads
()¶ Get the payload from the SOAP response. This should be called during
onResponse()
.Throws: - SOAPException – When unable to extract the payload in the SOAP Response.
- IOException – When unable to open the input stream for the payload.
Returns: A set of payload in SOAP message.
onError¶
MessageSenderException¶
MessageStatusSender¶
-
public class
MessageStatusSender
extends SOAPSender¶ The
MessageStatusSender
is the SOAP Message client that query the message status record through theMessage status engine (MS-E). From the description in (MS-E), a series of parameters have been defined and required to send to the MS-E.- partnershipId
- channelType (OUTGOING | INCOMING)
- channelId
- folderName
- fileName
- fromTimestamp (in UTC format)
- toTimestamp (in UTC format)
- numOfRecords
- conversationId
- messageId
- messageType
- messageStatus
- protocol
- locale (EN)
- levelOfDetails (0 | 1)
- offset
Creation Date: 12/03/2007
Author: Twinsen Tsang
Constructors¶
MessageStatusSender¶
-
public
MessageStatusSender
(FileLogger l, MessageStatusRequestData m)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message status properties including the querying parameter.
Methods¶
getMessageStatusList¶
-
public ArrayList
getMessageStatusList
()¶ [@GET] Get the list of message status record. It should be called only after the invocation of
onResponse()
.Returns: a list of message status record using the filter from the last web services call query.
initializeMessage¶
-
public void
initializeMessage
()¶ Initialize the message using the properties in the
MessageStatusRequestData
.Throws: - ClassCastException – the properties set is not a message status request data.
onResponse¶
PermitRedownloadServiceSender¶
-
public abstract class
PermitRedownloadServiceSender
extends SOAPSender¶
Constructors¶
PermitRedownloadServiceSender¶
-
public
PermitRedownloadServiceSender
(FileLogger l, Data m)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- m – The message properties including how many message need to be sent and some performance parameter.
Methods¶
getElapsedTime¶
-
public long
getElapsedTime
()¶ Get how long it tasks for the sender to do it’s tasks.
Returns: The times for the task from start to end in milleseconds.
getResponseElementText¶
-
public String
getResponseElementText
(String tagname, String nsURI, int whichOne)¶ This method should only be called inside
onResponse()
. because the response object will be deleted upon each ws call.Parameters: - tagname – The tag name of element to be retrieved.
- nsURI – The namespace URI.
- whichOne – The nth child element to be returned.
Returns: The element text in the tagname specified.
onError¶
SFRMStatusQuerySender¶
-
public class
SFRMStatusQuerySender
extends SOAPSender¶ The
SFRMStatusQuerySender
is a client sender sending SOAP web services request to CorvusSFRM
plugin for query the status of particular message. The web service parameters are defined in the below:<messageId> 20070418-124233-75006@147.8.177.42 </messageId>
Creation Date: 02/05/2007
Author: Twinsen Tsang
Constructors¶
SFRMStatusQuerySender¶
-
public
SFRMStatusQuerySender
(FileLogger l, SFRMStatusQueryData data)¶ Explicit Constructor.
Parameters: - l – The logger used for log message and exception.
- data – The SFRM Status query parameter.
Methods¶
getLastResponseData¶
-
public SFRMStatusQueryResponseData
getLastResponseData
()¶ Returns: The SFRM status response data by the last SFRM status query SOAP Call.
initializeMessage¶
-
public void
initializeMessage
()¶ The SOAPRequest in the creation stage should be liked this.
Throws: - Exceptions –
onResponse¶
-
public void
onResponse
()¶ Get the SOAP Body and analyze the result of configuration.
The result of SOAP body:
<messageInfo> <status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <numberOfSegments> Maximum number of segments </numberOfSegments> <numberOfProcessedSegments> Number of processed segments </numberOfProcessedSegments> <lastUpdatedTime> The last updated timestamp </lastUpdatedTime> </messageInfo>
SOAPSender¶
-
public abstract class
SOAPSender
extends Component implements Runnable¶ The
SOAPSender
is a abstract class for the SOAP-Based protocol client. It reduces the complexity and version incompatible induced from the apache AXIS by using only Built-in java SOAP XML Package. The target developer is for those whose are not familiar with the complex AXIS framework. It is implemented using the event-driven model so that developer are only required to implement several event method. The package is under development and will be standardized in the future release.Author: Twinsen Tsang
Fields¶
log¶
-
protected FileLogger
log
¶ The logger used for log message and exception
See also:
hk.hku.cecid.corvus.util.FileLogger
request¶
-
protected SOAPMessage
request
¶ The SOAP request
response¶
-
protected SOAPMessage
response
¶ The SOAP response
Constructors¶
SOAPSender¶
-
public
SOAPSender
()¶ SPA Constructor. It is used when the SOAP Sender is a component in the spa.
SOAPSender¶
-
public
SOAPSender
(FileLogger l, Data d)¶ Constructor
Parameters: - l – The logger used for log message and exception.
SOAPSender¶
-
public
SOAPSender
(FileLogger l, Data d, String endpoint)¶ Constructor
Parameters: - l – The logger used for log message and exception.
- endpoint – The url of service end point.
SOAPSender¶
-
public
SOAPSender
(FileLogger l, Data d, URL endpoint)¶ Constructor.
Parameters: - l – The logger used for log message and exception.
- endpoint – The url of service end point.
Methods¶
addRequestElementText¶
-
public boolean
addRequestElementText
(String tagName, String tagValue, String nsPrefix, String nsURI)¶ Add SOAP element to body with name and value.
Parameters: - tagName – The tag name of element to be retrieved.
- tagValue – The value of the element to be added.
- nsPrefix – The namespace Prefix
- nsURI – The namespace URI.
Throws: - SOAPException –
Returns: true if the creation and addition is successfully.
addRequestElementText¶
-
public boolean
addRequestElementText
(String parentTagName, String parentNsURI, String tagName, String tagValue, String nsPrefix, String nsURI)¶ Add SOAP element to specify parent element
Parameters: - parentTagName – The tag name of parent element.
- parentNsURI – The namespace URI of parent element.
- tagName – The tag name of element to be retrieved.
- tagValue – The value of the element to be added.
- nsPrefix – The namespace Prefix
- nsURI – The namespace URI.
Throws: - SOAPException –
Returns: true if the creation and linking is successfully.
countResponseElementText¶
-
public int
countResponseElementText
(String tagname, String nsURI)¶ This methods count number of specified
tagname
in the response. It should only be called insideonResponse()
.Parameters: - tagname – The tag name of element to be retrieved.
- nsURI – The namespace URI.
Throws: - SOAPException –
Returns: The element text in the tagname specified.
getCurrentLoopTimes¶
-
public int
getCurrentLoopTimes
()¶ Get what is the current loop times for looping
getRequestElementText¶
-
public String
getRequestElementText
(String tagname, String nsURI, int whichOne)¶ This method should only be called inside
onCreateRequest()
. because the request object will be deleted upon each ws call.Parameters: - tagname – The tag name of element to be retrieved.
- nsURI – The namespace URI.
- whichOne – The nth child element to be returned.
getResponseElementAsList¶
-
public String[]
getResponseElementAsList
(String tagname, String nsURI)¶ This method should only be called inside
onResponse()
. because the response object will be deleted upon each ws call. This method get the element by it’stagname
and return a list of text value inside.Parameters: - tagname – The name of the XML tag to be extraceted.
- nsURI – The namespace URI.
Throws: - SOAPException –
Returns: The elements’ text in the tagname specified.
getResponseElementText¶
-
public String
getResponseElementText
(String tagname, String nsURI, int whichOne)¶ This method should only be called inside
onResponse()
. because the response object will be deleted upon each ws call.Parameters: - tagname – The tag name of element to be retrieved.
- nsURI – The namespace URI.
- whichOne – The nth child element to be returned.
Returns: The element text in the tagname specified.
getSOAPRequest¶
-
protected SOAPMessage
getSOAPRequest
()¶ Get the SOAP request.
Returns: The SOAP Request Body.
getSOAPResponse¶
-
protected SOAPMessage
getSOAPResponse
()¶ Get the SOAP response. The method should only be called inside
onResponse()
.Returns: The SOAP Response Body.
getServiceEndPoint¶
initializeMessage¶
-
public void
initializeMessage
()¶ Implements this method if you want to send messages without much different between other message to sent.
isRequireXMLDeclaraction¶
-
public boolean
isRequireXMLDeclaraction
()¶ return return true if the request requires the XML declaration to sent.
onBeforeRequest¶
-
public void
onBeforeRequest
(SOAPConnection conn, SOAPMessage request)¶ [@EVENT] This method is invoked just before sending the request to Web service endpoints.
Parameters: - conn – The SOAP Connection used for sending SOAP request.
- request – The request created by
onCreateRequest()
.
Throws: - Exception – Any type of exception will be processed at onError(throwable t).
onCreateRequest¶
-
public SOAPMessage
onCreateRequest
()¶ [@EVENT] This method is invoked when the sender is required to sent a SOAP Request for configuration. The default return value is the request in the sender. If developer want to send a custom SOAP request other than the sender SOAP request, override the function and return your customizing SOAP Request. For example, if you want to send a SOAP request always with soap element “test”. Then you should override this function called.
public SOAPMessage onCreateRequest() throws Exception{ SOAPMessage request = MessageFactory.newInstance().createMessage(); .. .. add the element "test". return request; }
Throws: - Exception – Any type of exception will be processed at onError(throwable t).
Returns: javax.xml.SOAPMessage
onEachLoopStart¶
onError¶
onResponse¶
-
public void
onResponse
()¶ [@EVENT] This method is invoked when received the reply SOAP response from the server Developer can use
getSOAPResponse()
to get the SOAP response for self-handling. Otherwise, developer can usegetResponseElementText(String,String,int)
to get the response element text from the response object.Throws: - Exception – Any type of exception will be processed at onError(throwable t).
onStart¶
-
public void
onStart
()¶ [@EVENT] This method is invoked when the sender begins to execute the run method.
resetSOAPRequest¶
-
protected void
resetSOAPRequest
()¶ Reset the request to empty SOAP Body. It is commonly used when for each loop times the request
Throws: - SOAPException –
resetSOAPResponse¶
-
protected void
resetSOAPResponse
()¶ Reset the request to empty SOAP Body. It is commonly used when for each loop times the response.
setBasicAuthentication¶
setLoopTimes¶
-
public void
setLoopTimes
(int loopTimes)¶ Set how many times should the sender to be send.
Parameters: - loopTimes – the new loopTimes.
setRequestDirty¶
-
public void
setRequestDirty
(boolean dirty)¶ Set if the request is dirty. We considered “dirty” as the request has been modified by someone during last sending.
setRequireXMLDeclaraction¶
-
public void
setRequireXMLDeclaraction
(boolean require)¶ Set if the request requires XML declaration at the top of the request. This is equivalent to:
SOAPRequest.setProperty(WRITE_XML_DECLARATION, "true");
Parameters: - require – true if requires XML declaration.
See also:
javax.xml.soap.SOAPMessage.setProperty(String,Object)
,javax.xml.soap.SOAPMessage.WRITE_XML_DECLARATION
setServiceEndPoint¶
setServiceEndPoint¶
setUserObject¶
transformResponseContent¶
-
public PropertyTree
transformResponseContent
()¶ Transform the response into a property tree. It should only be called inside
onResponse()
.Returns: An XML Property tree having the same tag content in the response.
hk.hku.cecid.corvus.ws.data¶
AS2AdminData¶
-
public class
AS2AdminData
extends AdminData¶ The
EBMSAdminData
is data structure for holding the administration data for EbMS plugin.Author: Twinsen Tsang
Constructors¶
AS2AdminData¶
-
public
AS2AdminData
()¶ Create an instance of
EBMSAdminData
with default value.- Username : corvus
- Password : corvus
- Manage Partnership End-point : http://localhost:8080/corvus/admin/as2/partnership
- Envelop Query End-point : http://localhost:8080/corvus/admin/as2/repository
- Partnership Operation : 1
- Message Box Criteria: INBOX
- Message ID Criteria: changem-messageid
AS2ConfigData¶
-
public class
AS2ConfigData
extends KVPairData¶ The
AS2ConfigData
is the data structure representing the parameters set for as2 runtime configuration. This is the sample WSDL request for the message status WS request.<active-module-status> true | false </active-module-status> <inmessage-interval>15000</inmessage-interval> <inmessage-maxthread>0</inmessage-maxthread> <outmessage-interval>15000</outmessage-interval> <outmessage-maxthread>0</outmessage-maxthread> <outpayload-interval>15000</outpayload-interval> <outpayload-maxthread>0</outpayload-maxthread>
Author: Twinsen Tsang
Fields¶
CONFIG_KEY_SET¶
CONFIG_PREFIX¶
PARAM_KEY_SET¶
PARAM_PREFIX¶
stressMode¶
-
public boolean
stressMode
¶ This is special flag for stress test mode. In stress test mode, messages are bumped into Hermes2 before start processing. so we need to switch off the active module before bumping the message. and restart after bumping. At the result, we need a flag for switch on / off active task module.
Methods¶
getActiveModuleStatus¶
getActiveModuleStatusBn¶
-
public boolean
getActiveModuleStatusBn
()¶ Returns: Get the boolean value for ths active module status wanted to set for this data.
getInMessageExecInterval¶
getInMessageMaxThread¶
getOutMessageExecInterval¶
getOutMessageMaxThread¶
getOutPayloadExecInterval¶
getOutPayloadMaxThread¶
getSendEndpoint¶
setActiveModuleStatus¶
-
public void
setActiveModuleStatus
(boolean newStatus)¶ Set the new active module status wanted for this data.
Parameters: - newStatus – the new active module status wanted for this data.
setInMessageExecInterval¶
-
public void
setInMessageExecInterval
(long newInterval)¶ Parameters: - newInterval – the new execution interval for incoming message for this data.
setInMessageMaxThread¶
-
public void
setInMessageMaxThread
(long maxThread)¶ Parameters: - maxThread – the maximum thread for incoming message for this data.
setOutMessageExecInterval¶
-
public void
setOutMessageExecInterval
(long newInterval)¶ Parameters: - newInterval – the new execution interval for outgoing message for this data.
setOutMessageMaxThread¶
-
public void
setOutMessageMaxThread
(long maxThread)¶ Parameters: - maxThread – the maximum thread for outgoing message for this data.
setOutPayloadExecInterval¶
-
public void
setOutPayloadExecInterval
(long newInterval)¶ Parameters: - newInterval – the new execution interval for outgoing payload for this data.
AS2MessageData¶
-
public class
AS2MessageData
extends KVPairData¶ The
AS2MessageData
is the data structure representing the parameters set for sending as2 messagw with payload to Hermes2. This is the sample WSDL request for the message status WS request.<as2_from>as2loopback</as2_from> <as2_to>as2loopback</as2_to> <type>xml</type>
The first three parameters are derived from
AS2PartnershipData.getAS2From()
andAS2PartnershipData.getAs2To()
.Author: Twinsen Tsang
AS2MessageHistoryRequestData¶
-
public class
AS2MessageHistoryRequestData
extends MessageHistoryRequestData¶
Fields¶
Methods¶
AS2PartnershipData¶
-
public class
AS2PartnershipData
extends KVPairData¶ The
AS2PartnershipData
isAuthor: Twinsen Tsang
Methods¶
getPartnershipId¶
getRecipientAddress¶
isInboundEncryptRequired¶
-
public boolean
isInboundEncryptRequired
()¶ Returns: true if inbound encryption is required.
isInboundSignRequired¶
-
public boolean
isInboundSignRequired
()¶ Returns: true if inbound signing is required.
isOutboundCompressRequired¶
-
public boolean
isOutboundCompressRequired
()¶ Returns: true if outbound compression is required.
isOutboundEncryptRequired¶
-
public boolean
isOutboundEncryptRequired
()¶ Returns: true if outbound encryption is required.
isOutboundSignRequired¶
-
public boolean
isOutboundSignRequired
()¶ Returns: True if outbound signing is required.
isReceiptSignRequired¶
-
public boolean
isReceiptSignRequired
()¶ Returns: true if receipt signing is required.
setEncryptAlgorithm¶
setEncryptCert¶
-
public void
setEncryptCert
(byte[] encryptCert)¶ Parameters: - encryptCert – encryption certificate in byte array.
setIsDisabled¶
-
public void
setIsDisabled
(boolean isDisabled)¶ Set the partnership is enabled or not.
Parameters: - isDisabled – the flag whether the partnership is enabled or not.
setIsHostnameVerified¶
-
public void
setIsHostnameVerified
(boolean isHostnameVerified)¶ Parameters: - isHostnameVerified – true if the hostname is verified.
setIsInboundEncryptRequired¶
-
public void
setIsInboundEncryptRequired
(boolean isInboundEncryptRequired)¶ Parameters: - isInboundEncryptRequired – true if inbound encrpytion is required.
setIsInboundSignRequired¶
-
public void
setIsInboundSignRequired
(boolean isInboundSignRequired)¶ Parameters: - isInboundSignRequired – true if inbound signing is required.
setIsOutboundCompressRequired¶
-
public void
setIsOutboundCompressRequired
(boolean isOutboundCompressRequired)¶ Parameters: - isOutboundCompressRequired – true if outbound compression is required.
setIsOutboundEncryptRequired¶
-
public void
setIsOutboundEncryptRequired
(boolean isOutboundEncryptRequired)¶ Parameters: - isOutboundEncryptRequired – true if outbound encryption is required.
setIsOutboundSignRequired¶
-
public void
setIsOutboundSignRequired
(boolean isOutboundSignRequired)¶ Parameters: - isOutboundSignRequired – true if outbound signing is required.
setIsReceiptRequired¶
-
public void
setIsReceiptRequired
(boolean isReceiptRequired)¶ Parameters: - isReceiptRequired – true if receipt required.
setIsReceiptSignRequired¶
-
public void
setIsReceiptSignRequired
(boolean isReceiptSignRequired)¶ Parameters: - isReceiptSignRequired – true if receipt signing is required.
setIsSyncReply¶
-
public void
setIsSyncReply
(boolean isSyncReply)¶ Set the message require sync reply
Parameters: - isSyncReply –
setMicAlgorithm¶
setPartnershipId¶
setReceiptAddress¶
setRecipientAddress¶
setRetryInterval¶
-
public void
setRetryInterval
(int retryInterval)¶ Parameters: - retryInterval – retries interval.
setSignAlgorithm¶
setSubject¶
AS2StatusQueryData¶
-
public class
AS2StatusQueryData
extends CorvusStatusQueryData¶ The
AS2StatusQueryData
is the data structure representing the request parameter set for AS2 Status Query web services. This is the sample WSDL request for the status query WS request.<messageId> 20070418-124233-75006@147.8.177.42 </messageId>
Creation Date: 10/05/2007
Author: Twinsen Tsang
AS2StatusQueryResponseData¶
-
public class
AS2StatusQueryResponseData
extends CorvusStatusQueryResponseData¶ The
AS2StatusQueryResponseData
is the data structure representing the response data set for EBMS status query web services. This is the sample WSDL request for the status query WS request.<status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <mdnMessageId> The message id of acknowledgment / receipt if any </ackMessageId> <mdnStatus> The status of acknowledgment / receipt if any </ackStatus> <mdnStatusDescription> The status description of acknowledgment / receipt if any </ackStatusDescription>
Creation Date: 10/05/2007
Author: Twinsen Tsang
Fields¶
AdminData¶
-
abstract class
AdminData
extends KVPairData¶ The
AdminData
isAuthor: Twinsen Tsang
Fields¶
CONFIG_KEY_SET¶
PARAM_KEY_SET¶
-
public static final String[]
PARAM_KEY_SET
¶ For consistent, used for
DataFactory.createEBMSAdminDataFromXML(hk.hku.cecid.piazza.commons.util.PropertyTree)
Methods¶
getEnvelopQueryEndpoint¶
getManagePartnershipEndpoint¶
getMessageBoxCriteria¶
getMessageIdCriteria¶
getPartnershipOperation¶
-
public int
getPartnershipOperation
()¶ [USED ONLY BY PartnershipSender]
Throws: - NumberFormatException – If the data format of the value of partnership operation is invalid.
Returns: The partnership operation you have set, either 0, 1, 2.
getPassword¶
-
public char[]
getPassword
()¶ Returns: The password for authenticate the administrator page.
getUsername¶
setEnvelopQueryEndpoint¶
setManagePartnershipEndpoint¶
setMessageBoxCriteria¶
setMessageIdCriteria¶
setPartnershipOperation¶
-
public void
setPartnershipOperation
(int pOp)¶ [USED ONLY BY PartnershipSender]
Parameters: - pOp – The partnership operation you want to set, either 0, 1, 2.
See also:
hk.hku.cecid.corvus.http.PartnershipOp
,hk.hku.cecid.corvus.http.EBMSPartnershipSender
setPassword¶
CorvusStatusQueryData¶
-
public class
CorvusStatusQueryData
extends KVPairData¶ The
CorvusStatusQueryData
is the data structure representing the parameters set for status query web services for all protocol using Corvus level. This is the sample WSDL request for the status query WS request.<messageId> 20070418-124233-75006@147.8.177.42 </messageId>
Creation Date: 2/5/2007
Author: Twinsen Tsang
Constructors¶
CorvusStatusQueryResponseData¶
-
public class
CorvusStatusQueryResponseData
extends KVPairData¶ The
CorvusStatusQueryResponseData
is the data structure representing the general response data set for status query web services in corvus level. This is the sample WSDL request for the status query WS request.<status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <ackMessageId> The message id of acknowledgment / receipt if any </ackMessageId> <ackStatus> The status of acknowledgment / receipt if any </ackStatus> <ackStatusDescription> The status description of acknowledgment / receipt if any </ackStatusDescription>
Creation Date: 10/05/2007
Author: Twinsen Tsang
Constructors¶
DataFactory¶
-
public class
DataFactory
¶ A
DataFactory
imports data from the XML property tree to create different data object used for sending web service request. Creation Date: 19/3/2007Author: Twinsen Tsang
Fields¶
XML_SEPARATOR¶
-
public static final char
XML_SEPARATOR
¶ The constants representing the XML Separator *
instance¶
-
public static final DataFactory
instance
¶ Singleton.
Methods¶
createAS2AdminDataFromXML¶
-
public AS2AdminData
createAS2AdminDataFromXML
(PropertyTree t)¶ Create an instance of
AS2AdminData
from the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
AS2AdminData
with data imported from the property tree.
createAS2ConfigDataFromXML¶
-
public AS2ConfigData
createAS2ConfigDataFromXML
(PropertyTree t)¶ Create an instance of
AS2ConfigData
From the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
AS2ConfigData
with data imported from the property tree.
createAS2MessageDataFromXML¶
-
public AS2MessageData
createAS2MessageDataFromXML
(PropertyTree t)¶ Create an instance of
AS2MessageData
from the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
AS2MessageData
with data imported from the property tree.
createAS2PartnershipFromXML¶
-
public AS2PartnershipData
createAS2PartnershipFromXML
(PropertyTree t)¶ Create an instance of
AS2PartnershipData
From the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
AS2PartnershipData
with data imported from the property tree.
createAS2PermitRedownloadDataFromXML¶
-
public PermitRedownloadData
createAS2PermitRedownloadDataFromXML
(PropertyTree t)¶
createAS2StatusQueryDataFromXML¶
-
public AS2StatusQueryData
createAS2StatusQueryDataFromXML
(PropertyTree t)¶ Create an instance of
AS2StatusQueryData
From the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
AS2StatusQueryData
with data imported from the property tree.
createAs2MessageHistoryQueryDataFromXML¶
-
public AS2MessageHistoryRequestData
createAs2MessageHistoryQueryDataFromXML
(PropertyTree t)¶ Create an instance of
AS2MessageHistoryRequestData
from the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
AS2MessageHistoryRequestData
with data imported from the property tree.
createEBMSAdminDataFromXML¶
-
public EBMSAdminData
createEBMSAdminDataFromXML
(PropertyTree t)¶ Create an instance of
EBMSAdminData
from the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
EBMSAdminData
with data imported from the property tree.
createEBMSConfigDataFromXML¶
-
public EBMSConfigData
createEBMSConfigDataFromXML
(PropertyTree t)¶ Create an instance of
EBMSConfigData
From the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
EBMSConfigData
with data imported from the property tree.
createEBMSMessageDataFromXML¶
-
public EBMSMessageData
createEBMSMessageDataFromXML
(PropertyTree t)¶ Create an instance of
EBMSMessageData
from the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
EBMSMessageData
with data imported from the property tree.
createEBMSPartnershipFromXML¶
-
public EBMSPartnershipData
createEBMSPartnershipFromXML
(PropertyTree t)¶ Create an instance of
EBMSPartnershipData
From the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
EBMSPartnershipData
with data imported from the property tree.
createEBMSPermitRedownloadDataFromXML¶
-
public PermitRedownloadData
createEBMSPermitRedownloadDataFromXML
(PropertyTree t)¶
createEBMSStatusQueryDataFromXML¶
-
public EBMSStatusQueryData
createEBMSStatusQueryDataFromXML
(PropertyTree t)¶ Create an instance of
EBMSStatusQueryData
From the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
EBMSStatusQueryData
with data imported from the property tree.
createEbmsMessageHistoryQueryDataFromXML¶
-
public EBMSMessageHistoryRequestData
createEbmsMessageHistoryQueryDataFromXML
(PropertyTree t)¶ Create an instance of
EBMSMessageHistoryRequestData
from the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
EBMSMessageHistoryRequestData
with data imported from the property tree.
createMessageRequestStatusDataFromXML¶
-
public static MessageStatusRequestData
createMessageRequestStatusDataFromXML
(PropertyTree t)¶ Create an instance of
MessageStatusRequestData
From the XML property tree.Parameters: - t – The property tree to import the data.
Throws: - UtilitiesException – When the data factory is unable to import the data from the property tree.
Returns: A new instance of
MessageStatusRequestData
with data imported from the property tree.
createMessageStatusDataFromXML¶
-
public static MessageStatusRequestData
createMessageStatusDataFromXML
(String filename)¶ Create an instance of
MessageStatusRequestData
From a file written in XML format.Parameters: - filename – The file to load the message status request data.
Throws: - ComponentException – When unable to load the file or invalid file format.
Returns: A new instance of
MessageStatusRequestData
with data imported from the file with namefilename
createSFRMStatusQueryDataFromXML¶
-
public SFRMStatusQueryData
createSFRMStatusQueryDataFromXML
(PropertyTree t)¶ Create an instance of
SFRMStatusQueryData
From the XML property tree.Parameters: - t – The property tree to import the data.
Returns: A new instance of
SFRMStatusQueryData
with data imported from the property tree.
getInstance¶
-
public static DataFactory
getInstance
()¶ Singleton instance.
storeAS2MessageDataToXML¶
-
public void
storeAS2MessageDataToXML
(AS2MessageData d, URL path)¶ Store an instance of
AS2Message to XML.
Parameters: - d – The
AS2MessageData to store.
- path – The URL specified the location for storing the data.
Throws: - IOException – when storing the data fails.
- d – The
storeAS2PartnershipFromXML¶
-
public void
storeAS2PartnershipFromXML
(AS2PartnershipData d, URL path)¶ Store the instance of
AS2PartnershipData
to the XML specified atpath.
Parameters: - d – The
AS2PartnershipData
you want to store. - path – The URL specified the location for storing the data.
Throws: - IOException – when storing the data fails.
- d – The
storeEBMSMessageDataToXML¶
-
public void
storeEBMSMessageDataToXML
(EBMSMessageData d, URL path)¶ Store an instance of
EBMSMessage to XML.
Parameters: - d – The
AS2MessageData to store.
- path – The URL specified the location for storing the data.
Throws: - IOException – when storing the data fails.
- d – The
storeEBMSPartnershipFromXML¶
-
public void
storeEBMSPartnershipFromXML
(EBMSPartnershipData d, URL path)¶ Store the instance of
EBMSPartnershipData
to the XML specified atpath.
Parameters: - d – The
EBMSPartnershipData
you want to store. - path – The URL specified the location for storing the data.
Throws: - IOException – when storing the data fails.
- d – The
DataFactoryUnitTest¶
-
public class
DataFactoryUnitTest
extends TestCase¶ The
DataFactoryUnitTest
is unit test ofDataFactory
.Author: Twinsen Tsang
Fields¶
AS2_PARTNERSHIP_DATA_LOAD0¶
AS2_PARTNERSHIP_DATA_STORE0¶
EBMS_PARTNERSHIP_DATA_LOAD0¶
EBMS_PARTNERSHIP_DATA_STORE0¶
Methods¶
testCcreateEbmsMessageHistoryQueryDataFromXML¶
-
public void
testCcreateEbmsMessageHistoryQueryDataFromXML
()¶
testCreateAS2AdminData¶
-
public void
testCreateAS2AdminData
()¶ Test whether the DataFactory able to load AS2 Administrator Data from the fixture *
testCreateAS2PartnershipData¶
-
public void
testCreateAS2PartnershipData
()¶ Test whether the DataFactory able to create EBMS Partnership Data from the fixture *
testCreateEBMSAdminData¶
-
public void
testCreateEBMSAdminData
()¶ Test whether the DataFactory able to load EBMS Administrator Data from the fixture *
testCreateEBMSPartnershipData¶
-
public void
testCreateEBMSPartnershipData
()¶ Test whether the DataFactory able to create EBMS Partnership Data from the fixture *
testStoreAS2MessageData¶
-
public void
testStoreAS2MessageData
()¶ Test whether the DataFactory able to store AS2 Message Data to the fixture *
testStoreAS2PartnershipData¶
-
public void
testStoreAS2PartnershipData
()¶ Test whether the DataFactory able to store AS2 Partnership Data to the fixture *
EBMSAdminData¶
-
public class
EBMSAdminData
extends AdminData¶ The
EBMSAdminData
is data structure for holding the administration data for EbMS plugin.Author: Twinsen Tsang
Constructors¶
EBMSAdminData¶
-
public
EBMSAdminData
()¶ Create an instance of
EBMSAdminData
with default value.- User-name: corvus
- Password : corvus
- Manage Partnership End-point : http://localhost:8080/corvus/admin/ebms/partnership
- Envelop Query End-point : http://localhost:8080/corvus/admin/ebms/repository
- Partnership Operation : 1
- Message Box Criteria: INBOX
- Message ID Criteria: changme-messageid
EBMSConfigData¶
-
public class
EBMSConfigData
extends KVPairData¶ The
EBMSConfigData
is the data structure representing the parameters set for EbMS runtime configuration. This is the WSDL schema for the message status WS request.<active-module-status> true | false </active-module-status> <incollector-interval>15000</incollector-interval> <incollector-maxthread>0</incollector-maxthread> <outcollector-interval>15000</outcollector-interval> <outcollector-maxthread>0</outcollector-maxthread> <mailcollector-interval>15000</mailcollector-interval> <mailcollector-maxthread>0</mailcollector-maxthread>
Author: Twinsen
Methods¶
getActiveModuleStatus¶
getActiveModuleStatusBn¶
-
public boolean
getActiveModuleStatusBn
()¶ Returns: Get the boolean value for ths active module status wanted to set for this data.
getInCollectorExecInterval¶
getInCollectorMaxThread¶
getMailCollectorExecInterval¶
getMailCollectorMaxThread¶
getOutCollectorExecInterval¶
getOutCollectorMaxThread¶
getSendEndpoint¶
setActiveModuleStatus¶
-
public void
setActiveModuleStatus
(boolean newStatus)¶ Set the new active module status wanted for this data.
Parameters: - newStatus – the new active module status wanted for this data.
setInCollectorExecInterval¶
-
public void
setInCollectorExecInterval
(long newInterval)¶ Parameters: - newInterval – the new execution interval for incoming collector for this data.
setInCollectorMaxThread¶
-
public void
setInCollectorMaxThread
(long maxThread)¶ Parameters: - maxThread – the maximum thread for incoming message for this data.
setMailCollectorExecInterval¶
-
public void
setMailCollectorExecInterval
(long newInterval)¶ Parameters: - newInterval – the new execution interval for mail collector for this data.
setMailCollectorMaxThread¶
-
public void
setMailCollectorMaxThread
(long maxThread)¶ Parameters: - maxThread – the maximum thread for mail message for this data.
setOutCollectorExecInterval¶
-
public void
setOutCollectorExecInterval
(long newInterval)¶ Parameters: - newInterval – the new execution interval for outgoing collector for this data.
EBMSMessageData¶
-
public class
EBMSMessageData
extends KVPairData¶ The
EBMSMessageData
is the data structure representing the parameters set for sending ebms message with payload to Hermes2. This is the sample WSDL request for the sending EbMS message WS request. *<cpaId> ebmscpaid </cpaId> <service> http://localhost:8080/corvus/httpd/ebms/inbound <service> <action> action </action> <convId> convId </convId> <fromPartyId> fromPartyId </fromPartyId> <fromPartyType> fromPartyType </fromPartyType> <toPartyId> toPartyId </toPartyId> <toPartyType> toPartyType </toPartyType> <refToMessageId> </refToMessageId> <serviceType> </serviceType>
This is the sample WSDL request for the retrieve EbMS message WS request.*
<messageId> target-messageId </messageId>
The first three parameters are derived from
EBMSPartnershipData.getCpaId()
,EBMSPartnershipData.getService()
andEBMSPartnershipData.getAction()
Author: Twinsen Tsang
EBMSMessageHistoryRequestData¶
-
public class
EBMSMessageHistoryRequestData
extends MessageHistoryRequestData¶
Fields¶
Methods¶
EBMSPartnershipData¶
-
public class
EBMSPartnershipData
extends KVPairData¶ The
EBMSPartnershipData
is a duplicate-class data-structures for representing a EBMS partnership DVO object. It reduces the dependency from “corvus-ebms-core.jar” which changed quite frequently.Author: Twinsen Tsang
Methods¶
getAckSignRequested¶
getEncryptCert¶
-
public byte[]
getEncryptCert
()¶ Returns: The certificate for encryption in byte array.
getIsHostnameVerified¶
setAckRequested¶
setAckSignRequested¶
setDsAlgorithm¶
setDupElimination¶
setEncryptAlgorithm¶
setEncryptCert¶
-
public void
setEncryptCert
(byte[] encryptCert)¶ Parameters: - encryptCert – The certificate for encryption in byte array.
setEncryptRequested¶
setIsHostnameVerified¶
setMdAlgorithm¶
setMessageOrder¶
setPartnershipId¶
setPersistDuration¶
setRetryInterval¶
-
public void
setRetryInterval
(int retryInterval)¶ Parameters: - retryInterval – The retryInterval to set.
setSignCert¶
-
public void
setSignCert
(byte[] signCert)¶ Parameters: - signCert – The certificate for verification to set in byte array.
setSignRequested¶
setSyncReplyMode¶
setTransportEndpoint¶
EBMSStatusQueryData¶
-
public class
EBMSStatusQueryData
extends CorvusStatusQueryData¶ The
EBMSStatusQueryData
is the data structure representing the request parameter set for EBMS Status Query web services. This is the sample WSDL request for the status query WS request.<messageId> 20070418-124233-75006@147.8.177.42 </messageId>
Creation Date: 10/05/2007
Author: Twinsen Tsang
EBMSStatusQueryResponseData¶
-
public class
EBMSStatusQueryResponseData
extends CorvusStatusQueryResponseData¶ The
EBMSStatusQueryResponseData
is the data structure representing the response data set for EBMS status query web services. This is the sample WSDL request for the status query WS request.<status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <ackMessageId> The message id of acknowledgment / receipt if any </ackMessageId> <ackStatus> The status of acknowledgment / receipt if any </ackStatus> <ackStatusDescription> The status description of acknowledgment / receipt if any </ackStatusDescription>
Creation Date: 10/05/2007
Author: Twinsen Tsang
Fields¶
KVPairData¶
-
public class
KVPairData
implements Data¶ The
KVPairData
is a simple data structures for storing key-valued style data. It is implemented based onjava.util.Map
. You can define the max capacity through the constructor so that the internal data does not need to rehash when there is not enough room. Creation Date: 21/3/2007Author: Twinsen Tsang
Constructors¶
MessageHistoryRequestData¶
-
public class
MessageHistoryRequestData
extends KVPairData¶
Fields¶
PARAM_KEY_SET¶
-
public static final String[]
PARAM_KEY_SET
¶ For consistent, used for
DataFactory.createEBMSAdminDataFromXML(hk.hku.cecid.piazza.commons.util.PropertyTree)
MessageStatusRequestData¶
-
public class
MessageStatusRequestData
extends KVPairData¶ The
MessageStatusRequestData
is the data structures representing the parameters set for message status request query. This is the WSDL schema for the message status WS request.<xs:sequence> <xs:element name="partnershipId" type="xs:string" minOccurs="0"/> <xs:element name="channelType" type="xs:string" minOccurs="0"/> <xs:element name="channelId" type="xs:string" minOccurs="0"/> <xs:element name="folderName" type="xs:string" minOccurs="0"/> <xs:element name="fileName" type="xs:string" minOccurs="0"/> <xs:element name="fromTimestamp" type="xs:dateTime" minOccurs="0"/> <xs:element name="toTimestamp" type="xs:dateTime" minOccurs="0"/> <xs:element name="numOfRecords" type="xs:integer" minOccurs="0"/> <xs:element name="conversationId" type="xs:string" minOccurs="0"/> <xs:element name="messageId" type="xs:string" minOccurs="0"/> <xs:element name="messageType" type="xs:string" minOccurs="0"/> <xs:element name="messageStatus" type="xs:string" minOccurs="0"/> <xs:element name="protocol" type="xs:string" minOccurs="0"/> <xs:element name="locale" type="xs:string" minOccurs="0"/> <xs:element name="levelOfDetails" type="xs:integer" minOccurs="0"/> <xs:element name="offset" type="xs:integer" minOccurs="0"/> </xs:sequence>
Creation Date: 12/3/2007
Author: Twinsen Tsang
Methods¶
getChannelId¶
getChannelType¶
getConversationId¶
getFileName¶
getFolderName¶
getFromTimestamp¶
getLevelOfDetails¶
-
public BigInteger
getLevelOfDetails
()¶ Gets the levelOfDetails value for this MessageStatusRequestData. The default value is 1.
Returns: levelOfDetails
getLocale¶
getMessageId¶
getMessageStatus¶
getMessageType¶
getNumOfRecords¶
-
public BigInteger
getNumOfRecords
()¶ Gets the numOfRecords value for this MessageStatusRequestData. The default value is 1.
Returns: numOfRecords
getOffset¶
-
public BigInteger
getOffset
()¶ Gets the offset value for this MessageStatusRequestData. The default value is 1.
Returns: offset
getPartnershipId¶
getProtocol¶
getToTimestamp¶
getUsername¶
getWSEndpoint¶
setChannelId¶
setChannelType¶
setConversationId¶
setFileName¶
setFolderName¶
setFromTimestamp¶
setLevelOfDetails¶
-
public void
setLevelOfDetails
(BigInteger levelOfDetails)¶ Sets the levelOfDetails value for this MessageStatusRequestData.
Parameters: - levelOfDetails –
setLocale¶
setMessageId¶
setMessageStatus¶
setMessageType¶
setNumOfRecords¶
-
public void
setNumOfRecords
(BigInteger numOfRecords)¶ Sets the numOfRecords value for this MessageStatusRequestData.
Parameters: - numOfRecords –
setOffset¶
-
public void
setOffset
(BigInteger offset)¶ Sets the offset value for this MessageStatusRequestData.
Parameters: - offset –
setPartnershipId¶
setProtocol¶
setToTimestamp¶
setUsername¶
setWSEndpoint¶
MessageStatusResponseData¶
-
public class
MessageStatusResponseData
extends KVPairData¶ The
MessageStatusResponseData
is the data structures representing the parameters set for the response in the message status requestquery. This is the WSDL schema for the message status WS request.<xs:complexType name="MessageInfo.Type"> <xs:sequence> <xs:element name="messageId" type="xs:string"/> <xs:element name="messageType" type="xs:string"/> <xs:element name="timestamp" type="xs:dateTime"/> <xs:element name="messageStatus" type="xs:string"/> <xs:element name="messageDetail" type="xs:string" minOccurs="0"/> <xs:element name="partnershipId" type="xs:string" minOccurs="0"/> <xs:element name="channelType" type="xs:string" minOccurs="0"/> <xs:element name="channelId" type="xs:string" minOccurs="0"/> <xs:element name="folderName" type="xs:string" minOccurs="0"/> <xs:element name="fileName" type="xs:string" minOccurs="0"/> <xs:element name="conversationId" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType>
Creation Date: 19/3/2007
Author: Twinsen Tsang
Fields¶
Methods¶
getChannelId¶
getChannelType¶
getConversationId¶
getFileName¶
getFolderName¶
getMessageDetail¶
getMessageId¶
getMessageStatus¶
getMessageType¶
getPartnershipId¶
getProperties¶
getTimestamp¶
setChannelId¶
setChannelType¶
setConversationId¶
setFileName¶
setFolderName¶
setMessageDetail¶
setMessageId¶
setMessageStatus¶
setMessageType¶
setPartnershipId¶
setProperties¶
setTimestamp¶
Payload¶
-
public class
Payload
implements Data¶ The Payload is a data object representing a payload in the SOAP message.
Author: Twinsen Tsang
Constructors¶
Payload¶
Payload¶
-
public
Payload
(InputStream inputStream, String contentType)¶ Parameters: - inputStream –
- contentType –
Methods¶
getInputStream¶
-
public InputStream
getInputStream
()¶ Returns: The input stream of the payload
setFilePath¶
SFRMStatusQueryData¶
-
public class
SFRMStatusQueryData
extends CorvusStatusQueryData¶ The
CorvusStatusQueryData
is the data structure representing the parameters set for status query web services for SFRM protocol using Corvus level. This is the sample WSDL request for the SFRM status query WS request.<messageId> 20070418-124233-75006@147.8.177.42 </messageId>
Creation Date: 2/5/2007 Creation Date: 02/05/2007
Author: Twinsen Tsang
SFRMStatusQueryResponseData¶
-
public class
SFRMStatusQueryResponseData
extends KVPairData¶ The
SFRMStatusQueryResponseData
is the data structure representing the response data set for SFRM Message Status Query serivce. This is the sample WSDL response for the SFRM status query WS request.<messageInfo> <status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <numberOfSegments> Maximum number of segments </numberOfSegments> <numberOfProcessedSegments> Number of processed segments </numberOfProcessedSegments> <lastUpdatedTime> The last updated timestamp </lastUpdatedTime> </messageInfo>
Creation Date: 10/5/2007
Author: Twinsen Tsang
Fields¶
Constructors¶
hk.hku.cecid.ebms.admin.listener¶
AgreementUploadPageletAdaptor¶
-
public class
AgreementUploadPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Fields¶
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
ChangeMessageStatusPageletAdaptor¶
-
public class
ChangeMessageStatusPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
EbmsPropertiesPageletAdaptor¶
-
public class
EbmsPropertiesPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
MessageHistoryOraclePageletAdaptor¶
-
public class
MessageHistoryOraclePageletAdaptor
extends MessageHistoryPageletAdaptor¶ Author: Donahue Sze
MessageHistoryPageletAdaptor¶
-
public class
MessageHistoryPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
PartnershipPageletAdaptor¶
-
public class
PartnershipPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
getHashtable¶
-
public Hashtable
getHashtable
(HttpServletRequest request)¶
RepositoryAdaptor¶
-
public class
RepositoryAdaptor
extends HttpRequestAdaptor¶ Author: Donahue Sze
Methods¶
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶
ResendAsNewAdapter¶
-
public class
ResendAsNewAdapter
extends AdminPageletAdaptor¶
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
hk.hku.cecid.ebms.handler¶
hk.hku.cecid.ebms.pkg¶
AckRequested¶
-
public class
AckRequested
extends HeaderElement¶ An ebXML
AckRequested
in the SOAP Header of aHeaderContainer
[ebMSS 6.3.1].Author: cyng
Fields¶
Constructors¶
AckRequested¶
-
AckRequested
(SOAPEnvelope soapEnvelope, boolean signed)¶ Constructs a
AckRequested
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which theAckRequested
element is added to. - signed – Indicates if a signed acknowledgement response is requested. True if a signed response is requested; false otherwise.
Throws: - SOAPException –
- soapEnvelope –
AckRequested¶
-
AckRequested
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs a
AckRequested
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which theAckRequested
element is added to. - soapElement –
SOAPElement
containing acknowledgement request.
Throws: - SOAPException –
- soapEnvelope –
Acknowledgment¶
-
public class
Acknowledgment
extends HeaderElement¶ An ebXML
Acknowledgment
in the SOAP Header of aHeaderContainer
[ebMSS 6.3.2].Author: cyng
Constructors¶
Acknowledgment¶
-
Acknowledgment
(SOAPEnvelope soapEnvelope, String timestamp, EbxmlMessage refToMessage, String fromPartyId, String fromPartyIdType)¶ Constructs an
Acknowledgment
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header container of which theAcknowledgement
is attached to. - timestamp – The time the message service handler received the message to be acknowledged.
- refToMessage – The message this acknowledgement response is referring to.
- fromPartyId – The identifier of the party generating the acknowledgement response message.
- fromPartyIdType – PartyId type
Throws: - SOAPException –
- soapEnvelope –
Acknowledgment¶
-
Acknowledgment
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs an
Acknowledgement
object by parsing the givenSOAPElement
.Parameters: - soapEnvelope –
SOAPEnvelope
, the header container of which theAcknowledgement
is attached to. - soapElement –
SOAPElement
containing acknowledgement response.
Throws: - SOAPException –
- soapEnvelope –
AttachmentDataSource¶
-
public class
AttachmentDataSource
implements DataSource¶ This is an implementation of
javax.activation.DataSource
that encapsulates attachment data in a SOAP message.Author: cyng
Constructors¶
AttachmentDataSource¶
AttachmentDataSource¶
-
public
AttachmentDataSource
(byte[] data, String contentType, String name)¶ Constructs an
AttachmentDataSource
object from an array of binary data, and assign a name to the data source.Parameters: - data – Byte array containing data for the
AttachmentDataSource
- contentType – Content type of the data.
- name – Name assigned to the
AttachmentDataSource
- data – Byte array containing data for the
AttachmentDataSource¶
-
public
AttachmentDataSource
(byte[] data, String contentType, String encoding, String name)¶ Constructs an
AttachmentDataSource
object from an array of binary data, and assign a name to the data source.Parameters: - data – Byte array containing data for the
AttachmentDataSource
- contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
- name – Name assigned to the
AttachmentDataSource
- data – Byte array containing data for the
AttachmentDataSource¶
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, String contentType, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object from a file.Parameters: - fileName – Name of the file to be loaded.
- contentType – Content type of the file.
- loadToMem – Load all data to memory upon creation
Throws: - IOException –
AttachmentDataSource¶
AttachmentDataSource¶
-
public
AttachmentDataSource
(File file, String contentType, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object from aFile
object.Parameters: - file –
File
object containing information on the file to be loaded. - contentType – Content type of the file.
- loadToMem – Load all data to memory upon creation
Throws: - IOException –
- file –
AttachmentDataSource¶
-
public
AttachmentDataSource
(InputStream in, String contentType)¶ Constructs an
AttachmentDataSource
object from anInputStream
.Parameters: - in –
InputStream
from which the data is read and stored in the data source. - contentType – Content type of the data.
Throws: - IOException –
- in –
AttachmentDataSource¶
-
public
AttachmentDataSource
(InputStream in, String contentType, String name)¶ Constructs an
AttachmentDataSource
object from anInputStream
with a given name.Parameters: - in –
InputStream
from which the data is read and stored in the data source. - contentType – Content type of the data.
- name – Name assigned to the
AttachmentDataSource
.
Throws: - IOException –
- in –
AttachmentDataSource¶
-
public
AttachmentDataSource
(InputStream in, String contentType, String encoding, String name)¶ Constructs an
AttachmentDataSource
object from anInputStream
with the specified Content-Transfer-Encoding and name.Parameters: - in –
InputStream
from which the data is read and stored in the data source. - contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
- name – Name assigned to the
AttachmentDataSource
.
Throws: - IOException –
- in –
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
with the specified Content-Type.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
with the specified Content-Type.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
- loadToMem – Load all data to memory upon creation
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType, String encoding)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
. with the specified Content-Type and Content-Transfer-Encoding.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType, String encoding, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
. with the specified Content-Type and Content-Transfer-Encoding.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
- loadToMem – Load all data to memory upon creation
AttachmentDataSource¶
-
public
AttachmentDataSource
(DataSource dataSource, long offset, long length, String contentType, String encoding, boolean loadToMem)¶
Methods¶
getByteArray¶
-
public byte[]
getByteArray
()¶ Gets a byte array of data in this data source.
Returns: A byte array of data.
getContentType¶
getInputStream¶
-
public InputStream
getInputStream
()¶ Gets
InputStream
from which data in theAttachmentDataSource
can be read.Throws: - IOException –
Returns: An
InputStream
.
getLength¶
-
public long
getLength
()¶ Gets the length of data in this data source
Returns: length of data
getName¶
getOutputStream¶
-
public OutputStream
getOutputStream
()¶ This method should never be called. It implements the
getOutputStream()
method of thejavax.activation.DataSource
interface andIOException
will be thrown as the result of invocation.Throws: - IOException –
Returns: This method always result in
IOException
; it never returns normally.
AttachmentResolver¶
-
class
AttachmentResolver
extends ResourceResolverSpi¶ A
ResourceResolver
implementation used by Apache Security library. The URI in theReference
element of a digital signature points to some internal or external resources. ThisAttachmentResolver
is used to provide the resources in theEbxmlMessage
payload attachments and also theSOAPPart
itself with Reference URI=””.Author: cyng
Constructors¶
AttachmentResolver¶
-
AttachmentResolver
(EbxmlMessage ebxmlMessage)¶
BodyElement¶
-
class
BodyElement
extends ExtensionElementImpl¶ An
ExtensionElement
in the SOAP Body of aHeaderContainer
Author: cyng
Constructors¶
BodyElement¶
-
BodyElement
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
BodyElement¶
-
BodyElement
(SOAPEnvelope soapEnvelope, String localName)¶
Constants¶
-
public class
Constants
¶ This class serves as a bag containing all the constants that fall in the following criteria: (1) Related to property settings (2) Public strings (3) Previously public strings that are declared multiple times in various locations.
Author: Frankie Lam
EbxmlMessage¶
-
public class
EbxmlMessage
¶ A representation of an ebXML message. An ebXML message conforms to the ` SOAP 1.1 with Attachments Specification <http://www.w3.org/TR/2000/NOTE-SOAP-attachments-20001211>`_. This
EbxmlMessage
encapsulates ajavax.xml.soap.SOAPMessage
.Author: cyng
Fields¶
CHARACTER_SET_ENCODING¶
SOAP_ACTION_VALUE¶
SOAP_PART_CONTENT_ID¶
Constructors¶
EbxmlMessage¶
-
public
EbxmlMessage
()¶ Constructs an
EbxmlMessage
using the default JAXMMessageFactory
implementationThrows: - SOAPException – Description of the Exception
EbxmlMessage¶
-
public
EbxmlMessage
(MessageFactory messageFactory)¶ Constructs an
EbxmlMessage
using the providedjavax.xml.soap.MessageFactory
Parameters: - messageFactory –
MessageFactory
for creating message.
Throws: - SOAPException – Description of the Exception
- messageFactory –
EbxmlMessage¶
-
public
EbxmlMessage
(File file)¶ construct an
EbxmlMessage
from File using the logic in MessageServer. The file must not contain any content header like Content-TypeParameters: - file – the file contain the messsage.
Throws: - SOAPException – Description of the Exception
- IOException – Description of the Exception
EbxmlMessage¶
-
public
EbxmlMessage
(InputStream inputStream)¶ constructs an
EbxmlMessage
from InputStream using the logic in MessageServer. The input stream must not contain any content headers like Content-type.Parameters: - inputStream – Description of the Parameter
Throws: - SOAPException – Description of the Exception
- IOException – Description of the Exception
EbxmlMessage¶
-
public
EbxmlMessage
(SOAPMessage soapMessage)¶ Constructs an
EbxmlMessage
using the givenSOAPMessage
Parameters: - soapMessage –
Throws: - SOAPException – Description of the Exception
EbxmlMessage¶
-
public
EbxmlMessage
(MimeHeaders headers, InputStream in)¶ Constructs a
EbxmlMessage
using the givenInputStream
and default JAXMMessageFactory
implementationParameters: - headers – MIME headers to be included in the message.
- in – Message content in form of
InputStream
.
Throws: - IOException – Description of the Exception
- SOAPException – Description of the Exception
Methods¶
addAckRequested¶
-
public void
addAckRequested
(boolean signed)¶ Add acknowledgement request element to the message.
Parameters: - signed – The feature to be added to the AckRequested attribute
Throws: - SOAPException –
addAcknowledgment¶
-
public void
addAcknowledgment
(String timestamp, EbxmlMessage refToMessage)¶ Add acknowledgement element to the message using given timestamp, refToMessageId.
Parameters: - timestamp – Timestamp string expressed in UTC format.
- refToMessage – The feature to be added to the Acknowledgment attribute
Throws: - SOAPException – Description of the Exception
addAcknowledgment¶
-
public void
addAcknowledgment
(String timestamp, EbxmlMessage refToMessage, String fromPartyId)¶ Add acknowledgement element to the message using given timestamp, refToMessageId and fromPartyId.
Parameters: - timestamp – Timestamp string expressed in UTC format.
- fromPartyId – Sender party ID.
- refToMessage – The feature to be added to the Acknowledgment attribute
Throws: - SOAPException – Description of the Exception
addAcknowledgment¶
-
public void
addAcknowledgment
(String timestamp, EbxmlMessage refToMessage, String fromPartyId, String fromPartyIdType)¶ Add acknowledgement element to the message using given timestamp, refToMessageId, fromPartyId and fromPartyIdType.
Parameters: - timestamp – Timestamp string expressed in UTC format.
- fromPartyId – Sender party ID.
- fromPartyIdType – Sender party ID type.
- refToMessage – The feature to be added to the Acknowledgment attribute
Throws: - SOAPException – Description of the Exception
addErrorList¶
-
public void
addErrorList
(String errorCode, String severity, String description)¶ Add an error list to the message using given error code, severity and description.
Parameters: - errorCode – [ebMSS 4.2.3.4]
- severity – Valid values are “Error” and “Warning”.
- description – Description of the error.
Throws: - SOAPException – Description of the Exception
addErrorList¶
-
public void
addErrorList
(String errorCode, String severity, String description, String location)¶ Add an error list to the message using given error code, severity and description.
Parameters: - errorCode – [ebMSS 4.2.3.4]
- severity – Valid values are “Error” and “Warning”.
- description – Description of the error.
- location – Location of the message containing the error.
Throws: - SOAPException –
addMessageHeader¶
-
public MessageHeader
addMessageHeader
(String fromPartyId, String toPartyId, String cpaId, String conversationId, String service, String action, String messageId, String timestamp)¶ Adds a
MessageHeader
to thisEbxmlMessage
with the given mandatory fieldsParameters: - fromPartyId – Party ID of the sender [ebMSS 3.1.1.1]
- toPartyId – Party ID of the receiver [ebMSS 3.1.1.1]
- cpaId – CPA Id [ebMSS 3.1.2]
- conversationId – ID of the conversation in which this message is involved [ebMSS 3.1.3]
- service – Service name [ebMSS 3.1.4]
- action – Action name [ebMSS 3.1.5]
- messageId – Unique identifier of the message [ebMSS 3.1.6.1]
- timestamp – Date/time of the message header creation expressed as UTC [ebMSS 3.1.6.2]
Throws: - SOAPException – Description of the Exception
Returns: the newly added
MessageHeader
addMessageHeader¶
-
public MessageHeader
addMessageHeader
(String fromPartyId, String fromPartyIdType, String toPartyId, String toPartyIdType, String cpaId, String conversationId, String service, String action, String messageId, String timestamp)¶ Adds a
MessageHeader
to thisEbxmlMessage
with the given mandatory fieldsParameters: - fromPartyId – Party ID of the sender [ebMSS 3.1.1.1]
- fromPartyIdType – PartyID type of the sender [ebMSS 3.1.1.1]
- toPartyId – Party ID of the receiver [ebMSS 3.1.1.1]
- toPartyIdType – PartyID type of the receiver [ebMSS 3.1.1.1]
- cpaId – CPA Id [ebMSS 3.1.2]
- conversationId – ID of the conversation in which this message is involved [ebMSS 3.1.3]
- service – Service name [ebMSS 3.1.4]
- action – Action name [ebMSS 3.1.5]
- messageId – Unique identifier of the message [ebMSS 3.1.6.1]
- timestamp – Date/time of the message header creation expressed as UTC [ebMSS 3.1.6.2]
Throws: - SOAPException – Description of the Exception
Returns: the newly added
MessageHeader
addMessageHeader¶
-
public MessageHeader
addMessageHeader
()¶ Adds a default
MessageHeader
to thisEbxmlMessage
.Throws: - SOAPException –
Returns: the newly added
MessageHeader
addMessageOrder¶
-
public void
addMessageOrder
(int status, int sequenceNumber)¶ Add a MessageOrder element to the header.
Parameters: - status – Status of the sequence number. It should have the value of either MessageOrder.STATUS_RESET or MessageOrder.STATUS_CONTINUE.
- sequenceNumber – Sequence number to be assigned to this message.
Throws: - SOAPException – Description of the Exception
addPayloadContainer¶
-
public PayloadContainer
addPayloadContainer
(DataHandler dataHandler, String contentId, String description)¶ Add an ebXML message payload container.
Parameters: - dataHandler – the
DataHandler
that generates the payload content. - contentId – the contentId of this payload attachment. The contentId must be unique among all payload attachment.
- description – the description of this payload.
Throws: - SOAPException –
Returns: the
PayloadContainer
object that is created and added.- dataHandler – the
addStatusRequest¶
addStatusResponse¶
addStatusResponse¶
-
public void
addStatusResponse
(String refToMessageId, String messageStatus, String timestamp)¶ Add a status response element to the message.
Parameters: - refToMessageId – Identifier of the message it is referring to.
- messageStatus – Status string to be added in the response element.
- timestamp – Timestamp of the status response expressed in UTC format.
Throws: - SOAPException –
addSyncReply¶
-
public void
addSyncReply
()¶ Add a SyncReply element to the message.
Throws: - SOAPException –
getAckRequested¶
-
public AckRequested
getAckRequested
()¶ Get acknowledgement request element.
Returns: AckRequested
object representing the element.
getAcknowledgment¶
-
public Acknowledgment
getAcknowledgment
()¶ Get acknowledgement element.
Returns: Acknowledgement
object representing the element.
getDatasource¶
-
public DataSource
getDatasource
()¶ Returns: Returns the datasource.
getDuplicateElimination¶
-
public boolean
getDuplicateElimination
()¶ Gets the flag stating if duplicate elimination is enabled or not.
Returns: true if duplicate elimination is required; false otherwise.
getErrorList¶
getFileName¶
getFromPartyIds¶
getHeaderContainer¶
-
public HeaderContainer
getHeaderContainer
()¶ Returns: Returns the headerContainer.
getManifest¶
getMessageFromDataSource¶
-
public static Object
getMessageFromDataSource
(DataSource dataSource, boolean withAttachments)¶
getMessageHeader¶
-
public MessageHeader
getMessageHeader
()¶ Get the message header of this ebXML message.
Returns: MessageHeader
of this ebXML message.
getMessageOrder¶
-
public MessageOrder
getMessageOrder
()¶ Get the message order element in the message.
Returns: MessageOrder
object if it exists in the ebXML message; null otherwise.
getMimeHeaders¶
getMimeHeaders¶
-
public Map
getMimeHeaders
(String soapEncoding, String payloadEncoding)¶ Gets the MIME headers of this ebXML message
Parameters: - soapEncoding – content transfer encoding to be applied to SOAP part when computing length
- payloadEncoding – content transfer encoding to be applied to payload when computing length
Throws: - IOException – Description of the Exception
- SOAPException – Description of the Exception
Returns: the MIME headers of this ebXML message
getPayloadContainer¶
-
public PayloadContainer
getPayloadContainer
(String contentId)¶ Gets the payload that is identified by the given content ID.
Parameters: - contentId – Content ID of the payload to be retrieved.
Returns: PayloadContainer
of the given content ID ornull
if no suchPayloadContainer
exists
getPayloadContainers¶
getPayloadCount¶
-
public int
getPayloadCount
()¶ Gets the number of payloads in this ebXML message
Returns: the number of payloads
getPayloadInError¶
getPersistenceHandler¶
getPersistenceName¶
getSOAPMessage¶
-
public SOAPMessage
getSOAPMessage
()¶ Gets the
SOAPMessage
encapsulated in thisEbxmlMessage
.Returns: SOAPMessage
representing thisEbxmlMessage
getSignatures¶
getSoapEnvelopeBytes¶
-
byte[]
getSoapEnvelopeBytes
()¶ Get the soap envelope in bytes. This function will only be used by the Hermes Server itself, and it is not expected for the client to call it.
getSoapEnvelopeBytesFromStream¶
-
public static byte[]
getSoapEnvelopeBytesFromStream
(InputStream stream)¶ parse the message from InputStream and get the byte array of SOAP Envelope
Parameters: - stream – the InputStream contains the message
Throws: - MessageServerException – throw if there is error on parsing
Returns: the byte array of the Soap Envelope
getStatusRequest¶
-
public StatusRequest
getStatusRequest
()¶ Get the status request element in the message.
Returns: Content of the status request element stored in StatusRequest
object.
getStatusResponse¶
-
public StatusResponse
getStatusResponse
()¶ Get the status response element in the message.
Returns: Content of the status response element stored in StatusResponse
object.
getSyncReply¶
-
public boolean
getSyncReply
()¶ Gets the flag stating if sync reply is enabled or not.
Returns: true if sync reply is enabled; false otherwise.
getTimeToLive¶
getTimestamp¶
getToPartyIds¶
saveChanges¶
-
public void
saveChanges
()¶ Updates the encapsulated
SOAPMessage
with all changes that have been made to it.Throws: - SOAPException –
See also:
javax.xml.soap.SOAPMessage.saveChanges()
saveRequired¶
-
public boolean
saveRequired
()¶ Indicates whether the encapsulated
SOAPMessage
need to be updated by callingsaveChanges
on it.Returns: true if it is required to call saveChanges on the message; false otherwise.
setFileName¶
setPayloadContainers¶
setPersistenceInfo¶
-
public void
setPersistenceInfo
(String persistenceName, Object handler, DataSource datasource)¶ set the persistence info to the message This function will only be used by the Hermes Server itself, and it is not expected for the client to call it.
Parameters: - persistenceName – the name on the persistence handler
- handler – the persistence handler
setSoapEnvelopeBytes¶
-
public void
setSoapEnvelopeBytes
(byte[] soapEnvelopeBytes)¶ set the soap envelope in bytes. Those bytes will be used to verify This function will only be used by the Hermes Server itself, and it is not expected for the client to call it. the signature.
writeTo¶
-
public void
writeTo
(OutputStream out)¶ Writes the encapsulated
SOAPMessage
to the given output stream. The externalization format is as defined by the SOAP 1.1 with Attachments Specification.Parameters: - out –
OutputStream
to write the message to.
Throws: - IOException – Description of the Exception
- SOAPException – Description of the Exception
- out –
writeTo¶
-
public void
writeTo
(OutputStream out, String soapEncoding, String payloadEncoding)¶ Writes the encapsulated
SOAPMessage
to the given output stream. The externalization format is as defined by the SOAP 1.1 with Attachments Specification.Parameters: - out –
OutputStream
to write the message to. - soapEncoding – Description of the Parameter
- payloadEncoding – Description of the Parameter
Throws: - IOException – Description of the Exception
- SOAPException – Description of the Exception
- out –
EbxmlMessageFactory¶
-
public class
EbxmlMessageFactory
extends MessageFactory¶ Implementation of
javax.xml.soap.MessageFactory
Author: cyng
Constructors¶
Methods¶
createEbxmlMessage¶
-
public EbxmlMessage
createEbxmlMessage
()¶ Create a simple ebXML message.
Throws: - SOAPException –
Returns: A new ebXML message.
createEbxmlMessage¶
-
public EbxmlMessage
createEbxmlMessage
(MimeHeaders headers, InputStream in)¶ Create an ebXML message with given MIME headers and content in form of input stream.
Parameters: - headers – MIME headers to be used in the new message.
- in – Content of ebXML message in the form of input stream.
Throws: - IOException –
- SOAPException –
Returns: EbxmlMessage
created.
createMessage¶
-
public SOAPMessage
createMessage
()¶ Creates a simple ebXML SOAP message.
Throws: - SOAPException –
Returns: SOAPMessage
of the ebXML message created.
createMessage¶
-
public SOAPMessage
createMessage
(MimeHeaders headers, InputStream in)¶ Creates an ebXML SOAP message using given MIME headers and content in form of input stream.
Parameters: - headers – MIME headers to be used in the new message.
- in – Content of ebXML message in the form of input stream.
Throws: - IOException –
- SOAPException –
Returns: SOAPMessage
of the ebXML message created.
Element¶
-
interface
Element
¶ Encapsulation of a
javax.xml.soap.SOAPElement
Author: cyng
ErrorList¶
-
public class
ErrorList
extends HeaderElement¶ An ebXML
ErrorList
in the SOAP Header of aHeaderContainer
Author: cyng
Fields¶
ATTRIBUTE_CODE_CONTEXT¶
ATTRIBUTE_ERROR_CODE¶
ATTRIBUTE_HIGHEST_SEVERITY¶
ATTRIBUTE_LOCATION¶
ATTRIBUTE_SEVERITY¶
CODE_DELIVERY_FAILURE¶
CODE_INCONSISTENT¶
CODE_MIME_PROBLEM¶
CODE_NOT_SUPPORTED¶
CODE_OTHER_XML¶
CODE_SECURITY_FAILURE¶
CODE_TIME_TO_LIVE_EXPIRED¶
CODE_VALUE_NOT_RECOGNIZED¶
Constructors¶
ErrorList¶
-
ErrorList
(SOAPEnvelope soapEnvelope, String errorCode, String severity, String description)¶ Constructs an
ErrorList
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which theErrorList
is added. - errorCode – Error code value of the error.
- severity – Severity of the error.
- description – Description of the error.
Throws: - SOAPException –
- soapEnvelope –
ErrorList¶
-
ErrorList
(SOAPEnvelope soapEnvelope, String errorCode, String severity, String description, String lang)¶ Constructs an
ErrorList
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which theErrorList
is added. - errorCode – Error code value of the error.
- severity – Severity of the error.
- description – Description of the error.
- lang – Language of the description specified in ` RFC 1766 <http://www.ietf.org/rfc/rfc1766.txt>`_ and ISO639.
Throws: - SOAPException –
- soapEnvelope –
ErrorList¶
-
ErrorList
(SOAPEnvelope soapEnvelope, String errorCode, String severity, String description, String lang, String location)¶ Constructs an
ErrorList
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which theErrorList
is added. - errorCode – Error code value of the error.
- severity – Severity of the error.
- description – Description of the error.
- lang – Language of the description specified in ` RFC 1766 <http://www.ietf.org/rfc/rfc1766.txt>`_ and ISO639.
Throws: - SOAPException –
- soapEnvelope –
ErrorList¶
-
ErrorList
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs an
ErrorList
object by parsing the givenSOAPElement
object.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which theErrorList
is added. - soapElement –
SOAPElement
object to be read into theErrorList
object.
Throws: - SOAPException –
- soapEnvelope –
Methods¶
addError¶
addError¶
-
public void
addError
(String errorCode, String severity, String description, String lang)¶ Add an element to the error list.
Parameters: - errorCode – Error code value.
- severity – Severity of the error.
- description – Description of the error.
- lang – Language of the description specified in ` RFC 1766 <http://www.ietf.org/rfc/rfc1766.txt>`_ and ISO639.
Throws: - SOAPException –
addError¶
-
public void
addError
(String errorCode, String severity, String description, String lang, String location)¶ Add an element to the error list.
Parameters: - errorCode – Error code value.
- severity – Severity of the error.
- description – Description of the error.
- lang – Language of the description specified in ` RFC 1766 <http://www.ietf.org/rfc/rfc1766.txt>`_ and ISO639.
- location – Location of the message containing error.
Throws: - SOAPException –
ErrorList.Error¶
-
public static final class
Error
¶ An
Error
inside anErrorList
Constructors¶
Error¶
-
Error
(String errorCode, String severity, Description description)¶ Initializes Error object using given error code, severity and description.
Parameters: - errorCode – Error code value. Please refer to [ebMSS 4.2.3.4.1] for a list of valid error codes.
- severity – Severity of the error reported.
- description – Human-readable description of error.
Error¶
-
Error
(String errorCode, String severity, Description description, String location)¶ Initializes Error object using given error code, severity and description.
Parameters: - errorCode – Error code value. Please refer to [ebMSS 4.2.3.4.1] for a list of valid error codes.
- severity – Severity of the error reported.
- description – Human-readable description of error.
- location – Location of the message containing the error.
ExtensionElement¶
Fields¶
ATTRIBUTE_SCHEMA_LOCATION¶
NAMESPACE_PREFIX_SOAP_ENVELOPE¶
NAMESPACE_PREFIX_XSI¶
NAMESPACE_URI_SOAP_ENVELOPE¶
SCHEMA_LOCATION_SOAP_BODY¶
SCHEMA_LOCATION_SOAP_ENVELOPE¶
SCHEMA_LOCATION_SOAP_HEADER¶
XML_NS_DECL_PREFIX¶
Methods¶
addAttribute¶
-
ExtensionElement
addAttribute
(String localName, String value)¶ Add an attribute whose namespace is the same as this
ExtensionElement
.
addAttribute¶
addChildElement¶
-
ExtensionElement
addChildElement
(String localName)¶ Add a child element without text node value and whose namespace is the same as this
ExtensionElement
, i.e., the parent.
addChildElement¶
-
ExtensionElement
addChildElement
(String localName, String value)¶ Add a child element with the specified value and whose namespace is the same as this
ExtensionElement
, i.e., the parent.
addChildElement¶
-
ExtensionElement
addChildElement
(String localName, String prefix, String uri)¶ Add a child element without text node value and with the specified namespace.
addChildElement¶
getAttributeValue¶
getAttributeValue¶
getChildElements¶
-
Iterator
getChildElements
(String localName)¶ Get all descendant child elements of the specified
localName
whose namespace is the same as thisExtensionElement
, in the order in which they are encountered in a preorder traversal of thisExtensionElement
tree. EachIterator
entry is in the form of anjavax.xml.soap.SOAPElement
.
ExtensionElementImpl¶
-
class
ExtensionElementImpl
implements ExtensionElement¶ An implementation of
ExtensionElement
.Author: cyng
Fields¶
soapEnvelope¶
-
protected final SOAPEnvelope
soapEnvelope
¶ The
javax.xml.soap.SOAPEnvelope
encapsulating thisExtensionElement
Constructors¶
ExtensionElementImpl¶
-
ExtensionElementImpl
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Construct an
ExtensionElement
using the givenSOAPEnvelope
andSOAPElement
ExtensionElementImpl¶
-
ExtensionElementImpl
(SOAPEnvelope soapEnvelope, String localName, boolean isHeaderElement)¶ Construct an
ExtensionElement
using the givenSOAPEnvelope
and whose namespace and URI are equal to that of SOAP extension element as defined in ebXML Messaging Service Specification
ExtensionElementImpl¶
-
ExtensionElementImpl
(SOAPEnvelope soapEnvelope, String localName, String prefix, String uri, boolean isHeaderElement, boolean createSOAPElement)¶ Construct an
ExtensionElement
using the givenSOAPEnvelope
and the specified namespace and URI. Change the default namespace and URI of thisExtensionElement
to the new one so that subsequent added children elements will inherit the new namespace and URI.
Methods¶
addAttribute¶
-
public ExtensionElement
addAttribute
(String localName, String value)¶ Add an attribute whose namespace is the same as this
ExtensionElement
addAttribute¶
addAttribute¶
addChildElement¶
-
public ExtensionElement
addChildElement
(String localName)¶ Add a child element without text node value and whose namespace is the same as this
ExtensionElement
, i.e., the parent
addChildElement¶
-
public ExtensionElement
addChildElement
(String localName, String value)¶ Add a child element with the specified value and whose namespace is the same as this
ExtensionElement
, i.e., the parent
addChildElement¶
-
public ExtensionElement
addChildElement
(String localName, String prefix, String uri)¶ Add a child element without text node value and with the specified namespace
addChildElement¶
-
public ExtensionElement
addChildElement
(String localName, String prefix, String uri, String value)¶ Add a child element with the specified value and namespace. Change the default namespace and URI of this
ExtensionElement
to the new one so that subsequent added children elements will inherit the new namespace and URI.
getAllAttributes¶
getAttributeValue¶
getAttributeValue¶
getAttributeValue¶
getChildElements¶
-
public Iterator
getChildElements
(String localName)¶ Get all descendant child elements of the specified
localName
whose namespace is the same as thisExtensionElement
, in the order in which they are encountered in a preorder traversal of thisExtensionElement
tree. EachIterator
entry is in the form of anjavax.xml.soap.SOAPElement
.
getChildElements¶
getChildElements¶
getSOAPElement¶
-
public SOAPElement
getSOAPElement
()¶ Return the
javax.xml.soap.SOAPElement
representation of thisElement
HeaderContainer¶
-
class
HeaderContainer
¶ An encapsulation of the Header Container of an
EbxmlMessage
.Author: cyng
Constructors¶
Methods¶
addExtensionElement¶
-
void
addExtensionElement
(ExtensionElement extensionElement)¶ Add an
ExtensionElement
, e.g.MessageHeader
(aHeaderElement
) orManifest
(aBodyElement
), to thisHeaderContainer
getAckRequested¶
-
AckRequested
getAckRequested
()¶
getAcknowledgment¶
-
Acknowledgment
getAcknowledgment
()¶
getMessageHeader¶
-
MessageHeader
getMessageHeader
()¶
getMessageOrder¶
-
MessageOrder
getMessageOrder
()¶
getStatusRequest¶
-
StatusRequest
getStatusRequest
()¶
getStatusResponse¶
-
StatusResponse
getStatusResponse
()¶
HeaderElement¶
-
class
HeaderElement
extends ExtensionElementImpl¶ An
ExtensionElement
in the SOAP Header of aHeaderContainer
Author: cyng
Fields¶
Constructors¶
HeaderElement¶
-
HeaderElement
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
HeaderElement¶
-
HeaderElement
(SOAPEnvelope soapEnvelope, String localName)¶
Manifest¶
-
public class
Manifest
extends BodyElement¶ An ebXML
Manifest
in the SOAP Body of aHeaderContainer
Author: cyng
Constructors¶
Manifest¶
-
Manifest
(SOAPEnvelope soapEnvelope)¶ Constructs a
Manifest
Manifest¶
-
Manifest
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
MessageHeader¶
-
public class
MessageHeader
extends HeaderElement¶ An ebXML
MessageHeader
in the SOAP Header of aHeaderContainer
Author: cyng
Fields¶
ELEMENT_CONVERSATION_ID¶
ELEMENT_DUPLICATE_ELIMINATION¶
ELEMENT_MESSAGE_DATA¶
ELEMENT_REF_TO_MESSAGE_ID¶
ELEMENT_TIME_TO_LIVE¶
Constructors¶
MessageHeader¶
-
MessageHeader
(SOAPEnvelope soapEnvelope)¶ Initializes data structures in
MessageHeader
object using the givenSOAPEnvelope
.Parameters: - soapEnvelope –
SOAPEnvelope
into which theMessageHeader
is added.
Throws: - SOAPException –
- soapEnvelope –
MessageHeader¶
-
MessageHeader
(SOAPEnvelope soapEnvelope, String fromPartyId, String fromPartyIdType, String toPartyId, String toPartyIdType, String cpaId, String conversationId, String service, String action, String messageId, String timestamp)¶ Constructs a
MessageHeader
with the given mandatory fields. No further modification on the fields specified are allowed.Parameters: - soapEnvelope –
SOAPEnvelope
into which theMessageHeader
is added. - fromPartyId – PartyID of the sender.
- fromPartyIdType – PartyID type of the sender.
- toPartyId – PartyID of the recipient.
- toPartyIdType – PartyID type of the recipient.
- cpaId – CPA ID.
- conversationId – Conversation ID of the message.
- service – Service name.
- action – Action name.
- messageId – Unique message identifier.
- timestamp – Timestamp of the message header creation.
Throws: - SOAPException –
- soapEnvelope –
MessageHeader¶
-
MessageHeader
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs a
MessageHeader
with the givenSOAPEnvelope
andSOAPElement
.Parameters: - soapEnvelope –
SOAPEnvelope
into which theMessageHeader
is added. - soapElement –
SOAPElement
to be parsed and stored in the MessageHeader.
Throws: - SOAPException –
- soapEnvelope –
Methods¶
addDescription¶
addDescription¶
-
public void
addDescription
(String description, String lang)¶ Add element with specified
xml:lang
. This method can be called repeatedly to add several descriptions to theMessageHeader
Parameters: - description – Description to be added to
MessageHeader
- lang – Language of the description specified in ` RFC 1766 <http://www.ietf.org/rfc/rfc1766.txt>`_ and ISO639.
Throws: - SOAPException –
- description – Description to be added to
addFromPartyId¶
addFromPartyId¶
addToPartyId¶
addToPartyId¶
getConversationId¶
getDescriptionCount¶
-
public int
getDescriptionCount
()¶ Gets the number of
Description
elements in thisMessageHeader
.Returns: The number of Description
elements.
getDescriptions¶
getDuplicateElimination¶
-
public boolean
getDuplicateElimination
()¶ Get current setting of duplication elimination.
Returns: true if duplicate elimination is enabled; false otherwise.
getFrom¶
-
ExtensionElement
getFrom
()¶ Get From core extension element.
Returns: From extension element object.
getFromPartyIds¶
getFromRole¶
getMessageData¶
-
ExtensionElement
getMessageData
()¶ Get MessageData core extension element.
Returns: MessageData ExtensionElement
getRefToMessageId¶
getServiceType¶
getTimeToLive¶
getTimestamp¶
getTo¶
-
ExtensionElement
getTo
()¶ Get To core extension element.
Returns: To extension element object.
getToPartyIds¶
getToRole¶
setAction¶
setConversationId¶
setCpaId¶
setDuplicateElimination¶
-
public void
setDuplicateElimination
()¶ Enable duplication elimination function. This property can be set only once.
Throws: - SOAPException –
setFromRole¶
setMessageId¶
setRefToMessageId¶
setService¶
setService¶
setServiceType¶
setTimeToLive¶
setTimeToLive¶
setTimestamp¶
MessageHeader.Service¶
-
public static final class
Service
¶ A class representing service element in the
MessageHeader
Constructors¶
MessageOrder¶
-
public class
MessageOrder
extends HeaderElement¶ An ebXML
MessageOrder
in the SOAP Header of aHeaderContainer
[ebMSS 9.1].Author: tslam
Fields¶
STATUS_CONTINUE¶
-
public static final int
STATUS_CONTINUE
¶ Subsequent messages in the conversation and the sequence number is not reset.
Constructors¶
MessageOrder¶
-
MessageOrder
(SOAPEnvelope soapEnvelope, int status, int sequenceNo)¶ Constructs a
MessageOrder
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header container of which theMessageOrder
is attached to. - status – Status of the sequence number.
- sequenceNo – The sequence number in the converstaion.
Throws: - SOAPException –
- soapEnvelope –
MessageOrder¶
-
MessageOrder
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs an
MessageOrder
object by parsing the givenSOAPElement
.Parameters: - soapEnvelope –
SOAPEnvelope
, the header container of which theMessageOrder
is attached to. - soapElement –
SOAPElement
containing SequenceNumber element.
Throws: - SOAPException –
- soapEnvelope –
Methods¶
getSequenceNumber¶
-
public int
getSequenceNumber
()¶ Get the sequence number in the conversation. Note that although the word “conversation” is used in the specification, the sequence number is set and incremented by one party only. It means that both parties need to keep their own sequence numbers for all outgoing messages.
Returns: sequence number.
PKISignatureImpl¶
-
class
PKISignatureImpl
extends Signature¶ An implementation of ebXML
Signature
, making use of Phoenix’s PKI library.Author: kcyee
Constructors¶
PKISignatureImpl¶
-
PKISignatureImpl
(EbxmlMessage ebxmlMessage)¶
PKISignatureImpl¶
-
PKISignatureImpl
(EbxmlMessage ebxmlMessage, SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
Methods¶
sign¶
sign¶
sign¶
-
void
sign
(PrivateKey privateKey, X509Certificate[] certificates)¶
verify¶
-
boolean
verify
(char[] password, String keyStoreLocation, CertResolver certResolver, DataSource dataSource)¶
PartialInputStream¶
-
class
PartialInputStream
extends InputStream¶ This is an implementation of
java.io.InputStream
that represents part of data read from anInputStream
.Author: cyng
Constructors¶
PartialInputStream¶
-
PartialInputStream
(InputStream in, long offset, long length)¶ Constructor for the PartialInputStream object
Parameters: - in – the origninal input stream
- offset – the offset the read data from the stream.
- length – the length of the data to be read
Throws: - IOException – Description of the Exception
PayloadContainer¶
-
public class
PayloadContainer
¶ An encapsulation of the payload container in an
EbxmlMessage
[ebMSS 2.1.4].A Payload Container contains an ebXML MIME header as well as application payload, as illustrated in the following diagram:
1 2 3 4 5 6 7 8
Content-ID: Content-type: application/xml <PurchaseOrder> <Product>...</Product> ... </PurchaseOrder> <!--Line 1-2: ebXML MIME headers. Line 4-7: Application payload-->
This class encapsulates the structure of payload container in an ebXML message.
Author: cyng
Fields¶
Constructors¶
PayloadContainer¶
-
public
PayloadContainer
(DataHandler dataHandler, String contentId, Reference reference)¶ Create a
PayloadContainer
from the specifiedDataHandler
.
Methods¶
getContentLength¶
-
public long
getContentLength
()¶ Get the content length of this payload. Note that the content length returned will be -1 if this container is not created from AttachmentDataSource. Also, the length returned does not take Content-Transfer-Encoding into account, if any.
Returns: content length of this payload
getDataHandler¶
-
public DataHandler
getDataHandler
()¶ Get
javax.activation.DataHandler
of this attachment.
getReference¶
Reference¶
-
public class
Reference
extends ExtensionElementImpl¶ A
Reference
inside aManifest
Author: cyng
Constructors¶
Reference¶
-
Reference
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Parse the given
SOAPElement
to reconstruct aReference
object withSOAPEnvelope
as the parent.Parameters: - soapEnvelope –
SOAPEnvelope
object into which theReference
object is added. - soapElement –
SOAPElement
object to be parsed to reconstruct theReference
object.
Throws: - SOAPException –
- soapEnvelope –
Methods¶
addDescription¶
addDescription¶
-
public void
addDescription
(String description, String lang)¶ Add element with specified
xml:lang
Parameters: - description – Description to be added to the
Reference
. - lang – Language of the description specified in ` RFC 1766 <http://www.ietf.org/rfc/rfc1766.txt>`_ and ISO639.
Throws: - SOAPException –
- description – Description to be added to the
addSchema¶
getDescriptionCount¶
-
public int
getDescriptionCount
()¶ Gets the number of
Description
elements in thisReference
.Returns: The number of Description
elements.
getDescriptions¶
getHref¶
getSchemas¶
Reference.Schema¶
-
public static final class
Schema
¶ A
Schema
inside aReference
[ebMSS 3.2.1.1]. The schema is not necessarily an XML or DTD schema; it can be any kind of schema such as Database schema.
Constructors¶
Signature¶
-
public abstract class
Signature
extends HeaderElement¶ An ebXML
Signature
is aHeaderElement
inHeaderContainer
[ebMSS 4.1.1 and 4.1.3].This class is a partial implementation of the XML-Signature Syntax and Processing / RFC 3275. Please refer to these documents for details.
Author: cyng See also: ` XML-Signature Syntax and Processing <http://www.w3.org/TR/xmldsig-core/>`_
Fields¶
ATTRIBUTE_ALGORITHM¶
CANONICALIZATION_METHOD¶
-
public static final String
CANONICALIZATION_METHOD
¶ Namespace URI of the canonicalization method as specified in Exclusive XML Canonicalization Version 1.0.
DIGEST_ALGORITHM¶
DIGEST_METHOD¶
ELEMENT_CANONICALIZATION_METHOD¶
ELEMENT_DIGEST_METHOD¶
ELEMENT_DIGEST_VALUE¶
ELEMENT_KEY_INFO¶
ELEMENT_OBJECT¶
ELEMENT_REFERENCE¶
ELEMENT_SIGNATURE¶
ELEMENT_SIGNATURE_METHOD¶
ELEMENT_SIGNATURE_VALUE¶
ELEMENT_SIGNED_INFO¶
ELEMENT_TRANSFORM¶
ELEMENT_TRANSFORMS¶
ELEMENT_X509_CERTIFICATE¶
ELEMENT_X509_DATA¶
SIGNATURE_ALGORITHM¶
SIGNATURE_METHOD¶
TRANSFORM_ALGORITHM_ENVELOPED_SIGNATURE¶
TRANSFORM_ALGORITHM_XPATH¶
TRANSFORM_XPATH¶
Constructors¶
Signature¶
-
Signature
(SOAPEnvelope soapEnvelope, String localName, String prefix, String uri)¶ Initializes the
Signature
object using the givenSOAPEnvelope
, local name, namespace prefix and namespace URI.Parameters: - soapEnvelope –
SOAPEnvelope
on which digital signature will be applied. - localName – Local name of the signature element.
- prefix – Namespace prefix of the signature element.
- uri – Namespace URI of the signature element.
Throws: - SOAPException –
- soapEnvelope –
Signature¶
-
Signature
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
Methods¶
addReference¶
newInstance¶
-
static Signature
newInstance
(EbxmlMessage ebxmlMessage)¶ Get a new instance of
Signature
which will be used to sign or verify the givenEbxmlMessage
newInstance¶
-
static Signature
newInstance
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
newInstance¶
-
static Signature
newInstance
(EbxmlMessage ebxmlMessage, SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
sign¶
sign¶
-
abstract void
sign
(String username, char[] password, String keyStoreLocation, String algorithm)¶ Sign the
EbxmlMessage
with the username and password used to retrieve private key from the keystoreParameters: - username – User name required to open the private key.
- password – Password required to open the private key.
- keyStoreLocation – File location of the keystore.
- algorithm – Name of the algorithm used to sign the message.
Throws:
sign¶
-
abstract void
sign
(String username, char[] password, String keyStoreLocation, String algorithm, String digestAlgo, boolean signEnvelopeOnly)¶ Sign the
EbxmlMessage
with the username and password used to retrieve private key from the keystoreParameters: - username – User name required to open the private key.
- password – Password required to open the private key.
- keyStoreLocation – File location of the keystore.
- algorithm – Name of the algorithm used to sign the message.
- digestAlgo – Name of the algorithm used to make the digest.
- signEnvelopeOnly – whether sign the envelope only.,
Throws:
sign¶
-
abstract void
sign
(String username, char[] password, String keyStoreLocation)¶ Sign the
EbxmlMessage
with the username and password used to retrieve private key from the keystoreParameters: - username – User name required to open the private key.
- password – Password required to open the private key.
- keyStoreLocation – File location of the keystore.
Throws:
sign¶
-
abstract void
sign
(String username, char[] password, String keyStoreLocation, String type, String provider)¶ Sign the
EbxmlMessage
with the username and password used to retrieve private key from the keystore.Parameters: - username – User name required to open the private key.
- password – Password required to open the private key.
- keyStoreLocation – File location of the keystore
- type –
- provider –
Throws:
sign¶
-
abstract void
sign
(java.security.PrivateKey privateKey, java.security.cert.X509Certificate[] certificates)¶ Sign the
EbxmlMessage
using the private key supplied and attach X.509 certificates to the signature.Parameters: - privateKey – Private key used to sign the message.
- certificates – List of certificates to be included in the signature.
Throws:
verify¶
-
abstract boolean
verify
(char[] password, String keyStoreLocation, CertResolver certResolver, DataSource datasource)¶ Verify the message using trusted keystore.
Parameters: - password – Password to open the keystore.
- keyStoreLocation – File location of the key store.
- certResolver – Resolve a certificate chain in order to verify the message. If it is null, the certificate chain is extracted directly from the element in the message.
Throws: Returns: true if the digital signature is valid; false otherwise.
verify¶
-
abstract boolean
verify
(org.w3c.dom.Element documentElement, java.security.PublicKey publicKey)¶ Verify the XML signature of the
EbxmlMessage
Parameters: - documentElement – Document fragment which contains the digital signature.
- publicKey – Public key used to verify the digitall signature.
Throws: Returns: true if digital signature is valid; false otherwise.
SignatureException¶
SignatureHandler¶
-
public class
SignatureHandler
¶ Author: Donahue Sze
Constructors¶
SignatureHandler¶
-
public
SignatureHandler
(EbxmlMessage message, String username, char[] password, String keyStoreLocation, X509TrustManager trustman)¶
SignatureHandler¶
-
public
SignatureHandler
(EbxmlMessage message, Certificate cert)¶
Methods¶
sign¶
-
public void
sign
()¶ Sign this
EbxmlMessage
with XML signatureThrows: - SOAPException –
- SignatureException –
sign¶
-
public void
sign
(String algorithm)¶ Sign this
EbxmlMessage
with XML signatureParameters: - algorithm – Specifies the algorithm used to generate the digital signature. Refer to ` XML-Signature Syntax and Processing: Algorithm Identifiers and Implementation Requirements <http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/#sec-AlgID>`_ for details.
Throws: - SOAPException –
- SignatureException –
sign¶
-
public void
sign
(String algorithm, String digestAlgorithm, boolean signEnvelopeOnly)¶ Sign this
EbxmlMessage
with XML signatureParameters: - algorithm – Specifies the algorithm used to generate the digital signature. Refer to ` XML-Signature Syntax and Processing: Algorithm Identifiers and Implementation Requirements <http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/#sec-AlgID>`_ for details.
- signEnvelopeOnly – whether it should sign the envelope only, without signing the payload.
- digestAlgorithm – Description of the Parameter
Throws: - SOAPException –
- SignatureException –
verify¶
-
public boolean
verify
()¶ Verify the message using trusted keystore.
Throws: - SOAPException –
- SignatureException –
Returns: true if the digital signature is valid; false otherwise.
SignatureReference¶
-
public class
SignatureReference
extends HeaderElement¶ element in .
Author: cyng
Fields¶
Constructors¶
SignatureReference¶
-
SignatureReference
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶
StatusRequest¶
-
public class
StatusRequest
extends BodyElement¶ An ebXML
StatusRequest
in the SOAP Body of aHeaderContainer
[ebMSS 7.1.1].Author: cyng
Constructors¶
StatusRequest¶
-
StatusRequest
(SOAPEnvelope soapEnvelope, String refToMessageId)¶ Constructs a
StatusRequested
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which status request element will be added to. - refToMessageId – Identifier of the message that this status message intends to query.
Throws: - SOAPException –
- soapEnvelope –
StatusRequest¶
-
StatusRequest
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs a
StatusRequest
object by parsing the givenSOAPElement
.Parameters: - soapEnvelope –
SOAPEnvelope
, the header of which status request element will be added to. - soapElement –
SOAPElement
from which aStatusRequest
object is constructed.
Throws: - SOAPException –
- soapEnvelope –
StatusResponse¶
-
public class
StatusResponse
extends BodyElement¶ An ebXML
StatusResponse
in the SOAP Body of aHeaderContainer
[ebMSS 7.1.2].Author: cyng
Constructors¶
StatusResponse¶
-
StatusResponse
(SOAPEnvelope soapEnvelope, String refToMessageId, String messageStatus)¶ Constructs a
StatusResponse
with the given mandatory fieldsParameters: - soapEnvelope –
SOAPEnvelope
to which the status response element will be added. - refToMessageId – Identifier of the message whose status is being reported. [ebMSS 7.3.1].
- messageStatus – Message status response string [ebMSS 7.3.3].
Throws: - SOAPException –
- soapEnvelope –
StatusResponse¶
-
StatusResponse
(SOAPEnvelope soapEnvelope, String refToMessageId, String messageStatus, String timestamp)¶ Constructs a
StatusResponse
with the given mandatory fieldsParameters: - soapEnvelope –
SOAPEnvelope
to which the status response element will be added. - refToMessageId – Identifier of the message whose status is being reported. [ebMSS 7.3.1].
- messageStatus – Message status response string [ebMSS 7.3.3].
- timestamp – Timestamp of the message the status is being reported.
Throws: - SOAPException –
- soapEnvelope –
StatusResponse¶
-
StatusResponse
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs a
StatusResponse
object by parsing the givenSOAPElement
.Parameters: - soapEnvelope –
SOAPEnvelope
to which the status response element will be added. - soapElement –
SOAPElement
from which aStatusResponse
object is constructed.
Throws: - SOAPException –
- soapEnvelope –
SyncReply¶
-
public class
SyncReply
extends HeaderElement¶ An ebXML
SyncReply
in the SOAP Header of aHeaderContainer
[ebMSS 4.3].Author: tslam
Constructors¶
SyncReply¶
-
SyncReply
(SOAPEnvelope soapEnvelope)¶ Constructs a
SyncReply
with the given mandatory fields.Parameters: - soapEnvelope –
SOAPEnvelope
, the header container of which theSyncReply
is attached to.
Throws: - SOAPException –
- soapEnvelope –
SyncReply¶
-
SyncReply
(SOAPEnvelope soapEnvelope, SOAPElement soapElement)¶ Constructs an
SyncReply
object by parsing the givenSOAPElement
.Parameters: - soapEnvelope –
SOAPEnvelope
, the header container of which theSyncReply
is attached to. - soapElement – Empty
SOAPElement
.
Throws: - SOAPException –
- soapEnvelope –
Utility¶
-
public class
Utility
¶ Utility class for use by both clients and server.
Author: kcyee
Methods¶
fromUTCString¶
-
public static Date
fromUTCString
(String dateTime)¶ Convert a string of data type “dateTime” as specified by XML-Schema Part 2: Datatypes section 3.2.7 to local date/time. Only date/time represented as CCYY-MM-DDThh:mm:ssZ is supported.
Parameters: - dateTime – Date/time string in UTC.
Returns: local time representation of the given UTC time string.
generateMessageId¶
-
public static String
generateMessageId
(Date date, EbxmlMessage ebxmlMessage)¶ Generate globally unique message ID according to the specified date and the information in ebXML message. Required fields are:
- To/PartyId element [ebMSS 3.1.1.1]
- CPAId [ebMSS 3.1.2]
- Service element [ebMSS 3.1.4]
- Action element [ebMSS 3.1.5]
Parameters: - date – Date to be used to generate message ID.
- ebxmlMessage – ebXML message containing required fields.
Throws: Returns: Message ID derived from the given information.
generateMessageId¶
-
public static String
generateMessageId
(Date date, String toPartyId, String cpaId, String service, String action)¶ Generate message ID from the specified date, ToPartyId, CPAId, service name and action string.
Parameters: - date – Date from which message ID is generated.
- toPartyId – Party ID of the recipient [ebMSS 3.1.1.1].
- cpaId – CPAId [ebMSS 3.1.2].
- service – Service name [ebMSS 3.1.4].
- action – Action name [ebMSS 3.1.5].
Returns: Message ID derived from the given information.
toUTCString¶
-
public static String
toUTCString
(Date date)¶ Get timestamp of the specified date in type “dateTime” as specified in XML-Schema Part 2: Datatypes section 3.2.7. Local time is converted to UTC time.
Parameters: - date – Local date to be converted to UTC time.
Returns: UTC time string in CCYY-MM-DDThh:mm:ssZ format
hk.hku.cecid.ebms.pkg.pki¶
ApacheXMLDSigner¶
-
public class
ApacheXMLDSigner
implements XMLDSigner¶ This class hides the details for digital signature. The digital signature routines are provided by the Apache XML Security library. We defined a standard way to have the document signed as interface. Different classes will implement the interface using different library behind.
Author: kcyee
Fields¶
DIGEST_METHOD¶
ELEMENT_KEY_INFO¶
ELEMENT_SIGNATURE¶
NAMESPACE_PREFIX_SOAP_ENVELOPE¶
NAMESPACE_URI_SOAP_ENVELOPE¶
SIGNATURE_METHOD¶
TRANSFORM_ALGORITHM_XPATH¶
TRANSFORM_XPATH¶
documents¶
signature¶
-
protected XMLSignature
signature
¶ Internal variable of the Apache XML Security library signature object for doing the actual signing/verifying algorithm.
trusted¶
-
protected CompositeKeyStore
trusted
¶ Internal variable for holding the trusted anchor for certificate path verification.
Constructors¶
Methods¶
addCertResolver¶
-
public void
addCertResolver
(CertResolver certResolver, Object obj)¶
addDocument¶
-
public void
addDocument
(String uri, InputStream is, String contentType)¶ Adds a reference to a document attachment to the signature.
Parameters: - uri – the URI of the document attachment
- is – the input stream of the content of the document
- contentType – the content type of the document
getElement¶
setEnvelope¶
-
public void
setEnvelope
(Document doc, String algo, String digestAlgo)¶ Set the envelope to host the Signature element. That is the XML document where the Signature element to be added. The digital signature here will always be an enveloped signature. The envelope will be included in the process of signing.
Parameters: - doc – the XML document to host the Signature element
- algo – the algorithm used for digital signature. Currently, only two values are tested:
dsa-sha1
andrsa-sha1
. - digestAlgo – the algorithm used for making digest value. Currently, one value is supported:
sha1
Throws: - SignException – internal exception when doing initialization on Apache XML Security library
setEnvelope¶
-
public void
setEnvelope
(Document doc, String algo)¶ Set the envelope to host the Signature element. That is the XML document where the Signature element to be added. The digital signature here will always be an enveloped signature. The envelope will be included in the process of signing.
Parameters: - doc – the XML document to host the Signature element
- algo – the algorithm used for digital signature. Currently, only two values are tested:
dsa-sha1
andrsa-sha1
.
Throws: - SignException – internal exception when doing initialization on Apache XML Security library
setEnvelope¶
-
public void
setEnvelope
(Document doc)¶ Set the envelope to host the Signature element. That is the XML document where the Signature element to be added. The digital signature here will always be an enveloped signature. The envelope will be included in the process of signing.
Parameters: - doc – the XML document to host the Signature element
Throws: - SignException – internal exception when doing initialization on Apache XML Security library
setTrustAnchor¶
-
public void
setTrustAnchor
(CompositeKeyStore ks)¶ Sets the trust anchor for verfication of certificate path.
Parameters: - ks – the keystore providing the trusted certificates
sign¶
-
public void
sign
(CompositeKeyStore ks, String alias, char[] password)¶ Signs the envelope and documents by using the specified key in the keystore.
Parameters: - ks – the keystore holding the key for signing
- alias – the alias of the key for signing
- password – the password for accessing the key for signing
Throws: - SignException – when there is any error in the processing of signing
verify¶
-
public boolean
verify
()¶ Verifies the signature in the envelope passed in, which may reference the documents specified using the addDocument method.
Throws: - VerifyException – when there is any error in the processing of verification
Returns: true if the signature can be verified successfully, false if otherwise.
CRLFileSource¶
CRLSource¶
-
public abstract class
CRLSource
¶ This is an abstract class for holding a X509 CRL instance. The functionality of CRL is given by this class. The sub-classes will provide different initialization method for loading the CRL, for example, through a file or through LDAP.
Author: kcyee
Fields¶
Constructors¶
Methods¶
getIssuer¶
-
public String
getIssuer
()¶ Gets the distinguished name (DN) of the issuer of the CRL.
Throws: - InitializationException – the object is not yet initialized
Returns: the DN of the issuer
getNextUpdate¶
-
public Date
getNextUpdate
()¶ Gets the next update date of the CRL.
Throws: - InitializationException – the object is not yet initialized
Returns: the next update date
getThisUpdate¶
-
public Date
getThisUpdate
()¶ Gets the last update date of the CRL.
Throws: - InitializationException – the object is not yet initialized
Returns: the last update date
init¶
-
public abstract void
init
()¶ Initializes the object. The initialization procedure depends on the source of the CRL. So, we declare this method as abstract here, leaving the sub-classes to concern about the initialization.
Throws: - CRLException – Initialization error occurs
isReady¶
-
public boolean
isReady
()¶ Gets the readiness of the object. The object will be ready for use after init() is called. And the internal X509 CRL storage is populated.
Returns: true if the object is ready for use; false if otherwise
isRevoked¶
-
public boolean
isRevoked
(Certificate cert)¶ Checks the specified certificate against the CRL to see whether the certificate has been revoked or not.
Parameters: - cert – the certificate to be tested against the CRL
Throws: - InitializationException – the object is not yet initialized
Returns: true if the specified certificate is revoked according to the CRL; false if otherwise
isRevoked¶
-
public boolean
isRevoked
(CertSource cert)¶ Checks the specified certificate against the CRL to see whether the certificate has been revoked or not.
Parameters: - cert – the certificate to be tested against the CRL
Throws: - InitializationException – the object is not yet initialized
Returns: true if the specified certificate is revoked according to the CRL; false if otherwise
verifySignature¶
-
public boolean
verifySignature
(PublicKey pubKey)¶ Verifies the CRL to check whether is is signed by the private key corresponding to the specified public key or not.
Parameters: - pubKey – the public key used to verify
Throws: - InitializationException – the object is not yet initialized
Returns: true if the CRL is signed by the private key corresponding to
pubKey
; false if otherwise
verifySignature¶
-
public boolean
verifySignature
(Certificate cert)¶ Verifies the CRL to check whether is is signed by the private key corresponding to the public key in the specified certificate or not.
Parameters: - cert – the certificate storing the public key to be used for verification
Throws: - InitializationException – the object is not yet initialized
Returns: true if the CRL is signed by the private key corresponding to the public key stored in
cert
; false if otherwise
verifySignature¶
-
public boolean
verifySignature
(CertSource cert)¶ Verifies the CRL to check whether is is signed by the private key corresponding to the public key in the specified certificate or not.
Parameters: - cert – the certificate storing the public key to be used for verification
Throws: - InitializationException – the object is not yet initialized
Returns: true if the CRL is signed by the private key corresponding to the public key stored in
cert
; false if otherwise
CertPathVerifier¶
-
public class
CertPathVerifier
¶ This class wraps the certificate path verification routine into a separate static method. This is useful when JDK1.3 is used, the cert path verification is skipped. And the JDK1.4 specific classes will not be loaded, as they are all called in this class.
Author: kcyee
Methods¶
verify¶
-
public static boolean
verify
(java.security.cert.Certificate[] certs, CompositeKeyStore trusted)¶ Verifies the specified certificate chain against the trusted anchors. The trusted anchors contains all public certificate that is trusted. This method will make use of JDK1.4’s utilities to verify the certificate chain.
Parameters: - certs – the certificate chain being verified
- trusted – the keystore storing the trusted anchors.
Returns: true if verification is succeeded; false otherwise
CertResolver¶
-
public interface
CertResolver
¶ Author: cyng
Methods¶
resolve¶
-
Certificate[]
resolve
(Object obj)¶
CertSource¶
-
public class
CertSource
¶ This class loads a X509 certificate file. Basically this class only acts as a convenience wrapper of java.security.cert.X509Certificate.
Author: kcyee
Fields¶
x509Cert¶
-
protected X509Certificate
x509Cert
¶ internal X509 certificate storage.
Constructors¶
CertSource¶
-
public
CertSource
()¶ Default constructor. The user should call load() to further initialize the certificate.
CertSource¶
CertSource¶
-
public
CertSource
(String certFile)¶ Constructor with initialization parameters. The certificate will be loaded from the file specified.
Parameters: - certFile – the file name of the certificate file
Throws: - CertificateException – if the file specified cannot be read, or any errors occurred when loading the file.
CertSource¶
-
public
CertSource
(X509Certificate cert)¶ Constructor with initialization parameters. The class will be initialized with the specified certificate.
Parameters: - cert – the preloaded certificate
Methods¶
getInternalCert¶
-
public X509Certificate
getInternalCert
()¶ Gets the X509Certificate stored internally.
Returns: the X509Certificate stored internally.
getIssuer¶
-
public String
getIssuer
()¶ Gets the distinguished name (DN) of the issuer of the certificate.
Throws: - InitializationException – the object is not yet initialized
Returns: the DN of the issuer
getPublicKey¶
isValid¶
-
public boolean
isValid
()¶ Checks whether the certificate is valid in current time.
Returns: true if the certificate is still valid, false if otherwise.
isValid¶
load¶
load¶
verify¶
verify¶
-
public boolean
verify
(Certificate cert)¶ Verifies whether the certificate is signed by the private key corresponding to public key in the specified certificate.
Parameters: - cert – the certificate for verification
Returns: true if the verification is passed, false if otherwise.
verify¶
-
public boolean
verify
(CertSource cert)¶ Verifies whether the certificate is signed by the private key corresponding to public key in the specified certificate.
Parameters: - cert – the certificate for verification
Returns: true if the verification is passed, false if otherwise.
CompositeKeyStore¶
-
public class
CompositeKeyStore
¶ Composite keystore which manages keystores of different types. A typical Java keystore supports only one keystore type per file. That will be inconvenient for applications to manage several types of keystore. Also, this composite keystore supports managing multiple keystore files. This can be viewed as a keystore registry, that is, this object manages a pool of keystore files.
Author: kcyee
Fields¶
Constructors¶
Methods¶
addKeyStoreFile¶
addKeyStoreFile¶
aliases¶
-
public Enumeration
aliases
()¶ Gets all the aliases of the keystores pointed by this composite keystore.
Returns: an enumeration of string, holding the aliases of the keys
containsAlias¶
getCertificate¶
-
public Certificate
getCertificate
(String alias)¶ Gets the certificate named by the given alias, from the collection of keystores pointed by this composite keystore.
Parameters: - alias – the alias of the key/certificate
Throws: - KeyStoreException – the keystore is corrupted
Returns: the certificate named by the given alias, null if not found
getCertificateAlias¶
-
public String
getCertificateAlias
(Certificate cert)¶ Gets the alias of the specified certificate.
Parameters: - cert – the certificate
Returns: the alias of the certificate, if the certificate can be found in the collection of keystores pointed by this composite keystore. Otherwise, null will be returned
getCertificateChain¶
-
public Certificate[]
getCertificateChain
(String alias)¶ Gets the certificate chain by the specified alias.
Parameters: - alias – the alias of the key/certificate
Throws: - KeyStoreException – the keystore is corrupted
Returns: the certificate chain by the specified alias, null if not found
getCreationDate¶
-
public Date
getCreationDate
(String alias)¶ Gets the creation date of the key/certificate by the specified alias.
Parameters: - alias – the alias of the key/certificate
Throws: - KeyStoreException – the keystore is corrupted
Returns: the creation date of the key/certificate by the specified alias, null if not found
getKey¶
-
public Key
getKey
(String alias, char[] password)¶ Gets the key by the specified alias. A password should be given also to retrieve the key.
Parameters: - alias – the alias of the key/certificate
- password – the password to retrieve the key
Throws: - KeyStoreException – the keystore is corrupted
- NoSuchAlgorithmException – the keystore cannot be read
- UnrecoverableKeyException – the keystore cannot be read
Returns: the key specified by the alias, null if not found
getKeyStore¶
isCertificateEntry¶
isKeyEntry¶
load¶
-
public void
load
(String storeFileName)¶ Loads the composite keystore from a persistent file in the file system.
Parameters: - storeFileName – the name of the composite keystore persistent file
Throws: - InitializationException – the persistent file is corrupted
load¶
-
public void
load
(File storeFile)¶ Loads the composite keystore from a persistent file in the file system.
Parameters: - storeFile – the composite keystore persistent file
Throws: - InitializationException – the persistent file is corrupted
loadCache¶
-
protected void
loadCache
()¶ Loads the keystores pointed by this composite keystore into memory and create a caching of aliases.
loadKeyStore¶
-
protected KeyStore
loadKeyStore
(String fileName, KeyStoreFileProp ksp)¶ Gets an instance of the keystore of correct type. This function will consider the Java version and determine whether to use JSSE or not. For Java version 1.4 or above, JSSE is built in. So, no need to call an external provider to create an instance of PKCS#12 formatted keystore. Otherwise, JSSE should be used, and we make use of dynamic binding to load the JSSE library.
Parameters: - fileName – the keystore file name to load
- ksp – other keystore parameters for loading
Returns: keystore instance of the correct type
removeKeyStoreFile¶
removeKeyStoreFile¶
size¶
-
public int
size
()¶ Gets the total number of keys/certificates in all the keystores pointed by this composite keystore.
Returns: the total number of keys/certificates
store¶
-
public void
store
(String storeFileName)¶ Stores the composite keystore to a persistent file in the file system.
Parameters: - storeFileName – the name of the composite keystore persistent file
Throws: - StoreException – the composite keystore is not successfully stored
store¶
-
public void
store
(File storeFile)¶ Stores the composite keystore to a persistent file in the file system.
Parameters: - storeFile – the composite keystore persistent file
Throws: - StoreException – the composite keystore is not successfully stored
DocumentDetail¶
-
public class
DocumentDetail
¶ A data structure class for holding the document attachment parameters.
Author: kcyee
DocumentResolver¶
-
public class
DocumentResolver
extends ResourceResolverSpi¶ This class is needed by the Apache XML Security library for locating and loading the document attachments.
Author: kcyee
Fields¶
docs¶
-
protected DocumentDetail[]
docs
¶ Internal variable for holding the document parameters.
Constructors¶
DocumentResolver¶
-
public
DocumentResolver
(DocumentDetail[] docs)¶ Construct with an array of document parameters.
Parameters: - docs – array of document parameters
ErrorMessages¶
-
public class
ErrorMessages
¶ A class holding error codes and the corresponding error messages.
Author: kcyee
Fields¶
Methods¶
InitializationException¶
KeyStoreFileProp¶
-
public class
KeyStoreFileProp
implements Serializable¶ This class represents the data structure for holding parameters for accessing a keystore file. Since the parameters will be serialized to the file system, some fields (particularly password will be scrambled.
Author: kcyee
Fields¶
Constructors¶
Methods¶
decrypt¶
-
protected char[]
decrypt
(char[] password)¶ Decrypts the password. This is a helper function called internally to unscramble the password from storage.
Parameters: - password – the text to be decrypted
Returns: the decrypted password
SMIMEException¶
SMIMEHandler¶
-
public class
SMIMEHandler
¶ It is the base class of SMIMEEncrypter and SMIMEDecrypter. The BouncyCastle ‘s SMIME engine only works properly with BouncyCastle ‘s JCE provider. The subclass should call the method initiate(), which add the BouncyCastle ‘s Provider and setup which DataHandler for what types of content type.
SignException¶
StoreException¶
VerifyException¶
XMLDSigner¶
-
public interface
XMLDSigner
¶ This interface defines a standard way to have the document signed. Different classes will implement the interface using different library behind.
Author: kcyee
Methods¶
addDocument¶
-
public void
addDocument
(String uri, InputStream is, String contentType)¶ Adds a reference to a document attachment to the signature.
Parameters: - uri – the URI of the document attachment
- is – the input stream of the content of the document
- contentType – the content type of the document
getElement¶
setEnvelope¶
-
public void
setEnvelope
(Document doc)¶ Set the envelope to host the Signature element. That is the XML document where the Signature element to be added. The digital signature here will always be an enveloped signature. The envelope will be included in the process of signing.
Parameters: - doc – the XML document to host the Signature element
Throws:
setTrustAnchor¶
-
public void
setTrustAnchor
(CompositeKeyStore ks)¶ Sets the trust anchor for verfication of certificate path.
Parameters: - ks – the keystore providing the trusted certificates
sign¶
-
public void
sign
(CompositeKeyStore ks, String alias, char[] password)¶ Signs the envelope and documents by using the specified key in the keystore.
Parameters: - ks – the keystore holding the key for signing
- alias – the alias of the key for signing
- password – the password for accessing the key for signing
Throws: - SignException – when there is any error in the processing of signing
verify¶
-
public boolean
verify
()¶ Verifies the signature in the envelope passed in, which may reference the documents specified using the addDocument method.
Throws: - VerifyException – when there is any error in the processing of verification
Returns: true if the signature can be verified successfully, false if otherwise.
hk.hku.cecid.ebms.pkg.validation¶
BodyValidator¶
-
public class
BodyValidator
¶ Class for validating the body of an ebXML message.
EbxmlValidationException
will be thrown in case of error.Author: Frankie Lam
Methods¶
validate¶
-
public void
validate
(EbxmlMessage ebxmlMessage)¶
EbxmlMessageValidator¶
-
public class
EbxmlMessageValidator
¶ Class for validating an ebXML message.
EbxmlValidationException
will be thrown in case of error.Author: Frankie Lam
Methods¶
validate¶
-
public void
validate
(EbxmlMessage ebxmlMessage)¶
EbxmlValidationException¶
-
public class
EbxmlValidationException
extends ValidationException¶ Exception class that can generate ebXML error messages from the information it has been given.
Author: Frankie Lam
Fields¶
ACTION¶
EBXML_ERROR_DELIVERY_FAILURE¶
EBXML_ERROR_INCONSISTENT¶
EBXML_ERROR_MIME_PROBLEM¶
EBXML_ERROR_NOT_SUPPORTED¶
EBXML_ERROR_OTHER_XML¶
EBXML_ERROR_SECURITY_FAILURE¶
EBXML_ERROR_TIME_TO_LIVE_EXPIRED¶
EBXML_ERROR_UNKNOWN¶
EBXML_ERROR_VALUE_NOT_RECOGNIZED¶
SERVICE¶
refToMessage¶
-
protected EbxmlMessage
refToMessage
¶ The ebXML message being referred to.
Constructors¶
EbxmlValidationException¶
-
public
EbxmlValidationException
(String errorCode, String severity, String errorString)¶ Constructs a
EbxmlValidationException
object given its error code, severity level, error string and the ebXML message being referred.Parameters: - errorCode – One of the error codes defined in ebMS 4.2.3.4.1.
- severity – Severity level of the error, which should be either SEVERITY_WARNING or SEVERITY_ERROR
- errorString – String describing the error.
EbxmlValidationException¶
-
public
EbxmlValidationException
(String errorCode, String severity, String errorString, String location)¶ Constructs a
EbxmlValidationException
object given its error code, severity level, error string and the ebXML message being referred.Parameters: - errorCode – One of the error codes defined in ebMS 4.2.3.4.1.
- severity – Severity level of the error, which should be either SEVERITY_WARNING or SEVERITY_ERROR
- errorString – String describing the error.
- location – Location of the message containing the error.
Methods¶
getEbxmlMessage¶
-
public EbxmlMessage
getEbxmlMessage
()¶ Get
EbxmlMessage
error message from the information given int this object.Returns: EbxmlMessage
containing the error information.
getLocation¶
getSOAPMessage¶
-
public SOAPMessage
getSOAPMessage
()¶ Get the error message in SOAP format.
Returns: javax.xml.soap.SOAPMessage
object.
setRefToMessage¶
-
public void
setRefToMessage
(EbxmlMessage refToMessage)¶ Set the
EbxmlMessage
being referred to by the error message.Parameters: - refToMessage –
EbxmlMessage
object to be referred to.
- refToMessage –
HeaderValidator¶
-
public class
HeaderValidator
¶ Class for validating the header of an ebXML message.
EbxmlValidationException
will be thrown in case of error.Author: Frankie Lam
Methods¶
validate¶
-
public void
validate
(EbxmlMessage ebxmlMessage)¶ Validate the header of an ebXML message.
Parameters: - ebxmlMessage – The header of the
EbxmlMessage
object to be validated.
- ebxmlMessage – The header of the
validatePartyId¶
validatePayload¶
-
protected void
validatePayload
(EbxmlMessage ebxmlMessage)¶ Validate payload. The following checks are applied: - All payload references with “cid:” as the prefix must exist. - All payload references must be a valid URI.
validateService¶
SOAPValidationException¶
-
public class
SOAPValidationException
extends ValidationException¶ Exception class that can generate SOAP fault messages from the information it has been given.
Author: Frankie Lam
Fields¶
ELEMENT_ERROR¶
NAMESPACE_PREFIX_SOAP_ENVELOPE¶
NAMESPACE_URI_SOAP_ENVELOPE¶
SOAP_FAULT_CLIENT¶
SOAP_FAULT_MUST_UNDERSTAND¶
SOAP_FAULT_SERVER¶
SOAP_FAULT_VERSION_MISMATCH¶
Constructors¶
SOAPValidationException¶
SOAPValidationException¶
-
public
SOAPValidationException
(String faultCode, String faultString, String detail)¶ Constructs a
SOAPValidationException
object given its fault code and fault string.Parameters: - faultCode – Fault codes as specified in the SOAP 1.1 specification
- faultString – Human readable explanation of the fault.
- detail – Specific error information related to the SOAP Body element. It must be present if the SOAP Body cannot be processed successfully, and must NOT be present if the error is caused by header entries.
SOAPValidationException¶
-
public
SOAPValidationException
(String faultCode, String faultString, String faultActor, String detail)¶ Constructs a
SOAPValidationException
object given its fault code and fault string.Parameters: - faultCode – Fault codes as specified in the SOAP 1.1 specification
- faultString – Human readable explanation of the fault.
- faultActor – Information on who caused the fault to happen.
- detail – Specific error information related to the SOAP Body element. It must be present if the SOAP Body cannot be processed successfully, and must NOT be present if the error is caused by header entries.
Methods¶
getSOAPMessage¶
-
public SOAPMessage
getSOAPMessage
()¶ Get SOAP Fault message from the information given.
Returns: SOAPMessage
object containing Fault element.
ValidationException¶
-
public abstract class
ValidationException
extends SOAPException¶ Base class for message validation exceptions. All classes extending this class must be able to generate a SOAP message to indicate the error, but it is not necessary a SOAP Fault message (e.g. an ebXML message containing ErrorList element).
Author: Frankie Lam
Fields¶
ERROR_EBXML¶
-
public static final int
ERROR_EBXML
¶ The error represented by this exception is caused by an incorrectly packaged ebXML message.
ERROR_SOAP¶
-
public static final int
ERROR_SOAP
¶ The error represented by this exception is a SOAP Fault
Constructors¶
ValidationException¶
-
public
ValidationException
(int errorType, String errorCode, String errorString)¶ Constructs a
ValidationException
object.Parameters: - errorType – The type of error represented by this exception object.
- errorCode – An error code in string to be processed by the applications.
- errorString – A human-readable description string.
Methods¶
getSOAPMessage¶
-
public abstract SOAPMessage
getSOAPMessage
()¶ Get the SOAP message containing the error information.
Returns: SOAPMessage
object containing the error information.
hk.hku.cecid.ebms.service¶
EbmsMessageStatusQueryService¶
-
public class
EbmsMessageStatusQueryService
extends WebServicesAdaptor¶ EbmsMessageStatusQueryService
Author: Donahue Sze
hk.hku.cecid.ebms.spa¶
EbmsProcessor¶
-
public class
EbmsProcessor
implements PluginHandler¶ Author: Donahue Sze
Fields¶
ACTIVE_MODULE_INBOX_COLLECTOR¶
ACTIVE_MODULE_MAIL_COLLECTOR¶
ACTIVE_MODULE_OUTBOX_COLLECTOR¶
core¶
-
public static SystemModule
core
¶
Methods¶
getKeyStoreManagerForDecryption¶
-
public static KeyStoreManager
getKeyStoreManagerForDecryption
()¶
getKeyStoreManagerForSignature¶
-
public static KeyStoreManager
getKeyStoreManagerForSignature
()¶
getModuleGroup¶
-
public static ModuleGroup
getModuleGroup
()¶ Returns: the Ebms module group
EbmsUtility¶
-
public class
EbmsUtility
¶ An utility for converting from java datetime to UTC conformed datetime and vice versa.
- Fixed a bug that it parses UTC datetime with ‘Z’ timezone incorrectly becasue it used wrong timezone (GMT, but not UTC). (Thank Martin Kalen for figure out this)
- Added datetime / calendar two UTC convertion.
Author: Twinsen Tsang, (modifier Philip Wong)
Methods¶
GMT2Calender¶
-
public static Calendar
GMT2Calender
(String dateTime)¶ Convert an GMT representation of string
dateTime
to java calendar object.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: The millisecond representing the
dateTime
GMT2Date¶
-
public static Date
GMT2Date
(String dateTime)¶ Convert an GMT representation of string
dateTime
to java Date object.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java date object representing the
dateTime
GMT2MS¶
-
public static long
GMT2MS
(String dateTime)¶ Convert an GMT representation of string
dateTime
to millisecond.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: The millisecond representing the
dateTime
GMT2Timestamp¶
-
public static Timestamp
GMT2Timestamp
(String dateTime)¶ Convert an GMT representation of string
dateTime
to java Timestamp object.Parameters: - dateTime – A string representing a GMT datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java timestamp object representing the
dateTime
UTC2Calendar¶
-
public static Calendar
UTC2Calendar
(String dateTime)¶ Convert an UTC representation of string
dateTime
to java calendar object. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java clendar object representing the
dateTime
UTC2Date¶
-
public static Date
UTC2Date
(String dateTime)¶ Convert an UTC representation of string
dateTime
to java Date object. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java date object representing the
dateTime
.
UTC2MS¶
-
public static long
UTC2MS
(String dateTime)¶ Convert an UTC representation of string
dateTime
to millisecond. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: The millisecond representing by
dateTime
.
UTC2Timestamp¶
-
public static Timestamp
UTC2Timestamp
(String dateTime)¶ Convert an UTC representation of string
dateTime
to java Timestamp object. Followings are UTC conformed patterns:- 2007-07-16T13:24:56
- 2007-07-16T13:24:56Z
- 2007-07-16T13:24:56.789
- 2007-07-16T13:24:56.789Z
- 2007-07-16T13:24:56+02:00
- 2007-07-16T13:24:56-02:00
- 2007-07-16T13:24:56.789+02:00
- 2007-07-16T13:24:56.789-02:00
Parameters: - dateTime – A string representing a UTC datetime.
Throws: - UtilitiesException – When unable to convert the dateTime format.
Returns: A java timestamp object representing the
dateTime
.
calendar2UTC¶
-
public static String
calendar2UTC
(Calendar dateTime)¶ Convert a calendar
dateTime
to UTC conformed representation of string.Parameters: - dateTime – A java calendar representing the time you want to convert.
Throws: - UtilitiesException – When unable to convert the
dateTime
to UTC.
Returns: an UTC conformed representation with time specified by
dateTime
date2UTC¶
-
public static String
date2UTC
(Date dateTime, TimeZone timeZone)¶ Convert a date
dateTime
to UTC conformed representation of string. (e.g. 2007-07-16T13:24:56.789+13:00)Parameters: - dateTime – A java date representing the time you want to convert.
- timeZone – The timezone of the
dateTime
. If it is null, it use the default timezone in the machine.
Throws: - UtilitiesException – When unable to convert the
dateTime
to UTC.
Returns: an UTC conformed representation with time specified by
dateTime
EbmsUtilityTest¶
-
public class
EbmsUtilityTest
extends TestCase¶ The
EbmsUtilityTest
is the testcase forEbmsUtility
.Author: Twinsen Tsang
Methods¶
getLocalTimezone¶
testDate2UTC_Pos0¶
-
public void
testDate2UTC_Pos0
()¶ Test for converting from a java date object to UTC conformed representation string. Testing for the scenario the dateTime is represented as java calendar and under the timezone same as the machine running.
testDate2UTC_Pos1¶
-
public void
testDate2UTC_Pos1
()¶ Test for converting from a java date object to UTC conformed representation string. Testing for the scenario the dateTime is represented as java calendar and under the timezone under UTC.
testDate2UTC_Pos2¶
-
public void
testDate2UTC_Pos2
()¶ Test for converting from a java date object to UTC conformed representation string. Testing for the scenario the dateTime is represented as java calendar and under the timezone under GMT-12:00 (boundary case)
testDate2UTC_Pos3¶
-
public void
testDate2UTC_Pos3
()¶ Test for converting from a java date object to UTC conformed representation string. Testing for the scenario the dateTime is represented as java calendar and under the timezone under GMT+13:00 (boundary case)
testGMT2Date_Pos0¶
-
public void
testGMT2Date_Pos0
()¶ Test for converting from GMT datetime representation to java date object.
testMartinKalenIssue1¶
-
public void
testMartinKalenIssue1
()¶ Test for the scenario issued by Martin Kalen from the google group. QUOTED FROM martin said:
Hermes sends ebMS ACK messages with a non-standard timezone part of the timestamp (timezone info is not according to ebXML-specification, see background below) Background on #1: The recent fix for Hermes UTC timestamps uses the Java SimpleDateFormat "Z"-pattern for timezone, which is unfortunately incompatible with the ebXML specification for time zone refering to the XML schema data-type "dateTime" specified here: http://www.w3.org/TR/xmlschema-2/#dateTime Snippets from the spec: "dateTime consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?" "zzzzzz (if present) represents the timezone" From 3.2.7.3 Timezones The lexical representation of a timezone is a string of the form: (('+' | '-') hh ':' mm) | 'Z'" In Java the ':' character is missing between the "hh" and "mm" parts. More details on the Java SimpleDateFormat vs XSD dateTime incompatibility can be found here:
Detail: http://groups.google.com/group/cecid-hermes2/browse_thread/thread/46cca8b51ca21524
testMartinKalenIssue2¶
-
public void
testMartinKalenIssue2
()¶ Test for the scenario issued by Martin Kalen from the google group.
I live in the UTC+02:00 timezone and today at 14:01 my time (=12:01 UTC time) an incoming ebXML message with the following TTL timestamp was considered expired by Hermes: "2007-07-10T12:04:14Z". Without the change in EbmsUtility above, Hermes regards the incoming timestamp as 12:04 in my timezone which mutates the expected 12:04:14UTC to 10:04:14UTC = incorrect expiry notification to the sender.
Detail: http://groups.google.com/group/cecid-hermes2/browse_thread/thread/46cca8b51ca21524
testUTC2Calendar_Neg0¶
-
public void
testUTC2Calendar_Neg0
()¶ Test the conversation from UTC to java calendar object negatively. Testing for the scenario all invalid UTC format representation.
testUTC2Calendar_Pos0¶
-
public void
testUTC2Calendar_Pos0
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC and under the timezone in UTC (GMT+00:00) using ‘Z’ designator.
testUTC2Calendar_Pos1¶
-
public void
testUTC2Calendar_Pos1
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC and under the timezone in UTC (GMT+00:00) using +00:00
testUTC2Calendar_Pos2¶
-
public void
testUTC2Calendar_Pos2
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC and under the timezone GMT+08:00 (non zero timezone)
testUTC2Calendar_Pos3¶
-
public void
testUTC2Calendar_Pos3
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC and under the timezone GMT+13:00 (boundary case)
testUTC2Calendar_Pos4¶
-
public void
testUTC2Calendar_Pos4
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC and under the timezone GMT-12:00 (boundary case)
testUTC2Calendar_Pos5¶
-
public void
testUTC2Calendar_Pos5
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC without millisecond and under the timezone UTC.
testUTC2Calendar_Pos6¶
-
public void
testUTC2Calendar_Pos6
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC without millisecond and under any timezone other than UTC.
testUTC2Calendar_Pos7¶
-
public void
testUTC2Calendar_Pos7
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC without millisecond and ‘Z’ and under any timezone other than UTC.
testUTC2Calendar_Pos8¶
-
public void
testUTC2Calendar_Pos8
()¶ Test the conversation from UTC to java calendar object. Testing for the scenario the dateTime is represented as UTC with ‘Z’ and under any timezone other than UTC.
validateCalendar¶
-
public void
validateCalendar
(Calendar cal, int expectedYear, int expectedMonth, int expectedDay, int expectedHour, int expectedMins, int expectedSecond, int expectedMillisecond, String expectedTz)¶ A common method to validate cirtical field for specified
cal
Parameters: - cal – The calendar to test against.
- expectedYear – The expected year.
- expectedMonth – The expected month.
- expectedDay – The expected day.
- expectedHour – The expected hour.
- expectedMins – The expected mins.
- expectedSecond – The expected second.
- expectedMillisecond – The expected millisecond.
- expectedTz – The expected timezone.
hk.hku.cecid.ebms.spa.dao¶
InboxDAO¶
InboxDVO¶
InboxDataSourceDAO¶
-
public class
InboxDataSourceDAO
extends DataSourceDAO implements InboxDAO¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
Methods¶
findInboxNextOrderNo¶
-
public long
findInboxNextOrderNo
()¶ Returns next value of inbox order no. from DB sequence. it determines message order being retrieved by client. For DB, PostgreSQL & Oracle built-in auto number (sequence) will be used. Otherwise for mySQL, max(order_no) + 1 will be returned. Default starting order no is 1.
Returns: the value of next inbox order no.
InboxDataSourceDAOTest¶
-
public class
InboxDataSourceDAOTest
extends DAOTest<InboxDataSourceDAO>¶
InboxDataSourceDVO¶
-
public class
InboxDataSourceDVO
extends DataSourceDVO implements InboxDVO¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
MessageDAO¶
Methods¶
addMessage¶
-
public void
addMessage
(MessageDVO data)¶
deleteMessage¶
-
public void
deleteMessage
(MessageDVO data)¶
findInboxPendingMessagesByTimestamp¶
-
public List
findInboxPendingMessagesByTimestamp
(MessageDVO messageDVO)¶
findInboxReadyMaxSequenceNoByCpa¶
-
public int
findInboxReadyMaxSequenceNoByCpa
(MessageDVO data)¶
findMaxSequenceGroupByMessageBoxAndCpa¶
-
public int
findMaxSequenceGroupByMessageBoxAndCpa
(MessageDVO data)¶
findMaxSequenceNoByMessageBoxAndCpa¶
-
public int
findMaxSequenceNoByMessageBoxAndCpa
(MessageDVO data)¶
findMessage¶
-
public boolean
findMessage
(MessageDVO data)¶
findMessageByCpa¶
-
public List
findMessageByCpa
(MessageDVO data, int numberOfMessage)¶
findMessagesByHistory¶
-
public List
findMessagesByHistory
(MessageDVO data, int numberOfMessage, int offset)¶
findMessagesByTime¶
-
public List
findMessagesByTime
(int time_period, MessageDVO data, int numberOfMessage, int offset)¶
findNumOfMessagesByMessageBoxAndCpaAndSequenceGroup¶
-
public int
findNumOfMessagesByMessageBoxAndCpaAndSequenceGroup
(MessageDVO data)¶
findNumberOfMessagesByHistory¶
-
public int
findNumberOfMessagesByHistory
(MessageDVO data)¶
findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo¶
-
public boolean
findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo
(MessageDVO data)¶
findOrderedMessagesByMessageBoxAndCpaAndStatus¶
-
public List
findOrderedMessagesByMessageBoxAndCpaAndStatus
(MessageDVO data)¶
findOutboxPendingMessagesByTimestamp¶
-
public List
findOutboxPendingMessagesByTimestamp
(MessageDVO messageDVO)¶
findOutboxProcessingMessagesByTimestamp¶
-
public List
findOutboxProcessingMessagesByTimestamp
(MessageDVO messageDVO)¶
findRefToMessage¶
-
public boolean
findRefToMessage
(MessageDVO data)¶
updateMessage¶
-
public boolean
updateMessage
(MessageDVO data)¶
updateTimedOutMessageStatus¶
-
public int
updateTimedOutMessageStatus
(String status, Date currentTime)¶ Update the status of all timed-out message to
status
. A message is considered as timed-out if the timeout timestamp is earlier than thecurrentTime
.Throws: - DAOException – When
status
is null or Error in persistence connectivity.
See also:
hk.hku.cecid.ebms.spa.dao.MessageDVO.getTimeoutTimestamp()
,hk.hku.cecid.ebms.spa.dao.MessageDVO.setTimeoutTimestamp(java.sql.Timestamp)
- DAOException – When
MessageDVO¶
-
public interface
MessageDVO
extends DVO¶ The
MessageDataSourceDVO
is a implementation of interfaceMesageDVO
and representing one persistence record in the table message.Author: Donahue Sze, Twinsen Tsang (modifier)
Methods¶
getHasResendAsNew¶
getPrimalMessageId¶
getSyncReply¶
getTimeoutTimestamp¶
setAckRequested¶
setDupElimination¶
setFromPartyId¶
setFromPartyRole¶
setHasResendAsNew¶
setMessageBox¶
setMessageId¶
setMessageType¶
setPrimalMessageId¶
setPrincipalId¶
setRefToMessageId¶
setSequenceNo¶
-
public void
setSequenceNo
(int sequenceNo)¶ Parameters: - sequenceNo – The sequenceNo to set.
setSyncReply¶
setTimeStamp¶
setTimeToLive¶
setTimeoutTimestamp¶
setToPartyId¶
MessageDataSourceDAO¶
-
public class
MessageDataSourceDAO
extends DataSourceDAO implements MessageDAO¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
Methods¶
addMessage¶
-
public void
addMessage
(MessageDVO data)¶
deleteMessage¶
-
public void
deleteMessage
(MessageDVO data)¶
findInboxPendingMessagesByTimestamp¶
-
public List
findInboxPendingMessagesByTimestamp
(MessageDVO data)¶ Find all the pending messages for inbox collector order by timestamp.
Parameters: - data – The message data value object.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
findInboxReadyMaxSequenceNoByCpa¶
-
public int
findInboxReadyMaxSequenceNoByCpa
(MessageDVO data)¶ Find max sequence no. of inbox message in PS or DL status by CPA Only for EbMS Inbox Collector Service
Parameters: - data – The message data value object.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: max sequence no. -1 will be returned if there is no matching data.
findMaxSequenceGroupByMessageBoxAndCpa¶
-
public int
findMaxSequenceGroupByMessageBoxAndCpa
(MessageDVO data)¶
findMaxSequenceNoByMessageBoxAndCpa¶
-
public int
findMaxSequenceNoByMessageBoxAndCpa
(MessageDVO data)¶ Find max sequence no. of message by CPA and message box
Parameters: - data – The message data value object.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: max sequence no. -1 will be returned if there is no matching data.
findMessage¶
-
public boolean
findMessage
(MessageDVO data)¶
findMessageByCpa¶
-
public List
findMessageByCpa
(MessageDVO data, int numberOfMessage)¶ Find all the message by CPA, status, message type and message box. Only for EbMS Message Collector Service
Parameters: - data – The message data value object.
- numberOfMessage – The no. of message return.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
findMessagesByHistory¶
-
public List
findMessagesByHistory
(MessageDVO data, int numberOfMessage, int offset)¶ Find messages order by descending timestamp by different criteria.
Parameters: - data – The message data value object carrying query criteria.
- numberOfMessage – max no. of message in return.
- offset – no. of starting record in return.
Throws:
findMessagesByTime¶
-
public List
findMessagesByTime
(int time_period, MessageDVO data, int numberOfMessage, int offset)¶
findNumOfMessagesByMessageBoxAndCpaAndSequenceGroup¶
-
public int
findNumOfMessagesByMessageBoxAndCpaAndSequenceGroup
(MessageDVO data)¶
findNumberOfMessagesByHistory¶
-
public int
findNumberOfMessagesByHistory
(MessageDVO data)¶ Find number of messages by different criteria.
Parameters: - data – The message data value object carrying query criteria.
Throws:
findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo¶
-
public boolean
findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo
(MessageDVO data)¶
findOrderedMessagesByMessageBoxAndCpaAndStatus¶
-
public List
findOrderedMessagesByMessageBoxAndCpaAndStatus
(MessageDVO data)¶
findOutboxPendingMessagesByTimestamp¶
-
public List
findOutboxPendingMessagesByTimestamp
(MessageDVO data)¶ Find all the pending messages for outbox collector order by timestamp.
Parameters: - data – The message data value object.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
findOutboxProcessingMessagesByTimestamp¶
-
public List
findOutboxProcessingMessagesByTimestamp
(MessageDVO data)¶ Find all the processing messages for outbox collector order by timestamp.
Parameters: - data – The message data value object.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
findRefToMessage¶
-
public boolean
findRefToMessage
(MessageDVO data)¶
updateMessage¶
-
public boolean
updateMessage
(MessageDVO data)¶
updateTimedOutMessageStatus¶
-
public int
updateTimedOutMessageStatus
(String status, Date currentTime)¶ Update the status of all timed-out message to
status
. A message is considered as timed-out if the timeout timestamp is earlier than thecurrentTime
.Throws: - DAOException – When
status
is null or Error in persistence connectivity.
See also:
hk.hku.cecid.ebms.spa.dao.MessageDVO.getTimeoutTimestamp()
,hk.hku.cecid.ebms.spa.dao.MessageDVO.setTimeoutTimestamp(java.sql.Timestamp)
- DAOException – When
MessageDataSourceDAOTest¶
-
public class
MessageDataSourceDAOTest
extends DAOTest<MessageDataSourceDAO>¶
Methods¶
MessageDataSourceDVO¶
-
public class
MessageDataSourceDVO
extends DataSourceDVO implements MessageDVO¶ The
MessageDataSourceDVO
is a implementation of interfaceMesageDVO
and representing one persistence record in the table message.Author: Donahue Sze, Twinsen Tsang (modifier)
Methods¶
getHasResendAsNew¶
getPrimalMessageId¶
getSyncReply¶
getTimeoutTimestamp¶
setAckRequested¶
setAckSignRequested¶
setConvId¶
setDupElimination¶
setFromPartyId¶
setFromPartyRole¶
setHasResendAsNew¶
setMessageBox¶
setMessageId¶
setMessageType¶
setPrimalMessageId¶
setPrincipalId¶
setRefToMessageId¶
setSequenceGroup¶
-
public void
setSequenceGroup
(int sequenceGroup)¶ Parameters: - sequenceGroup – The sequenceGroup to set.
setSequenceNo¶
-
public void
setSequenceNo
(int sequenceNo)¶ Parameters: - sequenceNo – The sequenceNo to set.
setSyncReply¶
setTimeStamp¶
setTimeToLive¶
setTimeoutTimestamp¶
setToPartyId¶
MessageServerDAO¶
Methods¶
clearMessage¶
-
public void
clearMessage
(MessageDVO data)¶
storeMessage¶
-
public void
storeMessage
(MessageDVO messageDVO, RepositoryDVO repositoryDVO)¶
storeOutboxMessage¶
-
public void
storeOutboxMessage
(MessageDVO messageDVO, RepositoryDVO repositoryDVO, OutboxDVO outboxDVO, MessageDVO primalMsgDVO)¶
MessageServerDataSourceDAO¶
-
public class
MessageServerDataSourceDAO
extends DataSourceDAO implements MessageServerDAO¶ Author: Donahue Sze
Methods¶
clearMessage¶
-
public void
clearMessage
(MessageDVO data)¶
storeMessage¶
-
public void
storeMessage
(MessageDVO messageDVO, RepositoryDVO repositoryDVO)¶
storeOutboxMessage¶
-
public void
storeOutboxMessage
(MessageDVO messageDVO, RepositoryDVO repositoryDVO, OutboxDVO outboxDVO, MessageDVO primalMsgDVO)¶
MessageServerDataSourceDVO¶
-
public class
MessageServerDataSourceDVO
extends DataSourceDVO implements MessageServerDVO¶ Author: Donahue Sze
OutboxDAO¶
OutboxDataSourceDAO¶
-
public class
OutboxDataSourceDAO
extends DataSourceDAO implements OutboxDAO¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
Methods¶
OutboxDataSourceDVO¶
-
public class
OutboxDataSourceDVO
extends DataSourceDVO implements OutboxDVO¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
PartnershipDAO¶
PartnershipDVO¶
PartnershipDataSourceDAO¶
-
public class
PartnershipDataSourceDAO
extends DataSourceDAO implements PartnershipDAO¶ Author: Donahue Sze
PartnershipDataSourceDVO¶
-
public class
PartnershipDataSourceDVO
extends DataSourceDVO implements PartnershipDVO¶ Author: Donahue Sze
RepositoryDAO¶
Methods¶
addRepository¶
-
public void
addRepository
(RepositoryDVO data)¶
deleteRepository¶
-
public void
deleteRepository
(RepositoryDVO data)¶
findRepository¶
-
public boolean
findRepository
(RepositoryDVO data)¶
updateRepository¶
-
public boolean
updateRepository
(RepositoryDVO data)¶
RepositoryDVO¶
RepositoryDataSourceDAO¶
-
public class
RepositoryDataSourceDAO
extends DataSourceDAO implements RepositoryDAO¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
Methods¶
addRepository¶
-
public void
addRepository
(RepositoryDVO data)¶
deleteRepository¶
-
public void
deleteRepository
(RepositoryDVO data)¶
findRepository¶
-
public boolean
findRepository
(RepositoryDVO data)¶
updateRepository¶
-
public boolean
updateRepository
(RepositoryDVO data)¶
RepositoryDataSourceDVO¶
-
public class
RepositoryDataSourceDVO
extends DataSourceDVO implements RepositoryDVO¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
hk.hku.cecid.ebms.spa.handler¶
EbxmlMessageDAOConvertor¶
-
public class
EbxmlMessageDAOConvertor
¶ The EbxmlMessageDAOConvertor construct the necessary DAO Data from EbxmlMessage.
Author: Donahue Sze
Constructors¶
EbxmlMessageDAOConvertor¶
-
public
EbxmlMessageDAOConvertor
(EbxmlMessage ebxmlMessage, String messageBox, String messageType)¶ Create a new instance of Ebxml Message to DAO Data Convertor
Parameters: - ebxmlMessage – Ebxml Message to be converted
- messageBox – Message box the message will be stored
- messageType – The type of the message
Methods¶
getEbxmlMessage¶
-
public static EbxmlMessage
getEbxmlMessage
(String messageId, String messageBox)¶
getInboxDVO¶
getMessageDVO¶
-
public MessageDVO
getMessageDVO
()¶ Get the message dao data
Throws: Returns: The message dao data
getOutboxDVO¶
getRepositoryDVO¶
-
public RepositoryDVO
getRepositoryDVO
()¶ Get the repository DAO data
Throws: Returns: The repository DAO data
InboundMessageProcessor¶
-
public class
InboundMessageProcessor
¶ Author: Donahue Sze Preferences - Java - Code Style - Code Templates
Fields¶
inboundMessageProcessor¶
-
static InboundMessageProcessor
inboundMessageProcessor
¶
Methods¶
getInstance¶
-
public static InboundMessageProcessor
getInstance
()¶
processIncomingMessage¶
-
public void
processIncomingMessage
(EbmsRequest request, EbmsResponse response)¶
MessageClassifier¶
-
public class
MessageClassifier
¶ Author: Donahue Sze
Fields¶
Constructors¶
MessageClassifier¶
-
public
MessageClassifier
(EbxmlMessage ebxmlMessage)¶
MessageServiceHandler¶
-
public class
MessageServiceHandler
¶ EbxmlMessageDAOConvertor Service Handler that supports asynchronous communication and reliable messaging.
Author: cyng
Fields¶
Methods¶
createSignatureHandler¶
-
public static SignatureHandler
createSignatureHandler
(EbxmlMessage message)¶
createSignatureHandler¶
-
public static SignatureHandler
createSignatureHandler
(EbxmlMessage message, Certificate certificate)¶
getInstance¶
-
public static synchronized MessageServiceHandler
getInstance
()¶
isInboundAgreementCheck¶
-
public boolean
isInboundAgreementCheck
()¶ Returns: Returns the isInboundAgreementCheck.
isOutboundAgreementCheck¶
-
public boolean
isOutboundAgreementCheck
()¶ Returns: Returns the isOutboundAgreementCheck.
processInboundMessage¶
-
public void
processInboundMessage
(EbmsRequest request, EbmsResponse response)¶
processOutboundMessage¶
-
public void
processOutboundMessage
(EbmsRequest request, EbmsResponse response)¶
MessageServiceHandlerException¶
-
public class
MessageServiceHandlerException
extends hk.hku.cecid.piazza.commons.GenericException¶ DeliveryException represents all kinds of exception occuring in delivery.
Author: Hugo Y. K. Lam
OutboundMessageProcessor¶
-
public class
OutboundMessageProcessor
¶ Author: Donahue Sze
Fields¶
outboundMessageProcessor¶
-
static OutboundMessageProcessor
outboundMessageProcessor
¶
Methods¶
getInstance¶
-
public static synchronized OutboundMessageProcessor
getInstance
()¶
processOutgoingMessage¶
-
public void
processOutgoingMessage
(EbmsRequest request, EbmsResponse response)¶
resendAsNew¶
-
public EbxmlMessage
resendAsNew
(String primalMessageId)¶
SignalMessageGenerator¶
-
public class
SignalMessageGenerator
¶ SignalMessageGenerator
is an utility api for the user to generate some signal messageAuthor: pykoon
Methods¶
generateAcknowledgment¶
-
public static EbxmlMessage
generateAcknowledgment
(EbxmlMessage ackRequestedMessage, String refToMessageId)¶ Generates acknowledgement message from the given acknowledgement request message and the refToMessageId. Note that the acknowledgment message is not signed.
Parameters: - ackRequestedMessage – Acknowledgement request message.
- refToMessageId – MessageId of the message to which the acknowledgement response should be referred.
Throws: - SOAPException –
Returns: Acknowledgement message.
generateAcknowledgment¶
-
public static EbxmlMessage
generateAcknowledgment
(EbxmlMessage ackRequestedMessage)¶ Generates acknowledgement message from the given acknowledgement request message and the refToMessageId. Note that the acknowledgment message is not signed.
Parameters: - ackRequestedMessage – Acknowledgement request message.
Throws: - SOAPException –
Returns: Acknowledgement message.
generateErrorMessage¶
-
public static EbxmlMessage
generateErrorMessage
(EbxmlMessage ebxmlMessage, String errorCode, String severity, String description, String location)¶ Generates an error message containing the specfied error code [ebMSS 4.2.3.4.1].
Parameters: - ebxmlMessage – ebXML message to which error list should be attached.
- errorCode – Error code of the message.
- severity – Error severity, either ERROR or WARNING.
- description – Human-readable description of the error message.
- location – Source of the error.
Throws: - SOAPException –
Returns: ebXML message containing error code.
generateErrorMessageBySender¶
-
public static EbxmlMessage
generateErrorMessageBySender
(EbxmlMessage ebxmlMessage, String errorCode, String severity, String description, String location)¶
generatePongMessage¶
-
public static EbxmlMessage
generatePongMessage
(EbxmlMessage pingMessage)¶ Generates pong message from the given ping message [ebMSS 8.2].
Parameters: - pingMessage – Incoming ping message.
Throws: - SOAPException –
Returns: Pong message in response of the incoming ping message.
generateStatusResponseMessage¶
-
public static EbxmlMessage
generateStatusResponseMessage
(EbxmlMessage statusRequestMessage, String status, Date timestamp)¶ Generates response message from the given status request message and the status string [ebMSS 7.1.2].
Parameters: - statusRequestMessage – Status request message.
- status – Current status of the message service handler.
Throws: - SOAPException –
Returns: Status response message.
hk.hku.cecid.ebms.spa.listener¶
EbmsAdaptor¶
-
public abstract class
EbmsAdaptor
extends SOAPHttpAdaptor¶ Author: Donahue Sze Window - Preferences - Java - Code Style - Code Templates
Methods¶
processRequest¶
-
public abstract void
processRequest
(EbmsRequest request, EbmsResponse response)¶
processRequest¶
-
public void
processRequest
(SOAPRequest soapRequest, SOAPResponse soapResponse)¶
EbmsInboundListener¶
-
public class
EbmsInboundListener
extends EbmsAdaptor¶ Author: Donahue Sze
Methods¶
processRequest¶
-
public void
processRequest
(EbmsRequest request, EbmsResponse response)¶
EbmsOutboundListener¶
-
public class
EbmsOutboundListener
extends EbmsAdaptor¶ Author: Donahue Sze
Methods¶
processRequest¶
-
public void
processRequest
(EbmsRequest request, EbmsResponse response)¶
EbmsRequest¶
-
public class
EbmsRequest
¶ Author: Donahue Sze
Methods¶
getMessage¶
-
public EbxmlMessage
getMessage
()¶ Returns: Returns the msg.
setMessage¶
-
public void
setMessage
(EbxmlMessage message)¶ Parameters: - message – The msg to set.
EbmsResponse¶
-
public class
EbmsResponse
¶ Author: Donahue Sze
Constructors¶
Methods¶
getMessage¶
-
public EbxmlMessage
getMessage
()¶ Returns: Returns the msg.
setMessage¶
-
public void
setMessage
(EbxmlMessage message)¶ Parameters: - message – The msg to set.
hk.hku.cecid.ebms.spa.service¶
EbmsConfigService¶
-
public class
EbmsConfigService
extends WebServicesAdaptor¶
EbmsMessageHistoryService¶
-
public class
EbmsMessageHistoryService
extends WebServicesAdaptor¶
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
EbmsMessageHistoryServiceTest¶
-
public class
EbmsMessageHistoryServiceTest
¶
Fields¶
historyService¶
-
EbmsMessageHistoryService
historyService
¶
EbmsMessageReceiverListService¶
-
public class
EbmsMessageReceiverListService
extends WebServicesAdaptor¶ EbmsMessageReceiverListService
Author: Donahue Sze
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
EbmsMessageReceiverService¶
-
public class
EbmsMessageReceiverService
extends WebServicesAdaptor¶ AS2MessageReceiverListService
Author: Donahue Sze
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
EbmsMessageSenderService¶
-
public class
EbmsMessageSenderService
extends WebServicesAdaptor¶ EbmsMessageSenderService
Author: Hugo Y. K. Lam
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
EbmsPermitRedownloadService¶
-
public class
EbmsPermitRedownloadService
extends WebServicesAdaptor¶
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
hk.hku.cecid.ebms.spa.task¶
AgreementHandler¶
-
public class
AgreementHandler
¶ Author: Donahue Sze
Constructors¶
AgreementHandler¶
-
public
AgreementHandler
(MessageDVO message, boolean isCheckAgreement)¶
AgreementHandler¶
-
public
AgreementHandler
(EbxmlMessage ebxmlMessage, String messageBox, String messageType, boolean isCheckAgreement)¶
Methods¶
DeliveryException¶
-
public class
DeliveryException
extends hk.hku.cecid.piazza.commons.GenericException¶ DeliveryException represents all kinds of exception occuring in delivery.
Author: Hugo Y. K. Lam
EbmsEventListener¶
Methods¶
errorOccurred¶
-
public abstract void
errorOccurred
(EbxmlMessage errorMessage)¶
messageReceived¶
-
public abstract void
messageReceived
(EbxmlMessage requestMessage)¶
messageSent¶
-
public abstract void
messageSent
(EbxmlMessage requestMessage)¶
responseReceived¶
-
public abstract void
responseReceived
(EbxmlMessage acknowledgement)¶
EbmsEventModule¶
-
public class
EbmsEventModule
extends EventModule<EbmsEventListener>¶
Constructors¶
EbmsEventModule¶
-
public
EbmsEventModule
(String descriptorLocation, ClassLoader loader)¶
EbmsEventModule¶
-
public
EbmsEventModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶
Methods¶
fireErrorOccurred¶
-
public void
fireErrorOccurred
(EbxmlMessage errorMessage)¶
fireMessageReceived¶
-
public void
fireMessageReceived
(EbxmlMessage requestMessage)¶
fireMessageSent¶
-
public void
fireMessageSent
(EbxmlMessage requestMessage)¶
fireResponseReceived¶
-
public void
fireResponseReceived
(EbxmlMessage acknowledgement)¶
InboxCollector¶
-
public class
InboxCollector
extends ActiveTaskList¶ Author: Donahue Sze
InboxTask¶
-
public class
InboxTask
implements ActiveTask¶ Author: Donahue Sze
Constructors¶
InboxTask¶
-
public
InboxTask
(MessageDVO message, long nextOrderNo)¶
Methods¶
MailCollector¶
-
public class
MailCollector
extends ActiveTaskList¶ Author: Donahue Sze
MessageMonitor¶
-
public class
MessageMonitor
extends ActiveModule¶ The
MessageMonitor
is a monitor which correct all Creation Date: 14/05/2007Author: Twinsen Tsang
Constructors¶
MessageMonitor¶
-
public
MessageMonitor
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of MessageMonitor.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Methods¶
execute¶
-
public boolean
execute
()¶ The method is invoked constantly with interval defined in the configuration descriptor or 60 second by default. It update the status of all timed-out message to PENDING so that they can be re-sending by Outbox Collector.
Returns: true if this method should be invoked again after a defined interval. See also:
hk.hku.cecid.ebms.spa.task.OutboxCollector
,hk.hku.cecid.ebms.spa.task.OutboxTask
MessageValidationException¶
-
public class
MessageValidationException
extends hk.hku.cecid.piazza.commons.GenericException¶ DeliveryException represents all kinds of exception occuring in delivery.
Author: Hugo Y. K. Lam
OutboxCollector¶
-
public class
OutboxCollector
extends ActiveTaskList¶ Author: Donahue Sze
OutboxTask¶
-
public class
OutboxTask
implements ActiveTask¶ Author: Donahue Sze, Twinsen Tsang (modifiers)
Constructors¶
OutboxTask¶
-
public
OutboxTask
(MessageDVO message)¶ Explicit Constructor.
Parameters: - message –
Methods¶
execute¶
-
public void
execute
()¶ The main execution of
OutboxTask
. The overview procedure is listed in below:- Extract the
EbXMLMessage
from themessageDVO
. - Sign the
EbXMLMessage
by it’s keystore if necessary. - Send the
EbXMLMessage
through HTTP/HTTPS/SMTP protocol. - Update the number of retry attempted to deliver for this
EbXMLMessage
.
- Extract the
getMaxRetries¶
-
public int
getMaxRetries
()¶ Get the maximum execution times for this task. It returns the total number of times that the
EbXML Message
can be attempted to deliver (including non-retry delivery). ForEbXML Message
does not requests ACK, this method always return zero because it does not support retry / re-sending schema when ACK does not requested. [ebMSS section 6.4.3] It is calculated by : Max(maximum retry defined in partnership for this message - 1,0) + 1.See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.getMaxRetries()
,hk.hku.cecid.ebms.spa.dao.PartnershipDVO.getRetries()
,hk.hku.cecid.ebms.spa.dao.OutboxDVO.getRetried()
onFailure¶
setRetried¶
-
public void
setRetried
(int retried)¶ Parameters: - retried – The number of times that this active task has been retried (local retired times).
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.setRetried(int)
hk.hku.cecid.ebms.spa.util¶
EbmsMessageStatusReverser¶
-
public class
EbmsMessageStatusReverser
¶ Reverse message status for message redownload and resend
Author: franz
Methods¶
updateToSend¶
-
public MessageDVO
updateToSend
(String messageId)¶ Reverse OUTBOX message status back to PENDING. Hence, the message can be resent again.
Parameters: - messageId –
- Message Id of the message to be resent
Throws: Returns: MessageDVO of the message to be resent
- messageId –
hk.hku.cecid.edi.as2¶
AS2Exception¶
-
public class
AS2Exception
extends hk.hku.cecid.piazza.commons.GenericException¶ AS2Exception represents all kinds of exception related to AS2 processing.
Author: Hugo Y. K. Lam
AS2PlusProcessor¶
-
public class
AS2PlusProcessor
extends PluginProcessor¶ AS2Processor
Author: Hugo Y. K. Lam
Methods¶
getIncomingMessageProcessor¶
-
public IncomingMessageProcessor
getIncomingMessageProcessor
()¶
getInstance¶
-
public static AS2PlusProcessor
getInstance
()¶
getKeyStoreManager¶
-
public KeyStoreManager
getKeyStoreManager
()¶
getModuleGroupImpl¶
-
protected ModuleGroup
getModuleGroupImpl
()¶
getOutgoingMessageProcessor¶
-
public OutgoingMessageProcessor
getOutgoingMessageProcessor
()¶
getOutgoingPayloadRepository¶
-
public PayloadRepository
getOutgoingPayloadRepository
()¶
processActivation¶
setModuleGroupImpl¶
-
protected void
setModuleGroupImpl
(ModuleGroup moduleGroup)¶
AS2Processor¶
-
public class
AS2Processor
implements PluginHandler¶ AS2Processor
Author: Hugo Y. K. Lam
Fields¶
core¶
-
public static SystemModule
core
¶
Methods¶
getIncomingMessageProcessor¶
-
public static IncomingMessageProcessor
getIncomingMessageProcessor
()¶
getIncomingPayloadRepository¶
-
public static PayloadRepository
getIncomingPayloadRepository
()¶
getKeyStoreManager¶
-
public static KeyStoreManager
getKeyStoreManager
()¶
getMessageRepository¶
-
public static MessageRepository
getMessageRepository
()¶
getModuleGroup¶
-
public static ModuleGroup
getModuleGroup
()¶
getOutgoingPayloadRepository¶
-
public static PayloadRepository
getOutgoingPayloadRepository
()¶
getSystemModule¶
-
public static SystemModule
getSystemModule
()¶
processActivation¶
hk.hku.cecid.edi.as2.admin.listener¶
ChangeMessageStatusPageletAdaptor¶
-
public class
ChangeMessageStatusPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
MessageHistoryOraclePageletAdaptor¶
-
public class
MessageHistoryOraclePageletAdaptor
extends MessageHistoryPageletAdaptor¶ Author: Donahue Sze
MessageHistoryPageletAdaptor¶
-
public class
MessageHistoryPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
MessageHistoryPageletAdaptorTest¶
-
public class
MessageHistoryPageletAdaptorTest
extends TestCase¶
Methods¶
PartnershipPageletAdaptor¶
-
public class
PartnershipPageletAdaptor
extends AdminPageletAdaptor¶ Author: Donahue Sze
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
getHashtable¶
-
public Hashtable
getHashtable
(HttpServletRequest request)¶
RepositoryAdaptor¶
-
public class
RepositoryAdaptor
extends HttpRequestAdaptor¶ Author: Donahue Sze
Methods¶
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶
ResendAsNewAdapter¶
-
public class
ResendAsNewAdapter
extends AdminPageletAdaptor¶
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
hk.hku.cecid.edi.as2.dao¶
AS2DAOHandler¶
-
public class
AS2DAOHandler
¶ AS2DAOHandler
Author: Hugo Y. K. Lam
Constructors¶
AS2DAOHandler¶
-
public
AS2DAOHandler
(DAOFactory daoFactory)¶
AS2DAOHandler¶
-
public
AS2DAOHandler
(DAOFactory daoFactory, Principal principal)¶
Methods¶
createMessageDAO¶
-
public MessageDAO
createMessageDAO
()¶
createMessageDVO¶
-
public MessageDVO
createMessageDVO
(AS2Message message, boolean isIncoming)¶
createMessageStore¶
-
public MessageStoreDAO
createMessageStore
()¶
createPartnershipDAO¶
-
public PartnershipDAO
createPartnershipDAO
()¶
createRawRepositoryDAO¶
-
public RawRepositoryDAO
createRawRepositoryDAO
()¶
createRawRepositoryDVO¶
-
public RawRepositoryDVO
createRawRepositoryDVO
(AS2Message message)¶
createRepositoryDAO¶
-
public RepositoryDAO
createRepositoryDAO
()¶
createRepositoryDVO¶
-
public RepositoryDVO
createRepositoryDVO
(AS2Message message, boolean isIncoming)¶
findMessageDVO¶
-
public MessageDVO
findMessageDVO
(String messageId, String messageBox)¶
findPartnership¶
-
public PartnershipDVO
findPartnership
(AS2Message message, boolean isIncoming)¶
findPartnership¶
-
public PartnershipDVO
findPartnership
(String partnershipId)¶
findPartnership¶
-
public PartnershipDVO
findPartnership
(String fromParty, String toParty)¶
findRawRepositoryDVO¶
-
public RawRepositoryDVO
findRawRepositoryDVO
(String messageId)¶
MessageDAO¶
Methods¶
findMessageByOriginalMessageID¶
findMessagesByHistory¶
-
public List
findMessagesByHistory
(MessageDVO data, int numberOfMessage, int offset)¶
findMessagesByTime¶
-
public List
findMessagesByTime
(int time_period, MessageDVO data, int numberOfMessage, int offset)¶
findNumberOfMessagesByHistory¶
-
public int
findNumberOfMessagesByHistory
(MessageDVO data)¶
MessageDVO¶
Fields¶
Methods¶
getHasResendAsNew¶
getOriginalMessageId¶
getPrimalMessageId¶
setHasResendAsNew¶
setIsAcknowledged¶
-
public void
setIsAcknowledged
(boolean isAcknowledged)¶ Parameters: - isAcknowledged – The isAcknowledged to set.
setIsReceipt¶
-
public void
setIsReceipt
(boolean isReceipt)¶ Parameters: - isReceipt – The isReceipt to set.
setIsReceiptRequested¶
-
public void
setIsReceiptRequested
(boolean isReceiptRequested)¶ Parameters: - isReceiptRequested – The isReceiptRequested to set.
setMessageBox¶
setMessageId¶
setOriginalMessageId¶
setPrimalMessageId¶
MessageDataSourceDAO¶
-
public class
MessageDataSourceDAO
extends DataSourceDAO implements MessageDAO¶ Author: Donahue Sze
Methods¶
findMessageByOriginalMessageID¶
findMessagesByHistory¶
-
public List
findMessagesByHistory
(MessageDVO data, int numberOfMessage, int offset)¶
findMessagesByTime¶
-
public List
findMessagesByTime
(int time_period, MessageDVO data, int numberOfMessage, int offset)¶
findNumberOfMessagesByHistory¶
-
public int
findNumberOfMessagesByHistory
(MessageDVO data)¶
MessageDataSourceDVO¶
-
public class
MessageDataSourceDVO
extends DataSourceDVO implements MessageDVO¶ Author: Donahue Sze
Methods¶
getHasResendAsNew¶
getOriginalMessageId¶
getPrimalMessageId¶
getReceiptUrl¶
getStatusDescription¶
-
public String
getStatusDescription
()¶ getStatusDescription
Returns: String See also:
hk.hku.cecid.edi.as2.dao.MessageDVO.getStatusDescription()
isAcknowledged¶
-
public boolean
isAcknowledged
()¶ isAcknowledged
Returns: @see hk.hku.cecid.edi.as2.dao.MessageDVO#isAcknowledged()
isReceipt¶
-
public boolean
isReceipt
()¶ isReceipt
Returns: @see hk.hku.cecid.edi.as2.dao.MessageDVO#isReceipt()
isReceiptRequested¶
-
public boolean
isReceiptRequested
()¶ isReceiptRequested
Returns: @see hk.hku.cecid.edi.as2.dao.MessageDVO#isReceiptRequested()
setHasResendAsNew¶
setIsAcknowledged¶
-
public void
setIsAcknowledged
(boolean isAcknowledged)¶ setIsAcknowledged
Parameters: - isAcknowledged –
See also:
hk.hku.cecid.edi.as2.dao.MessageDVO.setIsAcknowledged(boolean)
setIsReceipt¶
-
public void
setIsReceipt
(boolean isReceipt)¶ setIsReceipt
Parameters: - isReceipt –
See also:
hk.hku.cecid.edi.as2.dao.MessageDVO.setIsReceipt(boolean)
setIsReceiptRequested¶
-
public void
setIsReceiptRequested
(boolean isReceiptRequested)¶ setIsReceiptRequested
Parameters: - isReceiptRequested –
See also:
hk.hku.cecid.edi.as2.dao.MessageDVO.setIsReceiptRequested(boolean)
setMessageBox¶
setMessageId¶
setOriginalMessageId¶
setPrimalMessageId¶
setReceiptUrl¶
setStatusDescription¶
MessageStoreDAO¶
Methods¶
storeMessage¶
-
public void
storeMessage
(MessageDVO primalMsgDVO, MessageDVO msgDVO, RepositoryDVO repoDVO, RawRepositoryDVO rawRepoDVO)¶
storeMessage¶
-
public void
storeMessage
(MessageDVO[] messageDVO, RepositoryDVO[] repositoryDVO)¶
storeMessage¶
-
public void
storeMessage
(MessageDVO messageDVO, RepositoryDVO repositoryDVO)¶
storeReceipt¶
-
public void
storeReceipt
(MessageDVO receiptMessageDVO, RepositoryDVO receiptRepositoryDVO, MessageDVO originalMessageDVO)¶
MessageStoreDataSourceDAO¶
-
public class
MessageStoreDataSourceDAO
extends DataSourceDAO implements MessageStoreDAO¶ Author: Donahue Sze
Methods¶
storeMessage¶
-
public void
storeMessage
(MessageDVO primalMsgDVO, MessageDVO msgDVO, RepositoryDVO repoDVO, RawRepositoryDVO rawRepoDVO)¶
storeMessage¶
-
public void
storeMessage
(MessageDVO messageDVO, RepositoryDVO repositoryDVO)¶
storeMessage¶
-
public void
storeMessage
(MessageDVO[] messageDVO, RepositoryDVO[] repositoryDVO)¶
storeReceipt¶
-
public void
storeReceipt
(MessageDVO receiptMessageDVO, RepositoryDVO receiptRepositoryDVO, MessageDVO originalMessageDVO)¶
PartnershipDAO¶
PartnershipDVO¶
Fields¶
Methods¶
getEffectiveVerifyCertificate¶
-
public X509Certificate
getEffectiveVerifyCertificate
()¶
getEncryptX509Certificate¶
-
public X509Certificate
getEncryptX509Certificate
()¶
getVerifyX509Certificate¶
-
public X509Certificate
getVerifyX509Certificate
()¶
setIsInboundEncryptRequired¶
-
public void
setIsInboundEncryptRequired
(boolean isInboundEncryptRequired)¶
setIsOutboundCompressRequired¶
-
public void
setIsOutboundCompressRequired
(boolean isOutboundEncryptRequired)¶
PartnershipDataSourceDAO¶
-
public class
PartnershipDataSourceDAO
extends DataSourceDAO implements PartnershipDAO¶ Author: Donahue Sze
PartnershipDataSourceDVO¶
-
public class
PartnershipDataSourceDVO
extends DataSourceDVO implements PartnershipDVO¶ Author: Donahue Sze
Methods¶
getEffectiveVerifyCertificate¶
-
public X509Certificate
getEffectiveVerifyCertificate
()¶
getEncryptX509Certificate¶
-
public X509Certificate
getEncryptX509Certificate
()¶
getVerifyX509Certificate¶
-
public X509Certificate
getVerifyX509Certificate
()¶
setIsInboundEncryptRequired¶
-
public void
setIsInboundEncryptRequired
(boolean isInboundEncryptRequired)¶
setIsOutboundCompressRequired¶
-
public void
setIsOutboundCompressRequired
(boolean isOutboundCompressRequired)¶
RawRepositoryDataSourceDAO¶
-
public class
RawRepositoryDataSourceDAO
extends DataSourceDAO implements RawRepositoryDAO¶
RawRepositoryDataSourceDVO¶
-
public class
RawRepositoryDataSourceDVO
extends DataSourceDVO implements RawRepositoryDVO¶
RepositoryDataSourceDAO¶
-
public class
RepositoryDataSourceDAO
extends DataSourceDAO implements RepositoryDAO¶ Author: Donahue Sze
RepositoryDataSourceDVO¶
-
public class
RepositoryDataSourceDVO
extends DataSourceDVO implements RepositoryDVO¶ Author: Donahue Sze
hk.hku.cecid.edi.as2.listener¶
AS2InboundListener¶
-
public class
AS2InboundListener
extends AS2RequestAdaptor¶ AS2InboundListener
Author: Hugo Y. K. Lam
Methods¶
processRequest¶
-
public void
processRequest
(AS2Request request, AS2Response response)¶ See also:
hk.hku.cecid.edi.as2.listener.AS2RequestAdaptor.processRequest(hk.hku.cecid.edi.as2.listener.AS2Request,hk.hku.cecid.edi.as2.listener.AS2Response)
AS2ReceiptListener¶
-
public class
AS2ReceiptListener
extends AS2RequestAdaptor¶ AS2InboundListener
Author: Hugo Y. K. Lam
Methods¶
processRequest¶
-
public void
processRequest
(AS2Request request, AS2Response response)¶ See also:
hk.hku.cecid.edi.as2.listener.AS2RequestAdaptor.processRequest(hk.hku.cecid.edi.as2.listener.AS2Request,hk.hku.cecid.edi.as2.listener.AS2Response)
AS2Request¶
-
public class
AS2Request
¶ The AS2Request class represents a SOAP request. It is independent of which transport protocol it is using and contains the SOAP message of the original request.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
getMessage¶
-
public AS2Message
getMessage
()¶ Gets the SOAP message of this request.
Returns: the SOAP message of this request.
getSource¶
setMessage¶
-
void
setMessage
(AS2Message message)¶ Sets the SOAP message of this request.
Parameters: - message – the SOAP message of this request.
AS2RequestAdaptor¶
-
public abstract class
AS2RequestAdaptor
extends HttpRequestAdaptor¶ AS2RequestAdaptor
Author: Hugo Y. K. Lam
Methods¶
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ processRequest
Parameters: - request –
- response –
Throws: Returns: String
See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.processRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
processRequest¶
-
public abstract void
processRequest
(AS2Request request, AS2Response response)¶
AS2Response¶
-
public class
AS2Response
¶ The AS2Response class represents a SOAP response. It is independent of which transport protocol it is using and contains the SOAP message of the target response.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
getMessage¶
-
public AS2Message
getMessage
()¶ Gets the SOAP message of this response.
Returns: the SOAP message of this response.
getTarget¶
setMessage¶
-
public void
setMessage
(AS2Message message)¶ Sets the SOAP message of this response.
Parameters: - message – the SOAP message of this response.
hk.hku.cecid.edi.as2.module¶
AS2EventListener¶
Methods¶
errorOccurred¶
-
public abstract void
errorOccurred
(AS2Message errorResponse)¶
messageReceived¶
-
public abstract void
messageReceived
(AS2Message requestMessage)¶
messageSent¶
-
public abstract void
messageSent
(AS2Message requestMessage)¶
responseReceived¶
-
public abstract void
responseReceived
(AS2Message response)¶
AS2EventModule¶
-
public class
AS2EventModule
extends EventModule<AS2EventListener>¶
Constructors¶
AS2EventModule¶
-
public
AS2EventModule
(String descriptorLocation, ClassLoader loader)¶
AS2EventModule¶
-
public
AS2EventModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶
Methods¶
fireErrorOccurred¶
-
public void
fireErrorOccurred
(AS2Message errorResponse)¶
fireMessageReceived¶
-
public void
fireMessageReceived
(AS2Message requestMessage)¶
fireMessageSent¶
-
public void
fireMessageSent
(AS2Message requestMessage)¶
fireResponseReceived¶
-
public void
fireResponseReceived
(AS2Message receipt)¶
IncomingMessage¶
-
class
IncomingMessage
¶ IncomingMessage
Author: Hugo Y. K. Lam
Constructors¶
IncomingMessage¶
-
public
IncomingMessage
(AS2Message requestMessage, KeyStoreManager keyman, AS2DAOHandler daoHandler, Logger logger)¶
Methods¶
generateReceipt¶
-
public AS2Message
generateReceipt
()¶
getDecrytedMessage¶
-
public AS2Message
getDecrytedMessage
()¶
getDisposition¶
-
public Disposition
getDisposition
()¶
processSMime¶
-
public Disposition
processSMime
()¶
IncomingMessageList¶
-
public class
IncomingMessageList
extends ActiveTaskList¶ IncomingMessageList
Author: Hugo Y. K. Lam
IncomingMessageProcessor¶
-
public class
IncomingMessageProcessor
extends SystemComponent¶ IncomingMessageProcessor
Author: Hugo Y. K. Lam
Methods¶
processMessage¶
-
public AS2Message
processMessage
(AS2Message requestMessage)¶
processReceipt¶
-
public void
processReceipt
(AS2Message receipt)¶
processReceivedMessage¶
-
protected AS2Message
processReceivedMessage
(AS2Message requestMessage)¶
IncomingMessageTask¶
-
public class
IncomingMessageTask
implements ActiveTask¶ OutgoingMessageTask
Author: Hugo Y. K. Lam
Constructors¶
IncomingMessageTask¶
-
public
IncomingMessageTask
(MessageDVO messageData)¶ Throws: - AS2Exception –
Methods¶
execute¶
-
public void
execute
()¶ execute
Throws: See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.execute()
getMaxRetries¶
-
public int
getMaxRetries
()¶ getMaxRetries
Returns: int See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.getMaxRetries()
getRetryInterval¶
-
public long
getRetryInterval
()¶ getRetryInterval
Returns: long See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.getRetryInterval()
isRetryEnabled¶
-
public boolean
isRetryEnabled
()¶ isRetryEnabled
Returns: boolean See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.isRetryEnabled()
isSucceedFast¶
-
public boolean
isSucceedFast
()¶ isSucceedFast
Returns: boolean See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.isSucceedFast()
onAwake¶
-
public void
onAwake
()¶ onAwake
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.onAwake()
onFailure¶
setRetried¶
-
public void
setRetried
(int retried)¶ setRetried
Parameters: - retried –
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.setRetried(int)
MessageRepository¶
-
public class
MessageRepository
extends PayloadRepository¶ MessageRepository
Author: Hugo Y. K. Lam
Methods¶
persistMessage¶
-
public void
persistMessage
(AS2Message message)¶
persistMessage¶
-
public void
persistMessage
(MessageDVO message, InputStream content)¶
OutgoingMessageList¶
-
public class
OutgoingMessageList
extends ActiveTaskList¶ OutgoingMessageList
Author: Hugo Y. K. Lam
OutgoingMessageProcessor¶
-
public class
OutgoingMessageProcessor
extends SystemComponent¶
Methods¶
calculateMIC¶
-
public String
calculateMIC
(SMimeMessage smime, PartnershipDVO partnership)¶
resendAsNew¶
-
public AS2Message
resendAsNew
(String primalMessageId)¶
storeOutgoingMessage¶
-
public AS2Message
storeOutgoingMessage
(String messageID, String type, PartnershipDVO partnership, DataSource attachementSource)¶
storeOutgoingMessage¶
-
public AS2Message
storeOutgoingMessage
(String messageID, String type, PartnershipDVO partnership, DataSource attachementSource, MessageDVO primalMsgDVO)¶
OutgoingMessageTask¶
-
public class
OutgoingMessageTask
implements ActiveTask¶ OutgoingMessageTask
Author: Hugo Y. K. Lam
Constructors¶
OutgoingMessageTask¶
-
public
OutgoingMessageTask
(MessageDVO message)¶ Throws: - AS2Exception –
Methods¶
execute¶
-
public void
execute
()¶ execute
Throws: See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.execute()
getMaxRetries¶
-
public int
getMaxRetries
()¶ getMaxRetries
Returns: int See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.getMaxRetries()
getRetryInterval¶
-
public long
getRetryInterval
()¶ getRetryInterval
Returns: long See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.getRetryInterval()
isRetryEnabled¶
-
public boolean
isRetryEnabled
()¶ isRetryEnabled
Returns: boolean See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.isRetryEnabled()
isSucceedFast¶
-
public boolean
isSucceedFast
()¶ isSucceedFast
Returns: boolean See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.isSucceedFast()
onAwake¶
-
public void
onAwake
()¶ onAwake
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.onAwake()
onFailure¶
setRetried¶
-
public void
setRetried
(int retried)¶ setRetried
Parameters: - retried –
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.setRetried(int)
OutgoingPayloadList¶
-
public class
OutgoingPayloadList
extends ActiveTaskList¶ OutgoingPayloadList
Author: Hugo Y. K. Lam
OutgoingPayloadTask¶
-
public class
OutgoingPayloadTask
implements ActiveTask¶ OutgoingPayloadTask
Author: Hugo Y. K. Lam
Constructors¶
OutgoingPayloadTask¶
-
public
OutgoingPayloadTask
(PayloadCache payload)¶ Throws: - AS2Exception –
Methods¶
execute¶
-
public void
execute
()¶ execute
Throws: See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.execute()
getMaxRetries¶
-
public int
getMaxRetries
()¶ getMaxRetries
Returns: int See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.getMaxRetries()
getRetryInterval¶
-
public long
getRetryInterval
()¶ getRetryInterval
Returns: long See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.getRetryInterval()
isRetryEnabled¶
-
public boolean
isRetryEnabled
()¶ isRetryEnabled
Returns: boolean See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.isRetryEnabled()
isSucceedFast¶
-
public boolean
isSucceedFast
()¶ isSucceedFast
Returns: boolean See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.isSucceedFast()
onAwake¶
-
public void
onAwake
()¶ onAwake
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.onAwake()
onFailure¶
setRetried¶
-
public void
setRetried
(int retried)¶ setRetried
Parameters: - retried –
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.setRetried(int)
PayloadCache¶
-
public class
PayloadCache
¶ PayloadCache
Author: Hugo Y. K. Lam
Constructors¶
PayloadCache¶
PayloadCache¶
-
public
PayloadCache
(PayloadRepository repository, File file)¶
hk.hku.cecid.edi.as2.pkg¶
AS2Header¶
-
public class
AS2Header
¶ AS2Header represents a set of AS2 message headers.
Author: Hugo Y. K. Lam
AS2Message¶
-
public class
AS2Message
¶ AS2Message represents an AS2 message.
Author: Hugo Y. K. Lam
Constructors¶
AS2Message¶
-
public
AS2Message
(InputStream message)¶ Creates a new instance of AS2Message.
Parameters: - message – the message as input stream.
Throws: - AS2MessageException – if unable to construct from the given input stream.
AS2Message¶
-
public
AS2Message
(InternetHeaders headers, InputStream content)¶ Creates a new instance of AS2Message.
Parameters: - headers – the headers of this message.
- content – the content stream.
Throws: - AS2MessageException – if unable to construct from the given content stream.
Methods¶
addHeader¶
generateID¶
getBodyPart¶
-
public MimeBodyPart
getBodyPart
()¶ Gets the MIME body part of this message.
Returns: the MIME body part.
getContent¶
-
public Object
getContent
()¶ Gets the content of this message.
Throws: - AS2MessageException – if unable to get the content.
Returns: the content part.
getContentStream¶
-
public InputStream
getContentStream
()¶ Gets the content stream of this message.
Throws: - AS2MessageException – if unable to retrieve the stream.
Returns: the content stream of this message.
getContentType¶
-
public String
getContentType
()¶ Gets the content type.
Throws: - AS2MessageException – if unable to get the content type.
Returns: the content type.
getDispositionNotification¶
-
public DispositionNotification
getDispositionNotification
()¶ Gets the MDN of this message.
Throws: - AS2MessageException – if unable to construct the MDN.
Returns: the MDN.
getDispositionNotificationOptions¶
-
public DispositionNotificationOptions
getDispositionNotificationOptions
()¶ Gets the disposition notification options.
Returns: the disposition notification options.
getFromPartyID¶
getHeader¶
getHeader¶
getHeaders¶
-
public InternetHeaders
getHeaders
()¶ Gets the headers of this message.
Returns: a copy of the headers of this message.
getInputStream¶
-
public InputStream
getInputStream
()¶ Gets the input stream of this message’s content. Any transfer encodings will be decoded before the input stream is provided.
Throws: - AS2MessageException – if unable to retrieve the stream.
Returns: the input stream of this message’s content.
isDispositionNotification¶
-
public boolean
isDispositionNotification
()¶ Checks if this message is an MDN.
Returns: true if this message is an MDN.
isReceiptRequested¶
-
public boolean
isReceiptRequested
()¶ Checks if receipt of message is requested.
Returns: true if receipt of message is requested.
isReceiptSynchronous¶
-
public boolean
isReceiptSynchronous
()¶ Checks if the receipt of message should be sent synchronously.
Returns: true if the receipt of message should be sent synchronously.
removeHeader¶
reply¶
-
public AS2Message
reply
()¶ Replies this message.
Throws: - AS2MessageException – if unable to construct the message.
Returns: the reply message.
setBodyPart¶
-
public void
setBodyPart
(MimeBodyPart bp)¶ Sets the MIME body part of this message.
setContent¶
-
public void
setContent
(Object content, String contentType)¶ Sets a content to this message.
Parameters: - content – the content part.
- contentType – the content type.
Throws: - AS2MessageException – if unable to set the content.
setHeader¶
toByteArray¶
-
public byte[]
toByteArray
()¶ Returns a byte array which represents this message.
Throws: - AS2MessageException – if unable to convert this message into bytes.
Returns: a byte array which represents this message.
toString¶
-
public String
toString
()¶ Returns a string representation of this message.
Returns: a string representation of this message. See also:
java.lang.Object.toString()
writeTo¶
-
public void
writeTo
(OutputStream outs)¶ Writes the message to the given output stream.
Parameters: - outs – the output stream to be written.
Throws: - AS2MessageException – if unable to write the message.
AS2MessageException¶
-
public class
AS2MessageException
extends GenericException¶ AS2MessageException represents an exception related to AS2 message.
Author: Hugo Y. K. Lam
Disposition¶
-
public class
Disposition
¶ Disposition represents an AS2 disposition.
Author: Hugo Y. K. Lam
Fields¶
Methods¶
DispositionException¶
-
public class
DispositionException
extends RuntimeException¶ DispositionException is a runtime exception representing an error-level disposition.
Author: Hugo Y. K. Lam
Constructors¶
DispositionException¶
-
public
DispositionException
(Disposition disposition, String text, Throwable cause)¶
DispositionException¶
-
public
DispositionException
(Disposition disposition, String text)¶
DispositionNotification¶
-
public class
DispositionNotification
¶ DispositionNotification represents an AS2 disposition notification.
Author: Hugo Y. K. Lam
Fields¶
Constructors¶
DispositionNotification¶
-
DispositionNotification
(AS2Message as2Message)¶
Methods¶
getBodyPart¶
-
public MimeBodyPart
getBodyPart
()¶
getDisposition¶
-
public Disposition
getDisposition
()¶
replyTo¶
-
public void
replyTo
(AS2Message message, String reportingUA)¶
setDisposition¶
-
public void
setDisposition
(Disposition disposition)¶
DispositionNotificationOption¶
-
public class
DispositionNotificationOption
¶ DispositionNotificationOption represents an AS2 disposition notification option.
Author: Hugo Y. K. Lam
Fields¶
Constructors¶
Methods¶
DispositionNotificationOptions¶
-
public class
DispositionNotificationOptions
¶ DispositionNotificationOption represents the AS2 disposition notification options.
Author: Hugo Y. K. Lam
Fields¶
Constructors¶
Methods¶
addOption¶
-
public void
addOption
(DispositionNotificationOption option)¶
addOption¶
-
public DispositionNotificationOption
addOption
(String name)¶
getOption¶
-
public DispositionNotificationOption
getOption
(String name)¶
hk.hku.cecid.edi.as2.service¶
AS2ConfigService¶
-
public class
AS2ConfigService
extends WebServicesAdaptor¶ This is a AS2 Configuration Web Service. The XML SOAP Message should be liked this.
<active-module-status> true | false </active-module-status> <inmessage-interval>15000 </inmessage-interval> <inmessage-maxthread>0</inmessage-maxthread> <outmessage-interval>15000</outmessage-interval> <outmessage-maxthread>0</outmessage-maxthread> <outpayload-interval>15000</outpayload-interval> <outpayload-maxthread>0</outpayload-maxthread>
Author: Twinsen Tsang.
AS2MessageHistoryService¶
-
public class
AS2MessageHistoryService
extends WebServicesAdaptor¶
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
AS2MessageReceiverListService¶
-
public class
AS2MessageReceiverListService
extends WebServicesAdaptor¶ AS2MessageReceiverListService
Author: Donahue Sze
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
AS2MessageReceiverService¶
-
public class
AS2MessageReceiverService
extends WebServicesAdaptor¶ AS2MessageReceiverListService
Author: Donahue Sze
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
AS2MessageSenderService¶
-
public class
AS2MessageSenderService
extends WebServicesAdaptor¶ AS2MessageSenderService
Author: Hugo Y. K. Lam
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
AS2MessageStatusQueryService¶
-
public class
AS2MessageStatusQueryService
extends WebServicesAdaptor¶ AS2MessageStatusQueryService
Author: Donahue Sze
AS2PermitRedownloadService¶
-
public class
AS2PermitRedownloadService
extends WebServicesAdaptor¶
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
hk.hku.cecid.edi.as2.util¶
AS2MessageStatusReverser¶
-
public class
AS2MessageStatusReverser
¶ Reverse message status for message redownload and resend
Author: franz
Methods¶
updateToDownload¶
updateToSend¶
-
public MessageDVO
updateToSend
(String messageId)¶ Reverse OUTBOX message status back to PENDING. Hence, the message can be resent again.
Parameters: - messageId –
- Message Id of the message to be resent
Throws: Returns: MessageDVO of the message to be resent
- messageId –
hk.hku.cecid.edi.sfrm.activation¶
EmptyDataSource¶
-
public class
EmptyDataSource
implements DataSource¶ NullDataSource is an implementation of the javax.activation.DataSource that represents a empty, but not null. datasource Creation Date: 7/11/2006
Author: Twinsen Tsang
Constructors¶
Methods¶
getInputStream¶
-
public InputStream
getInputStream
()¶ This method will return an InputStream representing the the data and will throw an IOException if it can not do so. This method will return a new instance of NullInputStream with each invocation
See also:
hk.hku.cecid.edi.sfrm.io.NullInputStream
getOutputStream¶
-
public OutputStream
getOutputStream
()¶ This method always throw IO exception.
Throws: - IOException – as output stream is not supported by this data source.
FileRegionDataSource¶
-
public class
FileRegionDataSource
extends FileDataSource¶ ByteBufferDataSource is an implementation of the javax.activation.DataSource that represents a data source of a region in the file. Creation Date: 2/11/2006
Author: Twinsen Tsang
Methods¶
getByteBuffer¶
-
public ByteBuffer
getByteBuffer
()¶ This method will return an ByteBuffer representing the the data region and will throw an IOException if it can not do so or OutOfMemory error. For OutOfMemory error in direct memory usage, it’s still an issue in Java. http://bugs.sun.com/view_bug.do?bug_id=5025281 Properly reuse of the memory and set runtime parameter may solve the problem.
See also:
java.nio.channels.FileChannel
getInputStream¶
-
public InputStream
getInputStream
()¶ This method will return an InputStream representing the the data and will throw an IOException if it can not do so. This method will return a new instance of ByteBufferInputStream with the direct byte buffer inside for each invocation.
See also:
java.nio.channels.FileChannel
,hk.hku.cecid.edi.sfrm.io.ByteBufferInputStream
getOutputStream¶
-
public OutputStream
getOutputStream
()¶ This method always throw IO exception.
Throws: - IOException – as output stream is not supported by this data source.
SFRMDataContentHandler¶
-
public class
SFRMDataContentHandler
implements DataContentHandler¶
Methods¶
getContent¶
-
public Object
getContent
(DataSource ds)¶
getTransferData¶
-
public Object
getTransferData
(DataFlavor df, DataSource ds)¶
getTransferDataFlavors¶
-
public DataFlavor[]
getTransferDataFlavors
()¶
writeTo¶
-
public void
writeTo
(Object obj, String mime, OutputStream os)¶
hk.hku.cecid.edi.sfrm.admin.listener¶
MessageHistoryPageletAdaptor¶
-
public class
MessageHistoryPageletAdaptor
extends AdminPageletAdaptor¶ Author: Patrick Yip
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
PartnershipPageletAdaptor¶
-
public class
PartnershipPageletAdaptor
extends AdminPageletAdaptor¶ Author: Patrick Yip
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
getHashtable¶
-
public Hashtable
getHashtable
(HttpServletRequest request)¶
hk.hku.cecid.edi.sfrm.archive¶
Archiver¶
-
public interface
Archiver
¶ An Archiver is the interface that provide the basic archive operations like:
- Compress operations
- Extract operations
- List operations
Creation Date: 13/11/2006
Author: Twinsen Tsang
Methods¶
compress¶
-
public boolean
compress
(File src, File dest, boolean includeItself)¶ Compress the
src
todest
in the archive form. If thesrc
is a file, then the resulting archive contains only that file. If thesrc
is a directory, then the resulting archive contains all files (recursively) in the src. If the flagincludeItself
is true , then thesrc
will also include in the archive as the root.Parameters: - src – The source of the file(s) to be archive.
- dest – The destination of the arhived file.
- includeItself – the source directory includes in the archive if it is true, vice versa.
Throws: - IOException – if any kind of I/O Erros
Returns: true if the operations run successfully.
compress¶
-
public boolean
compress
(FileSystem src, File dest)¶ Compress the
src
todest
in the archive form.Parameters: - src – The source of the file(s) to be archive.
- dest – The destination of the arhived file.
- includeItself – the source directory includes in the archive if it is true, vice versa.
Throws: - IOException – if any kind of I/O Errors.
Returns: true if the operations run successfully.
extract¶
-
public boolean
extract
(File archive, File dest)¶ Extract the
archive
to thedest
directory.Parameters: - archive – The archive to be extract.
- dest – The destination directory extract to.
Throws: - IOException – Any kind of I/O Errors.
- IllegalArgumentException – If the
dest
is not a directory.
Returns: true if the operations run successfully.
extract¶
-
public boolean
extract
(File archive, FileSystem dest)¶ Extract the
archive
to thedest
directory.Parameters: - archive – The archive to be extract.
- dest – The destination directory extract to.
Throws: - IOException – Any kind of I/O Errors.
Returns: true if the operations run successfully.
guessCompressedSize¶
-
public long
guessCompressedSize
(File src)¶ Guess how big is the compressed file without compressing actually.
Parameters: - src – The source of the file(s) to be archive.
Throws: - NullPointerException – if the
src
is null. - IOException – if one of the file in the folders does not exist in some reason.
guessCompressedSize¶
-
public long
guessCompressedSize
(FileSystem src)¶ Guess how big is the compressed file without compressing actually.
Parameters: - src – The source of the file(s) to be archive.
Throws: - NullPointerException – if the
src
is null. - IOException – if one of the file in the folders does not exist in some reason.
isSupportArchive¶
-
public boolean
isSupportArchive
(File archive)¶ Check whether the
archive
is supported by this type of archiver. The execution time of this method solely depends on how the archiver structure look like. For example, ArchiverZIP return immediately because it checks only with the extension of the archive file, without the actual content.Parameters: - archive – The archive to be tested.
Returns: true if the archiver support this
archive
.
listAsFile¶
ArchiverNULL¶
-
public abstract class
ArchiverNULL
implements Archiver¶ An ArchiverNULL is a null packaging device that provides some useful method for the sub-class which enhance code design and ease to read.
- Pre-error Handling of compress,list and extract
Creation Date: 13/11/2006
Author: Twinsen Tsang
Methods¶
compress¶
-
public boolean
compress
(File src, File dest, boolean includeItself)¶ The NULL archiver validates all fields in the parameters and return false in the end.
Parameters: - src – The source of the file(s) to be archive.
- dest – The destination of the arhived file.
- includeItself – the source directory includes in the archive if it is true, vice versa.
Throws: - IOException – if any kind of I/O Erros
Returns: true if the operations run successfully.
See also:
hk.hku.cecid.edi.sfrm.archive.Archiver.compress(File,File,boolean)
extract¶
-
public boolean
extract
(File archive, File dest)¶ The NULL archiver validates all fields in the parameters and return false in the end. If the destination directory does not exist, the NULL archiver will create one for you.
Parameters: - archive – The archive to be extract.
- dest – The destination directory extract to.
Throws: - IOException – Any kind of I/O Errors.
- IllegalArgumentException – If the
dest
is not a directory.
Returns: true if the operations run successfully.
getBaseArchivingDirectory¶
listAsFile¶
listAsFilename¶
listFilesToArchive¶
-
protected Iterator
listFilesToArchive
(File src)¶ List out all files that need to be archive in a
compress(File,File,boolean)
call. NOTE: This method should only be used inside thecompress
method.Parameters: - src – The source of the file(s) to be archive.
Returns: An iterator whichs contains a list of files object to archive.
ArchiverTar¶
-
public class
ArchiverTar
extends ArchiverNULL¶ Author: Patrick Yip
Methods¶
compress¶
-
public boolean
compress
(File src, File dest, boolean includeItself)¶ Compress the
src
todest
in the archive form. If thesrc
is a file, then the resulting archive contains only that file. If thesrc
is a directory, then the resulting archive contains all files (recursively) in the src. Thesrc
file sets will be archived to TAR format which is comes from Apache Ant Tools Tar. For more details, read Apache Ant Tool TarParameters: - src – The source of the file(s) to be archive.
- dest – The destination of the arhived file.
- includeItself – the source directory includes in the archive if it is true, vice versa.
Throws: - IOException – if any kind of I/O Erros
Returns: true if the operations run successfully.
See also:
hk.hku.cecid.edi.sfrm.archive.Archiver.compress(File,File,boolean)
compress¶
-
public boolean
compress
(FileSystem src, File dest)¶
extract¶
-
public boolean
extract
(File archive, File dest)¶ Extract the
archive
to thedest
directory.Parameters: - archive – The archive to be extract.
- dest – The destination directory extract to.
Throws: - IOException – Any kind of I/O Errors.
- IllegalArgumentException – If the
dest
is not a directory.
Returns: true if the operations run successfully.
extract¶
-
public boolean
extract
(File archive, FileSystem dest)¶ Extract the
archive
to thedest
directory.Parameters: - archive – The archive to be extract.
- dest – The destination directory extract to.
Throws: - IOException – Any kind of I/O Errors.
Returns: true if the operations run successfully.
guessCompressedSize¶
-
public long
guessCompressedSize
(File src)¶ Guess how big is the compressed file without compressing actually. The algorithm of guessing the tar size as follow: For each of file Each header size is TAR_ENTRY_SIZE bytes, and for the data content block. It use TAR_ENTRY_SIZE as a block of data. If for last block of data is not TAR_ENTRY_SIZE, then the rest will padding with the empty bytes. Such that the final guessed size is ceil((file_length/TAR_ENTRY_SIZE)+1)*TAR_ENTRY_SIZE. More details of tar file format can found from this.
Parameters: - src – The source of the file(s) to be archive.
Throws: - NullPointerException – if the
src
is null. - IOException – if one of the file in the folders does not exist in some reason.
Returns: guessed file size in byte
guessCompressedSize¶
-
public long
guessCompressedSize
(FileSystem src)¶
listAsFile¶
ArchiverTarTest¶
-
public class
ArchiverTarTest
extends TestCase¶ Author: Patrick Yip
SFRMTarEntry¶
-
public class
SFRMTarEntry
extends TarEntry¶ Author: Patrick
SFRMTarInputStream¶
-
public class
SFRMTarInputStream
extends TarInputStream¶ Author: Patrick Yip
Constructors¶
SFRMTarInputStream¶
-
public
SFRMTarInputStream
(InputStream arg0)¶
SFRMTarInputStream¶
-
public
SFRMTarInputStream
(InputStream is, int blockSize)¶
SFRMTarInputStream¶
-
public
SFRMTarInputStream
(InputStream is, int blockSize, int recordSize)¶
Methods¶
getNextEntry¶
-
public TarEntry
getNextEntry
()¶ Get the next entry in this tar archive. This will skip over any remaining data in the current entry, if there is one, and place the input stream at the header of the next entry, and read the header and instantiate a new TarEntry from the header bytes and return that entry. If there are no more entries in the archive, null will be returned to indicate that the end of the archive has been reached.
Throws: - IOException – on error
Returns: The next TarEntry in the archive, or null.
SFRMTarOutputStream¶
-
public class
SFRMTarOutputStream
extends TarOutputStream¶ Author: Patrick Yip
Constructors¶
SFRMTarOutputStream¶
-
public
SFRMTarOutputStream
(OutputStream os)¶
SFRMTarOutputStream¶
-
public
SFRMTarOutputStream
(OutputStream os, int blockSize)¶
SFRMTarOutputStream¶
-
public
SFRMTarOutputStream
(OutputStream os, int blockSize, int recordSize)¶
Methods¶
putNextEntry¶
-
public void
putNextEntry
(TarEntry entry)¶ Put an entry on the output stream. This writes the entry’s header record and positions the output stream for writing the contents of the entry. Once this method is called, the stream is ready for calls to write() to write the entry’s contents. Once the contents are written, closeEntry() MUST be called to ensure that all buffered data is completely written to the output stream.
Parameters: - entry – The TarEntry to be written to the archive.
Throws: - IOException – on error
SFRMTarUtils¶
-
public class
SFRMTarUtils
¶ Author: Patrick Yip
Methods¶
getNameBytes¶
-
public static int
getNameBytes
(StringBuffer name, byte[] buf, int offset, int length)¶ Determine the number of bytes in an entry name.
Parameters: - name – The header name from which to parse.
- buf – The buffer from which to parse.
- offset – The offset into the buffer from which to parse.
- length – The number of header bytes to parse.
Returns: The number of bytes in a header’s entry name.
parseName¶
-
public static String
parseName
(byte[] header, int offset, int length)¶ Parse an entry name from a header buffer.
Parameters: - header – The header buffer from which to parse.
- offset – The offset into the buffer from which to parse.
- length – The number of header bytes to parse.
Returns: The header’s entry name.
hk.hku.cecid.edi.sfrm.com¶
FoldersPayload¶
-
public class
FoldersPayload
extends NamedPayloads¶ A folders payload represent a folder hierarchical with the set of payloads. Creation Date: 5/10/2006
Author: Twinsen Tsang
Constructors¶
FoldersPayload¶
-
protected
FoldersPayload
(String payloadsName, int initialState, PayloadsRepository owner)¶ Protected Explicit Constructor. This constructor is mainly used for creating a new payload proxy including the physical file and the proxy object.
Parameters: - payloadsName – The name of the newly created payload.
- initialState – The initialState of the payloads, see
PayloadsState
for details. - owner – The owner of the payloads.
Throws: - Exception – Any kind of exceptions.
FoldersPayload¶
-
protected
FoldersPayload
(File payloads, PayloadsRepository owner)¶ Protected Explicit Constructor.
Parameters: - payloads – The payloads directory.
- owner – The owner of this payload.
Throws: - IOException – If the payload is not directory.
Methods¶
clearPayloadCache¶
-
public void
clearPayloadCache
()¶ Clear all the content and the folder for this payload.
decode¶
-
protected void
decode
()¶ Decode the payload root to become some useful information. Only the partnershipId (the first token) is assigned.
Throws: - ArrayIndexOutOfBoundsException – if the decoding fails due to the filename is in wrong format.
load¶
-
public InputStream
load
()¶ The outgoing payload does not support
load
method.
loadChannel¶
-
public ReadableByteChannel
loadChannel
()¶ The outgoing payload does not support
loadChannel
method.
save¶
-
public void
save
(InputStream content, boolean append)¶ The outgoing payload does not support
save
method.
NamedPayloads¶
-
public abstract class
NamedPayloads
¶ A Named payloads is a kind of payload (file attachment) that use it’s filename to provide some informations for the system. It is a proxy design pattern that control the behavior of the actual files. In SFRM plugin, the default style of named payload is shown on the below:
- Outgoing Payload Repository - <service>$<message_id>$timestamp>
- Packaged Payload Repository - <service>$<message_id>
- Incoming Payload Repository - <service>$<message_id>
Creation Date: 6/10/2006.
Author: Twinsen Tsang
Constructors¶
NamedPayloads¶
-
public
NamedPayloads
(String payloadsName, int initialState, PayloadsRepository owner)¶ Explicit Constructor. This constructor is mainly used for creating a new payload proxy including the physical file and the proxy object. NOTE: The physical file is not created until it is necessary.
Parameters: - payloadsName – The name of the newly created payload.
- initialState – The initialState of the payloads, see
PayloadsState
for details. - owner – The owner of the payloads.
Throws: - NullPointerException – if the
owner
is null - IllegalArgumentException – if the
payloadsName
is null or theinitialState
is not invalid.
See also:
hk.hku.cecid.edi.sfrm.com.PayloadsRepostory
,hk.hku.cecid.edi.sfrm.com.PayloadsState
NamedPayloads¶
-
public
NamedPayloads
(File payloads, PayloadsRepository owner)¶ Explicit Constructor. The constructor is mainly used for creating the new payload proxy object only.
Parameters: - payloads – The file payload object.
- owner – The owner of the payloads.
See also:
hk.hku.cecid.edi.sfrm.PayloadsRepostory
Methods¶
clearPayloadCache¶
-
public void
clearPayloadCache
()¶ Clear / Delete the payload cache to free some space.
decode¶
-
protected abstract void
decode
()¶ Decode the payload root to become some useful information.
Throws: - ArrayIndexOutOfBoundsException – if the decoding fails due to the filename is in wrong format.
getOriginalRootname¶
getOwner¶
-
public PayloadsRepository
getOwner
()¶ Returns: get the owner of this payload.
getSize¶
-
public long
getSize
()¶ Returns: get the size of the payload, return 0 if the payload does not exist.
getStateForm¶
-
public static String
getStateForm
(int state)¶ Get the state form string according to the specified state.
Parameters: - state – The state you want to retrieve.
Throws: - IllegalArgumentException – if the state is invalid. For all state see PayloadsState.
isProcessed¶
-
public boolean
isProcessed
()¶ Returns: true if the payload’s name is starting with processed prefix.
isProcessing¶
-
public boolean
isProcessing
()¶ Returns: true if the payload’s name is startting with processing prefix.
isUploading¶
-
public boolean
isUploading
()¶ Returns: true if the payload’s name is startting with processing prefix.
load¶
-
public InputStream
load
()¶ Load the payload content from the input stream. NOTE: This method returns a new instance of input stream.
Throws: - IOException – Throws if the payload file does not exist.
Returns: the content input stream.
loadChannel¶
-
public ReadableByteChannel
loadChannel
()¶ Load the payload content from the input stream channel.
Throws: - IOException – Throws if the payload file does not exist.
Returns: the content input channel.
moveRoot¶
moveToRepository¶
-
public boolean
moveToRepository
(PayloadsRepository newOwner)¶ Move the root to another payloads repository. The owner of this payloads will changes to
newOwner
after invocation of this method.Parameters: - newOwner – The new owner of the payload repository.
Returns: true if the moving operation successfully, false if the
newOwner
is null or moving operation fail.
moveToRepositoryForce¶
-
public boolean
moveToRepositoryForce
(PayloadsRepository newOwner)¶ Move the root to another payloads repository force. The owner of this payloads will changes to
newOwner
after invocation of this method.Parameters: - newOwner – The new owner of the payload repository.
Returns: true if the moving operation successfully, false if the
newOwner
is null or moving operation fail.
renameRoot¶
save¶
-
public void
save
(InputStream content, boolean append)¶ Save the content from the input stream to this payloads. If the content stream is null, it save the file with empty content.
Parameters: - content – The input content stream.
- append – true if the new content is added to the existing content, false if the new content overwrite the existing.
setToPending¶
-
public boolean
setToPending
()¶ Set the status of payload to pending.
Returns: true if the operation run sucessfully.
setToProcessed¶
-
public boolean
setToProcessed
()¶ Set the status of payload to processed.
Returns: true if the operation run sucessfully.
setToProcessing¶
-
public boolean
setToProcessing
()¶ Set the status of payload to processing.
Returns: true if the operation run sucessfully.
OutgoingPayloadsRepository¶
-
public class
OutgoingPayloadsRepository
extends PayloadsRepository¶ The outgoing payloads repository retrieves the payload which is in the form of directory. Creation Date: 5/10/2006
Author: Twinsen Tsang
Methods¶
createPayloads¶
-
public NamedPayloads
createPayloads
(Object[] params, int initialState)¶ Create a customizing payloads for the specified parameter. Since the outgoing payloads is in the form of <partnership_id>$<message_id>, so the size of parameters size should have at least 2.
Parameters: - params – An array object parameters set for creating the payload.
Throws: - IllegalArgumentException – if the size of parameters is smaller than 2.
createPayloadsProxy¶
-
protected NamedPayloads
createPayloadsProxy
(File proxyObj)¶ Create a customizing payloads for this repository.
Parameters: - proxyObj – The file object for the payloads.
Returns: a customizing payloads.
getPayload¶
-
public NamedPayloads
getPayload
(Object[] params, int state)¶ Get a particular payload in the payload repository by the specified parameters. Since the outgoing payloads is in the form of <partnership_id>$<message_id>, so the size of parameters size should have at least 2.
Parameters: - params – An array object parameters set for creating the payload.
- state – The current state of that payload.
Returns: the payload with the specified params or null if it does not exist.
getPayloads¶
-
public Collection
getPayloads
()¶ Returns: A set of directories which contains the payloads set.
getProcessingPayloads¶
-
public Collection
getProcessingPayloads
()¶ Returns: Get the list of processing payloads in the payload repositoy;
PackagedPayloads¶
-
public class
PackagedPayloads
extends NamedPayloads¶ A packaged payloads represent a archive file typed payloads. Creation Date: 6/10/2006
Author: Twinsen Tsang
Constructors¶
PackagedPayloads¶
-
protected
PackagedPayloads
(String payloadsName, int initialState, PayloadsRepository owner)¶ Protected Explicit Constructor. This constructor is mainly used for creating a new payload proxy including the physical file and the proxy object. NOTE: The physical file is not created until it is necessary.
Parameters: - payloadsName – The name of the newly created payload.
- initialState – The initialState of the payloads, see
PayloadsState
for details. - owner – The owner of the payloads.
Throws: - Exception – Any kind of exceptions.
PackagedPayloads¶
-
protected
PackagedPayloads
(File payload, PayloadsRepository owner)¶ Protected Explicit Constructor.
Parameters: - payloads – The payloads directory.
- owner – The owner of this payload.
Throws: - IOException – If the payload is not directory.
Methods¶
getFilename¶
getFoldersPayload¶
-
public FoldersPayload
getFoldersPayload
(PayloadsRepository repo, int state, boolean isCreateFolder)¶ To create a FoldersPayload object for this payload, create the folder in the file system when needed
Parameters: - repo – owner repository of this folder payload
- state – state of the payload folder @see PayloadsState
- isCreateFolder – whether to create the specific folder in the file system
Throws: - IOException – if isCreateFolder is true and cannot create folder successfully
- PayloadException – if isCreateFolder is true and the folder already existing
Returns: FoldersPayload object
isPacked¶
-
public boolean
isPacked
()¶ Get whether the payload is packed in tar format
Returns: true for packed, false otherwise
save¶
-
public void
save
(InputStream content, boolean append)¶ Save the content from the input stream to this payloads. If the content stream is null, it save the file with empty content. This method is rarely used in this class because it’s semantics here is to copy the bytes from the inputstream to the package payload.
Parameters: - content – The input content stream.
- append – true if the new content is added to the existing content, false if the new content overwrite the existing.
PackagedPayloadsRepository¶
-
public class
PackagedPayloadsRepository
extends PayloadsRepository¶ The outgoing payloads repository retrieves the payload which is in the form of zip files. Creation Date: 5/10/2006
Author: Twinsen Tsang
Methods¶
createPayloads¶
-
public NamedPayloads
createPayloads
(Object[] params, int initialState)¶ Create a customizing payloads for the specified parameter. Since the packaged payloads is in the form of <partnership_id>$<message_id>, so the size of parameters size should have at least 2.
Parameters: - params – An array object parameters set for creating the payload.
Throws: - IllegalArgumentException – if the size of parameters is smaller than 2.
createPayloadsProxy¶
-
protected NamedPayloads
createPayloadsProxy
(File proxyObj)¶ Create a customizing payloads for this repository.
Parameters: - proxyObj – The file object for the payloads.
Returns: a customizing payloads.
getPayload¶
-
public NamedPayloads
getPayload
(Object[] params, int state)¶ Get a particular payload in the payload repository by the specified parameters. Since the outgoing payloads is in the form of <partnership_id>$<message_id>, so the size of parameters size should have at least 2.
Parameters: - params – An array object parameters set for creating the payload.
- state – The current state of that payload.
Returns: the payload with the specified params or null if it does not exist.
getPayloads¶
-
public Collection
getPayloads
()¶ Returns: return a set of packaged payload.
getProcessingPayloads¶
-
public Collection
getProcessingPayloads
()¶ Returns: Get the list of processing payloads in the payload repositoy;
getReadyPayloads¶
-
public Collection
getReadyPayloads
()¶ Returns: return a set of ready to sent payload
PackagedPayloadsRepositoryTest¶
-
public class
PackagedPayloadsRepositoryTest
extends SystemComponentTest<PackagedPayloadsRepository>¶
PayloadException¶
-
public class
PayloadException
extends GenericException¶ PayloadException represents all kinds of exception related to SFRM payload. Creation Date: 6/3/2009
Author: Patrick Yip
PayloadsRepository¶
-
public abstract class
PayloadsRepository
extends SystemComponent¶ A Generic repository for collect a set of payloads that satisfies some criteria. SPA Component Guideline:
- Add a new parameter with the name is “location”.
- The value of newly parameter should be the absolute repository path.
Example If the location is C:corvusrepositorytest-repository,
<component id="test" name="Test Repository"> <class>hk.hku.cecid.edi.sfrm.com.XXXXRepository</class> <parameter name="location" value="C:corvusrepositorytest-repository"/> </component>
- Creation Date: 5/10/2006
Author: Twinsen
Constructors¶
Methods¶
createPayloads¶
-
public abstract NamedPayloads
createPayloads
(Object[] params, int initialState)¶ Create a customizing payloads for the specified parameter.
Parameters: - params – An array object parameters set for creating the payload.
- initialState – The initial state of the payloads, see
PayloadsState
for details
Throws: - Exception – Any kind of exception.
createPayloadsProxy¶
-
protected abstract NamedPayloads
createPayloadsProxy
(File proxyObj)¶ Create a customizing payloads for this repository.
Parameters: - proxyObj – The file object for the payloads.
Returns: a customizing payloads.
getPayload¶
-
public NamedPayloads
getPayload
(String name)¶ Get a particular payload in the payload repository.
Parameters: - name – The physical file name of the payload.
Returns: the payload with the specified name or null if it does not exist.
getPayload¶
-
public abstract NamedPayloads
getPayload
(Object[] params, int state)¶ Get a particular payload in the payload repository by the specified parameters.
Parameters: - params – An array object parameters set for creating the payload.
- state – The current state of that payload.
Returns: the payload with the specified params or null if it does not exist.
getPayloads¶
-
public abstract Collection
getPayloads
()¶ Returns: Get the list of pending payloads in the payload repository.
getProcessingPayloads¶
-
public abstract Collection
getProcessingPayloads
()¶ Returns: Get the list of processing payloads in the payload repositoy;
getRepositorySystem¶
-
public FileSystem
getRepositorySystem
()¶ Get the repository system
Returns: Return the repository.
initRepository¶
initRepository¶
hk.hku.cecid.edi.sfrm.dao¶
CacheException¶
DVOCacher¶
-
public interface
DVOCacher
¶ The
DVOCacher
is a component that caches the DVO(s) into partiular format designated in the sub-class. To store DVO that have multiple key, it is recommended to combine the key as a string by a separator “_”. For example, If the messageDVO has the key message_id and message_box, You should use combined key message_id_message_box. Creation Date: 12/2/2007Author: Twinsen Tsang
Methods¶
activeSize¶
-
int
activeSize
()¶ The activs size is defined how many DVO are already stored in the cacher.
Returns: Get the active size of DVO cacher.
efficieny¶
-
double
efficieny
()¶ This method is used to calculate the
getDVO(String)
efficieny (eff) of the cacher. It is formulated :cacheHit eff = (--------------------) * 100 cacheHit + cacheMiss
Returns: the efficiency of the cacher.
getDVO¶
maxSize¶
-
int
maxSize
()¶ The maximum size is defined how many DVO are the cacher can store before swapping out happens.
Returns: Get the maximum size of DVO cacher.
putDVO¶
-
void
putDVO
(String key, DVO cacheItem)¶ Store the DVO
cacheItem
into the cacher with the specifiedKey
. If the DVO in thekey
is already exist, it throws CacheException indicating cache duplication.Parameters: - key – The key field of the DVO.
- cacheItem – The DVO item to be cached.
Throws: - CacheException – when the record is already exist.
See also:
.putOrUpdateDVO(String,DVO);
putOrUpdateDVO¶
SFRMMessageDAO¶
-
public interface
SFRMMessageDAO
extends DAO¶ The Interface of SFRM message dao. Creation Date: 3/10/2006
Author: Twinsen Tsang
Methods¶
findMessageByMessageBoxAndPartnershipIdAndStatus¶
-
public List
findMessageByMessageBoxAndPartnershipIdAndStatus
(String messageBox, String partnershipId, String status)¶ Find a list of message record according to the message box and partnership id and status.
Parameters: - messageBox – The message box of the message.
- partnershipId – The partnership id of the message.
- status – The status of the message.
Throws: - DAOException – if any kind of errors.
Returns: a list of message record the satisfy this condition.
findMessageByMessageBoxAndStatus¶
-
public List
findMessageByMessageBoxAndStatus
(String messageBox, String status)¶ Find a list of message record according to the message box and it’s status.
Parameters: - messageBox – The message box of message. it should be “INBOX” or “OUTBOX”.
- status – The status of the message.
Throws: - DAOException – if any kind of errors.
Returns: a list of message record that satisfy this condition.
findMessageByMessageIdAndBox¶
-
public SFRMMessageDVO
findMessageByMessageIdAndBox
(String messageId, String messageBox)¶ Find a message record with specified message id.
Parameters: - messageId – The message id of message to be found.
- messageBox – The message box of message. it should be “INBOX” or “OUTBOX”.
Throws: - DAOException – if any kind of errors.
Returns: return null if not found, otherwise a message record.
findMessageByMessageIdAndBox¶
-
public SFRMMessageDVO
findMessageByMessageIdAndBox
(SFRMMessageDVO message)¶ Find a message record with specified message record. The field “message id” and “message box” will be used for record finding.
Parameters: - message – The message record object to be used for searching.
Throws: - DAOException – if any kind of errors.
Returns: return null if not found, otherwise a message record.
findMessageForAcknowledgement¶
-
public List
findMessageForAcknowledgement
(int numberOfMessage, int offset)¶ Find the message that is ready for requesting the acknowledgement
Parameters: - numberOfMessage – Number of message show in the page
- offset – Offset of the data in the list of the search result
Throws: - DAOException – if any kind of errors
Returns: List of SFRMMessageDVO that is determined for ready to request for acknowledgement
findMessagesByHistory¶
-
public List
findMessagesByHistory
(SFRMMessageDVO data, int numberOfMessage, int offset)¶ Find messages order by descending timestamp by different criteria.
Parameters: - data – The message data value object carrying query criteria.
- numberOfMessage – max no. of message in return.
- offset – no. of starting record in return.
Throws: - DAOException – if any kind of errors
findMessagesByTime¶
-
public List
findMessagesByTime
(int time_period, SFRMMessageDVO data, int numberOfMessage, int offset)¶ Find the message by the bound of certain time period
Parameters: - time_period – How many month before today
- data – Criteria to search the message for
- numberOfMessage – Number of message show in the page
- offset – Offset of the data in the list of the search result
Throws: - DAOException – if any kind of errors
Returns: List of SFRMMessageDVO that contain the search result
findNumberOfMessagesByHistory¶
-
public int
findNumberOfMessagesByHistory
(SFRMMessageDVO dao)¶ Find number of the message in the message history by a given search criteria given by dao
Parameters: - dao – Search Criteria
Returns: Number of message found
SFRMMessageDVO¶
SFRMMessageSegmentDAO¶
Methods¶
findIncompleteSegments¶
-
public List
findIncompleteSegments
(String messageBox, String status, String type, int limit)¶ Find-out all segments which are incomplete in SFRM semantic. Incomplete Segments are defined as their corresponding message is not in the status of either ‘DF’ or ‘PS’. The query support wildcard on
status
by using ‘%’ string.
findLastUpdatedMessageSegmentByMessageIdAndBoxAndType¶
-
public SFRMMessageSegmentDVO
findLastUpdatedMessageSegmentByMessageIdAndBoxAndType
(String messageId, String messageBox, String type)¶ Find a message segment recrod with specified parameters. The field “message id”, “message box” and “type” will be used for record searching. The message segment extracted is the last updated segments by other module.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The type of the message segment
Throws: - DAOException – Any kind of database error.
Returns: A message segment record if found.
findMaxSegmentNoByMessageIdAndBoxAndType¶
-
public int
findMaxSegmentNoByMessageIdAndBoxAndType
(String messageId, String messageBox, String type)¶ Find the maximum number of segment no in the database from the specified parameters.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The type of the message segment
findMessageSegmentByMessageBoxAndStatusAndTypeAndMessageStatusNotEqualTo¶
findMessageSegmentByMessageIdAndBoxAndType¶
-
public SFRMMessageSegmentDVO
findMessageSegmentByMessageIdAndBoxAndType
(String messageId, String messageBox, int segmentNo, String type)¶ Find a message segment record with specified parameters. The field “message id”, “message box” , “segment no” and “segment type” will be used for record searching.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- segmentNo – The segment no of the message segment.
- type – The type of the message segment
Throws: - DAOException – Any kind of database error.
Returns: A message segment record if found.
findMessageSegmentsByMessageBoxAndStatus¶
-
public List
findMessageSegmentsByMessageBoxAndStatus
(String messageBox, String status, int limit)¶ Find a set of message segment record with specified message box and message status.
Parameters: - messageBox – The message box of the message segment.
- status – The status of the message segment.
- limit – The maximum message segment can be retrieved at one invocation.
Throws: - DAOException – Any kind of database error.
Returns: A set of message segment which meets the specified condition or empty list if no record matched.
findMessageSegmentsByMessageBoxAndStatusAndMessageStatusNotEqualTo¶
-
public List
findMessageSegmentsByMessageBoxAndStatusAndMessageStatusNotEqualTo
(String messageBox, String status, String messageStatus, int limit)¶ Find a set of message segment record with specified message box and message status.
Parameters: - messageBox – The message box of the message segment.
- status – The status of the message segment.
- messageStatus – The associated main message status of the segment.
- limit – The maximum message segment can be retrieved at one invocation.
Throws: - DAOException – Any kind of database error.
Returns: A set of message segment which meets the specified condition or empty list if no record matched.
findNumOfBytesSentByMessageIdAndBoxAndTypeAndStatues¶
-
public long
findNumOfBytesSentByMessageIdAndBoxAndTypeAndStatues
(String messageId, String messageBox, String type, long proceedTime, List<String> statues)¶ Find how many segments is available into the database.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The segment type of the message segment.
- statues – The statues of the message segment.
Throws:
findNumOfSegmentByMessageIdAndBoxAndTypeAndStatus¶
-
public int
findNumOfSegmentByMessageIdAndBoxAndTypeAndStatus
(String messageId, String messageBox, String type, String status)¶ Find how many segments is available into the database.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The segment type of the message segment.
- status – The status of the message segment.
Throws:
findSegmentByMessageIdAndBoxAndTypeAndNos¶
-
public List
findSegmentByMessageIdAndBoxAndTypeAndNos
(String messageId, String messageBox, String type, List<Integer> segmentNos)¶ Find segment by their message id, message box, type and list of segment number
Parameters: - messageId – message ID
- messageBox – message box
- type – segment type
- segmentNos – list of segment number
Throws: Returns: list of SFRMMessageSegmentDVO
findSegmentsByMessageIdAndBoxAndTypeAndStatus¶
-
public List
findSegmentsByMessageIdAndBoxAndTypeAndStatus
(String messageId, String messageBox, String type, String status)¶ Find segment by their message Id, nessage box, message type and message status
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The segment type of the message segment.
- status – The status of the message segment.
Throws:
updateBatchSegmentsRecoveryStatus¶
SFRMPartnershipDAO¶
Methods¶
findAllPartnerships¶
findPartnershipById¶
-
public SFRMPartnershipDVO
findPartnershipById
(SFRMPartnershipDVO partnershipDVO)¶ Find the partnership by the partnership object specified in the parameter object. The partnership id field will be retreived and used for the finder.
Parameters: - partnershipDVO –
Returns: return null if no partnership found, otherwise the a sfrm partnership.
findPartnershipById¶
-
public SFRMPartnershipDVO
findPartnershipById
(String partnershipId)¶ Find the partnership by the service string specified in the parameter.
Parameters: - partnershipId – The partnership id to used for search partnership.
Returns: return null if no partnership found, otherwise the a sfrm partnership.
findPartnershipBySeq¶
-
public SFRMPartnershipDVO
findPartnershipBySeq
(SFRMPartnershipDVO partnershipDVO)¶ Find the partnership by the partnership object specified in the parameter object. The partnership seq field will be retreived and used for the finder.
Parameters: - partnershipDVO –
Throws: Returns: return null if no partnership found, otherwise the a sfrm partnership.
findPartnershipBySeq¶
-
public SFRMPartnershipDVO
findPartnershipBySeq
(int partnershipId)¶ Find the partnership by it’s seq id.
Parameters: - partnershipId –
Returns: return null if no partnership found, otherwise the a sfrm partnership.
SFRMPartnershipDVO¶
Fields¶
Methods¶
getEncryptX509Certificate¶
-
public X509Certificate
getEncryptX509Certificate
()¶
getVerifyX509Certificate¶
-
public X509Certificate
getVerifyX509Certificate
()¶
SimpleLRUDVOCacher¶
-
public class
SimpleLRUDVOCacher
extends Component implements DVOCacher¶ The
SimpleLRUDVOCacher
is the simple DVO cacher which possess LRU, Least-Recently Used features. When there is not enough room to store the DVO as a cache. It tries to remove the oldest record (the one that has not retrieved for longest times). Creation Date: 12/2/2007Author: Twinsen Tsang
Constructors¶
SimpleLRUDVOCacher¶
-
public
SimpleLRUDVOCacher
()¶ Constructor. Use
SimpleLRUDVOCacher(int)
instead of this constructor. This is reserved for Piazza Common component initialization only.
Methods¶
activeSize¶
-
public int
activeSize
()¶ The activs size is defined how many DVO are already stored in the cacher.
Returns: Get the active size of DVO cacher.
efficieny¶
-
public double
efficieny
()¶ This method is used to calculate the
getDVO(String)
efficieny (eff) of the cacher. It is formulated :cacheHit eff = (--------------------) * 100 cacheHit + cacheMiss
Returns: the efficiency of the cacher.
getDVO¶
maxSize¶
-
public int
maxSize
()¶ The maximum size is defined how many DVO are the cacher can store before swapping out happens.
Returns: Get the maximum size of DVO cacher.
putDVO¶
-
public void
putDVO
(String key, DVO cacheItem)¶ Store the DVO
cacheItem
into the cacher with the specifiedKey
. If the DVO in thekey
is already exist, it throws CacheException indicating cache duplication.Parameters: - key – The key field of the DVO.
- cacheItem – The DVO item to be cached.
Throws: - CacheException – when the record is already exist.
See also:
.putOrUpdateDVO(String,DVO);
putOrUpdateDVO¶
hk.hku.cecid.edi.sfrm.dao.ds¶
SFRMMessageDSDAO¶
-
public class
SFRMMessageDSDAO
extends DataSourceDAO implements SFRMMessageDAO¶ The data access object controller for the database table
sfrm_message
. It provides some useful database-level queries. Creation Date: 29/9/2006Author: Twinsen Tsang
Methods¶
createDVO¶
findMessageByMessageBoxAndPartnershipIdAndStatus¶
-
public List
findMessageByMessageBoxAndPartnershipIdAndStatus
(String messageBox, String partnershipId, String status)¶ Find a list of message record according to the message box and partnership id and status.
Parameters: - messageBox – The message box of the message.
- partnershipId – The partnership id of the message.
- status – The status of the message.
Throws: - DAOException – if any kind of errors.
Returns: a list of message record the satisfy this condition.
findMessageByMessageBoxAndStatus¶
-
public List
findMessageByMessageBoxAndStatus
(String messageBox, String status)¶ Find a message record according to the message box and it’s status
Parameters: - messageBox – The message box of message. it should be “INBOX” or “OUTBOX”.
- status – The status of the message.
Throws: Returns: a list of message record that satisfy this condition.
findMessageByMessageIdAndBox¶
-
public SFRMMessageDVO
findMessageByMessageIdAndBox
(String messageId, String messageBox)¶ Find a message record with specified message id.
Parameters: - messageId – The message id of message to be found.
- messageBox – The message box of message. it should be “INBOX” or “OUTBOX”.
Throws: Returns: return null if not found, otherwise a message record.
findMessageByMessageIdAndBox¶
-
public SFRMMessageDVO
findMessageByMessageIdAndBox
(SFRMMessageDVO message)¶ Find a message record with specified message record. The field “message id” and “message box” will be used for record finding.
Parameters: - message – The message record object to be used for searching.
Throws: Returns: return null if not found, otherwise a message record.
findMessageForAcknowledgement¶
findMessagesByHistory¶
-
public List
findMessagesByHistory
(SFRMMessageDVO data, int numberOfMessage, int offset)¶ Find messages order by descending timestamp by different criteria.
Parameters: - data – The message data value object carrying query criteria.
- numberOfMessage – max no. of message in return.
- offset – no. of starting record in return.
Throws: - DAOException – if any kind of errors
findMessagesByTime¶
-
public List
findMessagesByTime
(int time_period, SFRMMessageDVO data, int numberOfMessage, int offset)¶ Find the message by the bound of certain time period. The bounded time period is in term of completed timestamp of message
Parameters: - time_period – How many month before today
- data – Criteria to search the message for
- numberOfMessage – Number of message show in the page
- offset – Offset of the data in the list of the search result
Returns: List of SFRMMessageDVO that contain the search result
findNumberOfMessagesByHistory¶
-
public int
findNumberOfMessagesByHistory
(SFRMMessageDVO data)¶ Find number of the message in the message history by a given search criteria given by dao
Parameters: - dao – Search Criteria
Returns: Number of message found
SFRMMessageDSDAOTest¶
-
public class
SFRMMessageDSDAOTest
extends DAOTest<SFRMMessageDSDAO>¶ Test cases for SFRMMessageDAO
Author: Patrick Yip
SFRMMessageDSDVO¶
-
public class
SFRMMessageDSDVO
extends DataSourceDVO implements SFRMMessageDVO¶ The
SFRMMessageDSDVO
is a data value object that represent a tabular row in sfrm_message at the persistence layer. It possesses caching automatically for most frequently fields shown below:- message id
- message box
- partnership id
- partnership endpoint
- requires signing / encryption
- status
So developers do not need to worry the issue of thread contention and can freely call the get and set with no performance impact. Creation Date: 29/9/2006 Version 1.0.3 -
- Added cache for hot access field, it requires extra 22 bytes per
SFRMMessageDSDVO
object.
Version 1.0.2 -
- Added conversation id
Version 2.0.0 -
- Added sign algorithm
- Removed is signed
- Added encrypt algorithm
- Removed is encrypted
Author: Twinsen Tsang
Methods¶
getCompletedTimestamp¶
getCreatedTimestamp¶
getEncryptAlgorithm¶
getFilename¶
getMessageBox¶
getMessageId¶
getPartnerEndpoint¶
getPartnerX509Certificate¶
-
public X509Certificate
getPartnerX509Certificate
()¶
getPartnershipId¶
getProceedTimestamp¶
getSignAlgorithm¶
getStatus¶
getStatusDescription¶
getTotalSegment¶
-
public int
getTotalSegment
()¶ [@GET, THREAD-SAFETY]
Returns: the total segment of this message DVO.
getTotalSize¶
-
public long
getTotalSize
()¶ [@GET, THREAD-SAFETY]
Returns: the total size of this message DVO.
setCompletedTimestamp¶
setCreatedTimestamp¶
setData¶
setEncryptAlgorithm¶
setFilename¶
setMessageBox¶
setMessageId¶
setPartnerEndpoint¶
setPartnershipId¶
setProceedTimestamp¶
setSignAlgorithm¶
setStatus¶
setStatusDescription¶
SFRMMessageSegmentDSDAO¶
-
public class
SFRMMessageSegmentDSDAO
extends DataSourceDAO implements SFRMMessageSegmentDAO¶ The data access object controller for the database table
sfrm_message_segment
. It provides some useful database-level queries. Creation Date: 29/9/2006Author: Twinsen Tsang
Methods¶
createDVO¶
findIncompleteSegments¶
-
public List
findIncompleteSegments
(String messageBox, String status, String type, int limit)¶ Find-out all segments which are incomplete in SFRM semantic. Incomplete Segments are defined as their corresponding message is not in the status of either ‘DF’ or ‘PS’. The query support wildcard on
status
by using ‘%’ string.
findLastUpdatedMessageSegmentByMessageIdAndBoxAndType¶
-
public SFRMMessageSegmentDVO
findLastUpdatedMessageSegmentByMessageIdAndBoxAndType
(String messageId, String messageBox, String type)¶ Find a message segment recrod with specified parameters. The field “message id”, “message box” and “type” will be used for record searching. The message segment extracted is the last updated segments by other module.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The type of the message segment
Throws: - DAOException – Any kind of database error.
Returns: A message segment record if found.
findMaxSegmentNoByMessageIdAndBoxAndType¶
-
public int
findMaxSegmentNoByMessageIdAndBoxAndType
(String messageId, String messageBox, String type)¶ Find the maximum number of segment no in the database from the specified parameters.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The type of the message segment
findMessageSegmentByMessageBoxAndStatusAndTypeAndMessageStatusNotEqualTo¶
findMessageSegmentByMessageIdAndBoxAndType¶
-
public SFRMMessageSegmentDVO
findMessageSegmentByMessageIdAndBoxAndType
(String messageId, String messageBox, int segmentNo, String type)¶ Find a message segment record with specified parameters. The field “message id”, “message box” , “segment no” and “segment type” will be used for record finding.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The status of the message segment
Throws: - DAOException – Any kind of database error.
Returns: A set of message segment which meets the specified condition or empty list if no record matched.
findMessageSegmentsByMessageBoxAndStatus¶
-
public List
findMessageSegmentsByMessageBoxAndStatus
(String messageBox, String status, int limit)¶ Find a set of message segment record with specified message box and message status.
Parameters: - messageBox – The message box of the message segment.
- status – The status of the message segment.
- limit – The maximum message segment can be retrieved at one invocation.
Throws: - DAOException – Any kind of database error.
Returns: A set of message segment which meets the specified condition or empty list if no record matched.
findMessageSegmentsByMessageBoxAndStatusAndMessageStatusNotEqualTo¶
-
public List
findMessageSegmentsByMessageBoxAndStatusAndMessageStatusNotEqualTo
(String messageBox, String status, String messageStatus, int limit)¶ Find a set of message segment record with specified message box and message status.
Parameters: - messageBox – The message box of the message segment.
- status – The status of the message segment.
- messageStatus – The associated main message status of the segment.
- limit – The maximum message segment can be retrieved at one invocation.
Throws: - DAOException – Any kind of database error.
Returns: A set of message segment which meets the specified condition or empty list if no record matched.
findNumOfBytesSentByMessageIdAndBoxAndTypeAndStatues¶
findNumOfSegmentByMessageIdAndBoxAndTypeAndStatus¶
-
public int
findNumOfSegmentByMessageIdAndBoxAndTypeAndStatus
(String messageId, String messageBox, String type, String status)¶ Find how many segments is available into the database.
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
Throws:
findSegmentByMessageIdAndBoxAndTypeAndNos¶
findSegmentsByMessageIdAndBoxAndTypeAndStatus¶
-
public List
findSegmentsByMessageIdAndBoxAndTypeAndStatus
(String messageId, String messageBox, String type, String status)¶ Find segment by their message Id, nessage box, message type and message status
Parameters: - messageId – The message id of the message segment.
- messageBox – The message box of the message segment.
- type – The segment type of the message segment.
- status – The status of the message segment.
Throws:
updateBatchSegmentsRecoveryStatus¶
SFRMMessageSegmentDSDAOTest¶
-
public class
SFRMMessageSegmentDSDAOTest
extends DAOTest<SFRMMessageSegmentDSDAO>¶ Author: Patrick Yip
SFRMMessageSegmentDSDVO¶
-
public class
SFRMMessageSegmentDSDVO
extends DataSourceDVO implements SFRMMessageSegmentDVO¶ Creation Date: 29/9/2006
Author: Twinsen Tsang
Methods¶
SFRMPartnershipDSDAO¶
-
public class
SFRMPartnershipDSDAO
extends DataSourceDAO implements SFRMPartnershipDAO¶ Creation Date: 27/9/2007
Author: Twinsen
Methods¶
createDVO¶
findAllPartnerships¶
findPartnershipById¶
-
public SFRMPartnershipDVO
findPartnershipById
(SFRMPartnershipDVO partnershipDVO)¶ Find the partnership by the partnership object specified in the parameter object. The partnership id field will be retreived and used for the finder.
Parameters: - partnershipDVO –
Returns: return null if no partnership found, otherwise the a sfrm partnership.
findPartnershipById¶
-
public SFRMPartnershipDVO
findPartnershipById
(String partnershipId)¶ Find the partnership by the service string specified in the parameter.
Parameters: - partnershipId –
Returns: return null if no partnership found, otherwise the a sfrm partnership.
findPartnershipBySeq¶
-
public SFRMPartnershipDVO
findPartnershipBySeq
(SFRMPartnershipDVO partnershipDVO)¶ Find the partnership by the partnership object specified in the parameter object. The partnership id field will be retreived and used for the finder.
Parameters: - partnershipDVO –
Throws: Returns: return null if no partnership found, otherwise the a sfrm partnership.
findPartnershipBySeq¶
-
public SFRMPartnershipDVO
findPartnershipBySeq
(int partnershipId)¶ Find the partnership by it’s id.
Parameters: - partnershipId –
Returns: return null if no partnership found, otherwise the a sfrm partnership.
SFRMPartnershipDSDAOTest¶
-
public class
SFRMPartnershipDSDAOTest
extends DAOTest<SFRMPartnershipDSDAO>¶
Methods¶
SFRMPartnershipDSDVO¶
-
public class
SFRMPartnershipDSDVO
extends DataSourceDVO implements SFRMPartnershipDVO¶ The
SFRMPartnershipDSDVO
is a data value object representing a tabular row in the sfrm_partnership in the persistence layer. Creation Date: 27/9/2006 It possesses caching automatically for most frequently fields shown below:- partnership Id
- partnership endpoint
- maximum retry allowed
- retry interval
- X509 verfication / encryption cerfiticates
So developers do not need to worry the issue of thread contention and can freely call the get and set with no performance impact. Version 1.0.1 -
- Added cache for hot access field, it requires extra 17 bytes + 1 soft reference per
SFRMPartnershipDSDVO
object.
Author: Twinsen Tsang
Methods¶
getCreationTimestamp¶
getDescription¶
getEncryptX509Certificate¶
-
public X509Certificate
getEncryptX509Certificate
()¶ Get X509 certificate from trusted certificate store specified in SFRM properties
Throws: Returns: X509 certificate
getModifiedTimestamp¶
getOrgPartnerEndpoint¶
getPartnerCertFingerprint¶
getPartnerEndpoint¶
-
public String
getPartnerEndpoint
()¶ [@GET, THREAD-SAFETY] Get the sending endpoint of the partnership. The endpoint in the database stores only the address of receiver. For example, like http://127.0.0.1:8080/ or http://sfrm.partnership.com:8080/ But the endpoint returned here will concat a designated conext path = “corvus/httpd/sfrm/inbound”.
getPartnershipId¶
getPartnershipSeq¶
-
public int
getPartnershipSeq
()¶ [@GET, THREAD-SAFETY] Get the partnership sequence no from this partnership DVO.
getRetryInterval¶
-
public int
getRetryInterval
()¶ [@GET, NON-THREAD-SAFETY] Get the retry interval of this partnership DVO.
getRetryMax¶
-
public int
getRetryMax
()¶ [@GET, THREAD-SAFETY] Get the maximum retry allowed for this partnership DVO.
getVerifyX509Certificate¶
-
public X509Certificate
getVerifyX509Certificate
()¶ Get X509 certificate from trusted certificate store specified in SFRM properties
Throws: Returns: X509 certificate
isHostnameVerified¶
-
public boolean
isHostnameVerified
()¶ [@GET, THREAD-SAFETY] whether the partnership requires SSL hostname verified.
setCreationTimestamp¶
setDescription¶
setIsHostnameVerified¶
-
public void
setIsHostnameVerified
(boolean isHostnameVerified)¶ [@SET, THREAD-SAFETY] set whether the partnership requires SSL hostname verified.
setModifiedTimestamp¶
setPartnerCertFingerprint¶
setPartnerEndPoint¶
setPartnershipId¶
setPartnershipSeq¶
-
public void
setPartnershipSeq
(int partnershipSeq)¶ [@SET, THREAD-SAFETY] Set the partnership sequence
setRetryInterval¶
-
public void
setRetryInterval
(int retryInterval)¶ [@SET, THREAD-SAFETY] Set the retry interval of this partnership DVO.
hk.hku.cecid.edi.sfrm.handler¶
AcknowledgementHandler¶
-
public class
AcknowledgementHandler
extends SFRMComponent¶
AcknowledgementHandlerTest¶
-
public class
AcknowledgementHandlerTest
extends PluginTest<SFRMProcessor>¶
DSHandler¶
-
public abstract class
DSHandler
extends SystemComponent¶ The class DSHandler provides abstract interface for getting the actual DAO from the implementation class. Creation Date: 3/10/2006. V1.0.2 - support DVO
Caching
Author: Twinsen Tsang
Fields¶
IncomingMessageHandler¶
-
public class
IncomingMessageHandler
extends SFRMComponent¶ The incoming message handler is the core class for handling all incoming SFRM segment. It also handles:
- Allocation of disk space for HANDSHAKING segment.
- Insertion of data content to specified file for PAYLOAD segment.
- RECEIPT Response handling
- RECOVERY when data integrity check fails.
- Error Definition and handling
For details, read
processIncomingMessage(SFRMMessage,Object[])
as the entry point for knowing how this class work. Creation Date: 11/10/2006Author: Twinsen Tsang
Methods¶
extractPartnership¶
-
public SFRMPartnershipDVO
extractPartnership
(SFRMMessage incomingMessage)¶ Validate whether the partnership for the incoming message is exist and return that partnership as return value. [SINGLE-THREADED].
Parameters: - incomingMessage – The incoming SFRM message.
Throws: - MalformedURLException – throw if the partnership does not found or any other database error.
Returns: A SFRM partnership record.
getInstance¶
-
public static IncomingMessageHandler
getInstance
()¶ Returns: an instnace of IncomingMessageHandler.
init¶
-
protected void
init
()¶ Invoked for initialization. The IMH has serval properties :
- maxActive: The number of parallel threads for handling incoming segments. The default value is 10. [Integer]
initGuardForSegment¶
-
public boolean
initGuardForSegment
(SFRMMessage incomingMessage)¶ initalize the Guard so that there is ONLY ONE THREAD working per the
incomingMessage
.Parameters: - incomgMessage – The incoming SFRM Message.
isDuplicateSegment¶
-
public boolean
isDuplicateSegment
(SFRMMessage incomingMessage)¶ Validate whether the incoming segment message has been received once.
Parameters: - incomingMessage – The incoming SFRM message.
Throws: - DAOException – throw if there is any kind of database error.
Returns: true if it is a duplicated (received already).
isNotEnoughRoom¶
-
public boolean
isNotEnoughRoom
(SFRMMessage incomingMessage, long threshold)¶ Validate whether the harddisk has enough space for this message. The validation formula is liked this:
pS : total payload size T : threshold (the minimum hard disk space) HDDS: the remaining hard disk space true iff (HDDS >= pS + T) false iff (HDDS < ps + T)
Parameters: - incomingMessage – The incoming SFRM message.
- threshold – The remaining disk space threshold. if the remaining disk space is lower than (this value + the payload size), in this case, it always return false.
Returns: true if there is enough hard disk space or the associated payloads is created already in the harddisk. vice versa.
isProcessingMessage¶
-
public boolean
isProcessingMessage
(SFRMMessage incomingMessage)¶ Validate whether the associated message of this incoming segment is processing. Any state except
SFRMConstant.MSGS_PROCESSING
return false for this method invocation. If the message record does not exist in receiver, we treat this as failure because every segment should has handshaking steps before sending.Parameters: - incomingMessage – The incoming SFRM message.
Throws: - DAOException – throw if there is any kind of database error.
- SFRMMesageException –
Returns: true if it is processing.
logMessage¶
-
protected void
logMessage
(SFRMMessage incomingMessage)¶ Log the whole message for debug purpose.
Parameters: - incomingMessage – The incoming sfrm message.
logMessageType¶
processAcknowledgement¶
-
public SFRMMessage
processAcknowledgement
(SFRMMessage msg, SFRMPartnershipDVO pDVO)¶
processHandshakingMessage¶
-
public SFRMMessage
processHandshakingMessage
(SFRMMessage rawMessage, Object[] params)¶ Process handshaking for a new message. [SINGLE-THREADED]. The message segment is also META type. In the handshaking steps, it create the message record and check whether it has enough space for receiving the message. This method does not block and return immediately to let the sender know does the receiver is available to receive this message.
Parameters: - rawMessage – The incoming SFRM Message.
- params – RESERVED.
Throws: - DAOException – any kind of DB I/O Errors.
- Exception – thrown when pre-allocate the payload.
Returns: RESERVED.
processIncomingMessage¶
-
public SFRMMessage
processIncomingMessage
(SFRMMessage incomingMessage, Object[] params)¶ Process all kind of incoming SFRM message.. This method is invoked when the received HTTP request is transformed to SFRM Message from the SFRM inbound listener.
Parameters: - incomingMessage – The incoming SFRM Message.
- params – RESERVED
Throws: Returns: A SFRM message for response message.
processMetaMessage¶
-
public SFRMMessage
processMetaMessage
(SFRMMessage inputMessage, SFRMPartnershipDVO partnershipDVO, Object[] params)¶ Process all meta-typed message segment. [MULTI-THREADED]. This method pre-allocates the payload and it blocks until the file has been created.
Parameters: - inputMessage – The incoming SFRM Message. (unsigned and decrypted)
- partnershipDVO – The partnership DVO for this incoming message.
- params – RESERVED.
Throws: - DAOException – any kind of DB I/O Errors.
- Exception – thrown when pre-allocate the payload.
Returns: RESERVED.
processPDFAck¶
-
public String
processPDFAck
(SFRMMessageDVO mDVO)¶ Process the acknowledgement with PDF status
Parameters: - messageId – message ID
Throws: - DAOException – if anything fail on database operation
Returns: the acknowledgement response content
processPPSAck¶
-
public String
processPPSAck
(SFRMMessageDVO mDVO)¶ Process the acknowledgement with PPS status
Parameters: - messageId – message ID
Throws: - DAOException – if anything fail on database operation
Returns: the acknowledgement response content
processPRAck¶
-
public String
processPRAck
(SFRMMessageDVO mDVO, SFRMAcknowledgementParser parser)¶ Process the acknowledgement request with PR status
Parameters: - messageId – message id
- parser – parser that content the acknowledgement request parsing
Throws: - DAOException – if anything fail on database operation
Returns: the acknowledgement response content
processPRSAck¶
-
public String
processPRSAck
(SFRMMessageDVO mDVO)¶ Process the acknowledgement with PRS status
Parameters: - messageId – message ID
Throws: - DAOException – if anything fail on database operation
Returns: the acknowledgement response content
processPSDAck¶
-
public String
processPSDAck
(SFRMMessageDVO mDVO)¶ Process the acknowledgement with PSD status
Parameters: - messageId – message ID
Throws: - DAOException – if anything fail on database operation
Returns: the acknowledgement response content
processSegmentMessage¶
-
public SFRMMessage
processSegmentMessage
(SFRMMessage rawMessage, Object[] params)¶ Process payload-typed segment message. What the method has done:
- Create a segment file in the incoming segment repository.
- Create a inbox message segment record for the incoming message.
Parameters: - inputMessage – The packed SFRMMessage.
- rawMessage – The unpacked SFRM Message. (i.e. no sign and encrypt here)
- params – RESERVED
Returns: A SFRM message for response message.
releaseGuardForSegment¶
-
public boolean
releaseGuardForSegment
(SFRMMessage incomingMessage)¶ Release the ONE THREAD working GUARD for
incomingMessage
Parameters: - incomingMessage – The incoming SFRM Message.
resolveGuardOwnerForSegment¶
-
public boolean
resolveGuardOwnerForSegment
(SFRMMessage incomingMessage)¶ Resolve the guard for the
incomingMessage
to the new owner (another thread that process theincomingMessage
.Parameters: - incomingMesasge – The incoming SFRM Message.
unpackIncomingMessage¶
-
public void
unpackIncomingMessage
(SFRMMessage message, SFRMPartnershipDVO partnershipDVO)¶ Unpack the SMIME (secure MIME) message to become raw SFRM Message.
Parameters: - incomingMessage – The incoming SFRM Message.
- partnershipDVO – The partnership to valid against to.
Throws: - Exception – any kind of exceptions.
Returns: The raw SFRM Message.
IncomingMessageHandlerTest¶
-
public class
IncomingMessageHandlerTest
extends PluginTest<SFRMProcessor>¶ Author: Patrick Yip
Methods¶
getDSDAO¶
-
public DataSourceDAO
getDSDAO
()¶
MessageStatusQueryHandler¶
-
public class
MessageStatusQueryHandler
extends SFRMComponent¶ Handler to hold all the speed measurement class for active transferring SFRM Message. Active transferring message mean the message status is in PS processing
Author: Patrick Yip
Methods¶
addMessageSpeedQuery¶
-
public StatusQuery
addMessageSpeedQuery
(String messageId)¶ Add a message for monitoring the message status
Parameters: - messageId – SFRM Message ID
Returns: newly created StatusQuery
getInstance¶
-
public static MessageStatusQueryHandler
getInstance
()¶
getMessageList¶
getMessageSpeedQuery¶
-
public StatusQuery
getMessageSpeedQuery
(String messageId)¶ Get the StatusQuery for a particular message
Parameters: - messageId –
Returns: StatusQuery for a given message, null if is non-exist
getTotalSpeed¶
-
public double
getTotalSpeed
()¶ Get the total speed for the currently transfering message
Returns: total speed
removeMessageSpeedQuery¶
-
public StatusQuery
removeMessageSpeedQuery
(String messageId)¶ Remove the status query for particular message
Parameters: - messageId – SFRM Message ID
Returns: removed SpeedQuery
OutgoingMessageHandler¶
-
public class
OutgoingMessageHandler
extends SFRMComponent¶ The outgoing message handler is a singleton classes that provides service for processing outgoing SFRM message. Creation Date: 5/12/2006
Author: Twinsen Tsang
Methods¶
getInstance¶
-
public static OutgoingMessageHandler
getInstance
()¶ Returns: an instance of OutgoingMessageHandler.
packOutgoingMessage¶
-
protected SFRMMessage
packOutgoingMessage
(SFRMMessage message, String signAlgorithm, String encryptAlgorithm, X509Certificate encryptCert)¶ Pack the SMIME (secure MIME) message to become secured SFRM Message. Currently, the packing mechanisms support:
- Digitial Signing using MD5 or SHA-1
- Encryption using RC2_CBC or DES_EDE3_CBC
Parameters: - message – The outgoing SFRM Message.
- msgDVO – The message record associated to this SFRM message.
- pDVO –
Throws: - UnrecoverableKeyException –
- NoSuchAlgorithmException –
- SFRMException –
Returns: The secured SFRM message.
sendMessage¶
-
public FastHttpConnector
sendMessage
(SFRMMessage message, String endpoint, boolean isHostVerified, String signAlg, String encryptAlg, X509Certificate encryptCert)¶ Send SFRM message.
Parameters: - message – The original SFRM Message.
- isSign – Digital signature is required
- isEncryptReq – Encryption is required
- signAlg – Signing algorithm
- encryptAlg – Encryption algorithm
- encrypt – Partner public certificate for encryption
Throws: Returns: HTTP response
sendMessageWithMessageResponse¶
-
public SFRMMessage
sendMessageWithMessageResponse
(SFRMMessage message, String endpoint, boolean isHostVerified, String signAlg, String encryptAlg, X509Certificate encryptCert)¶
OutgoingMessageHandlerTest¶
-
public class
OutgoingMessageHandlerTest
extends SystemComponentTest<OutgoingMessageHandler>¶ Author: Patrick Yip
SFRMDoSHandler¶
-
public class
SFRMDoSHandler
extends Component¶ The
SFRMDoSHandler
is a simple barrier to ensure there is ONLY one-thread working per segment. When an incoming message is received and prepare to process, the IMH invokeenter(SFRMMessage)
asking the DoSHandler to insert the working record for this segment. Then if there is a duplicate message received, the DosHandler reject it due to the working record has already exist. Thus it guarantees ONE THREAD WORKING per segment semantics. CAUTION: When the thread in the working record is not alive, the DoSHandler considers the working record is redundant and ALLOW message with same composite key owning a barrier for that message. Creation Date: 28/6/2007Author: Twinsen Tsang
Methods¶
enter¶
-
public boolean
enter
(SFRMMessage message)¶ Invoke for requesting a barrier for
message
. For this case, the requested barrier does not expire.Parameters: - message – The incoming SFRM Message.
Returns: if the message has been entered by other thread before, it return false. otherwise, the barrier for this
message
is created and the owner is the invocation thread.
enter¶
-
public boolean
enter
(SFRMMessage message, long lifetime)¶ Invoke for requesting a barrier for
message
.Parameters: - message – The incoming SFRM Message.
- lifetime – How long is the barrier expire in millisecond. The common use for this is managing timeout/retry for a message.
Returns: if the message has been entered by other thread before, it return false. otherwise, the barrier for this
message
is created and the owner is the invocation thread.
exit¶
-
public boolean
exit
(SFRMMessage message)¶ Invoke for removing the barrier for a
message
. The internal barrier for thismessage
is removed and therefore invocatingenter(SFRMMessage)
for thismesasge
return true again.Parameters: - message – The incoming SFRM Message.
Returns: it returns true iff the working record exists and remove successfully.
getResolvedKey¶
-
public String
getResolvedKey
(SFRMMessage message)¶ Get the composite key from the
message
. What it does is generating one string indentifying the message. For example:Input message id: test@message-id Input segment type: PAYLOAD Input segment number: 999 Then the resolved key is test@message-id_INBOX_PAYLOAD_999
Parameters: - message – The incoming SFRM Message.
Returns: the composite key of thie SFRM Message.
SFRMDoSHandlerTest¶
-
public class
SFRMDoSHandlerTest
extends TestCase¶ The test-case of
SFRMDoSHandler
. Creation Date: 03/07/2007Author: Twinsen Tsang
Methods¶
testEnterAfterThreadDie_Pos_0¶
-
public void
testEnterAfterThreadDie_Pos_0
()¶ Testcase for entering the message after previous thread owner has been died.
testEnterAfterThreadDie_Pos_1¶
-
public void
testEnterAfterThreadDie_Pos_1
()¶ Testcase for entering the message being owner by other active thread.
testEnterWithLifetime_Pos_0¶
-
public void
testEnterWithLifetime_Pos_0
()¶ Testcase for a message entering the DoSHandler with a specified lifetime. The record should be removed after at least (1 + sweeping_interval) seconds.
testEnterWithLifetime_Pos_1¶
-
public void
testEnterWithLifetime_Pos_1
()¶ Testcase for a message entering the DosHandler with a specified lifetime. The record should exist within the lifetime.
testEnter_Neg_0¶
-
public void
testEnter_Neg_0
()¶ Testcase for duplicate message entering the DosHandler.
testEnter_Pos_0¶
-
public void
testEnter_Pos_0
()¶ Simplest Testcase for a message entering the DoS Handler.
testEnter_Pos_1¶
-
public void
testEnter_Pos_1
()¶ Testcase for multiple message entering the DoS Handler.
SFRMExternalRequestHandler¶
-
public class
SFRMExternalRequestHandler
extends SFRMComponent¶ Author: Patrick Yip
SFRMExternalRequestHandlerTest¶
-
public class
SFRMExternalRequestHandlerTest
extends PluginTest<SFRMProcessor>¶
SFRMMessageFactory¶
-
public class
SFRMMessageFactory
extends Component¶ It is the [FACTORY] of the SFRM Message. It provides API for creating all kinds of SFRM Message in the version 1.0.3 specification. Creation Date: 5/12/2006
Author: Twinsen Tsang See also:
hk.hku.cecid.edi.sfrm.pkg.SFRMMessage
Methods¶
createAcknowledgement¶
-
public SFRMMessage
createAcknowledgement
(SFRMMessageDVO mDVO, SFRMPartnershipDVO pDVO, String segType, String ackContent)¶
createHandshakingRequest¶
-
public SFRMMessage
createHandshakingRequest
(String messageId, String partnershipId, int totalSegment, long totalSize, String filename)¶ Create a handshaking request which is used for communicate to the receiver for delivery confirmation. This kind of SFRMMessage segment has the type called “META”.
Parameters: - messageId – The message Id of segment.
- partnershipId – The partnership Id of segment.
- totalSegment – The total segment of message.
- totalSize – The total size of message.
Throws: Returns: A new handshaking SFRM Message.
createPayloadRequest¶
-
public SFRMMessage
createPayloadRequest
(String messageId, String partnershipId, int segmentNo, long segmentOffset, long segmentLength, long totalSize, File payload, String contentType)¶ Parameters: - messageId –
- partnershipId –
- segmentNo –
- segmentOffset –
- segmentLength –
- totalSize –
- payload –
- contentType –
Throws:
getInstance¶
-
public static SFRMMessageFactory
getInstance
()¶ Returns: an instnace of SFRMMessageFactory.
setupMessage¶
-
protected void
setupMessage
(SFRMMessage ret, String messageId, String partnershipId, String segmentType, String convId, int segmentNo, File payload, String contentType)¶ Setup the message field according to the specified parameters.
Parameters: - ret –
- messageId –
- partnershipId –
- segmentType –
- convId –
- segmentNo –
SFRMMessageHandler¶
-
public class
SFRMMessageHandler
extends DSHandler¶ THe SFRM Message handler is a proxy object of DAO layers. It wraps with some useful query like retrieve message and create message by the SFRM Meta Header. Creation Date: 3/10/2006 V1.0.1 - supports DVO
caching
.Author: Twinsen Tsang
Methods¶
createMessageBySFRMMetaMessage¶
-
public SFRMMessageDVO
createMessageBySFRMMetaMessage
(SFRMMessage msg, SFRMPartnershipDVO pDVO, String messageBox, String status, String statusDesc)¶ Create a new message record by a SFRM Mesasge which is meta type.
Parameters: - msg – The SFRM message.
- pDVO – The partnership associated with this message.
- messageBox – The message box of the new message record.
- status – The status of the new message record.
- statusDesc – The status description of the new message record.
Throws: - DAOException – If the sfrm message is null or with segment no not equal to zero , or other database error.
- SFRMException –
- IOException –
- FileNotFoundException –
Returns: return null if database error, otherwise a new message record.
removeMessage¶
-
public boolean
removeMessage
(SFRMMessageDVO msgDVO)¶ Remove the
msgDVO
to the pesistence DB. Developer SHOULD use this method instead ofhk.hku.cecid.piazza.commons.dao.DAO.remove(hk.hku.cecid.piazza.commons.dao.DVO)
because this invocation also manage the DVO cache.Parameters: - msgDVO – The message DVO to be update.
Throws: Returns: true if operation success, fail vice versa.
retrieveAcknowledgmentMessages¶
-
public List
retrieveAcknowledgmentMessages
(int numOfMessage, int offset)¶ Retrieve a set of messages that is required to ack the acknowledgement from receiver
Parameters: - numOfMessage – number of messages for acknowledgement request
- offset – offset in the message records
Throws: Returns: a list of message that is required to ack the acknowledgement
retrieveMessage¶
-
public SFRMMessageDVO
retrieveMessage
(String messageId, String messageBox)¶ Retrieve a message from the specified parameters. This method support caching. If the particular DVO is already in the cache, it returned immediately without JDBC calls.
Parameters: - messageId – The message id of the message.
- messageBox – The message box of the message. either inbox or outbox.
Throws: Returns: return null if not found by the specified parameter, otherwise a message record.
retrieveMessages¶
-
public List
retrieveMessages
(String messageBox, String status)¶ Retrieve a set of messages from the specified parameters.
Parameters: - messageBox – The message box of the message. either inbox or outbox.
- status – The status of the message.
Throws: Returns: return a list of message that fit the criteria.
updateMessage¶
-
public boolean
updateMessage
(SFRMMessageDVO msgDVO)¶ Update the
msgDVO
to the pesistence DB. Developer SHOULD use this method instead ofhk.hku.cecid.piazza.commons.dao.DAO.persist(hk.hku.cecid.piazza.commons.dao.DVO)
because this invocation also manage the DVO cache.Parameters: - msgDVO – The message DVO to be update.
Returns: true if operation success, fail vice versa.
SFRMMessageSegmentHandler¶
-
public class
SFRMMessageSegmentHandler
extends DSHandler¶ The SFRM Message Segment handler is a proxy object of DAO layers. It wraps with some useful query like retrieve message segment and create message by the SFRM Message Header. Creation Date: 9/10/2006
Author: Twinsen Tsang
Methods¶
createMessageSegmentBySFRMMessage¶
-
public SFRMMessageSegmentDVO
createMessageSegmentBySFRMMessage
(SFRMMessage message, String messageBox, String status)¶ Create an Message Segment according to the SFRM message.
Parameters: - message – The message segmented used for generating the message segment record.
- messageBox – The message box for the mesasge. It should either be “inbox” or “outbox”.
- status – The status for the new message segment record. if this field is null, we conside the status is PENDING.
Throws: - DAOException – Error in Database connectivity.
Returns: a message segment dvo if the operation runs succesfully.
retrieveDeliveredSegmentForMessage¶
retrieveIncompleteSegments¶
retrieveLastUpdatedMessageSegment¶
-
public SFRMMessageSegmentDVO
retrieveLastUpdatedMessageSegment
(String messageId, String messageBox, String type)¶ Select the last updated message segment with the specified parameter. The last updated message segment is defined as the message segment which has the latest
proceedTimestamp value.
Parameters: - messageId – The message id of the message segment belong to.
- messageBox – The message box of the message segment. It should either “inbox” or “outbox”.
- type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws: Returns: A message segment dvo if the operation runs succesfully.
retrieveLastUpdatedTimestamp¶
-
public Timestamp
retrieveLastUpdatedTimestamp
(String messageId, String messageBox, String type)¶ Select the last updated timestamp with the specified parameter. The last updated message segment is defined as the message segment which has the latest
proceedTimestamp value.
Parameters: - messageId – The message id of the message segment belong to.
- messageBox – The message box of the message segment. It should either “inbox” or “outbox”.
- type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws: Returns: A message segment dvo if the operation runs succesfully.
retrieveMaxMessageSegmentNumber¶
-
public int
retrieveMaxMessageSegmentNumber
(String messageId, String messageBox, String type)¶ Find the maximum segment number it has in the DB for the specified message.
Parameters: - messageId – The message id of the message segment belong to.
- messageBox – The message box of the message segment.
- type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws:
retrieveMessageSegment¶
-
public SFRMMessageSegmentDVO
retrieveMessageSegment
(String messageId, String messageBox, int segmentNo, String type)¶ Select a message segment with the specified parameter.
Parameters: - messageId – The message id of the message segment belong to.
- messageBox – The message box of the message segment. It should either “inbox” or “outbox”.
- segmentNo – The segment number of the segment
- type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws: - DAOException – Error in Database connectivity.
Returns: A message segment dvo if the operation runs succesfully.
retrieveMessageSegment¶
-
public SFRMMessageSegmentDVO
retrieveMessageSegment
(SFRMMessage message, String messageBox)¶ Select a message segment with the specified parameter. The segment type is omitted here is this query.
Parameters: - message – The message segmented used for get the message segment record.
- messageBox – The message box for the mesasge. It should either be “inbox” or “outbox”.
Throws: Returns: A message segment dvo if the operation runs succesfully.
retrieveMessageSegmentCount¶
-
public int
retrieveMessageSegmentCount
(String messageId, String messageBox, String type, String status)¶ Find how many message for the partiucalur message id and message box are available in the database.
Parameters: - messageId – The message id of the message segment belong to.
- messageBox – The message box of the message segment. Either inbox or outbox can be allowed.
- type – The segment type of the message segment.
- status – The status of the message segment
Throws:
retrieveMessages¶
-
public List
retrieveMessages
(String messageBox, String status, int limit)¶ Retrieve a set of messages from the specified parameters.
Parameters: - messageBox – The message box of the message segment. Either inbox or outbox can be allowed.
- status – The status of the message segment.
- limit – The maximum message that can be retrieved.
Throws: Returns: Return a list of message that fit the criteria.
retrieveMessages¶
retrieveMessages¶
retrieveMessages¶
-
public List
retrieveMessages
(String messageId, String messageBox, String messageType, String[] status)¶ Find message segment by providing the message ID, message box, message type and a list of status
Parameters: - messageId – The message id of the mesage segment belong to
- messageBox – The message box of the message segment
- messageType – The segment type (META, PAYLOAD, ACK)
- status – The status of message status
Throws: Returns: List of SFRMMessageSegmentDVO
SFRMPartnershipHandler¶
-
public class
SFRMPartnershipHandler
extends DSHandler¶ Creation Date: 28/9/2006 V1.0.1 - supports DVO
caching
.Author: Twinsen
Methods¶
addPartnership¶
-
public boolean
addPartnership
(SFRMPartnershipDVO pDVO, String mID)¶ Add a SFRM Partnership by partnership object specified in the parmeter.
Parameters: - pDVO – The SFRM Partnership to be added for.
- mID – The message id for the requesting partnership.
Throws: Returns: false if operation fails to execute, otherwise true.
clearCache¶
clearCache¶
createPartnership¶
-
public SFRMPartnershipDVO
createPartnership
()¶ Create a SFRM Partnership object.
Throws: Returns: A new SFRM Partnership object.
removePartnership¶
-
public boolean
removePartnership
(SFRMPartnershipDVO pDVO)¶ Remove a SFRM Partnership by partnership object specified in the parameter.
Parameters: - pDVO –
Throws: Returns: false if operation fails to execute, otherwise true.
retreivePartnership¶
-
public SFRMPartnershipDVO
retreivePartnership
(String pID, String mID)¶ Select a SFRM Partnership by the service parameter.
Parameters: - pID – The partnership id name of the partnership id to be search.
- mID – The message id for the requesting partnership.
Throws: Returns: null if not found, otherwise the SFRM Partnership.
retreivePartnership¶
-
public SFRMPartnershipDVO
retreivePartnership
(SFRMPartnershipDVO pDVO, String mID)¶ Select a SFRM Partnership by the keys specified in the parameter.
Parameters: - pDVO – The SFRM Partnership to be found for.
- mID – The message id for the requesting partnership.
Throws: Returns: null if not found, otherwise the SFRM Partnership.
retreivePartnership¶
-
public SFRMPartnershipDVO
retreivePartnership
(SFRMMessage msg)¶ Select a SFRM Partnership by the SFRM message.
Parameters: - msg – The SFRM Message record used for finding it’s associate partnership.
Throws: Returns: null if not found, otherwise the SFRM Partnership.
updatePartnership¶
-
public boolean
updatePartnership
(SFRMPartnershipDVO pDVO, String mID)¶ Update a SFRM Partnership by partnership object specified in the parameter.
Parameters: - pDVO – The SFRM Partnership to be updated for.
- mID – The message id for the requesting partnership.
Throws: Returns: false if operation fails to execute, otherwise true.
hk.hku.cecid.edi.sfrm.io¶
ByteBufferInputStream¶
-
public class
ByteBufferInputStream
extends InputStream¶ A ByteBufferInputStream contains an internal buffer that contains direct or non-direct byte buffer that may be read from the stream. Creation Date: 24/10/2006
Author: Twinsen Tsang
Fields¶
buf¶
-
protected ByteBuffer
buf
¶ The internal byte buffer.
Constructors¶
ByteBufferInputStream¶
-
public
ByteBufferInputStream
(ByteBuffer buffer)¶ Creates a
ByteBufferInputStream
so that it usesbuf
as its byte buffer. The buffer array is not copied.Parameters: - buf – the input buffer.
Methods¶
available¶
-
public int
available
()¶ Returns the number of bytes that can be read from this input stream without blocking. The value returned is limit of byte buffer. which is the number of bytes remaining to be read from the input buffer.
Returns: the number of bytes that can be read from the input stream without blocking.
getChannel¶
-
public ReadableByteChannel
getChannel
()¶ Returns the readable byte channel object associated with this byte buffer input stream.
Returns: a readable byte channel for this byte buffer. See also:
java.nio.channels.Channels
markSupported¶
-
public boolean
markSupported
()¶ Mark is support by this InputStream.
Returns: always true
read¶
-
public int
read
()¶ Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned.
ChecksumException¶
-
public class
ChecksumException
extends IOException¶ An exception that should be thrown when the check sum value for a file is invalid. Creation Date: 21/12/2006
Author: Twinsen
NullInputStream¶
-
public class
NullInputStream
extends InputStream¶ A NullInputStream discards any bytes and always return negative one for
read
operations. Creation Date: 7/11/2006Author: Twinsen
Methods¶
NullOutputStream¶
-
public class
NullOutputStream
extends OutputStream¶ A NullOutputStream discards any bytes in
write
operations. Creation Date: 11/10/2006Author: Twinsen Tsang
hk.hku.cecid.edi.sfrm.listener¶
SFRMInboundListener¶
-
public class
SFRMInboundListener
extends SFRMRequestAdaptor¶ This is the inbound listener for receiving the payload segment from the sender.
Author: Twinsen
Methods¶
processRequest¶
-
public void
processRequest
(SFRMRequest request, SFRMResponse response)¶ See also:
hk.hku.cecid.edi.sfrm.listener.SFRMRequestAdaptor.processRequest(hk.hku.cecid.edi.as2.listener.SFRMRequest,hk.hku.cecid.edi.as2.listener.SFRMResponse)
SFRMRequest¶
-
public class
SFRMRequest
¶ The SFRMRequest class represents a wrapper of HTTP request wrapping the SFRMMessage inside.
Author: Twinsen Tsang
Constructors¶
Methods¶
getMessage¶
-
public SFRMMessage
getMessage
()¶ Gets the SOAP message of this request.
Returns: the SOAP message of this request.
getSource¶
setMessage¶
-
void
setMessage
(SFRMMessage message)¶ Sets the SOAP message of this request.
Parameters: - message – the SOAP message of this request.
SFRMRequestAdaptor¶
-
public abstract class
SFRMRequestAdaptor
extends HttpRequestAdaptor¶ This is the sfrm customizied HTTP Request Adaptor.
Author: Twinsen See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestAdaptor
Methods¶
processFail¶
-
public String
processFail
(HttpServletRequest request, HttpServletResponse response, Exception cause)¶ It process a HTTP request from the piazza corvus framework when there is exception thrown from underlying handler.
Parameters: - request – The HTTP Request
- response – The HTTP Response
- cause – The exception cause to fail.
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ It process a HTTP request from the piazza corvus framework.
Parameters: - request – The HTTP Request
- response – The HTTP Response
Throws: See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.processRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
processRequest¶
-
public abstract void
processRequest
(SFRMRequest request, SFRMResponse response)¶ Parameters: - request –
- response –
Throws:
SFRMResponse¶
-
public class
SFRMResponse
¶ The SFRMResponse class represents a wrapper of HTTP response wrapping the SFRMMessage inside.
Author: Twinsen Tsang
Constructors¶
Methods¶
getMessage¶
-
public SFRMMessage
getMessage
()¶ Gets the SOAP message of this response.
Returns: the SOAP message of this response.
getTarget¶
setMessage¶
-
public void
setMessage
(SFRMMessage message)¶ Sets the SOAP message of this response.
Parameters: - message – the SOAP message of this response.
hk.hku.cecid.edi.sfrm.net¶
FastHttpConnector¶
-
public class
FastHttpConnector
extends HttpConnector¶ Creation Date: 10/10/2006 Modified Date: 17/06/2009
Author: Twinsen, Philip
Constructors¶
Methods¶
getResponseCode¶
-
public int
getResponseCode
()¶ Sends an HTTP/S request using the given HTTP connection.
Parameters: - request – the HTTP request content or null for a simple get request.
- internet – headers
Throws: - ConnectionException – if failed in sending the HTTP request.
Returns: an input stream for reading the reply from the host.
getResponseContentStream¶
-
public InputStream
getResponseContentStream
()¶
getResponseHeaders¶
-
public InternetHeaders
getResponseHeaders
()¶
send¶
-
public HttpURLConnection
send
(InputStream request, InternetHeaders headers)¶
hk.hku.cecid.edi.sfrm.pkg¶
SFRMAcknowledgementBuilder¶
-
public class
SFRMAcknowledgementBuilder
¶ Author: Patrick Yip To build the SFRM Acknowledgement content body
Fields¶
Constructors¶
Methods¶
getMessageSegmentXPath¶
setMessage¶
-
public Element
setMessage
(String messageId, String status)¶ Set the message information to the acknowledgment content, if the message is not present, it will create an entry, otherwise it will modify the entry
Parameters: - messageId – message id
- status – message status
Returns: the newly created or modified XML element
setSegment¶
-
public Element
setSegment
(String messageId, int segmentNum, String segmentStatus)¶ Set the message segment information for a given message id, if the message segment is present, it will create one, otherwise it will modify the existing entry
Parameters: - messageId – message id for message segment
- segmentNum – segment number
- segmentStatus – segment status
Throws: - IllegalArgumentException – if the given message id is not existing in the acknowledgment content
Returns: the newly created or modified XML element
SFRMAcknowledgementBuilderTest¶
-
public class
SFRMAcknowledgementBuilderTest
extends TestCase¶ Author: Patrick Yip
SFRMAcknowledgementParser¶
-
public class
SFRMAcknowledgementParser
¶
SFRMAcknowledgementParserTest¶
-
public class
SFRMAcknowledgementParserTest
extends TestCase¶
Methods¶
SFRMConstant¶
-
public final class
SFRMConstant
¶ The constant field for SFRM Message. Creation Date: 13/11/2006 Version 1.0.1 - Added Message status Description Constant.
Author: Twinsen Tsang
Fields¶
SFRMHeader¶
-
public class
SFRMHeader
¶ SFRMHeader represents a set of SFRM message headers. Version 1.0.2 - Added Converation Id. Version 1.0.1 - Header schema updated for the impl of on-the-fly sending and recv mode. Remove deprecated fields. Version 2.0.0 - Add Is-Packed header field Add Filename header field
Author: Twinsen Tsang
SFRMMessage¶
-
public class
SFRMMessage
implements Cloneable¶ This is the SFRM Message used for wrapping the payload and send it to the receiver side. Specification: Creation Date: 29/9/2006 Version 1.0.2 -
- Add a message classifier for recognizing the message nature much easily.
Version 1.0.1 -
- MIC Value is stored into ContentMD5 in the MimeBodyPart.
- Support cloning.
Author: Twinsen Tsang
Fields¶
Constructors¶
SFRMMessage¶
-
public
SFRMMessage
(InputStream message)¶ Creates a new instance of SFRM Message.
Parameters: - message – the message as input stream.
Throws: - SFRMMessageException – if unable to construct from the given input stream.
SFRMMessage¶
-
public
SFRMMessage
(InternetHeaders headers, InputStream content)¶ Creates a new instance of SFRMMessage.
Parameters: - headers – the headers of this message.
- ins – the content stream.
Throws: - SFRMMessageException – if unable to construct from the given content stream.
Methods¶
addHeader¶
decrypt¶
-
public void
decrypt
(X509Certificate cert, PrivateKey privateKey)¶
digest¶
-
public static String
digest
(InputStream inStream)¶
digest¶
-
public static String
digest
(FileRegionDataSource frds)¶
encrypt¶
-
public void
encrypt
(X509Certificate cert, String encryptAlg)¶
getBodyPart¶
-
public MimeBodyPart
getBodyPart
()¶ Gets the MIME body part of this message.
Returns: the MIME body part.
getClassifier¶
-
public SFRMMessageClassifier
getClassifier
()¶ Returns: a message classifier for this message.
getContent¶
-
public Object
getContent
()¶ Gets the content of payload from this message.
Throws: - SFRMMessageException – if unable to get the content.
Returns: the content part.
getContentStream¶
-
public InputStream
getContentStream
()¶ Gets the content stream of this message.
Returns: the content stream of this message. null if there is no content.
getContentType¶
-
public String
getContentType
()¶ Gets the content type of the payload from this message.
Throws: - SFRMMessageException – if unable to get the content type.
Returns: the content type.
getConverationId¶
getFilename¶
getHeader¶
getHeader¶
getHeaders¶
-
public InternetHeaders
getHeaders
()¶ Gets the headers of this message.
Returns: a copy of the headers of this message.
getInputStream¶
-
public InputStream
getInputStream
()¶ Gets the input stream of this message’s content. Any transfer encodings will be decoded before the input stream is provided.
Throws: - SFRMMessageException – if unable to retrieve the stream.
Returns: the input stream of this message’s content.
getPartnershipId¶
getSegmentLength¶
-
public long
getSegmentLength
()¶ Returns: the SFRM segment length from this message.
getSegmentOffset¶
-
public long
getSegmentOffset
()¶ Returns: the SFRM segment offset position from the message.
removeHeader¶
setBodyPart¶
-
public void
setBodyPart
(MimeBodyPart bp)¶ Sets the MIME body part of this message.
Parameters: - bp – the new MIME body part.
setContent¶
-
public void
setContent
(Object content, String contentType)¶ Sets a content to this message.
Parameters: - content – the content part.
- contentType – the content type.
Throws: - SFRMMessageException – if unable to set the content.
setConversationId¶
setFilename¶
setHeader¶
setIsEncrypted¶
-
public void
setIsEncrypted
(boolean isEncrypted)¶ Set whether the message is encrypted.
Parameters: - isEncrypted – true if encrypted, false vice versa.
setIsSigned¶
-
public void
setIsSigned
(boolean isSigned)¶ Set whether the message is signed.
Parameters: - isSigned – true if signed, false vice versa.
setMessageID¶
setMicValue¶
setPartnershipId¶
setSegmentLength¶
-
public void
setSegmentLength
(long length)¶ Set the segment payload into this message. The segment length will only be set when it is greater than or equal to zero.
Parameters: - length – The length of this segment.
setSegmentNo¶
-
public void
setSegmentNo
(int segmentNo)¶ Set the segment number of the message. The segment number will only be set when it is greater than or equal to zero.
Parameters: - segmentNo – The segment number of message.
setSegmentOffset¶
-
public void
setSegmentOffset
(long offset)¶ Set the segment offset of this message. The segment offset will only be set when it is greater than or equal to zero.
Parameters: - offset – The offset of this segment.
setSegmentType¶
setTotalSegment¶
-
public void
setTotalSegment
(int totalSegment)¶ Set the total segment in the meta message.
Parameters: - totalSegment – The total segment of the message.
setTotalSize¶
-
public void
setTotalSize
(long totalSize)¶ Set the total size in the meta message.
Parameters: - totalSize – The total size of the message.
sign¶
-
public void
sign
(X509Certificate cert, PrivateKey privateKey, String digestAlg)¶
toByteArray¶
-
public byte[]
toByteArray
()¶ Returns a byte array which represents this message contnet.
Throws: - SFRMMessageException – if unable to convert this message into bytes.
Returns: a byte array which represents this message.
toByteBuffer¶
-
public ByteBuffer
toByteBuffer
(boolean hardwareBuffer)¶ Returns a byte buffer which represents this message content, i.e. a MIME body part byte buffer.
Parameters: - hardwareBuffer –
toString¶
-
public String
toString
()¶ Returns a string representation of this message.
Returns: a string representation of this message. See also:
java.lang.Object.toString()
verify¶
-
public void
verify
(X509Certificate cert)¶
writeTo¶
-
public void
writeTo
(OutputStream outs)¶ Writes the message to the given output stream.
Parameters: - outs – the output stream to be written.
Throws: - SFRMMessageException – if unable to write the message.
SFRMMessageClassifier¶
-
public class
SFRMMessageClassifier
¶ The
SFRMMessageClassifier
is a classifier for SFRM segments. It provide very fast and efficient access to crtiical information for it’s corresponding segment. Creation Date: 10/11/2006Author: Twinsen Tsang
Constructors¶
SFRMMessageClassifier¶
-
public
SFRMMessageClassifier
(SFRMMessage message)¶ Explicit Constructor.
Parameters: - message – The sfrm message need to be classify.
Throws: - NullPointerException – if the message is null.
- SFRMMessageException –
- Exception –
hk.hku.cecid.edi.sfrm.service¶
SFRMMessageResumeService¶
-
public class
SFRMMessageResumeService
extends WebServicesAdaptor¶ Author: Patrick Yip
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶
SFRMMessageStatusQueryService¶
-
public class
SFRMMessageStatusQueryService
extends WebServicesAdaptor¶ The
SFRMMessageStatusQueryService
is a SOAP-based Web services for querying the current status of particular SFRM message. The web services schema is defined here: Input XML tag:<messageId> messageId</messageId>
Output XML tag:
<messageInfo> <status> The current status of message </status> <statusDescription> The current status description of message </statusDescription> <numberOfSegments> Maximum number of segments </numberOfSegments> <numberOfProcessedSegments> Number of processed segments </numberOfProcessedSegments> <lastUpdatedTime> The last updated timestamp </lastUpdatedTime> </messageInfo>
There are some situation that the returned value may differ than your expectation and they are listed below:
- When the SFRM message is in status of handshaking (HS), the number of segments is
- maximum integer. This is because the number of segments can not be determined at that moment.
- When the SFRM message can’t be found by the web service parameter. The returned tuple is [“N/A”,””, “2147483647”,”0”,”current time].
Creation Date: 26/4/2007
Author: Twinsen Tsang
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶ Process the web services call by the client.
Parameters: - request – The SOAP-based Web services request.
- response – The SOAP-based Web services response.
Throws:
SFRMMessageSuspendService¶
-
public class
SFRMMessageSuspendService
extends WebServicesAdaptor¶
Methods¶
serviceRequested¶
-
public void
serviceRequested
(WebServicesRequest request, WebServicesResponse response)¶ Process the web services call by the client.
Parameters: - request – The SOAP-based Web services request.
- response – The SOAP-based Web services response.
Throws: - SOAPRequestException – Unable to process the SOAP request.
- DAOException – Error in database connectivity.
- SOAPException –
hk.hku.cecid.edi.sfrm.spa¶
SFRMComponent¶
-
public abstract class
SFRMComponent
extends SystemComponent¶ Author: Patrick Yip
Methods¶
getAcknowledgementHandler¶
-
public AcknowledgementHandler
getAcknowledgementHandler
()¶
getExternalRequestHandler¶
-
public SFRMExternalRequestHandler
getExternalRequestHandler
()¶
getIncomingMessageHandler¶
-
public IncomingMessageHandler
getIncomingMessageHandler
()¶
getIncomingRepository¶
-
public PackagedPayloadsRepository
getIncomingRepository
()¶
getKeyStoreManager¶
-
public KeyStoreManager
getKeyStoreManager
()¶
getMessageHandler¶
-
public SFRMMessageHandler
getMessageHandler
()¶
getMessageSegmentHandler¶
-
public SFRMMessageSegmentHandler
getMessageSegmentHandler
()¶
getMessageSpeedQueryHandler¶
-
public MessageStatusQueryHandler
getMessageSpeedQueryHandler
()¶
getOutgoingMessageHandler¶
-
public OutgoingMessageHandler
getOutgoingMessageHandler
()¶
getOutgoingRepository¶
-
public PackagedPayloadsRepository
getOutgoingRepository
()¶
getPartnershipHandler¶
-
public SFRMPartnershipHandler
getPartnershipHandler
()¶
SFRMException¶
-
public class
SFRMException
extends GenericException¶ SFRMException represents all kinds of exception related to SFRM processing. Creation Date: 27/9/2006
Author: Twinsen Tsang
SFRMLog¶
-
public interface
SFRMLog
¶ The
SFRMLog
is the log code for the logging statement in the sfrm.log files. For detail, please read “doc/logcode.txt”.Author: Twinsen Tsang
Fields¶
ATC_CALLER¶
AT_CALLER¶
CREATE_SGT¶
DECRYPT_SGT¶
ENCRYPT_SGT¶
FAIL_CRC¶
FAIL_HDSK¶
FIRST_LOAD¶
ILLEGAL_SGT¶
IMH_CALLER¶
INSERT_SGTS¶
IPTC_CALLER¶
IPT_CALLER¶
MSC_CALLER¶
MSGID_PREFIX¶
MSHDAO_CALLER¶
NOTIFY_REPT¶
OMH_CALLER¶
OPPTC_CALLER¶
OPPT_CALLER¶
OPTC_CALLER¶
OPT_CALLER¶
OSPTC_CALLER¶
OSPT_CALLER¶
OUTG_TASK¶
PACK_MSG¶
QUERY_STATUS¶
RECEIVE_ALL¶
RECEIVE_DUP¶
RECEIVE_FAIL¶
RECEIVE_HDSK¶
RECEIVE_META¶
RECEIVE_SGT¶
RESOLVE_FAIL¶
ROLL_BACK¶
SEND_ALL¶
SEND_HDSK¶
SEND_SGT¶
SGTNO_PREFIX¶
SIGNING_SGT¶
SPANNED_THRD¶
SQS_CALLER¶
SUCCESS_CRC¶
UNPACK_MSG¶
UNPACK_SGT¶
VERIFY_SGT¶
SFRMLogUtil¶
-
public class
SFRMLogUtil
¶ The
SFRMLogUtil
Creation Date: 03/07/2007Author: Twinsen Tsang
SFRMProcessor¶
-
public class
SFRMProcessor
extends PluginProcessor¶ The SFRM SPA plugin processor for initiating and containing the references to all SFRM components. Creation Date: 27/9/2006
Author: Twinsen, Philip
Fields¶
moduleGroup¶
-
protected static ModuleGroup
moduleGroup
¶
Methods¶
createLock¶
getAcknowledgementHandler¶
-
public AcknowledgementHandler
getAcknowledgementHandler
()¶
getExternalRequestHandler¶
-
public SFRMExternalRequestHandler
getExternalRequestHandler
()¶
getIncomingMessageHandler¶
-
public IncomingMessageHandler
getIncomingMessageHandler
()¶
getIncomingRepository¶
-
public PayloadsRepository
getIncomingRepository
()¶
getInstance¶
-
public static SFRMProcessor
getInstance
()¶
getKeyStoreManager¶
-
public KeyStoreManager
getKeyStoreManager
()¶
getLock¶
getMessageHandler¶
-
public SFRMMessageHandler
getMessageHandler
()¶
getMessageSegmentHandler¶
-
public SFRMMessageSegmentHandler
getMessageSegmentHandler
()¶
getMessageSpeedQueryHandler¶
-
public MessageStatusQueryHandler
getMessageSpeedQueryHandler
()¶
getModuleGroupImpl¶
-
protected ModuleGroup
getModuleGroupImpl
()¶
getOutgoingRepository¶
-
public PackagedPayloadsRepository
getOutgoingRepository
()¶
getPartnershipHandler¶
-
public SFRMPartnershipHandler
getPartnershipHandler
()¶
removeLock¶
setModuleGroupImpl¶
-
protected void
setModuleGroupImpl
(ModuleGroup mg)¶
SFRMProperties¶
-
public class
SFRMProperties
¶ Provide fast access of constant field defined in the properties files. It is originally come from POC1. Creation Date: 3/10/2006 V1.0.2 - Added
Mailcaps
properties.Author: Twinsen
Fields¶
XPATH_MAILCAPS¶
XPATH_MAX_PAYLOAD_SIZE¶
XPATH_SEGMENT_SIZE¶
XPATH_SEPARATOR¶
XPATH_SPEED_MAXIMUM¶
XPATH_SPEED_TICK_INTERVAL¶
hk.hku.cecid.edi.sfrm.task¶
AcknowledgementCollector¶
-
public class
AcknowledgementCollector
extends LimitedActiveTaskList¶ Author: Patrick Yip
AcknowledgementTask¶
-
public class
AcknowledgementTask
extends ActiveTaskAdaptor¶ Active task responsible for handling the action of sending the acknowledgement request to receiver
Author: Patrick Yip
Constructors¶
AcknowledgementTask¶
-
public
AcknowledgementTask
(SFRMMessageDVO messageDVO, SFRMPartnershipDVO partenershipDVO)¶
Methods¶
unpackIncomingMessage¶
-
public void
unpackIncomingMessage
(SFRMMessage message, SFRMPartnershipDVO partnershipDVO)¶
MessageStatusCollector¶
-
public class
MessageStatusCollector
extends LimitedActiveTaskList¶ Author: Patrick Yip Collector to query the status of active message periodically. The status of message includes - status code
- status description
- number of processed segment
- message speed (KB/s)
OutgoingPayloadsCollector¶
-
public class
OutgoingPayloadsCollector
extends LimitedActiveTaskList¶ The outgoing message payloads collector collects all packaged message from the DB with the associated payload which then create DB segments for send. The looking query for packaged message.
select * from sfrm_message where message_box = ? and status = ?
Creation Date: 5/10/2006.
Author: Twinsen Tsang
OutgoingPayloadsTask¶
-
public class
OutgoingPayloadsTask
extends ActiveTaskAdaptor¶ What the task does
- Update the status of message to segmentating (status: ST).
- Analyze the payload and save the segment record to the database.
- Update the status of message to processing (status: PR).
Creation Date: 24/10/2006.
Author: Twinsen Tsang
Constructors¶
OutgoingPayloadsTask¶
-
public
OutgoingPayloadsTask
(PackagedPayloads payload, SFRMPartnershipDVO pDVO, String status)¶ Explicit Constructor.
Parameters: - payload – The packaged payload file.
- pDVO – TODO
- status – The status of the for process
Throws: - NullPointerException – if the input payload is null.
- DAOException – if fail to retreve the partnership.
- IOException –
Methods¶
execute¶
-
public void
execute
()¶ Execute the active task.
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.execute()
OutgoingPayloadsTaskTest¶
-
public class
OutgoingPayloadsTaskTest
extends PluginTest<SFRMProcessor>¶
OutgoingSegmentCollector¶
-
public class
OutgoingSegmentCollector
extends LimitedActiveTaskList¶ The outgoing segment payloads collector collect all segmented payload at the database which is ready for sending to receiver. (status: PS). Creation Date: 25/10/2006
Author: Twinsen Tsang
OutgoingSegmentTask¶
-
public class
OutgoingSegmentTask
extends ActiveTaskAdaptor¶ Creation Date: 9/10/2006
Author: Twinsen Tsang
Constructors¶
OutgoingSegmentTask¶
-
public
OutgoingSegmentTask
(SFRMMessageSegmentDVO sgtDVO, SFRMPartnershipDVO pDVO, SFRMMessageDVO msgDVO, PackagedPayloads payload)¶ Explicit Constructor.
Parameters: - sgtDVO – The payload need to be send out.
- pDVO – The partnership record associated to this segment.
- msgDVO – The message record associated to this segment.
- payload – The packaged payloads
Throws: - NullPointerException – If the message, partnership and segment is null.
Methods¶
execute¶
-
public void
execute
()¶ Execute the active task.
See also:
hk.hku.cecid.piazza.commons.module.ActiveTask.execute()
getMaxRetries¶
-
public int
getMaxRetries
()¶ Returns: return the max retries allowed for this active task.
getRetryInterval¶
-
public long
getRetryInterval
()¶ Returns: return the interval between each sending retry.
onFailure¶
-
public void
onFailure
(Throwable e)¶ The method is invoked upon the task fails to send. The message segment and message will treat as FAIL. with status DF (Delivery Failure). Also, if the outgoing segment is a RECEIPT, then the PAYLOAD segment corresponding to this RECEIPT is also treated as FAIL.
Parameters: - e – The failure cause.
hk.hku.cecid.edi.sfrm.util¶
BandWidthOptimizer¶
-
public class
BandWidthOptimizer
¶ Author: Patrick Yip To regulate the execution interval of the collector, to improve the performance and use as least resource as possible to reach the maximum speed
Constructors¶
BandWidthOptimizer¶
-
public
BandWidthOptimizer
(ActiveTaskModule collector)¶
PathHelper¶
-
public class
PathHelper
¶ It provides some useful method for handling the file path issue. version 1.0.1 - Added
getRelativePath(String,String)
.Author: Twinsen
StatusQuery¶
-
public class
StatusQuery
¶ Author: Patrick Yip
Constructors¶
StatusQuery¶
-
public
StatusQuery
(String messageId, SFRMMessageSegmentDAO dao)¶
Methods¶
StatusQueryTest¶
-
public class
StatusQueryTest
extends PluginTest<SFRMProcessor>¶ Author: Patrick Yip
TimedOutEntryListener¶
-
public interface
TimedOutEntryListener
¶ The
TimedOutEntryListener
is the callback listener forTimedOutHashTable
. It is invoked when a hash key-value pair is considered timed-out and prepare to delete the entry. Creation Date: 26/6/2007Author: Twinsen Tsang See also:
hk.hku.cecid.piazza.commons.util.TimedOutHashTable.
TimedOutHashTable¶
-
public class
TimedOutHashTable
extends Hashtable¶ The
TimedOutDHashTable
is the hashtable that provides time out features. All timed-out key and value will be cleared in the hashtable. The default interval for sweeping away all timed out record is 5 second. For the release of JDK5.0 , this class can inherit java.util.conncurrent.ConcurrentHashMap for better performance. Creation Date: 25/6/2007 17/7/2007 1. Bug Fixed that return false for invokingcontainsValue(Object)
because of invalid implementation ofTimedOutEntry.equals(Object)
. 2. Bug Fixed that the memory leak issue when de-referecing timed-out hashtable due to there is one reference in the internal TimedOutTask. Now you are required to callcomplete()
when you want to gc the hashtable.Author: Twinsen Tsang
Constructors¶
Methods¶
complete¶
-
public void
complete
()¶ Invoke this method when you no longer want to use the hashtable anymore. (it will be gc soon).
put¶
-
public Object
put
(Object key, Object value, long timeOutInMs)¶ Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null. The value can be retrieved by calling the get method with a key that is equal to the original key.
Parameters: - key – the hashtable key.
- value – the value
- timeOutInMS – how long does this record time out.
Returns: the previous value of the specified key in this hashtable, or null if it did not have one.
put¶
-
public Object
put
(Object key, Object value, Date timeOutDate)¶ Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null. The value can be retrieved by calling the get method with a key that is equal to the original key.
Parameters: - key – the hashtable key.
- value – the value
- timeOutDate – how long does this record time out in date object.
Returns: the previous value of the specified key in this hashtable, or null if it did not have one.
setListener¶
-
public void
setListener
(TimedOutEntryListener listener)¶ Parameters: - listener – The listener for receiving removal event of timed-out entry.
See also:
hk.hku.cecid.piazza.commons.util.TimedOutEntryListener.
TimedOutHashTableTest¶
-
public class
TimedOutHashTableTest
extends TestCase¶ The test case for
TimedOutHashTable
. Creation Date: 25/6/2007Author: Twinsen Tsang
Methods¶
testContain¶
-
public void
testContain
()¶ Test for existence of the putting object using method
contain
.
testContainValue¶
-
public void
testContainValue
()¶ Test for existence of the putting object using method
containValue
.
testMultiplePutWithMixed¶
-
public void
testMultiplePutWithMixed
()¶ Test for putting multiple object with some time out specified while some don’t. It then check whether some records are swept out after [sweeping_interval + timeout value].
testMultiplePutWithTimeout¶
-
public void
testMultiplePutWithTimeout
()¶ Test for putting multiple object with time out specified and see whether all records are swept out after [sweeping_interval + timeout value].
hk.hku.cecid.hermes.api¶
Constants¶
-
public class
Constants
¶
hk.hku.cecid.hermes.api.listener¶
HermesAbstractApiListener¶
-
public class
HermesAbstractApiListener
extends HttpRequestAdaptor¶ HermesAbstractApiListener
Author: Patrick Yee
Methods¶
getDictionaryFromRequest¶
-
protected Map<String, Object>
getDictionaryFromRequest
(HttpServletRequest request)¶
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ processRequest
Parameters: - request –
- response –
Throws: Returns: String
See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.processRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
HermesAbstractApiListenerTest¶
-
public class
HermesAbstractApiListenerTest
¶ HermesAbstractApiListenerTest
Author: Patrick Yee
HermesApiListener¶
-
public class
HermesApiListener
extends HermesAbstractApiListener¶ HermesApiListener
Author: Patrick Yee
HermesMessageReceiveApiListener¶
-
public class
HermesMessageReceiveApiListener
extends HermesProtocolApiListener¶ HermesMessageReceiveApiListener
Author: Patrick Yee
HermesMessageSendApiListener¶
-
public class
HermesMessageSendApiListener
extends HermesProtocolApiListener¶ HermesMessageSendApiListener
Author: Patrick Yee
HermesPartnershipApiListener¶
-
public class
HermesPartnershipApiListener
extends HermesProtocolApiListener¶ HermesPartnershipApiListener
Author: Patrick Yee
HermesProtocolApiListener¶
-
public class
HermesProtocolApiListener
extends HermesAbstractApiListener¶ HermesProtocolApiListener
Author: Patrick Yee
HermesProtocolApiListenerTest¶
-
public class
HermesProtocolApiListenerTest
¶ HermesProtocolApiListenerTest
Author: Patrick Yee
Fields¶
listener¶
-
protected HermesProtocolApiListener
listener
¶
Methods¶
testGetProtocolFromPathInfo_end_with_slash¶
-
public void
testGetProtocolFromPathInfo_end_with_slash
()¶
testGetProtocolFromPathInfo_four_segments_no_prefix¶
-
public void
testGetProtocolFromPathInfo_four_segments_no_prefix
()¶
testGetProtocolFromPathInfo_multiple_action_parts¶
-
public void
testGetProtocolFromPathInfo_multiple_action_parts
()¶
testGetProtocolFromPathInfo_multiple_action_parts_with_empty_segment¶
-
public void
testGetProtocolFromPathInfo_multiple_action_parts_with_empty_segment
()¶
testGetProtocolFromPathInfo_some_empty_segment¶
-
public void
testGetProtocolFromPathInfo_some_empty_segment
()¶
hk.hku.cecid.hermes.api.spa¶
ApiPlugin¶
-
public class
ApiPlugin
implements PluginHandler¶ Author: Patrick Yee
Fields¶
core¶
-
public static SystemModule
core
¶
hk.hku.cecid.piazza.commons¶
GenericException¶
-
public class
GenericException
extends Exception¶ GenericException represents all kinds of non-runtime exception in the application.
Author: Hugo Y. K. Lam
Methods¶
toString¶
-
public String
toString
()¶ Returns a string representation of this exception.
Returns: a string representation of this exception. See also:
java.lang.Object.toString()
Sys¶
-
public final class
Sys
¶ Sys represents a system in an application and contains one system module, which is described by a module descriptor. The descriptor location and the system module class will be looked up from a module group descriptor which is located by the following logic:
- Search for the Sys properties (sys.properties) in the classpaths of the classloader used to load the Sys class.
- If the properties was not found, use the Java System Properties.
- Look for a property ‘sys.module.group’ for the system module group descriptor location.
- If the property is not found, the location will be default to ‘hk/hku/cecid/piazza/commons/conf/sys.module-group.xml’
Author: Hugo Y. K. Lam See also:
hk.hku.cecid.piazza.commons.module.Module
,hk.hku.cecid.piazza.commons.module.ModuleGroup
Fields¶
main¶
-
public static final SystemModule
main
¶ The main system module.
Methods¶
getModuleGroup¶
-
public static ModuleGroup
getModuleGroup
()¶ Gets the system module group.
Returns: the system module group.
hk.hku.cecid.piazza.commons.activation¶
ByteArrayDataSource¶
-
public class
ByteArrayDataSource
implements DataSource¶ ByteArrayDataSource is an implementation of the javax.activation.DataSource that represents a data source of a byte array.
Author: Hugo Y. K. Lam
Constructors¶
ByteArrayDataSource¶
-
public
ByteArrayDataSource
(byte[] bytes)¶ Creates a new instance of ByteArrayDataSource.
Parameters: - bytes – the bytes source.
ByteArrayDataSource¶
Methods¶
getInputStream¶
-
public InputStream
getInputStream
()¶ Returns a new input stream representing the bytes source.
Returns: a new byte array input stream.
getName¶
-
public String
getName
()¶ Gets the name of the underlying content.
Returns: the name of the underlying content. See also:
javax.activation.DataSource.getName()
getOutputStream¶
-
public OutputStream
getOutputStream
()¶ This method always throw IO exception.
Throws: - IOException – as output stream is not supported by this data source.
ByteStreamDataContentHandler¶
-
public class
ByteStreamDataContentHandler
implements DataContentHandler¶ ByteStreamDataContentHandler is an implementation of the javax.activation.DataContentHandler that represents a data content handler of a byte stream.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
getContent¶
-
public Object
getContent
(DataSource ds)¶ Returns a byte stream, which is described by the first DataFlavor returned by the getTransferDataFlavors() method, representing the specified data.
Parameters: - ds – the data source representing the data to be converted.
Throws: - IOException – if unable to convert the data.
Returns: the byte stream representing the data.
See also:
javax.activation.DataContentHandler.getContent(javax.activation.DataSource)
getTransferData¶
-
public Object
getTransferData
(DataFlavor df, DataSource ds)¶ Returns a byte stream which represents the data to be transferred, ignoring the specified flavor.
Parameters: - df – the data flavor representing the requested type.
- ds – the DataSource representing the data to be converted.
Throws: - IOException – if unable to convert the data.
Returns: the byte stream representing the data.
getTransferDataFlavors¶
-
public DataFlavor[]
getTransferDataFlavors
()¶ Returns an array of DataFlavor objects indicating the flavors the data can be provided in.
Returns: an array of DataFlavor objects. See also:
javax.activation.DataContentHandler.getTransferDataFlavors()
writeTo¶
-
public void
writeTo
(Object obj, String mimeType, OutputStream os)¶ Converts the object to a byte stream of the specified MIME type and write it to the output stream.
Parameters: - obj – the object to be converted.
- mimeType – the requested MIME type of the resulting byte stream.
- os – the output stream into which to write the converted byte stream.
Throws: - IOException – if unable to convert the given object.
See also:
javax.activation.DataContentHandler.writeTo(java.lang.Object,java.lang.String,java.io.OutputStream)
InputStreamDataSource¶
-
public class
InputStreamDataSource
implements DataSource¶ InputStreamDataSource is an implementation of the javax.activation.DataSource It is designed to be used by SOAPMailSender as a bridge of InputStream and OutputStream for base64 encoding transformation.
Author: Philip Wong
Constructors¶
InputStreamDataSource¶
-
public
InputStreamDataSource
(InputStream is, String contentType, String name)¶ Creates a new instance of InputStreamDataSource by BodyPart.
Parameters: - is – the input stream.
- contentType – the content type.
- name – the filename if any.
Methods¶
getContentType¶
getInputStream¶
-
public InputStream
getInputStream
()¶ Gets the input stream.
Returns: the input stream when this data source created.
getName¶
getOutputStream¶
-
public OutputStream
getOutputStream
()¶ Returns new byte array from a new BytesArrayOutStream always. Logically, it is required to copy binary content from the input stream to output stream. But it is found the same result without touching binary content.
Returns: the content type when this data source created.
Mailcap¶
-
public class
Mailcap
¶ Mailcap represents a single mailcap in the MailcapCommandMap. It is a convenient class for constructing a mailcap to be added to the MailcapCommandMap and for easy comparison if necessary.
Author: Kevin Tsang See also:
javax.activation.MailcapCommandMap
Constructors¶
hk.hku.cecid.piazza.commons.dao¶
AbstractDVO¶
-
public abstract class
AbstractDVO
implements DVO¶ The AbstractDVO, which implements the DVO interface, is simply a convenient abstract class for managing the data of a DVO. It implemented the methods of the DVO interface, provides some convenient methods and is backed by a Hashtable.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
equals¶
-
public boolean
equals
(Object obj)¶ Indicates whether the given object is equal to this one. The objects are equal if and only if the given object is an AbstractDVO object and the values contained in that object match with this one’s.
Parameters: - obj – the object to be compared.
Returns: true if the given object is equal to this one.
get¶
getBoolean¶
getData¶
getDate¶
getDirties¶
getDouble¶
getInt¶
getLong¶
getObject¶
-
public Object
getObject
(Object key, Class c)¶ Gets an Object from this DVO by its referencing key. If the value object is not of the Class specified, it will try to create an instance of the Class with the Object as the parameter.
Parameters: - key – The key referencing the String value.
- c – the Class of the returning Object.
Returns: the Object retrieved by its referencing key. If the value object is not of the Class specified, it will be an instance of the Class with the Object as the parameter. Null if the mentioned cannot be achieved.
getSQLDate¶
getString¶
getTimestamp¶
-
public java.sql.Timestamp
getTimestamp
(Object key)¶ Retrieves the value by the specified key in this AbstractDVO as a java.sql.Timestamp. It can transform java.sql.Date, java.util.Date and Oracle DATE and TIMESTAMP.
Parameters: - key – the key referencing the value to be retrieved.
Returns: the value retrieved by the specified key.
put¶
-
public Object
put
(Object key, Object value)¶ Sets a single value to this DVO with a key as its reference.
Parameters: - key – the key referencing the value to be set.
- value – the value object to be set to this DVO.
Returns: the previous value of the specified key in this hashtable, or null if it did not have one.
remove¶
setBoolean¶
setData¶
setDate¶
setDouble¶
setInt¶
setLong¶
setString¶
DAO¶
-
public interface
DAO
¶ The Data Access Object is the primary object of the DAO pattern. The Data Access Object abstracts the underlying data access implementation for the Business Object to enable transparent access to the data source. The Business Object also delegates data load and store operations to the Data Access Object.
Author: Hugo Y. K. Lam
Methods¶
create¶
-
public void
create
(DVO data)¶ Creates the given DAO data, which is managed by this DAO, in the underlying data source.
Parameters: - data – the DAO data.
Throws: - DAOException – if unable to create the data.
createDVO¶
getFactory¶
-
public DAOFactory
getFactory
()¶ Gets the DAO factory of this DAO.
Returns: the DAO factory.
getParameters¶
-
public Properties
getParameters
()¶ Gets the parameters of this DAO.
Returns: the parameters of this DAO.
getTransaction¶
-
public Transaction
getTransaction
()¶ Gets the transaction of this DAO.
Throws: Returns: the transaction of this DAO or null if there is none.
persist¶
-
public boolean
persist
(DVO data)¶ Persists the given DAO data, which is managed by this DAO, to the underlying data source.
Parameters: - data – the DAO data.
Throws: - DAOException – if unable to persist the data.
- ClassCastException – if the DAO data is not DataSourceDVO.
Returns: true if the data is found and persisted.
remove¶
-
public boolean
remove
(DVO data)¶ Removes the given DAO data, which is managed by this DAO, from the underlying data source.
Parameters: - data – the DAO data.
Throws: - DAOException – if unable to remove the data.
Returns: true if the data is found and removed.
retrieve¶
-
public boolean
retrieve
(DVO data)¶ Retrieves the given DAO data, which is managed by this DAO, from the underlying data source.
Parameters: - data – the DAO data.
Throws: - DAOException – if unable to retrieve the data.
- ClassCastException – if the DAO data is not DataSourceDVO.
Returns: true if the data is found and retrieved.
setTransaction¶
-
public void
setTransaction
(Transaction transaction)¶ Sets a transaction to this DAO.
Parameters: - transaction – the transaction of this DAO.
Throws: - DAOException – if the transaction is not supported by this DAO.
DAOException¶
-
public class
DAOException
extends hk.hku.cecid.piazza.commons.GenericException¶ DAOException is a class representing the exception related to or thrown in the DAO framework.
Author: Hugo Y. K. Lam
DAOFactory¶
-
public abstract class
DAOFactory
extends Component¶ The DAO pattern can be made highly flexible by adopting the Abstract Factory and the Factory Method Patterns.
The Factory Method pattern can be used to produce a number of DAOs needed by the application when the underlying storage is not subject to change from one implementation to another. When it is subject to change, the Abstract Factory pattern can in turn build on and use the Factory Method Implementation. In this case, it provides an abstract DAO factory object that can construct various types of concrete DAO factories, each factory supporting a different type of persistent storage implementation. Once you obtain the concrete DAO factory for a specific implementation, you use it to produce DAOs supported and implemented in that implementation.
Author: Hugo Y. K. Lam
Methods¶
createDAO¶
-
public DAO
createDAO
(Class inf)¶ Creates a new DAO.
Parameters: - inf – the DAO interface class.
Throws: - DAOException – if there is any problem in looking up the DAO with the interface specified.
Returns: the DAO retrieved by the interface specified.
createDAO¶
-
public DAO
createDAO
(String daoname)¶ Creates a new DAO.
Parameters: - daoname – the DAO name.
Throws: - DAOException – if there is any problem in looking up the DAO with the name specified.
Returns: the DAO retrieved by the name specified.
See also:
.initDAO(DAO)
createDAOFactory¶
-
public static DAOFactory
createDAOFactory
(String name, String provider, Properties params, ClassLoader loader)¶ Creates a DAO Factory.
Parameters: - name – the DAO Factory name.
- provider – the provider of the DAO Factory.
- params – the parameters for creating the DAO Factory.
- loader – the class loader for loading the factory class.
Throws: - DAOException – if there is any error when creating the DAO Factory using the specified parameters.
Returns: the DAO Factory created by the parameters specified.
createTransaction¶
-
public Transaction
createTransaction
()¶ Creates a new transaction.
Throws: - DAOException – if unable to create a new transaction.
Returns: a new transaction.
getParameter¶
-
protected String
getParameter
(String key)¶ Gets a parameter from the parameters of this DAOFactory.
Parameters: - key – the parameter key.
Throws: - DAOException – if there is no parameter matching the specified key.
Returns: the parameter value associated with the specified key.
getParameter¶
-
protected String
getParameter
(String key, String def)¶ Gets a parameter from the parameters of this DAOFactory.
Parameters: - key – the parameter key.
- def – the default value.
Returns: the parameter value associated with the specified key. The default value will be returned if there is no parameter matching the specified key.
init¶
-
protected void
init
()¶ Initializes the DAO Factory.
Throws: - DAOException – when there is any error in the initialization.
See also:
.initFactory()
initDAO¶
-
protected abstract void
initDAO
(DAO dao)¶ Invoked by the createDAO() method for initializing the given DAO.
Parameters: - dao – the DAO.
Throws: - DAOException – if unable to initialize the DAO.
See also:
.createDAO(Class)
,.createDAO(String)
initFactory¶
-
protected abstract void
initFactory
()¶ Invoked by the init() method for initializing the implementing factory.
Throws: - DAOException – if unable to initialize the factory.
See also:
.init()
DVO¶
-
public interface
DVO
extends java.io.Serializable¶ A DVO represents a value object in the DAO model. The Data Access Object may use a value object to return data to the client. The Data Access Object may also receive a value object for updating and querying.
Author: Hugo Y. K. Lam
Transaction¶
-
public interface
Transaction
¶ The Transaction interface allows operations to be performed against the transaction in the target Transaction object. A Transaction object is created by a corresponding DAO factory. Before any transaction starts, the Transaction object should be notified by the invocation of its begin() method. When the transaction is finished, either commit() or rollback should be invoked and the resources it acquired should be released accordingly.
Author: Hugo Y. K. Lam
Methods¶
begin¶
-
public void
begin
()¶ Begins the transaction.
Throws: - DAOException – if unable to begin the transaction.
commit¶
-
public void
commit
()¶ Commits the transaction.
Throws: - DAOException – if unable to commit the transaction.
rollback¶
-
public void
rollback
()¶ Rolls back the transaction.
Throws: - DAOException – unable to roll back the transaction.
hk.hku.cecid.piazza.commons.dao.ds¶
DataSourceDAO¶
-
public abstract class
DataSourceDAO
implements DAO¶ The abstract DataSourceDAO class encapsulates a DataSourceDAOFactory object. It basically provides methods, such as getTransaction() and createTransaction(), for any subclasses to get or create a transaction for accessing the underlying data source. It also provides some convenient methods for the subclasses to access, like querying and updating, the data source.
When using the convenient methods, some basic parameters need to be defined. The parameters should be stored in the Properties object which can be retrieved by calling getProperties().
The key-value pairs of the parameters must be in the following format:
Key Value Used by finder:key The key finder SQL statement findByKey() finder: {alias name} The finder SQL statement find() column: {name in the data source} The column’s key in the DVO getColumnCodeName(), executeQuery() sql: {alias name} The SQL statement getSQL(), update() Author: Hugo Y. K. Lam
Methods¶
create¶
-
public void
create
(DVO data)¶ Creates the given value object in the data source.
Parameters: - data – the value object.
Throws: - DAOException – if unable to create the data.
- ClassCastException – if the value object is not DataSourceDVO.
See also:
hk.hku.cecid.piazza.commons.dao.DAO.create(hk.hku.cecid.piazza.commons.dao.DVO)
createTransaction¶
-
protected DataSourceTransaction
createTransaction
()¶ Creates a new DataSourceTransaction object from the underlying data source factory.
Throws: - DAOException – if unable to create the transaction.
Returns: a new DataSourceTransaction object.
executeQuery¶
-
protected List
executeQuery
(String sql)¶ Executes a SQL query on the data source and returns a List of DVO which matches.
Parameters: - sql – the SQL query statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
executeQuery¶
-
protected List
executeQuery
(DataSourceTransaction tx, String sql)¶ Executes a SQL query on the data source and returns a List of DVO which matches.
Parameters: - tx – the DataSourceTransaction to be used in execution.
- sql – the SQL query statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
executeQuery¶
-
protected List
executeQuery
(String sql, Object[] paras)¶ Executes a SQL query on the data source and returns a List of DVO which matches.
Parameters: - sql – the SQL query statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
executeQuery¶
-
protected List
executeQuery
(DataSourceTransaction tx, String sql, Object[] paras)¶ Executes a SQL query on the data source and returns a List of DVO which matches.
Parameters: - tx – the DataSourceTransaction to be used in execution.
- sql – the SQL query statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
executeRawQuery¶
-
protected List
executeRawQuery
(String sql, Object[] paras)¶ Executes a SQL query on the data source and returns a List of raw data which matches.
Parameters: - sql – the SQL query statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
executeRawQuery¶
-
protected List
executeRawQuery
(DataSourceTransaction tx, String sql, Object[] paras)¶ Executes a SQL query on the data source and returns a List of raw data which matches.
Parameters: - tx – the DataSourceTransaction to be used in execution.
- sql – the SQL query statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO resulted from the specified SQL query. An empty List will be returned if there is no matching data.
executeUpdate¶
-
protected int
executeUpdate
(String sql)¶ Executes a SQL update on the data source and returns an integer indicating the update result.
Parameters: - sql – the SQL update statement.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an integer indicating the update results. Same as the value returned by java.sql.Statement.executeUpdate().
executeUpdate¶
-
protected int
executeUpdate
(DataSourceTransaction tx, String sql)¶ Executes a SQL update on the data source and returns an integer indicating the update result.
Parameters: - tx – the DataSourceTransaction to be used in execution.
- sql – the SQL update statement.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an integer indicating the update results. Same as the value returned by java.sql.Statement.executeUpdate().
executeUpdate¶
-
protected int
executeUpdate
(String sql, Object[] paras)¶ Executes a SQL update on the data source and returns an integer indicating the update result.
Parameters: - sql – the SQL update statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an integer indicating the update results. Same as the value returned by java.sql.Statement.executeUpdate().
executeUpdate¶
-
protected int
executeUpdate
(DataSourceTransaction tx, String sql, Object[] paras)¶ Executes a SQL update on the data source and returns an integer indicating the update result.
Parameters: - tx – the DataSourceTransaction to be used in execution.
- sql – the SQL update statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an integer indicating the update results. Same as the value returned by java.sql.Statement.executeUpdate()
executeUpdate¶
-
protected int[]
executeUpdate
(String sql, Object[][] paras)¶ Executes a SQL update on the data source and returns an array of integers indicating the update results.
Parameters: - sql – the SQL update statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement and multiple sets if it is a batch update.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an array of integers indicating the update results. Same as the value returned by java.sql.Statement.executeUpdate().
executeUpdate¶
-
protected int[]
executeUpdate
(DataSourceTransaction tx, String sql, Object[][] paras)¶ Executes a SQL update on the data source and returns an array of integers indicating the update results.
Parameters: - tx – the DataSourceTransaction to be used in execution.
- sql – the SQL update statement.
- paras – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement and multiple sets if it is a batch update.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an array of integers indicating the update results. Same as the value returned by java.sql.Statement.executeUpdate().
find¶
-
protected List
find
(String finder, Object[] paras)¶ Retrieves data from the data source as a List of DVO by searching with the specified data values.
Parameters: - finder – the name of the finder SQL statement.
- paras – the parameter values used by the finder statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of DVO found by the specified data values. An empty List will be returned if there is no matching data.
findByKey¶
-
protected DVO
findByKey
(Object[] keys)¶ Retrieves data from the data source by searching with the specified key values.
Parameters: - keys – the key values for querying the data source.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a DVO found by the specified key values. If there are more than one DVO found, the first one will be returned. null will be returned if nothing was found.
getColumnCodeName¶
getFactory¶
-
public DAOFactory
getFactory
()¶ Gets the DAO factory of this DAO.
Returns: the DAO factory.
getFilter¶
getFinder¶
getOrder¶
getParameters¶
-
public Properties
getParameters
()¶ Gets the parameters of this DAO.
Returns: a Properties which stored the parameters for this DAO.
getSQL¶
getTransaction¶
-
public Transaction
getTransaction
()¶ Gets the transaction of this DAO. This method returns null if this DAO is not under a transaction.
Throws: - DAOException – if unable to get the transaction.
Returns: the transaction of this DAO.
See also:
hk.hku.cecid.piazza.commons.dao.DAO.getTransaction()
getTransaction¶
-
protected DataSourceTransaction
getTransaction
(boolean create)¶ Gets the transaction of this DAO. This method returns a new transaction if and only if this DAO is not under a transaction and the create parameter is set to true. Notice that a newly created transaction will not be set as the transaction of this DAO. It is only created for convenience of use.
Parameters: - create – true if a new transaction should be created if this DAO is not under a transaction.
Throws: - DAOException – if unable get or create a transaction.
Returns: the transaction of this DAO or a new transaction.
isUnderTransaction¶
-
public boolean
isUnderTransaction
()¶ Checks if this DAO is under a transaction.
Returns: true if this DAO is under a transaction.
persist¶
-
public boolean
persist
(DVO data)¶ Persists the given value object to the data source.
Parameters: - data – the value object.
Throws: - DAOException – if unable to persist the data.
- ClassCastException – if the DAO data is not DataSourceDVO.
Returns: true if the data is found and persisted.
See also:
hk.hku.cecid.piazza.commons.dao.DAO.persist(hk.hku.cecid.piazza.commons.dao.DVO)
remove¶
-
public boolean
remove
(DVO data)¶ Removes the given value object from the data source.
Parameters: - data – the value object.
Throws: - DAOException – if unable to remove the data.
- ClassCastException – if the value object is not DataSourceDVO.
Returns: true if the data is found and removed.
See also:
hk.hku.cecid.piazza.commons.dao.DAO.remove(hk.hku.cecid.piazza.commons.dao.DVO)
retrieve¶
-
public boolean
retrieve
(DVO data)¶ Retrieves the given value object from the data source.
Parameters: - data – the value object.
Throws: - DAOException – if unable to retrieve the data.
- ClassCastException – if the value object is not DataSourceDVO.
Returns: true if the data is found and retrieved.
See also:
hk.hku.cecid.piazza.commons.dao.DAO.retrieve(hk.hku.cecid.piazza.commons.dao.DVO)
setFactory¶
-
void
setFactory
(DataSourceDAOFactory factory)¶ Sets the DAO factory of this DAO.
Parameters: - factory – the DAO factory.
setTransaction¶
-
public void
setTransaction
(Transaction tx)¶ Sets the transaction of this DAO.
Parameters: - tx – the transaction of this DAO.
Throws: - DAOException – if the given transaction is not supported.
update¶
-
protected int
update
(String sqlname, Object[] paras)¶ Updates the data source with the specified data values.
Parameters: - sqlname – the name of the SQL statement to be used.
- paras – the data values to be updated to the data source.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an integer indicating the update result. Same as the value returned by java.sql.Statement.executeUpdate()
DataSourceDAOFactory¶
-
public class
DataSourceDAOFactory
extends DAOFactory¶ The DataSourceDAOFactory has implemented the DAOFactory and provides an implementation for accessing the data source by Java DataSource. Notice that the DAO created by the createDAO() method is a DataSourceDAO object since this factory is a DataSourceDAOFactory.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
createTransaction¶
-
public Transaction
createTransaction
()¶ Creates a data source transaction.
Throws: - TransactionException – if unable to create the data source transaction.
Returns: a new data source transaction.
See also:
hk.hku.cecid.piazza.commons.dao.DAOFactory.createTransaction()
getDataSource¶
-
protected DataSource
getDataSource
()¶ Gets the underlying DataSource object.
Returns: the underlying DataSource object.
initDAO¶
-
protected void
initDAO
(DAO dao)¶ Initializes the given DAO.
Parameters: - dao – the DAO.
Throws: - DAOException – if unable to initialize the DAO.
setDataSource¶
-
protected void
setDataSource
(DataSource source)¶ Sets the underlying DataSource object.
Parameters: - source – the underlying DataSource object.
DataSourceDVO¶
-
public abstract class
DataSourceDVO
extends AbstractDVO¶ The DataSourceDVO, which implements the DVO interface, is simply a subclass of the AbstractDVO. It is expected to be used by a DataSourceDAOFactory.
Author: Hugo Y. K. Lam
DataSourceProcess¶
-
public abstract class
DataSourceProcess
¶ DataSourceProcess represents a data source transaction process. Subclasses are required to implement the doTransaction() method for the transaction process.
This process will only manage, for example commit or rollback, the transaction encapsulated if its DataSourceDAO is not under a transaction and it is not explicitly instructed, in construction, to use a specified transaction.
Author: Hugo Y. K. Lam
Constructors¶
DataSourceProcess¶
-
public
DataSourceProcess
(DataSourceDAO dao)¶ Creates a new instance of DataSourceProcess.
Parameters: - dao – the DAO to which this process correspond.
DataSourceProcess¶
-
public
DataSourceProcess
(DataSourceDAO dao, DataSourceTransaction transaction)¶ Creates a new instance of DataSourceProcess.
Parameters: - dao – the DAO to which this process correspond.
- transaction – the transaction in which this process should execute.
Methods¶
doTransaction¶
-
protected abstract void
doTransaction
(DataSourceTransaction tx)¶ Executes the transaction process.
Parameters: - tx – the DataSourceTransaction object in which this process executes.
Throws: - DAOException – if any error occurred in the execution.
getDAO¶
-
protected DataSourceDAO
getDAO
()¶ Gets the DAO to which this process correspond.
Returns: the DAO to which this process correspond.
getParameterCount¶
-
protected int
getParameterCount
(PreparedStatement pStmt, String sql)¶ Counts the number of parameters required by the prepared statement. If a parameter meta data is not available, it counts the occurrences of ‘?’ in the given SQL statement.
Parameters: - pStmt – the prepared statement.
- sql – the SQL statement.
Returns: the numbder of parameters.
getResult¶
isCommitted¶
-
public boolean
isCommitted
()¶ Checks if this process has committed the transaction.
Returns: true if this process has committed the transaction.
isRolledBack¶
-
public boolean
isRolledBack
()¶ Checks if this process has rolled back the transaction.
Returns: true if this process has rolled back the transaction.
isStarted¶
-
public boolean
isStarted
()¶ Checks if this process has already been started.
Returns: true if the this process has already been started.
setParameter¶
-
protected void
setParameter
(PreparedStatement pStmt, int pos, Object param)¶ Sets a parameter to the prepared statement.
Parameters: - pStmt – the prepared statement.
- pos – the position of the parameter.
- param – the parameter.
Throws: - SQLException – if unable to set the parameter.
setResult¶
start¶
-
public synchronized void
start
()¶ Starts executing this process. A process can only be started if it has not yet been started.
Throws: - DAOException – if there is any error in the execution or the process has already been started.
toString¶
-
public String
toString
()¶ Returns a string representation of this process.
Returns: a string representation of this process. See also:
java.lang.Object.toString()
DataSourceQuery¶
-
class
DataSourceQuery
extends DataSourceProcess¶ DataSourceQuery is a data source DAO process which handles a SQL query process.
Author: Hugo Y. K. Lam
Constructors¶
DataSourceQuery¶
-
DataSourceQuery
(DataSourceDAO dao, DataSourceTransaction transaction, String sql, Object[] params)¶ Creates a new instance of DataSourceQuery.
Parameters: - dao – the DAO to which this process correspond.
- transaction – the transaction for this process.
- sql – the SQL query statement.
- params – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Methods¶
doTransaction¶
-
protected void
doTransaction
(DataSourceTransaction tx)¶ Executes the query and stores the result as a list of DataSourceDVO or raw data list.
Throws: - DAOException – if unable to execute the query.
See also:
hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.doTransaction(DataSourceTransaction)
isRawResult¶
-
public boolean
isRawResult
()¶ Checks if the result data is in raw format.
Returns: true if the result data is in raw format. See also:
.setRawResult(boolean)
setRawResult¶
-
public void
setRawResult
(boolean isRawResult)¶ Sets whether the result data should be in raw format. If true, the result data will be a list of DataSourceDVO. Otherwise, it will be a list of list which contains the data values in order with the query.
Parameters: - isRawResult – true if the result data should be in raw format.
DataSourceTransaction¶
-
public class
DataSourceTransaction
implements Transaction¶ DataSourceTransaction is an implementation of a DAO transaction. It should not be created directly and is usually created through DataSourceDAOFactory.
Author: Hugo Y. K. Lam See also:
DataSourceDAOFactory
Constructors¶
DataSourceTransaction¶
-
protected
DataSourceTransaction
(DataSourceDAOFactory dsFactory)¶ Creates a new instance of DataSourceTransaction.
Parameters: - dsFactory – the data source factory which creates this transaction.
Throws: - DAOException – if the no data source factory specified.
Methods¶
begin¶
-
public void
begin
()¶ Begins the transaction.
Throws: - DAOException – if unable to begin the transaction or the transaction has already begun.
See also:
hk.hku.cecid.piazza.commons.dao.Transaction.begin()
commit¶
-
public void
commit
()¶ Commits the transaction.
Throws: - DAOException – if unable to commit the transaction.
See also:
hk.hku.cecid.piazza.commons.dao.Transaction.commit()
getConnection¶
-
public Connection
getConnection
()¶ Gets the connection that this transaction manages.
Throws: - DAOException – if the transaction has not begun or has been ended.
Returns: the connection this transaction manages.
releaseConnection¶
-
public void
releaseConnection
()¶ Releases the connection that this transaction manages.
rollback¶
-
public void
rollback
()¶ Rolls back the transaction.
Throws: - DAOException – if unable to commit the transaction.
See also:
hk.hku.cecid.piazza.commons.dao.Transaction.rollback()
DataSourceUpdate¶
-
class
DataSourceUpdate
extends DataSourceProcess¶ DataSourceUpdate is a data source DAO process which handles a SQL update process.
Author: Hugo Y. K. Lam
Constructors¶
DataSourceUpdate¶
-
DataSourceUpdate
(DataSourceDAO dao, DataSourceTransaction transaction, String sql, Object[][] params)¶ Creates a new instance of DataSourceUpdate.
Parameters: - dao – the DAO to which this process correspond.
- transaction – the transaction for this process.
- sql – the SQL update statement.
- params – the parameter values used by the specified SQL statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement and multiple sets if it is a batch update.
Methods¶
doTransaction¶
-
protected void
doTransaction
(DataSourceTransaction tx)¶ Executes the update and stores the result as an array of integers which indicates the update results.
Throws: - DAOException – if unable to execute the update.
See also:
hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.doTransaction(DataSourceTransaction)
NullableObject¶
-
public class
NullableObject
¶ NullableObject is a wrapper class for any object which has a corresponding SQL type. It indicates if the object wrapped is null and provide the type, java.sql.Types, information of the object.
Constructors¶
Methods¶
getObject¶
getType¶
-
public int
getType
()¶ Retrieves the type information of the object wrapped.
Returns: the type information of the object wrapped. -1 if not specified in the creation of this instance.
SQLBuilder¶
-
public class
SQLBuilder
¶ SQLBuilder is a tool which can construct prepared SQL statements from the specified table, keys, and columns.
Author: Hugo Y. K. Lam
SimpleDSDAO¶
-
public class
SimpleDSDAO
extends DataSourceDAO¶ SimpleDSDAO is a concrete subclass of DataSourceDAO which provides some convenient methods for querying and updating its underlying data source. It should not be used directly when the underlying persistent storage would be changed to any kind that does not support Java DataSource.
Author: Hugo Y. K. Lam
Methods¶
find¶
-
public SimpleDSDVO
find
(Object[] keys)¶ Retrieves data from the data source by searching with the specified key values.
Parameters: - keys – the key values for querying the data source. The number, format, and sequence of the parameter values should match the key finder statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a SimpleDSDVO found by the specified key values. If there are more than one DVO found, the first one will be returned. null will be returned if nothing was found.
find¶
-
public List
find
(String finder, Object[] paras)¶ Retrieves data from the data source as a List of DVO by searching with the specified data values.
Parameters: - finder – the name of the finder SQL statement.
- paras – the parameter values used by the specified finder statement. The number, format, and sequence of the parameter values should match the statement. null if there is no parameter for the statement.
Throws: - DAOException – if errors found when retrieving data from the data source.
Returns: a List of SimpleDSDVO found by the specified data values. An empty List will be returned if there is no matching data.
update¶
-
public int
update
(String sqlname, Object[] paras)¶ Update the data source with the specified data values.
Parameters: - sqlname – the name of the SQL statement to be used.
- paras – the data values to be updated to the data source.
Throws: - DAOException – if errors found when updating data to the data source.
Returns: an integer indicating the update result. Same as the value returned by java.sql.Statement.executeUpdate().
SimpleDSDAOFactory¶
-
public class
SimpleDSDAOFactory
extends DataSourceDAOFactory¶ SimpleDSDAOFactory is a subclass of DataSourceDAOFactory and provides an implementation for accessing the data source by a simple DataSource object which is backed by the DriverManager and provides no pooling.
Notice that the DAO created by the createDAO() method shall be an instance of DataSourceDAO since this factory is a DataSourceDAOFactory.
Author: Hugo Y. K. Lam
Constructors¶
SimpleDSDVO¶
-
public class
SimpleDSDVO
extends DataSourceDVO¶ SimpleDSDVO is just a concrete subclass of DataSourceDVO. It should not be used directly when the underlying persistent storage would be changed to any kind that does not support Java DataSource.
Author: Hugo Y. K. Lam
hk.hku.cecid.piazza.commons.ejb¶
AbstractEntityBean¶
-
public class
AbstractEntityBean
implements EntityBean¶ The AbstractEntityBean class is an abstract class which implements the methods required for an Entity Bean, except the ejbCreateXXX() methods which have been defined in the home interface.
Author: Hugo Y. K. Lam
Fields¶
context¶
-
protected EntityContext
context
¶ The entity context.
Constructors¶
Methods¶
ejbActivate¶
-
public void
ejbActivate
()¶ A container invokes this method when the instance is taken out of the pool of available instances to become associated with a specific EJB object.
See also:
javax.ejb.EntityBean.ejbActivate()
ejbLoad¶
-
public void
ejbLoad
()¶ A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database.
See also:
javax.ejb.EntityBean.ejbLoad()
ejbPassivate¶
-
public void
ejbPassivate
()¶ A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object.
See also:
javax.ejb.EntityBean.ejbPassivate()
ejbRemove¶
-
public void
ejbRemove
()¶ A container invokes this method before it removes the EJB object that is currently associated with the instance.
See also:
javax.ejb.EntityBean.ejbRemove()
ejbStore¶
-
public void
ejbStore
()¶ See also:
javax.ejb.EntityBean.ejbStore()
setEntityContext¶
-
public void
setEntityContext
(EntityContext ctx)¶ Sets the associated entity context.
See also:
javax.ejb.EntityBean.setEntityContext(javax.ejb.EntityContext)
AbstractMessageDrivenBean¶
-
public abstract class
AbstractMessageDrivenBean
implements javax.ejb.MessageDrivenBean, javax.jms.MessageListener¶ The AbstractMessageDrivenBean class is an abstract class which implements the methods required for a Message Driven Bean, excepts the onMessage() method.
Author: Hugo Y. K. Lam
Fields¶
mdc¶
-
protected MessageDrivenContext
mdc
¶
Methods¶
ejbCreate¶
-
public void
ejbCreate
()¶ A container invokes this method before it begins the life of the message-driven object.
ejbRemove¶
-
public void
ejbRemove
()¶ A container invokes this method before it ends the life of the message-driven object.
setMessageDrivenContext¶
-
public void
setMessageDrivenContext
(MessageDrivenContext mdc)¶ Sets the associated message-driven context. The container calls this method after the instance creation.
Parameters: - mdc – A MessageDrivenContext interface for the instance.
AbstractSessionBean¶
-
public class
AbstractSessionBean
implements SessionBean¶ The AbstractSessionBean class is an abstract class which implements the methods required for a Session Bean, except the ejbCreate(...) methods and the business methods.
Author: Hugo Y. K. Lam
Fields¶
context¶
-
protected SessionContext
context
¶ The session context.
Constructors¶
Methods¶
ejbActivate¶
-
public void
ejbActivate
()¶ A container invokes this method when the instance is activated from its “passive” state.
See also:
javax.ejb.SessionBean.ejbActivate()
ejbCreate¶
-
public void
ejbCreate
()¶ A container invokes this method when the instance is created. This is a default and mandatory creator in a stateless session bean.
See also:
javax.ejb.SessionBean.ejbActivate()
ejbPassivate¶
-
public void
ejbPassivate
()¶ A container invokes this method before the instance enters the “passive” state.
See also:
javax.ejb.SessionBean.ejbPassivate()
ejbRemove¶
-
public void
ejbRemove
()¶ A container invokes this method before it ends the life of the session object.
See also:
javax.ejb.SessionBean.ejbRemove()
setSessionContext¶
-
public void
setSessionContext
(SessionContext ctx)¶ Set the associated session context.
See also:
javax.ejb.SessionBean.setSessionContext(javax.ejb.SessionContext)
EjbConnection¶
-
public class
EjbConnection
¶ An EjbConnection represents a connection to the initial context by which the specified EJBHome can be looked up. The URL connection string for an EJBConnection should comply the following format: PROVIDER_URL@INITIAL_CONTEXT_FACTORY {@SECURITY_PROTOCOL}
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
close¶
-
public synchronized void
close
()¶ Closes this connection and releases any resources associated.
Throws: - EjbConnectionException – if errors occurred during closing the connection or, the connection has not yet been connected or has been closed already.
connect¶
-
public synchronized void
connect
()¶ Connects to the destination URL using the username and password stored in this connection.
Throws: - EjbConnectionException – if errors occurred during the establishment of connection.
connect¶
-
public synchronized void
connect
(String username, String password)¶ Connects to the destination URL using the specified username and password.
Parameters: - username – the username used to connect. null if authentication is not required.
- password – the password used to connect. null if authentication is not required.
Throws: - EjbConnectionException – if errors occurred during the establishment of connection or, the connection has been connected or closed already.
finalize¶
-
protected void
finalize
()¶ Closes this connection in finalization.
See also:
java.lang.Object.finalize()
getUrl¶
getUsername¶
lookupHome¶
-
public Object
lookupHome
(String jndiName, Class narrowTo)¶ Retrieves the EJBHome by looking it up using the specified JNDI name. The EJBHome will be narrowed to the specified class if it is a remote interface.
Parameters: - jndiName – the JNDI name for the EJBHome to be looked up.
- narrowTo – the class to which the EJBHome should be narrowed.
Throws: - EjbConnectionException – if there is a naming or narrowing error.
- NullPointerException – if
narrowTo is null.
Returns: the EJBHome bound to the specified JNDI name.
toString¶
-
public String
toString
()¶ Returns a string representation of this object, which is the URL.
See also:
java.lang.Object.toString()
EjbConnectionException¶
EjbConnectionFactory¶
-
public final class
EjbConnectionFactory
¶ EjbConnectionFactory is a concrete factory class for creating EjbConnection by using a pre-defined set of properties.
Author: Hugo Y. K. Lam
Methods¶
configure¶
-
public static void
configure
(URL url)¶ Configures the EjbConnectionFactory from the configuration located by the specifed URL. Expected to be called before any other methods are called.
Parameters: - url – The URL of the configuration file.
Throws: - EjbConnectionException – if any errors in configuring the EjbConnectionFactory.
createConnection¶
-
public static EjbConnection
createConnection
()¶ Creates a new EjbConnection. The url, username and password will be retrieved from the default properties.
Returns: a new EjbConnection.
createConnection¶
-
public static EjbConnection
createConnection
(String url)¶ Creates a new EjbConnection. The username and password will be retrieved from the default properties.
Parameters: - url – the URL for this connection.
Returns: a new EjbConnection.
createConnection¶
-
public static EjbConnection
createConnection
(String url, String username, String password)¶ Creates a new EjbConnection.
Parameters: - url – the URL for this connection.
- username – the username for authentication.
- password – the password for authentication.
Returns: a new EjbConnection.
hk.hku.cecid.piazza.commons.ejb.util¶
RemoteCommand¶
-
public interface
RemoteCommand
extends javax.ejb.EJBObject¶ RemoteCommand is the remote interface of RemoteCommandBean. It can execute a remote command with the given parameters.
Author: Hugo Y. K. Lam See also:
RemoteCommandBean
,RemoteCommandHandler
Methods¶
execute¶
-
public Object
execute
(String cmdName, Object[] parameters)¶ Executes a registered command with the given parameters.
Parameters: - cmdName – the command name.
- parameters – parameters for the target method invocation.
Throws: - java.rmi.RemoteException – if there is a remote exception occurred.
- InstanceException – if the instance of the target class cannot be created or the method could not be invoked.
- InvocationTargetException – if the invoked method has thrown an exception.
- NullPointerException – if the command is not registered.
Returns: the object returned by the invoked method.
RemoteCommandBean¶
-
public class
RemoteCommandBean
extends AbstractSessionBean¶ RemoteCommandBean is the session bean class of RemoteCommand. It can execute a registered command with the given parameters.
Author: Hugo Y. K. Lam See also:
RemoteCommand
,RemoteCommandHandler
Methods¶
execute¶
-
public Object
execute
(String cmdName, Object[] parameters)¶ Executes a registered command with the given parameters.
Parameters: - cmdName – the command name.
- parameters – parameters for the target method invocation.
Throws: - InstanceException – if the instance of the target class cannot be created or the method could not be invoked.
- InvocationTargetException – if the invoked method has thrown an exception.
- NullPointerException – if the command is not registered.
Returns: the object returned by the invoked method.
RemoteCommandHandler¶
-
public final class
RemoteCommandHandler
¶ RemoteCommandHandler is a handler class for invoking the RemoteCommand bean. It invokes the bean by using the command name and parameters specified by the caller. The given command must be registered beforehand on both side with a set of command properties in Java properties format:
Key Value url The connection URL (see EjbConnection) username The username for the connection password The password for the connection class The class name/object to be excuted method The method of the class to be excuted parameters The parameter types, separated by comma, of the method to be excuted If it fails to invoke the bean, it will invoke the target class locally.
Author: Hugo Y. K. Lam See also:
RemoteCommandBean
,EjbConnection
Methods¶
execute¶
-
public static Object
execute
(String cmdName, Object[] parameters)¶ Executes a registered command with the given parameters.
Parameters: - cmdName – the command name.
- parameters – parameters for the target method invocation.
Throws: - RemoteException – if there is a remote exception occurred.
- InstanceException – if the instance of the target class cannot be created or the method could not be invoked.
- InvocationTargetException – if the invoked method has thrown an exception.
- NullPointerException – if the command is not registered.
Returns: the object returned by the invoked method.
executeLocal¶
-
static Object
executeLocal
(String cmdName, Object[] parameters)¶ Executes a registered command locally with the given parameters.
Parameters: - cmdName – the command name.
- parameters – parameters for the target method invocation.
Throws: - InstanceException – if the instance of the target class cannot be created or the method could not be invoked.
- InvocationTargetException – if the invoked method has thrown an exception.
- NullPointerException – if the command is not registered.
Returns: the object returned by the invoked method.
getCommand¶
-
public static Properties
getCommand
(String name)¶ Gets the command properties by its name.
Parameters: - name – the command name.
Throws: - NullPointerException – if the command is not registered.
Returns: the command properties.
getCommandNames¶
-
public static Enumeration
getCommandNames
()¶ Gets the names of the regsitered commands.
Returns: the names of the regsitered commands.
register¶
-
public static void
register
(String cmdName, Properties command)¶ Register a command to this handler.
Parameters: - cmdName – the command name.
- command – the command properties.
RemoteCommandHome¶
-
public interface
RemoteCommandHome
extends javax.ejb.EJBHome¶ RemoteCommandHome is the home interface of RemoteCommand.
Author: Hugo Y. K. Lam See also:
RemoteCommand
Methods¶
create¶
-
public RemoteCommand
create
()¶ Creates a remote instance of RemoteCommand.
Throws: - javax.ejb.CreateException – if the remote instance could not be created.
- java.rmi.RemoteException – if there is a remote exception occurred.
Returns: a RemoteCommand remote instance.
hk.hku.cecid.piazza.commons.io¶
FileSystem¶
-
public class
FileSystem
¶ FileSystem encapsulates a root directory and provides accessors for querying and modifying this root.
Author: Hugo Y. K. Lam
Fields¶
Constructors¶
Methods¶
exists¶
-
public boolean
exists
()¶ Checks if the root of this file system exists.
Returns: true if the root of this file system exists.
getDirectories¶
-
public Collection
getDirectories
(boolean isRecursive)¶ Retrieves a collection of directory-only File objects from the root of this file system.
Parameters: - isRecursive – true if the search should be recursive.
Returns: a collection of File objects resulted from the search.
getDirectories¶
-
public Collection
getDirectories
(boolean isRecursive, String pattern)¶ Retrieves a collection of directory-only File objects from the root of this file system.
Parameters: - isRecursive – true if the search should be recursive.
- pattern – the filename’s pattern for filtering the result. null if no filtering should be applied.
Returns: a collection of File objects resulted from the search.
getFiles¶
-
public Collection
getFiles
(boolean isRecursive)¶ Retrieves a collection of file-only File objects from the root of this file system.
Parameters: - isRecursive – true if the search should be recursive.
Returns: a collection of File objects resulted from the search.
getFiles¶
-
public Collection
getFiles
(boolean isRecursive, String pattern)¶ Retrieves a collection of file-only File objects from the root of this file system.
Parameters: - isRecursive – true if the search should be recursive.
- pattern – the filename’s pattern for filtering the result. null if no filtering should be applied.
Returns: a collection of File objects resulted from the search.
getFiles¶
-
public Collection
getFiles
(boolean isRecursive, int type, String pattern)¶ Retrieves a collection of File objects from the root of this file system.
Parameters: - isRecursive – true if the search should be recursive.
- type – the file type to be searched.
- pattern – the filename’s pattern for filtering the result. null if no filtering should be applied.
Returns: a collection of File objects resulted from the search.
getFiles¶
-
public Collection
getFiles
(Collection c, boolean isRecursive, int type, String pattern)¶ Retrieves a collection of File objects from the root of this file system.
Parameters: - c – the collection into which the result will be stored.
- isRecursive – true if the search should be recursive.
- type – the file type to be searched.
- pattern – the filename’s pattern for filtering the result. null if no filtering should be applied.
Returns: a collection of File objects resulted from the search.
getRoot¶
purge¶
-
public void
purge
()¶ Removes the files, including the directories, under the root directory of this file system recursively. If there are files that cannot be removed immediately, the files will be deleted on exit. This method will also remove the root directory itself.
purge¶
-
public void
purge
(boolean isSelfRemoved)¶ Removes the files, including the directories, under the root directory of this file system recursively. If there are files that cannot be removed immediately, the files will be deleted on exit.
Parameters: - isSelfRemoved – true if the root directory itself should be removed.
remove¶
-
public boolean
remove
()¶ Removes the files, including the directories, under the root directory of this file system recursively. The operation ceases when it encounters any error in removing any file. If the operation is successful, the root directory itself will be removed as well.
Returns: true if and only if all the files are removed successfully.
remove¶
-
public boolean
remove
(boolean isSelfRemoved)¶ Removes the files, including the directories, under the root of this file system recursively. The operation ceases when it encounters any error in removing any file.
Parameters: - isSelfRemoved – true if the root directory itself should be removed.
Returns: true if and only if all the files are removed successfully.
toString¶
-
public String
toString
()¶ Returns the absolute path of the root of this file system.
Returns: the absolute path of the root of this file system. See also:
java.lang.Object.toString()
IOHandler¶
-
public final class
IOHandler
¶ IOHandler provides some convenient methods for handling some basic input and output funtions.
Author: Hugo Y. K. Lam
Methods¶
merge¶
-
public static InputStream
merge
(InputStream ins1, InputStream ins2)¶ Merges the given input streams into one input stream.
Parameters: - ins1 – the first input stream to be merged.
- ins2 – the second input stream to be merged.
Returns: the merged input stream.
pipe¶
-
public static void
pipe
(InputStream ins, OutputStream out)¶ Pipes an input stream to an output stream.
Parameters: - ins – the input stream to be read.
- out – the output stream to be written.
Throws: - IOException – if there is IO error occurred during the operation.
pipe¶
readBytes¶
-
public static byte[]
readBytes
(InputStream ins)¶ Reads an array of bytes from an input stream.
Parameters: - ins – the input stream to be read.
Throws: - IOException – if there is IO error occurred during the operation.
Returns: an array of bytes read from the specified input stream.
readBytes¶
-
public static byte[]
readBytes
(Reader reader, Charset charset)¶ Reads an array of bytes from a reader.
Parameters: - reader – the reader to be read.
- charset – the charset used to convert the characters.
Throws: - IOException – if there is IO error occurred during the operation.
Returns: an array of bytes read from the specified reader.
readString¶
-
public static String
readString
(InputStream ins, Charset charset)¶ Reads a string from an input stream.
Parameters: - ins – the input stream to be read.
- charset – the charset used to convert the bytes.
Throws: - IOException – if there is IO error occurred during the operation.
Returns: a string read from the specified input stream.
readString¶
writeBytes¶
-
public static void
writeBytes
(byte[] bytes, OutputStream out)¶ Writes an array of bytes to an output stream.
Parameters: - bytes – an array of bytes to write.
- out – the output stream to be written.
Throws: - IOException – if there is IO error occurred during the operation.
writeBytes¶
-
public static void
writeBytes
(byte[] bytes, Writer writer, Charset charset)¶ Writes an array of bytes to a writer.
Parameters: - bytes – an array of bytes to write.
- writer – to writer to be written.
- charset – the charset used to convert the bytes.
Throws: - IOException – if there is IO error occurred during the operation.
writeString¶
-
public static void
writeString
(String s, OutputStream out, Charset charset)¶ Writes a string to an output stream.
Parameters: - s – the string to write.
- out – the output stream to be written.
- charset – the charset used to convert the characters.
Throws: - IOException – if there is IO error occurred during the operation.
MergedInputStream¶
-
public class
MergedInputStream
extends InputStream¶ MergedInputStream is an input stream which can merge two input streams into one. When the read() method is called, the first input stream will be read at first. However, if it has already reached the end, the second input stream will be read.
Author: Hugo Y. K. Lam
Constructors¶
MergedInputStream¶
-
public
MergedInputStream
(InputStream ins1, InputStream ins2)¶ Creates a new instance of MergedInputStream.
Parameters: - ins1 – the first input stream to be merged.
- ins2 – the second input stream to be merged.
Methods¶
read¶
-
public int
read
()¶ Reads the first input stream and if it has reached the end, reads the second input stream. After this input stream has positioned to the second input stream, it will never come back to the first one.
See also:
java.io.InputStream.read()
NIOHandler¶
-
public class
NIOHandler
¶ NIOHandler provides some convenient methods for handling some basic input and output funtions which has adopted the features of java NIO package. Creation Date: 5/10/2006
Author: Twinsen See also:
hk.hku.cecid.piazza.commons.io.IOHandler
,java.nio.ByteBuffer
,java.nio.MappedByteBuffer
,java.nio.channels.Channels
Fields¶
Methods¶
pipe¶
-
public static void
pipe
(FileInputStream fins, OutputStream out)¶ Pipes an file input stream to an output stream.
Parameters: - fins – the file input stream to be read.
- out – the output stream to be written.
Throws: - IOException – if there is IO error occurred during the operation.
pipe¶
-
public static void
pipe
(FileInputStream fins, OutputStream out, int startPosition, long size)¶ Pipes an file input stream to an output stream.
Parameters: - fins – the file input stream to be read.
- out – the output stream to be written.
Throws: - IOException – if there is IO error occurred during the operation.
pipe¶
-
public static void
pipe
(InputStream ins, OutputStream out)¶ Pipes an input stream to an output stream.
Parameters: - ins – the input stream to be read.
- out – the output stream to be written.
Throws: - IOException – if there is IO error occurred during the operation.
readByteBuffer¶
-
public static ByteBuffer
readByteBuffer
(InputStream ins)¶ Reads an array of bytes from an input stream.
Parameters: - ins – the input stream to be read.
Throws: - IOException – if there is IO error occurred during the operation.
Returns: a bytes buffer read from the specified input stream.
readBytes¶
-
public static byte[]
readBytes
(InputStream ins)¶ Reads an array of bytes from an input stream.
Parameters: - ins – the input stream to be read.
Throws: - IOException – if there is IO error occurred during the operation.
Returns: an array of bytes read from the specified input stream.
writeBytes¶
-
public static void
writeBytes
(byte[] bytes, OutputStream out)¶ Writes an array of bytes to an output stream.
Parameters: - bytes – an array of bytes to write.
- out – the output stream to be written.
Throws: - IOException – if there is IO error occurred during the operation.
writeBytes¶
-
public static void
writeBytes
(ByteBuffer src, OutputStream out)¶ Writes a byte buffer to an output stream.
Parameters: - src – a byte buffer to write.
- out – the output stream to be written.
Throws: - IOException – if there is IO error occurred during the operation.
hk.hku.cecid.piazza.commons.mail¶
SmtpMail¶
-
public class
SmtpMail
¶ A class that handles sending SMTP messages.
Author: Administrator
Constructors¶
SmtpMail¶
-
public
SmtpMail
(boolean useSSL)¶ Create a new SmtpMail instance.
Parameters: - useSSL –
Throws: - SmtpMailException –
SmtpMail¶
-
public
SmtpMail
(SmtpMailProperties sprops, boolean useSSL)¶ Create a new SmtpMail instance with the given SmtpMailProperties object.
Parameters: - sprops –
- useSSL –
Throws: - SmtpMailException –
Methods¶
isConnected¶
-
public boolean
isConnected
()¶ Checks whether the transport associated with this instance is connected.
Returns: boolean
send¶
send¶
transportClose¶
-
public void
transportClose
()¶ Attempts to close the transport connection. If the transport is not connected, will not do anything.
Throws:
hk.hku.cecid.piazza.commons.module¶
ActiveModule¶
-
public abstract class
ActiveModule
extends Module implements Runnable¶ ActiveModule is a runnable module which runs as a separated thread after started. Subclasses are expected to implement the run() method in the Runnable interface.
Author: Hugo Y. K. Lam
Constructors¶
ActiveModule¶
ActiveModule¶
-
public
ActiveModule
(String descriptorLocation, boolean shouldInitialize)¶ Creates a new instance of ActiveModule.
Parameters: - descriptorLocation – the module descriptor.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
ActiveModule¶
-
public
ActiveModule
(String descriptorLocation, ClassLoader loader)¶ Creates a new instance of ActiveModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
ActiveModule¶
-
public
ActiveModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of ActiveModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Methods¶
execute¶
-
public abstract boolean
execute
()¶ Invoked by the run() method to execute this module’s job.
Returns: true if this method should be invoked again after a defined interval.
getThread¶
init¶
-
public void
init
()¶ Initializes this module by the following module parameters:
- group-execution: all - started and stopped by its group; start - only started by its group; stop - only stopped by its group; none - not started or stopped by its group.
- execution-interval: the interval (milliseconds) that this module should wait until the next execution. A negative number indicates a one-time execution.
- stop-timeout: the maximum time (milliseconds) to wait for stopping this module.
isGroupStart¶
-
public boolean
isGroupStart
()¶ Checks if this module should be started by its group, if any.
Returns: true if this module should be started by its group.
isGroupStop¶
-
public boolean
isGroupStop
()¶ Checks if this module should be stopped by its group, if any.
Returns: true if this module should be stopped by its group.
run¶
-
public void
run
()¶ Invoked by the start() method and will continuously call the execute() method to carry out the execution. This method should not be invoked directly.
See also:
.start()
,.execute()
,java.lang.Runnable.run()
setExecutionInterval¶
-
public void
setExecutionInterval
(long newInterval)¶ Set the execution interval in the module.
start¶
-
public synchronized void
start
()¶ Starts this module. This method will invoke onStart() before starting its own thread.
See also:
java.lang.Thread.start()
,.onStart()
ActiveMonitor¶
-
public class
ActiveMonitor
¶ ActiveMonitor is a thread monitor of active threads.
Author: Hugo Y. K. Lam See also:
ActiveThread
Methods¶
acquireThread¶
-
public synchronized ActiveThread
acquireThread
()¶ Acquires a new active thread. This method will block if the maximum number of threads has been reached.
Returns: a new active thread or null if the monitor is suspended.
getMaxThreadCount¶
-
public int
getMaxThreadCount
()¶ Gets the maximum number of threads this monitor allows to acquire.
Returns: the maximum number.
getPeekThreadCount¶
-
public int
getPeekThreadCount
()¶ Gets the peek number of threads being acquired.
Returns: the peek number of threads being acquired.
getThreadCount¶
-
public int
getThreadCount
()¶ Gets the current number of threads being acquired.
Returns: the current number of threads being acquired.
releaseThread¶
-
public synchronized void
releaseThread
(ActiveThread thread)¶ Releases a previously acquired thread.
Parameters: - thread – the previously acquired thread.
ActiveTask¶
-
public interface
ActiveTask
¶ ActiveTask represents a task which can be executed under a separated thread.
Author: Hugo Y. K. Lam
Methods¶
execute¶
getMaxRetries¶
-
public int
getMaxRetries
()¶ Gets the maximum number of retries.
Returns: the maximum number of retries.
getRetryInterval¶
-
public long
getRetryInterval
()¶ Gets the retry interval in milliseconds.
Returns: the retry interval.
isRetryEnabled¶
-
public boolean
isRetryEnabled
()¶ Indicates if retry should be enabled.
Returns: true if retry should be enabled.
isSucceedFast¶
-
public boolean
isSucceedFast
()¶ Indicates if the task should succeed fast. false if this task should be retried depending solely on the indication of isRetryEnabled().
Returns: true if the task should succeed fast. See also:
.isRetryEnabled()
onFailure¶
ActiveTaskAdaptor¶
-
public class
ActiveTaskAdaptor
implements ActiveTask¶ A Active Task Adaptor is a dummy class for the interface active task. Creation Date: 24/10/2006.
Author: Twinsen Tsang
Methods¶
ActiveTaskList¶
-
public abstract class
ActiveTaskList
extends Component¶ ActiveTaskList is a module component which represents a collection of active tasks.
Author: Hugo Y. K. Lam See also:
ActiveTask
ActiveTaskModule¶
-
public class
ActiveTaskModule
extends ActiveModule¶ ActiveTaskModule is an active module which manages an active task list. As an active module, it runs as a separated thread and loops through the task list for executing the tasks. It also contains an active monitor responsible for monitoring and controlling the thread count.
Author: Hugo Y. K. Lam
Constructors¶
ActiveTaskModule¶
ActiveTaskModule¶
-
public
ActiveTaskModule
(String descriptorLocation, boolean shouldInitialize)¶ Creates a new instance of ActiveTaskModule.
Parameters: - descriptorLocation – the module descriptor.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – when errors encountered when loading the module descriptor.
ActiveTaskModule¶
-
public
ActiveTaskModule
(String descriptorLocation, ClassLoader loader)¶ Creates a new instance of ActiveTaskModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
Throws: - ModuleException – when errors encountered when loading the module descriptor.
ActiveTaskModule¶
-
public
ActiveTaskModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of ActiveTaskModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – when errors encountered when loading the module descriptor.
Methods¶
execute¶
-
public boolean
execute
()¶ Invoked by the start() method to start executing the managed task list and its tasks.
Returns: true if the active monitor of this module is not suspended. See also:
hk.hku.cecid.piazza.commons.module.ActiveModule.execute()
getMonitor¶
-
public ActiveMonitor
getMonitor
()¶ Gets the monitor of this module.
Returns: the monitor of this module.
init¶
-
public void
init
()¶ Initializes this module by loading the active task list component named “task-list”. The component may have the following parameters:
- max-thread-count: the maximum number of threads which can be acquired to execute the tasks in the task list. A number smaller than 1 indicates the tasks should be run under the same thread as this module.
- wait-for-list: true if the tasks in the task list should be completely executed before being refreshed.
onStart¶
-
public void
onStart
()¶ Resumes the active monitor so that new threads can be acquired for executing tasks.
See also:
hk.hku.cecid.piazza.commons.module.ActiveModule.start()
,hk.hku.cecid.piazza.commons.module.ActiveModule.onStart()
onStop¶
-
public void
onStop
()¶ Suspends the active monitor so that no more threads can be acquired for executing tasks.
See also:
hk.hku.cecid.piazza.commons.module.ActiveModule.stop()
,hk.hku.cecid.piazza.commons.module.ActiveModule.onStop()
ActiveThread¶
-
public class
ActiveThread
implements Runnable¶ ActiveThread is a thread which executes its associated task and manages the retry of the task. An active thread may or may not be managed by an active monitor.
Author: Hugo Y. K. Lam See also:
ActiveTask
,ActiveMonitor
Constructors¶
ActiveThread¶
-
public
ActiveThread
(ActiveMonitor monitor)¶ Creates a new instance of ActiveThread.
Parameters: - monitor – the active monitor from which this active thread is acquired.
Methods¶
getTask¶
-
public ActiveTask
getTask
()¶ Gets the active task of this thread.
Returns: the active task of this thread.
run¶
-
public void
run
()¶ Executes its associated task and manages the retry of the task.
See also:
java.lang.Runnable.run()
setTask¶
-
public void
setTask
(ActiveTask task)¶ Sets the active task of this thread.
Parameters: - task – the active task to be executed.
Component¶
-
public abstract class
Component
¶ Component represents a module component. Subclasses should override the init() method for their own initializations.
Author: Hugo Y. K. Lam See also:
Module
Methods¶
getModule¶
getName¶
getParameters¶
-
public Properties
getParameters
()¶ Gets the parameters of this component.
Returns: the parameters of this component.
init¶
setModule¶
setName¶
setParameters¶
-
protected void
setParameters
(Properties parameters)¶ Sets the parameters of this component.
Parameters: - parameters – the parameters of this component.
ComponentException¶
-
public class
ComponentException
extends GenericException¶ ComponentException represents an exception related to a component.
Author: Hugo Y. K. Lam
EventModule¶
Fields¶
Constructors¶
EventModule¶
-
public
EventModule
(String descriptorLocation, ClassLoader loader)¶
EventModule¶
-
public
EventModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶
LimitedActiveTaskList¶
-
public abstract class
LimitedActiveTaskList
extends ActiveTaskList¶ A limited active task list is a active task list that can be set it’s limit in the parameters list. But it has not effect on how big the active task list can return (no bound, only a limit value). Creation Date: 31/10/2006.
Author: Twinsen
Module¶
-
public class
Module
extends Component¶ A Module is described by a module descriptor and contains zero to many components. Each module has its own classloader for loading its components, which are defined in the module descriptor, and its resources.
Author: Hugo Y. K. Lam See also:
Component
Constructors¶
Module¶
Module¶
-
public
Module
(String descriptorLocation, boolean shouldInitialize)¶ Creates a new instance of Module.
Parameters: - descriptorLocation – the module descriptor.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Module¶
-
public
Module
(String descriptorLocation, ClassLoader loader)¶ Creates and initializes a new instance of Module.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Module¶
-
public
Module
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of Module.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Methods¶
createComponents¶
-
protected void
createComponents
()¶ Creates all the components defined in the module descriptor.
Throws: - ModuleException – if unable to create any component.
getClassLoader¶
-
public ClassLoader
getClassLoader
()¶ Gets the class loader that this module uses to load classes.
Returns: the class loader for this module.
getComponent¶
getComponentCount¶
-
public int
getComponentCount
()¶ Gets the number of components in this module.
Returns: the number of components in this module.
getComponents¶
-
public Collection
getComponents
()¶ Gets all the components in this module.
Returns: all module components
getDescriptor¶
getGroup¶
-
public ModuleGroup
getGroup
()¶ Gets the module group to which this module belongs.
Returns: the module group.
getLogger¶
getRequiredParameter¶
-
protected String
getRequiredParameter
(String key)¶ Get the mandatory parameter from the current module, throw ModuleException if not found.
Parameters: - key – the key in the parameters list.
Throws: - ModuleException – if the parameter with
key
does not exist.
Returns: The value of the parameter if found.
getResource¶
getResource¶
-
public static URL
getResource
(String name, ClassLoader loader)¶ Gets a resource as URL.
The specified name can be an absolute path or a relative path to the current directory or classpaths.
If the specified name is a relative path, it will be searched through the current directory and then the classpaths.
Parameters: - name – the name of the resource.
- loader – the class loader for finding the resource.
Returns: the URL of the resource.
getResourceAsStream¶
-
public InputStream
getResourceAsStream
(String name)¶ Gets a resource as stream.
Parameters: - name – the name of the resource.
Returns: an input stream of the resource.
See also:
.getResource(String)
getString¶
getVersion¶
init¶
-
public void
init
()¶ Initializes the module and all its components.
Throws: - ModuleException – if unable to initialize the module.
initComponents¶
-
protected void
initComponents
()¶ Initializes all the created components.
Throws: - ModuleException – if unable to initialize any component.
setComponent¶
setGroup¶
-
public void
setGroup
(ModuleGroup group)¶ Sets the module group to which this module belongs.
Parameters: - group – the module group.
toString¶
-
public String
toString
()¶ Returns a string representation of this module.
Returns: a string representation of this module. See also:
java.lang.Object.toString()
ModuleException¶
-
public class
ModuleException
extends RuntimeException¶ ModuleException represents a module’s runtime exception.
Author: Hugo Y. K. Lam
Methods¶
toString¶
-
public String
toString
()¶ Returns a string representation of this exception.
Returns: a string representation of this exception. See also:
java.lang.Object.toString()
ModuleGroup¶
-
public class
ModuleGroup
¶ ModuleGroup represents a group of modules and is capable of starting and stopping its active modules. A module group can have multiple system modules and the first one defined in the module group descriptor will be treated as the default system module.
Author: Hugo Y. K. Lam
Constructors¶
ModuleGroup¶
ModuleGroup¶
-
public
ModuleGroup
(String descriptorLocation, ClassLoader loader)¶ Creates a new instance of ModuleGroup.
Parameters: - descriptorLocation – the descriptor location.
- loader – the class loader for loading the modules.
Methods¶
addChild¶
-
public void
addChild
(ModuleGroup group)¶ Adds a child module group.
Parameters: - group – the child module group.
getChildren¶
-
public Collection
getChildren
()¶ Gets the child module groups.
Returns: the child module groups.
getModule¶
getModules¶
-
public Collection
getModules
()¶ Gets all modules in this module group.
Returns: all modules in this module group.
getName¶
getParent¶
-
public ModuleGroup
getParent
()¶ Gets the parent module group.
Returns: the parent module group.
getSystemModule¶
-
public SystemModule
getSystemModule
()¶ Gets the default system module.
Returns: the default system module or null if there is none.
removeChild¶
-
public void
removeChild
(ModuleGroup group)¶
setParent¶
-
public void
setParent
(ModuleGroup parent)¶ Sets the parent module group.
Parameters: - parent – the parent module group.
toString¶
-
public String
toString
()¶ Returns a string representation of this module group.
Returns: a string representation of this module group. See also:
java.lang.Object.toString()
PersistentComponent¶
-
public abstract class
PersistentComponent
extends Component¶ PersistentComponent represents a component that is persistent. Subclasses should override the loading(URL) and storing(URL) methods to provide their specific implementations.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
getURL¶
init¶
-
protected void
init
()¶ Initializes this component from the URL specified in the parameter ‘config’. The load() method will then be invoked to handle the loading of this component.
See also:
.load(URL)
,Component.init()
,Component.getParameters()
load¶
load¶
-
public void
load
()¶ Loads this component from the URL representing it.
Throws: - ComponentException – if unable to load this component from the URL.
See also:
.load(URL)
loading¶
store¶
store¶
-
public void
store
()¶ Stores this component to the URL representing it.
Throws: - ComponentException – if unable to store this component from the URL.
See also:
.store(URL)
PluginProcessor¶
-
public abstract class
PluginProcessor
implements PluginHandler¶
Methods¶
getDAOFactory¶
-
public DAOFactory
getDAOFactory
()¶
getModuleGroup¶
-
public ModuleGroup
getModuleGroup
()¶
getModuleGroupImpl¶
-
protected abstract ModuleGroup
getModuleGroupImpl
()¶
getProperties¶
-
public PropertySheet
getProperties
()¶
getSystemModule¶
-
public SystemModule
getSystemModule
()¶
processActivation¶
-
public void
processActivation
(Plugin plugin)¶ See also:
hk.hku.cecid.piazza.commons.spa.PluginHandler.processActivation(Plugin)
processDeactivation¶
-
public void
processDeactivation
(Plugin plugin)¶ See also:
hk.hku.cecid.piazza.commons.spa.PluginHandler.processDeactivation(Plugin)
setModuleGroup¶
-
public void
setModuleGroup
(ModuleGroup moduleGroup)¶
setModuleGroupImpl¶
-
protected abstract void
setModuleGroupImpl
(ModuleGroup moduleGroup)¶
SystemComponent¶
SystemModule¶
-
public class
SystemModule
extends Module¶ SystemModule is a module which contains some utility members which are common to a system.
Author: Hugo Y. K. Lam
Fields¶
dao¶
-
public final DAOFactory
dao
¶ The system DAO factory, having a component name ‘daofactory’.
properties¶
-
public final PropertySheet
properties
¶ The system properties, having a component name ‘properties’.
Constructors¶
SystemModule¶
SystemModule¶
-
public
SystemModule
(String descriptorLocation, boolean shouldInitialize)¶ Creates a new instance of SystemModule.
Parameters: - descriptorLocation – the module descriptor.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
SystemModule¶
-
public
SystemModule
(String descriptorLocation, ClassLoader loader)¶ Creates a new instance of SystemModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
SystemModule¶
-
public
SystemModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of SystemModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Methods¶
getLogger¶
-
public Logger
getLogger
()¶ See also:
hk.hku.cecid.piazza.commons.module.Module.getLogger()
hk.hku.cecid.piazza.commons.net¶
ConnectionException¶
-
public class
ConnectionException
extends hk.hku.cecid.piazza.commons.GenericException¶ ConnectionException represents all kinds of exception related to connectivity.
Author: Hugo Y. K. Lam
HttpConnector¶
-
public class
HttpConnector
¶ HttpConnector is a connector for making HTTP/S connections to an URL.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
addKeyManager¶
-
public void
addKeyManager
(KeyManager km)¶ Adds a key manager for SSL connection.
Parameters: - km – the key manager.
addTrustManager¶
-
public void
addTrustManager
(TrustManager tm)¶ Adds a trust manager for SSL connection.
Parameters: - tm – the trust manager.
createConnection¶
-
public HttpURLConnection
createConnection
()¶ Creates a new HTTP connection based on this connector’s properties.
Throws: - ConnectionException – if unable to create a new HTTP connection.
Returns: a new HTTP connection.
getHostnameVerifier¶
-
public HostnameVerifier
getHostnameVerifier
()¶ Gets the host verifier for SSL connection.
Returns: the host name verifier.
getRequestHeaders¶
getSSLSocketFactory¶
-
public SSLSocketFactory
getSSLSocketFactory
()¶ Gets the SSL socket factory which is used in SSL connection.
Throws: - ConnectionException – if unable to create SSL socket factory.
Returns: the SSL socket factory.
send¶
-
public InputStream
send
(InputStream request)¶ Sends an HTTP/S request using the given HTTP connection.
Parameters: - request – the HTTP request content or null for a simple get request.
Throws: - ConnectionException – if failed in sending the HTTP request or creating a new connection.
Returns: an input stream for reading the reply from the host.
send¶
-
public InputStream
send
(InputStream request, HttpURLConnection connection)¶ Sends an HTTP/S request using the given HTTP connection.
Parameters: - request – the HTTP request content or null for a simple get request.
- connection – the HTTP connection for sending the request.
Throws: - ConnectionException – if failed in sending the HTTP request.
Returns: an input stream for reading the reply from the host.
setHostnameVerifier¶
-
public void
setHostnameVerifier
(HostnameVerifier hostnameVerifier)¶ Sets a host name verifier for SSL connection.
Parameters: - hostnameVerifier – the host name verifier.
MailConnector¶
-
public abstract class
MailConnector
¶ MailConnector is an abstract connector for making connection to mail hosts. The configuration of mail connector is mainly through the standard java properties injection. You can always use either
addProperties(Properties)
orgetProperties()
to set or get the current configuration of this mail connector. For the detail of the properties key, read here 1.0.1 - Add help method for enabling black box debug mode throughsetDebug(boolean)
Author: Hugo Y. K. Lam,, Twinsen Tsang (modifers)
Methods¶
addProperties¶
-
public void
addProperties
(Properties properties)¶ Adds the given mail properties to the underlying mail properties used by this connector.
Parameters: - properties – the properties to be added.
addProperty¶
createSession¶
getHost¶
getProperties¶
-
public Properties
getProperties
()¶ Gets the underlying mail properties used by this connector.
Returns: the mail properties.
getProtocol¶
MailReceiver¶
-
public class
MailReceiver
extends MailConnector¶ MailReceiver is a mail connector for making connections to incoming mail servers.
Author: Hugo Y. K. Lam
Methods¶
connect¶
-
public synchronized void
connect
()¶ Connects to the incoming mail server.
Throws: - ConnectionException – if unable to connect to the incoming mail server or a connection to the server has already been established.
disconnect¶
-
public synchronized void
disconnect
()¶ Disconnects from the incoming mail server.
Throws: - ConnectionException – if unable to disconnect from the incoming mail server or the connection to the server has not been established.
openFolder¶
-
public synchronized Folder
openFolder
(String folderName)¶ Opens a specified folder for read-write access.
Parameters: - folderName – the name of the folder to be opened.
Throws: - ConnectionException – if unable to open the specified folder or the connection to the incoming mail server has not yet been established.
Returns: the opened folder.
openFolder¶
-
public synchronized Folder
openFolder
(String folderName, boolean readOnly)¶ Opens a specified folder.
Parameters: - folderName – the name of the folder to be opened.
- readOnly – true if the folder should be readonly.
Throws: - ConnectionException – if unable to open the specified folder or the connection to the incoming mail server has not yet been established.
Returns: the opened folder.
openInbox¶
-
public synchronized Folder
openInbox
()¶ Opens the inbox for read-write access.
Throws: - ConnectionException – if unable to open the inbox or the connection to the incoming mail server has not yet been established.
Returns: the opened inbox.
MailSender¶
-
public class
MailSender
extends MailConnector¶ MailSender is a mail connector for making connections to outgoing mail servers.
Author: Hugo Y. K. Lam
Methods¶
createMessage¶
-
public MimeMessage
createMessage
()¶ Creates a MIME message from the underlying mail properties.
Returns: a new MIME message.
createMessage¶
-
public MimeMessage
createMessage
(Session session)¶ Creates a MIME message from the given mail session.
Parameters: - session – the mail session.
Returns: a new MIME message.
createMessage¶
-
public MimeMessage
createMessage
(String from, String to, String cc, String subject)¶ Creates a simple MIME message with some basic headers.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
Throws: - ConnectionException – if error occurred in constructing the mail message.
Returns: a new MIME message.
createMessage¶
-
public MimeMessage
createMessage
(String from, String to, String cc, String subject, Session session)¶ Creates a simple MIME message with some basic headers.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
- session – the mail session.
Throws: - ConnectionException – if error occurred in constructing the mail message.
Returns: a new MIME message.
send¶
-
public void
send
(String from, String to, String cc, String subject, String body)¶ Sends a simple mail message.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
- body – the message content.
Throws: - ConnectionException – if unable to construct the mail message or to send out the message.
send¶
-
public void
send
(Message msg)¶ Sends a mail message.
Parameters: - msg – the mail message to be sent.
Throws: - ConnectionException – if unable to send the mail message
hk.hku.cecid.piazza.commons.os¶
OSCommander¶
-
public class
OSCommander
¶ The OS Manager provides interface for executing platform command console so that it can execute the console command through this interface. Creation Date: 04/05/2009
Author: Philip Wong
Fields¶
Constructors¶
OSCommander¶
-
public
OSCommander
(SystemComponent sys)¶
Methods¶
createDummyFile¶
execNoWaitAsInputStream¶
-
public BufferedInputStream
execNoWaitAsInputStream
(String... args)¶
execNoWaitAsInputStream¶
-
public BufferedInputStream
execNoWaitAsInputStream
(File dir, String... args)¶
execNoWaitAsReader¶
-
public BufferedReader
execNoWaitAsReader
(String... args)¶
execNoWaitAsReader¶
-
public BufferedReader
execNoWaitAsReader
(File dir, String... args)¶
execWaitAsOutputStream¶
-
public void
execWaitAsOutputStream
(OutputStream os, String... args)¶
execWaitAsOutputStream¶
-
public void
execWaitAsOutputStream
(OutputStream os, File dir, String... args)¶
writeTo¶
-
public void
writeTo
(InputStream is, OutputStream os)¶
OSManager¶
-
public class
OSManager
extends SystemComponent¶ The OSManager acts as a bridge between OSCommander and Piazza Commons framework. It provides convenient way for components to execute system command. Creation Date: 04/05/2009
Author: Philip Wong
Fields¶
osCommander¶
-
protected OSCommander
osCommander
¶
hk.hku.cecid.piazza.commons.pagelet¶
HttpPageletAdaptor¶
-
public abstract class
HttpPageletAdaptor
extends HttpRequestAdaptor¶ HttpPageletAdaptor is an HTTP request adaptor which generates a page from a template pagelet. A template pagelet may contain the content, or part of the content, of the page to be generated. It also describes the layout of other pagelets in the page.
The tag in the template which declares a pagelet should follow the convention stated below:
<!-- template-[pagelet-id] -->
By default, there are two generation modes of the page.
- full - Generate the page according to the template pre-defined by this adaptor. This is the default generation mode.
- raw - Generate the page according to the dynamically specified pagelet.
Note: All the pagelets, including the template, must be saved in UTF-8 encoding.
Author: Hugo Y. K. Lam See also:
Pagelet
,PageletStore
,Template
Methods¶
getErrorPagelet¶
-
protected Pagelet
getErrorPagelet
(HttpServletRequest request)¶ Gets the error pagelet. This method invokes getPagelet() with a parameter “&pagelet-error”.
Parameters: - request – the servlet request.
Returns: the template pagelet.
getPagelet¶
-
protected Pagelet
getPagelet
(String id)¶ Gets the pagelet from the underlying pagelet store. If the specified ID is preceded by an ampersand, it indicates the pagelet id should be firstly treated as a listener parameter name which has a value of the target pagelet ID. In this case, if there is a corresponding listener parameter, its value will be used as the target pagelet ID. Otherwise, the specified id will be matched against the underlying pagelet store as if there is no ampersand indicator.
Parameters: - id – the pagelet ID.
Returns: the corresponding pagelet or null if not found.
getPageletStore¶
-
protected abstract PageletStore
getPageletStore
()¶ Gets the pagelet store which holds all the registered pagelets of this adaptor.
Returns: a pagelet store.
getTemplate¶
-
protected Pagelet
getTemplate
(HttpServletRequest request)¶ Gets the template pagelet. This method invokes getPagelet() with a parameter “&pagelet-template”.
Parameters: - request – the servlet request.
Returns: the template pagelet.
processError¶
-
protected void
processError
(TemplateElement element, Throwable error, HttpServletRequest request, HttpServletResponse response)¶ Processes the error generated when processing a pagelet.
Parameters: - element – the template element which represents the pagelet.
- error – the error generated by the pagelet process.
- request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if unable to process the pagelet error.
See also:
.processTemplate(HttpServletRequest,HttpServletResponse)
processPagelet¶
-
protected void
processPagelet
(TemplateElement element, Pagelet pagelet, HttpServletRequest request, HttpServletResponse response)¶ Processes the pagelet of the generating page by reading the content from the pagelet and generates it to the output.
Parameters: - element – the template element which represents the pagelet.
- pagelet – the pagelet to be processed.
- request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if unable to process the pagelet.
See also:
.processTemplate(HttpServletRequest,HttpServletResponse)
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ Processes the page request. This method determines if the generation mode is “raw”. If not, it invokes processTemplate() to complete the rest of the generation.
See also:
.processTemplate(HttpServletRequest,HttpServletResponse)
,hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.processRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
processTemplate¶
-
protected void
processTemplate
(HttpServletRequest request, HttpServletResponse response)¶ Processes the template of the generating page. This method invokes getTemplate() to retrieve the template pagelet. It then generates the page according to the pagelet. The content of the template pagelet will be parsed according to the following alogirthm:
- When it encounters any text other than a template tag, it invokes processText() to generate the content.
- When it encounters a template tag in the template, it invokes processPagelet() to generate the content.
- When it encounters any errors while invoking processPagelet(), it will invokes processError() to generate the content.
Parameters: - request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if unable to process the template.
See also:
.getTemplate(HttpServletRequest)
,.processText(TemplateElement,String,HttpServletRequest,HttpServletResponse)
,.processPagelet(TemplateElement,Pagelet,HttpServletRequest,HttpServletResponse)
,.processError(TemplateElement,Throwable,HttpServletRequest,HttpServletResponse)
processText¶
-
protected void
processText
(TemplateElement element, String text, HttpServletRequest request, HttpServletResponse response)¶ Processes the text part of the generating page by simply generating the text to the output.
Parameters: - element – the template element which represents the text.
- text – the text to be processed.
- request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if unable to process the text.
See also:
.processTemplate(HttpServletRequest,HttpServletResponse)
Pagelet¶
-
public class
Pagelet
¶ A Pagelet contains a URL representing a page or a fragment of a page. By default, it caches the content of the pagelet softly. Therefore, each invocation of openStream() may or may not cause an actual access to the pagelet URL, depending on the memory status and whether caching is enabled.
Author: Hugo Y. K. Lam See also:
PageletStore
Constructors¶
Methods¶
isCacheEnabled¶
-
public boolean
isCacheEnabled
()¶ Checks if caching is enabled.
Returns: true if caching is enabled.
openStream¶
-
public InputStream
openStream
()¶ Opens an input stream for reading the content of the pagelet.
Throws: - IOException – if unable to create a new input stream.
Returns: the input stream of the pagelet.
setCacheEnabled¶
-
public void
setCacheEnabled
(boolean isCacheEnabled)¶ Sets whether caching should be enabled.
Parameters: - isCacheEnabled – true if caching should be enabled.
toString¶
-
public String
toString
()¶ Returns a string representation of this pagelet.
Returns: a string representation of this pagelet. See also:
java.lang.Object.toString()
PageletStore¶
Template¶
-
public class
Template
¶ A Template is a parser which tokenizes a given template into a list of template elements. There are two types of template elements:
- Text
- Template Tag
Hence, a template is composed of a mixture of text and template tags. A template tag is recognized by the following pattern in the content:
<!--[\\s]*template-((.*?))[\\s]*-->
Author: Hugo Y. K. Lam See also:
TemplateElement
Constructors¶
Methods¶
hasMoreElements¶
-
public boolean
hasMoreElements
()¶ Checks if there are anymore elements in this template. This method will always return false if this template is not yet parsed. More, each invocation of nextElement() may also affect the result of this method.
Returns: true if there are more elements in this template. See also:
.nextElement()
nextElement¶
-
public TemplateElement
nextElement
()¶ Gets the next template element. This method will always return null if this template is not yet parsed.
Returns: the next template element.
toString¶
-
public String
toString
()¶ Returns a string representation of this template. This method simply returns the original template content.
Returns: a string representation of this template. See also:
java.lang.Object.toString()
TemplateElement¶
-
public class
TemplateElement
¶ A TemplateElement represents a composing element of a template. There are two types of template elements:
- Text
- Template Tag
Author: Hugo Y. K. Lam See also:
Template
Methods¶
getName¶
getText¶
isText¶
-
public boolean
isText
()¶ Checks if this element is a text element.
Returns: true if this element is a text element.
toString¶
-
public String
toString
()¶ Returns a string representation of this element.
Returns: the text of this element if it is a text element or the element name otherwise. See also:
java.lang.Object.toString()
hk.hku.cecid.piazza.commons.pagelet.xslt¶
BorderLayoutPageletAdaptor¶
-
public abstract class
BorderLayoutPageletAdaptor
extends HttpXsltPageletAdaptor¶ BorderLayoutPageletAdaptor is an HTTP-XSLT pagelet adaptor which supports a border layout of pagelets.
A border layout can be divided into five regions:
- north
- east
- west
- south
- center
Each region maps to a pagelet which has an ID same as the region’s name.
Author: Hugo Y. K. Lam
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶ Gets the transformation source for the center region.
Parameters: - request – the servlet request.
Returns: the transformation source or null by default.
getEastSource¶
-
protected Source
getEastSource
(HttpServletRequest request)¶ Gets the transformation source for the east region.
Parameters: - request – the servlet request.
Returns: the transformation source or null by default.
getNorthSource¶
-
protected Source
getNorthSource
(HttpServletRequest request)¶ Gets the transformation source for the north region.
Parameters: - request – the servlet request.
Returns: the transformation source or null by default.
getPageletSource¶
-
protected Source
getPageletSource
(TemplateElement element, Pagelet pagelet, HttpServletRequest request)¶ Determines the border layout region that the given template element refers to and invokes the corresponding method for retrieving the transformation source.
See also:
.getNorthSource(HttpServletRequest)
,.getEastSource(HttpServletRequest)
,.getWestSource(HttpServletRequest)
,.getSouthSource(HttpServletRequest)
,hk.hku.cecid.piazza.commons.pagelet.xslt.HttpXsltPageletAdaptor.getPageletSource(hk.hku.cecid.piazza.commons.pagelet.TemplateElement,hk.hku.cecid.piazza.commons.pagelet.Pagelet,javax.servlet.http.HttpServletRequest)
getSouthSource¶
-
protected Source
getSouthSource
(HttpServletRequest request)¶ Gets the transformation source for the south region.
Parameters: - request – the servlet request.
Returns: the transformation source or null by default.
getWestSource¶
-
protected Source
getWestSource
(HttpServletRequest request)¶ Gets the transformation source for the west region.
Parameters: - request – the servlet request.
Returns: the transformation source or null by default.
HttpXsltPageletAdaptor¶
-
public abstract class
HttpXsltPageletAdaptor
extends HttpPageletAdaptor¶ HttpXsltPageletAdaptor is an HTTP pagelet adaptor which employs the XSLT technology for content rendering. It is basically same as the HTTP pagelet adpator except that all the involved pagelets, excluding the template, are XSL documents.
This pagelet adaptor supports an additional generation mode, “xml”, which suppresses the XSL transformation. If the generation mode is “xml”, no rendering will be done and the output will only be a trunk of consecutive XML sources.
Author: Hugo Y. K. Lam
Methods¶
getErrorSource¶
-
protected Source
getErrorSource
(TemplateElement element, Throwable error, HttpServletRequest request)¶ Gets the transformation source for the XSL error pagelet.
Parameters: - element – the template element which represents the pagelet.
- error – the error generated by the XSL pagelet process.
- request – the servlet request.
Throws: - RequestListenerException – if there was any error occurred when constructing the source.
Returns: the transformation source of the XSL error pagelet or null by default.
See also:
.processError(TemplateElement,Throwable,HttpServletRequest,HttpServletResponse)
getPageletSource¶
-
protected Source
getPageletSource
(TemplateElement element, Pagelet pagelet, HttpServletRequest request)¶ Gets the transformation source for the given XSL pagelet.
Parameters: - element – the template element which represents the pagelet.
- pagelet – the XSL pagelet.
- request – the servlet request.
Throws: - RequestListenerException – if there was any error occurred when constructing the source.
Returns: the transformation source of the given XSL pagelet or null by default.
See also:
.processPagelet(TemplateElement,Pagelet,HttpServletRequest,HttpServletResponse)
processError¶
-
protected void
processError
(TemplateElement element, Throwable exception, HttpServletRequest request, HttpServletResponse response)¶ Processes the error generated by the XSL pagelet. The transformation source for the XSL error pagelet will be retrieved by invoking the getErrorSource() method.
Throws: - RequestListenerException – if there was any error occurred when processing the XSL error pagelet.
See also:
.transform(Pagelet,Source,HttpServletRequest,HttpServletResponse)
,.getErrorSource(TemplateElement,Throwable,HttpServletRequest)
,hk.hku.cecid.piazza.commons.pagelet.HttpPageletAdaptor.processError(hk.hku.cecid.piazza.commons.pagelet.TemplateElement,java.lang.Throwable,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
processPagelet¶
-
protected void
processPagelet
(TemplateElement element, Pagelet pagelet, HttpServletRequest request, HttpServletResponse response)¶ Processes the XSL pagelet. The transformation source for the given XSL pagelet will be retrieved by invoking the getPageletSource() method.
Parameters: - pagelet – the XSL pagelet.
Throws: - RequestListenerException – if there was any error occurred when processing the XSL pagelet.
See also:
.transform(Pagelet,Source,HttpServletRequest,HttpServletResponse)
,.getPageletSource(TemplateElement,Pagelet,HttpServletRequest)
,hk.hku.cecid.piazza.commons.pagelet.HttpPageletAdaptor.processPagelet(hk.hku.cecid.piazza.commons.pagelet.TemplateElement,hk.hku.cecid.piazza.commons.pagelet.Pagelet,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
processText¶
-
protected void
processText
(TemplateElement element, String text, HttpServletRequest request, HttpServletResponse response)¶ Processes the text part of the generating page if the generation mode is not “xml”.
See also:
hk.hku.cecid.piazza.commons.pagelet.HttpPageletAdaptor.processText(hk.hku.cecid.piazza.commons.pagelet.TemplateElement,java.lang.String,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
transform¶
-
protected void
transform
(Pagelet xsl, Source source, HttpServletRequest request, HttpServletResponse response)¶ Transforms a given XML source using the specified XSL and writes the output to the response output stream.
Parameters: - xsl – the XSL for the transformation.
- source – the XML source.
- request – the servlet request.
- response – the servlet response.
Throws: - IOException – if an I/O exception occurs during openning the XSL stream.
- TransformerException – if an unrecoverable error occurs during the course of the transformation.
hk.hku.cecid.piazza.commons.rest¶
hk.hku.cecid.piazza.commons.security¶
KeyStoreComponent¶
-
abstract class
KeyStoreComponent
extends Component¶ KeyStoreComponent is a module component which embeds a key store.
Author: Hugo Y. K. Lam
Fields¶
Constructors¶
Methods¶
init¶
-
protected void
init
()¶ Initializes this key store component.
Component parameters:
- keystore-location: the key store location
- keystore-password: the key store password
- key-alias: the alias name
- key-password: the key password
- keystore-type: the key store type.
- keystore-provider: the key store provider
Throws: - KeyStoreManagementException – if unable to initialize the key store component.
See also:
.init(String,String,String,String,String,Object)
,hk.hku.cecid.piazza.commons.module.Component.init()
init¶
-
protected void
init
(KeyStore keyStore, String alias, String keyPass)¶ Initializes this key store component.
Parameters: - keyStore –
- alias – the alias name.
- keyPass – the key password.
Throws: - KeyStoreManagementException – if unable to initialize the key store component.
init¶
-
protected void
init
(String location, String storePass, String alias, String keyPass, String storeType, Object provider)¶ Initializes this key store component.
Parameters: - location – the key store location.
- storePass – the key store password.
- alias – the alias name.
- keyPass – the key password.
- storeType – the key store type.
- provider – the key store provider.
Throws: - KeyStoreManagementException – if unable to initialize the key store component.
KeyStoreKeyManager¶
-
public class
KeyStoreKeyManager
extends KeyStoreComponent implements X509KeyManager¶ KeyStoreKeyManager implements javax.net.ssl.X509KeyManager, which manages a given key store of X509 certificate-based key pairs and authenticates the local side of a secure socket.
Author: Hugo Y. K. Lam
Constructors¶
KeyStoreKeyManager¶
-
public
KeyStoreKeyManager
(KeyStoreManager keyman)¶ Creates a new instance of KeyStoreKeyManager.
Parameters: - keyman – the key store manager used for authentication.
Throws: - KeyStoreManagementException – if the specified key store manager is null.
KeyStoreKeyManager¶
-
public
KeyStoreKeyManager
(KeyStore keyStore, String alias, String password)¶ Creates a new instance of KeyStoreKeyManager.
Parameters: - keyStore – the initialized key store used for authentication.
- alias – the alias name associated with the key.
- password – the key password.
Throws: - KeyStoreManagementException – if the specified key store is null.
Methods¶
chooseClientAlias¶
-
public String
chooseClientAlias
(String[] keyType, Principal[] issuers, Socket socket)¶ Chooses an alias to authenticate the client side of a secure socket. This method always returns the predefined alias.
Parameters: - keyType – the key algorithm type name(s), ordered with the most-preferred key type first.
- issuers – the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.
- socket – the socket to be used for this connection or null.
Returns: the alias name.
chooseServerAlias¶
-
public String
chooseServerAlias
(String keyType, Principal[] issuers, Socket socket)¶ Chooses an alias to authenticate the server side of a secure socket. This method always returns the predefined alias.
Parameters: - keyType – the key algorithm type name.
- issuers – the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.
- socket – the socket to be used for this connection or null.
Returns: the alias name.
getCertificateChain¶
-
public X509Certificate[]
getCertificateChain
(String alias)¶ Gets the certificate chain associated with the given alias.
Parameters: - alias – the alias name.
Returns: the certificate chain.
See also:
javax.net.ssl.X509KeyManager.getCertificateChain(java.lang.String)
getClientAliases¶
-
public String[]
getClientAliases
(String keyType, Principal[] issuers)¶ Gets the aliases for authenticating the client side of a secure socket. This method always returns the predefined alias.
Parameters: - keyType – the key algorithm type name.
- issuers – the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.
Returns: the aliases for authenticating the client side of a secure socket.
See also:
javax.net.ssl.X509KeyManager.getClientAliases(java.lang.String,java.security.Principal[])
getPrivateKey¶
-
public PrivateKey
getPrivateKey
(String alias)¶ Gets the key associated with the given alias.
Parameters: - alias – the alias name.
Throws: - RuntimeException – if unable to retrieve the private key.
Returns: the private key.
See also:
javax.net.ssl.X509KeyManager.getPrivateKey(java.lang.String)
getServerAliases¶
-
public String[]
getServerAliases
(String keyType, Principal[] issuers)¶ Gets the aliases for authenticating the server side of a secure socket. This method always returns the predefined alias.
Parameters: - keyType – the key algorithm type name.
- issuers – the list of acceptable CA issuer subject names or null if it does not matter which issuers are used.
Returns: the aliases for authenticating the server side of a secure socket.
See also:
javax.net.ssl.X509KeyManager.getServerAliases(java.lang.String,java.security.Principal[])
KeyStoreManagementException¶
-
public class
KeyStoreManagementException
extends hk.hku.cecid.piazza.commons.GenericException¶ KeyStoreManagementException represents all kinds of exception related to KeyStoreManager.
Author: Hugo Y. K. Lam
KeyStoreManager¶
-
public class
KeyStoreManager
extends KeyStoreComponent¶ KeyStoreManager manages a key store and provides convenient methods such as method that retrieves an X509Certificate or retrieves a private key.
Author: Hugo Y. K. Lam
Constructors¶
KeyStoreManager¶
KeyStoreManager¶
-
public
KeyStoreManager
(KeyStore keyStore, String alias, String keyPass)¶ Creates a new instance of KeyStoreManager.
Parameters: - keyStore – the initialized keystore to be managed.
- alias – the alias name associating with the managed key.
- keyPass – the key password.
Throws: - KeyStoreManagementException – if the specified key store is null.
KeyStoreManager¶
KeyStoreManager¶
-
public
KeyStoreManager
(String location, String storePass, String alias, String keyPass)¶ Creates a new instance of KeyStoreManager.
Parameters: - location – the key store location.
- storePass – the key store password.
- alias – the alias name.
- keyPass – the key password.
Throws: - KeyStoreManagementException – if unable to initialize the key store with the given paramemeters.
KeyStoreManager¶
-
public
KeyStoreManager
(String location, String storePass, String storeType, Object provider)¶ Creates a new instance of KeyStoreManager.
Parameters: - location – the key store location.
- storePass – the key store password.
- storeType – the key store type.
- provider – the key store provider.
Throws: - KeyStoreManagementException – if unable to initialize the key store with the given paramemeters.
KeyStoreManager¶
-
public
KeyStoreManager
(String location, String storePass, String alias, String keyPass, String storeType, Object provider)¶ Creates a new instance of KeyStoreManager.
Parameters: - location – the key store location.
- storePass – the key store password.
- alias – the alias name.
- keyPass – the key password.
- storeType – the key store type.
- provider – the key store provider.
Throws: - KeyStoreManagementException – if unable to initialize the key store with the given paramemeters.
Methods¶
getAliases¶
getCertificate¶
-
public Certificate
getCertificate
()¶ Gets the managed certificate.
Returns: the managed certificate.
getCertificate¶
-
public Certificate
getCertificate
(String alias)¶ Gets the certificate asscoiated with the given alias name.
Parameters: - alias – the alias name.
Returns: the certificate.
getCertificateChain¶
-
public Certificate[]
getCertificateChain
()¶ Gets the managed certificate chain.
Returns: the managed certificate chain.
getCertificateChain¶
-
public Certificate[]
getCertificateChain
(String alias)¶ Gets the certificate chain asscoiated with the given alias name.
Parameters: - alias – the alias name.
Returns: the certificate chain.
getPrivateKey¶
-
public PrivateKey
getPrivateKey
()¶ Gets the managed private key.
Throws: - NoSuchAlgorithmException – if the algorithm for recovering the key cannot be found.
- UnrecoverableKeyException – if the key cannot be recovered (e.g., the given password is wrong).
Returns: the private key.
getX509Certificate¶
-
public X509Certificate
getX509Certificate
()¶ Gets the managed X509 certificate.
Throws: - ClassCastException – if the certificate is not of the X509 type.
Returns: the managed X509 certificate.
getX509Certificate¶
-
public X509Certificate
getX509Certificate
(String alias)¶ Gets the managed X509 certificate.
Parameters: - alias – the alias name.
Throws: - ClassCastException – if the certificate is not of the X509 type.
Returns: the managed X509 certificate.
getX509CertificateChain¶
-
public X509Certificate[]
getX509CertificateChain
()¶ Gets the managed X509 certificate chain.
Returns: the managed certificate chain.
getX509CertificateChain¶
-
public X509Certificate[]
getX509CertificateChain
(String alias)¶ Gets the X509 certificate chain asscoiated with the given alias name.
Parameters: - alias – the alias name.
Returns: the certificate chain.
KeyStoreTrustManager¶
-
public class
KeyStoreTrustManager
extends KeyStoreComponent implements X509TrustManager¶ This class implements the javax.net.ssl.X509TrustManager, which trusts a Certificate Chain if any of the certificate in the certificate chain is stored in the KeyStore.
Author: Bob P. Y. Koon
Constructors¶
KeyStoreTrustManager¶
-
public
KeyStoreTrustManager
(KeyStoreManager keyman)¶ Creates a new instance of KeyStoreTrustManger.
Parameters: - keyman – the trusted key store manager.
Throws: - KeyStoreManagementException – if the specified key store manager is null.
Methods¶
checkClientTrusted¶
-
public void
checkClientTrusted
(X509Certificate[] chain, String authType)¶ Checks if the client is trusted. It trusts the certificate chain if the embeded key store contains one of the certificate in the chain.
Parameters: - chain – the peer certificate chain.
- authType – the key exchange algorithm used.
Throws: - IllegalArgumentException – if null or zero-length chain is passed in for the chain parameter or if null or zero-length string is passed in for the authType parameter.
- CertificateException – if the certificate chain is not trusted by this TrustManager.
checkServerTrusted¶
-
public void
checkServerTrusted
(X509Certificate[] chain, String authType)¶ Checks if the server is trusted. It trusts the certificate chain if the embeded key store contains one of the certificate in the chain.
Parameters: - chain – the peer certificate chain.
- authType – the key exchange algorithm used.
Throws: - IllegalArgumentException – if null or zero-length chain is passed in for the chain parameter or if null or zero-length string is passed in for the authType parameter.
- CertificateException – if the certificate chain is not trusted by this TrustManager.
getAcceptedIssuers¶
-
public X509Certificate[]
getAcceptedIssuers
()¶ Returns an array of certificate authority certificates which are stored in the embeded key store.
Returns: a non-null (possibly empty) array of acceptable CA issuer certificates.
SMimeException¶
-
public class
SMimeException
extends hk.hku.cecid.piazza.commons.GenericException¶ SMimeException represents all kinds of exception related to SMIME.
Author: Hugo Y. K. Lam
SMimeMessage¶
-
public class
SMimeMessage
¶ SMimeMessage represents a Secure MIME Message. It encapsulates a MIME body part and provides methods for digital signing, signature verification, encryption, decryption, compression, and decompression.
Author: Hugo Y. K. Lam
Constructors¶
SMimeMessage¶
-
public
SMimeMessage
(MimeBodyPart bodyPart)¶ Creates a new instance of SMimeMessage.
Parameters: - bodyPart – the original MIME body part.
SMimeMessage¶
-
public
SMimeMessage
(MimeBodyPart bodyPart, X509Certificate cert)¶ Creates a new instance of SMimeMessage.
Parameters: - bodyPart – the original MIME body part.
- cert – the certificate for signature verification or encryption.
SMimeMessage¶
-
public
SMimeMessage
(MimeBodyPart bodyPart, X509Certificate cert, Session session)¶ Creates a new instance of SMimeMessage.
Parameters: - bodyPart – the original MIME body part.
- cert – the certificate for signature verification or encryption.
- session – the mail session.
SMimeMessage¶
-
public
SMimeMessage
(MimeBodyPart bodyPart, X509Certificate cert, PrivateKey privateKey)¶ Creates a new instance of SMimeMessage.
Parameters: - bodyPart – the original MIME body part.
- cert – the certificate for signature verification or encryption.
- privateKey – the private key for digital signing or decryption.
SMimeMessage¶
-
public
SMimeMessage
(MimeBodyPart bodyPart, X509Certificate cert, PrivateKey privateKey, Session session)¶ Creates a new instance of SMimeMessage.
Parameters: - bodyPart – the original MIME body part.
- cert – the certificate for signature verification or encryption.
- privateKey – the private key for digital signing or decryption.
- session – the mail session.
SMimeMessage¶
-
protected
SMimeMessage
(MimeBodyPart bodyPart, SMimeMessage smime)¶ Creates a new instance of SMimeMessage.
Parameters: - bodyPart – the original MIME body part.
- smime – the S/MIME message from which the configuration is copied.
Methods¶
compress¶
-
public SMimeMessage
compress
()¶ Compresses the encapsulated MIME body part.
Throws: - SMimeException – if unable to compress the body part.
Returns: an S/MIME message encapsulating the compressed MIME body part.
decompress¶
-
public SMimeMessage
decompress
()¶ Decompresses the encapsulated MIME body part.
Throws: - SMimeException – if unable to decompress the body part.
Returns: an S/MIME message encapsulating the decompressed MIME body part.
decrypt¶
-
public SMimeMessage
decrypt
()¶ Decrypts the encapsulated MIME body part.
Throws: - SMimeException – if unable to decrpyt the body part.
Returns: an S/MIME message encapsulating the decrypted MIME body part.
decrypt¶
-
public SMimeMessage
decrypt
(PrivateKey privateKey)¶ Decrypts the encapsulated MIME body part.
Parameters: - privateKey – the private key for decryption.
Throws: - SMimeException – if unable to decrpyt the body part.
Returns: an S/MIME message encapsulating the decrypted MIME body part.
digest¶
-
public String
digest
()¶ Digests the encapsulated MIME body part.
Throws: - SMimeException – if unable to compute the digest value.
Returns: the digested value in Base 64 format.
digest¶
-
public String
digest
(String digestAlg, boolean isHeadersIncluded)¶ Digests the encapsulated MIME body part.
Parameters: - digestAlg – digest algorithm.
- isHeadersIncluded – true if the digest should be computed on both the headers and the content of the encapsulated body part.
Throws: - SMimeException – if unable to compute the digest value.
Returns: the digested value in Base 64 format.
encrypt¶
-
public SMimeMessage
encrypt
()¶ Encrypts the encapsulated MIME body part.
Throws: - SMimeException – if unable to encrpyt the body part.
Returns: an S/MIME message encapsulating the encrypted MIME body part.
encrypt¶
-
public SMimeMessage
encrypt
(X509Certificate cert)¶ Encrypts the encapsulated MIME body part.
Parameters: - cert – the certificate for encryption.
Throws: - SMimeException – if unable to encrpyt the body part.
Returns: an S/MIME message encapsulating the encrypted MIME body part.
getBodyPart¶
-
public MimeBodyPart
getBodyPart
()¶ Gets the encapsulated MIME body part.
Returns: the encapsulated MIME body part.
getContentTransferEncoding¶
getDigestAlgorithm¶
getEncryptAlgorithm¶
isCompressed¶
-
public boolean
isCompressed
()¶ Checks if the encapsulated MIME body part is compressed.
Throws: - SMimeException – if error occurred in checking.
Returns: true if the encapsulated MIME body part is compressed.
isEncrypted¶
-
public boolean
isEncrypted
()¶ Checks if the encapsulated MIME body part is encrypted.
Throws: - SMimeException – if error occurred in checking.
Returns: true if the encapsulated MIME body part is encrypted.
isSigned¶
-
public boolean
isSigned
()¶ Checks if the encapsulated MIME body part is signed.
Throws: - SMimeException – if error occurred in checking.
Returns: true if the encapsulated MIME body part is signed.
setContentTransferEncoding¶
setDigestAlgorithm¶
setEncryptAlgorithm¶
sign¶
-
public SMimeMessage
sign
()¶ Signs the encapsulated MIME body part.
Throws: - SMimeException – if unable to sign the body part.
Returns: an S/MIME message encapsulating the signed MIME body part.
unsign¶
-
public SMimeMessage
unsign
()¶ Unsigns the encapsulated MIME body part.
Throws: - SMimeException – if unable to unsign the body part.
Returns: the an S/MIME message encapsulating the signed content.
verify¶
-
public SMimeMessage
verify
()¶ Verifies the encapsulated MIME body part.
Throws: - SMimeException – if unable to verify the body part.
Returns: an S/MIME message encapsulating the signed content.
verify¶
-
public SMimeMessage
verify
(X509Certificate cert)¶ Verifies the encapsulated MIME body part.
Parameters: - cert – the certificate for verification.
Throws: - SMimeException – if unable to verify the body part.
Returns: an S/MIME message encapsulating the signed content.
TrustedHostnameVerifier¶
-
public class
TrustedHostnameVerifier
implements HostnameVerifier¶ TrustedHostnameVerifier is a HostnameVerifier which verifies the host name in an SSL session based on a list of pre-defined hostnames. If there is no such a list in this verifier, it defaults to trust any host name.
Author: Hugo Y. K. Lam
Constructors¶
TrustedHostnameVerifier¶
-
public
TrustedHostnameVerifier
()¶ Creates a new intance of TrustedHostnameVerifier. The verifier will be set to trust all hostnames on verification.
TrustedHostnameVerifier¶
-
public
TrustedHostnameVerifier
(Collection hostnames)¶ Creates a new intance of TrustedHostnameVerifier.
Parameters: - hostnames – the host names to be trusted on verification.
Methods¶
verify¶
-
public boolean
verify
(String hostname, SSLSession sslSession)¶ Verifies that the host name is an acceptable match with the trusted host names pre-defined in this verifier.
Parameters: - hostname – the host name.
- sslSession – the SSL session used on the connection to the host.
Returns: true if the host name is acceptable.
See also:
javax.net.ssl.HostnameVerifier.verify(java.lang.String, javax.net.ssl.SSLSession)
hk.hku.cecid.piazza.commons.servlet¶
RequestListener¶
-
public interface
RequestListener
¶ RequestListener is a listener for handling servlet requests.
Author: Hugo Y. K. Lam
Methods¶
getParameters¶
-
public Properties
getParameters
()¶ Gets the parameters of this listener.
Returns: the parameters of this listener.
listenerCreated¶
-
public void
listenerCreated
()¶ Invoked after the listener has been created and before it can handle any request.
Throws: - RequestListenerException – if the invoked process has errors.
listenerDestroyed¶
-
public void
listenerDestroyed
()¶ Invoked after the listener has been taken out from service and before disposal.
Throws: - RequestListenerException – if the invoked process has errors.
RequestListenerException¶
-
public class
RequestListenerException
extends hk.hku.cecid.piazza.commons.GenericException¶ RequestListenerException represents all kinds of exception related to RequestListener.
Author: Hugo Y. K. Lam
StatefulServletContext¶
-
public class
StatefulServletContext
¶ A StatefulServletContext represents a context of a stateful servlet. A stateful servlet has two states, a halted state and a running state.
Author: Hugo Y. K. Lam See also:
StatefulServletContextListener
Constructors¶
Methods¶
acquire¶
-
public synchronized void
acquire
()¶ Acquires a permission from this context. Any servlet which employs this stateful context must call this method before processing any requests.
Throws: - UnavailableException – if the context is currently halted.
addContextListener¶
getContextListeners¶
-
public Collection
getContextListeners
()¶ Gets all the stateful servlet context listeners in this context.
Returns: all the stateful servlet context listeners in this context.
getCurrentThreadCount¶
-
public int
getCurrentThreadCount
()¶ Gets the current count of threads running under this context.
Returns: the current count of threads running under this context.
getRequestEncoding¶
getResponseEncoding¶
halt¶
-
public synchronized boolean
halt
()¶ Halts this context. The calling thread will be blocked until a lock on the context has been acquired and no more threads are running under this context. Nothing will be done if the servlet is already halted.
Returns: true if and only if this context is not halted or being halted.
isHalted¶
-
public boolean
isHalted
()¶ Checks if the context is currently halted.
Returns: true if the servlet is currently halted.
isHalting¶
-
public boolean
isHalting
()¶ Checks if the context is currently being halted.
Returns: true if the servlet is currently being halted.
release¶
-
public synchronized void
release
()¶ Releases a permission to this context. Any servlet which employs this stateful context must call this method after processing any requests.
resume¶
-
public synchronized boolean
resume
()¶ Resumes this context. The calling thread will be blocked until a lock on the context has been acquired. Nothing will be done if the servlet is not halted.
Returns: true if and only if this context is halted and not being halted.
setRequestEncoding¶
StatefulServletContextListener¶
-
public interface
StatefulServletContextListener
¶ StatefulServletContextListener is a listener for listening the events from a stateful servlet context.
Author: Hugo Y. K. Lam See also:
StatefulServletContext
hk.hku.cecid.piazza.commons.servlet.http¶
HttpDispatcher¶
-
public class
HttpDispatcher
extends HttpServlet¶ HttpDispatcher is an HttpServlet which dispatches Http request to the Http request listeners registered in its Http dispatcher context.
Author: Hugo Y. K. Lam See also:
HttpDispatcherContext
Fields¶
Methods¶
doDelete¶
-
protected void
doDelete
(HttpServletRequest request, HttpServletResponse response)¶ Handles the HTTP
POST
method.Parameters: - request – the servlet request.
- response – the servlet response.
doGet¶
-
protected void
doGet
(HttpServletRequest request, HttpServletResponse response)¶ Handles the HTTP
GET
method.Parameters: - request – the servlet request.
- response – the servlet response.
doPost¶
-
protected void
doPost
(HttpServletRequest request, HttpServletResponse response)¶ Handles the HTTP
POST
method.Parameters: - request – the servlet request.
- response – the servlet response.
fireRequestAcceptedEvent¶
-
protected boolean
fireRequestAcceptedEvent
(HttpRequestEvent event)¶ Invoked before a request is processed by the listener registered at the request context path which is relative to this servlet’s context path.
Parameters: - event – the HTTP request event.
Returns: true if the request should be accepted and processed by the registered listener.
fireRequestProcessedEvent¶
-
protected void
fireRequestProcessedEvent
(HttpRequestEvent event)¶ Invoked when a request has been processed by the listener registered at the request context path which is relative to this servlet’s context path.
Parameters: - event – the HTTP request event.
getServletInfo¶
init¶
-
public void
init
(ServletConfig config)¶ Initializes the servlet.
Parameters: - config – the ServletConfig.
Throws: - ServletException – if error occurred in initialization.
processRequest¶
-
protected void
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ Processes requests for both HTTP
GET
andPOST
methods.Parameters: - request – servlet request.
- response – servlet response.
HttpDispatcherContext¶
-
public class
HttpDispatcherContext
extends StatefulServletContext¶ An HttpDispatcherContext is a StatefulServletContext. Additionally it manages the Http request listeners for the HttpDispatcher.
Author: Hugo Y. K. Lam See also:
HttpDispatcher
,HttpRequestListener
Constructors¶
Methods¶
addContext¶
-
public static void
addContext
(String id, HttpDispatcherContext context)¶ Adds an Http dispatcher context to the embeded context store.
Parameters: - id – the ID of the Http dispatcher context.
- context – the Http dispatcher context.
addRequestFilter¶
getContext¶
-
public static HttpDispatcherContext
getContext
(String id)¶ Gets an Http dispatcher context from the embeded context store.
Parameters: - id – the ID of the Http dispatcher context.
Returns: the Http dispatcher context.
getDefaultContext¶
-
public static HttpDispatcherContext
getDefaultContext
()¶ Gets the default Http dispatcher context.
Returns: the default Http dispatcher context.
getListener¶
-
public HttpRequestListener
getListener
(String pathInfo)¶ Gets the Http request listener for the specified path which is relative to its corresponding servlet’s context path. If there is an exact match on the specified path, the registered listener will be returned. Else if there is a wildcard path which matches the specified path, its corresponding registered listener will be returned. Otherwise, null will be returned.
Parameters: - pathInfo – the path information.
Returns: the HttpRequestListener registered at the specified path.
getPathInfo¶
-
public String
getPathInfo
(HttpServletRequest request)¶ Gets the path information from the specified request. The path information will be fixed according to the internal logic of this context if necessary.
Parameters: - request – the Http servlet request.
Returns: the path information.
getRegisteredListenersInfo¶
-
public Properties
getRegisteredListenersInfo
()¶ Gets the information of all registered Http request listeners. The resulted properties will contain a set of pathInfo-listenerName pairs.
Returns: the information as properties.
getRequestFilters¶
-
public Collection
getRequestFilters
()¶ Gets all the request filters in this context.
Returns: all the request filters in this context.
register¶
-
public boolean
register
(String pathInfo, Object requestListener)¶ Registers an Http request listener at a specified path which is relative to its corresponding servlet’s context path.
Parameters: - pathInfo – the path information.
- requestListener – the Http request listener, the class name of the listener, or the class of the listener.
Returns: true if the operation is successful, false otherwise.
register¶
-
public boolean
register
(String pathInfo, Object requestListener, Properties params)¶ Registers an Http request listener at a specified path which is relative to its corresponding servlet’s context path.
Parameters: - pathInfo – the path information.
- requestListener – the Http request listener, the class name of the listener, or the class of the listener.
- params – the parameters of the listener.
Returns: true if the operation is successful, false otherwise.
unregister¶
HttpRequestAdaptor¶
-
public abstract class
HttpRequestAdaptor
implements HttpRequestListener¶ HttpRequestAdaptor is an abstract adapter class for handling HTTP requests. The methods in this class are empty. This class exists as convenience for creating listener objects.
Author: Hugo Y. K. Lam
Fields¶
parameters¶
-
protected final Properties
parameters
¶ The parameters of this listener.
Methods¶
doEndRequest¶
-
public void
doEndRequest
(HttpServletRequest request, HttpServletResponse response)¶ See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.doEndRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
doStartRequest¶
-
public boolean
doStartRequest
(HttpServletRequest request, HttpServletResponse response)¶ See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.doStartRequest(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
getParameters¶
-
public Properties
getParameters
()¶ See also:
hk.hku.cecid.piazza.commons.servlet.RequestListener.getParameters()
listenerCreated¶
-
public void
listenerCreated
()¶ See also:
hk.hku.cecid.piazza.commons.servlet.RequestListener.listenerCreated()
listenerDestroyed¶
-
public void
listenerDestroyed
()¶ See also:
hk.hku.cecid.piazza.commons.servlet.RequestListener.listenerDestroyed()
HttpRequestEvent¶
-
public class
HttpRequestEvent
¶ HttpRequestEvent represents an event of an HTTP request.
Author: Hugo Y. K. Lam
Constructors¶
HttpRequestEvent¶
-
HttpRequestEvent
(String pathInfo, HttpServletRequest request, HttpServletResponse response)¶ Creates a new instance of HttpRequestEvent.
Parameters: - pathInfo – the path information.
- request – the request object.
- response – the response object.
Methods¶
getRequest¶
-
public HttpServletRequest
getRequest
()¶ Gets the request object.
Returns: the request object.
getResponse¶
-
public HttpServletResponse
getResponse
()¶ Gets the response object.
Returns: the response object.
setPathInfo¶
setRequest¶
-
void
setRequest
(HttpServletRequest request)¶ Sets the request object.
Parameters: - request – the request object.
setResponse¶
-
void
setResponse
(HttpServletResponse response)¶ Sets the response object.
Parameters: - response – the response object.
toString¶
-
public String
toString
()¶ Returns a string representation of this event.
Returns: a string representation of this event. See also:
java.lang.Object.toString()
HttpRequestFilter¶
-
public interface
HttpRequestFilter
¶ HttpRequestFilter
Author: Hugo Y. K. Lam
Methods¶
requestAccepted¶
-
public boolean
requestAccepted
(HttpRequestEvent event)¶ Invoked when the an HTTP request is accepted.
Parameters: - event – the HTTP request event.
requestProcessed¶
-
public void
requestProcessed
(HttpRequestEvent event)¶ Invoked when the an HTTP request has been processed.
Parameters: - event – the HTTP request event.
HttpRequestListener¶
-
public interface
HttpRequestListener
extends RequestListener¶ HttpRequestListener is a listener for handling requests for both HTTP
GET
andPOST
methods.Author: Hugo Y. K. Lam
Methods¶
doEndRequest¶
-
public void
doEndRequest
(HttpServletRequest request, HttpServletResponse response)¶ Invoked after invoking processRequest().
Parameters: - request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if errors occurred during processing the request.
doStartRequest¶
-
public boolean
doStartRequest
(HttpServletRequest request, HttpServletResponse response)¶ Invoked before invoking processRequest().
Parameters: - request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if errors occurred during processing the request.
Returns: true if processRequest() should be invoked.
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ Processes requests for both HTTP
GET
andPOST
methods.Parameters: - request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if errors occurred during processing the request.
Returns: the forwarding path.
hk.hku.cecid.piazza.commons.soap¶
SOAPFaultException¶
-
public class
SOAPFaultException
extends SOAPRequestException¶ SOAPFaultException represents a SOAP fault in a SOAP request.
Author: Hugo Y. K. Lam
Fields¶
SOAPHttpAdaptor¶
-
public abstract class
SOAPHttpAdaptor
extends HttpRequestAdaptor implements SOAPRequestListener¶ SOAPHttpAdaptor is both an HttpRequestListener and SOAPRequestListener. It is an adaptor for handling SOAP on Http requests.
Author: Hugo Y. K. Lam
Fields¶
msgFactory¶
-
protected MessageFactory
msgFactory
¶ A SOAP message factory.
soapFactory¶
-
protected SOAPFactory
soapFactory
¶ A SOAP factory.
Methods¶
isCacheEnabled¶
-
protected boolean
isCacheEnabled
()¶ Checks if cache in memory should be enabled. If this method returns false, it indicates that the SOAP request object will not provide a byte array cache of the original SOAP request.
Returns: true if cache in memory should be enabled.
isSOAPFaultEnabled¶
-
protected boolean
isSOAPFaultEnabled
()¶ Checks if errors in the request process should be reported as a SOAP fault to the client.
Returns: true if SOAP fault reporting is enabled.
listenerCreated¶
-
public void
listenerCreated
()¶ Creates a new instance of MessageFactory.
Throws: - RequestListenerException – if unable to create MessageFactory.
See also:
hk.hku.cecid.piazza.commons.servlet.RequestListener.listenerCreated()
listenerDestroyed¶
-
public void
listenerDestroyed
()¶ Cleans up resources.
See also:
hk.hku.cecid.piazza.commons.servlet.RequestListener.listenerDestroyed()
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ Processes the HTTP request and transforms it into a SOAP request.
See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.processRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
SOAPHttpConnector¶
-
public class
SOAPHttpConnector
extends HttpConnector¶ SOAPHttpConnector is an HTTP connector for making HTTP SOAP connections to an endpoint.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
send¶
-
public SOAPMessage
send
(SOAPMessage request)¶ Sends an HTTP SOAP request.
Parameters: - request – the SOAP request message.
Throws: - ConnectionException – if failed in sending the HTTP SOAP request or creating a new connection.
Returns: the SOAP reply message responsed from the host.
send¶
-
public SOAPMessage
send
(SOAPMessage request, HttpURLConnection connection)¶ Sends an HTTP SOAP request using the given HTTP connection.
Parameters: - request – the SOAP request message.
- connection – the HTTP connection for sending the request.
Throws: - ConnectionException – if failed in sending the HTTP SOAP request.
Returns: the SOAP reply message responsed from the host.
SOAPMailSender¶
-
public class
SOAPMailSender
extends MailSender¶ SOAPMailSender is a mail sender responsible for sending SOAP message.
Author: Hugo Y. K. Lam
Methods¶
createMessage¶
-
public MimeMessage
createMessage
(String from, String to, String cc, String subject, SOAPMessage soapMessage)¶ Creates a MIME message from a SOAP message.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
- soapMessage – the SOAP message.
Throws: - ConnectionException – if error occurred in constructing the mail message.
Returns: a new MIME message.
See also:
hk.hku.cecid.piazza.commons.net.MailSender.createMessage(java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.mail.Session)
createMessage¶
-
public MimeMessage
createMessage
(String from, String to, String cc, String subject, SOAPMessage soapMessage, Session session)¶ Creates a MIME message from a SOAP message.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
- soapMessage – the SOAP message.
- session – the mail session.
Throws: - ConnectionException – if error occurred in constructing the mail message.
Returns: a new MIME message.
See also:
hk.hku.cecid.piazza.commons.net.MailSender.createMessage(java.lang.String,java.lang.String,java.lang.String,java.lang.String,javax.mail.Session)
send¶
-
public void
send
(String from, String to, String cc, String subject, SOAPMessage soapMessage)¶ Sends a SOAP message.
Parameters: - from – the ‘from’ mail address.
- to – the ‘to’ mail address(es).
- cc – the ‘cc’ mail address(es).
- subject – the mail subject.
- soapMessage – the SOAP message.
Throws: - ConnectionException – if unable to construct the mail message or to send out the message.
See also:
hk.hku.cecid.piazza.commons.net.MailSender.send(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
SOAPRequest¶
-
public class
SOAPRequest
¶ The SOAPRequest class represents a SOAP request. It is independent of which transport protocol it is using and contains the SOAP message of the original request.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
getBytes¶
-
public byte[]
getBytes
()¶ Gets the SOAP message as bytes.
Returns: the byte array of the SOAP message.
getHeaders¶
-
public MimeHeaders
getHeaders
()¶ Gets the mime headers of the request.
Returns: the mime headers of the request.
getMessage¶
-
public SOAPMessage
getMessage
()¶ Gets the SOAP message of this request.
Returns: the SOAP message of this request.
getSource¶
setBytes¶
-
void
setBytes
(byte[] bs)¶ Sets the bytes of the SOAP message.
Parameters: - bs – the byte array of the SOAP message.
setHeaders¶
-
void
setHeaders
(MimeHeaders headers)¶ Sets the mime headers of the request.
Parameters: - headers – the mime headers of the request.
setMessage¶
-
void
setMessage
(SOAPMessage message)¶ Sets the SOAP message of this request.
Parameters: - message – the SOAP message of this request.
SOAPRequestException¶
-
public class
SOAPRequestException
extends hk.hku.cecid.piazza.commons.GenericException¶ SOAPRequestException represents all kinds of exception related to a SOAP request or its process.
Author: Hugo Y. K. Lam
Constructors¶
SOAPRequestException¶
-
public
SOAPRequestException
()¶ Creates a new instance of SOAPRequestException.
SOAPRequestException¶
SOAPRequestException¶
Methods¶
getSOAPFault¶
-
public SOAPFaultException
getSOAPFault
()¶ Gets the SOAP fault exception which caused this exception.
Returns: the SOAP fault exception which caused this exception or null if there is none.
SOAPRequestListener¶
-
public interface
SOAPRequestListener
¶ SOAPRequestListener is a listener for handling SOAP requests.
Author: Hugo Y. K. Lam
Methods¶
processRequest¶
-
public void
processRequest
(SOAPRequest request, SOAPResponse response)¶ Processes the SOAP request.
Parameters: - request – the SOAP request.
- response – the SOAP response.
Throws: - SOAPRequestException – if there is any error in processing the SOAP request.
SOAPResponse¶
-
public class
SOAPResponse
¶ The SOAPResponse class represents a SOAP response. It is independent of which transport protocol it is using and contains the SOAP message of the target response.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
addFault¶
-
public SOAPFault
addFault
(String code, String actor, String desc)¶ Adds a SOAP fault to the SOAP message of this response.
Parameters: - code – the fault code.
- actor – the fault actor.
- desc – the fault description.
Throws: - SOAPException – a SOAP error occurred when adding the the fault.
Returns: the SOAP fault which has been added to the SOAP message. null if there is no SOAP message in this response or the fault has already been added.
addFault¶
-
public SOAPFault
addFault
(Throwable cause)¶ Adds a SOAP fault to the SOAP message of this response.
Parameters: - cause – the exception cause.
Throws: - SOAPException – a SOAP error occurred when adding the the fault.
Returns: the SOAP fault which has been added to the SOAP message. null if there is no SOAP message in this response or the fault has already been added.
getMessage¶
-
public SOAPMessage
getMessage
()¶ Gets the SOAP message of this response.
Returns: the SOAP message of this response.
getTarget¶
setMessage¶
-
public void
setMessage
(SOAPMessage message)¶ Sets the SOAP message of this response.
Parameters: - message – the SOAP message of this response.
WebServicesAdaptor¶
-
public abstract class
WebServicesAdaptor
extends SOAPHttpAdaptor¶ WebServicesAdaptor is a SOAPHttpAdaptor which handles web services request. This adaptor can only handles document style web services. It invokes either one of the following methods in the subclass for handling the request:
- public Element[] serviceRequested(Element[] bodies)
- public SOAPElement[] serviceRequested(SOAPElement[] bodies)
- public void serviceRequested(SOAPMessage req, SOAPMessage resp)
- public void serviceRequested(WebServicesRequest req, WebServicesResponse resp)
Author: Hugo Y. K. Lam
Methods¶
createElement¶
-
protected SOAPElement
createElement
(String name, String value, String namespace, String xsdType)¶ Creates a SOAP element.
Parameters: - name – the element name.
- value – the element value.
- namespace – the namespace.
- xsdType – the XSD data type.
Throws: - SOAPException – if unable to create the element.
Returns: the newly created element.
createElement¶
-
protected SOAPElement
createElement
(String local, String namespace)¶
createText¶
-
protected SOAPElement
createText
(String name, String value, String namespace)¶ Creates a text element.
Parameters: - name – the element name.
- value – the element value.
- namespace – the namespace.
Throws: - SOAPException – if unable to create the element.
Returns: the newly created text element.
doStartRequest¶
-
public boolean
doStartRequest
(HttpServletRequest request, HttpServletResponse response)¶ Responses with a web services descriptor if the request’s query is “wsdl” or the request is a “get” method.
Parameters: - request – the servlet request.
- response – the servlet response.
Throws: - RequestListenerException – if there is any error in processing the request.
Returns: true if the request is not a “wsdl” request, false otherwise.
See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.doStartRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
getChildElementArray¶
-
protected SOAPElement[]
getChildElementArray
(SOAPElement element)¶
getText¶
isElement¶
-
protected boolean
isElement
(SOAPElement element, String local, String namespace)¶
processDescriptorRequest¶
-
protected void
processDescriptorRequest
(OutputStream outs)¶ Processes the WSDL request. Override to provide specific descriptor.
Parameters: - outs – the output stream to which the descriptor should be written.
Throws: - RequestListenerException – if there is error in processing the WSDL request.
processRequest¶
-
public void
processRequest
(SOAPRequest request, SOAPResponse response)¶ Prcoesses the SOAP request.
Parameters: - request – the SOAP request.
- response – the SOAP response.
Throws: - SOAPRequestException – if there is any error in processing the SOAP request.
See also:
hk.hku.cecid.piazza.commons.soap.SOAPRequestListener.processRequest(hk.hku.cecid.piazza.commons.soap.SOAPRequest, hk.hku.cecid.piazza.commons.soap.SOAPResponse)
WebServicesRequest¶
-
public class
WebServicesRequest
¶ The WebServicesRequest class represents a Web Services request. It is independent of which access protocol it is using and contains the bodies of the request message.
Author: Hugo Y. K. Lam
Constructors¶
WebServicesResponse¶
-
public class
WebServicesResponse
¶ The WebServicesResponse class represents a Web Services response. It is independent of which access protocol it is using and contains the bodies of the response message.
Author: Hugo Y. K. Lam
Constructors¶
hk.hku.cecid.piazza.commons.spa¶
Extension¶
-
public class
Extension
extends PluginComponent¶ An Extension is a plugin component which represents the extension element in the plugin descriptor.
Author: Hugo Y. K. Lam See also:
Plugin
,ExtensionPoint
Constructors¶
Extension¶
-
public
Extension
(PluginComponent parent, String point, String name)¶ Creates a new instance of Extension.
Parameters: - parent – the parent plugin component.
- point – the extension point this extension extends.
- name – the extension name.
Extension¶
-
public
Extension
(PluginComponent parent, String point, String name, Properties parameters)¶ Creates a new instance of Extension.
Parameters: - parent – the parent plugin component.
- point – the extension point this extension extends.
- name – the extension name.
- parameters – the extension parameters.
Methods¶
getParameter¶
getParameters¶
-
public Properties
getParameters
()¶ Gets the extension parameters.
Returns: the parameters.
getPoint¶
toString¶
-
public String
toString
()¶ Returns a string representation of this extension.
Returns: a string representation of this extension. See also:
java.lang.Object.toString()
ExtensionPoint¶
-
public class
ExtensionPoint
extends PluginComponent¶ An ExtensionPoint is a plugin component which represents the extension-point element in the plugin descriptor.
Author: Hugo Y. K. Lam See also:
Plugin
,Extension
,ExtensionPointHandler
Constructors¶
Methods¶
getHandlerClass¶
getId¶
getName¶
processExtensions¶
-
public void
processExtensions
(Collection extensions)¶ Processes extensions by invoking the handler class of this extension point.
Parameters: - extensions – the extensions to be processed.
Throws: - PluginException – if there is error in processing extensions by the handler
toString¶
-
public String
toString
()¶ Returns a string representation of this extension point.
Returns: a string representation of this extension point. See also:
java.lang.Object.toString()
ExtensionPointHandler¶
-
public interface
ExtensionPointHandler
¶ An ExtensionPointHandler handles all the extensions of the extension point it represents.
Author: Hugo Y. K. Lam See also:
ExtensionPoint
Methods¶
processExtensions¶
-
public void
processExtensions
(Collection extensions)¶ Processes the extensions of the extension point it represents. It is invoked when the plugin registry is being activated.
Parameters: - extensions – the extensions of the extension point it represents.
Throws: - PluginException – if failed in the processing extensions.
ExtensionPointIteratedHandler¶
-
public abstract class
ExtensionPointIteratedHandler
implements ExtensionPointHandler¶ An ExtensionPointIteratedHandler handles all the extensions of the extension point it represents one by one.
Author: Hugo Y. K. Lam See also:
ExtensionPoint
Methods¶
isFaultTolerated¶
-
protected boolean
isFaultTolerated
()¶ Checks if fault tolerance is enabled.
Returns: true if fault tolerance is enabled.
processExtension¶
processExtensions¶
-
public void
processExtensions
(Collection extensions)¶ Processes the extensions one by one. If fault tolerance is enabled, no exception will be thrown and processes will be carried on even if there are any exceptions.
Parameters: - extensions – the extensions of the extension point it represents.
Throws: - PluginException – if failed in processing the extensions.
See also:
hk.hku.cecid.piazza.commons.spa.ExtensionPointHandler.processExtensions(java.util.Collection)
Import¶
-
public class
Import
extends PluginComponent¶ An Import is a plugin component which represents the import element in the plugin descriptor.
Author: Hugo Y. K. Lam See also:
Plugin
Constructors¶
Import¶
-
public
Import
(PluginComponent parent, String importedPluginId)¶ Creates a new instance of Import.
Parameters: - parent – the parent plugin component.
- importedPluginId – the ID of the imported plugin.
Library¶
-
public class
Library
extends PluginComponent¶ A Library is a plugin component which represents the library element in the plugin descriptor.
Author: Hugo Y. K. Lam See also:
Plugin
Constructors¶
Library¶
-
public
Library
(PluginComponent parent, String name)¶ Creates a new instance of Library.
Parameters: - parent – the parent plugin component.
- name – the name of this library.
Plugin¶
-
public class
Plugin
extends PluginComponent¶ A Plugin represents a plugin descriptor. It contains the elements specified in the descriptor. It also contains a class loader for loading classes which stored in the libraries specified in the descriptor. If there is a plugin handler specified in the descriptor, it will be invoked when the plugin is being activated.
Author: Hugo Y. K. Lam See also:
PluginRegistry
,PluginClassLoader
,PluginHandler
Constructors¶
Plugin¶
-
public
Plugin
(PluginRegistry registry, File folder, String descriptor)¶ Creates a new instance of Plugin.
Parameters: - registry – the plugin registry which stores this plugin.
- folder – the folder which holds this plugin.
- descriptor – the descriptor of this plugin.
Throws: - PluginException – if this plugin cannot be initialized according to its plugin descriptor.
Methods¶
activate¶
-
public synchronized void
activate
()¶ Activates this plugin by invoking the plugin handler specified in the plugin descriptor. If the plugin has already been activated, nothing will be done.
Throws: - PluginException – if there is any error in processing activation by the handler.
deactivate¶
-
public synchronized void
deactivate
()¶ Deactivates this plugin by invoking the plugin handler specified in the plugin descriptor. If the plugin has not yet been activated, nothing will be done.
Throws: - PluginException – if there is any error in processing deactivation by the handler.
getClassLoader¶
-
public PluginClassLoader
getClassLoader
()¶ Gets the class loader for this plugin.
Returns: the class loader for this plugin.
getExtensionPoints¶
-
public Collection
getExtensionPoints
()¶ Gets all the extension points declared in the plugin descriptor.
Returns: all the extension points declared in the plugin descriptor.
getExtensions¶
-
public Collection
getExtensions
()¶ Gets all extensions declared in the plugin descriptor.
Returns: all extensions declared in the plugin descriptor.
getExtensions¶
-
public Collection
getExtensions
(String point)¶ Gets all extensions declared in the plugin descriptor which extends the specified extension point.
Parameters: - point – the extension point.
Returns: all extensions declared in the plugin descriptor which extends the specified extension point.
getHandlerClass¶
getImports¶
-
public Collection
getImports
()¶ Gets all plugin imports declared in the plugin descriptor.
Returns: all plugin imports declared in the plugin descriptor.
getLibraries¶
-
public Collection
getLibraries
()¶ Gets all libraries declared in the plugin descriptor.
Returns: all libraries declared in the plugin descriptor.
getParameters¶
-
public Properties
getParameters
()¶ Gets the parameters of this plugin.
Returns: the parameters of this plugin.
getPluginRegistry¶
-
public PluginRegistry
getPluginRegistry
()¶ Gets the plugin registry of this plugin.
Returns: the plugin registry of this plugin.
getProviderName¶
getVersion¶
isActivated¶
-
public boolean
isActivated
()¶ Checks if this plugin has been activated.
Returns: true if this plugin has been activated.
loadClass¶
-
public Class
loadClass
(String name)¶ Loads a class from this plugin’s class loader.
Parameters: - name – the class name.
Throws: - PluginException – if the class was not found.
Returns: the Class instance for the specified class name.
toString¶
-
public String
toString
()¶ Returns a string representation of this plugin.
Returns: a string representation of this plugin. See also:
java.lang.Object.toString()
PluginClassLoader¶
-
public class
PluginClassLoader
extends URLClassLoader¶ A PluginClassLoader is a class loader for loading classes which stored in the libraries specified in a plugin descriptor.
Author: Hugo Y. K. Lam See also:
Plugin
Constructors¶
PluginClassLoader¶
PluginClassLoader¶
-
public
PluginClassLoader
(Plugin plugin, URL[] urls, ClassLoader parent)¶ Creates a new instance of PluginClassLoader.
Parameters: - plugin – the Plugin corresponds to this class loader.
- urls – the search paths.
- parent – the parent class loader.
PluginClassLoader¶
-
public
PluginClassLoader
(Plugin plugin, URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)¶ Creates a new instance of PluginClassLoader.
Parameters: - plugin – the Plugin corresponds to this class loader.
- urls – the search paths.
- parent – the parent class loader.
- factory – the URL stream handler factory.
Methods¶
findClass¶
-
protected Class
findClass
(String name)¶ Finds and loads the class with the specified name from the URL search path. Any URLs referring to JAR files are loaded and opened as needed until the class is found. If the class is not found from the search paths of this class loader, it will be searched from the imported class loaders.
Parameters: - name – the name of the class.
Throws: - java.lang.ClassNotFoundException – if the class could not be found.
Returns: the resulting class.
findImportedClass¶
-
protected Class
findImportedClass
(String name)¶ Finds and loads the class with the specified name from the imported class loaders.
Parameters: - name – the name of the class.
Throws: - java.lang.ClassNotFoundException – if the class could not be found.
Returns: the resulting class.
findResource¶
-
public URL
findResource
(String name)¶ Finds the resource with the specified name on the URL search paths.
Parameters: - name – the name of the resource.
Returns: a URL for the resource, or null if the resource could not be found.
See also:
java.lang.ClassLoader.findResource(java.lang.String)
getPlugin¶
importClassLoader¶
-
void
importClassLoader
(ClassLoader loader)¶ Imports a class loader.
Parameters: - loader – the class loader to be imported.
toString¶
-
public String
toString
()¶ Returns a string representation of this class loader.
Returns: a string representation of this class loader. See also:
java.lang.Object.toString()
PluginComponent¶
-
public class
PluginComponent
¶ A PluginComponent represents any components compose the plugin, including the plugin itself.
Author: Hugo Y. K. Lam
Constructors¶
PluginComponent¶
-
public
PluginComponent
(PluginComponent parent)¶ Creates a new instance of PluginComponent.
Parameters: - parent – the parent component.
Methods¶
getParent¶
-
public PluginComponent
getParent
()¶ Gets the parent component of this plugin component.
Returns: the parent component of this plugin component.
PluginDescriptor¶
-
public class
PluginDescriptor
¶ PluginDescriptor is a descriptor containing the configurations of the plugin it represents.
<plugin id="nmtoken" name="nmtoken"? version="nmtoken"? provider-name="nmtoken"? class="nmtoken"?> <parameters>? <parameter name="nmtoken" value="nmtoken" />* </parameters> <runtime>? <library name="nmtoken" />* </runtime> <requires>? <import plugin="nmtoken" />* </requires> <extension-point id="nmtoken" class="nmtoken" name="nmtoken"? />* <extension point="nmtoken" name="nmtoken"?>* <parameter name="nmtoken" value="nmtoken" />* </extension> </plugin>
Author: Hugo Y. K. Lam
Fields¶
Constructors¶
PluginDescriptor¶
PluginDescriptor¶
-
public
PluginDescriptor
(InputStream ins)¶ Creates a new instance of PluginDescriptor.
Parameters: - ins – the plugin descriptor input stream.
Throws: - PluginException – if unable to create the plugin descriptor.
Methods¶
getExtensionPoints¶
-
public Collection
getExtensionPoints
()¶ Creates a collection of extension points according to the specified plugin descriptor.
Returns: a collection of extension points.
getExtensions¶
-
public Collection
getExtensions
()¶ Creates a collection of extensions according to the specified plugin descriptor.
Returns: a collection of extensions.
getHandlerClass¶
getImports¶
-
public Collection
getImports
()¶ Creates a collection of imports according to the specified plugin descriptor.
Returns: a collection of imports.
getLibraries¶
-
public Collection
getLibraries
()¶ Creates a collection of libraries according to the specified plugin descriptor.
Returns: a collection of libraries.
getParameters¶
-
public Properties
getParameters
()¶ Gets the plugin parameters.
Returns: the plugin parameters.
getParent¶
-
public PluginComponent
getParent
()¶ Gets the parent plugin component of this descriptor.
Returns: the parent plugin component of this descriptor.
getProviderName¶
setParent¶
-
public void
setParent
(PluginComponent parent)¶ Sets the parent plugin component of this descriptor.
Parameters: - parent – the parent plugin component of this descriptor.
PluginException¶
-
public class
PluginException
extends hk.hku.cecid.piazza.commons.GenericException¶ PluginException represents all kinds of exception related to the plugin framework.
Author: Hugo Y. K. Lam
PluginFile¶
-
public class
PluginFile
¶ A PluginFile represents an archive file containing all the plugin required files, including the plugin descriptor.
Author: Hugo Y. K. Lam
Fields¶
Constructors¶
PluginFile¶
PluginFile¶
PluginFile¶
-
public
PluginFile
(InputStream pluginStream)¶ Create a new instance of PluginFile.
Parameters: - pluginStream – the plugin stream.
Throws: - PluginException – if unable to create the plugin file instance.
PluginFile¶
-
public
PluginFile
(InputStream pluginStream, String descriptorName)¶ Create a new instance of PluginFile.
Parameters: - pluginStream – the plugin stream.
- descriptorName – the plugin descriptor name.
Throws: - PluginException – if unable to create the plugin file instance.
PluginHandler¶
-
public interface
PluginHandler
¶ A PluginHandler handles the activation process of a plugin.
Author: Hugo Y. K. Lam See also:
Plugin
Methods¶
processActivation¶
-
public void
processActivation
(Plugin plugin)¶ Processes the activation of the plugin this handler represents. It is invoked when the plugin is being activated.
Parameters: - plugin – the plugin this handler represents.
Throws: - PluginException – if activation failed.
processDeactivation¶
-
public void
processDeactivation
(Plugin plugin)¶ Processes the deactivation of the plugin this handler represents. It is invoked when the plugin is being deactivated.
Parameters: - plugin – the plugin this handler represents.
Throws: - PluginException – if deactivation failed.
PluginRegistry¶
-
public class
PluginRegistry
¶ A PluginRegistry is a registry which stores all the plugin configurations. It has a fixed registry location and the plugin configurations are specified in plugin descriptors.
Author: Hugo Y. K. Lam See also:
Plugin
Methods¶
activate¶
-
public synchronized void
activate
()¶ Activates the plugin registry if it is not yet activated.
deactivate¶
-
public synchronized void
deactivate
()¶ Deactivates the plugin registry if it is activated.
deploy¶
-
public String
deploy
(InputStream spa)¶ Deploys a plugin to the plugin registry.
Parameters: - spa – the SPA file input stream.
Throws: - PluginException – if unable to deploy the plugin.
Returns: the plugin ID of the deployed plugin.
getAllExtensions¶
-
public Collection
getAllExtensions
(String point)¶ Gets all extensions corresponding to the specified extension point.
Parameters: - point – the extension point.
Returns: all extensions corresponding to the specified extension point.
getLocation¶
getPlugin¶
getPlugins¶
-
public Collection
getPlugins
()¶ Gets all plugins in this plugin registry.
Returns: all plugins in this plugin registry.
hasErrors¶
-
public boolean
hasErrors
()¶ Checks if there is any error occurred during the initialization or activation of this plugin registry.
Returns: true if there is any error occurred during the activation of this plugin registry.
isActivated¶
-
public boolean
isActivated
()¶ Checks if this plugin registry has already been activated.
Returns: true if this plugin registry has already been activated.
toString¶
-
public String
toString
()¶ Returns a string representation of this plugin registry.
Returns: a string representation of this plugin registry. See also:
java.lang.Object.toString()
undeploy¶
-
public void
undeploy
(String pluginID)¶ Undeploys a plugin from the plugin registry.
Parameters: - pluginID – the plugin ID to undeploy.
Throws: - PluginException – if unable to undeploy the plugin.
hk.hku.cecid.piazza.commons.swallow¶
DiagnosticUtilities¶
-
public class
DiagnosticUtilities
¶ The
DiagnosticUtilities
is is a utility for providing useful information for monitoring and debugging the JVM.Author: Twinsen Tsang
Methods¶
dumpAllThread¶
-
public void
dumpAllThread
(OutputStream os, int stackTraceDepth)¶ Dump all threads information from the current JVM to the specified OutputStream
os
.Parameters: - os – The output stream to dump the threads information.
- stackTraceDepth – The depth of stack trace to dump, default is 3.
Throws: - NullPointerException – when
os
is null. - IllegalArgumentException – when
stackTraceDepth
less than zero.
dumpAllThread¶
-
public void
dumpAllThread
(Writer w, int stackTraceDepth)¶ Dump all threads information from the current JVM to the specified OutputStream
w
.Parameters: - w – The writer used to dump the threads information.
- stackTraceDepth – The depth of stack trace to dump, default is 3.
Throws: - NullPointerException – when
os
is null. - IllegalArgumentException – when
stackTraceDepth
less than zero.
getInstance¶
-
public static DiagnosticUtilities
getInstance
()¶ Get the single instance of
DiagnosticUtilities
.Returns: the single instance of DiagnosticUtilities
.
getNewInstance¶
-
public static DiagnosticUtilities
getNewInstance
()¶ Get the new instance of
DiagnosticUtilities
.Returns: the new instance of DiagnosticUtilities
.
DiagnosticUtilitiesUnitTest¶
-
public class
DiagnosticUtilitiesUnitTest
¶ The
DiagnoisticUtilitiesUnitTest
is MANUAL unit test ofDiagnoisticUtilities
.Author: Twinsen Tsang
Methods¶
testDumpAllThread¶
-
public void
testDumpAllThread
()¶ It is not an automated test-case. Just for manual diagnostic method.
testDumpAllThreadWithIllegalStackTraceDepth¶
-
public void
testDumpAllThreadWithIllegalStackTraceDepth
()¶ Test whether operation dumpAllThread throws IllegalArgumentException when stack trace depth is less than zero.
testDumpAllThreadWithNullStream¶
-
public void
testDumpAllThreadWithNullStream
()¶ Test whether operation dumpAllThread throws NullPointerException when output stream is null.
testGetInstance¶
-
public void
testGetInstance
()¶ Test whether the singleton instance is instantiated successfully through
DiagnosticUtilities.getInstance()
ShutdownHookEmailModule¶
-
public class
ShutdownHookEmailModule
extends Module¶ The ShutdownHookEmailModule is a piazza common module which send email to the specified when the JVM is terminated. It is typical used to notify the operator for the termination of long-running java process like application server (for instance, Tomcat) through email. Background about this: This component is emerged when project swallow requires the detection of application crashes and therefore we want a reusable generic component for doing such. Sample Module Descriptor
<module id="shutdown.email.module" name="Email shutdown hook module"> <parameters> <parameter name="host" value="intraflow2.cs.hku.hk"/> <parameter name="protocol" value="smtp"/> <parameter name="username" value=""/> <parameter name="password" value=""/> <parameter name="from" value="yourDaemon@cecid.hku.hk"/> <parameter name="to" value="yourEmailAddress"/> <parameter name="cc" value="yourCCEmailAddress"/> <parameter name="verbose" value="false"/> </parameters> </module>
Author: Twinsen Tsang
Constructors¶
ShutdownHookEmailModule¶
ShutdownHookEmailModule¶
-
public
ShutdownHookEmailModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of
ShutdownHookEmailModule
.Parameters: - descriptorLocation – the module descriptor.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
ShutdownHookEmailModule¶
-
public
ShutdownHookEmailModule
(String descriptorLocation, ClassLoader loader)¶ Creates a new instance of
ShutdownHookEmailModule
.Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
Throws: - ModuleException – if errors encountered when loading the module descriptor.
Methods¶
createShutdownHookWorker¶
-
protected Thread
createShutdownHookWorker
()¶ Create the thread executed during JVM shutdown. By default, it create an new instance of ShutdownHookEmailThread associated with the property defined in this module descriptor. The thread created must conform the rule specified in the Java API. For detail, read here
Throws: - Throwable – any kind of execution for setup the shutdown hook worker.
Returns: The thread executed during JVM shutdown
ShutdownHookEmailModuleUnitTest¶
-
public class
ShutdownHookEmailModuleUnitTest
extends ModuleTest<ShutdownHookEmailModule>¶ The
ShutdownHookEmailModuleUnitTest
is unit test ofShutdownHookEmailModule
.Author: Twinsen Tsang
Constructors¶
Methods¶
getModuleDescriptionSet¶
-
public static Collection
getModuleDescriptionSet
()¶
testCreateShutdownHookWorker¶
-
public void
testCreateShutdownHookWorker
()¶ Test whether the
ShutdownHookEmailModule.createShutdownHookWorker()
able to wire up all properties from the module descriptor and it is an instance of ShutdownHookEmailThread. Note that the assertion actually take place in a helper class called CreateShudownHookWorkerAssertionThread. It is essential because the ShutdownHook worker thread is loaded through a clone of current class loader and therefore the class only appear in that domain.
testGetThread¶
-
public void
testGetThread
()¶ Test whether
ShutdownHookEmailModule.getThread()
always return non null value.
testOnCreateMailNotificationBody¶
-
public void
testOnCreateMailNotificationBody
()¶ This test has not implemented yet because the mail subject is subject to change.
testOnCreateMailNotificationSubject¶
-
public void
testOnCreateMailNotificationSubject
()¶ This test has not implemented yet because the mail subject is subject to change.
testShutdownHookRegisteredToRuntime¶
-
public void
testShutdownHookRegisteredToRuntime
()¶ Test whether the thread from
ShutdownHookEmailModule.getThread()
is registered inside the runtime shutdown hook.
ShutdownHookEmailModuleUnitTest.CreateShudownHookWorkerAssertionThread¶
Constructors¶
CreateShudownHookWorkerAssertionThread¶
-
public
CreateShudownHookWorkerAssertionThread
(Properties assertionProperties, Thread shutdownThread)¶
ShutdownHookEmailThread¶
-
public class
ShutdownHookEmailThread
extends Thread¶ The
ShutdownHookEmailThread
is the actual worker thread executing during the JVM shutdown.
Fields¶
Constructors¶
ShutdownHookEmailThread¶
-
public
ShutdownHookEmailThread
(String protocol, String host, String username, String password, String from, String tos, String ccs, String subject, boolean verbose)¶ Create an instance of
ShutdownHookEmailThread
for delivering shutdown notification mail.Parameters: - protocol – The protocol for delivering email. default: smtp.
- host – The host-name of email server.
- username – The user-name for authenticating the email server, if necessary.
- password – The password for authenticating the email server, if necessary.
- from – The source email address of the shutdown notification email.
- tos – The to email address of recipient notification email.
- ccs – The cc email address of recipient notification email.
- subject – The subject of the email address.
- verbose – Enable debug mode ?
Methods¶
getCcs¶
getFrom¶
getHost¶
getIsVerbose¶
-
public boolean
getIsVerbose
()¶ Get whether the shutdown hook output verbosely.
Returns: Get whether the shutdown hook output verbosely.
getPassword¶
getProtocol¶
getSubject¶
getTos¶
getUsername¶
onCreateMailNotificationBody¶
onCreateMailNotificationSubject¶
-
protected String
onCreateMailNotificationSubject
()¶ Return the subject of notification email. Sub-class may override this to customize the subject of notification email.
Returns: Return the subject of notification email, default is DEFAULT_SHUTDOWN_MAIL_SUBJECT
hk.hku.cecid.piazza.commons.util¶
ArrayUtilities¶
-
public final class
ArrayUtilities
¶ ArrayUtilities is a convenient class for handling some common array processing.
Author: Hugo Y. K. Lam
Methods¶
forNames¶
-
public static Class[]
forNames
(String[] classNames)¶ Returns the Class object array associated with the class or interface with the given string name array.
Parameters: - classNames – the fully qualified names of the desired classes.
Throws: Returns: the Class object array for the classes with the specified names.
forObjects¶
toArray¶
toArray¶
toArray¶
-
public static Object[]
toArray
(Iterator it, Object[] a)¶ Converts an iterator into an object array.
Parameters: - it – the iterator to be converted.
- a – the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns: an array representation of the iterator.
toArray¶
-
public static Object[]
toArray
(Enumeration enumeration)¶ Converts an enumeration into an object array.
Parameters: - enumeration – the enumeration to be converted.
Returns: an array representation of the enumeration.
toArray¶
-
public static Object[]
toArray
(Enumeration enumeration, Object[] a)¶ Converts an enumeration into an object array.
Parameters: - enumeration – the enumeration to be converted.
- a – the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns: an array representation of the enumeration.
CSVTokenizer¶
-
public class
CSVTokenizer
¶ CSVTokenizer is a tokenizer which can parses a given CSV and represent its content as multiple rows and columns.
Author: Hugo Y. K. Lam
Caller¶
-
public class
Caller
¶ A Caller represents the class calling the method which generates this Caller. It retrieves information from the stack trace and is a relatively expensive operation. As a result, it should be used only when there is an absolute need.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
getClassName¶
getFileName¶
getLineNumber¶
-
public int
getLineNumber
()¶ Gets the line number in the source file of the caller class at which the call is made.
Returns: the line number in the source file.
getMethodName¶
getName¶
isUnknown¶
-
public boolean
isUnknown
()¶ Checks if the calling class is undetermined.
Returns: true if the calling class is undetermined.
toString¶
-
public String
toString
()¶ Returns a string representation of this Caller.
Returns: a string representation of this Caller. See also:
java.lang.Object.toString()
ConsoleLogger¶
Convertor¶
-
public final class
Convertor
¶ A Convertor is mainly responsible for data format conversion.
Author: Hugo Y. K. Lam
Methods¶
convertObject¶
-
public static Object
convertObject
(Object source, Class target)¶ Converts the given source Object to an instance of the specified target class. The constructor of the target class which has an argument of the source object type will be looked up first. It it succeeds, the source Object will be passed in as the argument. Otherwise, the constructor which has a String argument will be looked up and the source object will be passed in as a String by calling its toString method. Null will be returned if the conversion cannot be performed.
Parameters: - source – the source Object.
- target – the target class.
Returns: an instance of the target class representing the given source Object.
deepCopy¶
-
public static Object
deepCopy
(Serializable obj)¶ Performs a deep copy of the given serializable Object.
Parameters: - obj – the serializable Object to be copied.
Returns: a copy of the given Object.
toFile¶
toSQLDate¶
toTimestamp¶
toVector¶
-
public static Vector
toVector
(Object obj)¶ Converts the given Object to a Vector. If the given Object is already a Vector, the Object will be directly returned. Otherwise, the Oobject will be added to a new Vector and the Vector will be returned.
Parameters: - obj – The Object to be converted.
Returns: The Vector converted by the given Object.
translateProperties¶
-
public static void
translateProperties
(javax.servlet.http.HttpServletRequest request, Object bean)¶ Translates the request parameters in the given HttpServletRequest to the properties in the given bean Object.
Parameters: - request – the HttpServletRequest which contains the request parameters to be translated.
- bean – the bean Object into which the request parameters to be translated.
DataFormatter¶
-
public final class
DataFormatter
¶ DataFormatter is a convenient class for formatting objects into or from string. Objects like Date, Time, and Decimal will be formatted according to the following default patterns if none is specified or configured beforehand:
- date-format:
yyyyMMdd
- time-format:
HHmmss
- datetime-format:
yyyyMMddHHmmss
- timestamp-format:
yyyyMMddHHmmssSSS
- timestamp-suffix:
000
- decimal-format:
0.00
Author: Hugo Y. K. Lam - date-format:
Constructors¶
DataFormatter¶
-
public
DataFormatter
(Properties config)¶ Creates a new instance of DataFormatter.
Parameters: - config – configuration properties of the data format.
Methods¶
formatDate¶
formatDate¶
formatDate¶
-
public String
formatDate
(java.util.Date date, String pattern, Locale locale)¶ Formats a given java.util.Date into a String according to the specified pattern.
Parameters: - locale – The locale used in formatting.
- date – The date to be formatted.
- pattern – The pattern to be followed in formatting.
Returns: The formatted String of the date.
formatDateTime¶
formatDecimal¶
formatDecimal¶
formatDecimal¶
formatTime¶
formatTimestamp¶
getInstance¶
-
public static DataFormatter
getInstance
()¶ Gets a default instance of DataFormatter.
Returns: a default instance of DataFormatter.
parseDate¶
parseDate¶
parseDate¶
-
public java.util.Date
parseDate
(String date, String pattern, Locale locale)¶ Parses a date string and returns a java.util.Date object.
Parameters: - date – The date string to be parsed.
- pattern – The pattern of the date string.
- locale – The locale used in parsing the date string.
Returns: A java.util.Date object that represents the given date string.
parseDateTime¶
parseTime¶
Debugger¶
-
public final class
Debugger
¶ Debugger is a convenient tool for logging different Java objects, like string, collection, map, and etc., on debugging purpose. Since the logging of such objects may be expensive, the logging will only be turned on when the debug flag in the system module attached to this debugger is on.
Author: Hugo Y. K. Lam
Generator¶
-
public class
Generator
¶ Generator is a convenient class for generating various standard objects. For instance, a message ID which conforms to RFC2822.
Author: Hugo Y. K. Lam
Headers¶
-
public class
Headers
¶ The Headers class represents the headers of an HTTP URL connection or of the HTTP servlet request and response.
Author: Hugo Y. K. Lam
Constructors¶
Headers¶
-
public
Headers
(HttpURLConnection connection)¶ Creates a new instance of Headers.
Parameters: - connection – the HTTP connection for getting or setting the headers.
Headers¶
-
public
Headers
(HttpServletRequest request, HttpServletResponse response)¶ Creates a new instance of Headers.
Parameters: - request – the servlet request for getting the headers.
- response – the servlet response for setting the headers.
Methods¶
getInputStreamHeaders¶
-
public InputStream
getInputStreamHeaders
()¶ Gets the headers as an input stream from the underlying request object.
Returns: an input stream of the headers.
getInternetHeaders¶
-
public InternetHeaders
getInternetHeaders
()¶ Gets the Internet headers from the underlying request object.
Returns: the Internet headers.
getMimeHeaders¶
-
public MimeHeaders
getMimeHeaders
()¶ Gets the mime headers from the underlying request object.
Returns: the mime headers.
putInternetHeaders¶
-
public void
putInternetHeaders
(InternetHeaders headers)¶ Puts the Internet headers into the underlying response object.
Parameters: - headers – the Internet headers.
putMimeHeaders¶
-
public void
putMimeHeaders
(MimeHeaders headers)¶ Puts the mime headers into the underlying response object.
Parameters: - headers – the mime headers.
Instance¶
-
public final class
Instance
¶ Instance represents an object instance. It wraps the actual object instance and provides methods for invoking the object’s methods.
Author: Hugo Y. K. Lam
Constructors¶
Instance¶
Instance¶
-
public
Instance
(Object source, ClassLoader loader)¶ Creates a new instance of Instance.
Parameters: - source – an object instance, its class, or its class name.
- loader – the class loader for loading the instance’s class.
Throws: - InstanceException – if errors occurred in the creation of the instance.
Instance¶
-
public
Instance
(Object source, Class[] initargTypes, Object[] initargs)¶ Creates a new instance of Instance.
Parameters: - source – an object instance, its class, or its class name.
- initargTypes – the constructor’s parameter types.
- initargs – the constructor’s parameters.
Throws: - InstanceException – if errors occurred in the creation of the instance.
Instance¶
-
public
Instance
(Object source, ClassLoader loader, Class[] initargTypes, Object[] initargs)¶ Creates a new instance of Instance.
Parameters: - source – an object instance, its class, or its class name.
- loader – the class loader for loading the instance’s class.
- initargTypes – the constructor’s parameter types.
- initargs – the constructor’s parameters.
Throws: - InstanceException – if errors occurred in the creation of the instance.
Methods¶
getObject¶
invoke¶
-
public Object
invoke
(String methodName)¶ Invokes a method in the object that this instance represents.
Parameters: - methodName – the method name.
Throws: - InstanceException – if the method could not be invoked.
- InvocationTargetException – if the invoked method has thrown an exception.
Returns: the object returned by the invoked method.
invoke¶
-
public Object
invoke
(String methodName, Object[] parameters)¶ Invokes a method in the object that this instance represents.
Parameters: - methodName – the method name.
- parameters – the parameters.
Throws: - InstanceException – if the method could not be invoked.
- InvocationTargetException – if the invoked method has thrown an exception.
Returns: the object returned by the invoked method.
invoke¶
-
public Object
invoke
(String methodName, Object[] pt, Object[] parameters)¶ Invokes a method in the object that this instance represents.
Parameters: - methodName – the method name.
- pt – the parameter types.
- parameters – the parameters.
Throws: - InstanceException – if the method could not be invoked.
- InvocationTargetException – if the invoked method has thrown an exception.
Returns: the object returned by the invoked method.
InstanceException¶
-
public class
InstanceException
extends hk.hku.cecid.piazza.commons.GenericException¶ InstanceException represents all kinds of exception in creating an instance or invoking a method by reflection.
Author: Hugo Y. K. Lam
Logger¶
-
public interface
Logger
¶ Logger is a common interface of a logger.
Author: Hugo Y. K. Lam
LoggerLog4j¶
-
public class
LoggerLog4j
extends PersistentComponent implements hk.hku.cecid.piazza.commons.util.Logger¶ LoggerLog4j is an implementation of a Logger and is backed by a Log4j logger.
Author: Hugo Y. K. Lam See also:
org.apache.log4j.Logger
Constructors¶
LoggerLog4j¶
LoggerLog4j¶
LoggerLog4j¶
-
public
LoggerLog4j
(String name, URL url)¶ Creates a new instance of LoggerLog4j.
Parameters: - name – the logger category name. null if the name should be looked up dynamically in logging.
- url – the url of the configuration file.
Throws: - UtilitiesException – if the configuration could not be loaded from the specified url.
Methods¶
debug¶
debug¶
error¶
error¶
fatal¶
fatal¶
info¶
info¶
init¶
-
protected void
init
()¶ Initializes this logger and sets a default logger if specified.
Throws: - Exception – if error occurred in initialization.
See also:
hk.hku.cecid.piazza.commons.module.Component.init()
isDebugEnabled¶
-
public boolean
isDebugEnabled
()¶ Checks if the logger itself is in debug mode.
Returns: true if the logger itself is in debug mode.
loading¶
-
protected void
loading
(URL url)¶ Loads the configuration from the specified url location. A DOM configuration will be triggered if the url ends with ”.xml”.
Parameters: - url – the url of the configuration source.
Throws: - Exception – if the operation is unsuccessful.
See also:
hk.hku.cecid.piazza.commons.module.PersistentComponent.loading(java.net.URL)
warn¶
Messages¶
-
public interface
Messages
¶ Messages is a common interface of a collection of messages.
Author: Hugo Y. K. Lam
Methods¶
getDefaultLocale¶
getDefaultMessage¶
getErrorMessage¶
getErrorMessage¶
getMessage¶
getMessage¶
getMessage¶
getMessage¶
-
public String
getMessage
(String name, String def, String type, String locale)¶ Gets a message of the specified type and locale.
Parameters: - name – the name of the message.
- def – a default message.
- type – the type of the message.
- locale – the locale of the message.
Returns: the message with the specified name.
getWarningMessage¶
getWarningMessage¶
setDefaultLocale¶
MessagesTree¶
-
public class
MessagesTree
extends PersistentComponent implements Messages¶ MessagesTree is an implementation of a Messenger. It represents a messenger with a tree structure and is actually backed by a PropertiesTree object.
Author: Hugo Y. K. Lam
Constructors¶
Methods¶
getDefaultLocale¶
-
public String
getDefaultLocale
()¶ See also:
hk.hku.cecid.piazza.commons.util.Messages.getDefaultLocale()
getDefaultMessage¶
-
public String
getDefaultMessage
()¶ See also:
hk.hku.cecid.piazza.commons.util.Messages.getDefaultMessage()
getErrorMessage¶
getErrorMessage¶
getMessage¶
getMessage¶
getMessage¶
getMessage¶
getWarningMessage¶
getWarningMessage¶
loading¶
setDefaultLocale¶
PropertyMap¶
-
public class
PropertyMap
extends PersistentComponent implements PropertySheet¶ PropertyMap is an implementation of a PropertySheet. It represents a property sheet with a map structure and is actually backed by a Properties object.
Author: Hugo Y. K. Lam See also:
java.util.Properties
Constructors¶
PropertyMap¶
-
public
PropertyMap
(Properties p)¶ Creates a new instance of PropertyMap.
Parameters: - p – the Properties object which backs this map.
Methods¶
append¶
-
public boolean
append
(PropertySheet p)¶ Appends a property sheet to this property map. The specified property sheet can only be appended if it is of the PropertyMap type.
Parameters: - p – the property sheet to be appended.
Returns: true if the operation is successful. false otherwise.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.append(hk.hku.cecid.piazza.commons.util.PropertySheet)
containsKey¶
createProperties¶
-
public Properties
createProperties
(String keyPrefix)¶ Creates a Properties object which stores the properties retrieved by the specified key prefix.
Parameters: - keyPrefix – the property key prefix.
Returns: a Properties object which stores the retrieved properties.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.createProperties(java.lang.String)
getProperties¶
getProperties¶
-
public String[][]
getProperties
(String keyPrefix, String keySuffixes)¶ Gets a two-dimensional list of properties with the specified key prefix and key suffixes. The key prefix, along with the suffixes, will define the first dimension of the list while the key suffixes will define the second dimension. E.g.
# Properties content application.listener1.id=MyListener application.listener1.name=My Listener application.listener2.id=MyListener2 application.listener2.name=My Listener 2 Key Prefix: application.listener Key Suffixes: id,name Note that the resulted array will be sorted alphabetically according to the original keys but not the specified key suffixes order or the property values. Returned array: {{"MyListener","My Listener"},{"MyListener2","My Listener 2"}}
Parameters: - keyPrefix – the property key prefix.
- keySuffixes – the property key suffixes delimited by either ‘,’, ‘;’ or ‘|’.
Returns: a two-dimensional list of properties with the specified keys.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.getProperties(java.lang.String, java.lang.String)
getProperty¶
getProperty¶
-
public String
getProperty
(String key, String def)¶ Gets a property with the specified key.
Parameters: - key – the property key.
- def – the default value.
Returns: the property with the specified key.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.getProperty(java.lang.String, java.lang.String)
getPropertyNames¶
loading¶
propertyNames¶
-
public Enumeration
propertyNames
()¶ Gets all the existing property names.
Returns: all the existing property names. See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.propertyNames()
removeProperty¶
setProperty¶
-
public boolean
setProperty
(String key, String value)¶ Sets a property value with the specified key.
Parameters: - key – the property key.
- value – the property value.
Returns: true if the operation is successful. false otherwise.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.setProperty(java.lang.String, java.lang.String)
PropertySheet¶
-
public interface
PropertySheet
¶ PropertySheet is a common interface of a properties container.
Author: Hugo Y. K. Lam
Methods¶
append¶
-
public boolean
append
(PropertySheet p)¶ Appends a property sheet to this property sheet.
Parameters: - p – the property sheet to be appended.
Returns: true if the operation is successful. false otherwise.
containsKey¶
createProperties¶
-
public Properties
createProperties
(String key)¶ Creates a Properties object which stores the properties retrieved by the specified key.
Parameters: - key – the property key.
Returns: a Properties object which stores the retrieved properties.
getProperties¶
getProperties¶
-
public String[][]
getProperties
(String key, String key2)¶ Gets a two-dimensional list of properties with the specified keys. The first key will define the first dimension of the list and the second key will define the second dimension.
Parameters: - key – the first property key.
- key2 – the second property key.
Returns: a two-dimensional list of properties with the specified keys.
getProperty¶
getProperty¶
load¶
propertyNames¶
-
public Enumeration
propertyNames
()¶ Gets all the existing property names.
Returns: all the existing property names.
removeProperty¶
setProperty¶
PropertyTree¶
-
public class
PropertyTree
extends PersistentComponent implements PropertySheet¶ PropertyTree is an implementation of a PropertySheet. It represents a property sheet with a tree structure and is actually backed by a Document object.
Author: Hugo Y. K. Lam See also:
org.dom4j.Document
Constructors¶
PropertyTree¶
PropertyTree¶
PropertyTree¶
-
public
PropertyTree
(InputStream ins)¶ Creates a new instance of PropertyTree.
Parameters: - ins – the input stream of the properties source.
Throws: - ComponentException – if the properties could not be loaded from the specified input stream.
Methods¶
addProperty¶
append¶
-
public boolean
append
(PropertySheet p)¶ Appends a property sheet to this property tree. The specified property sheet can only be appended if it is of the PropertyTree type.
Parameters: - p – the property sheet to be appended.
Returns: true if the operation is successful. false otherwise.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.append(hk.hku.cecid.piazza.commons.util.PropertySheet)
containsKey¶
countProperties¶
createProperties¶
-
public Properties
createProperties
(String xpath)¶ Creates a Properties object which stores the properties retrieved by the specified xpath.
Parameters: - xpath – the properties xpath.
Returns: a Properties object which stores the retrieved properties.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.createProperties(java.lang.String)
getProperties¶
getProperties¶
-
public String[][]
getProperties
(String xpath, String xpath2)¶ Gets a two-dimensional list of properties with the specified xpaths. The first xpath will define the first dimension of the list while the second xpath will define the second dimension. E.g.
<!- Properties content --> <application> <listener> <id>MyListener</id> <name>My Listener</name> </listener> <listener> <id>MyListener2</id> <name>My Listener 2</name> </listener> </application> First xpath: /application/listener Second xpath: ./id|./name Returned array: {{"MyListener","My Listener"},{"MyListener2","My Listener 2"}}
Parameters: - xpath – the first xpath.
- xpath2 – the second xpath.
Returns: a two-dimensional list of properties with the specified xpaths.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.getProperties(java.lang.String, java.lang.String)
getProperty¶
-
public String
getProperty
(String xpath)¶ Gets a property with the specified xpath. If the xpath refers to more than one properpty, the first one will be returned.
Parameters: - xpath – the property xpath.
Returns: the property with the specified xpath.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.getProperty(java.lang.String)
getProperty¶
-
public String
getProperty
(String xpath, String def)¶ Gets a property with the specified xpath. If the xpath refers to more than one properpty, the first one will be returned.
Parameters: - xpath – the property xpath.
- def – the default value.
Returns: the property with the specified xpath.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.getProperty(java.lang.String, java.lang.String)
getPropertyNode¶
getPropertyNodes¶
loading¶
propertyNames¶
-
public Enumeration
propertyNames
()¶ Gets all the existing property xpaths.
Returns: all the existing property xpaths. See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.propertyNames()
removeProperty¶
-
public boolean
removeProperty
(String xpath)¶ Removes a property with the specified xpath. If the xpath refers to more than one properpty, the first one will be removed.
Parameters: - xpath – the property xpath.
Returns: true if the operation is successful. false otherwise.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.removeProperty(java.lang.String)
setProperty¶
-
public boolean
setProperty
(String xpath, String value)¶ Sets a property value with the specified key.
Parameters: - xpath – the property xpath.
- value – the property value.
Returns: true if the operation is successful. false otherwise.
See also:
hk.hku.cecid.piazza.commons.util.PropertySheet.setProperty(java.lang.String, java.lang.String)
storing¶
subtree¶
-
public PropertyTree
subtree
(String xpath)¶ Creates a sub-tree from this property tree.
Parameters: - xpath – the xpath for locating the subtree.
Returns: a new property tree.
toDocument¶
toString¶
-
public String
toString
()¶ Returns a string representation of this property tree, which is the XML text.
Returns: a string representation of this property tree. See also:
java.lang.Object.toString()
StringUtilities¶
-
public final class
StringUtilities
¶ A StringUtilities is a convenient class for handling some common text processing.
Author: Hugo Y. K. Lam
Methods¶
addLeadingCharacter¶
-
public static String
addLeadingCharacter
(String s, char c, int len)¶ Adds specified leading characters to the specified length. Nothing will be done if the length of the given string is equal to or greater than the specified length.
Parameters: - s – the source string.
- c – the leading character(s) to be added.
- len – the length of the target string.
Returns: the string after adding the specified leading character(s).
addLeadingSpace¶
-
public static String
addLeadingSpace
(String s, int len)¶ Adds leading spaces to the given string to the specified length. Nothing will be done if the length of the given string is equal to or greater than the specified length.
Parameters: - s – the source string.
- len – the length of the target string.
Returns: the string after adding leading spaces.
addLeadingZero¶
-
public static String
addLeadingZero
(String s, int len)¶ Adds leading zeros to the given string to the specified length. Nothing will be done if the length of the given string is equal to or greater than the specified length.
Parameters: - s – the source string.
- len – the length of the target string.
Returns: the string after adding leading zeros.
addPrefix¶
addSuffix¶
appendCharacter¶
-
public static String
appendCharacter
(String s, char c, int len)¶ Appends specified characters to the given string to the specified length. Nothing will be done if the length of the given string is equal to or greater than the specified length.
Parameters: - s – the source string.
- c – the character(s) to be appended.
- len – the length of the target string.
Returns: @return the string after appending the specified character(s).
appendSpace¶
-
public static String
appendSpace
(String s, int len)¶ Appends spaces to the given string to the specified length. Nothing will be done if the length of the given string is equal to or greater than the specified length.
Parameters: - s – the source string.
- len – the length of the target string.
Returns: @return the string after appending spaces.
appendZero¶
-
public static String
appendZero
(String s, int len)¶ Appends zeros to the given string to the specified length. Nothing will be done if the length of the given string is equal to or greater than the specified length.
Parameters: - s – the source string.
- len – the length of the target string.
Returns: the string after appending zeros.
concat¶
concat¶
-
public static String
concat
(String[] tokens, String tokenPrefix, String tokenSuffix, String delim)¶ Concatenates a string array (string tokens) into a string with the specified delimiter string, token’s prefix, and token’s suffix.
Parameters: - tokens – a string array to be concatenated.
- tokenPrefix – the token’s prefix to be concatenated.
- tokenSuffix – the token’s suffix to be concatenated.
- delim – the delimiter.
Returns: the concatenated string.
contains¶
-
public static boolean
contains
(String[] tokens, String target)¶ Checks if a given string array contains the specified search string.
Parameters: - tokens – a string array to be searched.
- target – the target search string.
Returns: true if the given string array contains the specified search string, false otherwise.
getLength¶
isAllDigit¶
isEmptyString¶
isWrappedWith¶
-
public static boolean
isWrappedWith
(String s, String prefix, String suffix)¶ Checks if the given string is wrapped with the specified prefix and suffix.
Parameters: - s – the string to be checked.
- prefix – the prefix.
- suffix – the suffix.
Returns: true if the given string is wrapped with the prefix and suffix.
parseBoolean¶
parseBoolean¶
parseDouble¶
parseDouble¶
parseInt¶
parseInt¶
parseLong¶
parseLong¶
removeLeadingCharacter¶
removeLeadingSpace¶
removeLeadingZero¶
repeat¶
toArray¶
toArray¶
toArray¶
toCharArray¶
toGMTString¶
toHexString¶
toString¶
-
public static String
toString
(Throwable e)¶ Returns a string representation of the given throwable object, empty string if it is null. The resulted string contains a cause trace of the given throwable object.
Parameters: - e – the throwable object for getting its string representation.
Returns: a string represenation of the given Object.
toString¶
tokenize¶
-
public static String[]
tokenize
(String str, String delim)¶ Tokenizes a given string according to the specified delimiters. The characters in the delim argument are the delimiters for separating tokens. Delimiter characters themselves will not be treated as tokens.
Parameters: - str – a string to be parsed.
- delim – the delimiters.
Returns: the tokens in a string array.
tokenize¶
-
public static String[]
tokenize
(String str, int fixedLength)¶ Tokenizes a given string according to a fixed length. If the last token’s length is less than the fixed length specified, it will be ignored.
Parameters: - str – a string to be parsed.
- fixedLength – the fixed length.
Returns: the tokens in a string array.
trim¶
trim¶
-
public static String
trim
(String s, String prefix, String suffix)¶ Trims the given string. If the given string starts with the specified prefix and ends with the specified suffix, both the prefix and the suffix will be trimmed out.
Parameters: - s – the string to be trimmed.
- prefix – the prefix.
- suffix – the suffix.
Returns: the trimmed string.
trimAndVerifySize¶
-
public static String
trimAndVerifySize
(String s, int size)¶ Trims a given string and then verifies its size against the specified size. If the sizes do not match, null will be returned.
Parameters: - s – the string to be trimmed and verified.
- size – the size for the verification.
Returns: the trimmed string or null if the size verification failed.
UtilitiesException¶
-
public class
UtilitiesException
extends hk.hku.cecid.piazza.commons.GenericException¶ UtilitiesException represents all kinds of exception occuring in the utility functions.
Author: Hugo Y. K. Lam
Zip¶
-
public final class
Zip
¶ Zip is a tool which can compress a set of files contained in a directory into a zip file. Likewise, it can also extract a set of files compressed in a zip file to a directory.
Author: Hugo Y. K. Lam
Methods¶
compress¶
-
public static void
compress
(File toFile, File dir)¶ Compresses a set of files contained in a directory into a zip file.
Parameters: - toFile – the zip file.
- dir – the directory which contains the files to be compressed.
Throws: - UtilitiesException – if there is any error in the compression.
extract¶
-
public static void
extract
(File fromFile, File dir)¶ Extracts a set of files compressed in a zip file to a directory.
Parameters: - fromFile – the zip file.
- dir – the directory to which the files to be extracted. Current user directory will be chosen if it is null.
Throws: - UtilitiesException – if there is any error in the extraction.
hk.hku.cecid.piazza.commons.xpath¶
XPathExecutor¶
-
public class
XPathExecutor
¶ XPathExecutor is an executor which evaluates a given xpath and yields the result.
Example:
XPathExecutor exec = new XPathExecutor(getDocument("doc.xml")); exec.registerFunction("http://example.com", "sum", new MySum()); System.out.println(exec.eval( "3 + number('3') + eg:sum(3, 4, '5.1') + /values/one - 2")); // The result will be '17.1'
Author: Hugo Y. K. Lam
XPathFunction¶
-
public interface
XPathFunction
¶ XPathFunction is an interface of any customized XPath functions.
Author: Hugo Y. K. Lam
XPathFunctionsProvider¶
-
class
XPathFunctionsProvider
implements ExtensionsProvider¶ XPathFunctionsProvider implements the Apache XPath Extensions Provider. It is solely used by the XPathExecutor in building an Apache XPath Context.
Author: Hugo Y. K. Lam
Methods¶
elementAvailable¶
-
public boolean
elementAvailable
(String ns, String elemName)¶ Checks if the given element is available.
Parameters: - ns – the namespace of the element.
- elemName – the element name.
Returns: false in any way.
See also:
org.apache.xpath.ExtensionsProvider.elementAvailable(java.lang.String,java.lang.String)
extFunction¶
-
public Object
extFunction
(String ns, String funcName, Vector argVec, Object methodKey)¶ Executes the extension function.
Parameters: - ns – the namespace of the function.
- funcName – the function name.
- argVec – the function arguments.
- methodKey – the method key.
Throws: - TransformerException – if the function executed with errors or the function is not available.
Returns: the execution result.
See also:
org.apache.xpath.ExtensionsProvider.extFunction(java.lang.String,java.lang.String,java.util.Vector,java.lang.Object)
regsiterFunction¶
-
public void
regsiterFunction
(String ns, String funcName, XPathFunction func)¶ Registers a function to this provider.
Parameters: - ns – the namespace of the function.
- funcName – the function name.
- func – the function implementation.
hk.hku.cecid.piazza.corvus.admin.handler¶
AdminModuleRegistrar¶
-
public class
AdminModuleRegistrar
extends ExtensionPointIteratedHandler¶ AdminModuleRegistrar handles the registration of an admin module with the default admin pagelet adaptor.
Author: Hugo Y. K. Lam See also:
hk.hku.cecid.piazza.corvus.admin.listener.AdminPageletAdaptor
Methods¶
processExtension¶
-
public void
processExtension
(Extension extension)¶ Adds an admin module to the default admin pagelet adaptor.
Parameters: - extension – the extension which represents the module to be added.
Throws: - PluginException – if unable to add the module.
See also:
hk.hku.cecid.piazza.commons.spa.ExtensionPointHandler.processExtensions(java.util.Collection)
AdminPageletRegistrar¶
-
public class
AdminPageletRegistrar
extends ExtensionPointIteratedHandler¶ AdminPageletRegistrar handles the registration of a pagelet with the default admin pagelet adaptor.
Author: Hugo Y. K. Lam See also:
hk.hku.cecid.piazza.corvus.admin.listener.AdminPageletAdaptor
Methods¶
getPageletStore¶
-
protected PageletStore
getPageletStore
(Extension extension)¶ Gets the pagelet store this registrar manages.
Parameters: - extension – the extension being processed.
Returns: the pagelet store of the default admin pagelet adaptor.
processExtension¶
-
public void
processExtension
(Extension extension)¶ Adds a pagelet to the pagelet store that this registrar manages.
Parameters: - extension – the extension which represents the pagelet to be added.
Throws: - PluginException – if unable to add the pagelet.
See also:
hk.hku.cecid.piazza.commons.spa.ExtensionPointHandler.processExtensions(java.util.Collection)
AdminPluginHandler¶
-
public class
AdminPluginHandler
implements PluginHandler¶ AdminPluginHandler is responsible for creating a new HTTP dispatcher context for the admin dispatcher.
Author: Hugo Y. K. Lam See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpDispatcherContext
Methods¶
processActivation¶
-
public void
processActivation
(Plugin plugin)¶ Processes the admin plugin activation and creates a new HTTP dispatcher context for the admin dispatcher.
Parameters: - plugin – the plugin this handler represents.
Throws: - PluginException – if activation failed.
See also:
hk.hku.cecid.piazza.commons.spa.PluginHandler.processActivation(hk.hku.cecid.piazza.commons.spa.Plugin)
processDeactivation¶
-
public void
processDeactivation
(Plugin plugin)¶ Processes the admin plugin deactivation.
Parameters: - plugin – the plugin this handler represents.
Throws: - PluginException – if deactivation failed.
See also:
hk.hku.cecid.piazza.commons.spa.PluginHandler.processDeactivation(hk.hku.cecid.piazza.commons.spa.Plugin)
AdminRequestFilterRegistrar¶
-
public class
AdminRequestFilterRegistrar
extends HttpdRequestFilterRegistrar¶ AdminRequestFilterRegistrar handles the registration of an HTTP request filter with the admin dispatcher context.
Author: Hugo Y. K. Lam
Methods¶
getHttpdContext¶
-
protected HttpDispatcherContext
getHttpdContext
(Extension extension)¶ Gets the admin dispatcher context.
See also:
hk.hku.cecid.piazza.corvus.core.main.handler.HttpdContextRegistrar.getHttpdContext(hk.hku.cecid.piazza.commons.spa.Extension)
AdminRequestListenerRegistrar¶
-
public class
AdminRequestListenerRegistrar
extends HttpdRequestListenerRegistrar¶ AdminRequestListenerRegistrar handles the registration of an HTTP request listener with the admin dispatcher context.
Author: Hugo Y. K. Lam
Methods¶
getHttpdContext¶
-
protected HttpDispatcherContext
getHttpdContext
(Extension extension)¶ Gets the admin dispatcher context.
See also:
hk.hku.cecid.piazza.corvus.core.main.handler.HttpdContextRegistrar.getHttpdContext(hk.hku.cecid.piazza.commons.spa.Extension)
ApiRequestListenerRegistrar¶
-
public class
ApiRequestListenerRegistrar
extends HttpdRequestListenerRegistrar¶ ApiRequestListenerRegistrar handles the registration of an HTTP request listener with the API dispatcher context.
Author: Patrick Yee
Methods¶
getHttpdContext¶
-
protected HttpDispatcherContext
getHttpdContext
(Extension extension)¶ Gets the admin dispatcher context.
See also:
hk.hku.cecid.piazza.corvus.core.main.handler.HttpdContextRegistrar.getHttpdContext(hk.hku.cecid.piazza.commons.spa.Extension)
hk.hku.cecid.piazza.corvus.admin.listener¶
AdminPageletAdaptor¶
-
public class
AdminPageletAdaptor
extends BorderLayoutPageletAdaptor¶ AdminPageletAdaptor is an HTTP-XSLT pagelet adaptor. It generally serves as a main framework for the admin pages. Pages generated by this pagelet are in border layout format corresponding to the pre-defined template.
Subclasses are expected to override the getCenterSource() method and provide implementation for the generation of the transformation source which contributes to the center region of the page being rendered.
Author: Hugo Y. K. Lam
Fields¶
ATTR_MESSAGE¶
ATTR_PREFIX¶
store¶
-
public static final PageletStore
store
¶ The pagelet store of this pagelet.
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶ Gets the transformation source of the main body. This method by default generates a transformation source of the system status. Sub-classes should override this method and provide its own implementation.
Parameters: - request – the servlet request.
Returns: the transformation source of the system status.
See also:
hk.hku.cecid.piazza.commons.pagelet.xslt.BorderLayoutPageletAdaptor.getCenterSource(javax.servlet.http.HttpServletRequest)
getErrorSource¶
-
protected Source
getErrorSource
(TemplateElement element, Throwable e, HttpServletRequest request)¶ Gets transformation source which represents the error generated by any of the pagelets composing the page being generated by this pagelet.
See also:
hk.hku.cecid.piazza.commons.pagelet.xslt.HttpXsltPageletAdaptor.getErrorSource(TemplateElement,Throwable,HttpServletRequest)
getModuleId¶
-
protected String
getModuleId
(HttpServletRequest request)¶ Gets the module ID that this pagelet represents. This method will look up the listener parameter ‘module’.
Parameters: - request – the servlet request.
Returns: the module ID.
getNorthSource¶
-
protected Source
getNorthSource
(HttpServletRequest request)¶ Gets the transformation source of the menu tabs.
See also:
hk.hku.cecid.piazza.commons.pagelet.xslt.BorderLayoutPageletAdaptor.getNorthSource(javax.servlet.http.HttpServletRequest)
getPageletStore¶
-
protected PageletStore
getPageletStore
()¶
getSouthSource¶
-
protected Source
getSouthSource
(HttpServletRequest request)¶ Gets the transformation source of the message area. The source will be generated according to the message attribute.
Parameters: - request – the servlet request.
Returns: the transformation source of the message area.
See also:
.ATTR_MESSAGE
,hk.hku.cecid.piazza.commons.pagelet.xslt.BorderLayoutPageletAdaptor.getSouthSource(javax.servlet.http.HttpServletRequest)
getTabId¶
-
protected String
getTabId
(HttpServletRequest request)¶ Gets the tab ID that this pagelet represents. This method will look up the listener parameter ‘tab’.
Parameters: - request – the servlet request.
Returns: the tab ID.
getWestSource¶
-
protected Source
getWestSource
(HttpServletRequest request)¶ Gets the transformation source of the menu modules.
See also:
hk.hku.cecid.piazza.commons.pagelet.xslt.BorderLayoutPageletAdaptor.getWestSource(javax.servlet.http.HttpServletRequest)
hk.hku.cecid.piazza.corvus.core¶
Kernel¶
-
public class
Kernel
¶ Kernel is the nucleus of Piazza Corvus. It initializes the basic configuration and sets up the plugin registry. After setting up the plugin registry, it activates the plugins and extension points and then Corvus is started.
Author: Hugo Y. K. Lam
Methods¶
getInstance¶
getPluginRegistry¶
-
public PluginRegistry
getPluginRegistry
()¶ Retrieves the plugin registry managed by this kernel.
Returns: the plugin registry.
getStartupTime¶
hk.hku.cecid.piazza.corvus.core.main.admin¶
AdminMainProcessor¶
-
public class
AdminMainProcessor
implements PluginHandler¶ The plugin handler for the Admin Main module plugin
Author: Joel Matsumoto
hk.hku.cecid.piazza.corvus.core.main.admin.hc.module¶
NeoSchedulerTask¶
-
public class
NeoSchedulerTask
extends SchedulerTask¶
Methods¶
cleanAS2¶
-
protected Transaction
cleanAS2
(int months)¶
NeoSchedulerTaskList¶
-
public class
NeoSchedulerTaskList
extends SchedulerTaskList¶
SchedulerTask¶
-
public class
SchedulerTask
implements ActiveTask¶
Fields¶
Methods¶
cleanAS2¶
-
protected Transaction
cleanAS2
(int months)¶ Attempt to clean out the AS2 database
Parameters: - months –
Throws:
cleanEBMS¶
-
protected Transaction
cleanEBMS
(int months)¶ Attempt to clean the EBMS messages.
Parameters: - months –
Throws:
getNextRunDateFromNow¶
setNextRunDateFromNow¶
-
public boolean
setNextRunDateFromNow
(AdminProperties properties)¶
hk.hku.cecid.piazza.corvus.core.main.admin.hc.util¶
AdminProperties¶
-
public class
AdminProperties
¶ A class to wrap the admin.main properties file for easier handling.
Author: Joel Matsumoto
Fields¶
Constructors¶
AdminProperties¶
-
public
AdminProperties
(PropertyTree tree)¶
Methods¶
getCutoff¶
-
public int
getCutoff
()¶ Return the ‘cutoff’ property if set, else if null or invalid, throw an exception.
Throws: Returns: int
getDay¶
-
public int
getDay
()¶ Return the ‘day’ property or throw an exception if an invalid integer
Throws: Returns: int
getEmail¶
getLastRun¶
getNextRun¶
getPort¶
-
public int
getPort
()¶ Return the ‘port’ property if set or throw an exception if null/invalid. If the value is not set, will return the deafult, 25;
Throws: Returns: int
getReason¶
getSmtp¶
getStatus¶
getUsername¶
isOn¶
-
public boolean
isOn
()¶ Return a boolean depending on if the value is set to ON/OFF or return false if none set/null/invalid.
Returns: boolean
setLastRun¶
setNextRun¶
setUsername¶
AdminPropertiesException¶
hk.hku.cecid.piazza.corvus.core.main.admin.listener¶
CorePropertiesPageletAdaptor¶
-
public class
CorePropertiesPageletAdaptor
extends PropertiesPageletAdaptor¶ CorePropertiesPageletAdaptor is a properties pagelet adaptor which provides an admin function of the core system properties.
Author: Hugo Y. K. Lam
Methods¶
addHouseCleaning¶
-
protected PropertyTree
addHouseCleaning
(HttpServletRequest request, PropertyTree dom)¶ Add the housecleaning data to the XSL tranformation.
Parameters: - request –
- dom –
Returns: PropertyTree
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶
getProperties¶
-
protected PropertySheet
getProperties
()¶ Gets the core system properties.
Returns: the core system properties. See also:
hk.hku.cecid.piazza.corvus.core.main.admin.listener.PropertiesPageletAdaptor.getProperties()
HttpdPageletAdaptor¶
-
public class
HttpdPageletAdaptor
extends AdminPageletAdaptor¶ HttpdPageletAdaptor is an admin pagelet adaptor which provides an admin function of the default HTTP dispatcher.
Author: Hugo Y. K. Lam
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶ Generates the transformation source of the default HTTP dispatcher.
See also:
hk.hku.cecid.piazza.corvus.admin.listener.AdminPageletAdaptor.getCenterSource(javax.servlet.http.HttpServletRequest)
ModuleInfoPageletAdaptor¶
-
public class
ModuleInfoPageletAdaptor
extends AdminPageletAdaptor¶ ModuleInfoPageletAdaptor is an admin pagelet adaptor which provides an admin function of the system modules.
Author: Hugo Y. K. Lam
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶ Generates the transformation source of the system modules.
See also:
hk.hku.cecid.piazza.corvus.admin.listener.AdminPageletAdaptor.getCenterSource(javax.servlet.http.HttpServletRequest)
PluginRegistryPageletAdaptor¶
-
public class
PluginRegistryPageletAdaptor
extends AdminPageletAdaptor¶ PluginRegistryPageletAdaptor is an admin pagelet adaptor which provides an admin function of the plugin registry.
Author: Hugo Y. K. Lam
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶ Generates the transformation source of the plugin regsitry.
See also:
hk.hku.cecid.piazza.corvus.admin.listener.AdminPageletAdaptor.getCenterSource(javax.servlet.http.HttpServletRequest)
PropertiesPageletAdaptor¶
-
public class
PropertiesPageletAdaptor
extends AdminPageletAdaptor¶ PropertiesPageletAdaptor is an admin pagelet adaptor which provides an admin function of the JVM properties. Subclasses can override the getProperties() method and return a compatible properties object for sharing the same admin function.
Author: Hugo Y. K. Lam
Methods¶
getCenterSource¶
-
protected Source
getCenterSource
(HttpServletRequest request)¶ Generates the transformation source of the properties.
See also:
hk.hku.cecid.piazza.corvus.admin.listener.AdminPageletAdaptor.getCenterSource(javax.servlet.http.HttpServletRequest)
getProperties¶
-
protected PropertySheet
getProperties
()¶ Gets the properties that this adaptor administrates.
Returns: the JVM properties.
getPropertiesForDisplayAndUpdate¶
-
protected PropertyTree
getPropertiesForDisplayAndUpdate
(HttpServletRequest request, PropertyTree dom)¶
hk.hku.cecid.piazza.corvus.core.main.handler¶
HttpdContextListenerRegistrar¶
-
public class
HttpdContextListenerRegistrar
extends HttpdContextRegistrar¶ HttpdContextListenerRegistrar handles the registration of an HTTP dispatcher context listener with the default HTTP dispatcher context.
Author: Hugo Y. K. Lam
Methods¶
processExtension¶
-
public void
processExtension
(Extension extension)¶ Adds an HTTP dispatcher context listener to the default HTTP dispatcher context.
Parameters: - extension – the extension which represents the listener.
Throws: - PluginException – if unable to add the context listener.
See also:
hk.hku.cecid.piazza.commons.spa.ExtensionPointHandler.processExtensions(java.util.Collection)
HttpdContextRegistrar¶
-
public abstract class
HttpdContextRegistrar
extends ExtensionPointIteratedHandler¶ HttpdContextRegistrar is a generic registrar for any extension point handler which handles reqistration, or alike, with an HTTP dispatcher context.
Author: Hugo Y. K. Lam
Methods¶
getHttpdContext¶
-
protected HttpDispatcherContext
getHttpdContext
(Extension extension)¶ Gets the HTTP dispatcher context this registrar manages.
Parameters: - extension – the extension being processed.
Returns: the default HTTP dispatcher context.
HttpdRequestFilterRegistrar¶
-
public class
HttpdRequestFilterRegistrar
extends HttpdContextRegistrar¶ HttpdRequestFilterRegistrar handles the registration of an HTTP request filter with the default HTTP dispatcher context.
Author: Hugo Y. K. Lam
Methods¶
processExtension¶
-
public void
processExtension
(Extension extension)¶ Adds an HTTP request filter to the default HTTP dispatcher context.
Parameters: - extension – the extension which represents the filter.
Throws: - PluginException – if unable to add the request filter.
See also:
hk.hku.cecid.piazza.commons.spa.ExtensionPointHandler.processExtensions(java.util.Collection)
HttpdRequestListenerRegistrar¶
-
public class
HttpdRequestListenerRegistrar
extends HttpdContextRegistrar¶ HttpdRequestListenerRegistrar handles the registration of an HTTP request listener with the default HTTP dispatcher context.
Author: Hugo Y. K. Lam
Methods¶
processExtension¶
-
public void
processExtension
(Extension extension)¶ Adds an HTTP request listener to the default HTTP dispatcher context.
Parameters: - extension – the extension which represents the listener.
Throws: - PluginException – if unable to add the request listener.
See also:
hk.hku.cecid.piazza.commons.spa.ExtensionPointHandler.processExtensions(java.util.Collection)
RemoteCommandRegistrar¶
-
public class
RemoteCommandRegistrar
extends ExtensionPointIteratedHandler¶ RemoteCommandRegistrar handles the registration of any remote command with the central remote command handler.
Author: Hugo Y. K. Lam
Methods¶
processExtension¶
-
public void
processExtension
(Extension extension)¶ Adds a remote command to the central remote command handler.
Parameters: - extension – the extension which represents the remote command.
Throws: - PluginException – if unable to add the remote command.
See also:
hk.hku.cecid.piazza.commons.spa.ExtensionPointHandler.processExtensions(java.util.Collection)
hk.hku.cecid.piazza.corvus.core.main.listener¶
HttpProxyListener¶
-
public class
HttpProxyListener
extends HttpRequestAdaptor¶ HttpProxyListener is an HTTP request listener which serves as a simple HTTP proxy handler. It does not support HTTPS nor caching.
Author: Hugo Y. K. Lam
Methods¶
processRequest¶
-
public String
processRequest
(HttpServletRequest request, HttpServletResponse response)¶ Perform a simple HTTP proxy operation. No caching will be provided.
See also:
hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.processRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
WSPingService¶
-
public class
WSPingService
extends WebServicesAdaptor¶ WSPingService is a simple web service which provides a ping-pong function.
Author: Hugo Y. K. Lam
Methods¶
serviceRequested¶
-
public SOAPElement[]
serviceRequested
(SOAPElement[] bodies)¶ Processes the web service ping and replies with a pong message.
Throws: - SOAPRequestException – if unable to process the ping request.
hk.hku.cecid.piazza.corvus.core.servlet¶
StartupServlet¶
-
public class
StartupServlet
extends HttpServlet¶ StartupServlet is the main startup servlet of Corvus. It will initialize the Corvus kernel once the servlet is being initialized.
Author: Hugo Y. K. Lam
Methods¶
destroy¶
-
public void
destroy
()¶ Invoked when the servlet is out of service.
See also:
javax.servlet.Servlet.destroy()
init¶
-
public void
init
(ServletConfig config)¶ Initializes the servlet.
See also:
javax.servlet.Servlet.init(javax.servlet.ServletConfig)