Return to DynamicListenerConfig.cpp CVS log | Up to [Pegasus] / pegasus / src / Pegasus / DynListener |
File: [Pegasus] / pegasus / src / Pegasus / DynListener / DynamicListenerConfig.cpp
(download)
Revision: 1.4, Mon Jan 30 16:17:48 2006 UTC (18 years, 5 months ago) by karl Branch: MAIN CVS Tags: TASK_PEP233_EmbeddedInstSupport-merge_out_trunk, TASK_BUG_5314_IPC_REFACTORING_ROOT, TASK_BUG_5314_IPC_REFACTORING_BRANCH, TASK_BUG_5314_IPC_REFACTORING-V1, TASK_BUG_5191_QUEUE_CONSOLIDATION_ROOT, TASK_BUG_5191_QUEUE_CONSOLIDATION_BRANCH, TASK-TASK-BUG4011_WinLocalConnect-branch-New-root, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_to_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_from_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_to_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_from_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-branch, TASK-PEP268_SSLClientCertificatePropagation-root, TASK-PEP268_SSLClientCertificatePropagation-merged_out_to_branch, TASK-PEP268_SSLClientCertificatePropagation-merged_out_from_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_to_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_from_branch, TASK-PEP268_SSLClientCertificatePropagation-branch, TASK-PEP267_SLPReregistrationSupport-root, TASK-PEP267_SLPReregistrationSupport-merging_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merging_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merged_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_to_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_from_branch, TASK-PEP267_SLPReregistrationSupport-branch, TASK-PEP250_RPMProvider-root, TASK-PEP250_RPMProvider-merged_out_to_branch, TASK-PEP250_RPMProvider-merged_out_from_trunk, TASK-PEP250_RPMProvider-merged_in_to_trunk, TASK-PEP250_RPMProvider-merged_in_from_branch, TASK-PEP250_RPMProvider-branch, TASK-PEP245_CimErrorInfrastructure-root, TASK-PEP245_CimErrorInfrastructure-merged_out_to_branch, TASK-PEP245_CimErrorInfrastructure-merged_out_from_trunk, TASK-PEP245_CimErrorInfrastructure-merged_in_to_trunk, TASK-PEP245_CimErrorInfrastructure-merged_in_from_branch, TASK-PEP245_CimErrorInfrastructure-branch, TASK-PEP241_OpenPegasusStressTests-root, TASK-PEP241_OpenPegasusStressTests-merged_out_to_branch, TASK-PEP241_OpenPegasusStressTests-merged_out_from_trunk, TASK-PEP241_OpenPegasusStressTests-merged_in_to_trunk, TASK-PEP241_OpenPegasusStressTests-merged_in_from_branch, TASK-PEP241_OpenPegasusStressTests-branch, TASK-Bugs5690_3913_RemoteCMPI-root, TASK-Bugs5690_3913_RemoteCMPI-merged_out_to_branch, TASK-Bugs5690_3913_RemoteCMPI-merged_out_from_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_to_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_from_branch, TASK-Bugs5690_3913_RemoteCMPI-branch, TASK-Bug2102_RCMPIWindows-root, TASK-Bug2102_RCMPIWindows-merged_out_to_branch, TASK-Bug2102_RCMPIWindows-merged_out_from_trunk, TASK-Bug2102_RCMPIWindows-merged_in_to_trunk, TASK-Bug2102_RCMPIWindows-merged_in_from_branch, TASK-Bug2102_RCMPIWindows-branch, TASK-Bug2021_RemoteCMPIonWindows-root, TASK-Bug2021_RemoteCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RemoteCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RemoteCMPIonWindows-branch, TASK-Bug2021_RCMPIonWindows-root, TASK-Bug2021_RCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RCMPIonWindows-branch, TASK-BUG7240-root, TASK-BUG7240-branch, TASK-BUG4011_WinLocalConnect-root, TASK-BUG4011_WinLocalConnect-merged_out_to_branch, TASK-BUG4011_WinLocalConnect-merged_out_from_trunk, TASK-BUG4011_WinLocalConnect-merged_in_to_trunk, TASK-BUG4011_WinLocalConnect-merged_in_from_branch, TASK-BUG4011_WinLocalConnect-branch-New, TASK-BUG4011_WinLocalConnect-branch, RELEASE_2_6_3-RC2, RELEASE_2_6_3-RC1, RELEASE_2_6_3, RELEASE_2_6_2-RC1, RELEASE_2_6_2, RELEASE_2_6_1-RC1, RELEASE_2_6_1, RELEASE_2_6_0-RC1, RELEASE_2_6_0-FC, RELEASE_2_6_0, RELEASE_2_6-root, RELEASE_2_6-branch-clean, RELEASE_2_6-branch, RELEASE_2_5_5-RC2, RELEASE_2_5_5-RC1, RELEASE_2_5_5, RELEASE_2_5_4-RC2, RELEASE_2_5_4-RC1, RELEASE_2_5_4, RELEASE_2_5_3-RC1, RELEASE_2_5_3, RELEASE_2_5_2-RC1, RELEASE_2_5_2, RELEASE_2_5_1-RC1, RELEASE_2_5_1, RELEASE_2_5-root, RELEASE_2_5-branch, PEP286_PRIVILEGE_SEPARATION_ROOT, PEP286_PRIVILEGE_SEPARATION_CODE_FREEZE, PEP286_PRIVILEGE_SEPARATION_BRANCH, PEP286_PRIVILEGE_SEPARATION_1 Changes since 1.3: +3 -1 lines BUG#: 4691 TITLE: Update Licenses to 2006 DESCRIPTION: Updates most of the licenses to 2006. The slp_client directories are excluded for the moment pending discussion. This change has passed unit and system tests. Note that this changes just about EVERY file in Pegasus. |
//%2006//////////////////////////////////////////////////////////////////////// // // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; // IBM Corp.; EMC Corporation, The Open Group. // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // EMC Corporation; VERITAS Software Corporation; The Open Group. // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; // EMC Corporation; Symantec Corporation; The Open Group. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // //============================================================================== // // Author: Heather Sterling (hsterl@us.ibm.com) // // Modified By: // //%///////////////////////////////////////////////////////////////////////////// #include <Pegasus/Common/Config.h> #include <Pegasus/Common/OptionManager.h> #include <Pegasus/Common/FileSystem.h> #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Exception.h> #include "DynamicListenerConfig.h" PEGASUS_NAMESPACE_BEGIN PEGASUS_USING_STD; const String LISTENER_HOME_DEFAULT = "."; String DynamicListenerConfig::_listenerHome = LISTENER_HOME_DEFAULT; static struct OptionRow optionsTable[] = //optionname defaultvalue rqd type domain domainsize clname hlpmsg { {"listenerPort", "5999", false, Option::WHOLE_NUMBER, 0, 0, "listenerPort", "specifies system and port"}, #ifdef PEGASUS_HAS_SSL {"enableHttpsListenerConnection", "false", false, Option::BOOLEAN, 0, 0, "enableHttpsListenerConnection", "specifies namespace to use for operation"}, {"sslKeyFilePath", "", false, Option::STRING, 0, 0, "sslKeyFilePath", "path to the listener's SSL private key"}, {"sslCertificateFilePath", "", false, Option::STRING, 0, 0, "sslCertificateFilePath", "path to the listener's SSL public key certificate."}, #endif {"consumerDir", "", false, Option::STRING, 0, 0, "consumerDir", "path to the consumer libraries"}, {"consumerConfigDir", "", false, Option::STRING, 0, 0, "consumerConfigDir", "path to the consumer configuration files"}, {"enableConsumerUnload", "false", false, Option::BOOLEAN, 0, 0, "enableConsumerUnload", "specifies whether the listener should unload idle consumers"}, {"consumerIdleTimeout", "300000", false, Option::WHOLE_NUMBER, 0, 0, "consumerIdleTimeout", "period of inactivity, in ms, before consumers are unloaded"}, {"shutdownTimeout", "10000", false, Option::WHOLE_NUMBER, 0, 0, "shutdownTimeout", "the length of time to wait for consumer threads to complete, in ms"}, {"traceFilePath", "cimlistener.trc", false, Option::STRING, 0, 0, "traceFilePath", "path to the listener's trace file"}, {"traceLevel", "0", false, Option::WHOLE_NUMBER, 0, 0, "traceLevel", "the level of logging detail"}, {"traceComponents", "LISTENER", false, Option::STRING, 0, 0, "traceComponents", "the components to trace"}, }; const Uint32 NUM_OPTIONS = sizeof(optionsTable) / sizeof(optionsTable[0]); DynamicListenerConfig* DynamicListenerConfig::_instance = 0; DynamicListenerConfig::DynamicListenerConfig() { FileSystem::getCurrentDirectory(_listenerHome); FileSystem::translateSlashes(_listenerHome); } DynamicListenerConfig::~DynamicListenerConfig() { } DynamicListenerConfig* DynamicListenerConfig::getInstance() { if (!_instance) { _instance = new DynamicListenerConfig(); } return _instance; } void DynamicListenerConfig::initOptions(const String& configFile) { _optionMgr.registerOptions(optionsTable, NUM_OPTIONS); //do not throw an error if there's no config file; just use the defaults if (FileSystem::exists(configFile)) { _optionMgr.mergeFile(configFile); } _optionMgr.checkRequiredOptions(); } Boolean DynamicListenerConfig::lookupValue(const String& name, String& value) const { String temp; if (!_optionMgr.lookupValue(name, temp)) { return false; } if (String::equal(name, "consumerDir") || String::equal(name, "consumerConfigDir")) { value = DynamicListenerConfig::getHomedPath(temp); if (!FileSystem::exists(value) || !FileSystem::isDirectory(value) || !FileSystem::canRead(value)) { throw OMInvalidOptionValue(name, value); } //must be able to write pending requests to .dat files in the config directory if (String::equal(name, "consumerConfigDir") && !FileSystem::canWrite(value)) { throw OMInvalidOptionValue(name, value); } } else if (String::equal(name, "traceFilePath")) { //a blank value is acceptable and indicates that no tracing will be done if (String::equal(temp, "")) { value = String::EMPTY; return true; } value = DynamicListenerConfig::getHomedPath(temp); //check to make sure we can create trace file String path = FileSystem::extractFilePath(value); if (!FileSystem::exists(path) || !FileSystem::canWrite(path)) { throw OMInvalidOptionValue(name, value); } } #ifdef PEGASUS_HAS_SSL else if (String::equal(name, "sslKeyFilePath") || String::equal(name, "sslCertificateFilePath")) { //a blank value is acceptable and is the default if (String::equal(temp, "")) { value = String::EMPTY; return true; } value = DynamicListenerConfig::getHomedPath(temp); if (!FileSystem::exists(value) || !FileSystem::canRead(value)) { throw OMInvalidOptionValue(name, value); } } #endif else { value = temp; } return true; } Boolean DynamicListenerConfig::lookupIntegerValue(const String& name, Uint32& value) const { if (!_optionMgr.lookupIntegerValue(name, value)) { return false; } if (String::equal(name, "listenerPort")) { } else if (String::equal(name, "consumerIdleTimeout")) { } else if (String::equal(name, "shutdownTimeout")) { } else if (String::equal(name, "traceLevel")) { if (value > 4) { throw OMInvalidOptionValue(name, ""); } } return true; } Boolean DynamicListenerConfig::valueEquals(const String& name, const String& value) const { //not implemented yet -- do we need this in addition to lookupValue()? return _optionMgr.valueEquals(name, value); } Boolean DynamicListenerConfig::isTrue(const String& name) const { //no additional checking for booleans return _optionMgr.isTrue(name); } String DynamicListenerConfig::getListenerHome() { return _listenerHome; } //This sets the listener home to the FULL path //We do it once here so we do not have to keep doing file operations later on void DynamicListenerConfig::setListenerHome(const String& home) { PEG_METHOD_ENTER(TRC_LISTENER, "DynamicListenerConfig::setListenerHome"); if (System::is_absolute_path((const char *)home.getCString())) { _listenerHome = home; } else { String currentDir; FileSystem::getCurrentDirectory(currentDir); _listenerHome = FileSystem::getAbsolutePath((const char*)currentDir.getCString(), home); } PEG_METHOD_EXIT(); } String DynamicListenerConfig::getHomedPath(const String& value) { PEG_METHOD_ENTER(TRC_LISTENER, "DynamicListenerConfig::getHomedPath()"); String homedPath = String::EMPTY; if (String::equal(value, String::EMPTY)) { homedPath = _listenerHome; } else { homedPath = FileSystem::getAbsolutePath((const char*)_listenerHome.getCString(), value); } FileSystem::translateSlashes(homedPath); PEG_METHOD_EXIT(); return homedPath; } PEGASUS_NAMESPACE_END
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |