Package org.apache.commons.jexl2.parser

Examples of org.apache.commons.jexl2.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

    {
        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

      this.literals = entry.getLiterals();
      this.terms = entry.getTerms();
      this.rootNode = entry.getRootNode();
      this.tree = entry.getTree();
    } else {
      Parser p = new Parser(new StringReader(";"));
      rootNode = p.parse(new StringReader(query), null);
      rootNode.childrenAccept(this, null);
      TreeBuilder builder = new TreeBuilder(rootNode);
      tree = builder.getRootNode();
      entry = new CacheEntry(this.negatedTerms, this.andTerms, this.orTerms, this.literals, this.terms, rootNode, tree);
      synchronized (cache) {
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl2.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.