2 * ============LICENSE_START======================================================================
3 * Copyright (C) 2018 Nordix Foundation. All rights reserved.
4 * ===============================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 * in compliance with the License. You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software distributed under the License
11 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing permissions and limitations under
14 * ============LICENSE_END========================================================================
17 package org.onap.dcaegen2.collectors.datafile.ftp;
19 import java.io.IOException;
20 import java.io.OutputStream;
22 import javax.net.ssl.KeyManager;
23 import javax.net.ssl.TrustManager;
25 import org.apache.commons.net.ftp.FTPSClient;
27 public class FTPSClientWrapper implements IFTPSClient {
28 private FTPSClient ftpsClient = new FTPSClient();
31 public void setNeedClientAuth(boolean isNeedClientAuth) {
32 ftpsClient.setNeedClientAuth(isNeedClientAuth);
36 public void setKeyManager(KeyManager keyManager) {
37 ftpsClient.setKeyManager(keyManager);
41 public void setTrustManager(TrustManager trustManager) {
42 ftpsClient.setTrustManager(trustManager);
46 public void connect(String hostName, int port) throws IOException {
47 ftpsClient.connect(hostName, port);
51 public boolean login(String username, String password) throws IOException {
52 return ftpsClient.login(username, password);
56 public boolean logout() throws IOException {
57 return ftpsClient.logout();
61 public int getReplyCode() {
62 return ftpsClient.getReplyCode();
66 public void disconnect() throws IOException {
67 ftpsClient.disconnect();
71 public void enterLocalPassiveMode() {
72 ftpsClient.enterLocalPassiveMode();
76 public void setFileType(int fileType) throws IOException {
77 ftpsClient.setFileType(fileType);
81 public void execPBSZ(int psbz) throws IOException {
82 ftpsClient.execPBSZ(psbz);
86 public void execPROT(String prot) throws IOException {
87 ftpsClient.execPROT(prot);
91 public boolean retrieveFile(String remote, OutputStream local) throws IOException {
92 return ftpsClient.retrieveFile(remote, local);
96 public void setTimeout(Integer t) {
97 this.ftpsClient.setDefaultTimeout(t);
101 public boolean isConnected() {
102 return ftpsClient.isConnected();
106 public void setBufferSize(int bufSize) {
107 ftpsClient.setBufferSize(bufSize);