站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

FileAttributeQuery (NetBeans VCS API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.modules.vcscore.turbo.local
Class FileAttributeQuery

java.lang.Object
  extended byorg.netbeans.modules.vcscore.turbo.local.FileAttributeQuery

public final class FileAttributeQuery
extends Object

Extensible support for file attributes. It delegates to registered FileAttributeProviders and if no one matches it uses default attribute database.


Method Summary
 void addFileAttributeListener(FileAttributeListener l)
           
protected  void fireAttributeChange(FileObject fo, String name, Object value)
           
static FileAttributeQuery getDefault()
          Returns default instance.
 boolean isPrepared(FileObject fo, String name)
          Checks attribute instant availability.
 boolean prepareAttribute(FileObject fo, String name)
          Checks attribute instant availability and schedules its loading.
 Object readAttribute(FileObject fo, String name)
          Reads given attribute for given fileobject.
 void removeFileAttributeListener(FileAttributeListener l)
           
 String toString()
           
 boolean writeAttribute(FileObject fo, String name, Object value)
          Writes given attribute and notifies all listeners.
 void writeAttribute(File file, String id, Object value)
          Deprecated. Internal contract: it allows the VCSFS to address FileObject prenatal situations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getDefault

public static FileAttributeQuery getDefault()
Returns default instance.


readAttribute

public Object readAttribute(FileObject fo,
                            String name)
Reads given attribute for given fileobject.

Parameters:
fo - identifies source FileObject, never null
name - identifies requested attribute, never null
Returns:
attribute value or null if it does not exist.

writeAttribute

public boolean writeAttribute(FileObject fo,
                              String name,
                              Object value)
Writes given attribute and notifies all listeners.

A client calling this method is reponsible for passing valid attribute value that is accepted by providers. It's not an issue in typical case when the caller is often the provider itself. In other cases the caller must be provider friend and it should be assured by invoking this method using following code snippet:

    boolean success = faq.writeAttribute(fo, name, value);
    assert success : "Unexpected attribute[" + name + "] value[" + value + "] denial for " + fo + "!";
 

Parameters:
fo - identifies target file object, never null
name - identifies attribute, never null
value - actual attribute value that should be stored, null behaviour is defined specificaly for each attribute, commonly it invalidates the value
Returns:
false on write failure if provider denies the value. On I/O error it returns true.

writeAttribute

public void writeAttribute(File file,
                           String id,
                           Object value)
Deprecated. Internal contract: it allows the VCSFS to address FileObject prenatal situations.

Explicit support for FS.createData & FS.createFolder. It adds speculative entry into memory layer.


prepareAttribute

public boolean prepareAttribute(FileObject fo,
                                String name)
Checks attribute instant availability and schedules its loading.

Returns:
false if not ready and providers must be consulted. It'll fire event on completion if attribute exists. If true it's ready and stays ready until fo reference released.

isPrepared

public boolean isPrepared(FileObject fo,
                          String name)
Checks attribute instant availability. Note that attribute value may be still null.

Returns:
false if not yet computed.

addFileAttributeListener

public void addFileAttributeListener(FileAttributeListener l)

removeFileAttributeListener

public void removeFileAttributeListener(FileAttributeListener l)

fireAttributeChange

protected void fireAttributeChange(FileObject fo,
                                   String name,
                                   Object value)

toString

public String toString()

 

Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.