String internalSequenceID = getInternalSequenceIdFromServiceClient(serviceClient);
ServiceContext serviceContext = serviceClient.getServiceContext();
if (serviceContext == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.serviceContextNotSet));
ConfigurationContext configurationContext = serviceContext.getConfigurationContext();
SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
if (sequenceReport == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.cannotFindReportForGivenData, serviceClient.toString()));
if (sequenceReport.getSequenceStatus() != SequenceReport.SEQUENCE_STATUS_ESTABLISHED) {
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.noSequenceEstablished,
internalSequenceID));
}
StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());
// Get a transaction to retrieve the properties
Transaction transaction = null;
String sequenceID = null;
try
{
transaction = storageManager.getTransaction();
sequenceID = SandeshaUtil.getSequenceIDFromInternalSequenceID(internalSequenceID, storageManager);
}
finally
{
// Commit the transaction as it was only a retrieve
if(transaction != null) transaction.commit();
}
if (sequenceID == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.sequenceIdBeanNotSet));
return sequenceID;
}