Package nexj.core.meta.integration.format.zip

Examples of nexj.core.meta.integration.format.zip.ZipMessagePartMapping


            // Iterate the parts, assigning data from the Zip entry
            for (int i = 0; i < entriesPart.getPartCount(); i++)
            {
               PrimitiveMessagePart part = (PrimitiveMessagePart)entriesPart.getPart(i);
               ZipMessagePartMapping mapping = (ZipMessagePartMapping)part.getMapping();
               Object datum = null;
               Primitive partType = part.getType();

               switch (mapping.getValue())
               {
                  case ZipMessagePartMapping.VALUE_CONTENTS:
                     Binary contents = new PagedBinary(zipStream);

                     zipStream.closeEntry();

                     if (s_logger.isDebugEnabled())
                     {
                        s_logger.debug("Extracted contents of \"" + zipEntry.getName() + "\" size=" + contents.getSize());
                     }

                     if (contents.getSize() > 0)
                     {
                        datum = partType.getConverter(Primitive.BINARY).invoke(contents);
                     }

                     sKeyContents = part.getName();
                     break;

                  case ZipMessagePartMapping.VALUE_COMMENT:
                     datum = partType.getConverter(Primitive.STRING).invoke(zipEntry.getComment());
                     break;

                  case ZipMessagePartMapping.VALUE_DIRECTORY:
                     datum = partType.getConverter(Primitive.BOOLEAN).invoke(Boolean.valueOf(zipEntry.isDirectory()));
                     break;

                  case ZipMessagePartMapping.VALUE_EXTRA:
                     if (zipEntry.getExtra() != null)
                     {
                        datum = partType.getConverter(Primitive.BINARY).invoke(new Binary(zipEntry.getExtra()));
                     }

                     break;

                  case ZipMessagePartMapping.VALUE_NAME:
                     datum = partType.getConverter(Primitive.STRING).invoke(convertZipSeparatorToPlatformSeparator(zipEntry.getName()));
                     break;

                  case ZipMessagePartMapping.VALUE_SIZE:
                     datum = partType.getConverter(Primitive.LONG).invoke(Primitive.createLong(zipEntry.getSize()));
                     sKeySize = part.getName();
                     lValueSize = zipEntry.getSize();
                     sizeType = partType;
                     break;

                  case ZipMessagePartMapping.VALUE_TIME:
                     datum = partType.getConverter(Primitive.LONG).invoke(Primitive.createLong(zipEntry.getTime()));
                     break;

                  default:
                     throw new IllegalStateException("Unknown value: " + mapping.getValue());
               }

               entry.setValue(part.getName(), datum);
            }
View Full Code Here


   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;
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.format.zip.ZipMessagePartMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.