2ccf1bab9dd6ae951ea3b32a15e603ff0a0a5a39
[dcaegen2/collectors/datafile.git] /
1 /*
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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========================================================================
17  */
18
19 package org.onap.dcaegen2.collectors.datafile.ftp;
20
21 import java.io.IOException;
22 import java.io.OutputStream;
23
24 import javax.net.ssl.KeyManager;
25 import javax.net.ssl.TrustManager;
26
27 import org.apache.commons.net.ftp.FTPSClient;
28
29 public class FTPSClientWrapper implements IFTPSClient {
30     private FTPSClient ftpsClient = new FTPSClient();
31
32     @Override
33     public void setNeedClientAuth(boolean isNeedClientAuth) {
34         ftpsClient.setNeedClientAuth(isNeedClientAuth);
35     }
36
37     @Override
38     public void setKeyManager(KeyManager keyManager) {
39         ftpsClient.setKeyManager(keyManager);
40     }
41
42     @Override
43     public void setTrustManager(TrustManager trustManager) {
44         ftpsClient.setTrustManager(trustManager);
45     }
46
47     @Override
48     public void connect(String hostName, int port) throws IOException {
49         ftpsClient.connect(hostName, port);
50     }
51
52     @Override
53     public boolean login(String username, String password) throws IOException {
54         return ftpsClient.login(username, password);
55     }
56
57     @Override
58     public boolean logout() throws IOException {
59         return ftpsClient.logout();
60     }
61
62     @Override
63     public int getReplyCode() {
64         return ftpsClient.getReplyCode();
65     }
66
67     @Override
68     public void disconnect() throws IOException {
69         ftpsClient.disconnect();
70     }
71
72     @Override
73     public void enterLocalPassiveMode() {
74         ftpsClient.enterLocalPassiveMode();
75     }
76
77     @Override
78     public void execPBSZ(int psbz) throws IOException {
79         ftpsClient.execPBSZ(psbz);
80     }
81
82     @Override
83     public void execPROT(String prot) throws IOException {
84         ftpsClient.execPROT(prot);
85     }
86
87     @Override
88     public boolean retrieveFile(String remote, OutputStream local) throws IOException {
89         return ftpsClient.retrieveFile(remote, local);
90     }
91
92     @Override
93     public void setTimeout(Integer t) {
94         this.ftpsClient.setDefaultTimeout(t);
95     }
96 }