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


Java AbstractFileSystem类代码示例

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


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

示例1: MimeFileObject

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
protected MimeFileObject(final AbstractFileName name,
                        final Part part,
                        final AbstractFileSystem fileSystem) throws FileSystemException
{
    super(name, fileSystem);
    setPart(part);
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:8,代码来源:MimeFileObject.java

示例2: fireAllCreate

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
/**
 * Recursively fires create events for all children if recursive descent is
 * enabled. Otherwise the create event is only fired for the initial
 * FileObject.
 * @param child The child to add.
 */
private void fireAllCreate(FileObject child)
{
    // Add listener so that it can be triggered
    if (this.fm.getFileListener() != null)
    {
        child.getFileSystem().addListener(child, this.fm.getFileListener());
    }

    ((AbstractFileSystem) child.getFileSystem()).fireFileCreated(child);

    // Remove it because a listener is added in the queueAddFile
    if (this.fm.getFileListener() != null)
    {
        child.getFileSystem().removeListener(child,
            this.fm.getFileListener());
    }

    this.fm.queueAddFile(child); // Add

    try
    {

        if (this.fm.isRecursive())
        {
            if (child.getType().hasChildren())
            {
                FileObject[] newChildren = child.getChildren();
                for (int i = 0; i < newChildren.length; i++)
                {
                    fireAllCreate(newChildren[i]);
                }
            }
        }

    }
    catch (FileSystemException fse)
    {
        LOG.error(fse.getLocalizedMessage(), fse);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:47,代码来源:DefaultFileMonitor.java

示例3: check

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
private void check()
{
    this.refresh();

    try
    {
        // If the file existed and now doesn't
        if (this.exists && !this.file.exists())
        {
            this.exists = this.file.exists();
            this.timestamp = -1;

            // Fire delete event

            ((AbstractFileSystem)
                this.file.getFileSystem()).fireFileDeleted(this.file);

            // Remove listener in case file is re-created. Don't want to fire twice.
            if (this.fm.getFileListener() != null)
            {
                this.file.getFileSystem().removeListener(this.file,
                    this.fm.getFileListener());
            }

            // Remove from map
            this.fm.queueRemoveFile(this.file);
        }
        else if (this.exists && this.file.exists())
        {

            // Check the timestamp to see if it has been modified
            if (this.timestamp != this.file.getContent().getLastModifiedTime())
            {
                this.timestamp = this.file.getContent().getLastModifiedTime();
                // Fire change event

                // Don't fire if it's a folder because new file children
                // and deleted files in a folder have their own event triggered.
                if (!this.file.getType().hasChildren())
                {
                    ((AbstractFileSystem)
                        this.file.getFileSystem()).fireFileChanged(this.file);
                }
            }

        }
        else if (!this.exists && this.file.exists())
        {
            this.exists = this.file.exists();
            this.timestamp = this.file.getContent().getLastModifiedTime();
            // Don't fire if it's a folder because new file children
            // and deleted files in a folder have their own event triggered.
            if (!this.file.getType().hasChildren())
            {
                ((AbstractFileSystem)
                        this.file.getFileSystem()).fireFileCreated(this.file);
            }
        }

        this.checkForNewChildren();

    }
    catch (FileSystemException fse)
    {
        LOG.error(fse.getLocalizedMessage(), fse);
    }
}
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:68,代码来源:DefaultFileMonitor.java

示例4: runTest

import org.apache.commons.vfs2.provider.AbstractFileSystem; //导入依赖的package包/类
/**
     * Runs the test.  This implementation short-circuits the test if the
     * provider being tested does not have the capabilities required by this
     * test.
     *
     * @todo Handle negative caps as well - ie, only run a test if the provider does not have certain caps.
     * @todo Figure out how to remove the test from the TestResult if the test is skipped.
     */
    @Override
    protected void runTest() throws Throwable
    {
        // Check the capabilities
        final Capability[] caps = getRequiredCaps();
        if (caps != null)
        {
            for (int i = 0; i < caps.length; i++)
            {
                final Capability cap = caps[i];
                FileSystem fs = readFolder.getFileSystem();
                if (!fs.hasCapability(cap))
                {
//                    String name = fs.getClass().getName();
//                    int index = name.lastIndexOf('.');
//                    String fsName = (index > 0) ? name.substring(index + 1) : name;
//                    System.out.println("skipping " + getName() + " because " +
//                        fsName + " does not have capability " + cap);
                    return;
                }
            }
        }

        // Provider has all the capabilities - execute the test
        if (method != null)
        {
            try
            {
                method.invoke(this, (Object[]) null);
            }
            catch (final InvocationTargetException e)
            {
                throw e.getTargetException();
            }
        }
        else
        {
            super.runTest();
        }

        if (((AbstractFileSystem) readFolder.getFileSystem()).isOpen())
        {
            String name = "unknown";
            if (method != null)
            {
                name = method.getName();
            }

            throw new IllegalStateException(getClass().getName() + ": filesystem has open streams after: " + name);
        }
    }
 
开发者ID:wso2,项目名称:wso2-commons-vfs,代码行数:60,代码来源:AbstractProviderTestCase.java


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