|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.starbase.starteam.viewcomparemerge.Session
A view compare/merge (VCM) session.
Each VCM session has associated source view and target views. Comparing the two generates a set of differences. For each difference, you can detect conflicts, override default actions, and so on.
Conflicts may be resolved by merging item properties or file content. Alternatively, you can set property values or checkin new file revisions via the merge preview, which shows what the target view would look like were the session to be committed in its current state.
When ready, you can commit the changes, which updates the target view.
For general information on using the VCM APIs, see com.starbase.startem.viewcomparemerge.
| Constructor Summary | |
Session(MergeType mergeType,
View source,
View target)
Constructs a new VCM session, for comparing and merging changes from a given source view to a given target view. |
|
Session(MergeType mergeType,
View source,
View target,
Options options)
Constructs a new VCM session, for comparing and merging changes from a given source view to a given target view. |
|
| Method Summary | |
void |
cancel()
Cancels a compare or commit operation that is currently in progress. |
boolean |
canCommit()
Determines whether or not this session can be committed in its current state. |
void |
close()
Close this session, freeing its internal resources. |
void |
commit()
Commits changes to the target view. |
void |
compare()
Compares the source and target views. |
void |
connect(Server server)
Connects a restored session to a server instance. |
void |
generateDifferenceReport(java.io.File reportFile)
Generates a difference report for this session. |
void |
generateDifferenceReport(java.io.File reportFile,
boolean bListItemsInMovedFolders)
Generates a difference report for this session. |
void |
generateSummary(java.io.File reportFile,
boolean bIncludeHeading)
Generates a summary session report for this session. |
void |
generateUpdateReport(java.io.File reportFile)
Generates an update report for this session. |
java.lang.Object |
getApplicationObject()
Gets an application-specific object associated with this session. |
java.lang.String |
getDefaultComment()
Gets the default comment to use for checkin operations that occur when committing this session. |
DifferenceIterator |
getDifferences()
Allows an application to iterate over the set of differences detected when comparing the source and target views. |
ItemDifference |
getDifferencesForMergedItem(Item item)
Gets the ItemDifference that corresponds to a given merge item. |
ItemDifference |
getDifferencesForSourceItem(Item item)
Gets the ItemDifference that corresponds to a given source item. |
ItemDifference |
getDifferencesForTargetItem(Item item)
Gets the ItemDifference that corresponds to a given target item. |
Type[] |
getItemTypes()
Gets the item types that are to be included in the view compare/merge operation. |
int |
getLockCount()
Gets the number of source or target items that are currently locked on behalf of this session. |
static Item |
getMatchHint(Item source,
View target)
Determines whether or not a match hint is available that indicates which item in the given target view should be matched to the specified source item. |
View |
getMergePreview()
Gets a preview of the merge results for this session. |
MergeType |
getMergeType()
Gets the merge type of this session. |
java.lang.String |
getName()
Gets the name of this session. |
Options |
getOptions()
Gets the current set of options that influence the behavior of compare or merge operations. |
java.lang.String |
getPostCommitRevisionLabelName()
Gets the name of the post-commit revision label. |
java.lang.String |
getPostCommitViewLabelName()
Gets the name of the post-commit view label. |
java.lang.String |
getPreCommitRevisionLabelName()
Gets the name of the pre-commit revision label. |
java.lang.String |
getPreCommitViewLabelName()
Gets the name of the pre-commit view label. |
Item |
getProcessTask()
Gets the process task created in the target view when this session was committed. |
Progress |
getProgress()
Gets a snapshot of the state of the current compare or commit operation. |
java.lang.String |
getRootDirectory()
Gets the path to the temporary folder on disk used by this session. |
Scope |
getScope()
Gets the current scope of this view compare/merge session. |
Server |
getServer()
Gets the server from which this session was constructed. |
ServerInfo |
getServerInfo()
Gets the ServerInfo associated with this session. |
SessionState |
getSessionState()
Gets the current state of this session. |
Item[] |
getSourceMatchesForTargetItems(Item[] targetItems)
Finds the source items that are the best matches for the given target items. |
Item |
getSourceMatchForTargetItem(Item targetItem)
Finds the source item that is the best match for the given target item. |
View |
getSourceView()
Gets the source view associated with this session. |
View |
getSourceViewForCompare()
Gets the version of the source view used for comparison. |
View |
getTargetView()
Gets the target view associated with this session. |
View |
getTargetViewForCompare()
Gets the version of the target view used for comparison. |
boolean |
hasDifferences()
Determines whether or not there were any differences detected when comparing the source and target views. |
boolean |
hasLocks()
Determines whether any source or target items are currently locked on behalf of this session. |
boolean |
isCommitTransacted()
Determines whether or not the commit operation is atomic. |
boolean |
isDirty()
Determines whether or not this session has been changed since it was last saved or restored. |
boolean |
isFullScope(Type type)
Determines whether or not this session will perform a full-scope compare on the items of the given type. |
boolean |
isIncluded(Item item)
Determines whether or not the given item is in scope for the current view compare/merge operation. |
boolean |
isIncluded(Type type)
Determines whether or not the given item type is included in this view compare/merge session. |
boolean |
isPartiallyCommitted()
Determines whether or not this session was partially committed. |
boolean |
isPostCommitRevisionLabelEnabled()
Determines whether or not the post-commit revision label will be created. |
boolean |
isPostCommitViewLabelEnabled()
Determines whether or not the post-commit view label will be created. |
boolean |
isPreCommitRevisionLabelEnabled()
Determines whether or not the pre-commit revision label will be created. |
boolean |
isPreCommitViewLabelEnabled()
Determines whether or not the pre-commit view label will be created. |
boolean |
isReadOnly()
Determines whether this is a read-only session. |
boolean |
isVerbosePreview()
Determines whether or not verbose preview mode is enabled. |
void |
remove()
Removes this session and any associated temporary files on disk. |
static void |
remove(java.io.File theSession)
Remove the temporary folder tree associated with the specified session file. |
void |
removeLocks()
Unlocks any source or target items that were locked on behalf of this session. |
static Session |
restoreFrom(java.io.File file)
Restores a saved session from a file. |
static Session |
restoreFrom(java.io.File file,
boolean willPersist)
Restores a saved session from a file. |
void |
saveTo(java.io.File file,
boolean copyContent)
Save this session to a file. |
void |
setApplicationObject(java.lang.Object applicationObject)
Sets the application-specific object associated with this session. |
void |
setDefaultComment(java.lang.String comment)
Sets the default comment to use for checkin operations that occur when committing this session. |
void |
setMatch(Item source,
Item target)
Tells the VCM engine to match a specific source item to a specific target item. |
static void |
setMatchHint(Item source,
Item target)
Saves a match hint, indicating that the given source item corresponds to the given target item, even though the two might otherwise be unrelated. |
void |
setOptions(Options options)
Sets options that influence the behavior of compare or merge operations. |
void |
setPostCommitRevisionLabelEnabled(boolean isEnabled)
Determines whether or not the post-commit revision label will be created. |
void |
setPostCommitRevisionLabelName(java.lang.String name)
Sets the name of the post-commit revision label. |
void |
setPostCommitViewLabelEnabled(boolean isEnabled)
Determines whether or not the post-commit view label will be created. |
void |
setPostCommitViewLabelName(java.lang.String name)
Sets the name of the post-commit view label. |
void |
setPreCommitRevisionLabelEnabled(boolean isEnabled)
Determines whether or not the pre-commit revision label will be created. |
void |
setPreCommitRevisionLabelName(java.lang.String name)
Sets the name of the pre-commit revision label. |
void |
setPreCommitViewLabelEnabled(boolean isEnabled)
Determines whether or not the pre-commit view label will be created. |
void |
setPreCommitViewLabelName(java.lang.String name)
Sets the name of the pre-commit view label. |
void |
setScope(Scope s)
Sets the scope of this view compare/merge session. |
void |
setVerbosePreview(boolean verbose)
Enables or disables verbose preview mode. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Session(MergeType mergeType,
View source,
View target)
mergeType - The type of compare/merge to be performed.source - The source view.target - The target view.Session.Session(MergeType,View,View,Options),
Session.getMergeType(),
Session.getSourceView(),
Session.getTargetView()
public Session(MergeType mergeType,
View source,
View target,
Options options)
mergeType - The type of compare/merge to be performed.source - The source view.target - The target view.options - Options that influence the behavior of the compare or merge operations.Session.Session(MergeType,com.starbase.starteam.View,com.starbase.starteam.View),
Session.getMergeType(),
Session.getSourceView(),
Session.getTargetView(),
Session.getOptions()| Method Detail |
public Server getServer()
public ServerInfo getServerInfo()
Session.getSessionState(),
Session.restoreFrom(java.io.File)public SessionState getSessionState()
public boolean isDirty()
Session.saveTo(java.io.File, boolean),
Session.restoreFrom(java.io.File)public java.lang.Object getApplicationObject()
public void setApplicationObject(java.lang.Object applicationObject)
applicationObject - The application-specific object to be associated with this session.Session.saveTo(java.io.File, boolean),
Session.restoreFrom(java.io.File)public java.lang.String getName()
public MergeType getMergeType()
public Item getProcessTask()
java.lang.IllegalStateException - if the session has not yet been committed.public java.lang.String getRootDirectory()
Session.remove()public View getSourceView()
Session.getTargetView(),
Session.getSourceViewForCompare()public View getSourceViewForCompare()
Session.getSourceView(),
Session.getTargetViewForCompare()public View getTargetViewForCompare()
Session.getTargetView(),
Session.getSourceViewForCompare()public View getTargetView()
Session.getSourceView(),
Session.getTargetViewForCompare()public void remove()
Session.remove(java.io.File),
Session.getRootDirectory()public static void remove(java.io.File theSession)
theSession - A saved session file.Session.remove(),
Session.getRootDirectory()public boolean hasLocks()
Session.getLockCount(),
Session.removeLocks(),
Options.getLockSourceForDifference(),
Options.getLockTargetForDifference()public int getLockCount()
Session.hasLocks(),
Session.removeLocks(),
Options.getLockSourceForDifference(),
Options.getLockTargetForDifference()public void removeLocks()
Session.hasLocks(),
Session.getLockCount(),
Options.getLockSourceForDifference(),
Options.getLockTargetForDifference()public void compare()
Note that this method returns when the compare is complete. An application that wants to monitor progress or cancel the operation must do so from a separate thread.
java.lang.IllegalStateException - if the views have already been compared.Session.getProgress(),
Session.cancel()public boolean canCommit()
Note that a session cannot be committed if there are unresolved conflicts, or if there are no changes to be merged.
Also, a compare-only session or any other read-only session cannot be committed.
MergeType.COMPARE,
ItemDifference.isUnresolved(),
Session.isReadOnly(),
Session.commit()public void commit()
Note that this method returns when the commit is complete. An application that wants to monitor progress or cancel the operation must do so from a separate thread.
java.lang.IllegalStateException - if the views cannot be committed
in its current state.Session.canCommit(),
Session.isCommitTransacted(),
Session.getProgress(),
Session.cancel()public boolean isCommitTransacted()
Session.commit(),
Session.isPartiallyCommitted(),
SupportedFeatures.hasMultiCommandTransactions()public boolean isPartiallyCommitted()
Partially committed sessions may occur when VCM commits are not transacted. If the commit fails in the middle (for example, due to insufficient access rights), then the session is left in a state where some of the differences have been merged to the target view and others have not.
A partially committed session may be saved, restored and re-committed. Previously committed differences will be skipped on subsequent commits.
Session.isCommitTransacted(),
Session.getSessionState()public java.lang.String getPreCommitViewLabelName()
Creation of the pre-commit view label is optional, and is disabled by default.
To enable creation of the label, use setPreCommitViewLabelEnabled.
public void setPreCommitViewLabelName(java.lang.String name)
Creation of the pre-commit view label is optional, and is disabled by default.
To enable creation of the label, use setPreCommitViewLabelEnabled.
name - The name of the pre-commit view label,
or null to reset the label name to its default value.Session.setPreCommitViewLabelEnabled(boolean)public java.lang.String getPostCommitViewLabelName()
Creation of the post-commit view label is optional, and is enabled by default.
To disable creation of the label, use setPostCommitViewLabelEnabled.
public void setPostCommitViewLabelName(java.lang.String name)
Creation of the post-commit view label is optional, and is enabled by default.
To disable creation of the label, use setPostCommitViewLabelEnabled.
name - The name of the post-commit view label,
or null to reset the label name to its default value.Session.setPostCommitViewLabelEnabled(boolean)public java.lang.String getPreCommitRevisionLabelName()
Creation of the pre-commit revision label is optional, and is disabled by default.
To enable creation of the label, use setPreCommitRevisionLabelEnabled.
public void setPreCommitRevisionLabelName(java.lang.String name)
Creation of the pre-commit revision label is optional, and is disabled by default.
To enable creation of the label, use setPreCommitRevisionLabelEnabled.
name - The name of the pre-commit revision label,
or null to reset the label name to its default value.Session.setPreCommitRevisionLabelEnabled(boolean)public java.lang.String getPostCommitRevisionLabelName()
Creation of the post-commit revision label is optional, and is disabled by default.
To enable creation of the label, use setPostCommitRevisionLabelEnabled.
public void setPostCommitRevisionLabelName(java.lang.String name)
Creation of the post-commit revision label is optional, and is disabled by default.
To enable creation of the label, use setPostCommitRevisionLabelEnabled.
name - The name of the post-commit revision label,
or null to reset the label name to its default value.Session.setPostCommitRevisionLabelEnabled(boolean)public boolean isPreCommitViewLabelEnabled()
public void setPreCommitViewLabelEnabled(boolean isEnabled)
isEnabled - true if the pre-commit view label will be created, and false otherwise.Session.setPreCommitViewLabelName(java.lang.String),
Session.setPostCommitViewLabelEnabled(boolean),
Session.setPreCommitRevisionLabelEnabled(boolean),
Session.setPostCommitRevisionLabelEnabled(boolean)public boolean isPostCommitViewLabelEnabled()
public void setPostCommitViewLabelEnabled(boolean isEnabled)
isEnabled - true if the post-commit view label will be created, and false otherwise.Session.setPostCommitViewLabelName(java.lang.String),
Session.setPreCommitViewLabelEnabled(boolean),
Session.setPreCommitRevisionLabelEnabled(boolean),
Session.setPostCommitRevisionLabelEnabled(boolean)public boolean isPreCommitRevisionLabelEnabled()
public void setPreCommitRevisionLabelEnabled(boolean isEnabled)
isEnabled - true if the pre-commit revision label will be created, and false otherwise.Session.setPreCommitRevisionLabelName(java.lang.String),
Session.setPreCommitViewLabelEnabled(boolean),
Session.setPostCommitViewLabelEnabled(boolean),
Session.setPostCommitRevisionLabelEnabled(boolean)public boolean isPostCommitRevisionLabelEnabled()
public void setPostCommitRevisionLabelEnabled(boolean isEnabled)
isEnabled - true if the post-commit revision label will be created, and false otherwise.Session.setPostCommitRevisionLabelName(java.lang.String),
Session.setPreCommitViewLabelEnabled(boolean),
Session.setPostCommitViewLabelEnabled(boolean),
Session.setPreCommitRevisionLabelEnabled(boolean)public void setDefaultComment(java.lang.String comment)
comment - The default checkin comment.public java.lang.String getDefaultComment()
public boolean hasDifferences()
Session.getDifferences(),
ItemDifferencepublic DifferenceIterator getDifferences()
Session.compare(),
Session.hasDifferences(),
ItemDifferencepublic Progress getProgress()
Session.compare(),
Session.commit(),
Session.cancel()
public void saveTo(java.io.File file,
boolean copyContent)
throws java.io.IOException
If copyContent is false, then merged file content is stored in a session-specific temporary file on disk. This results in smaller session files, but means that they are generally useful only from the computer where they were generated.
If copyContent is true, then merged file content is copied into the session file. This may result in very large session files, but allows them to be used from any computer, attached to email messages, and so on.
file - The output file.copyContent - True to copy merged file content into the session file;
false to reference files stored on the local disk.
java.io.IOExceptionSession.restoreFrom(java.io.File),
Session.getRootDirectory()
public static Session restoreFrom(java.io.File file)
throws java.io.IOException
When a session is first restored, it is in a disconnected state.
It is not fully functional until it is connected to a server
instance that references the correct repository. To determine
which server is required, use getServerInfo.
For example:
Session session = Session.restoreFrom("MySession.vcmx");
Server server = new Server(session.getServerInfo());
server.logOn(user, password);
session.connect(server);
. . .
file - The session file. The file must have been previously
saved using saveTo.
java.io.IOExceptionSession.restoreFrom(java.io.File,boolean),
Session.saveTo(java.io.File, boolean),
Session.getSessionState(),
Session.connect(com.starbase.starteam.Server),
SessionState.DISCONNECTED
public static Session restoreFrom(java.io.File file,
boolean willPersist)
throws java.io.IOException
When a session is first restored, it is in a disconnected state.
It is not fully functional until it is connected to a server
instance that references the correct repository. To determine
which server is required, use getServerInfo.
For example:
Session session = Session.restoreFrom("MySession.vcmx");
Server server = new Server(session.getServerInfo());
server.logOn(user, password);
session.connect(server);
. . .
file - The session file. The file must have been previously
saved using saveTo.willPersist - True if the session will remain persisted on
disk; false if it is a temporary session that will be removed.
When a temporary session is closed, its working files on disk
are automatically removed.
java.io.IOExceptionSession.restoreFrom(java.io.File),
Session.saveTo(java.io.File, boolean),
Session.getSessionState(),
Session.connect(com.starbase.starteam.Server),
Session.close(),
SessionState.DISCONNECTEDpublic void connect(Server server)
When a session is first restored, it is in a disconnected state.
It is not fully functional until it is connected to a server
instance that references the correct repository. To determine
which server is required, use getServerInfo.
For example:
Session session = Session.restoreFrom("MySession.vcmx");
Server server = new Server(session.getServerInfo());
server.logOn(user, password);
session.connect(server);
. . .
server - The server instance to be connected. The server
must refer to the same StarTeam repository with which the session
was created.Session.restoreFrom(java.io.File)public void setOptions(Options options)
An application may also call getOptions, and change individual
settings in the Options instance that is returned.
options - Options that influence the behavior of compare or merge operations.public Options getOptions()
An application may change individual settings in the Options object, and they will affect this session.
public void cancel()
The compare and commit methods return when complete.
An application that wants to monitor progress or cancel the operation
must do so from a separate thread.
If a commit that is being executed as an atomic transaction is canceled before it is completed, then the transaction is rolled back. The source and target views are left in the state they were in prior to the start of the commit.
Session.compare(),
Session.commit(),
Session.getProgress(),
Session.isCommitTransacted()public void setVerbosePreview(boolean verbose)
In verbose preview mode, every ItemDifference has a corresponding item in the MergePreview. In cases where the item will not actually appear in the target view after the merge, the preview item is marked deleted.
For example, in the case of an ItemDifference where the default action is "Delete", the item will be removed from the target view when the merge is commited. Thus, the merged item for this ItemDifference would normally be null. However, in verbose mode, the merged item for this ItemDifference would be a deleted item, and the deleted item would appear in the merge preview.
verbose - true to enable verbose preview mode; false to disable it.Session.isVerbosePreview(),
Session.getMergePreview(),
ItemDifference.getMergedItem(),
Item.isDeleted()public boolean isVerbosePreview()
In verbose preview mode, every ItemDifference has a corresponding item in the MergePreview. In cases where the item will not actually appear in the target view after the merge, the preview item is marked deleted.
For example, in the case of an ItemDifference where the default action is "Delete", the item will be removed from the target view when the merge is commited. Thus, the merged item for this ItemDifference would normally be null. However, in verbose mode, the merged item for this ItemDifference would be a deleted item, and the deleted item would appear in the merge preview.
Session.setVerbosePreview(boolean)public View getMergePreview()
The preview is a close approximation of what the target view would look like if the session were to be committed in its current state.
Since the preview is itself a view, it provides applications with a familiar way to browse and manipulate the difference information. For example, in order to manually resolve a file merge conflict, an application may use the ItemDifference directly:
// Manually resolve a file merge conflict
// through the ItemDifference.
diff.setMergedFileContent(path);
Alternatively, the application may choose to checkin the new
content through the merge preview:
// The merged item is accessible through the ItemDifference
// and through the merge preview; they are physically the same.
Item item = diff.getMergedItem();
// Checking in a new file revision also resolves the conflict.
View preview = session.getMergePreview();
CheckinManager mgr = preview.createCheckinManager();
mgr.checkin((File)item, path);
public ItemDifference getDifferencesForMergedItem(Item item)
The merged item may have been obtained through
getMergeItem,
or it may have been obtained via the
merge preview.
item - A merged item.
ItemDifference.getMergedItem(),
Session.getMergePreview()public ItemDifference getDifferencesForSourceItem(Item item)
item - A source item.
ItemDifference.getSourceItem()public ItemDifference getDifferencesForTargetItem(Item item)
item - A target item.
ItemDifference.getTargetItem()public void close()
Closing a session that has not been persisted also deletes the associated temporary files on disk.
Session.remove(),
Session.saveTo(java.io.File, boolean)public Type[] getItemTypes()
public boolean isIncluded(Type type)
type - The type to be tested.
public void setScope(Scope s)
By default, all files and folders in the source view are compared against the corresponding target items. An application can change the scope so that specific items or types are included.
s - A scope specifier, indicating which source items are compared
against the target in this view compare/merge session, or null for a
full-scope compare of files and folders.ItemTypeScope,
FolderScope,
ItemListScope,
RevisionLabelScope,
ProcessItemScope,
AnyScope,
EveryScope,
Options.setVerboseDifferences(com.starbase.starteam.Type, boolean)public Scope getScope()
public boolean isIncluded(Item item)
item - The item to be tested.
#addScope,
#resetScopepublic boolean isReadOnly()
Compare-only sessions are read-only, as are sessions that have already been committed.
SessionState.COMMITTED,
MergeType.COMPAREpublic boolean isFullScope(Type type)
type - An item type.
public Item getSourceMatchForTargetItem(Item targetItem)
The scope of the view compare/merge operation is always defined in terms of the source. getSourceMatchForTargetItem() may be used by an application that wants to define the scope starting with a target item.
To find source matches for multiple target items, use getSourceMatchesForTargetItems(), which will result in better performance.
targetItem - Item
public Item[] getSourceMatchesForTargetItems(Item[] targetItems)
The scope of the view compare/merge operation is always defined in terms of the source. getSourceMatchesForTargetItems() may be used by an application that wants to define the scope starting with a set of target items.
To find source matches for multiple target items, use getSourceMatchesForTargetItems(), which will result in better performance.
public void generateDifferenceReport(java.io.File reportFile)
throws java.io.IOException
reportFile - The report output file.
java.io.IOException
public void generateDifferenceReport(java.io.File reportFile,
boolean bListItemsInMovedFolders)
throws java.io.IOException
reportFile - The report output file.bListItemsInMovedFolders - true to list items whose parent folder has moved
in either the source or target, even if the items themselves have no true differences.
java.io.IOException
public void generateSummary(java.io.File reportFile,
boolean bIncludeHeading)
throws java.io.IOException
reportFile - The report output file.bIncludeHeading - false to suppress the generation of the heading.
java.io.IOException
public void generateUpdateReport(java.io.File reportFile)
throws java.io.IOException
reportFile - The report output file.
java.io.IOException
public void setMatch(Item source,
Item target)
A client application can call setMatch() before calling compare() to avoid an AmbiguousMatchException.
source - An item from the source view.target - The corresponding item from the target view.Session.compare(),
AmbiguousMatchException
public static void setMatchHint(Item source,
Item target)
Internally, the match hint is represented by a StarTeam link.
source - A source item.target - The matching target item.
public static Item getMatchHint(Item source,
View target)
source - A source item.target - The desired target view.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||