Package Parser

Examples of Parser.Parser


    // make ACK of correct version
    Class<? extends Message> clazz = null;
    try {
      Message inbound = inboundHeader.getMessage();
      Parser p = inbound.getParser();
      ModelClassFactory mcf = p != null ? p.getFactory() : new DefaultModelClassFactory();
      String version = inbound.getVersion();
      if (version == null)
        version = "2.4";
      clazz = mcf.getMessageClass("ACK", version, false);
      Message out = clazz.newInstance();
View Full Code Here


        }
       
        DefaultValidator val = new DefaultValidator();
        try {
            String msgString = loadFile(args[0]);
            Parser parser = new GenericParser();
            Message message = parser.parse(msgString);
           
            String profileString = loadFile(args[1]);
            ProfileParser profParser = new ProfileParser(true);
            RuntimeProfile profile = profParser.parse(profileString);
           
View Full Code Here

   * @throws EncodingNotSupportedException
   *             If the encoding is not supported
   */
  public IReceivable<Message> sendAndReceiveMessage(ISendable<Message> theMessageToSend) throws DecodeException, IOException, EncodeException, EncodingNotSupportedException, HL7Exception {
    IReceivable<String> response = myRawClient.sendAndReceive(theMessageToSend);
    Parser parser = myParser != null ? myParser : theMessageToSend.getMessage().getParser();
    return new MessageReceivable(parser.parse(response.getMessage()));
  }
View Full Code Here

    if (myPort <= 0) {
      throw new IllegalStateException("Port not set");
    }
   
    LowerLayerProtocol llp = new ExtendedMinLowerLayerProtocol();
    Parser parser = new PipeParser(new GenericModelClassFactory());
    myServer = new SimpleServer(myPort, llp, parser);

    for (int i = 0; i < myAppRoutingData.size(); i++) {
      myServer.registerApplication(myAppRoutingData.get(i), myApplications.get(i));
    }
View Full Code Here

    /**
     * {@inheritDoc }
     */
    @Override
    public String encode() throws HL7Exception {
        Parser p = getMessage().getParser();
        return p.doEncode(this, EncodingCharacters.getInstance(getMessage()));
    }
View Full Code Here

        }
       
        DefaultValidator val = new DefaultValidator();
        try {
            String msgString = loadFile(args[0]);
            Parser parser = new GenericParser();
            Message message = parser.parse(msgString);
           
            String profileString = loadFile(args[1]);
            ProfileParser profParser = new ProfileParser(true);
            RuntimeProfile profile = profParser.parse(profileString);
           
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 = 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";

      // 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 = MessageIDGenerator.getInstance()
                  .getNewID();
              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

    {
        JexlContext jc = new MapContext();
        jc.set("aString", "Hello");
        Foo foo = new Foo();
        jc.set("foo", foo);
        Parser parser = new Parser(new StringReader(";"));
        parser.parse(new StringReader("aString = 'World';"), null);
       
        assertExpression(jc, "hello = 'world'", "world");
        assertEquals("hello variable not changed", "world", jc.get("hello"));
        assertExpression(jc, "result = 1 + 1", new Integer(2));
        assertEquals("result variable not changed", new Integer(2), jc.get("result"));
View Full Code Here

     * @throws InvalidSearchConditionException in case of errors retrieving identifiers
     */
    private Set<String> getWhereClause(final String expression, final String value, final AttributableUtil attrUtil)
            throws InvalidSearchConditionException {

        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.isNotBlank(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
View Full Code Here

TOP

Related Classes of Parser.Parser

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.