Package net.sf.jpluck.util.el

Examples of net.sf.jpluck.util.el.DefaultVariables


            if ((uriText.getText().length() == 0) && !editingDefault) {
                throw ValidationException.required(uriText, "Please enter a URL.");
            }
            ExpressionEvaluator eval = new ExpressionEvaluatorImpl();
            try {
                eval.evaluate((String) nameText.getText(), String.class, new DefaultVariables(),
                              StaticFunctionMapper.getDefault());
            } catch (Exception e) {
                throw ValidationException.invalid(nameText, "Error evaluating EL expression:\n" + e.getMessage());
            }
            try {
                eval.evaluate((String) uriText.getText(), String.class, new DefaultVariables(),
                              StaticFunctionMapper.getDefault());
            } catch (Exception e) {
                throw ValidationException.invalid(uriText, "Error evaluating EL expression:\n" + e.getMessage());
            }
View Full Code Here


  }

  public String getName() {
    try {
      String name = (String) getValue("name");
      name = (String) eval.evaluate(name, String.class, new DefaultVariables(),
                      StaticFunctionMapper.getDefault());
      return name.trim();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
View Full Code Here

  }
 
  public String getFilename() {
    try {
      String filename = (String) getValue("filename");
      filename = (String) eval.evaluate(filename, String.class, new DefaultVariables(),
                      StaticFunctionMapper.getDefault());
      return filename.trim();
    } catch (Exception e) {
      return null;
    }
View Full Code Here

  }

  public String getUri() {
    try {
      String uri = (String) eval.evaluate((String) getValue("uri"), String.class,
                        new DefaultVariables(null, getLastConverted(), null),
                        StaticFunctionMapper.getDefault());
      uri = uri.trim();
      if (jxl != null) {
        return jxl.resolve(uri);
      } else {
View Full Code Here

          }
            for (Iterator it = bookmarks.iterator(); it.hasNext();) {
                Bookmark bookmark = (Bookmark) it.next();
                if (bookmark.pattern.matcher(uri).matches()) {
                  String expression = bookmark.value;
          DefaultVariables variables = new DefaultVariables(uri, null, title);
          FunctionMapper functionMapper = StaticFunctionMapper.getDefault();
                    String name = (String) eval.evaluate(expression, String.class, variables, functionMapper);
                    name = name.trim();
                    if (name.length() > 0) {
            pluckerDocument.addBookmark(name, uri);
View Full Code Here

  public String rewrite(String uri) {
    try {
      for (Iterator it = rewriteList.iterator(); it.hasNext();) {
        Rule rule = (Rule) it.next();
        if (rule.pattern.matcher(uri).matches()) {
          DefaultVariables dv = new DefaultVariables(uri, null, null);
          return (String) eval.evaluate(rule.expression, String.class, dv,
                          StaticFunctionMapper.getDefault());
        }
      }
      return uri;
View Full Code Here

TOP

Related Classes of net.sf.jpluck.util.el.DefaultVariables

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.