Exemplo n.º 1
0
 public Event execute(
     XMLConsumer consumer,
     ExpressionContext expressionContext,
     ExecutionContext executionContext,
     MacroContext macroContext,
     Event startEvent,
     Event endEvent)
     throws SAXException {
   Iterator iter = getSubstitutions().iterator();
   while (iter.hasNext()) {
     Subst subst = (Subst) iter.next();
     char[] chars;
     if (subst instanceof Literal) {
       chars = ((Literal) subst).getCharArray();
       consumer.characters(chars, 0, chars.length);
     } else {
       JXTExpression expr = (JXTExpression) subst;
       try {
         Object val = expr.getNode(expressionContext);
         Invoker.executeNode(consumer, val);
       } catch (Exception e) {
         throw new SAXParseException(e.getMessage(), getLocation(), e);
       } catch (Error err) {
         throw new SAXParseException(err.getMessage(), getLocation(), new ErrorHolder(err));
       }
     }
   }
   return getNext();
 }
Exemplo n.º 2
0
 public Serializable getKey() {
   JXTExpression cacheKeyExpr =
       (JXTExpression) this.startDocument.getTemplateProperty(JXTemplateGenerator.CACHE_KEY);
   if (cacheKeyExpr == null) return null;
   try {
     final Serializable templateKey = (Serializable) cacheKeyExpr.getValue(this.expressionContext);
     if (templateKey != null) {
       return new JXCacheKey(this.startDocument.getUri(), templateKey);
     }
   } catch (Exception e) {
     getLogger().error("error evaluating cache key", e);
   }
   return null;
 }
Exemplo n.º 3
0
 public SourceValidity getValidity() {
   JXTExpression validityExpr =
       (JXTExpression) this.startDocument.getTemplateProperty(JXTemplateGenerator.VALIDITY);
   if (validityExpr == null) return null;
   try {
     final SourceValidity sourceValidity = this.startDocument.getSourceValidity();
     final SourceValidity templateValidity =
         (SourceValidity) validityExpr.getValue(this.expressionContext);
     if (sourceValidity != null && templateValidity != null) {
       return new JXSourceValidity(sourceValidity, templateValidity);
     }
   } catch (Exception e) {
     getLogger().error("error evaluating cache validity", e);
   }
   return null;
 }