alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
 * Microsystems, Inc. All Rights Reserved.
 */


package org.netbeans.modules.masterfs.providers;

import java.io.IOException;
import org.openide.filesystems.FileSystem;

/**
 * Enables to mount and unmount filesystems.
 * The only way, how to get instance of MountSupport is to implement
 * org.netbeans.modules.masterfs.providers.FileSystemProvider#initialize
 * and keep passed instance of MountSupport. So, there is important to know, that
 * only filesystems, that have registered implementation of FileSystemProvider can
 * be mounted. There is obvious, that only already mounted filesystems can be unmounted.
 *
 * @see org.netbeans.modules.masterfs.providers.FileSystemProvider#initialize
 * @author  rm111737
 */
final public class MountSupport {
    /**
     * Mounts a file system on mount point defined by parameter mountPoint.
     * Once mounted filesystem must be first unmounted, before other filesystem can
     * be mounted on the same mountPoint.
     *
     * @param mountPoint corresponds to java.io.File.getAbstractPath.
     * But be aware, that this doesn't mean, that such file must really exist.
     * MountPoint may also address virtual location.
     * @param fs filesystem that should be mounted. FileObject hierarchy within a delegate FileSystem
     *  must precisely match the File hierarchy and must not hide any files which exist on disk.
     * @throws java.io.IOException when mount fails e.g.: there already exists mounted filesystem
     * assigned to passed mount point.
     */
    public void mount(String mountPoint, FileSystem fs) throws IOException {
        delegate.mount (mountPoint, fs);
    }

    /**
     * Unmounts already mounted filesystem.
     * @param fs filesystem, taht should be unmounted
     * @throws java.io.IOException  when unmount fails e.g.: passed fs hasn't
     * been mounted yet.
     */
    public void  unmount(FileSystem fs) throws IOException {
        delegate.unmount (fs);
    }

    /**
     * Private constructor.
     * @see org.netbeans.modules.masterfs.providers.FileSystemProvider#initialize
     */
    private MountSupport (org.netbeans.modules.masterfs.InternalMountSupport delegate) {
        this.delegate = delegate;
    }
    

    private static final class APIAccessImpl extends org.netbeans.modules.masterfs.APIAccess {
        public MountSupport createMountSupport(org.netbeans.modules.masterfs.InternalMountSupport sup) {
            return new MountSupport (sup);
        }
    }

    static {
        org.netbeans.modules.masterfs.APIAccess.DEFAULT = new APIAccessImpl ();
    }

    private org.netbeans.modules.masterfs.InternalMountSupport delegate;

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.