Package org.wijiscommons.ssaf.drop_off.wrapper

Examples of org.wijiscommons.ssaf.drop_off.wrapper.DropOffResponse


        }
       
        if (invocationType.equals("WebService"))
        {   

            DropOffResponse dropOffResponse = new DropOffResponse();

            dropOffResponse.setAny( returnDoc.getDocumentElement() );
            exchange.getOut().setBody( dropOffResponse );

        }
         
   
View Full Code Here


          exchange.getOut().setHeader(FileComponent.HEADER_FILE_NAME, returnFileName);
        }
       
        if (invocationType.equals("WebService"))
        {   
            DropOffResponse dropOffResponse = new DropOffResponse();

            dropOffResponse.setAny( returnDoc.getDocumentElement() );
            exchange.getOut().setBody( dropOffResponse );
        }
         
   
    log.debug("Exiting this confirmation function");
View Full Code Here

        "request-files/javaClient-request/sample_dropOffSync_invocation.xml");

    Document dropOffDocument = DomUtils
        .getDocumentFromFile(dropOffFile);

    DropOffResponse dropOffReponse = null;
   
    try
    {
      dropOffReponse = dropOffSynchronousServiceClient
          .dropOffAFile(dropOffDocument.getDocumentElement());
    }
    catch (FatalFault e)
    {
      e.printStackTrace();
      System.out.println("Drop-off sync web service had thrown FatalFault exception.");
    }

    if (dropOffReponse != null)
    {
      Element dropOffReponseElement = (Element) dropOffReponse.getAny();
      System.out.println("Drop-off sync web service java client response : "
          + DomUtils.getStringFromDocument(dropOffReponseElement
              .getOwnerDocument()));
    }
  }
