Search in sources :

Example 46 with DumpTable

use of lucee.runtime.dump.DumpTable 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;
}
Also used : Binding(javax.wsdl.Binding) Parameters(org.apache.axis.wsdl.symbolTable.Parameters) Port(javax.wsdl.Port) SOAPHeaderElement(org.apache.axis.message.SOAPHeaderElement) Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) SymbolTable(org.apache.axis.wsdl.symbolTable.SymbolTable) Text(org.w3c.dom.Text) Operation(javax.wsdl.Operation) DumpTable(lucee.runtime.dump.DumpTable) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) KeyIterator(lucee.runtime.type.it.KeyIterator) KeyAsStringIterator(lucee.runtime.type.it.KeyAsStringIterator) ObjectsIterator(lucee.runtime.type.it.ObjectsIterator) Iterator(java.util.Iterator) ObjectsEntryIterator(lucee.runtime.type.it.ObjectsEntryIterator) BindingEntry(org.apache.axis.wsdl.symbolTable.BindingEntry)

Example 47 with DumpTable

use of lucee.runtime.dump.DumpTable 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;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) QName(javax.xml.namespace.QName) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Parameter(org.apache.axis.wsdl.symbolTable.Parameter)

Example 48 with DumpTable

use of lucee.runtime.dump.DumpTable 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 "";
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) DumpWriter(lucee.runtime.dump.DumpWriter) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Resource(lucee.commons.io.res.Resource) DumpProperties(lucee.runtime.dump.DumpProperties) PageContextImpl(lucee.runtime.PageContextImpl) IOException(java.io.IOException) DumpData(lucee.runtime.dump.DumpData) SimpleDumpData(lucee.runtime.dump.SimpleDumpData)

Aggregations

DumpTable (lucee.runtime.dump.DumpTable)48 SimpleDumpData (lucee.runtime.dump.SimpleDumpData)39 DumpData (lucee.runtime.dump.DumpData)6 PageException (lucee.runtime.exp.PageException)5 Collection (lucee.runtime.type.Collection)4 Key (lucee.runtime.type.Collection.Key)4 SQL (lucee.runtime.db.SQL)3 DumpRow (lucee.runtime.dump.DumpRow)3 PageRuntimeException (lucee.runtime.exp.PageRuntimeException)3 Struct (lucee.runtime.type.Struct)3 IOException (java.io.IOException)2 Iterator (java.util.Iterator)2 Binding (javax.wsdl.Binding)2 BindingOperation (javax.wsdl.BindingOperation)2 Operation (javax.wsdl.Operation)2 Port (javax.wsdl.Port)2 QName (javax.xml.namespace.QName)2 DumpProperties (lucee.runtime.dump.DumpProperties)2 DumpWriter (lucee.runtime.dump.DumpWriter)2 ExpressionException (lucee.runtime.exp.ExpressionException)2