Ejemplo n.º 1
0
void ResourceManager::addWebServiceInfo(IPropertyTree *wsinfo)
{
    //convert legacy web service info to the new resource format
    if (wsinfo)
    {
        if (wsinfo->hasProp("SOAP"))
            ensureManifestInfo()->addProp("WS-PARAMS", wsinfo->queryProp("SOAP"));
        if (wsinfo->hasProp("HELP"))
        {
            const char *content = wsinfo->queryProp("HELP");
            addCompress("HELP", strlen(content)+1, content);
        }
        if (wsinfo->hasProp("INFO"))
        {
            const char *content = wsinfo->queryProp("INFO");
            addCompress("INFO", strlen(content)+1, content);
        }
        if (wsinfo->hasProp("OTX"))
        {
            const char *content = wsinfo->queryProp("OTX");
            addCompress("HYPER-LINK", strlen(content)+1, content);
        }
        if (wsinfo->hasProp("HTML"))
        {
            const char *content = wsinfo->queryProp("HTML");
            Owned<IPropertyTree> manifestEntry = createPTree("Resource");
            manifestEntry->setProp("@name", "Custom Form");
            addCompress("XSLT", strlen(content)+1, content, manifestEntry);
            IPropertyTree *view = ensurePTree(ensureManifestInfo(), "Views/XSLT/FORM");
            view->setProp("@resource", "Custom Form");
        }
        if (wsinfo->hasProp("HTMLD"))
        {
            const char *content = wsinfo->queryProp("HTMLD");
            Owned<IPropertyTree> manifestEntry = createPTree("Resource");
            manifestEntry->setProp("@name", "Custom HTML");
            addCompress("HTML", strlen(content)+1, content, manifestEntry);
            IPropertyTree *view = ensurePTree(ensureManifestInfo(), "Views/HTML/FORM");
            view->setProp("@resource", "Custom HTML");
        }
        if (wsinfo->hasProp("RESULT"))
        {
            const char *content = wsinfo->queryProp("RESULT");
            Owned<IPropertyTree> manifestEntry = createPTree("Resource");
            manifestEntry->setProp("@name", "Results");
            addCompress("XSLT", strlen(content)+1, content, manifestEntry);
            IPropertyTree *view = ensurePTree(ensureManifestInfo(), "Views/XSLT/RESULTS");
            view->setProp("@resource", "Results");
        }
        if (wsinfo->hasProp("ERROR"))
        {
            const char *content = wsinfo->queryProp("ERROR");
            Owned<IPropertyTree> manifestEntry = createPTree("Resource");
            manifestEntry->setProp("@name", "Error");
            addCompress("XSLT", strlen(content)+1, content, manifestEntry);
            IPropertyTree *view = ensurePTree(ensureManifestInfo(), "Views/XSLT/ERROR");
            view->setProp("@resource", "Error");
        }
    }
}
Ejemplo n.º 2
0
IPropertyTree *CEsdlSvcEngine::createTargetContext(IEspContext &context, IPropertyTree *tgtcfg, IEsdlDefService &srvdef, IEsdlDefMethod &mthdef, IPropertyTree *req_pt)
{
    Owned<IPropertyTree> localCtx(createPTreeFromIPT(m_service_ctx, ipt_none));
    ensurePTree(localCtx, "Row/Common");
    localCtx->setProp("Row/Common/TransactionId", context.queryTransactionID());
    ensurePTree(localCtx, "Row/Common/ESP");
    localCtx->setProp("Row/Common/ESP/ServiceName", context.queryServiceName(""));
    //removing this entry since the Row/Common/ESP/Config/Method tree should have an attribute @name
    //localCtx->setProp("Row/Common/ESP/MethodName", mthdef.queryMethodName());
    ensurePTree(localCtx, "Row/Common/ESP/Config");
    localCtx->addPropTree("Row/Common/ESP/Config/Method", LINK(tgtcfg));
    return localCtx.getLink();
}
Ejemplo n.º 3
0
void CEsdlSvcEngine::init(const IPropertyTree *cfg, const char *process, const char *service)
{
    EsdlServiceImpl::init(cfg, process, service);

    m_service_ctx.setown( createPTree("Context", false) );
    ensurePTree(m_service_ctx, "Row");
}
void CLogContentFilter::addLogContentBranch(StringArray& branchNames, IPropertyTree* contentToLogBranch, IPropertyTree* updateLogRequestTree)
{
    IPropertyTree* pTree = updateLogRequestTree;
    unsigned numOfBranchNames = branchNames.length();
    unsigned i = 0;
    while (i < numOfBranchNames)
    {
        const char* branchName = branchNames.item(i);
        if (branchName && *branchName)
            pTree = ensurePTree(pTree, branchName);
        i++;
    }
    pTree->addPropTree(contentToLogBranch->queryName(), LINK(contentToLogBranch));
}
IPropertyTree *CEsdlSvcEngine::createTargetContext(IEspContext &context, IPropertyTree *tgtcfg, IEsdlDefService &srvdef, IEsdlDefMethod &mthdef, IPropertyTree *req_pt)
{
    const char *querytype = tgtcfg->queryProp("@querytype");
    if (!querytype || !strieq(querytype, "ROXIE")) //only roxie?
        return NULL;

    StringBuffer trxid;
    generateTransactionId(context, trxid);

    Owned<IPropertyTree> localCtx(createPTreeFromIPT(m_service_ctx, ipt_none));
    ensurePTree(localCtx, "Row/Common");
    localCtx->setProp("Row/Common/TransactionId", trxid.str());

    return localCtx.getLink();
}
Ejemplo n.º 6
0
void ResourceManifest::addToArchive(IPropertyTree *archive)
{
    IPropertyTree *additionalFiles = ensurePTree(archive, "AdditionalFiles");

    //xsi namespace required for proper representaion after PTree::setPropBin()
    if (!additionalFiles->hasProp("@xmlns:xsi"))
        additionalFiles->setProp("@xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");

    Owned<IPropertyTreeIterator> resources = manifest->getElements("Resource[@resourcePath]");
    ForEach(*resources)
    {
        IPropertyTree &item = resources->query();
        const char *respath = item.queryProp("@resourcePath");

        VStringBuffer xpath("Resource[@resourcePath='%s']", respath);
        if (!additionalFiles->hasProp(xpath.str()))
        {
            IPropertyTree *resTree = additionalFiles->addPropTree("Resource", createPTree("Resource"));

            const char *filepath = item.queryProp("@originalFilename");
            resTree->setProp("@originalFilename", filepath);
            resTree->setProp("@resourcePath", respath);

            MemoryBuffer content;
            loadResource(filepath, content);
            resTree->setPropBin(NULL, content.length(), content.toByteArray());
        }
    }

    StringBuffer xml;
    toXML(manifest, xml);

    IPropertyTree *manifest = additionalFiles->addPropTree("Manifest", createPTree("Manifest", ipt_none));
    manifest->setProp("@originalFilename", absFilename.str());
    manifest->setProp(NULL, xml.str());
}
Ejemplo n.º 7
0
void appendVariableParmInfo(IArrayOf<IPropertyTree> &parts, IResultSetFactory *resultSetFactory, IConstWUResult &var, unsigned hashWebserviceSeq=0)
{
    Owned<IResultSetMetaData> meta = resultSetFactory->createResultSetMeta(&var);
    StringAttr noinput;
    if (var.getResultFieldOpt("noinput", StringAttrAdaptor(noinput)).length() && strToBool(noinput.length(), noinput.get()))  //developer specified not to show field on form
        return;

    SCMStringBuffer varname;
    var.getResultName(varname);
    int seq = var.getResultSequence();

    WUResultFormat fmt = var.getResultFormat();

    SCMStringBuffer eclschema;
    var.getResultEclSchema(eclschema);

    StringBuffer width, height, fieldSeq, isPassword, select;
    var.getResultFieldOpt("fieldwidth", StringBufferAdaptor(width));
    var.getResultFieldOpt("fieldheight", StringBufferAdaptor(height));
    var.getResultFieldOpt("password", StringBufferAdaptor(isPassword));
    var.getResultFieldOpt("select", StringBufferAdaptor(select));
    if (hashWebserviceSeq)
        fieldSeq.append(hashWebserviceSeq);
    else
        var.getResultFieldOpt("sequence", StringBufferAdaptor(fieldSeq));

    SCMStringBuffer s;
    Owned<IPropertyTree> part = createPTree("part");
    if (!var.isResultScalar())
    {
        meta->getXmlSchema(s, false);
        part->setProp("@name", varname.str());
        part->setProp("@type", "tns:XmlDataset");
        if (fieldSeq.length())
            part->setProp("@sequence", fieldSeq);
    }
    else
    {
        meta->getColumnEclType(s, 0);
        DisplayType dt = meta->getColumnDisplayType(0);
        StringAttr ptype;
        switch (dt)
        {
        case TypeBoolean:
            ptype.set("xsd:boolean");
            break;
        case TypeInteger:
            ptype.set("xsd:integer");
            break;
        case TypeUnsignedInteger:
            ptype.set("xsd:integer");
            break;
        case TypeReal:
            ptype.set("xsd:real");
            break;
        case TypeSet:
            ptype.set("tns:EspStringArray");
            break;
        case TypeDataset:
        case TypeData:
            ptype.set("tns:XmlDataSet");
            break;
        case TypeUnicode:
        case TypeString:
            ptype.set("xsd:string");
            break;
        case TypeUnknown:
        case TypeBeginIfBlock:
        case TypeEndIfBlock:
        case TypeBeginRecord:
        default:
            ptype.set("xsd:string");
            break;
        }
        part->setProp("@name", varname.str());
        part->setProp("@type", ptype.str());
        if (width.length())
            part->setProp("@width", width);
        if (height.length())
            part->setProp("@height", height);
        if (fieldSeq.length())
            part->setProp("@sequence", fieldSeq);
        if (isPassword.length())
            part->setProp("@password", isPassword);
        if (select.length())
        {
            StringArray optionList;
            optionList.appendList(select, ",");
            IPropertyTree *selectTree = ensurePTree(part, "select");
            ForEachItemIn(i, optionList)
            {
                const char *value = optionList.item(i);
                bool selected = '*'==*value;
                if (selected)
                    value++;
                StringAttr name;
                const char *eq = strchr(value, '=');
                if (!eq)
                    name.set(value);
                else
                {
                    name.set(value, eq-value);
                    value = eq + 1;
                }
                Owned<IPropertyTree> optionTree = createPTree();
                optionTree->setProp("@name", name);
                optionTree->setProp("@value", value);
                if (selected)
                    optionTree->setPropBool("@selected", true);
                selectTree->addPropTree("option", optionTree.getClear());
            }
        }
    }