blob: 3d2a11516c41a3c01f6e290ae020eab823b9540c [file] [log] [blame]
* PutSFTP class declaration
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
#ifndef __PUT_SFTP_H__
#define __PUT_SFTP_H__
#include <memory>
#include <string>
#include <list>
#include <map>
#include <mutex>
#include <thread>
#include "SFTPProcessorBase.h"
#include "utils/ByteArrayCallback.h"
#include "FlowFileRecord.h"
#include "core/Processor.h"
#include "core/ProcessSession.h"
#include "core/Core.h"
#include "core/Property.h"
#include "core/Resource.h"
#include "controllers/SSLContextService.h"
#include "core/logging/LoggerConfiguration.h"
#include "utils/Id.h"
#include "../client/SFTPClient.h"
namespace org {
namespace apache {
namespace nifi {
namespace minifi {
namespace processors {
class PutSFTP : public SFTPProcessorBase {
static constexpr char const *CONFLICT_RESOLUTION_REPLACE = "REPLACE";
static constexpr char const *CONFLICT_RESOLUTION_IGNORE = "IGNORE";
static constexpr char const *CONFLICT_RESOLUTION_RENAME = "RENAME";
static constexpr char const *CONFLICT_RESOLUTION_REJECT = "REJECT";
static constexpr char const *CONFLICT_RESOLUTION_FAIL = "FAIL";
static constexpr char const *CONFLICT_RESOLUTION_NONE = "NONE";
static constexpr char const* ProcessorName = "PutSFTP";
* Create a new processor
PutSFTP(std::string name, utils::Identifier uuid = utils::Identifier());
virtual ~PutSFTP();
// Supported Properties
static core::Property RemotePath;
static core::Property CreateDirectory;
static core::Property DisableDirectoryListing;
static core::Property BatchSize;
static core::Property ConflictResolution;
static core::Property RejectZeroByte;
static core::Property DotRename;
static core::Property TempFilename;
static core::Property LastModifiedTime;
static core::Property Permissions;
static core::Property RemoteOwner;
static core::Property RemoteGroup;
static core::Property UseCompression;
// Supported Relationships
static core::Relationship Success;
static core::Relationship Reject;
static core::Relationship Failure;
virtual bool supportsDynamicProperties() override {
return true;
virtual void onTrigger(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) override;
virtual void initialize() override;
virtual void onSchedule(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSessionFactory> &sessionFactory) override;
class ReadCallback : public InputStreamCallback {
ReadCallback(const std::string& target_path,
utils::SFTPClient& client,
const std::string& conflict_resolution);
virtual int64_t process(std::shared_ptr<io::BaseStream> stream) override;
std::shared_ptr<logging::Logger> logger_;
bool write_succeeded_;
const std::string target_path_;
utils::SFTPClient& client_;
const std::string conflict_resolution_;
bool create_directory_;
uint64_t batch_size_;
std::string conflict_resolution_;
bool reject_zero_byte_;
bool dot_rename_;
bool processOne(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session);
REGISTER_RESOURCE(PutSFTP, "Sends FlowFiles to an SFTP Server")
} /* namespace processors */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */