nl.uva.vlet.vrs
Class MyVLe

java.lang.Object
  extended by nl.uva.vlet.vrs.VNode
      extended by nl.uva.vlet.vrs.VCompositeNode
          extended by nl.uva.vlet.vrs.MyVLe
All Implemented Interfaces:
VComposite, VEditable

public class MyVLe
extends VCompositeNode
implements VEditable

MyVLe is the toplevel object for all resources, like My Computer is on Windows. It's childs are configured locations and settings, etc.


Field Summary
static java.lang.String MYVLE_TYPE
           
 
Fields inherited from class nl.uva.vlet.vrs.VNode
ATTR_CHARSET, ATTR_HOSTNAME, ATTR_ICON, ATTR_ISVLINK, ATTR_LOCATION, ATTR_MIMETYPE, ATTR_NAME, ATTR_PATH, ATTR_PORT, ATTR_SCHEME, ATTR_TYPE, location, vrsContext
 
Method Summary
 LinkNode addNode(VNode sourceNode, java.lang.String optNewName, boolean isMove)
          Auto linkdrops node on this resource, returned node is alway of LinkNode type.
 VNode createChild(java.lang.String type, java.lang.String name, boolean force)
          VNode method to create new Child.
 boolean delete()
          Delete specified resource.
 boolean delete(boolean recurse)
          Recursive delete.
 boolean delNode(VNode node)
          VRS method to delete specified resource Node
 VAttribute getAttribute(java.lang.String name)
          This is the single method a Node has to implement so that attributes can be fetched.
 java.lang.String[] getAttributeNames()
          Get the names of the attributes this resource has
 VNode getChild(int nodeNr)
           
 VNode[] getChilds()
          Returns Child Nodes.
 VRL getHelp()
          Returns simple text file or complete HTML page.
 java.lang.String getName()
          Returns the short name of the resource.
The default is the basename of the resource or the last part of the path part in the URI.
 long getNrOfChilds()
          Returns number of child nodes.
 java.lang.String[] getResourceTypes()
          Returns allowed resource types which this node can have as child and/or create.
 java.lang.String getType()
          Returns resource type, if it has one
static VNode getVLeRoot(VRSContext vrsContext)
           
 java.io.File[] getWindowsDrives()
          Returns all root partitians on this system.
 boolean hasChild(java.lang.String name)
          Checks whether this node has a child with the specified name
 boolean isDeletable()
          returns true is the caller has the permissions to delete this resource The default implementation for a VFSNode is to check whether it is writable
 boolean isEditable()
          returns true is the caller has the permissions to edit this resource.
 boolean isVirtual()
          MyVle is 'virtual' it is not mapped to a 'real' resource, or an resource which has an implementation.
static VNode openLocation(VRSContext vrs, VRL location)
          Get "myvle:///" location.
 boolean setAttribute(VAttribute attr)
          Set single attribute.
 boolean setAttributes(VAttribute[] attrs)
          Sets a list of attributes
 
Methods inherited from class nl.uva.vlet.vrs.VCompositeNode
addNode, addNodes, delNodes, exists, getChild, getChildAttributes, getChildAttributes, getParents, isAccessable
 
Methods inherited from class nl.uva.vlet.vrs.VNode
compareTo, getAttributes, getAttributes, getAttributeSet, getBasename, getCharSet, getHostname, getIconURL, getID, getLocation, getMimeType, getParent, getPath, getPort, getScheme, getServerAttributes, getURI, getVRL, getVRSContext, isComposite, isVLink, mergedGetAttributes, setLocation, setVRL, toLinkNode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MYVLE_TYPE

public static final java.lang.String MYVLE_TYPE
See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Description copied from class: VNode
Returns the short name of the resource.
The default is the basename of the resource or the last part of the path part in the URI. To use another name, subclassses must overide this method.

Overrides:
getName in class VNode

getType

public java.lang.String getType()
Description copied from class: VNode
Returns resource type, if it has one

Specified by:
getType in class VNode

getHelp

public VRL getHelp()
Description copied from class: VNode
Returns simple text file or complete HTML page. Method should point to installed documentation. Default is to return help about this type.

Overrides:
getHelp in class VCompositeNode

getAttributeNames

public java.lang.String[] getAttributeNames()
Description copied from class: VNode
Get the names of the attributes this resource has

Overrides:
getAttributeNames in class VNode

getAttribute

public VAttribute getAttribute(java.lang.String name)
Description copied from class: VNode
This is the single method a Node has to implement so that attributes can be fetched. subclasses can override this method and do a super.getAttribute first to check whether the superclass provides an attribute name.

