Update of /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/handler
In directory sc8-pr-cvs1:/tmp/cvs-serv847/src/hk/hku/cecid/phoenix/message/handler
Modified Files:
Command.java MessageServer.java MessageServiceHandler.java
MessageServiceHandlerConnection.java
RepositoryPersistenceHandler.java
Log Message:
Change the MSH to support Customize Persistence Handler.
However, haven't changed the code on backup, archive and export yet.
Index: Command.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/handler/Command.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** Command.java 11 Dec 2003 06:41:29 -0000 1.22
--- Command.java 13 Jan 2004 10:41:58 -0000 1.23
***************
*** 71,80 ****
import hk.hku.cecid.phoenix.message.packaging.EbxmlMessage;
import java.io.File;
- import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Iterator;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
--- 71,82 ----
import hk.hku.cecid.phoenix.message.packaging.EbxmlMessage;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+ import java.io.OutputStream;
import java.io.Serializable;
import java.util.Iterator;
+
+ import javax.activation.DataSource;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
***************
*** 305,309 ****
--- 307,313 ----
String fileName = null;
+ OutputStream ostream = null;
try {
+ /*
fileName = DirectoryManager.getRepositoryFileName(messageId);
FileOutputStream fos = new FileOutputStream(fileName);
***************
*** 316,319 ****
--- 320,339 ----
ebxmlMessage = MessageServer.getMessageFromFile
(new File(fileName));
+ */
+ PersistenceHandler handler =
+ PersistenceManager.getRepositoryPersistenceHandler();
+ DataSource dataSource = handler.createNewObject();
+ fileName = dataSource.getName();
+ ostream = dataSource.getOutputStream();
+ byte[] buffer = new byte[65536];
+ int read = ois.read(buffer);
+ while (read != -1) {
+ ostream.write(buffer, 0, read);
+ read = ois.read(buffer);
+ }
+ ebxmlMessage = (EbxmlMessage)
+ MessageServer.getMessageFromDataSource(dataSource,
+ true);
+ ebxmlMessage.setPersistenceInfo(fileName, handler);
MimeHeaders headers = ebxmlMessage.getSOAPMessage().
getMimeHeaders();
***************
*** 324,329 ****
}
}
! }
! catch (Exception e) {
if (fileName != null) {
try {
--- 344,349 ----
}
}
! } catch (Exception e) {
! /*
if (fileName != null) {
try {
***************
*** 336,341 ****
--- 356,365 ----
System.err.println(e2.getMessage());
}
+ }*/
+ if (fileName != null) {
+
}
throw new IOException(e.getMessage());
+ } finally {
}
}
Index: MessageServer.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/handler/MessageServer.java,v
retrieving revision 1.145
retrieving revision 1.146
diff -C2 -d -r1.145 -r1.146
*** MessageServer.java 5 Jan 2004 11:24:08 -0000 1.145
--- MessageServer.java 13 Jan 2004 10:41:58 -0000 1.146
***************
*** 1143,1146 ****
--- 1143,1147 ----
String fileName = resultSet.getString
(DbTableManager.ATTRIBUTE_FILE_NAME);
+ /*
fileName = fileName.replace('\\', File.separatorChar);
fileName = fileName.replace('/', File.separatorChar);
***************
*** 1158,1161 ****
--- 1159,1167 ----
refToMessage = getMessageFromFile(pathName);
+ */
+ PersistenceHandler handler
+ = PersistenceManager.getRepositoryPersistenceHandler();
+ refToMessage = (EbxmlMessage) getMessageFromDataSource(
+ handler.getObject(fileName), true);;
} catch (MessageServerException e) {
exception = e;
***************
*** 2157,2161 ****
/**
! * Description of the Method
*
* @param ebxmlMessage Description of the Parameter
--- 2163,2167 ----
/**
! * Store the states for the EbxmlMessage
*
* @param ebxmlMessage Description of the Parameter
***************
*** 2167,2171 ****
* @throws MessageServerException Description of the Exception
*/
! String store(EbxmlMessage ebxmlMessage, ApplicationContext appContext,
int state, boolean isDelivered, Transaction tx)
throws MessageServerException {
--- 2173,2177 ----
* @throws MessageServerException Description of the Exception
*/
! void store(EbxmlMessage ebxmlMessage, ApplicationContext appContext,
int state, boolean isDelivered, Transaction tx)
throws MessageServerException {
***************
*** 2180,2188 ****
}
logger.debug("final sequence number in store: " + seqNo);
! return store(ebxmlMessage, appContext, state, seqNo, tx);
}
/**
! * Description of the Method
*
* @param ebxmlMessage Description of the Parameter
--- 2186,2194 ----
}
logger.debug("final sequence number in store: " + seqNo);
! store(ebxmlMessage, appContext, state, seqNo, tx);
}
/**
! * Store the states for the EbxmlMessage
*
* @param ebxmlMessage Description of the Parameter
***************
*** 2194,2198 ****
* @throws MessageServerException Description of the Exception
*/
! String store(EbxmlMessage ebxmlMessage, ApplicationContext appContext,
int state, int sequenceNumber, Transaction tx)
throws MessageServerException {
--- 2200,2204 ----
* @throws MessageServerException Description of the Exception
*/
! void store(EbxmlMessage ebxmlMessage, ApplicationContext appContext,
int state, int sequenceNumber, Transaction tx)
throws MessageServerException {
***************
*** 2222,2225 ****
--- 2228,2233 ----
ResultSet resultSet = null;
Exception exception = null;
+ PersistenceHandler handler
+ = PersistenceManager.getRepositoryPersistenceHandler();
try {
if (refToMessageId != null) {
***************
*** 2243,2246 ****
--- 2251,2255 ----
PreparedStatement[] actions;
if (!resultSet.next()) {
+ /*
fileName = ebxmlMessage.getFileName();
if (fileName == null) {
***************
*** 2258,2262 ****
String fileNameInDB = fileName.substring(
messageRepoPath.length());
!
logger.debug("insert into messagestore database");
insert = DbTableManager.DBTABLE_MESSAGE_STORE.getInsertQuery
--- 2267,2293 ----
String fileNameInDB = fileName.substring(
messageRepoPath.length());
! */
! fileName = ebxmlMessage.getPersistenceName();
! if (fileName == null) {
! logger.debug("Message haven't persisted");
! DataSource dataSource = handler.createNewObject();
! fileName = dataSource.getName();
! logger.debug("Try to persist to " + fileName);
! OutputStream ostream = null;
! try {
! ostream = dataSource.getOutputStream();
! ebxmlMessage.writeTo(ostream);
! } catch (Exception e) {
! throw e;
! } finally {
! if (ostream != null) {
! ostream.close();
! }
! }
! logger.debug("Message Persisted to " + fileName
! + " on persitence handler");
! ebxmlMessage.setPersistenceInfo(fileName, handler);
! }
! String fileNameInDB = fileName;
logger.debug("insert into messagestore database");
insert = DbTableManager.DBTABLE_MESSAGE_STORE.getInsertQuery
***************
*** 2300,2304 ****
infoinsert =
! DbTableManager.DBTABLE_MESSAGE_INFO.getInsertQuery(tx.getConnection(),
new String[]{
DbTableManager.ATTRIBUTE_MESSAGE_ID,
--- 2331,2336 ----
infoinsert =
! DbTableManager.DBTABLE_MESSAGE_INFO.getInsertQuery(
! tx.getConnection(),
new String[]{
DbTableManager.ATTRIBUTE_MESSAGE_ID,
***************
*** 2315,2319 ****
if (state == STATE_SENT_STARTED) {
sendingStateInsert =
! DbTableManager.DBTABLE_SENDING_STATE.getInsertQuery(tx.getConnection(), new String[]
{DbTableManager.ATTRIBUTE_MESSAGE_ID,
DbTableManager.ATTRIBUTE_CURRENT_RETRY,
--- 2347,2352 ----
if (state == STATE_SENT_STARTED) {
sendingStateInsert =
! DbTableManager.DBTABLE_SENDING_STATE.getInsertQuery(
! tx.getConnection(), new String[]
{DbTableManager.ATTRIBUTE_MESSAGE_ID,
DbTableManager.ATTRIBUTE_CURRENT_RETRY,
***************
*** 2379,2383 ****
new String[]{messageId});
actions = new PreparedStatement[]{update};
! fileName = messageRepository + File.separator + fileName;
}
tx.executeUpdate(actions);
--- 2412,2416 ----
new String[]{messageId});
actions = new PreparedStatement[]{update};
! //fileName = messageRepository + File.separator + fileName;
}
tx.executeUpdate(actions);
***************
*** 2429,2448 ****
throw new MessageServerException(exception.getMessage());
}
!
if (ebxmlMessage.getFileName() == null) {
ebxmlMessage.setFileName(fileName);
}
}
logger.debug("<= MessageServer.store");
- return fileName;
}
/**
! * Description of the Method
*
! * @param mshConfig Description of the Parameter
! * @param tx Description of the Parameter
! * @throws MessageServerException Description of the Exception
*/
void store(MessageServiceHandlerConfig mshConfig, Transaction tx)
--- 2462,2484 ----
throw new MessageServerException(exception.getMessage());
}
! /*
if (ebxmlMessage.getFileName() == null) {
ebxmlMessage.setFileName(fileName);
+ }*/
+ if (ebxmlMessage.getPersistenceName() == null) {
+ ebxmlMessage.setPersistenceInfo(fileName, handler);
}
}
logger.debug("<= MessageServer.store");
}
/**
! * Update the database status on the msh config.
*
! * @param mshConfig The message service handler config
! * @param tx the transaction for this updating
! * @throws MessageServerException throw if there is error on udpating
! * the msh config
*/
void store(MessageServiceHandlerConfig mshConfig, Transaction tx)
***************
*** 2697,2700 ****
--- 2733,2743 ----
final MessageListener messageListener;
try {
+ logger.debug("loading object store with object name : "
+ + objectName);
+ DataSource source = handler.getObject(objectName);
+ if (source == null) {
+ throw new Exception("Cannot load the objectName : "
+ + objectName);
+ }
stream = handler.getObject(objectName).getInputStream();
objStream = new ObjectInputStream(stream);
***************
*** 3236,3239 ****
--- 3279,3283 ----
String fileName =
resultSet.getString(DbTableManager.ATTRIBUTE_FILE_NAME);
+ /*
fileName = fileName.replace('\\', File.separatorChar);
fileName = fileName.replace('/', File.separatorChar);
***************
*** 3248,3256 ****
}
final EbxmlMessage ebxmlMessage = getMessageFromFile(pathName);
! int currentRetry =
! resultSet.getInt(DbTableManager.ATTRIBUTE_CURRENT_RETRY);
! final long nextRetryTime =
! resultSet.getLong(DbTableManager.ATTRIBUTE_NEXT_RETRY_TIME);
final int retries = mshConfig.getRetries();
final long retryInterval =
--- 3292,3314 ----
}
final EbxmlMessage ebxmlMessage = getMessageFromFile(pathName);
+ */
+ PersistenceHandler handler
+ = PersistenceManager.getRepositoryPersistenceHandler();
+ DataSource dataSource = handler.getObject(fileName);
+ if (dataSource == null) {
+ String err = ErrorMessages.getMessage(
+ ErrorMessages.ERR_HERMES_UNKNOWN_ERROR,
+ "Cannot restore persisted message "
+ + "with messsage id <" + messageId + ">");
+ logger.error(err);
+ throw new MessageServerException(err);
+ }
+ final EbxmlMessage ebxmlMessage = (EbxmlMessage)
+ getMessageFromDataSource(dataSource, true);
! int currentRetry = resultSet.getInt(
! DbTableManager.ATTRIBUTE_CURRENT_RETRY);
! final long nextRetryTime = resultSet.getLong(
! DbTableManager.ATTRIBUTE_NEXT_RETRY_TIME);
final int retries = mshConfig.getRetries();
final long retryInterval =
Index: MessageServiceHandler.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/handler/MessageServiceHandler.java,v
retrieving revision 1.182
retrieving revision 1.183
diff -C2 -d -r1.182 -r1.183
*** MessageServiceHandler.java 5 Jan 2004 09:57:43 -0000 1.182
--- MessageServiceHandler.java 13 Jan 2004 10:41:58 -0000 1.183
***************
*** 112,115 ****
--- 112,116 ----
import java.util.Stack;
import java.util.StringTokenizer;
+ import javax.activation.DataSource;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
***************
*** 637,646 ****
--- 638,656 ----
ArrayList results = msh.getUndeliveredMessages(
appContext, false);
+ PersistenceHandler handler
+ = PersistenceManager.getRepositoryPersistenceHandler();
for (int i=0 ; i<results.size() ; i++) {
tx = null;
try {
+ /*
String fileName = (String) results.get(i);
EbxmlMessage ebxmlMessage = MessageServer.
getMessageFromFile(new File(fileName));
+ */
+ String fileName = (String) results.get(i);
+ DataSource source = handler.getObject(fileName);
+ EbxmlMessage ebxmlMessage = (EbxmlMessage)
+ MessageServer.getMessageFromDataSource(
+ source, true);
messageListener.onMessage(ebxmlMessage);
tx = new Transaction(MessageServer.dbConnectionPool);
***************
*** 997,1000 ****
--- 1007,1011 ----
configure(prop);
logger.debug("=> MessageServiceHandler.MessageServiceHandler");
+ PersistenceManager.configure(prop);
DirectoryManager.configure(prop);
DirectoryManager.initObjects();
***************
*** 1005,1009 ****
HttpSender.configure(prop);
MailSender.configure(prop);
- PersistenceManager.configure(prop);
String className = prop.get(Constants.PROPERTY_CONFIG_LOCAL);
--- 1016,1019 ----
***************
*** 1560,1572 ****
try {
clientUrl = new URL(MessageListener.PROTOCOL_FILE +
MessageListener.PROTOCOL_SEPARATOR + messageRepository);
}
catch (MalformedURLException e) {
String err = ErrorMessages.getMessage(
ErrorMessages.ERR_HERMES_REGISTRATION_FAILED, e,
! "malformed URL: " + MessageListener.PROTOCOL_FILE
+ MessageListener.PROTOCOL_SEPARATOR
! + messageRepository);
logger.warn(err);
throw new MessageServiceHandlerException(err);
--- 1570,1586 ----
try {
+ /*
clientUrl = new URL(MessageListener.PROTOCOL_FILE +
MessageListener.PROTOCOL_SEPARATOR + messageRepository);
+ */
+ clientUrl = (new File(".")).toURL();
}
catch (MalformedURLException e) {
String err = ErrorMessages.getMessage(
ErrorMessages.ERR_HERMES_REGISTRATION_FAILED, e,
! "malformed URL: .");
! /* + MessageListener.PROTOCOL_FILE
+ MessageListener.PROTOCOL_SEPARATOR
! + messageRepository); */
logger.warn(err);
throw new MessageServiceHandlerException(err);
***************
*** 1765,1768 ****
--- 1779,1783 ----
}
catch (Exception e) {
+ /*
if (ebxmlMessage.getFileName() != null) {
try {
***************
*** 1777,1780 ****
--- 1792,1805 ----
logger.error(err);
}
+ }*/
+ if (ebxmlMessage.getPersistenceName() != null) {
+ try {
+ ebxmlMessage.getPersistenceHandler().removeObject(
+ ebxmlMessage.getPersistenceName());
+ } catch (Exception e2) {
+ String err = ErrorMessages.getMessage(
+ ErrorMessages.ERR_HERMES_UNKNOWN_ERROR, e2);
+ logger.error(err);
+ }
}
if (e instanceof MessageServiceHandlerException) {
***************
*** 1790,1796 ****
--- 1815,1827 ----
Transaction tx = new Transaction(MessageServer.dbConnectionPool);
+ /*
if (ebxmlMessage.getFileName() != null) {
tx.storeFileName(ebxmlMessage.getFileName());
}
+ */
+ if (ebxmlMessage.getPersistenceName() != null) {
+ tx.storePersistenceObject(ebxmlMessage.getPersistenceName(),
+ ebxmlMessage.getPersistenceHandler());
+ }
try {
mshConnection.send(ebxmlMessage, tx);
***************
*** 1944,1949 ****
--- 1975,1987 ----
return;
}
+ /*
EbxmlMessage ebxmlMessage = MessageServer.getMessageFromFile
(new File(messageRepository, fileName));
+ */
+ PersistenceHandler handler
+ = PersistenceManager.getRepositoryPersistenceHandler();
+ EbxmlMessage ebxmlMessage = (EbxmlMessage)
+ MessageServer.getMessageFromDataSource(
+ handler.getObject(fileName), true);
boolean shouldBeDelivered = true;
if (ebxmlMessage.getMessageOrder() != null) {
***************
*** 2404,2412 ****
String messageId = null;
! File messageFile = null;
final Map map = messageServer.getUndeliveredMessages
(appContext, tx);
final Set keys = map.keySet();
Iterator iter = keys.iterator();
while (iter.hasNext()) {
--- 2442,2453 ----
String messageId = null;
! //File messageFile = null;
! DataSource messageDataSource = null;
final Map map = messageServer.getUndeliveredMessages
(appContext, tx);
final Set keys = map.keySet();
Iterator iter = keys.iterator();
+ PersistenceHandler handler
+ = PersistenceManager.getRepositoryPersistenceHandler();
while (iter.hasNext()) {
***************
*** 2420,2424 ****
if (seqNo >= MessageServer.FIRST_MESSAGE_UNDELIVERED &&
seqNo < MessageServer.FIRST_MESSAGE_ORDER_UNDELIVERED) {
! messageFile = new File(messageRepository, fileName);
seqNo = messageServer.setFileDeliveryStatus
(fileName, true, tx);
--- 2461,2466 ----
if (seqNo >= MessageServer.FIRST_MESSAGE_UNDELIVERED &&
seqNo < MessageServer.FIRST_MESSAGE_ORDER_UNDELIVERED) {
! //messageFile = new File(messageRepository, fileName);
! messageDataSource = handler.getObject(fileName);
seqNo = messageServer.setFileDeliveryStatus
(fileName, true, tx);
***************
*** 2432,2436 ****
}
if (record.isNext(seqNo)) {
! messageFile = new File(messageRepository, fileName);
messageServer.setFileDeliveryStatus
(fileName, true, tx);
--- 2474,2479 ----
}
if (record.isNext(seqNo)) {
! //messageFile = new File(messageRepository, fileName);
! messageDataSource = handler.getObject(fileName);
messageServer.setFileDeliveryStatus
(fileName, true, tx);
***************
*** 2452,2464 ****
}
}
!
if (messageFile == null) {
logger.debug("<= MessageServiceHandler."
+ "getNextUndeliveredMessage with no message");
return null;
}
// Message found. Internalize the message and return
! EbxmlMessage msg = MessageServer.getMessageFromFile(messageFile);
if (msg == null) {
logger.debug("<= MessageServiceHandler."
--- 2495,2515 ----
}
}
! /*
if (messageFile == null) {
logger.debug("<= MessageServiceHandler."
+ "getNextUndeliveredMessage with no message");
return null;
+ }*/
+ if (messageDataSource == null ) {
+ logger.debug("<= MessageServiceHandler."
+ + "getNextUndeliveredMessage with no message");
+ return null;
}
// Message found. Internalize the message and return
! //EbxmlMessage msg = MessageServer.getMessageFromFile(messageFile);
! EbxmlMessage msg = (EbxmlMessage)
! MessageServer.getMessageFromDataSource(messageDataSource,
! true);
if (msg == null) {
logger.debug("<= MessageServiceHandler."
***************
*** 3635,3639 ****
throws MessageServiceHandlerException {
!
try {
ApplicationContext appContext = null;
--- 3686,3690 ----
throws MessageServiceHandlerException {
! logger.debug("=> MessageServiceHandler.processCommand");
try {
ApplicationContext appContext = null;
***************
*** 3726,3729 ****
--- 3777,3781 ----
monitor.endRequest();
}
+ logger.debug("<= MessageServiceHandler.processCommand");
return;
}
***************
*** 3768,3771 ****
--- 3820,3824 ----
}
catch (IOException e) {};
+ logger.debug("<= MessageServiceHandler.processCommand");
return;
}
***************
*** 3776,3779 ****
--- 3829,3833 ----
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
}
+ logger.debug("<= MessageServiceHandler.processCommand");
return;
}
***************
*** 3908,3911 ****
--- 3962,3966 ----
getMessage(appContext, response);
monitor.endRequest();
+ logger.debug("<= MessageServiceHandler.processCommand");
return;
case CommandConstants.GET_MESSAGE_ID:
***************
*** 3914,3917 ****
--- 3969,3973 ----
getUndeliveredMessageIds(appContext, response);
monitor.endRequest();
+ logger.debug("<= MessageServiceHandler.processCommand");
return;
case CommandConstants.GET_MESSAGE_BY_ID:
***************
*** 3921,3924 ****
--- 3977,3981 ----
getMessageById(messageId, response);
monitor.endRequest();
+ logger.debug("<= MessageServiceHandler.processCommand");
return;
case CommandConstants.QUERY_RESET_SEQUENCE_NUMBER:
***************
*** 3998,4001 ****
--- 4055,4059 ----
}
monitor.endRequest();
+ logger.debug("<= MessageServiceHandler.processCommand");
return;
}
***************
*** 4213,4216 ****
--- 4271,4275 ----
EbxmlMessage ebxmlMessage = new EbxmlMessage(soapMessage);
+ /*
File newFile = new File(DirectoryManager.getRepositoryFileName
(ebxmlMessage.getMessageId()));
***************
*** 4224,4233 ****
renamed = false;
}
soapMessage = null;
ebxmlMessage = null;
try {
- ebxmlMessage = MessageServer.getMessageFromFile(newFile);
if (!renamed) {
ebxmlMessage.setFileName(null);
}
}
--- 4283,4332 ----
renamed = false;
}
+ */
+ boolean renamed = true;
+ OutputStream ostream = null;
+ InputStream istream = null;
+ DataSource dataSource = null;
+ PersistenceHandler handler
+ = PersistenceManager.getRepositoryPersistenceHandler();
+ try {
+ dataSource = handler.createNewObject();
+ ostream = dataSource.getOutputStream();
+ istream = new FileInputStream(fileName);
+ byte[] buffer = new byte[2048];
+ int read = istream.read(buffer);
+ while (read != -1) {
+ ostream.write(buffer, 0, read);
+ read = istream.read(buffer);
+ }
+ logger.debug("Persist message to " + dataSource.getName()
+ + " on persistence handler");
+ renamed = true;
+ } catch (Exception e) {
+ if (dataSource != null) {
+ handler.removeObject(dataSource.getName());
+ }
+ throw e;
+ } finally {
+ if (ostream != null) {
+ ostream.close();
+ }
+ if (istream != null) {
+ istream.close();
+ }
+ }
soapMessage = null;
ebxmlMessage = null;
try {
if (!renamed) {
+ ebxmlMessage = MessageServer.getMessageFromFile(
+ new File(fileName));
ebxmlMessage.setFileName(null);
+ } else {
+ ebxmlMessage = (EbxmlMessage)
+ MessageServer.getMessageFromDataSource(dataSource,
+ true);
+ ebxmlMessage.setPersistenceInfo(dataSource.getName(),
+ handler);
}
}
Index: MessageServiceHandlerConnection.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/handler/MessageServiceHandlerConnection.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** MessageServiceHandlerConnection.java 11 Dec 2003 06:41:29 -0000 1.25
--- MessageServiceHandlerConnection.java 13 Jan 2004 10:41:58 -0000 1.26
***************
*** 72,76 ****
import hk.hku.cecid.phoenix.message.packaging.EbxmlMessage;
import hk.hku.cecid.phoenix.message.packaging.EbxmlMessageFactory;
- import java.io.File;
import javax.xml.messaging.JAXMException;
import javax.xml.messaging.ProviderConnection;
--- 72,75 ----
***************
*** 268,271 ****
--- 267,271 ----
try {
+ /*
boolean stored = (ebxmlMessage.getFileName() != null ?
true : false);
***************
*** 282,285 ****
--- 282,306 ----
new MessageProcessor(MessageServer.getMessageFromFile
(new File(ebxmlMessage.getFileName())), mshConfig, msh));
+ */
+ String persistenceName = ebxmlMessage.getPersistenceName();
+ try {
+ messageServer.store(ebxmlMessage, mshConfig.
+ getApplicationContext(), MessageServer.STATE_SENT_STARTED,
+ true, tx);
+ }
+ catch (MessageServerException e) {
+ throw e;
+ }
+ MessageProcessor messageProcessor;
+ if (persistenceName != null) {
+ messageProcessor = new MessageProcessor(
+ (EbxmlMessage) MessageServer.getMessageFromDataSource(
+ ebxmlMessage.getPersistenceHandler().getObject(
+ persistenceName) , true),
+ mshConfig, msh);
+ } else {
+ messageProcessor = new MessageProcessor(ebxmlMessage,
+ mshConfig, msh);
+ }
msh.addSendThread(ebxmlMessage.getMessageId(), messageProcessor);
//messageProcessor.start();
Index: RepositoryPersistenceHandler.java
===================================================================
RCS file: /cvsroot/ebxmlms/ebxmlms/src/hk/hku/cecid/phoenix/message/handler/RepositoryPersistenceHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RepositoryPersistenceHandler.java 3 Jan 2004 09:53:40 -0000 1.2
--- RepositoryPersistenceHandler.java 13 Jan 2004 10:41:58 -0000 1.3
***************
*** 225,229 ****
try {
File resultFile = createUniqueFile(curSubDirectory, "message");
! return directoryName + File.separatorChar + resultFile.getName();
} catch (IOException e) {
throw new PersistenceException(e);
--- 225,230 ----
try {
File resultFile = createUniqueFile(curSubDirectory, "message");
! return curSubDirectory.getName()
! + File.separatorChar + resultFile.getName();
} catch (IOException e) {
throw new PersistenceException(e);
|