/** * Encodes the object in XML */ private void encodeStatusCode(PrintStream out, Indenter indenter, Iterator iterator) { String in = indenter.makeString(); String code = (String)(iterator.next()); if (iterator.hasNext()) { indenter.in(); out.println(in + "<StatusCode Value=\"" + code + "\">"); encodeStatusCode(out, indenter, iterator); out.println(in + "</StatusCode>"); indenter.out(); } else { out.println(in + "<StatusCode Value=\"" + code + "\"/>"); } }
public void encode(OutputStream output, Indenter indenter, String nsURI) { // Make a PrintStream for a nicer printing interface PrintStream out = new PrintStream(output); // Prepare the indentation string String topIndent = indenter.makeString(); out.println(topIndent + "<Response xmlns='"+nsURI+"'>"); // Now write the XML... // Go through all results Iterator it = results.iterator(); indenter.in(); while (it.hasNext()) { Result result = (Result)(it.next()); result.encode(out, indenter); } indenter.out(); // Finish the XML for a response out.println(topIndent + "</Response>"); } }
/** * Encodes this <code>TargetMatchGroup</code> into its XML representation * and writes this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); Iterator it = matches.iterator(); String name = TargetMatch.NAMES[matchType]; out.println(indent + "<" + name + ">"); indenter.in(); while (it.hasNext()) { TargetMatch tm = (TargetMatch)(it.next()); tm.encode(output, indenter); } out.println(indent + "</" + name + ">"); indenter.out(); }
/** * Private helper that encodes the parameters based on the type */ private void encodeParamaters(OutputStream output, Indenter indenter, String prefix, String id) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); Iterator it = getParameters().iterator(); out.println(indent + "<" + prefix + "CombinerParameters " + prefix + "IdRef=\"" + id + "\">"); indenter.in(); while (it.hasNext()) { CombinerParameter param = (CombinerParameter)(it.next()); param.encode(output, indenter); } out.println(indent + "</" + prefix + "CombinerParameters>"); indenter.out(); }
/** * Encodes this class into its XML representation and writes this * encoding to the given <code>OutputStream</code> with indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); out.println(indent + "<VariableDefinition VariableId=\"" + variableId + "\">"); indenter.in(); expression.encode(output, indenter); out.println("</VariableDefinition>"); indenter.out(); }
/** * Encodes this context into its XML representation and writes * this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { // Make a PrintStream for a nicer printing interface PrintStream out = new PrintStream(output); // Prepare the indentation string String indent = indenter.makeString(); // Now write the XML... out.println(indent + "<Response>"); // Go through all results Iterator it = results.iterator(); indenter.in(); while (it.hasNext()) { Result result = (Result)(it.next()); result.encode(out, indenter); } indenter.out(); // Finish the XML for a response out.println(indent + "</Response>"); }
/** * Routine used by <code>Policy</code> and <code>PolicySet</code> to * encode some common elements. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ protected void encodeCommonElements(OutputStream output, Indenter indenter) { Iterator it = childElements.iterator(); while (it.hasNext()) { ((CombinerElement)(it.next())).encode(output, indenter); } if (obligations.size() != 0) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); out.println(indent + "<Obligations>"); indenter.in(); it = obligations.iterator(); while (it.hasNext()) { ((Obligation)(it.next())).encode(output, indenter); } out.println(indent + "</Obligations>"); indenter.out(); } }
/** * Encodes this <code>Apply</code> into its XML representation and * writes this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); out.println(indent + "<Apply FunctionId=\"" + function.getIdentifier() + "\">"); indenter.in(); Iterator it = xprs.iterator(); while (it.hasNext()) { Expression xpr = (Expression)(it.next()); xpr.encode(output, indenter); } indenter.out(); out.println(indent + "</Apply>"); }
/** * Encodes this <code>Condition</code> into its XML representation and * writes this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); if (isVersionOne) { out.println(indent + "<Condition FunctionId=\"" + function.getIdentifier() + "\">"); indenter.in(); Iterator it = children.iterator(); while (it.hasNext()) { Expression xpr = (Expression)(it.next()); xpr.encode(output, indenter); } } else { out.println(indent + "<Condition>"); indenter.in(); expression.encode(output, indenter); } indenter.out(); out.println(indent + "</Condition>"); }
"\" FulfillOn=\"" + Result.DECISIONS[fulfillOn] + "\">"); indenter.in();
/** * Encodes this status data into its XML representation and writes * this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); out.println(indent + "<Status>"); indenter.in(); encodeStatusCode(out, indenter, code.iterator()); if (message != null) out.println(indenter.makeString() + "<StatusMessage>" + message + "</StatusMessage>"); if (detail != null) out.println(detail.getEncoded()); indenter.out(); out.println(indent + "</Status>"); }
indenter.in(); String nextIndent = indenter.makeString();
/** * Encodes this <code>TargetMatch</code> into its XML representation and * writes this encoding to the given <code>OutputStream</code> with * indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); String tagName = NAMES[type] + "Match"; out.println(indent + "<" + tagName + " MatchId=\"" + function.getIdentifier().toString()+ "\">"); indenter.in(); attrValue.encode(output, indenter); eval.encode(output, indenter); indenter.out(); out.println(indent + "</" + tagName + ">"); }
/** * Encodes this parameter into its XML representation and writes this * encoding to the given <code>OutputStream</code> with indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); out.println(indent + "<CombinerParameter ParameterName=\"" + getName() + "\">"); indenter.in(); getValue().encode(output, indenter); out.println(indent + "</CombinerParameter>"); indenter.out(); }
/** * Encodes this element's <code>Rule</code> and parameters into their * XML representation and writes this encoding to the given * <code>OutputStream</code> with indentation. * * @param output a stream into which the XML-encoded data is written * @param indenter an object that creates indentation strings */ public void encode(OutputStream output, Indenter indenter) { Iterator it = getParameters().iterator(); if (it.hasNext()) { PrintStream out = new PrintStream(output); String indent = indenter.makeString(); out.println(indent + "<RuleCombinerParameters RuleIdRef=\"" + getRule().getId() + "\">"); indenter.in(); while (it.hasNext()) { CombinerParameter param = (CombinerParameter)(it.next()); param.encode(output, indenter); } out.println(indent + "</RuleCombinerParameters>"); indenter.out(); } getRule().encode(output, indenter); }
"\">"); indenter.in(); String nextIndent = indenter.makeString();
"\">"); indenter.in(); String nextIndent = indenter.makeString();
} else { out.println(indent + "<Target>"); indenter.in();