当前位置: 首页>>代码示例>>Java>>正文


Java FileSystemException类代码示例

本文整理汇总了Java中org.apache.commons.vfs2.FileSystemException的典型用法代码示例。如果您正苦于以下问题:Java FileSystemException类的具体用法?Java FileSystemException怎么用?Java FileSystemException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileSystemException类属于org.apache.commons.vfs2包,在下文中一共展示了FileSystemException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configurePlugins

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Scans the classpath to find any droped plugin.<br />
 * The plugin-description has to be in /META-INF/vfs-providers.xml
 * 
 * @throws FileSystemException
 *             if an error occurs.
 */
protected void configurePlugins() throws FileSystemException
{
	ClassLoader cl = findClassLoader();

	Enumeration<URL> enumResources;
	try
	{
		enumResources = cl.getResources(PLUGIN_CONFIG_RESOURCE);
	}
	catch (IOException e)
	{
		throw new FileSystemException(e);
	}

	while (enumResources.hasMoreElements())
	{
		URL url = enumResources.nextElement();
		configure(url);
	}
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:28,代码来源:StandardFileSystemManager.java

示例2: configure

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Configures this manager from an XML configuration file.
 * 
 * @param configUri
 *            The URI of the configuration.
 * @param configStream
 *            An InputStream containing the configuration.
 * @throws FileSystemException
 *             if an error occurs.
 */
@SuppressWarnings("unused")
private void configure(final String configUri,
		final InputStream configStream) throws FileSystemException
{
	try
	{
		// Load up the config
		// TODO - validate
		final DocumentBuilder builder = createDocumentBuilder();
		final Element config = builder.parse(configStream)
				.getDocumentElement();

		configure(config);

	}
	catch (final Exception e)
	{
		throw new FileSystemException("vfs.impl/load-config.error",
				configUri, e);
	}
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:32,代码来源:StandardFileSystemManager.java

示例3: addOperationProvider

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Adds a operationProvider from a operationProvider definition.
 */
private void addOperationProvider(final Element providerDef)
		throws FileSystemException
{
	final String classname = providerDef.getAttribute("class-name");

	// Attach only to available schemas
	final String[] schemas = getSchemas(providerDef);
	for (int i = 0; i < schemas.length; i++)
	{
		final String schema = schemas[i];
		if (hasProvider(schema))
		{
			final FileOperationProvider operationProvider = (FileOperationProvider) createInstance(classname);
			addOperationProvider(schema, operationProvider);
		}
	}
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:21,代码来源:StandardFileSystemManager.java

示例4: checkScript

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
private void checkScript()
{
	long lastModified;
	try
	{
		lastModified = VFSUtils.resolveFile(".", _scriptFile).getContent()
				.getLastModifiedTime();
	}
	catch (FileSystemException e)
	{
		throw new IllegalArgumentException("Cannot find script "
				+ _scriptFile + " ex=" + e.getMessage());
	}
	if (_lastModified == lastModified)
		return;
	else
	{
		_lastModified = lastModified;
		_script = ScriptFactory.createScript(_scriptFile, _counterString,
				null, _args, _log, 0, null, false, 0, 1);
		if (_script == null)
			throw new IllegalArgumentException("Cannot find script "
					+ _scriptFile);
	}
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:26,代码来源:ScriptCounter.java

示例5: getConfiguration

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
public Configuration getConfiguration()
{
	if (_config == null)
	{
		Map utils = new HashMap();
		utils.put("util", new Utils(this));
		try
		{
			VFSUtils.init();
		}
		catch (FileSystemException e)
		{
			e.printStackTrace();
		}

		_config = new YajswConfigurationImpl(_localConfiguration,
				_useSystemProperties, utils);
	}
	return _config;
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:21,代码来源:AbstractWrappedProcess.java

示例6: fileExists

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
private boolean fileExists(String file)
{
	try
	{
		// this hack is no longer required, changed VFS to init without
		// providers.xm.
		// String current =
		// System.getProperty("javax.xml.parsers.DocumentBuilderFactory");
		// System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
		// "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
		DefaultFileSystemManager fsManager = (DefaultFileSystemManager) VFS
				.getManager();
		// if (current != null)
		// System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
		// current);
		// else
		// System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
		FileObject f = VFSUtils.resolveFile(".", file);
		return f.exists();
	}
	catch (FileSystemException e)
	{
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:27,代码来源:YajswConfigurationImpl.java

示例7: findMaxID

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Recursively searches for the highest ID, which is the greatest slot file
 * name currently used in the store.
 * 
 * @param dir
 *            the directory to search
 * @param depth
 *            the subdirectory depth level of the dir
 * @return the highest slot file name / ID currently stored
 */
private String findMaxID(final FileObject dir, final int depth) throws FileSystemException {
    final FileObject[] children = dir.getChildren();

    if (children.length == 0) {
        return null;
    }

    Arrays.sort(children, new MCRFileObjectComparator());

    if (depth == slotLength.length) {
        return children[children.length - 1].getName().getBaseName();
    }

    for (int i = children.length - 1; i >= 0; i--) {
        final FileObject child = children[i];
        if (!child.getType().hasChildren()) {
            continue;
        }
        final String found = findMaxID(child, depth + 1);
        if (found != null) {
            return found;
        }
    }
    return null;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:36,代码来源:MCRStore.java

示例8: WatchFTPRunner

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
public WatchFTPRunner(FTPConfig config) {
    this.config = config;
    try { 
        fsManager = VFS.getManager();
       
        UserAuthenticator auth = new StaticUserAuthenticator("", config.getConnection().getUsername(), config.getConnection().getPassword()); 
        DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth); 
        FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts,true);
        FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true);
       
        resolvedAbsPath = fsManager.resolveFile(config.getFolder() + config.getConnection().getPathtomonitor() , opts);
        
        log.info("Connection successfully established to " +  resolvedAbsPath.getPublicURIString());        
        log.debug("Exists: " + resolvedAbsPath.exists());
        log.debug("Type  : " + resolvedAbsPath.getType());       
    } catch (FileSystemException e) {
        log.error("File system exception for " + config.getFolder(), e);
        //throw here?
    }
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:21,代码来源:WatchFTPRunner.java

示例9: createDefaultFileSystemOptions

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
protected FileSystemOptions createDefaultFileSystemOptions() throws FileSystemException {
	
    FileSystemOptions opts = new FileSystemOptions();
    
    // SSH Key checking
    SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no");
    
    // VFS file system root:
    // setting this parameter false = cause VFS to choose File System's Root as VFS's root
    // setting this parameter true = cause VFS to choose user's home directory as VFS's root
    SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true);
    
    // Timeout is count by Milliseconds
    SftpFileSystemConfigBuilder.getInstance().setTimeout(opts, 20000);
    
    return opts;
}
 
开发者ID:cycronix,项目名称:cloudturbine,代码行数:18,代码来源:FilePumpWorker.java

示例10: getUriWithoutAuth

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Construct the path suitable for NfsFile when used with NtlmPasswordAuthentication.
 *
 * @return caches and return URI with no username/password, never null
 * @throws FileSystemException if any of the invoked methods throw
 */
public String getUriWithoutAuth() throws FileSystemException
{
    if (uriWithoutAuth != null)
    {
        return uriWithoutAuth;
    }

    final StringBuilder sb = new StringBuilder(120);
    sb.append(getScheme());
    sb.append("://");
    sb.append(getHostName());
    if (getPort() != DEFAULT_PORT)
    {
        sb.append(":");
        sb.append(getPort());
    }
    sb.append(getPathDecoded());
    uriWithoutAuth = sb.toString();
    return uriWithoutAuth;
}
 
开发者ID:danniss,项目名称:common-vfs2-nfs,代码行数:27,代码来源:NfsFileName.java

示例11: doGetType

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Determines the type of the file, returns null if the file does not
 * exist.
 */
@Override
protected FileType doGetType() throws Exception
{
    if (!file.exists())
    {
        return FileType.IMAGINARY;
    }
    else if (file.isDirectory())
    {
        return FileType.FOLDER;
    }
    else if (file.isFile())
    {
        return FileType.FILE;
    }

    throw new FileSystemException("vfs.provider.Nfs/get-type.error", getName());
}
 
开发者ID:danniss,项目名称:common-vfs2-nfs,代码行数:23,代码来源:NfsFileObject.java

示例12: createClient

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Creates the client.
 * 
 * @return the grid ftp client
 * 
 * @throws FileSystemException the file system exception
 */
protected GridFTPClient createClient() throws FileSystemException {
    final GenericFileName rootName = getRoot();

    UserAuthenticationData authData = null;
    try {
        authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, GsiFtpFileProvider.AUTHENTICATOR_TYPES);

        String username = UserAuthenticatorUtils
                .getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName())).toString();
        String password = UserAuthenticatorUtils
                .getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword())).toString();
        return GsiFtpClientFactory.createConnection(rootName.getHostName(), rootName.getPort(), username, password, getFileSystemOptions());
    } finally {
        UserAuthenticatorUtils.cleanup(authData);
    }
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:24,代码来源:GridFTPClientWrapper.java

示例13: doGetType

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Determines the type of the file, returns null if the file does not exist.
 * 
 * @return the file type
 * 
 * @throws Exception the exception
 */
@Override
protected FileType doGetType() throws Exception {
    // log.debug("relative path:" + relPath);

    if (this.fileInfo == null) {
        return FileType.IMAGINARY;
    } else if (this.fileInfo.isDirectory()) {
        return FileType.FOLDER;
    } else if (this.fileInfo.isFile()) {
        return FileType.FILE;
    } else if (this.fileInfo.isSoftLink()) {
        return FileType.FILE; // getLinkDestination().getType();
    }

    throw new FileSystemException("vfs.provider.gsiftp/get-type.error", getName());
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:24,代码来源:GsiFtpFileObject.java

示例14: doRename

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Renames the file.
 * 
 * @param newfile the newfile
 * 
 * @throws Exception the exception
 */
@Override
protected void doRename(FileObject newfile) throws Exception {
    boolean ok = true;
    final GridFTPClient ftpClient = ftpFs.getClient();
    try {
        String oldName = getName().getPath();
        String newName = newfile.getName().getPath();
        ftpClient.rename(oldName, newName);
    } catch (IOException ioe) {
        ok = false;
    } catch (ServerException e) {
        ok = false;
    } finally {
        ftpFs.putClient(ftpClient);
    }

    if (!ok) {
        throw new FileSystemException("vfs.provider.gsiftp/rename-file.error", new Object[] { getName().toString(), newfile });
    }
    this.fileInfo = null;
    children = EMPTY_FTP_FILE_MAP;
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:30,代码来源:GsiFtpFileObject.java

示例15: doCreateFolder

import org.apache.commons.vfs2.FileSystemException; //导入依赖的package包/类
/**
 * Creates this file as a folder.
 * 
 * @throws Exception the exception
 */
@Override
protected void doCreateFolder() throws Exception {
    boolean ok = true;
    final GridFTPClient client = ftpFs.getClient();
    try {
        client.makeDir(getName().getPath());
    } catch (IOException ioe) {
        ok = false;
    } catch (ServerException se) {
        ok = false;
    } finally {
        ftpFs.putClient(client);
    }

    if (!ok) {
        throw new FileSystemException("vfs.provider.gsiftp/create-folder.error", getName());
    }
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:24,代码来源:GsiFtpFileObject.java


注:本文中的org.apache.commons.vfs2.FileSystemException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。