Perforce

com.perforce.api
Class Label

java.lang.Object
  |
  +--com.perforce.api.SourceControlObject
        |
        +--com.perforce.api.Mapping
              |
              +--com.perforce.api.Label
All Implemented Interfaces:
Cacheable

public class Label
extends Mapping

Representation of a source control lablel. There are static class methods that can be used to list all P4 labels or to get a particular label.

Version:
$Date: 2002/01/23 $ $Revision: #3 $
Author:
David Markley

Constructor Summary
Label()
          Default no-argument constructor.
Label(String name)
          Constructor that is passed the label 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 Label getLabel(Env env, String name, boolean force)
          Returns a Label with the specified name, or null if not found.
static Label getLabel(String name)
          Returns a Label with the specified name, or null if not found.
static Enumeration getLabelNames(Env env)
           
static Enumeration getLabels()
           
static Enumeration getLabels(Env env)
           
static void loadLabels()
          Loads the list of labels using the default environment.
static void loadLabels(Env env)
          Loads a list of all the labels into an internal class HashDecay.
static Enumeration lookupLabels(String prefix)
          Returns a list of labels that begin with the specified prefix.
 void sync()
          Brings this object back into sync with Perforce.
 void sync(String name)
          Synchronizes the Label with the latest information from P4.
 String toXML()
          Returns a string containing the object in XML form.
 
Methods inherited from class com.perforce.api.Mapping
addView, addView, 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

Label

public Label()
Default no-argument constructor.

Label

public Label(String name)
Constructor that is passed the label name.
Method Detail

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.
Overrides:
commit in class Mapping

getCache

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

getLabel

public static Label getLabel(Env env,
                             String name,
                             boolean force)
Returns a Label with the specified name, or null if not found.
Parameters:
env - Environment to use when working with P4.
name - Name of the label to find.
force - Indicates that the Label should be sync'd.

getLabel

public static Label getLabel(String name)
Returns a Label with the specified name, or null if not found.
Parameters:
name - Name of the label to find.

getLabelNames

public static Enumeration getLabelNames(Env env)
Returns:
List of all label names (Enumeration of String instances).

getLabels

public static Enumeration getLabels()
Returns:
List of all labels (Enumeration of Label instances).

getLabels

public static Enumeration getLabels(Env env)
Parameters:
env - Environment to use when working with P4
Returns:
List of all labels (Enumeration of Label instances).

loadLabels

public static void loadLabels()
Loads the list of labels using the default environment.
See Also:
Env

loadLabels

public static void loadLabels(Env env)
Loads a list of all the labels into an internal class HashDecay. This method will only be called by the class itself if the HashDecay is empty. Users should call this method if they believe the p4 label information needs to be brought up to date.
Parameters:
env - Environment to use when working with P4
See Also:
HashDecay

lookupLabels

public static Enumeration lookupLabels(String prefix)
Returns a list of labels that begin with the specified prefix.
Parameters:
prefix - Prefix for all labels to be returned
Returns:
List of labels matching the prefix.

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.
Overrides:
sync in class SourceControlObject

sync

public void sync(String name)
Synchronizes the Label with the latest information from P4. This method forces the Label to contain the latest, correct information if it didn't already.
Overrides:
sync in class Mapping
Parameters:
name - Name of the Label to synchronize.

toXML

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

Perforce

Copyright © 2001, Perforce Software, All rights reserved.