Пример #1
0
//when we aren't loading dynamically
// Change the function names when we stick with dynamic loading.
ESP_FACTORY IEspService * esp_service_factory(const char *name, const char* type, IPropertyTree *cfg, const char *process)
{
    if (strcmp(type, "ws_ecl")==0)
    {
        CWsEclService* service = new CWsEclService;
        service->init(name, type, cfg, process);
        return service;
    }
    else
    {
        throw MakeStringException(-1, "Unknown service type %s", type);
    }
    
    return NULL;
}
Пример #2
0
void LZMALZDecompressToBuffer(MemoryAttr & out, MemoryBuffer & in)
{
    size32_t expsz;
    size32_t cmpsz;
    in.read(expsz).read(cmpsz);
    void *o = out.allocate(expsz);
    if (cmpsz!=expsz) {
        CLZMA lzma;
        size32_t written = lzma.expand(in.readDirect(cmpsz),cmpsz,o,expsz);
        if (written!=expsz)
            throw MakeStringException(0, "fastLZDecompressToBuffer - corrupt data(4) %d %d",written,expsz);
    }
    else
        memcpy(o,in.readDirect(cmpsz),expsz);
}
void CWsPackageProcessEx::getPkgInfoById(const char *packageMapId, IPropertyTree* tree)
{
    if (!packageMapId || !*packageMapId)
        return;

    Owned<IPropertyTree> packageMaps = packageMapAndSet.getPackageMaps();
    if (!packageMaps)
        throw MakeStringException(PKG_DALI_LOOKUP_ERROR, "Unable to retrieve information about package maps from dali server");

    StringBuffer xpath;
    xpath.append("PackageMap[@id='").append(packageMapId).append("']");
    IPropertyTree *mapTree = packageMaps->queryPropTree(xpath);
    if (mapTree)
        mergePTree(tree, mapTree);
}
Пример #4
0
IClientWsEclResp* CClientWsEclService::sendHttpRequest(IClientWsEclRequest* request, const char* method, const char* URL, 
                                                                                    const char *user, const char *pw, const char *realm,
                                                                                    const char* httpPostVariableName, bool encodeHttpPostBody)
{
    if(strlen(URL) == 0)
        throw MakeStringException(-1, "url not set");

    CClientWsEclRequest* eclrequest = dynamic_cast<CClientWsEclRequest*>(request);
    Owned<CClientWsEclResponse> eclresponse = new CClientWsEclResponse;
    eclresponse->setRequestId(m_reqId);
    m_reqId++;

    eclrequest->sendHttpRequest(*eclresponse, method, URL, user, pw, realm, httpPostVariableName, encodeHttpPostBody);
    return eclresponse.getClear();
}
Пример #5
0
void LZMADecompressToAttr(MemoryAttr & out, const void * src)
{
    size32_t *sz = (size32_t *)src;
    size32_t expsz = *(sz++);
    size32_t cmpsz = *(sz++);
    void *o = out.allocate(expsz);
    if (cmpsz!=expsz) {
        CLZMA lzma;
        size32_t written = lzma.expand(sz,cmpsz,o,expsz);
        if (written!=expsz)
            throw MakeStringException(0, "fastLZDecompressToBuffer - corrupt data(2) %d %d",written,expsz);
    }
    else
        memcpy(o,sz,expsz);
}
static IWorkUnitFactory * getWorkunitFactory(ICodeContext * ctx)
{
    IEngineContext *engineCtx = ctx->queryEngineContext();
    if (engineCtx && !engineCtx->allowDaliAccess())
    {
        Owned<IException> e = MakeStringException(-1, "workunitservices cannot access Dali in this context - this normally means it is being called from a thor slave");
        EXCLOG(e, NULL);
        throw e.getClear();
    }

    //MORE: These should really be set up correctly - probably should be returned from IEngineContext
    ISecManager *secmgr = NULL;
    ISecUser *secuser = NULL;
    return getWorkUnitFactory(secmgr, secuser);
}
Пример #7
0
bool CWsLoggingServiceEx::init(const char* service, const char* type, IPropertyTree* cfg, const char* process)
{
    VStringBuffer xpath("Software/EspProcess[@name=\"%s\"]/EspService[@name=\"%s\"]", process, service);
    Owned<IPropertyTree> pServiceNode = cfg->getPropTree(xpath.str());
    if (!pServiceNode)
        throw MakeStringException(-1, "No settings found for service %s", service);

    Owned<IPropertyTreeIterator> logAgents = pServiceNode->getElements("LogAgent");
    if (!logAgents)
        throw MakeStringException(-1, "No logAgent is defined for service %s", service);

    ForEach(*logAgents)
    {
        IPropertyTree& ptree = logAgents->query();
        const char* agentName = ptree.queryProp("@name");
        const char* agentType = ptree.queryProp("@type");
        const char* agentPlugin = ptree.queryProp("@plugin");
        if (!agentName || !*agentName || !agentPlugin || !*agentPlugin)
            continue;

        IEspLogAgent* logAgent = loadLoggingAgent(agentName, agentPlugin);
        if (!logAgent)
        {
            ERRLOG(-1, "Failed to create logging agent for %s", agentName);
            continue;
        }
        logAgent->init(agentName, agentType, &ptree, process);
        IUpdateLogThread* logThread = createUpdateLogThread(&ptree, service, agentName, logAgent);
        if(!logThread)
            throw MakeStringException(-1, "Failed to create update log thread for %s", agentName);

        loggingAgentThreads.push_back(logThread);
    }

    return true;
}
Пример #8
0
    virtual bool finalizeOptions(IProperties *globals)
    {
        extractEsdlCmdOption(optIncludePath, globals, ESDLOPT_INCLUDE_PATH_ENV, ESDLOPT_INCLUDE_PATH_INI, NULL, NULL);

        if (optSource.isEmpty())
        {
            usage();
            throw( MakeStringException(0, "Error: Path to ESDL Source required"));
        }

        if( optService.isEmpty() )
        {
            usage();
            throw( MakeStringException(0, "An ESDL service name must be specified") );
        }

        if( optMethod.isEmpty() )
        {
            usage();
            throw( MakeStringException(0, "An ESDL method name must be specified") );
        }
        cmdHelper.verbose = optVerbose;
        return true;
    }
