*/
public void format(TransferObject tobj, Message message, Output out) throws IntegrationException
{
OutputStream ostream = out.getOutputStream();
ZipOutputStream zipStream = null;
CompositeMessagePart rootPart = message.getRoot();
ZipMessagePartMapping rootMapping = (ZipMessagePartMapping)rootPart.getMapping();
CompositeMessagePart entriesPart = (CompositeMessagePart)rootPart.getPart(0);
// Pre-compute the transfer object keys for the various Zip entry attributes
String sKeyComment = null;
String sKeyContents = null;
String sKeyExtra = null;
String sKeyName = null;
String sKeySize = null;
String sKeyTime = null;
for (int i = 0; i < entriesPart.getPartCount(); i++)
{
PrimitiveMessagePart part = (PrimitiveMessagePart)entriesPart.getPart(i);
ZipMessagePartMapping mapping = (ZipMessagePartMapping)part.getMapping();
switch (mapping.getValue())
{
case ZipMessagePartMapping.VALUE_COMMENT:
sKeyComment = part.getName();
break;
case ZipMessagePartMapping.VALUE_CONTENTS:
sKeyContents = part.getName();
break;
case ZipMessagePartMapping.VALUE_EXTRA:
sKeyExtra = part.getName();
break;
case ZipMessagePartMapping.VALUE_NAME:
sKeyName = part.getName();
break;
case ZipMessagePartMapping.VALUE_SIZE:
sKeySize = part.getName();
break;
case ZipMessagePartMapping.VALUE_TIME:
sKeyTime = part.getName();
break;
default:
// Ignore values that are not for output
break;
}
}
// Format the transfer object into a Zip stream
try
{
zipStream = new ZipOutputStream(ostream);
if (rootMapping != null)
{
zipStream.setComment(rootMapping.getComment());
zipStream.setLevel((int)rootMapping.getCompression());
}
List entryList = (List)tobj.getValue(entriesPart.getName());
for (int i = 0; i < entryList.size(); i++)
{
TransferObject entry = (TransferObject)entryList.get(i);