1 // =================================
  2 // Copyright (c) 2021 Seppo Laakko
  3 // Distributed under the MIT license
  4 // =================================
  5 
  6 #include <cmajor/build/BuildServerMessage.hpp>
  7 #include <cmajor/build/MessageHandler.hpp>
  8 
  9 namespace cmajor { namespace build {
 10 
 11 const char* pushProjectRequestId = "push-project-request";
 12 const char* pushProjectResponseId = "push-project-response";
 13 const char* pushProjectFileRequestId = "push-project-file-request";
 14 const char* pushProjectFileResponseId = "push-project-file-response";
 15 const char* pushProjectFileContentRequestId = "push-project-file-content-request";
 16 const char* pushProjectFileContentResponseId = "push-project-file-content-response";
 17 const char* buildProjectRequestId = "build-project-request";
 18 const char* buildProjectResponseId = "build-project-response";
 19 const char* showBuildMessageRequestId = "show-build-message-request";
 20 const char* showBuildMessageResponseId = "show-build-message-response";
 21 const char* errorResponseId = "error-response";
 22 const char* closeConnectionRequestId = "close-connection-request";
 23 
 24 PushProjectRequest::PushProjectRequest() : Message<ProjectInfo>()
 25 {
 26 }
 27 
 28 PushProjectRequest::PushProjectRequest(JsonObject* messageObject) : Message<ProjectInfo>(messageObject)
 29 {
 30 }
 31 
 32 void PushProjectRequest::DispatchTo(MessageHandler& handler)
 33 {
 34     handler.Handle(*this);
 35 }
 36 
 37 PushProjectResponse::PushProjectResponse() : Message<ProjectUpToDate>()
 38 {
 39 }
 40 
 41 PushProjectResponse::PushProjectResponse(JsonObject* messageObject) : Message<ProjectUpToDate>(messageObject)
 42 {
 43 }
 44 
 45 void PushProjectResponse::DispatchTo(MessageHandler& handler)
 46 {
 47     handler.Handle(*this);
 48 }
 49 
 50 PushProjectFileRequest::PushProjectFileRequest() : Message<ProjectInfo>()
 51 {
 52 }
 53 
 54 PushProjectFileRequest::PushProjectFileRequest(JsonObject* messageObject) : Message<ProjectInfo>(messageObject)
 55 {
 56 }
 57 
 58 void PushProjectFileRequest::DispatchTo(MessageHandler& handler)
 59 {
 60     handler.Handle(*this);
 61 }
 62 
 63 PushProjectFileResponse::PushProjectFileResponse() : Message<ProjectInfo>()
 64 {
 65 }
 66 
 67 PushProjectFileResponse::PushProjectFileResponse(JsonObject* messageObject) : Message<ProjectInfo>(messageObject)
 68 {
 69 }
 70 
 71 void PushProjectFileResponse::DispatchTo(MessageHandler& handler)
 72 {
 73     handler.Handle(*this);
 74 }
 75 
 76 PushProjectFileContentRequest::PushProjectFileContentRequest() : Message<ProjectInfo>()
 77 {
 78 }
 79 
 80 PushProjectFileContentRequest::PushProjectFileContentRequest(JsonObject* messageObject) : Message<ProjectInfo>(messageObject)
 81 {
 82 }
 83 
 84 void PushProjectFileContentRequest::DispatchTo(MessageHandler& handler)
 85 {
 86     handler.Handle(*this);
 87 }
 88 
 89 PushProjectFileContentResponse::PushProjectFileContentResponse() : Message<ProjectUpdated>()
 90 {
 91 }
 92 
 93 PushProjectFileContentResponse::PushProjectFileContentResponse(JsonObject* messageObject) : Message<ProjectUpdated>(messageObject)
 94 {
 95 }
 96 
 97 void PushProjectFileContentResponse::DispatchTo(MessageHandler& handler)
 98 {
 99     handler.Handle(*this);
100 }
101 
102 BuildProjectRequest::BuildProjectRequest() : Message<ProjectToBuild>()
103 {
104 }
105 
106 BuildProjectRequest::BuildProjectRequest(JsonObject* messageObject) : Message<ProjectToBuild>(messageObject)
107 {
108 }
109 
110 void BuildProjectRequest::DispatchTo(MessageHandler& handler)
111 {
112     handler.Handle(*this);
113 }
114 
115 BuildProjectResponse::BuildProjectResponse() : Message<ProjectBuilt>()
116 {
117 }
118 
119 BuildProjectResponse::BuildProjectResponse(JsonObject* messageObject) : Message<ProjectBuilt>(messageObject)
120 {
121 }
122 
123 void BuildProjectResponse::DispatchTo(MessageHandler& handler)
124 {
125     handler.Handle(*this);
126 }
127 
128 ShowBuildMessageRequest::ShowBuildMessageRequest() : Message<MessageLine>()
129 {
130 }
131 
132 ShowBuildMessageRequest::ShowBuildMessageRequest(JsonObject* messageObject) : Message<MessageLine>(messageObject)
133 {
134 }
135 
136 void ShowBuildMessageRequest::DispatchTo(MessageHandler& handler)
137 {
138     handler.Handle(*this);
139 }
140 
141 ShowBuildMessageResponse::ShowBuildMessageResponse() : Message<MessageShown>()
142 {
143 }
144 
145 ShowBuildMessageResponse::ShowBuildMessageResponse(JsonObject* messageObject) : Message<MessageShown>(messageObject)
146 {
147 }
148 
149 void ShowBuildMessageResponse::DispatchTo(MessageHandler& handler)
150 {
151     handler.Handle(*this);
152 }
153 
154 ErrorResponse::ErrorResponse() : Message<Error>()
155 {
156 }
157 
158 ErrorResponse::ErrorResponse(JsonObject* messageObject) : Message<Error>(messageObject)
159 {
160 }
161 
162 void ErrorResponse::DispatchTo(MessageHandler& handler)
163 {
164     handler.Handle(*this);
165 }
166 
167 CloseConnectionRequest::CloseConnectionRequest() : Message<CloseConnection>()
168 {
169 }
170 
171 CloseConnectionRequest::CloseConnectionRequest(JsonObject* messageObject) : Message<CloseConnection>(messageObject)
172 {
173 }
174 
175 void CloseConnectionRequest::DispatchTo(MessageHandler& handler)
176 {
177     handler.Handle(*this);
178 }
179 
180 void BuildServerMessageInit()
181 {
182     MessageFactory::Instance().Register(pushProjectRequestIdnew ConcreteMessageCreator<PushProjectRequest>());
183     MessageFactory::Instance().Register(pushProjectResponseIdnew ConcreteMessageCreator<PushProjectResponse>());
184     MessageFactory::Instance().Register(pushProjectFileRequestIdnew ConcreteMessageCreator<PushProjectFileRequest>());
185     MessageFactory::Instance().Register(pushProjectFileResponseIdnew ConcreteMessageCreator<PushProjectFileResponse>());
186     MessageFactory::Instance().Register(pushProjectFileContentRequestIdnew ConcreteMessageCreator<PushProjectFileContentRequest>());
187     MessageFactory::Instance().Register(pushProjectFileContentResponseIdnew ConcreteMessageCreator<PushProjectFileContentResponse>());
188     MessageFactory::Instance().Register(buildProjectRequestIdnew ConcreteMessageCreator<BuildProjectRequest>());
189     MessageFactory::Instance().Register(buildProjectResponseIdnew ConcreteMessageCreator<BuildProjectResponse>());
190     MessageFactory::Instance().Register(showBuildMessageRequestIdnew ConcreteMessageCreator<ShowBuildMessageRequest>());
191     MessageFactory::Instance().Register(showBuildMessageResponseIdnew ConcreteMessageCreator<ShowBuildMessageResponse>());
192     MessageFactory::Instance().Register(errorResponseIdnew ConcreteMessageCreator<ErrorResponse>());
193     MessageFactory::Instance().Register(closeConnectionRequestIdnew ConcreteMessageCreator<CloseConnectionRequest>());
194 }
195 
196 void BuildServerMessageDone()
197 {
198 }
199 
200 } } // namespace cmajor::build