Пример #9
0
/**************************************************************************
 *  CSecureHttpProtocol Implementation                                    *
 **************************************************************************/
CSecureHttpProtocol::CSecureHttpProtocol(IPropertyTree* cfg)
{
    m_maxConcurrentThreads = 0;

    if(cfg != NULL)
    {
        m_config.setown(cfg);

        //ensure keys are specified. Passphrase is optional
        StringBuffer sb;
        cfg->getProp("certificate", sb);
        if(sb.length() == 0)
        {
            throw MakeStringException(-1, "certificate file not specified in config file");
        }

        cfg->getProp("privatekey", sb.clear());
        if(sb.length() == 0)
        {
            throw MakeStringException(-1, "private key file not specified in config file");
        }

        createSecureSocketContextEx2_t xproc = NULL;
        IEspPlugin *pplg = loadPlugin(SSLIB);
        if (pplg)
            xproc = (createSecureSocketContextEx2_t) pplg->getProcAddress("createSecureSocketContextEx2");
        else
            throw MakeStringException(-1, "dll/shared-object %s can't be loaded", SSLIB);


        if (xproc)
            m_ssctx.setown(xproc(cfg, ServerSocket));
        else
            throw MakeStringException(-1, "procedure createSecureSocketContextEx2 can't be loaded");
    }
}
Пример #10
0
IEclPlusHelper * createEclPlusHelper(IProperties * globals)
{
    // Check to see what kind of helper to return !
    IFormatType * format = createFormatter(globals);
    IEclPlusHelper * helper = NULL;
    if(globals->hasProp("action"))
    {
        const char * action = globals->queryProp("action");
        if(!stricmp(action, "list"))
        {
            helper = new ListHelper(LINK(globals), format);
        }
        // Now re-enable delete
        else if(!stricmp(action, "delete"))
        {
            helper = new DeleteHelper(LINK(globals), format);
        }
        else if(!stricmp(action, "dump"))
        {
            helper = new DumpHelper(LINK(globals), format);
        }
        else if(!stricmp(action, "graph"))
        {
            helper = new GraphHelper(LINK(globals), format);
        }
        else if(!stricmp(action, "view"))
        {
            helper = new ViewHelper(LINK(globals), format);
        }
        else if(!stricmp(action, "query"))
        {
            helper = new QueryHelper(LINK(globals), format);
        }
        else if(!stricmp(action, "abort"))
        {
            helper = new AbortHelper(LINK(globals), format);
        }
        else if(!stricmp(action, "rerun"))
        {
            helper = new RerunHelper(LINK(globals), format);
        }
        else
        {
            throw MakeStringException(-1, "unknown action");
        }
    }
    return helper;
}
Пример #11
0
    bool finalizeOptions(IProperties *globals)
    {
        if (optInput.length())
        {
            const char *in = optInput.get();
            while (*in && isspace(*in)) in++;
            if (*in!='<')
            {
                StringBuffer content;
                content.loadFile(in);
                optInput.set(content.str());
            }
        }

        if (!optVersionStr.isEmpty())
        {
            optVersion = atof( optVersionStr.get() );
            if( optVersion <= 0 )
            {
                throw MakeStringException( 0, "Version option must be followed by a real number > 0" );
            }
        }
        else
            throw MakeStringException( 0, "ESDL service definition version must be provided!" );

        if(optTargetESPProcName.isEmpty())
            throw MakeStringException( 0, "Name of Target ESP process must be provided" );

        if (optService.isEmpty())
            throw MakeStringException( 0, "Name of ESDL based service must be provided" );

        if (optWSProcAddress.isEmpty())
            throw MakeStringException( 0, "Server address of ESDL process server must be provided" );

        if (optWSProcPort.isEmpty())
            throw MakeStringException( 0, "Port on which ESDL process is listening must be provided" );

        if (optMethod.isEmpty())
            throw MakeStringException( 0, "Name of ESDL based method must be provided" );

        if (optBindingName.isEmpty())
            throw MakeStringException( 0, "Name of ESP binding must be provided" );

        return true;
    }
