KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > masterfs > providers > AutoMountProvider


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.masterfs.providers;
21
22 import java.awt.Image JavaDoc;
23 import java.beans.PropertyVetoException JavaDoc;
24 import java.io.IOException JavaDoc;
25 import org.openide.filesystems.FileSystem;
26
27 /**
28  * An object that implements AutoMountProvider is called from MasterFileSystem and can affect
29  * behaviour of MasterFileSystem. MasterFileSystem invokes individual AutoMountProviders to obtain
30  * instance of FileSystem for defined mount point (see {@link #createFileSystem}).
31  * If there exists at least one implementation of AutoMountProvider, which returns non null FileSystem,
32  * then such FileSystem is mounted into MasterFileSystem. This mechanism can be called <b>automatic mounting</b>.
33  *
34  * So, AutoMountProvide must implement logic where (which mount point) and what to mount
35  * (which FileSystem implementation) into MasterFileSystem.
36  *
37  * @see org.netbeans.modules.masterfs.providers.FileSystemProvider#initialize
38  * @see org.netbeans.modules.masterfs.providers.MountSupport
39  * @author rm111737
40  */

41 public abstract class AutoMountProvider {
42     /** Provides filesystem with root defined by mountPoint or return null.
43      * If method method isRootOfFileSystem returns false for the same mountPoint,
44      * then method createFileSystem must return null.
45      * And if method isRootOfFileSystem returns true, then method createFileSystem mustn't return null.
46      * @param mountPoint corresponds to java.io.File.getAbstractPath
47      * But be aware, that this doesn't mean, that such file must really exist.
48      * mountPoint may also address virtual location.
49      * @return instance of FileSystem or null. FileObject hierarchy within a delegate FileSystem
50      * must precisely match the File hierarchy and must not hide any files which exist on disk.
51      */

52     public abstract FileSystem createFileSystem (String JavaDoc mountPoint) throws IOException JavaDoc, PropertyVetoException JavaDoc ;
53
54     /**
55      * If method method isRootOfFileSystem returns false for the same mountPoint,
56      * then method createFileSystem must return null.
57      * And if method isRootOfFileSystem returns true, then method createFileSystem mustn't return null.
58      * @param mountPoint corresponds to java.io.File.getAbstractPath
59      * But be aware, that this doesn't mean, that such file must really exist.
60      * mountPoint may also address virtual location.
61      * @return true if mountPoint is expected to be root of FileSystem, that provides
62      * method {@link #createFileSystem}
63      */

64     public abstract boolean isRootOfFileSystem (String JavaDoc mountPoint);
65
66     /**
67      * Gets icon for filesystem with root defined by mountPoint or null. Null can be
68      * returned only if method isRootOfFileSystem returns false for the same mountPoint.
69      * @param mountPoint corresponds to java.io.File.getAbstractPath
70      * But be aware, that this doesn't mean, that such file must really exist.
71      * mountPoint may also address virtual location.
72      * @param iconType constant to indicate icon (@see BeanInfo)
73      * @return filesystem icon for filesystem with root defined by mountPoint or null
74      */

75     public Image JavaDoc getIcon (String JavaDoc mountPoint, int iconType) {
76         return null;
77     }
78
79 }
80
Popular Tags