Xpriori::XMS::ServerUtil::Win32 - subclass of Xpriori::XMS::ServerUtils for Win32.


Xpriori-XMS documentation Contained in the Xpriori-XMS distribution.

Index


Code Index:

NAME

Top

Xpriori::XMS::ServerUtil::Win32 - subclass of Xpriori::XMS::ServerUtils for Win32.

SYNOPSIS

Top

This module is not intended to use directly.

DESCRIPTION

Top

subclass of Xpriori::XMS::ServerUtils for Win32.

NOTICE

Top

This module needs Win32::Service.

AUTHOR

Top

KAWAI,Takanori kwitknr@cpan.org

COPYRIGHT

Top

SEE ALSO

Top

Xpriori::XMS::ServerUtil, Xpriori::XMS::ServerUtil::Solaris


Xpriori-XMS documentation Contained in the Xpriori-XMS distribution.

use strict;
package Xpriori::XMS::ServerUtil::Win32;
use Win32::Service;
sub new($)
{
  return bless {}, shift(@_);
}
sub startServer($)
{
    my ($oSelf) = @_;
    return Win32::Service::StartService('', 'NeoServer');
}
sub stopServer($)
{
    my ($oSelf) = @_;
    return Win32::Service::StopService('', 'NeoServer');
}
sub getStatus($)
{
    my ($oSelf) = @_;
    my $iStsW = $oSelf->getStatusWin();
    return ($iStsW == 1)? 0 : 1; #STOPPED or NOT
}
sub createDb($$$)
{
  my($oSelf, $sNeoHome, $sPasswd) = @_;
  return qx{${sNeoHome}/bin/neoXMLUtils CreateDB_batch ${sNeoHome}/config ${sPasswd} AC_ON};
}
sub getStatusWin($)
{
    my ($oSelf) = @_;
    my %hRes;
    Win32::Service::GetStatus('', 'NeoServer', \%hRes);
    $hRes{CurrentStateText} = 
           $oSelf->getStatusWinTxt($hRes{CurrentState});
    return (wantarray())?  %hRes : $hRes{CurrentState};
}
sub getStatusWinTxt($$)
{
  my($oSelf, $iSts) = @_;
  my %_hStatus = (
    1 => 'SERVICE_STOPPED',
    2 => 'SERVICE_START_PENDING',
    3 => 'SERVICE_STOP_PENDING',
    4 => 'SERVICE_RUNNING', 
    5 => 'SERVICE_CONTINUE_PENDING',
    6 => 'SERVICE_PAUSE_PENDING',
    7 => 'SERVICE_PAUSED',
  );
  return $_hStatus{$iSts} if(defined($iSts));

  my %hRes;
  Win32::Service::GetStatus('', 'NeoServer', \%hRes);
  return $_hStatus{$hRes{CurrentState}};
}
1;
__END__