/*
*
* ProLinga-Repository
*
* Copyright (C) 2002-2008 Xobas Software.
* All rights reserved.
*
* This file is part of ProLinga-Repository.
*
* ProLinga-Repository 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-Repository 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-Repository. If not, see .
*
* More information is available at the following addresses:
*
* Website : http://www.prolinga.org
*
* Email : prolinga-list@prolinga.org
*
*
*/
#include
#include "RepCommon.h"
#include
#include
#include "RepConfig.hpp"
#include "RepMain.hpp"
/* Global Repository Pointer */
PlRepositoryPtr repPtr;
void ResetRepositoryService(int signo)
{
/* Flush container to disk */
repPtr->repositoryClose();
repPtr->repositoryOpen(NULL);
}
void StopRepositoryService(int signo)
{
/* Close container */
repPtr->repositoryClose();
/* Exit */
exit(0);
}
int main(int argc, char *argv[])
{
pid_t pid;
int i, server_port, num_threads, server_comp, log_level;
char *server_host, *log_file, *system_path;
PlSoapService sservice;
ConfigRepPtr confRepPtr;
for (i=1;igetStringValue("LogFile", DEF_LOG_FILE);
confRepPtr->writeConfig(log_file);
/* 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 */
system_path = confRepPtr->getStringValue("SystemPath", DEF_SYSTEM_PATH);
server_host = confRepPtr->getStringValue("ServerHost", DEF_SERVER_HOST);
server_port = confRepPtr->getNumberValue("ServerPort", DEF_SERVER_PORT);
num_threads = confRepPtr->getNumberValue("NumberOfThreads", DEF_THREADS);
server_comp = confRepPtr->getNumberValue("ServerCompressionLevel", DEF_SERVER_COMP_LEVEL);
log_file = confRepPtr->getStringValue("LogFile", DEF_LOG_FILE);
log_level = confRepPtr->getNumberValue("LogLevel", DEF_LOG_LEVEL);
/* Open Repository */
repPtr->repositoryOpen(NULL);
/*Start the Repository Service */
sservice.soapServiceStart(server_host, server_port, num_threads, server_comp, log_file, log_level);
/* Close container */
repPtr->repositoryClose();
/* Clean up */
delete confRepPtr;
delete repPtr;
//exit(0);
}
}