fintp_connectors
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
FilePublisher.h
Go to the documentation of this file.
1 /*
2 * FinTP - Financial Transactions Processing Application
3 * Copyright (C) 2013 Business Information Systems (Allevo) S.R.L.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>
17 * or contact Allevo at : 031281 Bucuresti, 23C Calea Vitan, Romania,
18 * phone +40212554577, office@allevo.ro <mailto:office@allevo.ro>, www.allevo.ro.
19 */
20 
21 #ifndef FILEPUBLISHER_H
22 #define FILEPUBLISHER_H
23 
24 #include "../Endpoint.h"
25 #include "../Message.h"
26 #include "MQ/MqWatcher.h"
27 
28 #include <fstream>
29 
30 class FilePublisher : public Endpoint
31 {
32  protected :
33 
34  // methods for controlling the endpoint
35  void internalStart();
36  void internalStop();
37 
38  public:
39 
40  // constructor
41  FilePublisher();
42 
43  //destructor
45 
46  // called before start. allows the endpoint to prepare environment
47  void Init();
48 
49  // methods for transactional execution
52  string Prepare();
53 
55  void Commit();
56 
58  void Abort();
59 
61  void Rollback();
62 
65  void Process( const string& correlationId );
66 
67  string Serialize( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, const string& xsltFilename, const string& filename, const unsigned long fileSize = 0, const string& HMAC = "" );
68 
69  bool moreMessages() const;
70  pthread_t getWatcherThreadId() { return m_Watcher.getThreadId(); }
71 
72  static string XPathCallback( const string& itemNamespace );
73 
74  private:
75 
76  void WriteMessage( const char* message, const streamsize length );
77  string HMAC_ShaGen( const string& inData, const string& privateKey );
78 
79  MqWatcher m_Watcher;
80 
81  string m_WatchQueue;
86 
87  //string m_CurrentMessageId;
88  //string m_CurrentGroupId;
89  //unsigned long m_CurrentMessageLength;
90 
91  // used by the "XMLFile" batch manager to generate a unique name ony for the first message
92  bool m_First;
93 
94  static string m_DestinationPath;
95  static string m_ReplyDestinationPath;
96  static string m_ReplyPattern;
97  static string m_Pattern;
98  static string m_TransformFile;
99  static string m_ReplyFeedback;
100  static string m_TempDestinationPath;
101 
102  string m_MessageId;
103 
104  // set only for xmlfile batchmanager type ( unique to each batch )
105  string m_BatchId;
106 
110 
111  ofstream m_DestFile;
112 
114 
116 
117 #ifdef USING_REGULATIONS
118  string m_ParamFileXslt;
119  string m_LAUCertFile;
120 #endif // USING_REGULATIONS
121 
122  string m_BlobLocator; // simplified xpath to locate the blob in the payload ( ex. /root/IDIMAGINE )
123  string m_BlobFilePattern; // folder+filename containing {xpats}s ( ex : c:\blobs\{/root/BATCHID}_{/root/IMAGEREF}.tiff )
124  string SaveBlobToFile( const string& xmlData );
125 };
126 
127 #endif