4b7cc01a54131da82e2186be60a2aefab6e04ea7
[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"); you may not use this file except
6  * in compliance with the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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
13  * the License.
14  * ============LICENSE_END========================================================================
15  */
16
17 package org.onap.dcaegen2.collectors.datafile.ftp;
18
19 import java.io.IOException;
20 import java.io.OutputStream;
21
22 import javax.net.ssl.KeyManager;
23 import javax.net.ssl.TrustManager;
24
25 import org.apache.commons.net.ftp.FTPSClient;
26
27 public class FTPSClientWrapper implements IFTPSClient {
28     private FTPSClient ftpsClient = new FTPSClient();
29
30     @Override
31     public void setNeedClientAuth(boolean isNeedClientAuth) {
32         ftpsClient.setNeedClientAuth(isNeedClientAuth);
33     }
34
35     @Override
36     public void setKeyManager(KeyManager keyManager) {
37         ftpsClient.setKeyManager(keyManager);
38     }
39
40     @Override
41     public void setTrustManager(TrustManager trustManager) {
42         ftpsClient.setTrustManager(trustManager);
43     }
44
45     @Override
46     public void connect(String hostName, int port) throws IOException {
47         ftpsClient.connect(hostName, port);
48     }
49
50     @Override
51     public boolean login(String username, String password) throws IOException {
52         return ftpsClient.login(username, password);
53     }
54
55     @Override
56     public boolean logout() throws IOException {
57         return ftpsClient.logout();
58     }
59
60     @Override
61     public int getReplyCode() {
62         return ftpsClient.getReplyCode();
63     }
64
65     @Override
66     public void disconnect() throws IOException {
67         ftpsClient.disconnect();
68     }
69
70     @Override
71     public void enterLocalPassiveMode() {
72         ftpsClient.enterLocalPassiveMode();
73     }
74
75     @Override
76     public void setFileType(int fileType) throws IOException {
77         ftpsClient.setFileType(fileType);
78     }
79
80     @Override
81     public void execPBSZ(int psbz) throws IOException {
82         ftpsClient.execPBSZ(psbz);
83     }
84
85     @Override
86     public void execPROT(String prot) throws IOException {
87         ftpsClient.execPROT(prot);
88     }
89
90     @Override
91     public boolean retrieveFile(String remote, OutputStream local) throws IOException {
92         return ftpsClient.retrieveFile(remote, local);
93     }
94
95     @Override
96     public void setTimeout(Integer t) {
97         this.ftpsClient.setDefaultTimeout(t);
98     }
99
100     @Override
101     public boolean isConnected() {
102         return ftpsClient.isConnected();
103     }
104
105     @Override
106     public void setBufferSize(int bufSize) {
107         ftpsClient.setBufferSize(bufSize);
108     }
109 }