コード例 #1
0
IAttributeHistory * CreateDiskAttributeHistory(const boost::filesystem::path & path, const IAttribute * attribute, int version)
{
    static CacheT<std::_tstring, CDiskAttributeHistory> AttributeHistoryCache;
    CDiskAttributeHistory * attr = AttributeHistoryCache.Get(new CDiskAttributeHistory(path, const_cast<IAttribute *>(attribute), version));
    ATLASSERT(attr);
    attr->Update();
    return attr;
}
コード例 #2
0
ファイル: Module.cpp プロジェクト: dehilsterlexis/eclide-1
CModule * CreateModuleRaw(const IRepository *rep, const std::_tstring & label, bool placeholder)
{
    CModuleHelper modHelper(label);
    StdStringVector tokens;
    modHelper.GetQualifiedLabel(tokens);

    CModule * retVal = NULL;
    std::_tstring qualifiedLabel;
    for (StdStringVector::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
    {
        if (!qualifiedLabel.empty())
            qualifiedLabel += CModuleHelper::DELIMTER;
        qualifiedLabel += *itr;
        retVal = ModuleCache.Get(new CModule(rep, retVal, qualifiedLabel.c_str(), *itr, placeholder));
    }
    return retVal;
}
コード例 #3
0
ファイル: SMC.cpp プロジェクト: dehilsterlexis/eclide-1
    bool GetActive(IClusterVector * clusters)
    {
        CComInitialize com;
        ServerT server;
        CString url = GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_SMC);
        server.SetUrl(url);

        CStructArrayOut<ActiveWorkunit> running;
#if _COMMS_VER < 499
        bool thorQueueManagement;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), &thorQueueManagement) == S_OK)
