Examples of PipeParser


Examples of ca.uhn.hl7v2.parser.PipeParser

      // set up connection to server
      String host = args[0];
      int port = Integer.parseInt(args[1]);

      final Parser parser = new PipeParser();
      LowerLayerProtocol llp = LowerLayerProtocol.makeLLP();
      Connection connection = new Connection(parser, llp, new Socket(
          host, port));
      final Initiator initiator = connection.getInitiator();
      connection.activate();
      final String outText = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";
      final IDGenerator generator = new InMemoryIDGenerator();

      // get a bunch of threads to send messages
      for (int i = 0; i < 1000; i++) {
        Thread sender = new Thread(new Runnable() {
         
          public void run() {
            try {
              // get message ID
              String ID = generator.getID();
              Message out = parser.parse(outText);
              Terser tOut = new Terser(out);
              tOut.set("/MSH-10", ID);

              // send, get response
              Message in = initiator.sendAndReceive(out);
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

  /**
   * Creates a new instance of SimpleServer that listens on the given port,
   * using the {@link MinLowerLayerProtocol} and a standard {@link PipeParser}.
   */
  public SimpleServer(int port) {
    this(port, LowerLayerProtocol.makeLLP(), new PipeParser(), false);
  }
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

  /**
   * Creates a new instance of SimpleServer that listens on the given port,
   * using the {@link MinLowerLayerProtocol} and a standard {@link PipeParser}.
   */
  public SimpleServer(int port, boolean tls) {
    this(port, LowerLayerProtocol.makeLLP(), new PipeParser(), tls);
 
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

    static Message parse(String body, boolean validate) throws HL7Exception {
        // replace \n with \r as HL7 uses 0x0d = \r as segment terminators and HAPI only parses with \r
        body = body.replace('\n', '\r');

        Parser parser = new PipeParser();
        if (!validate) {
            parser.setValidationContext(new NoValidation());
        }
        return parser.parse(body);
    }
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

        }
        return parser.parse(body);
    }

    static String encode(Message message, boolean validate) throws HL7Exception {
        Parser parser = new PipeParser();
        if (!validate) {
            parser.setValidationContext(new NoValidation());
        }
        return parser.encode(message);
    }
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

        }

        // convert to string
        String body;
        if (message instanceof Message) {
            Parser parser = new PipeParser();
            body = parser.encode((Message)message);
        } else if (message instanceof String) {
            body = (String)message;
        } else if (message instanceof byte[]) {
            body = new String((byte[])message);
        } else {
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

                    for (int i = 0; i < nextStructureList.size(); i++) {
                        if (i > 0) {
                            indent(theStringBuilder, currentIndent + structurePrefix.length());
                        }
                        Segment nextSegment = (Segment)nextStructureList.get(i);
                        theStringBuilder.append(new PipeParser().doEncode(nextSegment, EncodingCharacters.getInstance(getMessage())));
                        theStringBuilder.append(lineSeparator);
                       
                    }
                }
               
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

        assertMockEndpointsSatisfied();
    }   

    protected RouteBuilder createRouteBuilder() throws Exception {
        Parser p = new PipeParser();
        p.setValidationContext(new NoValidation());
        hl7 = new HL7DataFormat();
        hl7.setParser(p);
       
        return new RouteBuilder() {
            public void configure() throws Exception {
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

        // Helper class
    }

    @Converter
    public static String toString(Message message) throws HL7Exception {
        return encode(message, new PipeParser());
    }
View Full Code Here

Examples of ca.uhn.hl7v2.parser.PipeParser

        return encode(message, new PipeParser());
    }

    @Converter
    public static Message toMessage(String body) throws HL7Exception {
        return parse(body, new PipeParser());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.