com.starteam
Class ChangeSession

java.lang.Object
  extended by com.starteam.ChangeSession
Direct Known Subclasses:
Session

public abstract class ChangeSession
extends java.lang.Object

A change session, possibly associated with a change package.


Method Summary
 void close()
          Closes this change session, and releases the exclusive lock on the corresponding change package, if necessary.
 void close(boolean unlock)
          Closes this change session, optionally releasing the exclusive lock on the corresponding change package.
abstract  void connect(Server server)
          Connects a restored session to a server instance.
 ChangePackage getChangePackage()
          Returns the change package associated with this session, or null if the session has not yet been committed or saved in an active state.
abstract  java.lang.String getDefaultName()
          Gets a default name for this session.
 java.lang.String getDescription()
          Returns the description of the ChangePackage for this session.
abstract  int getLockCount()
          Gets the number of source or target items that are currently locked on behalf of this session.
 java.lang.String getName()
          Returns the name of the ChangePackage for this session.
abstract  View getSourceView()
          Gets the source view associated with this session.
abstract  View getTargetView()
          Gets the target view associated with this session.
abstract  boolean hasLocks()
          Determines whether any source or target items are currently locked on behalf of this session.
abstract  boolean isActive()
          Returns true if this session is in an active state.
abstract  boolean isCommitted()
          Returns true if this session is in a committed state.
 boolean isReadOnly()
          Returns true if this session is read-only; false otherwise.
abstract  void removeLocks()
          Unlocks any source or target items that were locked on behalf of this session.
abstract  void restart(Server server)
          Restart this session The session is opened for writing, and is ready to re-run a compare in the current context of the source and target views
 ChangePackage save()
          Saves the current state of this session.
 void setDescription(java.lang.String description)
          Sets the description of the ChangePackage for this session.
 void setName(java.lang.String name)
          Sets the name of the ChangePackage for this session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

restart

public abstract void restart(Server server)
Restart this session The session is opened for writing, and is ready to re-run a compare in the current context of the source and target views

Parameters:
server - the server instance on which this session will run
See Also:
ChangeSession.connect(Server)

connect

public abstract void connect(Server server)
Connects a restored session to a server instance.

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);
     . . .
 

Parameters:
server - The server instance to be connected. The server must refer to the same StarTeam repository with which the session was created.

isReadOnly

public boolean isReadOnly()
Returns true if this session is read-only; false otherwise.

Returns:
boolean

getChangePackage

public ChangePackage getChangePackage()
Returns the change package associated with this session, or null if the session has not yet been committed or saved in an active state.

Returns:
ChangePackage

getName

public java.lang.String getName()
Returns the name of the ChangePackage for this session. If no name has been set, returns a proposed default name.

Returns:
The name of the ChangePackage for this session, or a proposed default name.

setName

public void setName(java.lang.String name)
Sets the name of the ChangePackage for this session. If no ChangePackage has yet been created, creates a new one and sets its name. This method is only useful for servers that support ChangePackages, which were introduced in StarTeam 11.0.

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

getDescription

public java.lang.String getDescription()
Returns the description of the ChangePackage for this session. If no description has been set, returns a proposed default description.

Returns:
The description of the ChangePackage for this session, or a proposed default description.

setDescription

public void setDescription(java.lang.String description)
Sets the description of the ChangePackage for this session. If no ChangePackage has yet been created, creates a new one and sets its description. This method is only useful for servers that support ChangePackages, which were introduced in StarTeam 11.0.

Parameters:
description - the description of this ChangePackage for this session.

save

public ChangePackage save()
Saves the current state of this session. The session must be in an active state. If the session was not previously saved, a new active change package is created.


getDefaultName

public abstract java.lang.String getDefaultName()
Gets a default name for this session. The name is suitable, for example, as a file name.

Returns:
A default name for this session.

isActive

public abstract boolean isActive()
Returns true if this session is in an active state.

Returns:
boolean

isCommitted

public abstract boolean isCommitted()
Returns true if this session is in a committed state.

Returns:
boolean

getTargetView

public abstract View getTargetView()
Gets the target view associated with this session.

Returns:
The target view associated with this session.
See Also:
ChangeSession.getSourceView()

getSourceView

public abstract View getSourceView()
Gets the source view associated with this session.

Returns:
The source view associated with this session.
See Also:
ChangeSession.getTargetView()

hasLocks

public abstract boolean hasLocks()
Determines whether any source or target items are currently locked on behalf of this session. If the session has been restored but is still in a disconnected state, hasLocks will inspect the internal XML representation of the session to determine whether or not items are currently locked

Returns:
true if any source or target items are currently locked on behalf of this session.
See Also:
ChangeSession.getLockCount(), ChangeSession.removeLocks()

getLockCount

public abstract int getLockCount()
Gets the number of source or target items that are currently locked on behalf of this session. If the session has been restored but is still in a disconnected state, getLockCount will inspect the internal XML representation of the session to determine the number of items currently locked

Returns:
The number of source or target items that are currently locked on behalf of this session.
See Also:
ChangeSession.hasLocks(), ChangeSession.removeLocks()

removeLocks

public abstract void removeLocks()
Unlocks any source or target items that were locked on behalf of this session. If the session is in a disconnected state removeLocks will inspect the XML representation of the session to identify and unlock the locked items

See Also:
ChangeSession.hasLocks(), ChangeSession.getLockCount(), ChangeSession.getSourceView(), ChangeSession.getTargetView()

close

public void close()
Closes this change session, and releases the exclusive lock on the corresponding change package, if necessary.


close

public void close(boolean unlock)
Closes this change session, optionally releasing the exclusive lock on the corresponding change package.

Parameters:
unlock - true to unlock the corresponding change package.


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