Package net.sf.jml.protocol.outgoing

Examples of net.sf.jml.protocol.outgoing.OutgoingMSG$MsgType


  /**
   * @see MsnMimeMessage#toOutgoingMsg(MsnProtocol)
   */
  @Override
  public OutgoingMSG[] toOutgoingMsg(MsnProtocol protocol) {
    OutgoingMSG message = new OutgoingMSG(protocol)//;
        {
            protected void receivedResponse(MsnSession session, MsnIncomingMessage response)
            {
                MsnP2PMessage.this.receivedResponse(session, response);
            }
        };
    message.setMsgType(OutgoingMSG.TYPE_MSNC1);

    byte[] mimeMessageHeader = Charset.encodeAsByteArray(toString());

    byte[] body = bodyToMessage();
    if (body == null) {
      body = new byte[0];
    }

        // move to next data, as the body is the whole actual body
        // and we obey the length,currentLength and offset
        // if body is not the whole (length not equal to total length )
        // it means that external will take care fill the data
        if(getTotalLength() > getCurrentLength() && body.length == getTotalLength())
        {
            byte[] newBody = new byte[getCurrentLength()];
            System.arraycopy(body, (int)getOffset(), newBody, 0, newBody.length);
            body = newBody;
        }

    ByteBuffer msg = ByteBuffer
        .allocate(mimeMessageHeader.length + BINARY_HEADER_LEN
            + body.length + BINARY_FOOTER_LEN);

    msg.put(mimeMessageHeader);
    msg.put(binaryHeader);
    msg.put(body);
    msg.put(binaryFooter);
    message.setMsg(msg.array());
    return new OutgoingMSG[] { message };
  }
View Full Code Here


     *     used MsnProtocol
     * @return
     *     generated OutgoingMSGs. A MsnMimeMessage may generate multi OutgoingMSGs.
     */
    public OutgoingMSG[] toOutgoingMsg(MsnProtocol protocol) {
        OutgoingMSG message = new OutgoingMSG(protocol);
        message.setMsg(Charset.encodeAsByteArray(toString()));
        message.setMsgType(OutgoingMSG.TYPE_ACKNOWLEDGE_WHEN_ERROR);
        return new OutgoingMSG[] { message };
    }
View Full Code Here

  /**
   * @see MsnMimeMessage#toOutgoingMsg(MsnProtocol)
   */
  @Override
  public OutgoingMSG[] toOutgoingMsg(MsnProtocol protocol) {
    OutgoingMSG message = new OutgoingMSG(protocol)//;
        {
            protected void receivedResponse(MsnSession session, MsnIncomingMessage response)
            {
                MsnP2PMessage.this.receivedResponse(session, response);
            }
        };
    message.setMsgType(OutgoingMSG.TYPE_MSNC1);

    byte[] mimeMessageHeader = Charset.encodeAsByteArray(toString());

    byte[] body = bodyToMessage();
    if (body == null) {
      body = new byte[0];
    }

        // move to next data, as the body is the whole actual body
        // and we obey the length,currentLength and offset
        // if body is not the whole (length not equal to total length )
        // it means that external will take care fill the data
        if(getTotalLength() > getCurrentLength() && body.length == getTotalLength())
        {
            byte[] newBody = new byte[getCurrentLength()];
            System.arraycopy(body, (int)getOffset(), newBody, 0, newBody.length);
            body = newBody;
        }

    ByteBuffer msg = ByteBuffer
        .allocate(mimeMessageHeader.length + BINARY_HEADER_LEN
            + body.length + BINARY_FOOTER_LEN);

    msg.put(mimeMessageHeader);
    msg.put(binaryHeader);
    msg.put(body);
    msg.put(binaryFooter);
    message.setMsg(msg.array());
    return new OutgoingMSG[] { message };
  }
View Full Code Here

                invitationCookie);
    }

    @Override
  public OutgoingMSG[] toOutgoingMsg(MsnProtocol protocol) {
        OutgoingMSG message = new OutgoingMSG(protocol) {

            @Override
      protected void messageSent(MsnSession session) {
                super.messageSent(session);
                MsnInvitationMessage.this.messageSent(session);
            }
        };
        message.setMsgType(OutgoingMSG.TYPE_ACKNOWLEDGE_WHEN_ERROR);
        message.setMsg(Charset.encodeAsByteArray(toString()));
        return new OutgoingMSG[] { message };
    }
View Full Code Here

        setContentType(MessageConstants.CT_TEXT + MessageConstants.CHARSET);
        ByteBuffer[] body = Charset.encode(content, DEF_SPLIT_SIZE);
        OutgoingMSG[] outgoing = new OutgoingMSG[body.length];
        String messageId = "{" + GUID.createRandomGuid() + "}";
        for (int i = 0; i < outgoing.length; i++) {
            outgoing[i] = new OutgoingMSG(protocol);
            outgoing[i].setMsgType(OutgoingMSG.TYPE_ACKNOWLEDGE_WHEN_ERROR);

            StringHolder holder;
            if (body.length == 1)
                holder = headers;
View Full Code Here

            String vsystemName =
                vsystem.getName() != null && !StringUtils.isEmpty(vsystem.getName().getValue())
                    ? vsystem.getName().getValue() : vsystem.getId();

            MsgType prod = new MsgType();
            prod.setValue(vsystemName);

            ProductSectionType product = new ProductSectionType();
            product.setInfo(vsystem.getInfo());
            product.setProduct(prod);
View Full Code Here

            String vsystemName =
                vsystem.getName() != null && vsystem.getName().getValue() != null ? vsystem
                    .getName().getValue() : vsystem.getId();

            MsgType prod = new MsgType();
            prod.setValue(vsystemName);

            ProductSectionType product = new ProductSectionType();
            product.setInfo(vsystem.getInfo());
            product.setProduct(prod);
View Full Code Here

            String vsystemName =
                vsystem.getName() != null && vsystem.getName().getValue() != null ? vsystem
                    .getName().getValue() : vsystem.getId();

            MsgType prod = new MsgType();
            prod.setValue(vsystemName);

            ProductSectionType product = new ProductSectionType();
            product.setInfo(vsystem.getInfo());
            product.setProduct(prod);
View Full Code Here

            String vsystemName =
                vsystem.getName() != null && vsystem.getName().getValue() != null ? vsystem
                    .getName().getValue() : vsystem.getId();

            MsgType prod = new MsgType();
            prod.setValue(vsystemName);

            ProductSectionType product = new ProductSectionType();
            product.setInfo(vsystem.getInfo());
            product.setProduct(prod);
View Full Code Here

TOP

Related Classes of net.sf.jml.protocol.outgoing.OutgoingMSG$MsgType

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.