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

DefaultAttributes (NetBeans File Systems API) - NetBeans API Javadoc 5.0.0

 

org.openide.filesystems
Class DefaultAttributes

java.lang.Object
  extended byorg.openide.filesystems.DefaultAttributes
All Implemented Interfaces:
AbstractFileSystem.Attr, AbstractFileSystem.List, Serializable

public class DefaultAttributes
extends Object
implements AbstractFileSystem.Attr, AbstractFileSystem.List

Implementation of AbstractFileSystem.Attr using a special file in each folder for holding attributes. It needs to hide the file from the rest of system, so it also implements AbstractFileSystem.List to exclude the file from the children list (it can then serve to filter a plain list implementation). Description of format of special file ilustrates best DTD file that is showed in next lines:

See Also:
Serialized Form

Field Summary
static String ATTR_EXT
          Deprecated. does not handle XML attributes
static String ATTR_NAME
          Deprecated. does not handle XML attributes
static String ATTR_NAME_EXT
          Deprecated. does not handle XML attributes
 
Constructor Summary
  DefaultAttributes(AbstractFileSystem.Info info, AbstractFileSystem.Change change, AbstractFileSystem.List list)
          Constructor.
protected DefaultAttributes(AbstractFileSystem.Info info, AbstractFileSystem.Change change, AbstractFileSystem.List list, String fileName)
          Constructor.
 
Method Summary
 Enumeration attributes(String name)
          Get all file attribute names for the file.
 String[] children(String f)
          Get the children list, filtering out the special attributes file.
 void deleteAttributes(String name)
          Called when a file is deleted, to also delete its attributes.
 Object readAttribute(String name, String attrName)
          Get the file attribute with the specified name.
 void renameAttributes(String oldName, String newName)
          Called when a file is renamed, to appropriately update its attributes.
 void writeAttribute(String name, String attrName, Object value)
          Set the file attribute with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_NAME

public static final String ATTR_NAME
Deprecated. does not handle XML attributes

File name of special file in each folder where attributes are saved.

See Also:
Constant Field Values

ATTR_EXT

public static final String ATTR_EXT
Deprecated. does not handle XML attributes

Extension of special file in each folder where attributes are saved.

See Also:
Constant Field Values

ATTR_NAME_EXT

public static final String ATTR_NAME_EXT
Deprecated. does not handle XML attributes

Name with extension of special file in each folder where attributes are saved.

See Also:
Constant Field Values
Constructor Detail

DefaultAttributes

public DefaultAttributes(AbstractFileSystem.Info info,
                         AbstractFileSystem.Change change,
                         AbstractFileSystem.List list)
Constructor.

Parameters:
info - file object information to use
change - file change hooks to use
list - list to filter (can be null, but then this object cannot work as a list)

DefaultAttributes

protected DefaultAttributes(AbstractFileSystem.Info info,
                            AbstractFileSystem.Change change,
                            AbstractFileSystem.List list,
                            String fileName)
Constructor.

Parameters:
info - file object information to use
change - file change hooks to use
list - list to filter (can be null, but then this object cannot work as a list)
fileName -
Since:
4.35
Method Detail

children

public String[] children(String f)
Get the children list, filtering out the special attributes file. You must have provided a non-null AbstractFileSystem.List in the constructor for this to work. If you did not, the rest of the class will work fine, but this method should not be called and this object should not be used as a List implementation.

Specified by:
children in interface AbstractFileSystem.List
Parameters:
f - the folder, by name; e.g. top/next/afterthat
Returns:
a list of children of the folder, as file.ext (no path)

readAttribute

public Object readAttribute(String name,
                            String attrName)
Description copied from interface: AbstractFileSystem.Attr
Get the file attribute with the specified name.

Specified by:
readAttribute in interface AbstractFileSystem.Attr
Parameters:
name - the file
attrName - name of the attribute
Returns:
appropriate (serializable) value or null if the attribute is unset (or could not be properly restored for some reason)

writeAttribute

public void writeAttribute(String name,
                           String attrName,
                           Object value)
                    throws IOException
Description copied from interface: AbstractFileSystem.Attr
Set the file attribute with the specified name.

Specified by:
writeAttribute in interface AbstractFileSystem.Attr
Parameters:
name - the file
attrName - name of the attribute
value - new value or null to clear the attribute. Must be serializable, although particular filesystems may or may not use serialization to store attribute values.
Throws:
IOException - if the attribute cannot be set. If serialization is used to store it, this may in fact be a subclass such as NotSerializableException.

attributes

public Enumeration attributes(String name)
Description copied from interface: AbstractFileSystem.Attr
Get all file attribute names for the file.

Specified by:
attributes in interface AbstractFileSystem.Attr
Parameters:
name - the file
Returns:
enumeration of keys (as strings)

renameAttributes

public void renameAttributes(String oldName,
                             String newName)
Description copied from interface: AbstractFileSystem.Attr
Called when a file is renamed, to appropriately update its attributes.

Specified by:
renameAttributes in interface AbstractFileSystem.Attr
Parameters:
oldName - old name of the file
newName - new name of the file

deleteAttributes

public void deleteAttributes(String name)
Description copied from interface: AbstractFileSystem.Attr
Called when a file is deleted, to also delete its attributes.

Specified by:
deleteAttributes in interface AbstractFileSystem.Attr
Parameters:
name - name of the file

 

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