Perforce

com.perforce.api
Class SourceControlObject

java.lang.Object
  |
  +--com.perforce.api.SourceControlObject
All Implemented Interfaces:
Cacheable
Direct Known Subclasses:
Change, Counter, DirEntry, FileEntry, Job, Mapping, User

public abstract class SourceControlObject
extends Object
implements Cacheable

An abstract base class for all source control objects.

Version:
$Date: 2002/08/05 $ $Revision: #6 $
Author:
David Markley

Constructor Summary
SourceControlObject()
          Default, no-argument constructor.
SourceControlObject(Env env)
          Constructor that takes an environment for this object to use.
 
Method Summary
 void clearCache()
          Removes any cached objects.
abstract  void commit()
          Stores this object back into Perforce, creating it if it didn't already exist.
abstract  HashDecay getCache()
          Returns the HashDecay instance for this class
 Env getEnv()
          Returns the P4 environment associated with this instance.
 long getSyncTime()
          Returns the time, in milliseconds, that this object was synchronized.
 long getUpdateTime()
          Returns the time, in milliseconds, for this object's last update.
 void inSync()
          Marks this object as being in in sync or valid.
 void invalidate()
          Invalidates this object.
 boolean outOfSync(long threshold)
          Tests this object to see if it is out of sync.
 void refreshUpdateTime()
          Sets the update time for this object to the current time.
 void setEnv(Env env)
          Sets the P4 environment to be used when working with this object.
abstract  void sync()
          Brings this object back into sync with Perforce.
abstract  String toXML()
          Returns a string containing the object in XML form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceControlObject

public SourceControlObject()
Default, no-argument constructor.

SourceControlObject

public SourceControlObject(Env env)
Constructor that takes an environment for this object to use.
Parameters:
env - source control environement to use.
Method Detail

clearCache

public void clearCache()
Removes any cached objects.
Specified by:
clearCache in interface Cacheable

commit

public abstract void commit()
                     throws CommitException
Stores this object back into Perforce, creating it if it didn't already exist.
Specified by:
commit in interface Cacheable

getCache

public abstract HashDecay getCache()
Returns the HashDecay instance for this class
Specified by:
getCache in interface Cacheable

getEnv

public Env getEnv()
Returns the P4 environment associated with this instance.
Returns:
P4 environment.

getSyncTime

public long getSyncTime()
Returns the time, in milliseconds, that this object was synchronized.
Specified by:
getSyncTime in interface Cacheable

getUpdateTime

public long getUpdateTime()
Returns the time, in milliseconds, for this object's last update.
Specified by:
getUpdateTime in interface Cacheable

inSync

public void inSync()
Marks this object as being in in sync or valid.
Specified by:
inSync in interface Cacheable

invalidate

public void invalidate()
Invalidates this object.
Specified by:
invalidate in interface Cacheable

outOfSync

public boolean outOfSync(long threshold)
Tests this object to see if it is out of sync. Checks to see if the expiration time is within the specified number of milliseconds.
Specified by:
outOfSync in interface Cacheable
Parameters:
threshold - Number of milliseconds.
Returns:
True if the object will be out of sync within the threshold.

refreshUpdateTime

public void refreshUpdateTime()
Sets the update time for this object to the current time.
Specified by:
refreshUpdateTime in interface Cacheable

setEnv

public void setEnv(Env env)
Sets the P4 environment to be used when working with this object. This environment is required to store, sync, or otherwise work with the P4 depot. It is passed to the P4Process used in each of these transactions.
Parameters:
env - user environment to use.
See Also:
Env, P4Process

sync

public abstract void sync()
                   throws PerforceException
Brings this object back into sync with Perforce. This also sets the sets the update and sync time for this object.
Specified by:
sync in interface Cacheable

toXML

public abstract String toXML()
Returns a string containing the object in XML form.

Perforce

Copyright © 2001, Perforce Software, All rights reserved.