org.modeshape.graph.request
Class CloneWorkspaceRequest

java.lang.Object
  extended by org.modeshape.graph.request.Request
      extended by org.modeshape.graph.request.ChangeRequest
          extended by org.modeshape.graph.request.CloneWorkspaceRequest
All Implemented Interfaces:
Serializable, Cloneable

public final class CloneWorkspaceRequest
extends ChangeRequest

Request that an existing workspace be cloned into a target workspace with the supplied name. If the target workspace exists, the target conflict behavior defines the behavior to be followed. If the workspace being cloned does not exist, the clone conflict behavior defines the behavior to be followed.

See Also:
Serialized Form

Nested Class Summary
static class CloneWorkspaceRequest.CloneConflictBehavior
          The options for the behavior when a request specifies the name of the workspace to clone, but the cloned workspace does not exist.
 
Field Summary
static CloneWorkspaceRequest.CloneConflictBehavior DEFAULT_CLONE_CONFLICT_BEHAVIOR
          The default CloneWorkspaceRequest.CloneConflictBehavior that will be used if it is unspecified.
static CreateWorkspaceRequest.CreateConflictBehavior DEFAULT_CREATE_CONFLICT_BEHAVIOR
          The default CreateWorkspaceRequest.CreateConflictBehavior that will be used if it is unspecified.
 
Constructor Summary
CloneWorkspaceRequest(String nameOfWorkspaceToBeCloned, String desiredNameOfTargetWorkspace, CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior, CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior)
          Create a request to clone an existing workspace to create a new workspace, and specify the behavior should a workspace already exists with a name that matches the desired name for the new workspace.
 
Method Summary
 void cancel()
          Cancel this request.
 Location changedLocation()
          Get the location of the top-most node that is to be changed by this request.
 String changedWorkspace()
          Get the name of the workspace that was changed by this request.
 boolean changes(String workspace, Path path)
          Determine if this request changes the branch at the given path.
 CloneWorkspaceRequest clone()
           This method does not clone the results.
 CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior()
          Get the desired behavior if the cloned workspace does not exist.
 String desiredNameOfTargetWorkspace()
          Get the desired name for the target workspace.
 boolean equals(Object obj)
          
 Location getActualLocationOfRoot()
          Get the actual location of the root node in the new workspace, or null if the workspace was not (yet) created.
 String getActualWorkspaceName()
          Get the actual name of the workspace that was created.
 RequestType getType()
          Returns the type of the request
 int hashCode()
          
 boolean isReadOnly()
          Return whether this request only reads information.
 String nameOfWorkspaceToBeCloned()
          Get the name of the existing workspace that is to be cloned into the new workspace.
 void setActualRootLocation(Location actualLocationOfRoot)
          Set the actual location of the root node in the new workspace.
 void setActualWorkspaceName(String actualWorkspaceName)
          Set the actual name of the workspace that was created.
 CreateWorkspaceRequest.CreateConflictBehavior targetConflictBehavior()
          Get the desired behavior if a workspace already exists with the desired workspace name .
 String toString()
          
 
Methods inherited from class org.modeshape.graph.request.Request
checkNotFrozen, freeze, getError, hasError, isCancelled, isFrozen, setError, setLatchForFreezing
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CLONE_CONFLICT_BEHAVIOR

public static final CloneWorkspaceRequest.CloneConflictBehavior DEFAULT_CLONE_CONFLICT_BEHAVIOR
The default CloneWorkspaceRequest.CloneConflictBehavior that will be used if it is unspecified.


DEFAULT_CREATE_CONFLICT_BEHAVIOR

public static final CreateWorkspaceRequest.CreateConflictBehavior DEFAULT_CREATE_CONFLICT_BEHAVIOR
The default CreateWorkspaceRequest.CreateConflictBehavior that will be used if it is unspecified.

Constructor Detail

CloneWorkspaceRequest

public CloneWorkspaceRequest(String nameOfWorkspaceToBeCloned,
                             String desiredNameOfTargetWorkspace,
                             CreateWorkspaceRequest.CreateConflictBehavior createConflictBehavior,
                             CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior)
Create a request to clone an existing workspace to create a new workspace, and specify the behavior should a workspace already exists with a name that matches the desired name for the new workspace.

