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

FileAttributeProvider (NetBeans VCS API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.modules.vcscore.turbo.local
Interface FileAttributeProvider


public interface FileAttributeProvider

SPI, extension point allowing third parties to redefine attribute reading and writing. Must be registered in default Lookup.

It must generally deternime that they support given FileObject and attribute pair and if so then perform action.

Two providers can theoreticaly clash and support the same attribute for the same fileobject. The key point is that attribute meaning must be precisely defined guaranteeing that two independent providers respond with exactly same value hence making irrelevant which one is actually choosen.

Providers are not required to cache results. Any speculative results (per folder batching) can be implemented using FileAttributeQuery.writeAttribute() ignoring this self-initiated write.


Nested Class Summary
static class FileAttributeProvider.MemoryCache
          Provides direct access to memory layer without delegating to providers layer.
 
Method Summary
 Object readAttribute(FileObject fo, String name, FileAttributeProvider.MemoryCache memoryCache)
          Reads given attribute for given fileobject.
 boolean recognizesAttribute(String name)
          Reports if an attribute is supported by the implementation.
 boolean recognizesFileObject(FileObject fo)
          Reports if the file object is supported by the implementation.
 boolean writeAttribute(FileObject fo, String name, Object value)
          Writes given attribute.
 

Method Detail

recognizesAttribute

public boolean recognizesAttribute(String name)
Reports if an attribute is supported by the implementation.


recognizesFileObject

public boolean recognizesFileObject(FileObject fo)
Reports if the file object is supported by the implementation.


readAttribute

public Object readAttribute(FileObject fo,
                            String name,
                            FileAttributeProvider.MemoryCache memoryCache)
Reads given attribute for given fileobject. No method parameter may be referenced after method execution finishes.

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

writeAttribute

public boolean writeAttribute(FileObject fo,
                              String name,
                              Object value)
Writes given attribute. No method parameter may be referenced after method execution finishes.

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

 

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