Package org.apache.axis.attachments

Examples of org.apache.axis.attachments.AttachmentPart


          /*=================================================================
          * Get the object's content, and ingest the document
          *================================================================*/
          try
          {
            AttachmentPart ap = meridio_.getLatestVersionFile((int)docId);
            if (null == ap)
            {
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: Failed to get content for document '" + new Long(docId).toString() + "'");
              // No document.  Delete what's there
              activities.deleteDocument(documentIdentifier,docVersion);
              i++;
              continue;
            }
            try
            {
              // Get the file name.
              String fileName = ap.getDataHandler().getName();
              // Log what we are about to do.
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: File data is supposedly in "+fileName);
              File theTempFile = new File(fileName);
              if (theTempFile.isFile())
              {
                long fileSize = theTempFile.length();                   // ap.getSize();
                if (activities.checkLengthIndexable(fileSize))
                {
                  InputStream is = new FileInputStream(theTempFile);      // ap.getDataHandler().getInputStream();
                  try
                  {
                    repositoryDocument.setBinary(is, fileSize);

                    if (null != activities)
                    {
                      activities.ingestDocument(documentIdentifier, docVersion,
                        fileURL, repositoryDocument);
                    }
                  }
                  finally
                  {
                    is.close();
                  }
                }
                else
                  activities.deleteDocument(documentIdentifier, docVersion);
              }
              else
              {
                if (Logging.connectors.isDebugEnabled())
                  Logging.connectors.debug("Meridio: Expected temporary file was not present - skipping document '"+new Long(docId).toString() + "'");
                activities.deleteDocument(documentIdentifier, docVersion);
              }
            }
            finally
            {
              ap.dispose();
            }

          }
          catch (java.net.SocketTimeoutException ioex)
          {
View Full Code Here


            SOAPMessage soapMessage = ctx.getMessage();
            int x = 1;
            for (Iterator<?> i = soapMessage.getAttachments(); i.hasNext(); x++)
            {
                String name = String.valueOf(x);
                AttachmentPart attachmentPart = (AttachmentPart)i.next();
                message.addOutboundAttachment(name, attachmentPart.getActivationDataHandler());
            }
        }
        catch (Exception e)
        {
            // this will not happen
View Full Code Here

        // Add any attachments to the call
        for (Iterator iterator = event.getMessage().getOutboundAttachmentNames().iterator(); iterator.hasNext();)
        {
            String name = (String)iterator.next();
            DataHandler dh = event.getMessage().getOutboundAttachment(name);
            AttachmentPart part = new AttachmentPart(dh);
            call.addAttachmentPart(part);
        }
    }
View Full Code Here

        MessageContext msgContext = MessageContext.getCurrentContext();
        Message reqMsg = msgContext.getRequestMessage();
        Attachments messageAttachments = reqMsg.getAttachmentsImpl();
        int attachmentCount =
                messageAttachments.getAttachmentCount();
        AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
        Iterator it =
                messageAttachments.getAttachments().iterator();
        int count = 0;

        while (it.hasNext()) {
            AttachmentPart part = (AttachmentPart) it.next();
            attachments[count++] = part;
        }
        return attachments;
    }
View Full Code Here

        call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,

        java.util.Stack rev= new java.util.Stack();
        //Create an attachment referenced by a generated contentId.
        AttachmentPart ap= new AttachmentPart(new javax.activation.DataHandler(
          "Now is the time", "text/plain" ));
         refs.add(ap.getContentIdRef()); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a set contentId.
        String setContentId="rick_did_this";
        ap= new AttachmentPart(new DataHandler(" for all good", "text/plain" ));
          //new MemoryOnlyDataSource(
         ap.setContentId(setContentId)
         refs.add("cid:" + setContentId); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a absolute contentLocation.
        ap= new AttachmentPart(new DataHandler( " men to", "text/plain" ));
          //new MemoryOnlyDataSource( " men to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/firstLoc")
         refs.add(baseLoc+ "/firstLoc"); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a absolute location.
        ap= new AttachmentPart(new DataHandler( " come to", "text/plain" ));
          // new MemoryOnlyDataSource( " come to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/secondLoc")
        refs.add("secondLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a relative location.
        ap= new AttachmentPart(new DataHandler( " the aid of their country.", "text/plain" ));
          // new MemoryOnlyDataSource( " the aid of their country.", "text/plain" )));
        ap.setContentLocation("thirdLoc")
        refs.add("thirdLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);


        //Now build the message....
View Full Code Here

          /*=================================================================
          * Get the object's content, and ingest the document
          *================================================================*/
          try
          {
            AttachmentPart ap = meridio_.getLatestVersionFile((int)docId);
            if (null == ap)
            {
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: Failed to get content for document '" + new Long(docId).toString() + "'");
              // No document.  Delete what's there
              activities.noDocument(documentIdentifier,docVersion);
              i++;
              continue;
            }
            try
            {
              // Get the file name.
              String fileName = ap.getDataHandler().getName();
              // Log what we are about to do.
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: File data is supposedly in "+fileName);
              File theTempFile = new File(fileName);
              if (theTempFile.isFile())
              {
                long fileSize = theTempFile.length();                   // ap.getSize();
                if (activities.checkLengthIndexable(fileSize))
                {
                  InputStream is = new FileInputStream(theTempFile);      // ap.getDataHandler().getInputStream();
                  try
                  {
                    repositoryDocument.setBinary(is, fileSize);

                    if (null != activities)
                    {
                      activities.ingestDocumentWithException(documentIdentifier, docVersion,
                        fileURL, repositoryDocument);
                    }
                  }
                  finally
                  {
                    is.close();
                  }
                }
                else
                  activities.noDocument(documentIdentifier, docVersion);
              }
              else
              {
                if (Logging.connectors.isDebugEnabled())
                  Logging.connectors.debug("Meridio: Expected temporary file was not present - skipping document '"+new Long(docId).toString() + "'");
                activities.deleteDocument(documentIdentifier);
              }
            }
            finally
            {
              ap.dispose();
            }

          }
          catch (java.net.SocketTimeoutException ioex)
          {
View Full Code Here

        call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,

        java.util.Stack rev= new java.util.Stack();
        //Create an attachment referenced by a generated contentId.
        AttachmentPart ap= new AttachmentPart(new javax.activation.DataHandler(
          "Now is the time", "text/plain" ));
         refs.add(ap.getContentIdRef()); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a set contentId.
        String setContentId="rick_did_this";
        ap= new AttachmentPart(new DataHandler(" for all good", "text/plain" ));
          //new MemoryOnlyDataSource(
         ap.setContentId(setContentId)
         refs.add("cid:" + setContentId); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a absolute contentLocation.
        ap= new AttachmentPart(new DataHandler( " men to", "text/plain" ));
          //new MemoryOnlyDataSource( " men to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/firstLoc")
         refs.add(baseLoc+ "/firstLoc"); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a absolute location.
        ap= new AttachmentPart(new DataHandler( " come to", "text/plain" ));
          // new MemoryOnlyDataSource( " come to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/secondLoc")
        refs.add("secondLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a relative location.
        ap= new AttachmentPart(new DataHandler( " the aid of their country.", "text/plain" ));
          // new MemoryOnlyDataSource( " the aid of their country.", "text/plain" )));
        ap.setContentLocation("thirdLoc")
        refs.add("thirdLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);


        //Now build the message....
View Full Code Here

        call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,

        java.util.Stack rev= new java.util.Stack();
        //Create an attachment referenced by a generated contentId.
        AttachmentPart ap= new AttachmentPart(new javax.activation.DataHandler(
          "Now is the time", "text/plain" ));
         refs.add(ap.getContentIdRef()); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a set contentId.
        String setContentId="rick_did_this";
        ap= new AttachmentPart(new DataHandler(" for all good", "text/plain" ));
          //new MemoryOnlyDataSource(
         ap.setContentId(setContentId)
         refs.add("cid:" + setContentId); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by a absolute contentLocation.
        ap= new AttachmentPart(new DataHandler( " men to", "text/plain" ));
          //new MemoryOnlyDataSource( " men to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/firstLoc")
         refs.add(baseLoc+ "/firstLoc"); //reference the attachment by contentId.
         ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a absolute location.
        ap= new AttachmentPart(new DataHandler( " come to", "text/plain" ));
          // new MemoryOnlyDataSource( " come to", "text/plain" )));
        ap.setContentLocation(baseLoc+ "/secondLoc")
        refs.add("secondLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);

        //Create an attachment referenced by relative location to a relative location.
        ap= new AttachmentPart(new DataHandler( " the aid of their country.", "text/plain" ));
          // new MemoryOnlyDataSource( " the aid of their country.", "text/plain" )));
        ap.setContentLocation("thirdLoc")
        refs.add("thirdLoc"); //reference the attachment by contentId.
        ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
        call.addAttachmentPart(ap);
        rev.push(ap);


        //Now build the message....
View Full Code Here

        {
          if (oLog != null) oLog.debug("Meridio: Exiting getLatestVersionFile method with null.");
            return null;
        }

        AttachmentPart ap = (AttachmentPart) attachments[0];
        if (oLog != null && oLog.isDebugEnabled())
          oLog.debug("Meridio: Temp File is <" + ap.getAttachmentFile() + ">");

        if (oLog != null) oLog.debug("Meridio: Exiting getLatestVersionFile method.");
          return ap;
      }
      catch (RemoteException e)
View Full Code Here

          /*=================================================================
          * Get the object's content, and ingest the document
          *================================================================*/
          try
          {
            AttachmentPart ap = meridio_.getLatestVersionFile((int)docId);
            if (null == ap)
            {
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: Failed to get content for document '" + new Long(docId).toString() + "'");
              // No document.  Delete what's there
              activities.deleteDocument(documentIdentifier,docVersion);
              i++;
              continue;
            }
            try
            {
              // Get the file name.
              String fileName = ap.getDataHandler().getName();
              // Log what we are about to do.
              if (Logging.connectors.isDebugEnabled())
                Logging.connectors.debug("Meridio: File data is supposedly in "+fileName);
              File theTempFile = new File(fileName);
              if (theTempFile.isFile())
              {
                long fileSize = theTempFile.length();                   // ap.getSize();
                if (activities.checkLengthIndexable(fileSize))
                {
                  InputStream is = new FileInputStream(theTempFile);      // ap.getDataHandler().getInputStream();
                  try
                  {
                    repositoryDocument.setBinary(is, fileSize);

                    if (null != activities)
                    {
                      activities.ingestDocument(documentIdentifier, docVersion,
                        fileURL, repositoryDocument);
                    }
                  }
                  finally
                  {
                    is.close();
                  }
                }
                else
                  activities.deleteDocument(documentIdentifier, docVersion);
              }
              else
              {
                if (Logging.connectors.isDebugEnabled())
                  Logging.connectors.debug("Meridio: Expected temporary file was not present - skipping document '"+new Long(docId).toString() + "'");
                activities.deleteDocument(documentIdentifier, docVersion);
              }
            }
            finally
            {
              ap.dispose();
            }

          }
          catch (java.net.SocketTimeoutException ioex)
          {
View Full Code Here

TOP

Related Classes of org.apache.axis.attachments.AttachmentPart

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.