org.openide.filesystems
Class XMLFileSystem

java.lang.Object
  |
  +--org.openide.filesystems.FileSystem
        |
        +--org.openide.filesystems.AbstractFileSystem
              |
              +--org.openide.filesystems.XMLFileSystem
All Implemented Interfaces:
Serializable

public final class XMLFileSystem
extends AbstractFileSystem

XML-based file system.

  Description of format of XML file (which can be parsed by XMLFileSystem)
 ==================================================================
 Allowed Elements:	filesystem,file,folder,attr

 Mandatory attributes:	
         -for filesystem    version=... (e.g. "1.0")
         -for file,folder,attr name=....  (e.g.: <folder name="Config">)
         -for attr is mandatory one of bytevalue,shortvalue,intvalue,longvalue,floatvalue,doublevalue,boolvalue,charvalue,stringvalue,methodvalue,serialvalue,urlvalue
 
 Allowed atributes:
         -for file:	url=.... (e.g.: <file name="sample.xml" url="file:/c:\sample.xml">)
 	-for folder,filesystem	nothing allowed



 Note: file can contain 	content e.g.:
  < file name="sample.java">
 < ![CDATA[
 package org.sample;
 import java.io;
 ]]>
 < /file>



 This class implements virtual FileSystem. It is special case of FileSystem in XML format.

 Description of this format best ilustrate DTD file that is showed in next lines: 
 < !ELEMENT filesystem (file | folder)*>
 < !ATTLIST filesystem version CDATA #REQUIRED> //version not checkked yet
 < !ELEMENT folder (file |folder | attr)*>
 < !ATTLIST folder name CDATA #REQUIRED> //name of folder
 < !ELEMENT file (#PCDATA | attr)*>
 < !ATTLIST file name CDATA #REQUIRED> //name of file
 < !ATTLIST file url CDATA #IMPLIED> //content of the file can be find at url
 < !ELEMENT attr EMPTY>
 < !ATTLIST attr name CDATA #REQUIRED> //name of attribute
 < !ATTLIST attr bytevalue CDATA #IMPLIED>//the rest - types of attributes
 < !ATTLIST attr shortvalue CDATA #IMPLIED>
 < !ATTLIST attr intvalue CDATA #IMPLIED>
 < !ATTLIST attribute longvalue CDATA #IMPLIED>
 < !ATTLIST attr floatvalue CDATA #IMPLIED>
 < !ATTLIST attr doublevalue CDATA #IMPLIED>
 < !ATTLIST attr boolvalue CDATA #IMPLIED>
 < !ATTLIST attr charvalue CDATA #IMPLIED>
 < !ATTLIST attr stringvalue CDATA #IMPLIED>
 < !ATTLIST attr methodvalue CDATA #IMPLIED>
 < !ATTLIST attr serialvalue CDATA #IMPLIED>
 < !ATTLIST attr urlvalue CDATA #IMPLIED>
 

See Also:
Serialized Form

Inner Class Summary
static class XMLFileSystem.Impl
          Implementation of all interfaces List, Change, Info and Attr that delegates to JarFileSystem
 
Inner classes inherited from class org.openide.filesystems.AbstractFileSystem
AbstractFileSystem.Attr, AbstractFileSystem.Change, AbstractFileSystem.Info, AbstractFileSystem.List, AbstractFileSystem.Transfer
 
Inner classes inherited from class org.openide.filesystems.FileSystem
FileSystem.AtomicAction, FileSystem.Environment, FileSystem.Status
 
Fields inherited from class org.openide.filesystems.AbstractFileSystem
attr, change, info, list, transfer
 
Fields inherited from class org.openide.filesystems.FileSystem
PROP_HIDDEN, PROP_READ_ONLY, PROP_ROOT, PROP_SYSTEM_NAME, PROP_VALID
 
Constructor Summary
XMLFileSystem()
          Creates new XMLFileSystem
XMLFileSystem(FileSystemCapability cap)
          Constructor.
XMLFileSystem(String uri)
           
XMLFileSystem(URL url)
           
 
Method Summary
 void addNotify()
          Notifies this file system that it has been added to the repository.
protected  Reference createReference(FileObject fo)
          Creates Reference.
 String getDisplayName()
          Provides a name for the system that can be presented to the user.
 URL getXmlUrl()
          Getter of url field.
 boolean isReadOnly()
          Test if the filesystem is read-only or not.
 void removeNotify()
          Notifies this file system that it has been removed from the repository.
 void setXmlUrl(URL url)
          Setter of url field.
 void setXmlUrl(URL url, boolean validate)
          Setter of url field.
 
Methods inherited from class org.openide.filesystems.AbstractFileSystem
existingFileObjects, find, findReference, findResource, getActions, getRefreshTime, getRoot, refreshResource, refreshRoot, setRefreshTime
 
Methods inherited from class org.openide.filesystems.FileSystem
addFileStatusListener, addPropertyChangeListener, addVetoableChangeListener, fireFileStatusChanged, firePropertyChange, fireVetoableChange, getActions, getCapability, getStatus, getSystemName, isDefault, isHidden, isPersistent, isValid, prepareEnvironment, removeFileStatusListener, removePropertyChangeListener, removeVetoableChangeListener, runAtomicAction, setCapability, setHidden, setSystemName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLFileSystem

public XMLFileSystem()
Creates new XMLFileSystem

XMLFileSystem

public XMLFileSystem(String uri)
              throws org.xml.sax.SAXException

XMLFileSystem

public XMLFileSystem(URL url)
              throws org.xml.sax.SAXException

XMLFileSystem

public XMLFileSystem(FileSystemCapability cap)
Constructor. Allows user to provide own capabilities for this file system.
Parameters:
cap - capabilities for this file system
Method Detail

getXmlUrl

public URL getXmlUrl()
Getter of url field.

setXmlUrl

public void setXmlUrl(URL url)
               throws IOException,
                      PropertyVetoException
Setter of url field. Set name of the XML file.
Parameters:
aRoot - path to new ZIP or JAR file
Throws:
IOException - if the file is not valid

setXmlUrl

public void setXmlUrl(URL url,
                      boolean validate)
               throws IOException,
                      PropertyVetoException
Setter of url field. Set name of the XML file.
Parameters:
aRoot - path to new ZIP or JAR file
validate - if true uses validating parser else nonvalidating
Throws:
IOException - if the file is not valid

getDisplayName

public String getDisplayName()
Description copied from class: FileSystem
Provides a name for the system that can be presented to the user.
Overrides:
getDisplayName in class AbstractFileSystem
Following copied from class: org.openide.filesystems.FileSystem
Returns:
user presentable name of the file system

isReadOnly

public boolean isReadOnly()
Test if the filesystem is read-only or not.
Overrides:
isReadOnly in class FileSystem
Returns:
true if the system is read-only

addNotify

public void addNotify()
Notifies this file system that it has been added to the repository. Various initialization tasks should go here. Default implementation is noop.
Overrides:
addNotify in class FileSystem

removeNotify

public void removeNotify()
Notifies this file system that it has been removed from the repository. Concrete file system implementations should perform clean-up here. Default implementation is noop.
Overrides:
removeNotify in class FileSystem

createReference

protected Reference createReference(FileObject fo)
Creates Reference. In FileSystem, which subclasses AbstractFileSystem, you can overload method createReference(FileObject fo) to achieve another type of Reference (weak, strong etc.)
Overrides:
createReference in class AbstractFileSystem
Parameters:
fo - is FileObject. It`s reference yourequire to get.
Returns:
Reference to FileObject


Built on February 22 2001.  |  Portions Copyright 1997-2000 Sun Microsystems, Inc. All rights reserved.