当前位置: 首页>>代码示例>>C++>>正文


C++ SCXFilePath类代码示例

本文整理汇总了C++中SCXFilePath的典型用法代码示例。如果您正苦于以下问题:C++ SCXFilePath类的具体用法?C++ SCXFilePath怎么用?C++ SCXFilePath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SCXFilePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OpenNodemanagerDomains

    /**
        Read the nodemanager.domains file to get a list of the
        WebLogic 10g domains associated with the installation.
           
        Note: this file is located up the tree in a 'well-known' location.
              i.e. /opt/Oracle/Middleware/wlserver_10.3/common/nodemanager/nodemanager.domains
       
       Example:
       #Domains and directories created by Configuration Wizard
       #Tue Apr 12 15:23:12 PDT 2011
       base_domain=/opt/Oracle/Middleware/user_projects/domains/base_domain 
       
       \param[in]  nodemanagerDomains File object of the text file
                                      to open.
                                            
       \param[out] domains           vector that will be populated with
                                     list of discovered domains.
       
     */
    void WebLogicFileReader::ReadNodemanagerDomains(
            const SCXFilePath& nodemanagerDomains,
            vector<SCXFilePath>& domains)
    {
        string content;

        try {
            
            /*
             * Parse the INI file. 
             * 
             * After a '#', assume the rest of the line is a comment.
             * The file should consist of name/value pairs seperated
             * by an '='. 
             */
            SCXHandle<istream> reader = 
                    OpenNodemanagerDomains(nodemanagerDomains.Get());
            
            while (SCXStream::IsGood(*reader))
            {
                string buffer;
                getline(*reader, buffer);
                
                size_t effectiveEnd = buffer.size();
                size_t commentLocation = buffer.find(INI_COMMENT);
                if (string::npos != commentLocation)
                {
                    effectiveEnd = commentLocation; 
                }
                
                size_t delimiterLocation = buffer.find(INI_DELIMITER);
                if (string::npos != delimiterLocation)
                {
                    string narrowPath = buffer.substr(delimiterLocation + 1);
                    wstring widePath = StrFromUTF8(narrowPath);
                    SCXFilePath domainPath;
                    domainPath.SetDirectory(widePath);
                    domains.push_back(domainPath);
                }
            }
        }
        catch (SCXFilePathNotFoundException&)
        {
            SCX_LOGERROR(m_log, 
                    wstring(L"WebLogicFileReader::ReadNodemanagerDomains() - ").
                    append(m_installationPath).append(L" - Could not find file: ").
                    append(nodemanagerDomains.Get()));
        }
        catch (SCXUnauthorizedFileSystemAccessException&)
        {
            SCX_LOGERROR(m_log, 
                    wstring(L"WebLogicFileReader::ReadNodemanagerDomains() - ").
                    append(m_installationPath).append(L" - not authorized to open file: ").
                    append(nodemanagerDomains.Get()));
        }
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:75,代码来源:weblogicappserverenumeration.cpp

示例2: SearchExistingFilename

 //! Search for an existing filename using case insensitive comparision
 SCXFilePath SearchExistingFilename(const wstring &directory, const wstring &name) {
     vector<SCXCoreLib::SCXFilePath> files = SCXDirectory::GetFiles(directory);
     for (size_t nr = 0; nr < files.size(); nr++) {
         if (StrCompare(files[nr].GetFilename(), name, true) == 0) {
             return files[nr];
         }
     }
     // No existing name found, return the original path
     SCXFilePath original;
     original.SetDirectory(directory);
     original.SetFilename(name);
     return original;
 }
开发者ID:Microsoft,项目名称:pal,代码行数:14,代码来源:scxfile_test.cpp

示例3: SCXInvalidArgumentException

    SCXGlob::SCXGlob(const SCXFilePath &pttrn) :
                m_pathnames(NULL), m_index(cNoData), m_isBackSlashEscapeOn(true), m_isErrorAbortOn(false)
    {
        if (L"" == pttrn.Get())
        {
            throw SCXInvalidArgumentException(L"pattern", L"Empty pattern not allowed", SCXSRCLOCATION);
        }

                memset(&m_globHolder, 0, sizeof(glob_t));

        this->m_logHandle = SCXLogHandleFactory::GetLogHandle(L"scx.core.common.pal.os.scxglob");
        this->m_pattern = StrToUTF8(pttrn.Get());
        this->NormalizePattern();
    }
开发者ID:Microsoft,项目名称:pal,代码行数:14,代码来源:scxglob.cpp

示例4: implicit

    /**
        Opens a file stream

        \param[in]  file    The file to open
        \param[in]  mode    How to open it, explicitly.
        \throws     SCXFilePathNotFoundException
        \throws     SCXUnauthorizedFileSystemAccessException
        \throws     InvalidArgumentException Arguments

        Unlike STL there is no implicit (default) mode, the requested mode has to explicitly stated
     */
    SCXHandle<std::fstream> SCXFile::OpenFstream(const SCXFilePath& file, std::ios_base::openmode mode) {
        if (!(mode & std::ios::in) && !(mode & std::ios::out)) {
            throw SCXInvalidArgumentException(L"mode", L"Specify ios::in or ios::out, or both", SCXSRCLOCATION);
        }
#if defined(WIN32)
        SCXHandle<std::fstream> streamPtr(new std::fstream(file.Get().c_str(), mode));
#elif defined(SCX_UNIX)
        SCXHandle<std::fstream> streamPtr(new std::fstream(SCXFileSystem::EncodePath(file).c_str(), mode));
#else
#error
#endif
        if (streamPtr->good()) {
            SCXFileSystem::Attributes attribs(SCXFileSystem::GetAttributes(file));
            if (attribs.count(SCXFileSystem::eDirectory) > 0) {
                throw SCXUnauthorizedFileSystemAccessException(file, attribs, SCXSRCLOCATION);
            }

        } else {
            SCXFileInfo info(file);
            if (mode & std::ios::in) {
                if (!info.PathExists()) {
                    throw SCXFilePathNotFoundException(file, SCXSRCLOCATION);
                } else {
                    throw SCXUnauthorizedFileSystemAccessException(file,
                            (SCXFileSystem::GetAttributes(file)), SCXSRCLOCATION);
                }
            } else if (mode & std::ios::out) {
                throw SCXUnauthorizedFileSystemAccessException(file,
                    SCXFileSystem::GetAttributes(file), SCXSRCLOCATION);
            } else {
                throw SCXInvalidArgumentException(L"mode", L"Must specify ios:in or ios:out", SCXSRCLOCATION);
            }
        }
        return streamPtr;
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:46,代码来源:scxfile.cpp

示例5: Delete

    /**
        Deletes the specified file. An exception is not thrown if the specified file does not exist

        \param[in]  path    The path to the file to be deleted.
        \throws     SCXUnauthorizedFileSystemAccessException    The caller does not have the required permission
                                                                or path is a directory or path specified a read-only file

        The path parameter is permitted to specify relative or absolute path information. Relative
        path information is interpreted as relative to the current working directory. To obtain
        the current working directory, see GetCurrentDirectory
     */
    void SCXFile::Delete(const SCXFilePath& path) {
#if defined(WIN32)
        int failure = _wremove(path.Get().c_str());
#elif defined(SCX_UNIX)
        std::string localizedPath = SCXFileSystem::EncodePath(path);
        int failure = remove(localizedPath.c_str());
#else
#error
#endif
        if (failure) {
            if (errno == EACCES || errno == EBUSY || errno == EPERM || errno == EROFS) {
                throw SCXUnauthorizedFileSystemAccessException(path, SCXFileSystem::GetAttributes(path), SCXSRCLOCATION);
            } else if (errno == ENOENT) {
                const int existenceOnly = 00;
#if defined(WIN32)
                failure = _waccess(path.Get().c_str(), existenceOnly);
#elif defined(SCX_UNIX)
                failure = access(localizedPath.c_str(), existenceOnly);
#else
#error
#endif
                bool fileStillExists = !failure;
                if (fileStillExists) {
                    // We got ENOENT when trying to remove the file,
                    // but appearently the file exists. That means that
                    // the file is not a file but a directory
                    throw SCXUnauthorizedFileSystemAccessException(path, SCXFileSystem::GetAttributes(path), SCXSRCLOCATION);
                } if (errno == EACCES) {
                    throw SCXUnauthorizedFileSystemAccessException(path, SCXFileSystem::GetAttributes(path), SCXSRCLOCATION);
                } else if (errno == EINVAL) {
                    throw SCXInvalidArgumentException(L"path", L"Invalid format of path " + path.Get(), SCXSRCLOCATION);
                } else if (errno != ENOENT) {
                    std::wstring problem(L"Failed to delete " + path.Get());
                    throw SCXInternalErrorException(UnexpectedErrno(problem, errno), SCXSRCLOCATION);
                }
            } else {
                std::wstring problem(L"Failed to delete " + path.Get());
                throw SCXInternalErrorException(UnexpectedErrno(problem, errno), SCXSRCLOCATION);
            }
        }
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:52,代码来源:scxfile.cpp

示例6: AppServerInstance

    /**
        Constructor

       \param[in]  cell          The WebSphere Cell Name
       \param[in]  node          The WebSphere Node Name
       \param[in]  profile       The WebSphete Profile Name
       \param[in]  installDir    The folder where WebSphere is installed
       \param[in]  server        The WebSphere Server Name
       \param[in]  deps          Dependency instance to use
    */
    WebSphereAppServerInstance::WebSphereAppServerInstance(
        wstring installDir, wstring cell, wstring node, wstring profile, wstring server,
        SCXHandle<WebSphereAppServerInstancePALDependencies> deps) : 
        AppServerInstance(installDir, APP_SERVER_TYPE_WEBSPHERE), m_deps(deps)
    {
        SCXFilePath installPath;

        installPath.SetDirectory(installDir);

        m_diskPath = installPath.Get();
        
        m_cell = cell;
        m_node = node;
        m_profile = profile;
        m_server = server;

        wstring id = profile;
        SetId(id.append(L"-").append(cell).append(L"-").append(node).append(L"-").append(server));

        SCX_LOGTRACE(m_log, wstring(L"WebSphereAppServerInstance default constructor - ").append(GetId()));
    }
开发者ID:Microsoft,项目名称:SCXcore,代码行数:31,代码来源:websphereappserverinstance.cpp

示例7: file

    /**
        Determines whether the specified file exists

        \param[in]      path        Path to file
        \returns        true        iff the path refers to a file (not a directory) and the file exists

        The Exists method should not be used for path validation, this method merely checks
        if the file specified in path exists. Passing an invalid path to Existsl returns false.

        Be aware that another process can potentially do something with the file in between the
        time you call the Exists method and perform another operation on the file, such as Delete.
        A recommended programming practice is to wrap the Exists method, and the operations you
        take on the file, in a try...catch block. The Exists method can only help to ensure that the
        file will be available, it cannot guarantee it.

        The path parameter is permitted to specify relative or absolute path information.
        Relative path information is interpreted as relative to the current working directory.
        To obtain the current working directory, see GetCurrentDirectory.

        \note If path describes a directory, this method returns false.
    */
    bool SCXFile::Exists(const SCXFilePath& path) {
#if defined(WIN32)
        struct __stat64 buf;
        int failure = _wstat64(path.Get().c_str(), &buf );
#elif defined(SCX_UNIX)
        SCXFileSystem::SCXStatStruct buf;
        std::string localizedName = SCXFileSystem::EncodePath(path);
        int failure = SCXFileSystem::Stat(localizedName.c_str(), &buf );
#else
#error
#endif
        return !failure && !(buf.st_mode & S_IFDIR);
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:34,代码来源:scxfile.cpp

示例8: TestReadFilesWithPresetCharacterConversion

    /*
     * Uses the currently set locale to read a pre-defined file and then compares
     * the output with a reference file that is read with the UTF-8 functions.
     * These should of course be the same for this test to be successful.
     *
     * What encoded file should be read for a certain locale, and which reference file
     * should be used to test against is handled with a configurations file
     * that has the name "scxfile_test-locale-map.txt" that consists of multiple 
     * lines like this:
     * <name of locale> <name of encoded file> <name of reference file>
     * 
     * The "encoded file" is read with named locale active into an array.
     * The reference file is read with our own UTF-8 decoding routines, into 
     * another array. These two should result in exactly the same result for this
     * test to be successful.
     * 
     * If you're writing a new encoded or reference file, you'll at some point need
     * to see exactly what it contains byte-for-byte. The this command will be 
     * useful: "od -t x1 <filename>".
     *
     * If the current locale is not found in the configuration file, this results
     * in a warning.
     */
    void TestReadFilesWithPresetCharacterConversion()
    {
        bool found = false;

        std::wifstream locmap("./testfiles/scxfile_test-locale-map.txt");
        wstring locName, encodedFileName, referenceFileName;

        // This is the name of the currently selected locale for the Ctype facet
        wstring presetLocaleName(SCXLocaleContext::GetCtypeName());

        if (presetLocaleName == L"C" || presetLocaleName == L"POSIX") {
            SCXUNIT_WARNING(L"Testing with C/POSIX locale is meaningless.");
        }

        wcout << "\nTesting preset locale " << presetLocaleName << endl;

        while (locmap) {
            locmap >> locName >> encodedFileName >> referenceFileName;

            // Diagnostic output
            // wcout << "Name " << locName << endl;
            // wcout << "File " << encodedFileName << endl;
            // wcout << "File " << referenceFileName << endl;

            if (locName == presetLocaleName) {
                // wcout << L"found " << locName << endl;
                found = true;
                break;
            }
        }

        if (!found) {
            SCXUNIT_WARNING(L"Can't find preset locale " + presetLocaleName + L" in locale-map.txt. Please add it and test again.");
            return;
        }

        SCXFilePath encodedFileFP;
        encodedFileFP.SetDirectory(L"./testfiles/");
        encodedFileFP.SetFilename(encodedFileName);

        SCXFilePath referenceFileFP;
        referenceFileFP.SetDirectory(L"./testfiles/");
        referenceFileFP.SetFilename(referenceFileName);

        SCXStream::NLFs nlfs;
        vector<wstring> localLines;
        vector<wstring> utf8Lines;
        SCXFile::ReadAllLines(encodedFileFP, localLines, nlfs);
        SCXFile::ReadAllLinesAsUTF8(referenceFileFP, utf8Lines, nlfs);
        CPPUNIT_ASSERT_MESSAGE("Failure for preset locale " + locale().name(),
                               localLines == utf8Lines);

    }
开发者ID:Microsoft,项目名称:pal,代码行数:76,代码来源:scxfile_test.cpp

示例9: OpenDomainRegistryXml

    /**
       Read a simple XML file to find the locations of the domains for
       this WebLogic 11g R1 installation.
       
       Example:
       <?xml version="1.0" encoding="UTF-8"?>
       <domain-registry xmlns="http://xmlns.oracle.com/weblogic/domain-registry">
         <domain location="/opt/Oracle/Middleware/user_projects/domains/base_domain"/>
       </domain-registry> 
       
              \param[in]  domainRegistryXml File object of the XML file
                                            to open.
                                            
              \param[out] domains           vector that will contain the
                                            list of discovered domains.
     */
    void WebLogicFileReader::ReadDomainRegistryXml(
            const SCXFilePath& domainRegistryXml,
            vector<SCXFilePath>& domains)
    {
        string xml;

        try {
            SCXHandle<istream> reader = 
                    OpenDomainRegistryXml(domainRegistryXml.Get());
            GetStringFromStream(reader, xml);

            XElementPtr domainRegistryNode;
            XElement::Load(xml, domainRegistryNode);
            if (domainRegistryNode->GetName() == WEBLOGIC_DOMAIN_REGISTRY_XML_NODE)
            {
                XElementList domainNodes;
                domainRegistryNode->GetChildren(domainNodes);
                for (size_t index = 0; index < domainNodes.size(); ++index)
                {
                    string location;
                    if (domainNodes[index]->GetName() == WEBLOGIC_DOMAIN_XML_NODE && 
                        domainNodes[index]->GetAttributeValue(WEBLOGIC_LOCATION_XML_ATTRIBUTE, location))
                    {
                        wstring wideLocation = StrFromUTF8(location);
                        SCXFilePath domainPath;
                        domainPath.SetDirectory(wideLocation);                                
                        domains.push_back(domainPath);
                    }
                }
            }
        }
        catch (SCXFilePathNotFoundException&)
        {
            SCX_LOGERROR(m_log, 
                    wstring(L"WebLogicFileReader::ReadDomainRegistryXml() - ").
                    append(m_installationPath).append(L" - Could not find file: ").
                    append(domainRegistryXml.Get()));
        }
        catch (SCXUnauthorizedFileSystemAccessException&)
        {
            SCX_LOGERROR(m_log, 
                    wstring(L"WebLogicFileReader::ReadDomainRegistryXml() - ").
                    append(m_installationPath).append(L" - not authorized to open file: ").
                    append(domainRegistryXml.Get()));
        }
        catch (XmlException&)
        {
            SCX_LOGERROR(m_log, 
                    wstring(L"WebLogicFileReader::ReadDomainRegistryXml() - ").
                    append(m_installationPath).append(L" - Could not load XML from file: ").
                    append(domainRegistryXml.Get()));
        }
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:69,代码来源:weblogicappserverenumeration.cpp

示例10: SetAttributes

    /**
        Sets the specified FileAttributes of the file on the specified path

        \param[in]  path            The path to the file.
        \param[in]  attributes      The desired FileAttributes, such as Readable and Writable
        \throws     SCXUnauthorizedFileSystemAccessException    The caller does not have the required permission
                                                                or path is a directory
        \throws     SCXFilePathNotFoundException                If no file is found at path

        The path parameter is permitted to specify relative or absolute path information.
        Relative path information is interpreted as relative to the current working directory.
        To obtain the current working directory, see GetCurrentDirectory.

        It is not possible to change the compression status of a File object using the
        SetAttributes method

     */
    void SCXFile::SetAttributes(const SCXFilePath& path, const SCXFileSystem::Attributes& attributes) {
#if defined(WIN32)
        struct __stat64 buf;
        int failure = _wstat64(path.Get().c_str(), &buf );
#elif defined(SCX_UNIX)
        SCXFileSystem::SCXStatStruct buf;
        std::string localizedPath = SCXFileSystem::EncodePath(path);
        int failure = SCXFileSystem::Stat(localizedPath.c_str(), &buf );
#else
#error
#endif
        if (!failure) {
            if (buf.st_mode & S_IFDIR) {
                throw SCXUnauthorizedFileSystemAccessException(path, SCXFileSystem::GetAttributes(path), SCXSRCLOCATION);
            } else {
                SCXFileSystem::SetAttributes(path, attributes);
            }
        }
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:36,代码来源:scxfile.cpp

示例11: appserver

    /**
        Constructor

       \param[in]  id            Identifier for the appserver (= install path for the appserver configuration)
       \param[in]  homePath      Root install path for the application server
       \param[in]  deps          Dependency instance to use
    */
    TomcatAppServerInstance::TomcatAppServerInstance(
        wstring id, wstring homePath, SCXHandle<TomcatAppServerInstancePALDependencies> deps) : 
        AppServerInstance(id, APP_SERVER_TYPE_TOMCAT), m_deps(deps)
    {
        SCXFilePath installPath;
        SCXFilePath homeFilePath;

        installPath.SetDirectory(id);
        SetId(installPath.Get());
        m_diskPath = GetId();
        homeFilePath.SetDirectory(homePath);
        m_homePath = homeFilePath.Get();

        SCX_LOGTRACE(m_log, wstring(L"TomcatAppServerInstance default constructor - ").append(GetId()));
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:22,代码来源:tomcatappserverinstance.cpp

示例12: SCX_LOGTRACE

    /**
     From the necessary file, read the domains and return a unique list
     of potential domains.
     
     */
    vector<SCXFilePath> WebLogicFileReader::GetDomains()
    {
        SCX_LOGTRACE(m_log, L"WebLogicFileReader::GetDomains");

        vector<SCXFilePath> domains;

        // Logic necessary for reading WebLogic 11g domains
        SCXFilePath domainRegistryXml;
        domainRegistryXml.SetDirectory(m_installationPath);
        domainRegistryXml.SetFilename(
                WEBLOGIC_DOMAIN_REGISTRY_XML_FILENAME);
        
        if (DoesDomainRegistryXmlExist(domainRegistryXml))
        {
            ReadDomainRegistryXml(domainRegistryXml, domains);
        }

        // Logic necessary for reading WebLogic 10g domains
        SCXFilePath nodemanagerDomains;
        nodemanagerDomains.SetDirectory(m_installationPath);
        nodemanagerDomains.AppendDirectory(WEBLOGIC_NODEMANAGER_DOMAINS_DIRECTORY);
        nodemanagerDomains.SetFilename(WEBLOGIC_NODEMANAGER_DOMAINS_FILENAME);

        if (DoesNodemanagerDomainsExist(nodemanagerDomains))
        {
            ReadNodemanagerDomains(nodemanagerDomains, domains);
        }
        
        // There may be duplicates in the list, it is necessary to
        // sort the list of domains and return only the unique instances.
        sort(domains.begin(), domains.end(), SortPath());
        vector<SCXFilePath>::iterator tmp = 
                unique(domains.begin(), domains.end());
        domains.resize(tmp-domains.begin());
                
        SCX_LOGTRACE(m_log, 
                wstring(L"WebLogicFileReader::GetDomains() - ").
                append(L"Found ").append(StrFrom(domains.size())).append(L" domain(s)"));

        return domains;
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:46,代码来源:weblogicappserverenumeration.cpp

示例13: TestFileSystemInfo_SetAttributes

    void TestFileSystemInfo_SetAttributes()
    {
        // Improve code coverage on SCXFileSystemInfo
#if defined(SCX_UNIX)
        SCXFileSystem::Attribute readable = SCXFileSystem::eUserRead;
        SCXFileSystem::Attribute writable = SCXFileSystem::eUserWrite;
#else
        SCXFileSystem::Attribute readable = SCXFileSystem::eReadable;
        SCXFileSystem::Attribute writable = SCXFileSystem::eWritable;
#endif

        SCXFileInfo fi(m_path1);

        SCXFileSystem::Attributes attrRO, attrRW;
        attrRO.insert(readable);
        attrRW.insert(readable);
        attrRW.insert(writable);

        // Test SCXFileSystemInfo::SetAttributes and SCXFileSystemInfo::isWritable (and make sure it's right!)
        fi.SetAttributes(attrRO);
        CPPUNIT_ASSERT(! fi.isWritable());
        CPPUNIT_ASSERT(fi.GetAttributes().count(writable) == 0);
        fi.SetAttributes(attrRW);
        fi.Refresh();
        CPPUNIT_ASSERT(fi.isWritable());
        CPPUNIT_ASSERT(fi.GetAttributes().count(writable) != 0);

        // Create a new "junk" object to test directory - test SCXFileSystemInfo::GetDirectoryPath
        // (Use operator += to add a filename to pick up an additional test of that operator)
        SCXFilePath fbad = fi.GetDirectoryPath();
        fbad += L"file";
        fbad += L".txt";
        fbad.SetDirectory(L"/bogus/directory/path");
#if defined(SCX_UNIX)
        CPPUNIT_ASSERT(fbad.GetDirectory() == L"/bogus/directory/path/");
        CPPUNIT_ASSERT(fbad.Get() == L"/bogus/directory/path/file.txt");
#else
        CPPUNIT_ASSERT(fbad.GetDirectory() == L"\\bogus\\directory\\path\\");
        CPPUNIT_ASSERT(fbad.Get() == L"\\bogus\\directory\\path\\file.txt");
#endif
        // Original path was created without directory - test SCXFileSystemInfo::GetOriginalPath
        CPPUNIT_ASSERT(fi.GetOriginalPath().GetDirectory() == L"");
        CPPUNIT_ASSERT(fi.GetFullPath().GetDirectory() != L"");
    }
开发者ID:Microsoft,项目名称:pal,代码行数:44,代码来源:scxfile_test.cpp

示例14: GetInstances

    /**
       From the necessary XML configuration file, read information about
       the known instances.
       
       The file should be:
           ${Install}/${Domain}/config/config.xml

       \param[in]  domains    List of domains to find instances for

       \param[out] instances  vector to add instances to
       
    */    
    void WebLogicFileReader::GetInstances(
            const SCXFilePath& domain,
            vector<SCXHandle<AppServerInstance> >& instances)
    {
        SCXFilePath configXml;
        configXml.SetDirectory(domain.Get());
        configXml.AppendDirectory(WEBLOGIC_CONFIG_DIRECTORY);
        configXml.Append(WEBLOGIC_CONFIG_FILENAME);
        
        if (DoesConfigXmlExist(configXml))        
           {
            SCX_LOGTRACE(m_log, 
                    wstring(L"WebLogicFileReader::GetInstances() - ").
                    append(L"Reading ").append(configXml.Get()));
            ReadConfigXml(domain, configXml, instances);
           }
        else
        {
            SCX_LOGTRACE(m_log, 
                    wstring(L"WebLogicFileReader::GetInstances() - ").
                    append(L"Expected configuration file '").
                    append(configXml.Get()).append(L"' does not exist."));
        }
    }
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:36,代码来源:weblogicappserverenumeration.cpp

示例15: domain

    /**
       Read a simple XML file to find the locations of the both 
       the Admin and Managed servers for a WebLogic 11g R1 installation.
       
       Example:
       <?xml version="1.0" encoding="UTF-8"?>
       <domain ...>
         <name>base_domain</name>
         <domain-version>10.3.2.0</domain-version>
         <security-configuration ...>
            ...
         </security-configuration>
         <server>
           <name>AdminServer</name>
           <ssl>
             <name>AdminServer</name>
             <enabled>true</enabled>
             <listen-port>7012</listen-port>
           </ssl>
           <machine>new_UnixMachine_1</machine>
           <listen-port>7011</listen-port>
           <listen-address/>
         </server>
         <server>
           <name>new_ManagedServer_1</name>
           <ssl>
             <name>new_ManagedServer_1</name>
             <enabled>true</enabled>
             <listen-port>7513</listen-port>
           </ssl>
           <machine>new_UnixMachine_1</machine>
           <listen-port>7013</listen-port>
           <listen-address/>
         </server>
         <embedded-ldap>
           <name>base_domain</name>
           <credential-encrypted>{AES}RVX+Cadq8XJ5EvV7/1Ta2qGZrJlxve6t5CEa2A9euGUkYOMDTAwAqytymqDBS00Q</credential-encrypted>
         </embedded-ldap>
         <configuration-version>10.3.2.0</configuration-version>
         <machine xsi:type="unix-machineType">
           <name>new_UnixMachine_1</name>
           <node-manager>
             <name>new_UnixMachine_1</name>
             <listen-address>localhost</listen-address>
             <listen-port>5566</listen-port>
           </node-manager>
         </machine>
         <admin-server-name>AdminServer</admin-server-name>
       </domain>

              \param[in]  domainDir         Directory of the domain (needed
                                            for build the path to the server
       
              \param[in]  configXml         File object of the XML file
                                            to open.
                                            
              \param[out] instances         vector that will contain the
                                            list of server instances for the
                                            given domain.
       
     */
    void WebLogicFileReader::ReadConfigXml(
            const SCXFilePath& domainDir,
            const SCXFilePath& configXml,
            vector<SCXHandle<AppServerInstance> >& instances)
    {
        SCX_LOGTRACE(m_log, L"WebLogicFileReader::ReadConfigXml");
        SCX_LOGTRACE(m_log, 
                wstring(L"WebLogicFileReader::ReadConfigXml() - ").
                append(L"Reading the file: ").append(configXml.Get()));
        string xml;

        try {
            SCXHandle<istream> reader = 
                    OpenConfigXml(configXml.Get());
            GetStringFromStream(reader, xml);

            XElementPtr domainNode;
            XElement::Load(xml, domainNode);
            
            if (domainNode->GetName() == WEBLOGIC_DOMAIN_XML_NODE)
            {
                string version;
                ReadConfigXmlForVersion(domainNode, version);
                
                string adminServerName;
                ReadConfigXmlForAdminServerName(domainNode, adminServerName);
                
                XElementList serverNodes;
                domainNode->GetChildren(serverNodes);
                for (size_t index = 0; index < serverNodes.size(); ++index)
                {
                    if (serverNodes[index]->GetName() == WEBLOGIC_SERVER_XML_NODE)
                    {
                        bool isAdminServer = false;
                        bool isSslEnabled = false;
                        string name = "";
                        string httpPort = "";
                        string httpsPort = "";

//.........这里部分代码省略.........
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:101,代码来源:weblogicappserverenumeration.cpp


注:本文中的SCXFilePath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。