2 * ============LICENSE_START======================================================================
3 * Copyright (C) 2018 Nordix Foundation. All rights reserved.
4 * ===============================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ============LICENSE_END========================================================================
19 package org.onap.dcaegen2.collectors.datafile.ftp;
21 import java.io.IOException;
22 import java.io.OutputStream;
24 import javax.net.ssl.KeyManager;
25 import javax.net.ssl.TrustManager;
27 import org.apache.commons.net.ftp.FTPSClient;
29 public class FTPSClientWrapper implements IFTPSClient {
30 private FTPSClient ftpsClient = new FTPSClient();
33 public void setNeedClientAuth(boolean isNeedClientAuth) {
34 ftpsClient.setNeedClientAuth(isNeedClientAuth);
38 public void setKeyManager(KeyManager keyManager) {
39 ftpsClient.setKeyManager(keyManager);
43 public void setTrustManager(TrustManager trustManager) {
44 ftpsClient.setTrustManager(trustManager);
48 public void connect(String hostName, int port) throws IOException {
49 ftpsClient.connect(hostName, port);
53 public boolean login(String username, String password) throws IOException {
54 return ftpsClient.login(username, password);
58 public boolean logout() throws IOException {
59 return ftpsClient.logout();
63 public int getReplyCode() {
64 return ftpsClient.getReplyCode();
68 public void disconnect() throws IOException {
69 ftpsClient.disconnect();
73 public void enterLocalPassiveMode() {
74 ftpsClient.enterLocalPassiveMode();
78 public void execPBSZ(int psbz) throws IOException {
79 ftpsClient.execPBSZ(psbz);
83 public void execPROT(String prot) throws IOException {
84 ftpsClient.execPROT(prot);
88 public boolean retrieveFile(String remote, OutputStream local) throws IOException {
89 return ftpsClient.retrieveFile(remote, local);