Пример #12
0
NamedMutex::NamedMutex(const char *name)
{
    {
        CriticalBlock b(lockPrefixCS);
        if (0 == lockPrefix.length())
        {
            if (!getConfigurationDirectory(NULL, "lock", NULL, NULL, lockPrefix))
                throw MakeStringException(0, "Failed to get lock directory from environment");
        }
        addPathSepChar(lockPrefix);
        lockPrefix.append("JLIBMUTEX_");
    }
    StringBuffer tmp(lockPrefix);
    tmp.append("JLIBMUTEX_").append(name);
    mutexfname = tmp.detach();
}
Пример #13
0
IClientWsEclResp* CClientWsEclService::search(IClientWsEclRequest* request)
{
    if(strlen(m_url) == 0)
    {
        throw MakeStringException(-1, "url not set");
    }

    CClientWsEclRequest* eclrequest = dynamic_cast<CClientWsEclRequest*>(request);
    Owned<CClientWsEclResponse> eclresponse = new CClientWsEclResponse;
    eclresponse->setRequestId(m_reqId);
    
    m_reqId++;
    
    eclrequest->post(m_url, *eclresponse);

    return eclresponse.getClear();
}
Пример #14
0
unsigned getNextSize(unsigned max, unsigned required)
{
    if (required > DOUBLE_LIMIT)
    {
        max = (required + DOUBLE_LIMIT) & ~(DOUBLE_LIMIT-1);
        if (required >= max)
            throw MakeStringException(-1, "getNextSize: Request for %d bytes oldMax = %d", required, max);
    }
    else
    {
        if (max == 0)
            max = FIRST_CHUNK_SIZE;
        while (required >= max)
            max += max;
    }
    return max;
}
Пример #15
0
void ParseErrorHandler::handleSAXParserException(const SAXParseException& e, const char* errorType)
{
    char systemId[256], publicId[256];

    XMLString::transcode(e.getSystemId(),systemId,255);
    XMLString::transcode(e.getPublicId(),publicId,255);
    char* message = XMLString::transcode(e.getMessage());

    StringBuffer msg, line,col;
    line.appendlong(e.getLineNumber());
    col.appendlong(e.getColumnNumber());
    msg.appendf("%s at \"%s\", line %s, char %s:  %s", errorType,
                (publicId&&publicId[0]) ? publicId : systemId, line.str(), col.str(), message);
    appendException(MakeStringException(-1,"%s", msg.str()));

    XMLString::release(&message);
}
bool CLoggingManager::updateLog(IEspContext* espContext, const char* option, IPropertyTree* userContext, IPropertyTree* userRequest,
    const char* backEndReq, const char* backEndResp, const char* userResp, const char* logDatasets, StringBuffer& status)
{
    if (!initialized)
        throw MakeStringException(-1,"LoggingManager not initialized");

    bool bRet = false;
    try
    {
        Owned<IPropertyTree> espContextTree;
        if (espContext)
        {
            espContextTree.setown(createPTree("ESPContext"));

            short port;
            StringBuffer sourceIP, peerStr;
            const char* esdlBindingID = espContext->queryESDLBindingID();
            espContext->getServAddress(sourceIP, port);
            espContextTree->addProp("SourceIP", sourceIP.str());
            espContext->getPeer(peerStr);
            espContextTree->addProp("Peer", peerStr.str());
            if (!isEmptyString(esdlBindingID))
                espContextTree->addProp("ESDLBindingID", esdlBindingID);
            //More information in espContext may be added to the espContextTree later.

            const char* userId = espContext->queryUserId();
            if (userId && *userId)
                espContextTree->addProp("UserName", userId);

            espContextTree->addProp("ResponseTime", VStringBuffer("%.4f", (msTick()-espContext->queryCreationTime())/1000.0));
        }
        Owned<IEspUpdateLogRequestWrap> req =  new CUpdateLogRequestWrap(nullptr, option, espContextTree.getClear(), LINK(userContext), LINK(userRequest),
            backEndReq, backEndResp, userResp, logDatasets);
        Owned<IEspUpdateLogResponse> resp =  createUpdateLogResponse();
        bRet = updateLog(espContext, *req, *resp, status);
    }
    catch (IException* e)
    {
        status.set("Failed to update log: ");
        e->errorMessage(status);
        ERRLOG("%s", status.str());
        e->Release();
    }
    return bRet;
}
void CCassandraLogAgent::initKeySpace()
{
    //Initialize Cassandra Cluster Session
    cassSession.setown(new CassandraClusterSession(cass_cluster_new()));
    if (!cassSession)
        throw MakeStringException(-1,"Unable to create cassandra cassSession session");

    setSessionOptions(NULL);

    //ensure defaultDB
    ensureDefaultKeySpace();

    //ensure transSeed tables
    ensureTransSeedTable();

    //Read logging transaction seed
    queryTransactionSeed(loggingTransactionApp.get(), loggingTransactionSeed);
}
Пример #18
0
void LogicFileWrapper::FindClusterName(const char* logicalName, StringBuffer& returnCluster, IUserDescriptor* udesc)
{
    try {
        Owned<IDistributedFile> df = queryDistributedFileDirectory().lookup(logicalName, udesc) ;
        if(!df)
            throw MakeStringException(-1,"Could not find logical file");
        df->getClusterName(0,returnCluster);    // ** TBD other cluster
    }
    catch(IException* e){   
      StringBuffer msg;
      e->errorMessage(msg);
        WARNLOG("%s", msg.str());
        e->Release();
    }
    catch(...){
        WARNLOG("Unknown Exception thrown within LogicFileWrapper::FindClusterName");
    }
}
bool Cws_machineEx::onStartStop( IEspContext &context, IEspStartStopRequest &req, 
                                         IEspStartStopResponse &resp)
{
    try
    {
        if (!context.validateFeatureAccess(EXEC_FEATURE_URL, SecAccess_Full, false))
            throw MakeStringException(ECLWATCH_EXECUTION_ACCESS_DENIED, "Permission denied.");

        char* userName = (char*) m_sTestStr1.str();
        char* password = (char*) m_sTestStr2.str();
        doStartStop(context, req.getAddresses(), userName, password, req.getStop(), resp);
    }
    catch(IException* e)
    {   
        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
    }
    return true;
}
Пример #20
0
    static ISecManager* loadSecManager(const char* model_name, const char* servicename, IPropertyTree* cfg)
    {
        if(model_name && stricmp(model_name, "LdapSecurity") == 0)
        {
            HINSTANCE ldapseclib = LoadSharedObject(LDAPSECLIB, true, false);
            if(ldapseclib == NULL)
                throw MakeStringException(-1, "can't load library %s", LDAPSECLIB);
            
            newSecManager_t_ xproc = NULL;
            xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newLdapSecManager");

            if (xproc)
                return xproc(servicename, *cfg);
            else
                throw MakeStringException(-1, "procedure newLdapSecManager of %s can't be loaded", LDAPSECLIB);
        }
        else if(model_name && stricmp(model_name, "Local") == 0)
        {
            HINSTANCE ldapseclib = LoadSharedObject(LDAPSECLIB, true, false);
            if(ldapseclib == NULL)
                throw MakeStringException(-1, "can't load library %s", LDAPSECLIB);
            
            newSecManager_t_ xproc = NULL;
            xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newLocalSecManager");

            if (xproc)
                return xproc(servicename, *cfg);
            else
                throw MakeStringException(-1, "procedure newLocalSecManager of %s can't be loaded", LDAPSECLIB);
        }
        else if(model_name && stricmp(model_name, "Default") == 0)
        {
            HINSTANCE ldapseclib = LoadSharedObject(LDAPSECLIB, true, false);
            if(ldapseclib == NULL)
                throw MakeStringException(-1, "can't load library %s", LDAPSECLIB);
            
            newSecManager_t_ xproc = NULL;
            xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newDefaultSecManager");

            if (xproc)
                return xproc(servicename, *cfg);
            else
                throw MakeStringException(-1, "procedure newDefaultSecManager of %s can't be loaded", LDAPSECLIB);
        }
        else
            throw MakeStringException(-1, "Security model %s not supported", model_name?model_name:"UNKNOWN");
    }   
