Main.cc
6.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/****
* Main.cc
* Created on: 15 oct. 2012
* Author: AKKA IS
****/
/*!
* @mainpage AMDA-Kernel
* @image html Logo_CDPP-AMDA_little.png
* @image latex Logo_CDPP-AMDA_little.png "" height=0cm
* @section Introduction
* This document describe the AMDA-Kernel conception:
* - Version 1.0.0 written by AKKA IS exposes:
* -# main component Parameters used to retrieve/store data in parameter. See AMDA::Parameters and AMDA::Parameters::Parameter.
* -# EvalFormule component which is detailed by only one class: AMDA::Parameters::ProcessStandard
* -# Download component used to store data in ASCII file which is detailed in namespace AMDA::ParamOutputImpl::Download
* -# DD server Interface component used to open connection and sending data request to server. See AMDA::DDServerInterface
* - Version 2.0.0 written by CS exposes:
* -# TimeTable component used to read/write data from/to file. See timetable. It supports following format:
* - internal XML
* - VO
* - ASCII
* -# Updates of Download component to take into account possibilities of timetable
* -# DataMining component used to store logical state of an equation in file. See AMDA::ParamOutputImpl::DataMining
* -# Plot component used to draw graphics and based on plplot tools. See plot.
* - Version 3.0.0 written by AKKA exposes :
* -# Components Info used to describe parameters, datasets, instruments and missions
* -# Additional functionnalities in the Plot component :
* - Definition of a label
* - Definition of a horizontal or vetical line
* - Draw spectro for a timePlot
* - Muti-Axes Y support
* - Definition of a min or a max value for a plot
* - Definition of a temporal indication along a serie
* - Fill space between a line and a serie
* - Fill space between two series
* - Now the component apply a reampling in a parameter only if it's really needed
* - Definition of vertical layout and auto layout
* - Possibility to make a plot request in a TimeTable
* - Multi-Panel support in a page
* - Possibility to apply a post processing in a plot request result
* - Definition of a legend that's described all plotted series
* - Definition of an additionnal text in a panel
* - Definition of additionals curves
* - Use the Info component to show real parameters info in a plot
* - Definition of plot 'instantPlot'
* - Use the definition of physical gaps for a parameter in a plot
* - Possibility to define a colored parameter along a serie
* - Possibility to define an orbit plot with a projection
* - Possibility to add an error bars along a serie
* - Possibility to plot the new Tab2D ParamData
* - Possibility to plot a Tab2D for an instant cut time
* - Definition of the new plot "statusBar"
* - Definition of the new plot "epochPlot"
* - Possibility to superpose all time intervals in a same page of plot
* -# Additional functionnalities in the Download component :
* - CDF format support
* - JSON format support
* - VOTable format support
* - Use the Info component to show real parameters info in output files
* - New outputStructure "one-file-per-parameter-per-interval"
* - New output structures to resample parameters in the time list of a reference parameters (the first one defined in the request)
* - Creation of a catalog file for "too small time intervals" with the means of all parameters for each time intervals
* -# Add new Tab2D ParamData types
* -# Module TimeTable is replaced by the module TimeTableCatalog and support the load and the write of catalog files
* -# New ParamOutput module StatisticOutput to compute some statistics result
* -# New ParamGet module to get data from local files
* - CDF format support
* - ASCII format support
* - VOTable format support
*
*@section References
*@version 3.6.0
*@authors AKKA IS, CS.
*/
#include <iostream>
#include <memory>
// libxml
#include "libxml/threads.h"
#include "Application.hh"
#include "ParseMainArguments.hh"
// Parameters module include
#include "ParameterManager.hh"
#include "Parameter.hh"
#include "Process.hh"
#include "ServicesServer.hh"
// XMLRequest module include
#include "XMLRequestParser.hh"
using namespace AMDA::Parameters;
using namespace AMDA::XMLRequest;
using namespace AMDA::MainRequest;
/**
* Main function
*/
int main(int argc, char *argv[]) {
int result = AMDA_EXIT_OK;
xmlInitParser();
try {
//----------------------------
//argument parsing
ParseMainArguments parseArg(argc, argv);
if (parseArg.isStopProcess()) {
BOOST_THROW_EXCEPTION(AMDA::AMDA_exception());
}
if (access("app.properties", F_OK) != 0) {
BOOST_THROW_EXCEPTION(
AMDA::AMDA_exception() << AMDA::errno_code(AMDA_FILEPROPERTIES_ERR) << AMDA::ex_msg("Properties file not found"));
}
AMDA::helpers::Properties lProperties("app.properties");
std::unique_ptr<AMDA::XMLRequest::XMLRequestParser> u0Process(new AMDA::XMLRequest::XMLRequestParser(
lProperties["app.request.xsd"].c_str()));
ServicesServer::getInstance()->addService(u0Process.get());
bool b;
istringstream(lProperties["app.process.DYNAMIC_LOADING"]) >> std::boolalpha >> b;
if (b) {
ServicesServer::getInstance()->loadPluginsFromRequest(parseArg.getRequesteFile().c_str());
}
AMDA::Common::Application lMain;
result = lMain.main(argc, argv,
[&](int, char **, AMDA::helpers::Properties & lProperties) -> int {
std::unique_ptr<AMDA::XMLRequest::XMLRequestParser> u1Process = std::move(u0Process);
//----------------------------
//Start process
AMDA::Parameters::ParameterManager lParameterManager;
if (!lProperties["app.param.gapthreshold"].empty()) {
double defaultGapThreshold = atof(lProperties["app.param.gapthreshold"].c_str());
if (defaultGapThreshold > 0.)
lParameterManager.setDefaultGapThreshold(defaultGapThreshold);
}
(*u1Process)(lParameterManager, parseArg.getRequesteFile());
lParameterManager.execute(parseArg.getWorkPath());
return AMDA_EXIT_OK;
});
} catch (AMDA::AMDA_exception & e) {
std::cerr <<
"Error resume: " << AMDA::traitException(result, e) << std::endl;
}
return result;
}