use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.
the class HTTPClient method toDumpData.
@Override
public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
try {
Array args;
Struct sct = getMetaData(pageContext), val, a;
DumpTable cfc = new DumpTable("udf", "#66ccff", "#ccffff", "#000000"), udf, arg;
cfc.setTitle("Web Service (HTTP)");
if (dp.getMetainfo())
cfc.setComment(url.toExternalForm());
Iterator<Entry<Key, Object>> it = sct.entryIterator();
Entry<Key, Object> e;
// Loop UDFs
while (it.hasNext()) {
e = it.next();
val = Caster.toStruct(e.getValue());
// udf name
udf = new DumpTable("udf", "#66ccff", "#ccffff", "#000000");
arg = new DumpTable("udf", "#66ccff", "#ccffff", "#000000");
cfc.appendRow(1, new SimpleDumpData(e.getKey().getString()), udf);
// args
args = Caster.toArray(val.get(KeyConstants._arguments));
udf.appendRow(1, new SimpleDumpData("arguments"), arg);
arg.appendRow(7, new SimpleDumpData("name"), new SimpleDumpData("required"), new SimpleDumpData("type"));
Iterator<Object> ait = args.valueIterator();
while (ait.hasNext()) {
a = Caster.toStruct(ait.next());
arg.appendRow(0, new SimpleDumpData(Caster.toString(a.get(KeyConstants._name))), new SimpleDumpData(Caster.toString(a.get(KeyConstants._required))), new SimpleDumpData(Caster.toString(a.get(KeyConstants._type))));
}
// return type
udf.appendRow(1, new SimpleDumpData("return type"), new SimpleDumpData(Caster.toString(val.get(KeyConstants._returntype))));
/*
cfc.appendRow(new DumpRow(0,new DumpData[]{
new SimpleDumpData(arg.getDisplayName()),
new SimpleDumpData(e.getKey().getString()),
new SimpleDumpData(arg.isRequired()),
new SimpleDumpData(arg.getTypeAsString()),
def,
new SimpleDumpData(arg.getHint())}));*/
}
return cfc;
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw new PageRuntimeException(Caster.toPageException(t));
}
}
use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.
the class Axis1Client method _toDumpData.
private DumpData _toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) throws PageException {
DumpTable functions = new DumpTable("webservice", "#99cccc", "#ccffff", "#000000");
functions.setTitle("Web Service (Axis 1)");
if (dp.getMetainfo())
functions.setComment(wsdlUrl);
// DumpTable functions = new DumpTable("#ccccff","#cccc00","#000000");
Port port = getPort();
Binding binding = port.getBinding();
// Parameters parameters = null;
// Parameter p = null;
SymbolTable symbolTable = parser.getSymbolTable();
BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
Iterator itr = bEntry.getParameters().keySet().iterator();
Operation tmpOp = null;
// Operation operation = null;
while (itr.hasNext()) {
tmpOp = (Operation) itr.next();
Element el = tmpOp.getDocumentationElement();
StringBuffer doc = new StringBuffer();
if (el != null) {
NodeList children = XMLUtil.getChildNodes(el, Node.TEXT_NODE);
int len = children.getLength();
Text text;
for (int i = 0; i < len; i++) {
text = (Text) children.item(i);
doc.append(text.getData());
}
}
// parameters = (Parameters)bEntry.getParameters().get(tmpOp);
functions.appendRow(1, new SimpleDumpData(tmpOp.getName()), _toHTMLOperation(tmpOp.getName(), doc.toString(), (Parameters) bEntry.getParameters().get(tmpOp)));
}
// box.appendRow(1,new SimpleDumpData(""),functions);
return functions;
}
use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.
the class Axis1Client method _toHTMLOperation.
private DumpData _toHTMLOperation(String title, String doc, Parameters parameters) {
DumpTable table = new DumpTable("#99cccc", "#ccffff", "#000000");
table.setTitle(title);
if (doc.length() > 0)
table.setComment(doc);
DumpTable attributes = new DumpTable("#99cccc", "#ccffff", "#000000");
String returns = "void";
attributes.appendRow(3, new SimpleDumpData("name"), new SimpleDumpData("type"));
for (int j = 0; j < parameters.list.size(); j++) {
Parameter p = (Parameter) parameters.list.get(j);
QName paramType = org.apache.axis.wsdl.toJava.Utils.getXSIType(p);
String strType = paramType.getLocalPart();
switch(p.getMode()) {
case Parameter.IN:
attributes.appendRow(0, new SimpleDumpData(p.getName()), new SimpleDumpData(toLuceeType(strType)));
break;
case Parameter.OUT:
returns = toLuceeType(strType);
break;
case Parameter.INOUT:
attributes.appendRow(0, new SimpleDumpData(p.getName()), new SimpleDumpData(toLuceeType(strType)));
returns = toLuceeType(strType);
break;
}
}
Parameter rtn = parameters.returnParam;
if (rtn != null) {
QName paramType = org.apache.axis.wsdl.toJava.Utils.getXSIType(rtn);
String strType = paramType.getLocalPart();
returns = toLuceeType(strType);
}
table.appendRow(1, new SimpleDumpData("arguments"), attributes);
table.appendRow(1, new SimpleDumpData("return type"), new SimpleDumpData(returns));
return table;
}
use of lucee.runtime.dump.SimpleDumpData in project Lucee by lucee.
the class Dump method call.
public static String call(PageContext pc, Object object, String label, boolean expand, double maxLevel, String show, String hide, String output, String format, double keys, boolean metainfo, boolean showUDFs) throws PageException {
if (show != null && "all".equalsIgnoreCase(show.trim()))
show = null;
if (hide != null && "all".equalsIgnoreCase(hide.trim()))
hide = null;
// PageContext pcc = pc;
try {
// output
int defType = DumpWriter.DEFAULT_RICH;
int outputType = OUTPUT_TYPE_NONE;
Resource outputRes = null;
if (!StringUtil.isEmpty(output, true)) {
output = output.trim();
if ("browser".equalsIgnoreCase(output)) {
outputType = OUTPUT_TYPE_BROWSER;
defType = DumpWriter.DEFAULT_RICH;
} else if ("console".equalsIgnoreCase(output)) {
outputType = OUTPUT_TYPE_CONSOLE;
defType = DumpWriter.DEFAULT_PLAIN;
} else {
outputType = OUTPUT_TYPE_RESOURCE;
defType = DumpWriter.DEFAULT_RICH;
outputRes = ResourceUtil.toResourceNotExisting(pc, output);
}
}
// format
DumpWriter writer = pc.getConfig().getDumpWriter(format, defType);
Set<String> setShow = (show != null) ? ListUtil.listToSet(show.toLowerCase(), ",", true) : null;
Set<String> setHide = (hide != null) ? ListUtil.listToSet(hide.toLowerCase(), ",", true) : null;
DumpProperties properties = new DumpProperties((int) maxLevel, setShow, setHide, (int) keys, metainfo, showUDFs);
DumpData dd = DumpUtil.toDumpData(object, pc, (int) maxLevel, properties);
if (!StringUtil.isEmpty(label)) {
DumpTable table = new DumpTable("#ffffff", "#cccccc", "#000000");
table.appendRow(1, new SimpleDumpData(label));
// table.appendRow(1,new SimpleDumpData(getContext()));
table.appendRow(0, dd);
dd = table;
}
// formatType==FORMAT_TYPE_TEXT
boolean isText = "text".equalsIgnoreCase(format);
if (OUTPUT_TYPE_BROWSER == outputType || outputType == OUTPUT_TYPE_NONE) {
if (isText)
pc.forceWrite("<pre>");
pc.forceWrite(writer.toString(pc, dd, expand));
if (isText)
pc.forceWrite("</pre>");
} else if (OUTPUT_TYPE_CONSOLE == outputType)
System.out.println(writer.toString(pc, dd, expand));
else if (OUTPUT_TYPE_RESOURCE == outputType)
IOUtil.write(outputRes, writer.toString(pc, dd, expand) + "\n************************************************************************************\n", ((PageContextImpl) pc).getResourceCharset(), true);
} catch (IOException e) {
throw Caster.toPageException(e);
}
return "";
}
Aggregations