nl.uva.vlet.vrs
Class LinkNode

java.lang.Object
  extended by nl.uva.vlet.vrs.VNode
      extended by nl.uva.vlet.vrs.ResourceNode
          extended by nl.uva.vlet.vrs.LinkNode
All Implemented Interfaces:
java.lang.Cloneable, VEditable, VRenamable, VStreamReadable

public class LinkNode
extends ResourceNode

The LinkNode class which represents a link or a remote resource. This class is NOT intended as a unix softlink (very bug prone), but more as a windows shortcut object !
At the VRS/VFS level a 'saved' LinkNode appears as .vlink file and will be regarded as a file.
The GUI can both handle a '.vlink' file AND the LinkNode object. In the latter case the .vlink file has been 'loaded' and is of type 'Link'. This object has custom settings which can overide (default) VRS/VFS methods. Current implementation is to store a LinkNode as a java properties file.


Field Summary
 
Fields inherited from class nl.uva.vlet.vrs.ResourceNode
ATTR_LINK_IS_COMPOSITE, ATTR_LINK_MIMETYPE, default_show_shortcut_icon, guiAttributeNames, parent, resourceAttributes, SERVER_ATTRIBUTES, serverAttributeNames, storageLocation, type, urlAttributeNames
 
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
 
Constructor Summary
protected LinkNode(VRSContext context)
          Private constructor
 
Method Summary
 LinkNode clone()
           
static LinkNode createLinkNode(VRSContext context, VRL logicalLocation, VRL targetVRL)
          Creates new LinkNode object with logical location and specified linkTarget.
static LinkNode createLinkNode(VRSContext context, VRL logicalLocation, VRL targetVRL, boolean resolve)
           
static LinkNode createLinkTo(VRL parentLoc, java.lang.String name, VNode target)
          Main method to create a new LinkNode stored in parentLoc with name 'name' and with linkTarget the specified VNode target
 LinkNode duplicate()
           
 VRL getLinkTarget()
           
 java.lang.String getType()
          Returns resource type, if it has one
 boolean isVLink()
          Returns true if the EXTENSION equals '.vlink', this node might not be of type LinkNode.
static LinkNode loadFrom(VRSContext context, VNode vnode)
          Resolves a (stored) LinkNode.
static LinkNode loadFrom(VRSContext context, VRL loc)
          Load ResourceNode but return as LinkNode !
 void saveAtLocation(VComposite parent, java.lang.String newName)
          Store Link node
 void setLinkTarget(VRL linkTarget)
           
 
Methods inherited from class nl.uva.vlet.vrs.ResourceNode
_loadFrom, _loadFrom, checkAndStoreNewServerInfo, copyFrom, delete, exists, getAttribute, getAttributeNames, getIconURL, getImplementation, getInputStream, getName, getParent, getServerInfo, getShowShortCutIcon, getTargetHostname, getTargetIsComposite, getTargetMimeType, getTargetPath, getTargetPort, getTargetScheme, getTargetType, getTargetUserInfo, getTargetUsername, getTargetVRL, init, initAttributes, isDeletable, isEditable, isRenamable, isServerType, isVirtual, renameTo, save, setAttribute, setAttribute, setAttributes, setAttributes, setIconURL, setName, setResourceVRL, setServerAttributeNames, setServerAttributes, setServerInfo, setShowShortCutIcon, setTargetHostname, setTargetPath, setTargetPort, setTargetScheme, setTargetUsername, setType, updateTargetAttributes
 
Methods inherited from class nl.uva.vlet.vrs.VNode
compareTo, getAttributes, getAttributes, getAttributeSet, getBasename, getCharSet, getHelp, getHostname, getID, getLocation, getMimeType, getParents, getPath, getPort, getScheme, getServerAttributes, getURI, getVRL, getVRSContext, isComposite, mergedGetAttributes, setLocation, setVRL, toLinkNode, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkNode

protected LinkNode(VRSContext context)
Private constructor

Method Detail

setLinkTarget

public void setLinkTarget(VRL linkTarget)

duplicate

public LinkNode duplicate()

clone

public LinkNode clone()
Overrides:
clone in class java.lang.Object

getType

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

Overrides:
getType in class ResourceNode

isVLink

public boolean isVLink()
Description copied from class: VNode
Returns true if the EXTENSION equals '.vlink', this node might not be of type LinkNode. Is this method returns true, the method toLinkNode will return a valid LinkNode.

Overrides:
isVLink in class VNode
Returns:
See Also:
LinkNode, VNode.toLinkNode()

saveAtLocation

public void saveAtLocation(VComposite parent,
                           java.lang.String newName)
                    throws VlException
Store Link node

Throws:
VlException

createLinkTo

public static LinkNode createLinkTo(VRL parentLoc,
                                    java.lang.String name,
                                    VNode target)
                             throws VlException
Main method to create a new LinkNode stored in parentLoc with name 'name' and with linkTarget the specified VNode target

Throws:
VlException

createLinkNode

public static LinkNode createLinkNode(VRSContext context,
                                      VRL logicalLocation,
                                      VRL targetVRL)
                               throws VlException
Creates new LinkNode object with logical location and specified linkTarget.

Parameters:
logicalLocation -
linkTarget -
Throws:
VlException

createLinkNode

public static LinkNode createLinkNode(VRSContext context,
                                      VRL logicalLocation,
                                      VRL targetVRL,
                                      boolean resolve)
                               throws VlException
Throws:
VlException

loadFrom

public static LinkNode loadFrom(VRSContext context,
                                VRL loc)
                         throws VlException
Load ResourceNode but return as LinkNode !

Throws:
VlException

loadFrom

public static LinkNode loadFrom(VRSContext context,
                                VNode vnode)
                         throws VlException
Resolves a (stored) LinkNode. Since a LinkNode can be stored as any type of VNode, resolving it involves loading the data from the VNode.

Parameters:
vnode - the VNode to resolve the LinkNode from
Throws:
VlException
See Also:
#load(VNode)

getLinkTarget

public VRL getLinkTarget()
                  throws VlException
Throws:
VlException