Package ca.uhn.hl7v2.parser

Examples of ca.uhn.hl7v2.parser.PipeParser


    public static void showInNewWindow(Message message) {
        //Create the top-level container and add contents to it.
        JFrame frame = new JFrame(message.getClass().getName());
       
        try {
            TreePanel panel = new TreePanel(new PipeParser());
            panel.setMessage(message);
            JScrollPane scroll = new JScrollPane(panel);
            frame.getContentPane().add(scroll, BorderLayout.CENTER);
           
            //Finish setting up the frame
View Full Code Here


            System.out.println("Usage: TreePanel msg_file_name");
            System.exit(1);
        }
       
        try {           
            PipeParser parser = new PipeParser();
            File messageFile = new File(args[0]);
            long fileLength = messageFile.length();
            FileReader r = new FileReader(messageFile);
            char[] cbuf = new char[(int)fileLength];
            System.out.println("Reading message file ... " + r.read(cbuf) + " of " + fileLength + " chars");
            r.close();
            String messString = String.valueOf(cbuf);
            Message mess = parser.parse(messString);
            System.out.println("Got message of type " + mess.getClass().getName());
            showInNewWindow(mess);
           
            //write message to console ...
            System.out.println(parser.encode(mess, "VB"));
        } catch (Exception e) {
            e.printStackTrace();
            log.error( e );
        }
    }
View Full Code Here

                    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

      
    private PipeParser parser;
   
    /** Creates a new instance of TestApplication */
    public TestApplication() {
        parser = new PipeParser();
    }
View Full Code Here

            char[] cbuf = new char[fileLength];
            in.read(cbuf, 0, fileLength);
            String messageString = new String(cbuf);
           
            //parse inbound message ...
            final Parser parser = new PipeParser();
            Message inMessage = null;
            try {
                inMessage = parser.parse(messageString);
            }
            catch (HL7Exception e) {
                e.printStackTrace();
            }
           
View Full Code Here

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

      final Parser parser = new PipeParser();
      LowerLayerProtocol llp = new MinLowerLayerProtocol();
      Connection connection = new ActiveConnection(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

  /**
   * 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, new MinLowerLayerProtocol(), new PipeParser(), false);
  }
View Full Code Here

  /**
   * 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, new MinLowerLayerProtocol(), new PipeParser(), tls);
 
View Full Code Here

      char[] cbuf = new char[fileLength];
      in.read(cbuf, 0, fileLength);
      String messageString = new String(cbuf);

      // parse inbound message ...
      final Parser parser = new PipeParser();
      Message inMessage = null;
      try {
        inMessage = parser.parse(messageString);
      } catch (HL7Exception e) {
        e.printStackTrace();
      }

      // process with responder ...
View Full Code Here

  private BlockingQueue<AcceptedSocket> queue;
  private AcceptorThread inboundAcceptor, outboundAcceptor;
  private final HapiContext hapiContext;

  public TwoPortService(int inboundPort, int outboundPort) {
    this(new PipeParser(), new MinLowerLayerProtocol(), inboundPort,
        outboundPort, false);
  }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.parser.PipeParser

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.