Exemplo n.º 1
0
/*static*/ ProcessPtr ProcessFactory::create(OJInt32_t type,
    const OJString &inputFileName,
    const OJString &outputFileName)
{
    IProcess* pProcess = NULL;

    if (type == ProcessType::Compiler)
    {
        pProcess = new WindowsProcess(false, inputFileName, outputFileName);
    }
    else if (type == ProcessType::Excuter)
    {
        if (AppConfig::WindowsUser::Enable)
        {
            pProcess = new WindowsUserProcess(true, s_userPtr_, inputFileName, outputFileName);
        }
        else
        {
            pProcess = new WindowsProcess(true, inputFileName, outputFileName);
        }
    }
    else
    {
        throw(std::invalid_argument("Invalid process type!"));
    }

    return ProcessPtr(pProcess);
}
Exemplo n.º 2
0
ProcessPtr ObjectFactory::createProcess(const Process::Path     &path,
                                        const Process::Name     &name,
                                        const MD5Sum            *md5,
                                        const pid_t             *pid,
                                        const int               *uid,
                                        const Process::Username &username,
                                        const std::string       *arguments,
                                        ReferenceURLPtr          url) const
{
  return ProcessPtr( new Postgres::Process(path,
                                           name,
                                           md5,
                                           pid,
                                           uid,
                                           username,
                                           arguments,
                                           url) );
}