#elif _COMMS_VER < 505
        bool thorQueueManagement;
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress(), &thorQueueManagement) == S_OK)
#elif _COMMS_VER < 50509
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Index(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
#elif _COMMS_VER < 51100
        CStructArrayOut<ActiveWorkunit> running;
        if (server.Activity(false, exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
#elif _COMMS_VER < 67205
        CComBSTR build;
        CStructArrayOut<ThorCluster> thorClusters;
        CStructArrayOut<HoleCluster> holeClusters;
        CStructArrayOut<DFUJob> dfuJobs;
        ESP_EXCEPTION_LOG(EspException);
        if (server.Activity(exceptions.GetArrayAddress(), exceptions.GetCountAddress(), &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
        {
            if (build)
                m_version = CreateVersion(url, CString(build));

            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->Instance;
#elif _COMMS_VER < 700000
        CComBSTR build;
        CStructArrayOut<ThorCluster> thorClusters;
        CStructArrayOut<HoleCluster> holeClusters;
        CStructArrayOut<DFUJob> dfuJobs;
        ESP_EXCEPTION_LOG2(EspException);
        if (server.Activity(exceptions, &build, thorClusters.GetArrayAddress(), thorClusters.GetCountAddress(), holeClusters.GetArrayAddress() , holeClusters.GetCountAddress(), dfuJobs.GetArrayAddress(), dfuJobs.GetCountAddress(), running.GetArrayAddress(), running.GetCountAddress()) == S_OK)
        {
            if (build)
                m_version = CreateVersion(url, CString(build));

            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->Instance;
#else
        ESP_STATUS_LOG;
        if (server.ListActiveOrQueuedWorkunits(running.GetArrayAddress(), running.GetCountAddress(), &status.m_statusCode, &status.m_statusMessage) == S_OK)
        {
            //  Multi thor support - there could be some jobs running on a multi thor!
            for(int i = 0; i < running.GetCount(); ++i)
            {
                CComBSTR thorClusterName = running.GetItem(i)->ServerInstance;
#endif
                CComBSTR thorClusterStatus = running.GetItem(i)->State;
                ThorCluster thorCluster;
                thorCluster.ClusterName = thorClusterName;
                thorCluster.QueueStatus = thorClusterStatus;
                StlLinked<ICluster> cluster = CreateCluster(m_url, &thorCluster, running);
                if (std::find(clusters->begin(), clusters->end(), cluster) == clusters->end())
                {
                    clusters->push_back(cluster.get());
                }
            }
            return true;
        }
        else
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());

        return false;
    }

    IVersion * GetBuild()
    {
        if (m_version)
            return m_version;
        IClusterVector results;
        if (GetActive(&results))
            return m_version;
        return m_unknown;
    }

    bool SetPriority(const std::_tstring &cluster, const std::_tstring &wuid, PRIORITY priority)
    {
        CComInitialize com;
        ServerT server;
        server.SetUrl(CString(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_SMC)));

        CComBSTR inCluster = CT2W(cluster.c_str(), CP_UTF8);
        CComBSTR inWuid = CT2W(wuid.c_str(), CP_UTF8);

        HRESULT result;
#if _COMMS_VER < 67205 
        ESP_EXCEPTION_LOG(EspException);
#elif _COMMS_VER < 700000 
        ESP_EXCEPTION_LOG2(EspException);
#else
        ESP_STATUS_LOG;
#endif
        switch (priority)
        {
        case PRIORITY_UP:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobUp(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobUp(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobUp(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("up");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_DOWN:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobDown(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobDown(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobDown(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("down");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_TOP:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobFront(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobFront(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobFront(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("front");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        case PRIORITY_BOTTOM:
            {
#if _COMMS_VER < 51100 
                result = server.MoveJobBack(inCluster, inWuid);
#elif _COMMS_VER < 67205
                result = server.MoveJobBack(inCluster, inWuid, exceptions.GetArrayAddress(), exceptions.GetCountAddress());
#elif _COMMS_VER < 700000 
                result = server.MoveJobBack(inCluster, inWuid, exceptions);
#else
                CComBSTR position = _T("end");
                result = server.SetWorkunitPositionInSamePriority(inCluster, inWuid, position, &status.m_statusCode, &status.m_statusMessage);
#endif
            }
            break;
        default:
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());
            return false;
        }
        if(result == S_OK)
        {
            return true;
        }
        else
            _DBGLOG(m_url, LEVEL_WARNING, server.GetClientError());
        return false;
    }

    bool SetPriority(Dali::IWorkunitVector *workunits, PRIORITY priority)
    {
        switch (priority)
        {
        case PRIORITY_UP:
        case PRIORITY_TOP:
            {
                for(Dali::IWorkunitVector::iterator itr = workunits->begin(); itr != workunits->end(); ++itr)
                {
                    Dali::IWorkunitAdapt& workunit = *itr;
                    SetPriority(workunit->GetCluster(), workunit->GetWuid(), priority);
                }
            }
            break;
        case PRIORITY_DOWN:
        case PRIORITY_BOTTOM:
            {
                for (Dali::IWorkunitVector::reverse_iterator itr = workunits->rbegin(); itr != workunits->rend(); ++itr)
                {
                    Dali::IWorkunitAdapt& workunit = *itr;
                    SetPriority(workunit->GetCluster(), workunit->GetWuid(), priority);
                }
            }
            break;
        }
        return true;
    }
};
#endif

CacheT<std::_tstring, CSMC> SMCCache;
ISMC * AttachSMC(const std::_tstring & url, const std::_tstring & label)
{
    return SMCCache.Get(new CSMC(url.c_str(), label.c_str()));
}
COMMS_API ISMC * AttachSMC(const _variant_t & url, const std::_tstring & label)
{
    return SMCCache.Get(new CSMC(url, label.c_str()));
}
void ClearSingletons()
{
    ClearVersionCache();
    ClearClusterCache();
    SMCCache.clear();
}
}
コード例 #4
0
ファイル: Result.cpp プロジェクト: dehilsterlexis/eclide-1
CResult * CreateResultRaw(const CString & url, const CString & wuid, int sequence)
{
    return ResultCache.Get(new CResult(url, wuid, sequence));
}
コード例 #5
0
ファイル: Cluster.cpp プロジェクト: GordonSmith/eclide
CCluster * CreateClusterRaw(const CString & url, const CString & wuid, const std::_tstring & queue = _T(""))
{
	return ClusterCache.Get(new CCluster(static_cast<const TCHAR *>(url), static_cast<const TCHAR *>(wuid), queue));
}
コード例 #6
0
ファイル: DropZone.cpp プロジェクト: dehilsterlexis/eclide-1
CDropZone * CreateDropZoneRaw(const TCHAR *url, const TCHAR *name, const TCHAR *path)
{
    return DropZoneCache.Get(new CDropZone(url, name, path));
}
コード例 #7
0
ファイル: LocalFile.cpp プロジェクト: dehilsterlexis/eclide-1
CLocalFile * CreateLocalFileRaw(const CString & url, const CString & wuid, const CString & source)
{
    return LocalFileCache.Get(new CLocalFile(url, wuid, source));
}