/* * * ProLinga-Data * * Copyright (C) 2002-2009 Xobas Software. * All rights reserved. * * This file is part of ProLinga-Data. * * ProLinga-Data 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-Data 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-Data. If not, see . * * More information is available at the following addresses: * * Website : http://www.prolinga.org * * Email : prolinga-list@prolinga.org * * */ #include #include "DatCommon.h" #include #include #include "DatConfig.hpp" #include "DatMain.hpp" /* Global Pointers */ PlDataPtr datPtr; void ResetDataService(int signo) { /* Flush */ datPtr->dataClose(); datPtr->dataOpen(NULL, -1, NULL); } void StopDataService(int signo) { /* Clean up */ datPtr->dataClose(); /* Exit */ exit(0); } int main(int argc, char **argv) { pid_t pid; int i, serverPort, numThreads, serverComp, logLevel; char *serverHost, *logFile; PlSoapService sservice; ConfigDatPtr confDatPtr; /* Check arguments */ for (i=1;igetStringValue("LogFile", DEF_LOG_FILE); confDatPtr->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 = confDatPtr->getStringValue("ServerHost", DEF_SERVER_HOST); serverPort = confDatPtr->getNumberValue("ServerPort", DEF_SERVER_PORT); numThreads = confDatPtr->getNumberValue("NumberOfThreads", DEF_THREADS); serverComp = confDatPtr->getNumberValue("ServerCompressionLevel", DEF_SERVER_COMP_LEVEL); logFile = confDatPtr->getStringValue("LogFile", DEF_LOG_FILE); logLevel = confDatPtr->getNumberValue("LogLevel", DEF_LOG_LEVEL); /* Init libgda */ //gda_init(); /* Open Data */ datPtr->dataOpen(NULL, argc, argv); /*Start the Repository Service */ sservice.soapServiceStart(serverHost, serverPort, numThreads, serverComp, logFile, logLevel); /* Close Data */ datPtr->dataClose(); /* Clean up */ delete confDatPtr; /* Return */ return 0; } }