com.starteam
Class CheckinManager

java.lang.Object
  extended by com.starteam.CheckinManager
All Implemented Interfaces:
StreamUtils.Listener

public class CheckinManager
extends java.lang.Object
implements StreamUtils.Listener

Provides a way to check in multiple files, applying a consistent set of options across all files. Files may be aggregated or overwritten (using the different flavors of the checkin api's) until ready to commit all the changes Files may also be deleted or moved from their current parent folder to a different folder in the same view The commit() method must be called to save all the changes to the repository The commit consists of a non-transactional phase, followed by a transactional one, which additionally creates a ChangePackage that encompasses the set of changes, i.e. files added, modified, deleted and moved During the non-transactional phase of the commit, events are fired to the calling client application, at which point, the application may still decide to overwrite earlier decisions such as ignoring certain files, force checking in others, checking in from a different stream, etc. Usage CheckinManager cm = myView.createCheckinManager(); cm.checkin(file1); cm.checkinFrom(file2, new java.io.File("c://myprojects//myworkspace//file2.txt"); cm.delete(file3); cm.move(file4, myView.getRootFolder()); if (cm.canCommit()) cm.commit();


Nested Class Summary
static class CheckinManager.Progress
          Information on the progress of a checkin operation from CheckinManager.
static class CheckinManager.WebCacheCheckinManager
           
 
Method Summary
 void addCheckinListener(CheckinListener listener)
          Adds a listener for checkin-related events.
 boolean bytesTransferred(int bytes)
          The number of bytes transferred from client to server
 boolean canCommit()
          returns true if the session can be committed For the session to be in a commit-able state, all files being checked in should be in a relevant state, e.g.
 void checkin(File starTeamFile)
          Checks in a single file from the default location.
 void checkin(File[] files)
          Checks in the given set of files.
 void checkin(File starTeamFile, CheckinOptions options)
          Checks in a file with the specified set of options.
 void checkin(Folder folder)
          Checks in all the files in the given folder.
 void checkin(Folder folder, int depth)
          Checks in all the files in the given folder, and in all sub-folders to the given depth.
 void checkinFrom(File starTeamFile, java.io.File diskFile)
          Checks in a file in the context of the specified starTeam File Object.
 void checkinFrom(File starTeamFile, java.io.InputStream stream)
          Checks in a single file from an input stream.
 java.lang.Object clone()
          Clone a checkin manager from this one
 void commit()
          Commit all the changes to the repository
 ChangePackage getChangePackage()
          Returns the Change Package created as the outcome of this checkin operation Returns NULL if this checkin has not yet run or if the server does not support Change Packages
 java.lang.String getName()
          Returns the name of the ChangePackage for this session.
 CheckinOptions getOptions()
          Gets the default checkin options currently in effect.
 CheckinManager.Progress getProgress()
          Gets a snapshot of the state of the current checkin operation.
 View getView()
          returns the containing view
 boolean hasCheckinListeners()
          Returns true if there is at least one registered listener for checkin events
 void ignore(Item starTeamItem)
          Remove this item from consideration for the commit If the item was to be checked in, it will not be checked in if it was to be deleted, it will not be deleted, if it was to be moved, it will not be moved If the item is a folder, then all child items, descendant folders and child items of descendant folders will be removed from consideration
 boolean isCanceled()
          Indicates whether or not pending checkin operations have been canceled.
 boolean isRunning()
          Determines whether or not there is currently a checkin operation in progress.
 void moveTo(Item starTeamItem, Folder toFolder, boolean moveLocal)
          Move an item from it's current parent folder to the folder specified The specified folder MUST be a folder in the same view as the item is in, and as the CheckinManager is operating in.
 void remove(Item starTeamItem, boolean deleteLocal)
          Remove an item from the repository.
 void removeCheckinListener(CheckinListener listener)
          Removes a listener for checkin-related events.
 void setCanceled()
          Cancels any pending checkin operations.
 void setName(java.lang.String name)
          Sets the name of the ChangePackage for this session.
 void setOptions(CheckinOptions checkinOptions)
          Changes the checkin options currently in effect.
 long size()
          returns a count of the amount of work to be done by this manager
 java.lang.String toString()
          Gets a string representation of this CheckinManager, useful for debugging.
 void update(Item starTeamItem)
          Update an Item in the repository.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

clone

public java.lang.Object clone()
Clone a checkin manager from this one

Overrides:
clone in class java.lang.Object
Returns:
Object an instance of a checkin manager

setCanceled

public void setCanceled()
Cancels any pending checkin operations.

See Also:
CheckinManager.isCanceled()

isCanceled

public boolean isCanceled()
Indicates whether or not pending checkin operations have been canceled.

Returns:
true if pending checkin operations have been canceled, and false otherwise.
See Also:
CheckinManager.setCanceled()

checkin

public void checkin(File starTeamFile)
Checks in a single file from the default location. The file is checked in on commit. Creates a copy of the global options. Subsequent changes to global options do not affect this file

Parameters:
starTeamFile - The file to be checked in.
See Also:
CheckinManager.commit()

checkinFrom

public void checkinFrom(File starTeamFile,
                        java.io.InputStream stream)
Checks in a single file from an input stream. The file is checked in on commit No status update is performed in this case. Creates a copy of the global options. Subsequent changes to global options do not affect this file

Parameters:
starTeamFile - The file to be checked in.
stream - The stream from which the content is to be read.
See Also:
CheckinManager.commit()

checkin

public void checkin(File[] files)
Checks in the given set of files. The files are checked in on commit If any of the files are new, they are added to the repository. If some of the files are parented in new folders, then those folders are created in the repository. Creates a copy of the global options. Subsequent changes to global options do not affect these files

Parameters:
files - The files to be checked in.
See Also:
CheckinManager.commit(), Folder.getItems(com.starteam.Item.Type)

checkin

public void checkin(Folder folder)
Checks in all the files in the given folder. The files are checked in on commit. If this folder is new, i.e. it does not exist in the repository, it is created in the repository Creates a copy of the global options. Subsequent changes to global options do not affect this folder and its files

Parameters:
folder - The StarTeam folder whose files are to be checked in.
See Also:
CheckinManager.commit(), Folder, CheckinManager.checkin(Folder,int)

checkin

public void checkin(Folder folder,
                    int depth)
Checks in all the files in the given folder, and in all sub-folders to the given depth. If not in view folders have been included, then these folders will be created in the repository The files are checked in on commit. Creates a copy of the global options. Subsequent changes to global options do not affect these folders and their files

Parameters:
folder - The StarTeam folder whose files are to be checked in.
depth - Indicates which sub-folders also contain files to be checked in. Zero indicates that no sub-folders should be included; 1 indicates that this folder and its immediate child folders should be included; -1 indicates that this folder and all child folders at any depth should be included. -2 indicates that only this folder will be included, without any of it's containing files or sub-folders if depth == -2, it is expected that the folder being checked in is a not-in-view folder
See Also:
CheckinManager.commit()

checkinFrom

public void checkinFrom(File starTeamFile,
                        java.io.File diskFile)
Checks in a file in the context of the specified starTeam File Object. The file is checked in on commit. from the specified file system disk file Creates a copy of the global options. Subsequent changes to global options do not affect this file

Parameters:
starTeamFile - File a starTeam File Object instance
diskFile - java.io.File the working file on disk to checkin from
See Also:
CheckinManager.commit()

checkin

public void checkin(File starTeamFile,
                    CheckinOptions options)
Checks in a file with the specified set of options. The file is checked in on commit

Parameters:
starTeamFile - The file to checkin
options - the checkin options to use. These options override the default options assigned when this checkin manager was created.
See Also:
CheckinManager.commit()

update

public void update(Item starTeamItem)
Update an Item in the repository. The update occurs on commit Note that the item can be new or dirty. If the item is new, and its parent is a new folder as well then the update method must be called in order of parent's before children updates are in-place

Parameters:
starTeamItem - the item to update

remove

public void remove(Item starTeamItem,
                   boolean deleteLocal)
Remove an item from the repository. The item is removed on commit if the item is a folder, remove the folder and all contained items of all types from the repository. If the folder contains sub-folders, the sub-folders and their contained items are all removed from the repository

Parameters:
starTeamItem - The starTeam item to remove
deleteLocal - if true, and if the item is a file, then delete the local working file

moveTo

public void moveTo(Item starTeamItem,
                   Folder toFolder,
                   boolean moveLocal)
Move an item from it's current parent folder to the folder specified The specified folder MUST be a folder in the same view as the item is in, and as the CheckinManager is operating in. The specified folder must exist in the repository, i.e. it should not be new or deleted The folder must also be a different folder from the item's current parent folder

Parameters:
starTeamItem - the item to move to a different folder in the repository
toFolder - the folder to move the item to.
moveLocal - if the item is a File, move the local disk file on the file system too

size

public long size()
returns a count of the amount of work to be done by this manager

Returns:
a count of the amount of work to be done by this manager

canCommit

public boolean canCommit()
returns true if the session can be committed For the session to be in a commit-able state, all files being checked in should be in a relevant state, e.g. NEW or MODIFIED, or else the ForceCheckin option should be specified

Returns:
true if the session can be committed

ignore

public void ignore(Item starTeamItem)
Remove this item from consideration for the commit If the item was to be checked in, it will not be checked in if it was to be deleted, it will not be deleted, if it was to be moved, it will not be moved If the item is a folder, then all child items, descendant folders and child items of descendant folders will be removed from consideration

Parameters:
starTeamItem -

commit

public void commit()
Commit all the changes to the repository


isRunning

public boolean isRunning()
Determines whether or not there is currently a checkin operation in progress.

Returns:
true if there is currently a checkin operation in progress, and false otherwise.

addCheckinListener

public void addCheckinListener(CheckinListener listener)
Adds a listener for checkin-related events.

Parameters:
listener - Application-specific event handler for checkin-related events.
See Also:
CheckinListener, CheckinEvent, CheckinManager.removeCheckinListener(com.starteam.events.CheckinListener)

removeCheckinListener

public void removeCheckinListener(CheckinListener listener)
Removes a listener for checkin-related events.

Parameters:
listener - A previously-registered event handler for checkin-related events.
See Also:
CheckinManager.addCheckinListener(com.starteam.events.CheckinListener)

hasCheckinListeners

public boolean hasCheckinListeners()
Returns true if there is at least one registered listener for checkin events

Returns:
boolean true if there is at least one registered listener for checkin events

toString

public java.lang.String toString()
Gets a string representation of this CheckinManager, useful for debugging.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this CheckinManager.

getOptions

public CheckinOptions getOptions()
Gets the default checkin options currently in effect. Note that CheckinManager wide options should be specified before calling any of the checkin api's.

Note that individual options can be overridden on a file-by-file basis by registering a CheckinListener, and changing options as necessary in the onStartFile event handler.

Returns:
The checkin options currently in effect.
See Also:
CheckinOptions, CheckinManager.addCheckinListener(com.starteam.events.CheckinListener)

setOptions

public void setOptions(CheckinOptions checkinOptions)
Changes the checkin options currently in effect. CheckinManager wide options should be specified before calling any of the checkin api's.

Parameters:
checkinOptions - The new checkin options.

getChangePackage

public ChangePackage getChangePackage()
Returns the Change Package created as the outcome of this checkin operation Returns NULL if this checkin has not yet run or if the server does not support Change Packages

Returns:
the Change Package created as the outcome of this checkin operation

getProgress

public CheckinManager.Progress getProgress()
Gets a snapshot of the state of the current checkin operation.

Returns:
A snapshot of the state of the current checkin operation.
See Also:
CheckinManager.Progress, CheckinManager.isRunning()

getView

public View getView()
returns the containing view

Returns:
the View

bytesTransferred

public boolean bytesTransferred(int bytes)
The number of bytes transferred from client to server

Specified by:
bytesTransferred in interface StreamUtils.Listener
Parameters:
bytes - the bytes transferred from client to server
Returns:
boolean true to continue the transfer, false to stop it

setName

public void setName(java.lang.String name)
Sets the name of the ChangePackage for this session.

Parameters:
name - the name of the ChangePackage for this session

getName

public java.lang.String getName()
Returns the name of the ChangePackage for this session. May return null, if a name has not yet been set

Returns:
the name of the ChangePackage


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.