{
sendMessage = true;
}
else if (onEmpty.equals(Constants.READ_ERROR))
{
throw new XException(Constants.LOCATION_EXTERN,
Constants.LAYER_APPLICATION,
Constants.PACKAGE_APPLICATION_ADAPTER, "4");
}
}
if (sendMessage)
{
// Send the message to the destination system
// The message is already transformed and must only be
// retrieved.
// Structure information for message serialisation is due to
// the
// destination system.
TextSender textsender = (TextSender) sender;
String resData = textsender.execute(message.getFunction(),
request);
((TextMessage) message).setResponseText(resData,
destination);
message.setResponseTimestamp(new Date());
}
}
else if (Constants.TYPE_OBJECT.equals(senderType))
{
boolean sendMessage = true;
Object request = ((ObjectMessage) message)
.getRequestObject(destination);
if (isEmpty(request))
{
String onEmpty = retrieveOnEmpty(destination.getName(),
true);
if (onEmpty.equals(Constants.READ_IGNORE))
{
sendMessage = false;
}
else if (onEmpty.equals(Constants.READ_PROCESS))
{
sendMessage = true;
}
else if (onEmpty.equals(Constants.READ_ERROR))
{
throw new XException(Constants.LOCATION_EXTERN,
Constants.LAYER_APPLICATION,
Constants.PACKAGE_APPLICATION_ADAPTER, "4");
}
}
if (sendMessage)
{
// Send the message to the destination system
// The message is already transformed and must only be
// retrieved.
// Structure information for message serialisation is due to
// the
// destination system.
ObjectSender objectsender = (ObjectSender) sender;
Object resData = objectsender.execute(
message.getFunction(), ((ObjectMessage) message)
.getRequestObject(destination));
((ObjectMessage) message).setResponseObject(resData,
destination);
message.setResponseTimestamp(new Date());
}
}
else if (Constants.TYPE_XML.equals(senderType))
{
boolean sendMessage = true;
Object request = ((ObjectMessage) message)
.getRequestObject(destination);
if (isEmpty(request))
{
String onEmpty = retrieveOnEmpty(destination.getName(),
true);
if (onEmpty.equals(Constants.READ_IGNORE))
{
sendMessage = false;
}
else if (onEmpty.equals(Constants.READ_PROCESS))
{
sendMessage = true;
}
else if (onEmpty.equals(Constants.READ_ERROR))
{
throw new XException(Constants.LOCATION_EXTERN,
Constants.LAYER_APPLICATION,
Constants.PACKAGE_APPLICATION_ADAPTER, "4");
}
}
if (sendMessage)
{
// Send the message to the destination system
// The message is already transformed and must only be
// retrieved.
ObjectSender objectsender = (ObjectSender) sender;
Document resData = (Document) objectsender.execute(message
.getFunction(), ((XMLMessage) message)
.getRequestDocument(destination));
((XMLMessage) message).setResponseDocument(resData,
destination);
message.setResponseTimestamp(new Date());
}
}
else
{
List params = new Vector();
params.add(sender.getType());
throw new XException(Constants.LOCATION_INTERN,
Constants.LAYER_APPLICATION,
Constants.PACKAGE_APPLICATION_ADAPTER, "1", params);
}
}
catch (Exception t)
{
message.setResponseTimestamp(new Date());
message.setReturncode(Constants.RC_NOK);
message.setErrortext(t.getMessage());
Trace.error(t);
}
/* Logging of the sending-activity into the journal. */
try
{
new Journal().log('S', destination, message);
}
catch (Exception t)
{
throw new XException(Constants.LOCATION_INTERN,
Constants.LAYER_APPLICATION,
Constants.PACKAGE_APPLICATION_ADAPTER, "0", t);
}
}