Parameters:
nameOfWorkspaceToBeCloned - the name of the existing workspace that is to be cloned
desiredNameOfTargetWorkspace - the desired name of the target workspace
createConflictBehavior - the behavior if a workspace already exists with the same name
cloneConflictBehavior - the behavior if the workspace to be cloned does not exist
Throws:
IllegalArgumentException - if the either workspace name is null
Method Detail

nameOfWorkspaceToBeCloned

public String nameOfWorkspaceToBeCloned()
Get the name of the existing workspace that is to be cloned into the new workspace.

Returns:
the name of the existing workspace that is to be cloned; never null

desiredNameOfTargetWorkspace

public String desiredNameOfTargetWorkspace()
Get the desired name for the target workspace.

Returns:
the desired name for the new workspace; never null

targetConflictBehavior

public CreateWorkspaceRequest.CreateConflictBehavior targetConflictBehavior()
Get the desired behavior if a workspace already exists with the desired workspace name .

Returns:
the desired behavior; never null

cloneConflictBehavior

public CloneWorkspaceRequest.CloneConflictBehavior cloneConflictBehavior()
Get the desired behavior if the cloned workspace does not exist.

Returns:
the desired behavior; never null

getActualWorkspaceName

public String getActualWorkspaceName()
Get the actual name of the workspace that was created. This will be the same as the desired target name unless there was a conflict and the desired behavior was to alter the name.

Returns:
the actual name of the workspace that was created, or null if a workspace was not created (yet)

setActualWorkspaceName

public void setActualWorkspaceName(String actualWorkspaceName)
Set the actual name of the workspace that was created. This should be the same as the desired target name unless there was a conflict and the desired behavior was to alter the name.

Parameters:
actualWorkspaceName - the actual name of the workspace that was created, or null if a workspace was not created
Throws:
IllegalStateException - if the request is frozen

getActualLocationOfRoot

public Location getActualLocationOfRoot()
Get the actual location of the root node in the new workspace, or null if the workspace was not (yet) created.

Returns:
the actual location of the root node in the new workspace, or null if the workspace was not (yet) created

setActualRootLocation

public void setActualRootLocation(Location actualLocationOfRoot)
Set the actual location of the root node in the new workspace.

Parameters:
actualLocationOfRoot - the actual location of the workspace's root node.
Throws:
IllegalStateException - if the request is frozen

isReadOnly

public boolean isReadOnly()
Return whether this request only reads information.

Specified by:
isReadOnly in class Request
Returns:
true if this request reads information, or false if it requests that the repository content be changed in some way
See Also:
Request.isReadOnly()

cancel

public void cancel()
Cancel this request. After this method is called, the cancellation flag is set, and any current or future processing of the request may be affected by the cancellation. (Note however, that processors may choose to not respect this request.)

This method is safe to be called by different threads.

Overrides:
cancel in class Request
See Also:
Request.cancel()

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

changedLocation

public Location changedLocation()
Get the location of the top-most node that is to be changed by this request. If this request has been completed, this location will always have a path.

Specified by:
changedLocation in class ChangeRequest
Returns:
the location changed by this request
See Also:
ChangeRequest.changedLocation()

changedWorkspace

public String changedWorkspace()
Get the name of the workspace that was changed by this request.

Specified by:
changedWorkspace in class ChangeRequest
Returns:
the name of the workspace changed by this request
See Also:
ChangeRequest.changedWorkspace()

changes

public boolean changes(String workspace,
                       Path path)
Determine if this request changes the branch at the given path.

Specified by:
changes in class ChangeRequest
Parameters:
workspace - the name of the workspace; may not be null
path - the path; may not be null
Returns:
true if this request changes a node under the given path
See Also:
ChangeRequest.changes(java.lang.String, org.modeshape.graph.property.Path)

clone

public CloneWorkspaceRequest clone()

This method does not clone the results.

This method does not clone the results.

Specified by:
clone in class ChangeRequest
See Also:
ChangeRequest.clone()

getType

public RequestType getType()
Description copied from class: Request
Returns the type of the request

Specified by:
getType in class Request
Returns:
the type of the request


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.