Package org.apache.commons.vfs2

Examples of org.apache.commons.vfs2.FileSystemOptions


    {
        // Create the file system
        final URLFileName rootName = (URLFileName) name;

              String queryString = rootName.getQueryString();
        FileSystemOptions opts = fileSystemOptions;
        if (opts == null) {
            opts = new FileSystemOptions();
        }

        if (queryString != null) {
            FtpFileSystemConfigBuilder cfgBuilder = FtpFileSystemConfigBuilder.getInstance();
View Full Code Here


    public InputStream getInputStream(URL url) throws ConfigurationException
    {
        FileObject file;
        try
        {
            FileSystemOptions opts = getOptions(url.getProtocol());
            file = (opts == null) ? VFS.getManager().resolveFile(url.toString())
                    : VFS.getManager().resolveFile(url.toString(), opts);
            if (file.getType() != FileType.FILE)
            {
                throw new ConfigurationException("Cannot load a configuration from a directory");
View Full Code Here

    @Override
    public OutputStream getOutputStream(URL url) throws ConfigurationException
    {
        try
        {
            FileSystemOptions opts = getOptions(url.getProtocol());
            FileSystemManager fsManager = VFS.getManager();
            FileObject file = (opts == null) ? fsManager.resolveFile(url.toString())
                    : fsManager.resolveFile(url.toString(), opts);
            // throw an exception if the target URL is a directory
            if (file == null || file.getType() == FileType.FOLDER)
View Full Code Here

            FileObject file;
            // Only use the base path if the file name doesn't have a scheme.
            if (basePath != null && fileScheme == null)
            {
                String scheme = UriParser.extractScheme(basePath);
                FileSystemOptions opts = (scheme != null) ? getOptions(scheme) : null;
                FileObject base = (opts == null) ? fsManager.resolveFile(basePath)
                        : fsManager.resolveFile(basePath, opts);
                if (base.getType() == FileType.FILE)
                {
                    base = base.getParent();
                }

                file = fsManager.resolveFile(base, fileName);
            }
            else
            {
                FileSystemOptions opts = (fileScheme != null) ? getOptions(fileScheme) : null;
                file = (opts == null) ? fsManager.resolveFile(fileName)
                        : fsManager.resolveFile(fileName, opts);
            }

            if (!file.exists())
View Full Code Here

        }
    }

    private FileSystemOptions getOptions(String scheme)
    {
        FileSystemOptions opts = new FileSystemOptions();
        FileSystemConfigBuilder builder;
        try
        {
            builder = VFS.getManager().getFileSystemConfigBuilder(scheme);
        }
View Full Code Here

        {
            "/file1",
            "/file2",
        };

        FileSystemOptions opts = new FileSystemOptions();
        DelegatingFileSystemOptionsBuilder delgate = new DelegatingFileSystemOptionsBuilder(fsm);

        delgate.setConfigString(opts, "http", "proxyHost", "proxy");
        delgate.setConfigString(opts, "http", "proxyPort", "8080");
        delgate.setConfigClass(opts, "sftp", "userinfo", TrustEveryoneUserInfo.class);
View Full Code Here

        }
    }

    public void testDelegatingBad() throws Throwable
    {
        FileSystemOptions opts = new FileSystemOptions();
        DelegatingFileSystemOptionsBuilder delgate = new DelegatingFileSystemOptionsBuilder(fsm);

        try
        {
            delgate.setConfigString(opts, "http", "proxyPort", "wrong_port");
View Full Code Here

    @Override
    public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
    {
        final String uri = System.getProperty(TEST_URI);

        FileSystemOptions fileSystemOptions = new FileSystemOptions();
        SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fileSystemOptions, "no");
        SftpFileSystemConfigBuilder.getInstance().setUserInfo(fileSystemOptions, new TrustEveryoneUserInfo());

        return manager.resolveFile(uri, fileSystemOptions);
    }
View Full Code Here


        //FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions);

        String queryString = rootName.getQueryString();
        FileSystemOptions opts = fileSystemOptions;
        if (opts == null) {
            opts = new FileSystemOptions();
        }
        if (queryString != null) {
            FtpFileSystemConfigBuilder cfgBuilder = FtpFileSystemConfigBuilder.getInstance();
            StringTokenizer st = new StringTokenizer(queryString, "?&!=");
            while (st.hasMoreTokens()) {
View Full Code Here

        throws Exception
    {
        WebdavFileSystemConfigBuilder builder =
            (WebdavFileSystemConfigBuilder)manager.getFileSystemConfigBuilder("webdav");
        final String uri = System.getProperty(TEST_URI);
        FileSystemOptions opts = new FileSystemOptions();
        builder.setRootURI(opts, uri);
        return manager.resolveFile(uri, opts);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs2.FileSystemOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.