au.com.prunge.jgenfile.impl.local
Class LocalSetNameOperation

java.lang.Object
  |
  +--au.com.prunge.jgenfile.impl.AbstractOperation
        |
        +--au.com.prunge.jgenfile.impl.AbstractItemOperation
              |
              +--au.com.prunge.jgenfile.impl.local.LocalSetNameOperation
All Implemented Interfaces:
ItemOperation, Operation, SetNameOperation

public class LocalSetNameOperation
extends AbstractItemOperation
implements SetNameOperation

An operation that sets the name of a local item.

Version:
1.0
Author:
Peter Runge

Constructor Summary
LocalSetNameOperation(LocalItem item, String newName)
          Constructs a LocalSetNameOperation.
 
Method Summary
protected  void checkNameValidity(String name)
          Checks whether the specified name is valid.
 String getNewName()
          Returns the new name set with this operation.
 String getOldName()
          Returns the old name of the item.
 void runImpl()
          Begins execution of this operation.
 
Methods inherited from class au.com.prunge.jgenfile.impl.AbstractItemOperation
getItem
 
Methods inherited from class au.com.prunge.jgenfile.impl.AbstractOperation
abort, addOperationHints, checkRun, getLastRunException, getOperationHint, getOperationHints, hasRun, run, setLastRunException, setOperationHint, setOperationHints
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface au.com.prunge.jgenfile.SetNameOperation
run
 
Methods inherited from interface au.com.prunge.jgenfile.ItemOperation
getItem
 
Methods inherited from interface au.com.prunge.jgenfile.Operation
abort, addOperationHints, getLastRunException, getOperationHint, getOperationHints, hasRun, setOperationHint, setOperationHints
 

Constructor Detail

LocalSetNameOperation

public LocalSetNameOperation(LocalItem item,
                             String newName)
                      throws JGenFileException
Constructs a LocalSetNameOperation.

Parameters:
item - the item to set the name of.
newName - the new name to give the item.
Throws:
JGenFileException - if the operation could not be created.
NullPointerException - if newName is null.
Method Detail

getNewName

public String getNewName()
Description copied from interface: SetNameOperation
Returns the new name set with this operation.

Specified by:
getNewName in interface SetNameOperation
Returns:
the new name set with this operation.
See Also:
SetNameOperation.getNewName()

getOldName

public String getOldName()
Description copied from interface: SetNameOperation
Returns the old name of the item.

Specified by:
getOldName in interface SetNameOperation
Returns:
the old name of the item.
See Also:
SetNameOperation.getOldName()

checkNameValidity

protected void checkNameValidity(String name)
                          throws JGenFileException
Checks whether the specified name is valid.

Parameters:
name - the name to check.
Throws:
JGenFileException - if the name is not valid.

runImpl

public void runImpl()
             throws JGenFileException,
                    ItemNameInUseException,
                    InvalidItemNameException
Begins execution of this operation. This method blocks until the operation has completed running.

Specified by:
runImpl in class AbstractOperation
Throws:
JGenFileException - if an error occurs executing the operation.
InvalidItemNameException - if the new item name was invalid.
ItemNameInUseException - if an item with the new name already existed.