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 */
017package org.apache.commons.vfs2.provider.ftps;
018
019import org.apache.commons.vfs2.FileName;
020import org.apache.commons.vfs2.FileSystem;
021import org.apache.commons.vfs2.FileSystemConfigBuilder;
022import org.apache.commons.vfs2.FileSystemException;
023import org.apache.commons.vfs2.FileSystemOptions;
024import org.apache.commons.vfs2.provider.GenericFileName;
025import org.apache.commons.vfs2.provider.ftp.FtpFileProvider;
026
027/**
028 * A provider for FTP file systems.
029 *
030 * NOTE: Most of the heavy lifting for FTPS is done by the org.apache.commons.vfs2.provider.ftp package since they both
031 * use commons-net package
032 *
033 * @since 2.0
034 */
035public class FtpsFileProvider extends FtpFileProvider {
036    public FtpsFileProvider() {
037        super();
038    }
039
040    /**
041     * Creates the filesystem.
042     */
043    @Override
044    protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
045            throws FileSystemException {
046        // Create the file system
047        final GenericFileName rootName = (GenericFileName) name;
048
049        final FtpsClientWrapper ftpClient = new FtpsClientWrapper(rootName, fileSystemOptions);
050
051        return new FtpsFileSystem(rootName, ftpClient, fileSystemOptions);
052    }
053
054    @Override
055    public FileSystemConfigBuilder getConfigBuilder() {
056        return FtpsFileSystemConfigBuilder.getInstance();
057    }
058}