Пример #21
0
int CXslTransform::setResultTarget(char *pszBuffer, unsigned int nSize)
{
    closeResultTarget();

    // Our output target that uses an ostrstream that will use the buffer

    try
    {
        //m_ostrstream = new std::ostringstream(pszBuffer, nSize);
        m_ostrstream = new std::ostringstream(pszBuffer);
        m_resultTarget = new XSLTResultTarget(m_ostrstream);
    }
    catch(...)
    {
        throw MakeStringException(1, "Exception in setting character buffer as XSLT result target.");
    }
    return 0;
}
Пример #22
0
void CEspConfig::loadService(srv_cfg &xcfg)
{
    esp_service_factory_t xproc = NULL;
    builtin *pdirect = getBuiltIn(xcfg.plugin.str());
    if (pdirect)
        xproc = pdirect->serv;
    else
    {
        Owned<IEspPlugin> pplg = getPlugin(xcfg.plugin.str());
        if (pplg)
            xproc = (esp_service_factory_t) pplg->getProcAddress("esp_service_factory");
    }

    if (xproc)
        xcfg.srv.setown(xproc(xcfg.name.str(), xcfg.type.str(), m_envpt.get(), m_process.str()));
    else
        throw MakeStringException(-1, "procedure esp_service_factory can't be loaded");
}
Пример #23
0
void addUsedFilesFromActivePackageMaps(MapStringTo<bool> &usedFileMap, const char *process)
{
    Owned<IPropertyTree> packageSet = resolvePackageSetRegistry(process, true);
    if (!packageSet)
        throw MakeStringException(ECLWATCH_PACKAGEMAP_NOTRESOLVED, "Unable to retrieve package information from dali /PackageMaps");
    Owned<IPropertyTreeIterator> activeMaps = packageSet->getElements("PackageMap[@active='1']");
    //Add files referenced in all active maps, for all targets configured for this process cluster
    ForEach(*activeMaps)
    {
        Owned<IPropertyTree> packageMap = getPackageMapById(activeMaps->query().queryProp("@id"), true);
        if (packageMap)
        {
            Owned<IPropertyTreeIterator> subFiles = packageMap->getElements("//SubFile");
            ForEach(*subFiles)
                addLfnToUsedFileMap(usedFileMap, subFiles->query().queryProp("@value"));
        }
    }
}
bool CLoggingManager::getTransactionSeed(StringBuffer& transactionSeed, StringBuffer& status)
{
    if (!initialized)
        throw MakeStringException(-1,"LoggingManager not initialized");

    bool bRet = false;
    try
    {
        Owned<IEspGetTransactionSeedRequest> req =  createGetTransactionSeedRequest();
        Owned<IEspGetTransactionSeedResponse> resp =  createGetTransactionSeedResponse();
        transactionSeed.set("Seed");

        bRet = getTransactionSeed(*req, *resp);
        if (bRet && !resp->getStatusCode())
        {
            const char* seed = resp->getSeedId();
            if (!seed || !*seed)
                status.set("Failed to get Transaction Seed");
            else
            {
                transactionSeed.set(seed);
                status.set("Transaction Seed returned.");
                bRet = true;
            }
        }
        else
        {
            const char* statusMsg = resp->getStatusMessage();
            if (statusMsg && *statusMsg)
                status.setf("Failed to get Transaction Seed: %s", statusMsg);
            else
                status.set("Failed to get Transaction Seed");
        }
    }
    catch (IException* e)
    {
        e->errorMessage(status);
        status.insert(0, "Failed to get Transaction Seed: ");
        ERRLOG("%s",status.str());
        e->Release();
    }

    return bRet;
}
Пример #25
0
IFormatType * createFormatter(IProperties * globals)
{
    // Create a formatter
    IFormatType * format;
    if(globals->hasProp("format"))
    {
        const char * fmt = globals->queryProp("format");
        
        if(!fmt || !*fmt || !stricmp(fmt, "default"))
        {
            format = new DefaultFormatType();
        }
        else if(!stricmp(fmt, "csvh"))
        {
            format = new CSVHFormatType();
        }
        else if(!stricmp(fmt, "csv"))
        {
            format = new CSVFormatType();
        }
        else if(!stricmp(fmt, "runecl"))
        {
            format = new RuneclFormatType();
        }
        else if(!stricmp(fmt, "xml"))
        {
            format = new XmlFormatType();
        }
        else if(!stricmp(fmt, "bin") || !stricmp(fmt, "binary"))
        {
            format = new BinFormatType;
        }
        else
        {
            throw MakeStringException(-1, "format %s not supported", fmt);
        }
    }
    else
    {
        format = new DefaultFormatType();
    }
    return format;
}
Пример #26
0
 CXslIncludeSignature(const char* path)
 {
     if(!path || !*path)
         throw MakeStringException(-1, "CXslIncludeSignature : path can't be emtpy");
     filePath.append(path);
     Owned<IFile> f = createIFile(path);
     if(f)
     {
         CDateTime modtime;
         f->getTime(NULL, &modtime, NULL);
         fileTime = modtime.getSimple();
         fileSize = f->size();
     }
     else
     {
         fileSize = 0;
         fileTime = 0;
     }
 }
