1 22 23 package org.xquark.mediator.plan ; 24 25 import org.xquark.mediator.decomposer.Utils; 26 import org.xquark.mediator.runtime.MediatorException; 27 import org.xquark.xquery.parser.XQueryExpression; 28 29 public abstract class ZeroOp extends Operator { 30 private static final String RCSRevision = "$Revision: 1.6 $"; 34 private static final String RCSName = "$Name: $"; 35 39 45 public ZeroOp(ExecutionPlan plan, XQueryExpression expression) throws MediatorException { 46 super(plan, expression) ; 47 } 48 52 public void accept(OperatorVisitor visitor) throws MediatorException { 53 visitor.visit(this); 54 } 55 56 62 public ResultSet executeQuery(DynamicContext context) throws MediatorException { 63 return getResultSet(context); 64 } 65 66 67 69 protected abstract ResultSet getResultSet(DynamicContext context) throws MediatorException; 70 71 80 protected boolean shareSameSources() { 81 return true ; 82 } 83 84 89 public boolean isSource() { 90 return true ; 91 } 92 93 public void terminate() { 94 } 96 public void setPrepared() throws MediatorException { 97 if (prepared) return; 98 prepared = true; 99 } 101 102 107 109 public String toCompleteString(int indent) { 110 StringBuffer buf = new StringBuffer () ; 111 buf.append(Utils.makeIndent(indent) + "<" + getClass().getName() + " isLet=\"" + isLet() + "\">\n") ; 112 buf.append(Utils.makeIndent(indent + 1) + "<Expression>\n") ; 113 buf.append(Utils.makeIndent(indent + 2) + expression + "\n") ; 114 buf.append(Utils.makeIndent(indent + 1) + "</Expression>\n") ; 115 if (paths != null) { 123 buf.append(Utils.makeIndent(indent + 1) + "<Paths>\n") ; 124 for (int i = 0 ; i < paths.size() ; i ++) { 125 buf.append(Utils.makeIndent(indent + 2) + "<Path>" + paths.get(i) + "</Path>\n") ; 126 } 127 buf.append(Utils.makeIndent(indent + 1) + "</Paths>\n") ; 128 } 129 buf.append(Utils.makeIndent(indent) + "</" + getClass().getName() + ">\n") ; 130 return buf.toString() ; 131 } 132 } 133 | Popular Tags |