version 1.19, 2006/08/09 21:13:05
|
version 1.20, 2006/11/14 18:34:59
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com) |
|
// |
|
// Modified By: |
|
// Sushma Fernandes, Hewlett-Packard Company (sushma_fernandes@hp.com) |
|
// Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com) |
|
// |
|
//%//////////////////////////////////////////////////////////////////////////// | //%//////////////////////////////////////////////////////////////////////////// |
| |
| |
|
|
#include <Pegasus/Common/Signal.h> | #include <Pegasus/Common/Signal.h> |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/Monitor.h> |
#include <Pegasus/Common/MessageLoader.h> |
#include <Pegasus/Provider/CIMMethodProvider.h> | #include <Pegasus/Provider/CIMMethodProvider.h> |
#include <Pegasus/Server/ShutdownService.h> | #include <Pegasus/Server/ShutdownService.h> |
#include "ShutdownProvider.h" | #include "ShutdownProvider.h" |
| |
// l10n |
|
#include <Pegasus/Common/MessageLoader.h> |
|
|
|
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
{ | { |
PEG_METHOD_ENTER(TRC_SHUTDOWN, "ShutdownProvider::invokeMethod()"); | PEG_METHOD_ENTER(TRC_SHUTDOWN, "ShutdownProvider::invokeMethod()"); |
| |
|
|
|
|
// Check to see if the method name is correct | // Check to see if the method name is correct |
if (!methodName.equal(METHOD_NAME_SHUTDOWN)) | if (!methodName.equal(METHOD_NAME_SHUTDOWN)) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE, String::EMPTY); |
throw PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_METHOD_NOT_AVAILABLE, String::EMPTY); |
} | } |
| |
// Get user name | // Get user name |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY); | throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY); |
} | } |
|
|
#ifndef PEGASUS_ZOS_SECURITY | #ifndef PEGASUS_ZOS_SECURITY |
// Only privileged user can execute this operation | // Only privileged user can execute this operation |
if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) | if ((userName != String::EMPTY) && !System::isPrivilegedUser(userName)) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
// l10n |
|
MessageLoaderParms parms( | MessageLoaderParms parms( |
"ControlProviders.UserAuthProvider.MUST_BE_PRIVILEGED_USER", | "ControlProviders.UserAuthProvider.MUST_BE_PRIVILEGED_USER", |
"Must be a privileged user to execute this CIM operation."); | "Must be a privileged user to execute this CIM operation."); |
|
|
if ( inParameters.size() < 2 ) | if ( inParameters.size() < 2 ) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER, |
// l10n |
MessageLoaderParms( |
|
"Server.ShutdownProvider.INPUT_NOT_VALID", |
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER, MessageLoaderParms("Server.ShutdownProvider.INPUT_NOT_VALID","Input parameters are not valid.")); |
"Input parameters are not valid.")); |
|
|
// throw PEGASUS_CIM_EXCEPTION( CIM_ERR_INVALID_PARAMETER, |
|
// "Input parameters are not valid."); |
|
} | } |
| |
Boolean force = false; | Boolean force = false; |
|
|
else | else |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER, |
// l10n |
MessageLoaderParms( |
|
"Server.ShutdownProvider.INPUT_NOT_VALID", |
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER, MessageLoaderParms("Server.ShutdownProvider.INPUT_NOT_VALID","Input parameters are not valid.")); |
"Input parameters are not valid.")); |
|
|
// throw PEGASUS_CIM_EXCEPTION( CIM_ERR_INVALID_PARAMETER, |
|
// "Input parameters are not valid."); |
|
} | } |
} | } |
} | } |
| |
try | try |
{ | { |
|
|
|
|
_shutdownService->shutdown(force, timeoutValue, true); | _shutdownService->shutdown(force, timeoutValue, true); |
|
|
} | } |
catch (CIMException& e) | catch (CIMException& e) |
{ | { |
|
|
handler.deliver(CIMValue(0)); | handler.deliver(CIMValue(0)); |
handler.complete(); | handler.complete(); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return; |
|
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
|
|