View Full Code Here

      String recordRetrievalReponse, String mailBoxName)
  throws Exception
  {
    DropOffDocumentResult dropOffDocumentResponseCommand = new DropOffDocumentResult();
    Document recordRetrievalRequestDocument = null;
    DropOffResponse dropOffWebServiceResponse = null;
    String clientSideIDString = null;
    log.debug("mailBox Name from dropOffMailbox form is : " + mailBoxName);

    clientSideIDString = String.valueOf(clientSideID.getNextMessageID());

    // to proceed further injected cleintSideIDString should not be
    // null;
    if (StringUtils.isNotBlank(clientSideIDString))
    {
      dropOffDocumentResponseCommand.setClientSideID(clientSideIDString);
      recordRetrievalRequestDocument = SSAFAdminUtility
          .extractPayloadElementAndMakeDropOffRequest(
              recordRetrievalReponse, mailBoxName,
              clientSideIDString);

      if (recordRetrievalRequestDocument != null)
      {
        // call the web service
        dropOffWebServiceResponse = dropOffWebServiceClient
            .dropOffAFile(recordRetrievalRequestDocument
                .getDocumentElement());

        if (dropOffWebServiceResponse != null)
        {
          Element dropOffReponseElement = (Element) dropOffWebServiceResponse
              .getAny();

          NodeList confirmationNodeList = dropOffReponseElement
              .getElementsByTagNameNS(SSAFNodes.accepted_message
                  .getNamespace(), SSAFNodes.accepted_message
View Full Code Here

      String recordRetrievalReponse, String mailBoxName)
  throws Exception
  {
    DropOffDocumentResult dropOffDocumentResponseCommand = new DropOffDocumentResult();
    Document recordRetrievalRequestDocument = null;
    DropOffResponse dropOffWebServiceResponse = null;
    String clientSideIDString = null;
    log.debug("mailBox Name from dropOffMailbox form is : " + mailBoxName);

    clientSideIDString = String.valueOf(clientSideID.getNextMessageID());

    // to proceed further injected cleintSideIDString should not be
    // null;
    if (StringUtils.isNotBlank(clientSideIDString))
    {
      dropOffDocumentResponseCommand.setClientSideID(clientSideIDString);
      recordRetrievalRequestDocument = SSAFAdminUtility
          .extractPayloadElementAndMakeDropOffRequest(
              recordRetrievalReponse, mailBoxName,
              clientSideIDString);

      if (recordRetrievalRequestDocument != null)
      {
        // call the web service
        dropOffWebServiceResponse = dropOffWebServiceClient
            .dropOffAFile(recordRetrievalRequestDocument
                .getDocumentElement());

        if (dropOffWebServiceResponse != null)
        {
          Element dropOffReponseElement = (Element) dropOffWebServiceResponse
              .getAny();

          NodeList confirmationNodeList = dropOffReponseElement
              .getElementsByTagNameNS(SSAFNodes.accepted_message
                  .getNamespace(), SSAFNodes.accepted_message
View Full Code Here

  {
    log.info("Executing DropOffSynchronous operation ");

    Element docElement = (Element) dropOffSyncRequest.getAny();

    DropOffResponse dropOffSyncResponse = new DropOffResponse();
    ServiceResponseInfo sb = new ServiceResponseInfo();
    String mailBoxURI = null;
    String clientsideID = null;
    String recordURI = null;
    String messageID = null;

    HashMap<String, String> attributesMap = SSAFUtil
        .getMessageAttributes(docElement);
    clientsideID = attributesMap.get("clientsideID");
    recordURI = attributesMap.get("recordURI");
    mailBoxURI = attributesMap.get("dropoffMailBoxURI");

    // Throw Fault if clientside_Id is not specified
    if (StringUtils.isBlank(clientsideID))
    {
      sb.noteError("clientside_Id attribute is not specified in incoming request document");
      Drop_OffUtil  .throwFaultrecordURI,
                  null,
                  null,
                  sb, SSAFErrorTypes.REQUEST_INVALID, mailBoxURI,
                  docElement);

    }
    // check if mailBoxURI attribute is present in incoming request
    if (StringUtils.isNotBlank(mailBoxURI))
    {
      String mailBoxesAbsolutePath = mailBoxes_root + mailBoxURI;

      // check if it dropped of a file successfully
      if (DropOffHelperMethods.dropOffAFile(mailBoxesAbsolutePath, docElement,
          sb, clientsideID, recordURI))
      {
        log.info("Successfully dropped off a file to the mailbox location specified : "
                + mailBoxesAbsolutePath +SSAFUtil.fileSeparator+
                "drop_off"+SSAFUtil.fileSeparator+"drop_box");

        // poll for response file in both confirm_box and fail_box
        // folders.
        Element dropOffStatusReponseElement = Drop_OffUtil
                .pollForAFile(mailBoxesAbsolutePath,
                        clientsideID,
                        recordURI,
                        sb, docElement,
                        numberOfTimesToPoll,sleepInterval);

        if (dropOffStatusReponseElement != null)
        {
          // find out what type of response is returned either
          // confirmation or Error
          NodeList acceptedMessageList = dropOffStatusReponseElement
              .getElementsByTagNameNS(SSAFNamespaces.drop_off
                  .getNamespace(), SSAFNodes.accepted_message
                  .getLocalName());

          if (acceptedMessageList.getLength() > 0)
          {
            Element acceptedMessageElement = (Element) acceptedMessageList
                .item(0);

            messageID = acceptedMessageElement.getAttributeNS(
                SSAFNamespaces.ssaf.getNamespace(),
                SSAFNodes.message_id.getLocalName());
          }
          // all confirmation messages must have message_id attribute
          // in them. If not it's a error Document.

          if (StringUtils.isNotBlank(messageID))
          {
            log.info("message_id attribute defined in dropOffStatusReponseElement : "+messageID);
            File confirmationFileToDelete = Drop_OffUtil
                .lookForConfirmationFileWithMessageID(
                    messageID, mailBoxesAbsolutePath,
                    docElement, sb);

            // check if file exists
            if (confirmationFileToDelete != null
                && confirmationFileToDelete.exists())
            {
              // if it exists go ahead and delete a confirmation file
              if (DropOffHelperMethods.deleteAFile(
                  confirmationFileToDelete, sb))
              {
                dropOffSyncResponse
                    .setAny(dropOffStatusReponseElement);
              }
              else
              { // file exists but could not be deleted
               
                sb.noteError("Confirmation file exists in a file system but not " +
                    "able to delete a confirmation file with message_id : "
                        + messageID);
                log.error(sb.getMergedMessages());
               
                Drop_OffUtil.throwFault(recordURI,
                            clientsideID,
                            messageID,
                            sb,SSAFErrorTypes.NONLOGIC,
                            mailBoxURI,
                            dropOffStatusReponseElement);
              }
            }
            else
            {
              // File is not present in file system
              sb.noteError("File does not exists in a file system with specified message_id : "
                      + messageID);
              log.error(sb.getMergedMessages());

              Drop_OffUtil.throwFault(recordURI,
                          clientsideID,
                          messageID,
                          sb,SSAFErrorTypes.REQUEST_RECORD_ERROR,
                          mailBoxURI, dropOffStatusReponseElement);
            }
          }
          else
          {
            // If it is in this block then it is a error document -
            // delete it form file system and then return
            // dropOffSyncResponse.
            log.info("There is no message_id attribute defined in dropOffStatusReponseElement");

            String deleteErrorFileLocation = Drop_OffUtil
                .getFileName(mailBoxesAbsolutePath, "fail_box",
                    clientsideID, "response");

            File fileToDelete = new File(deleteErrorFileLocation);
            // check if error file exists
            if (fileToDelete.exists())
            {
              if (DropOffHelperMethods.deleteAFile(fileToDelete, sb))
              {
                log.info("Successfully deleted the a error file with" +
                    " specified clientside_id :"  + clientsideID);
                dropOffSyncResponse.setAny(dropOffStatusReponseElement);
              }
              else
              { // Confirmation file exists but could not be deleted
                sb.noteError("Confirmation file exists in a file system but not" +
                    " able to delete a error file with specified clientside_id : "
View Full Code Here

    }
   
   
    public DropOffResponse dropOffAFile(Element dropOffSyncRequest) throws FatalFault
  {
      DropOffResponse dropOffResponse = null;
     
      DropOffSynchronousService port = sendClientCertAlong();
     
      if(port != null)
    {
View Full Code Here

        }
       
        if (invocationType.equals("WebService"))
        {   

            DropOffResponse dropOffResponse = new DropOffResponse();

            dropOffResponse.setAny( returnDoc.getDocumentElement() );
            exchange.getOut().setBody( dropOffResponse );

        }
         
   
View Full Code Here

TOP

Related Classes of org.wijiscommons.ssaf.drop_off.wrapper.DropOffResponse

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.