Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.tools.ant
Class Symlink

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.hyperic.tools.ant.Symlink

    public class Symlink

extends org.apache.tools.ant.Task

Creates, Records and Restores Symlinks.

This task performs several related operations. In the most trivial, and default usage, it creates a link specified in the link atribute to a resource specified in the resource atribute. The second usage of this task is to traverses a directory structure specified by a fileset, and write a properties file in each included directory describing the links found in that directory. The third usage is to traverse a directory structure specified by a fileset, looking for properties files (also specified as included in the fileset) and recreate the links that have been previously recorded for each directory. Finally, it can be used to remove a symlink without deleting the file or directory it points to.

Examples of use:

Make a link named "foo" to a resource named "bar.foo" in subdir:

     <symlink link="${dir.top}/foo" resource="${dir.top}/subdir/bar.foo"/>

Record all links in subdir and it's descendants in files named "dir.links"

     <symlink action="record" linkfilename="dir.links">
        <fileset dir="${dir.top}" includes="subdir/**" />
     </symlink>

Recreate the links recorded in the previous example:

     <symlink action="recreate">
        <fileset dir="${dir.top}" includes="subdir/**/dir.links" />
     </symlink>

Delete a link named "foo" to a resource named "bar.foo" in subdir:

     <symlink action="delete" link="${dir.top}/foo"/>

LIMITATIONS: Because Java has no direct support for handling symlinks this task divines them by comparing canoniacal and absolute paths. On non-unix systems this may cause false positives. Furthermore, any operating system on which the command `ln -s link resource` is not a valid command on the comandline will not be able to use action= "delete", action="single" or action="recreate", but action="record" should still work. Finally, the lack of support for symlinks in Java means that all links are recorded as links to the canonical resource name. Therefore the link: `link --> subdir/dir/../foo.bar` will be recorded as `link=subdir/foo.bar` and restored as `link --> subdir/foo.bar`

Field Summary

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`Symlink()`

Method Summary
`void` | `addFileset(org.apache.tools.ant.types.FileSet set)` Adds a fileset to this task.
`void` | `execute()` The standard method for executing any task.
`void` | `init()` Initialize the task.
`void` | `setAction(java.lang.String typ)` The setter for the "action" attribute.
`void` | `setFailOnError(boolean foe)` The setter for the failonerror atribute.
`void` | `setLink(java.lang.String lnk)` The setter for the "link" attribute.
`void` | `setLinkfilename(java.lang.String lf)` The setter for the "linkfilename" attribute.
`void` | `setOverwrite(boolean owrite)` The setter for the overwrite atribute.
`void` | `setRelative(boolean b)`
`void` | `setResource(java.lang.String src)` The setter for the "resource" attribute.

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Symlink

    public Symlink()

Method Detail

### init

    public void init()
              throws org.apache.tools.ant.BuildException

  Initialize the task.

  Overrides:
    `init` in class `org.apache.tools.ant.Task`
  Throws:
    `org.apache.tools.ant.BuildException`

### execute

    public void execute()
                 throws org.apache.tools.ant.BuildException

  The standard method for executing any task.

  Overrides:
    `execute` in class `org.apache.tools.ant.Task`
  Throws:
    `org.apache.tools.ant.BuildException`

### setOverwrite

    public void setOverwrite(boolean owrite)

  The setter for the overwrite atribute. If set to false (default) the task will not overwrite existing links, and may stop the build if a link already exists depending on the setting of failonerror.

  Parameters:
    `owrite` - If true overwrite existing links.

### setFailOnError

    public void setFailOnError(boolean foe)

  The setter for the failonerror atribute. If set to true (default) the entire build fails upon error. If set to false, the error is logged and the build will continue.

  Parameters:
    `foe` - If true throw build exception on error else log it.

### setAction

    public void setAction(java.lang.String typ)

  The setter for the "action" attribute. May be "single" "multi" or "record"

  Parameters:
    `typ` - The action of action to perform

### setRelative

    public void setRelative(boolean b)

### setLink

    public void setLink(java.lang.String lnk)

  The setter for the "link" attribute. Only used for action = single.

  Parameters:
    `lnk` - The name for the link

### setResource

    public void setResource(java.lang.String src)

  The setter for the "resource" attribute. Only used for action = single.

  Parameters:
    `src` - The source of the resource to be linked.

### setLinkfilename

    public void setLinkfilename(java.lang.String lf)

  The setter for the "linkfilename" attribute. Only used for action=record.

  Parameters:
    `lf` - The name of the file to write links to.

### addFileset

    public void addFileset(org.apache.tools.ant.types.FileSet set)

  Adds a fileset to this task.

  Parameters:
    `set` - The fileset to add.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.