Пример #27
0
int CDfuPlusHelper::replicate()
{
    const char* srcname = globals->queryProp("srcname");
    if(srcname == NULL)
        throw MakeStringException(-1, "srcname not specified");

    bool nowait = globals->getPropBool("nowait", false);

    Owned<IClientReplicate> req = sprayclient->createReplicateRequest();
    req->setSourceLogicalName(srcname);
    req->setReplicateOffset(globals->getPropInt("replicateoffset",1));
    bool repeatlast = globals->getPropBool("repeatlast");
    bool onlyrepeated = repeatlast&&globals->getPropBool("onlyrepeated");
    StringBuffer cluster;
    globals->getProp("cluster",cluster);
    if (cluster.length()) 
        req->setCluster(cluster.str());
    else if (repeatlast) {
        error("replicate repeatlast specified with no cluster\n");
        return 0;
    }
    if (repeatlast) 
        req->setRepeatLast(true);
    if (onlyrepeated) 
        req->setOnlyRepeated(true);

    Owned<IClientReplicateResponse> result = sprayclient->Replicate(req);
    const char* wuid = result->getWuid();
    if(wuid == NULL || *wuid == '\0')
        exc(result->getExceptions(),"replicating");
    else
    {
        const char* jobname = globals->queryProp("jobname");
        if(jobname && *jobname)
            updatejobname(wuid, jobname);

        info("Submitted WUID %s\n", wuid);
        if(!nowait)
            waitToFinish(wuid);
    }

    return 0;
}
Пример #28
0
void CEclDirectEx::init(IPropertyTree *cfg, const char *process, const char *service)
{
    StringBuffer xpath;
    xpath.appendf("Software/EspProcess[@name=\"%s\"]/EspService[@name=\"%s\"]", process, service);
    Owned<IPropertyTree> srvcfg = cfg->getPropTree(xpath.str());

    if (!srvcfg)
    {
        IERRLOG("EclDirect: Configuration Error: unable to load configuration");
        throw MakeStringException(-1, "EclDirect: Configuration Error: unable to load configuration");
    }

    srvcfg->getProp("ClusterName", defaultCluster);

    defaultWait = srvcfg->getPropInt("WuTimeout", 60000);
    deleteWorkunits = cfg->getPropBool("DeleteWorkUnits", false);

    refreshValidClusters();
}
Пример #29
0
HttpProxy::HttpProxy(int localport, const char* host, int port, FILE* ofile, bool use_ssl, IPropertyTree* sslconfig)
{
    m_localport = localport;
    m_host.append(host);
    m_port = port;
    m_ofile = ofile;
    m_use_ssl = use_ssl;
    if(use_ssl)
    {
#if USE_OPENSSL
        if(sslconfig != NULL)
            m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ClientSocket));
        else
            m_ssctx.setown(createSecureSocketContext(ClientSocket));
#else
        throw MakeStringException(-1, "HttpProxy: failure to create SSL connection to host '%s': OpenSSL not enabled in build", host);
#endif
    }
}
Пример #30
0
HttpServer::HttpServer(int port, const char* in, FILE* ofile, bool use_ssl, IPropertyTree* sslconfig)
{
    m_ifname.append(in);
    m_port = port;
    m_ofile = ofile;
    m_use_ssl = use_ssl;
    m_recvDelay = m_sendDelay = m_closeDelay = 0;
    if(use_ssl)
    {
#ifdef USE_OPENSSL
        if(sslconfig != NULL)
            m_ssctx.setown(createSecureSocketContextEx2(sslconfig, ServerSocket));
        else
            m_ssctx.setown(createSecureSocketContext(ServerSocket));
#else
        throw MakeStringException(-1, "HttpServer: failure to create SSL socket - OpenSSL not enabled in build");
#endif
    }
}