com.perforce.api
Class Client

java.lang.Object
  extended by com.perforce.api.SourceControlObject
      extended by com.perforce.api.Mapping
          extended by com.perforce.api.Client
All Implemented Interfaces:
Cacheable, java.lang.Comparable

public final class Client
extends Mapping

Representation of a source control client. This class can be used to retrieve and hold p4 client information. It's class methods can be used to list all loaded clients or list those beginning with a particular prefix. Before these class methods are called, the class method loadClients() must be called to ensure the client list is up to date.

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

Constructor Summary
Client()
          Default no-argument constructor.
Client(Env env, java.lang.String name)
          Constructor that is passed the client name.
Client(java.lang.String name)
          Constructor that is passed the client name.
 
Method Summary
 void commit()
          Stores this object back into Perforce, creating it if it didn't already exist.
 HashDecay getCache()
          Returns the HashDecay instance for this class
static Client getClient(Env env, java.lang.String name)
          Returns a Client with the specified name, or null if not found.
static Client getClient(java.lang.String name)
          Returns a Client with the specified name, or null if not found.
static java.util.Iterator getClientIterator(Env env)
           
static java.util.Enumeration getClients()
          Deprecated.  
static java.util.Enumeration getClients(Env env)
           
 java.lang.String getOptions()
          Returns the Client options.
 java.lang.String getRoot()
          Returns the Client root.
static void loadClients()
          Loads a list of all the clients into an internal class Hashtable.
static void loadClients(Env env)
          Loads a list of all the clients into an internal class Hashtable.
static java.util.Enumeration lookupClient(Env env, java.lang.String prefix)
          Returns a list of clients that begin with the specified prefix.
static java.util.Enumeration lookupClient(java.lang.String prefix)
          Returns a list of clients that begin with the specified prefix.
static void main(java.lang.String[] argv)
          Deprecated. Actually in use, but this keeps it out of the docs.
 void setOptions(java.lang.String options)
          Sets the options for the Client.
 void setRoot(java.lang.String root)
          Sets the root for the Client.
 void store()
          Deprecated. Use commit() instead.
 void sync()
          Brings this object back into sync with Perforce.
 void sync(java.lang.String name)
          Synchronizes the Client with the latest information from P4.
 java.lang.String toXML()
          Returns a string containing the object in XML form.
 
Methods inherited from class com.perforce.api.Mapping
addView, addView, compareTo, getDescription, getName, getOwner, getView, getViews, lookupMappings, setDescription, setName, setOwner, toString
 
Methods inherited from class com.perforce.api.SourceControlObject
clearCache, getEnv, getSyncTime, getUpdateTime, inSync, invalidate, outOfSync, refreshUpdateTime, setEnv
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Client

public Client()
Default no-argument constructor.


Client

public Client(java.lang.String name)
Constructor that is passed the client name.


Client

public Client(Env env,
              java.lang.String name)
Constructor that is passed the client name.

Method Detail

getCache

public HashDecay getCache()
Description copied from class: SourceControlObject
Returns the HashDecay instance for this class

Specified by:
getCache in interface Cacheable
Specified by:
getCache in class SourceControlObject

setOptions

public void setOptions(java.lang.String options)
Sets the options for the Client.

Parameters:
options - Options of the client.

getOptions

public java.lang.String getOptions()
Returns the Client options.


setRoot

public void setRoot(java.lang.String root)
Sets the root for the Client.

Parameters:
root - Root of the client.

getRoot

public java.lang.String getRoot()
Returns the Client root.


getClient

public static Client getClient(Env env,
                               java.lang.String name)
Returns a Client with the specified name, or null if not found. It is important to keep in mind that the Client returned may not hold valid information, other than its name. To ensure the Client has valid information, the sync() method must be called.

Parameters:
name - Name of the client to find.

getClient

public static Client getClient(java.lang.String name)
Returns a Client with the specified name, or null if not found.

See Also:
getClient(Env, String)

lookupClient

public static java.util.Enumeration lookupClient(Env env,
                                                 java.lang.String prefix)
Returns a list of clients that begin with the specified prefix.

Parameters:
env - P4 environment to use.
prefix - Prefix for all clients to be returned.
Returns:
List of clients matching the prefix.

lookupClient

public static java.util.Enumeration lookupClient(java.lang.String prefix)
Returns a list of clients that begin with the specified prefix.

Parameters:
prefix - Prefix for all clients to be returned
Returns:
List of clients matching the prefix.

getClients

public static java.util.Enumeration getClients()
Deprecated. 

Returns a list of all the clients currently loaded.

Returns:
List of all clients currently loaded.

getClients

public static java.util.Enumeration getClients(Env env)
Parameters:
env - Environment to use when working with P4
Returns:
Enumeration of all clients currently loaded.

getClientIterator

public static java.util.Iterator getClientIterator(Env env)
Parameters:
env - Environment to use when working with P4
Returns:
Iterator for all clients currently loaded.

loadClients

public static void loadClients()
Loads a list of all the clients into an internal class Hashtable. This method will only be called by the class itself if the Hashtable is empty. Users should call this method if they believe the p4 client information needs to be brought up to date.

See Also:
Hashtable

loadClients

public static void loadClients(Env env)
Loads a list of all the clients into an internal class Hashtable.

Parameters:
env - Source conrol environment to use.
See Also:
loadClients()

store

public void store()
           throws CommitException
Deprecated. Use commit() instead.

Stores the client information back into p4, creating the client if it didn't already exist.

Throws:
CommitException

commit

public void commit()
            throws CommitException
Description copied from class: SourceControlObject
Stores this object back into Perforce, creating it if it didn't already exist.

Specified by:
commit in interface Cacheable
Specified by:
commit in class Mapping
Throws:
CommitException

sync

public void sync()
Description copied from class: SourceControlObject
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
Specified by:
sync in class SourceControlObject

sync

public void sync(java.lang.String name)
Synchronizes the Client with the latest information from P4. This method forces the Client to contain the latest, correct information if it didn't already.

Specified by:
sync in class Mapping
Parameters:
name - Name of the Client to synchronize.

toXML

public java.lang.String toXML()
Description copied from class: SourceControlObject
Returns a string containing the object in XML form.

Overrides:
toXML in class Mapping

main

public static void main(java.lang.String[] argv)
Deprecated. Actually in use, but this keeps it out of the docs.

Used for testing.



Copyright © 2009. All Rights Reserved.