1 /* Copyright (C) 2014 InfiniDB, Inc.
2 
3    This program is free software; you can redistribute it and/or
4    modify it under the terms of the GNU General Public License
5    as published by the Free Software Foundation; version 2 of
6    the License.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16    MA 02110-1301, USA. */
17 
18 /***********************************************************************
19  *   $Id: we_xmlgendata.h 4450 2013-01-21 14:13:24Z rdempsey $
20  *
21  ***********************************************************************/
22 /** @file */
23 #ifndef _WE_XMLGENDATA_H_
24 #define _WE_XMLGENDATA_H_
25 
26 #include <iosfwd>
27 #include <string>
28 #include <vector>
29 #include <map>
30 #include "calpontsystemcatalog.h"
31 
32 #if defined(_MSC_VER) && defined(WRITEENGINE_DLLEXPORT)
33 #define EXPORT __declspec(dllexport)
34 #else
35 #define EXPORT
36 #endif
37 
38 namespace WriteEngine
39 {
40 
41 /** @brief Base class for storing input data used to generate a Job XML file.
42  *
43  *  This class represents common code refactored out of inputmgr.h, under
44  *  tools/dbloadxml.  It was moved to writeengine/xml so that this common
45  *  code could be used by both colxml and cpimport.bin.
46  */
47 class XMLGenData
48 {
49 public:
50     typedef std::vector<execplan::CalpontSystemCatalog::TableName> TableList;
51     typedef std::map<std::string, std::string> ParmList;
52     typedef std::vector<std::string> LoadNames;
53 
54     // Valid parms that can be stored and retrieved from XMLGenData
55     EXPORT const static std::string DELIMITER;
56     EXPORT const static std::string DESCRIPTION;
57 #if defined(_MSC_VER) && !defined(WRITEENGINE_DLLEXPORT)
58     __declspec(dllimport)
59 #endif
60     EXPORT const static std::string ENCLOSED_BY_CHAR;
61 #if defined(_MSC_VER) && !defined(WRITEENGINE_DLLEXPORT)
62     __declspec(dllimport)
63 #endif
64     EXPORT const static std::string ESCAPE_CHAR;
65 #if defined(_MSC_VER) && !defined(WRITEENGINE_DLLEXPORT)
66     __declspec(dllimport)
67 #endif
68     EXPORT const static std::string JOBID;
69     EXPORT const static std::string MAXERROR;
70     EXPORT const static std::string NAME;
71     EXPORT const static std::string PATH;
72 #if defined(_MSC_VER) && !defined(WRITEENGINE_DLLEXPORT)
73     __declspec(dllimport)
74 #endif
75     EXPORT const static std::string RPT_DEBUG;
76     EXPORT const static std::string USER;
77     EXPORT const static std::string NO_OF_READ_BUFFER;
78     EXPORT const static std::string READ_BUFFER_CAPACITY;
79     EXPORT const static std::string WRITE_BUFFER_SIZE;
80     EXPORT const static std::string EXT;
81 
82     /** @brief XMLGenData constructor
83      */
84     EXPORT XMLGenData();
85 
86     /** @brief XMLGenData destructor
87      */
88     EXPORT virtual ~XMLGenData();
89 
90     /** @brief Print contents of this object to the specified stream.
91      */
92     EXPORT virtual void print(std::ostream& os) const;
93 
94     EXPORT std::string getParm(const std::string& key) const;
getTables()95     const TableList&   getTables()    const
96     {
97         return fTables;
98     }
getSchema()99     const std::string& getSchema()    const
100     {
101         return fSchema;
102     }
getLoadNames()103     const LoadNames&   getLoadNames() const
104     {
105         return fLoadNames;
106     }
107 
108 protected:
109     TableList   fTables;
110     ParmList    fParms;
111     std::string fSchema;
112     LoadNames   fLoadNames;
113 
114 private:
115     XMLGenData(const XMLGenData&);             // disable default copy ctor
116     XMLGenData& operator=(const XMLGenData&);  // disable default assignment
117 };
118 
119 }
120 
121 #undef EXPORT
122 
123 #endif
124