001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.camel.component.file.remote;
018    
019    import java.net.URI;
020    
021    /**
022     * Secure FTP configuration
023     */
024    public class SftpConfiguration extends RemoteFileConfiguration {
025    
026        public static final int DEFAULT_SFTP_PORT = 22;
027        private String knownHostsFile;
028        private String privateKeyFile;
029        private String privateKeyFilePassphrase;
030        private String strictHostKeyChecking = "no";
031        private int serverAliveInterval;
032        private int serverAliveCountMax = 1;
033        private String chmod;
034        // comma separated list of ciphers. 
035        // null means default jsch list will be used
036        private String ciphers;
037        private int compression;
038    
039        public SftpConfiguration() {
040            setProtocol("sftp");
041        }
042    
043        public SftpConfiguration(URI uri) {
044            super(uri);
045        }
046    
047        @Override
048        protected void setDefaultPort() {
049            setPort(DEFAULT_SFTP_PORT);
050        }
051    
052        public String getKnownHostsFile() {
053            return knownHostsFile;
054        }
055    
056        public void setKnownHostsFile(String knownHostsFile) {
057            this.knownHostsFile = knownHostsFile;
058        }
059    
060        public String getPrivateKeyFile() {
061            return privateKeyFile;
062        }
063    
064        public void setPrivateKeyFile(String privateKeyFile) {
065            this.privateKeyFile = privateKeyFile;
066        }
067    
068        public String getPrivateKeyFilePassphrase() {
069            return privateKeyFilePassphrase;
070        }
071    
072        public void setPrivateKeyFilePassphrase(String privateKeyFilePassphrase) {
073            this.privateKeyFilePassphrase = privateKeyFilePassphrase;
074        }
075    
076        public String getStrictHostKeyChecking() {
077            return strictHostKeyChecking;
078        }
079    
080        public void setStrictHostKeyChecking(String strictHostKeyChecking) {
081            this.strictHostKeyChecking = strictHostKeyChecking;
082        }
083    
084        public void setServerAliveInterval(int serverAliveInterval) {
085            this.serverAliveInterval = serverAliveInterval;
086        }
087    
088        public int getServerAliveInterval() {
089            return serverAliveInterval;
090        }
091    
092        public void setServerAliveCountMax(int serverAliveCountMax) {
093            this.serverAliveCountMax = serverAliveCountMax;
094        }
095    
096        public int getServerAliveCountMax() {
097            return serverAliveCountMax;
098        }
099    
100        public void setChmod(String chmod) {
101            this.chmod = chmod;
102        }
103    
104        public String getChmod() {
105            return chmod;
106        }
107    
108        public void setCiphers(String ciphers) {
109            this.ciphers = ciphers;
110        }
111    
112        public String getCiphers() {
113            return ciphers;
114        }
115    
116        public int getCompression() {
117            return compression;
118        }
119    
120        public void setCompression(int compression) {
121            this.compression = compression;
122        }
123    }