MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / processOne

Method processOne

extensions/sftp/processors/PutSFTP.cpp:223–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223bool PutSFTP::processOne(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
224 auto flow_file = session->get();
225 if (flow_file == nullptr) {
226 return false;
227 }
228
229 /* Parse common properties */
230 SFTPProcessorBase::CommonProperties common_properties;
231 if (!parseCommonPropertiesOnTrigger(context, flow_file, common_properties)) {
232 context->yield();
233 return false;
234 }
235
236 /* Parse processor-specific properties */
237 std::string filename;
238 std::string remote_path;
239 bool disable_directory_listing = false;
240 std::string temp_file_name;
241 bool last_modified_time_set = false;
242 int64_t last_modified_time = 0U;
243 bool permissions_set = false;
244 uint32_t permissions = 0U;
245 bool remote_owner_set = false;
246 uint64_t remote_owner = 0U;
247 bool remote_group_set = false;
248 uint64_t remote_group = 0U;
249
250 flow_file->getAttribute(core::SpecialFlowAttribute::FILENAME, filename);
251
252 std::string value;
253 context->getProperty(RemotePath, remote_path, flow_file);
254 /* Remove trailing slashes */
255 while (remote_path.size() > 1U && remote_path.back() == '/') {
256 remote_path.resize(remote_path.size() - 1);
257 }
258 /* Empty path means current directory, so we change it to '.' */
259 if (remote_path.empty()) {
260 remote_path = ".";
261 }
262 if (context->getDynamicProperty(DisableDirectoryListing.getName(), value)) {
263 utils::StringUtils::StringToBool(value, disable_directory_listing);
264 } else if (context->getProperty(DisableDirectoryListing.getName(), value)) {
265 utils::StringUtils::StringToBool(value, disable_directory_listing);
266 }
267 context->getProperty(TempFilename, temp_file_name, flow_file);
268 if (context->getProperty(LastModifiedTime, value, flow_file)) {
269 if (core::Property::StringToDateTime(value, last_modified_time)) {
270 last_modified_time_set = true;
271 }
272 }
273 if (context->getProperty(Permissions, value, flow_file)) {
274 if (core::Property::StringToPermissions(value, permissions)) {
275 permissions_set = true;
276 }
277 }
278 if (context->getProperty(RemoteOwner, value, flow_file)) {
279 if (core::Property::StringToInt(value, remote_owner)) {
280 remote_owner_set = true;

Callers 1

onTriggerMethod · 0.95

Calls 15

IsNullOrEmptyFunction · 0.85
log_debugMethod · 0.80
statMethod · 0.80
getLastErrorMethod · 0.80
log_errorMethod · 0.80
c_strMethod · 0.80
renameMethod · 0.80
removeFileMethod · 0.80
log_warnMethod · 0.80
concat_pathFunction · 0.50
getMethod · 0.45
yieldMethod · 0.45

Tested by

no test coverage detected