/*
*
* ProLinga-Validate
*
* Copyright (C) 2002-2008 Xobas Software.
* All rights reserved.
*
* This file is part of ProLinga-Validate.
*
* ProLinga-Validate is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProLinga-Validate is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProLinga-Validate. If not, see .
*
* More information is available at the following addresses:
*
* Website : http://www.prolinga.org
*
* Email : prolinga-list@prolinga.org
*
*
*/
#include "ValCommon.h"
#include
#include
#include "ValConfig.hpp"
#include "ValMain.hpp"
/* Global Validate Pointer */
PlValidatePtr valPtr;
void ResetRepositoryService(int signo)
{
valPtr->validateClose();
valPtr->validateOpen(NULL);
}
void StopRepositoryService(int signo)
{
/* Close validate */
valPtr->validateClose();
/* Exit */
exit(0);
}
int main(int argc, char *argv[])
{
pid_t pid;
int i, serverPort, numThreads, serverComp, logLevel;
char *serverHost, *logFile;
PlSoapService sservice;
ConfigValPtr confValPtr;
/* Check arguments */
for (i=1;igetStringValue("LogFile", DEF_LOG_FILE);
confValPtr->writeConfig(logFile);
/* Fork Process */
pid = fork();
if (pid < 0)
{
printf("Error creating server process\n");
exit(-1);
}
else if (pid != 0)
{
/* Parent Process */
exit(0);
}
else
{
/* Child Process */
setsid();
umask(0);
chdir("/");
/* Get config values */
serverHost = confValPtr->getStringValue("ServerHost", DEF_SERVER_HOST);
serverPort = confValPtr->getNumberValue("ServerPort", DEF_SERVER_PORT);
numThreads = confValPtr->getNumberValue("NumberOfThreads", DEF_THREADS);
serverComp = confValPtr->getNumberValue("ServerCompressionLevel", DEF_SERVER_COMP_LEVEL);
logLevel = confValPtr->getNumberValue("LogLevel", DEF_LOG_LEVEL);
/* Open Validate */
valPtr->validateOpen(NULL);
/*Start the Repository Service */
sservice.soapServiceStart(serverHost, serverPort, numThreads, serverComp, logFile, logLevel);
/* Close Validate */
valPtr->validateClose();
/* Clean up */
delete confValPtr;
delete valPtr;
//exit(0);
}
}