Overrides:
getAttribute in class VNode

setAttribute

public boolean setAttribute(VAttribute attr)
                     throws VlException
Description copied from interface: VEditable
Set single attribute. Return true if attribute was set.

Specified by:
setAttribute in interface VEditable
Throws:
VlException

delete

public boolean delete()
               throws VlException
Description copied from interface: VEditable
Delete specified resource.

Specified by:
delete in interface VEditable
Throws:
VlException

getResourceTypes

public java.lang.String[] getResourceTypes()
Description copied from interface: VComposite
Returns allowed resource types which this node can have as child and/or create.

Specified by:
getResourceTypes in interface VComposite

getNrOfChilds

public long getNrOfChilds()
                   throws VlException
Description copied from interface: VComposite
Returns number of child nodes.

Specified by:
getNrOfChilds in interface VComposite
Overrides:
getNrOfChilds in class VCompositeNode
Throws:
VlException

getChilds

public VNode[] getChilds()
                  throws VlException
Description copied from interface: VComposite
Returns Child Nodes.

Specified by:
getChilds in interface VComposite
Throws:
VlException

addNode

public LinkNode addNode(VNode sourceNode,
                        java.lang.String optNewName,
                        boolean isMove)
                 throws VlException
Auto linkdrops node on this resource, returned node is alway of LinkNode type. Will fail isMove==true to avoid deleting of the Dropped Node.

Specified by:
addNode in interface VComposite
Overrides:
addNode in class VCompositeNode
Returns:
new created VNode
Throws:
VlException

delNode

public boolean delNode(VNode node)
Description copied from interface: VComposite
VRS method to delete specified resource Node

Specified by:
delNode in interface VComposite
Overrides:
delNode in class VCompositeNode

createChild

public VNode createChild(java.lang.String type,
                         java.lang.String name,
                         boolean force)
                  throws VlException
Description copied from interface: VComposite
VNode method to create new Child.

Specified by:
createChild in interface VComposite
Overrides:
createChild in class VCompositeNode
Parameters:
type - must be on of the types getResourceTypes() returns.
name - may be null. The implementation might choose a default name or prompt the user.
force - means to create the child even if it already exists.
Throws:
VlException

delete

public boolean delete(boolean recurse)
               throws VlException
Description copied from interface: VComposite
Recursive delete. The parameter recurse is similiar to the 'rm -r' option.

Specified by:
delete in interface VComposite
Overrides:
delete in class VCompositeNode
Parameters:
recurse - whether to delete its children also.
Returns:
Returns true upon succes.
Throws:
VlException

hasChild

public boolean hasChild(java.lang.String name)
                 throws VlException
Description copied from interface: VComposite
Checks whether this node has a child with the specified name

Specified by:
hasChild in interface VComposite
Overrides:
hasChild in class VCompositeNode
Throws:
VlException

getVLeRoot

public static VNode getVLeRoot(VRSContext vrsContext)
                        throws VlException
Throws:
VlException

setAttributes

public boolean setAttributes(VAttribute[] attrs)
                      throws VlException
Description copied from interface: VEditable
Sets a list of attributes

Specified by:
setAttributes in interface VEditable
Throws:
VlException

isDeletable

public boolean isDeletable()
                    throws VlException
Description copied from interface: VEditable
returns true is the caller has the permissions to delete this resource The default implementation for a VFSNode is to check whether it is writable

Specified by:
isDeletable in interface VComposite
Specified by:
isDeletable in interface VEditable
Overrides:
isDeletable in class VCompositeNode
Throws:
VlException

isEditable

public boolean isEditable()
                   throws VlException
Description copied from interface: VEditable
returns true is the caller has the permissions to edit this resource. This means the setAttribute(s) method(s) are allowed. The default implementation for a VFSNode is to check whether it is writable

Specified by:
isEditable in interface VEditable
Throws:
VlException

openLocation

public static VNode openLocation(VRSContext vrs,
                                 VRL location)
                          throws VlException
Get "myvle:///" location. This since myvle hasn't got a VRS location factory

Throws:
VlException

getChild

public VNode getChild(int nodeNr)

getWindowsDrives

public java.io.File[] getWindowsDrives()
Returns all root partitians on this system. On Windows, this will be the A: through Z: drives.


isVirtual

public boolean isVirtual()
MyVle is 'virtual' it is not mapped to a 'real' resource, or an resource which has an implementation. It might be stored *inside* another (type of) resource. Like a LinkNode

Overrides:
isVirtual in class VNode