Perforce

com.perforce.api
Class FileEntry

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

public final class FileEntry
extends SourceControlObject

Representation of a source control file.

Version:
$Date: 2001/11/02 $ $Revision: #1 $
Author:
David Markley
See Also:
Hashtable

Constructor Summary
FileEntry()
          Default no-argument constructor.
FileEntry(Env env)
           
FileEntry(Env env, String p)
           
FileEntry(String p)
           
 
Method Summary
 void commit()
          No-op.
static String customizePath(String str, char from_char, char to_char)
           
static String depotizePath(String str)
           
 HashDecay getCache()
           
 String getClientPath()
           
 String getDepotPath()
           
 String getDescription()
           
static FileEntry getFile(String p)
          Gets the file information for the specified path.
 String getFileContents()
           
 String getFileContents(Env env, String path)
           
static Vector getFileLog(Env env, String path)
           
static Vector getFiles(Env env, String path)
           
 int getHaveRev()
           
 String getHeadAction()
           
 int getHeadChange()
           
 String getHeadDate()
           
 int getHeadRev()
           
 long getHeadTime()
           
 String getHeadTimeString()
           
 String getHeadType()
           
 String getName()
           
static Vector getOpened()
           
static Vector getOpened(Env env, boolean stat)
           
static Vector getOpened(Env env, boolean stat, boolean all, int changelist, Vector files)
           
 String getOwner()
           
 FileEntry getSource()
           
static String HTMLEncode(String str)
           
static String localizePath(String str)
           
 void obtainLock()
           
 void openForAdd()
           
 void openForAdd(Change chng)
           
static FileEntry openForAdd(Env env, String path, Change chng)
          Opens the file on the path for add under the change.
 void openForEdit()
           
 void openForEdit(boolean force, boolean lock)
           
 void openForEdit(boolean force, boolean lock, Change chng)
           
static FileEntry openForEdit(Env env, String path, boolean sync, boolean force, boolean lock, Change chng)
          Opens the file on the path for edit under the change.
 String resolve(boolean force)
           
static String resolveAll(Env env, String flags, String path)
           
static String resolveAT(Env env, Enumeration en)
           
 boolean revert()
           
 void setClientPath(String p)
          Sets the client path for this file.
 void setDepotPath(String p)
          Sets the depot path for this file.
 void setDescription(String d)
           
 void setHaveRev(int rev)
           
 void setHeadAction(String action)
           
 void setHeadChange(int change)
           
 void setHeadDate(String d)
           
 void setHeadRev(int rev)
           
 void setHeadTime(long time)
           
 void setHeadType(String type)
           
 void setOwner(String o)
           
 void setSource(FileEntry fent)
           
 void sync()
          Synchronizes the user information with P4.
 String syncMySpace(Env env, String path)
           
static void syncWorkspace(Env env, String path)
           
 String toString()
          if (l.trim().equals("")) { if (null != nfe.getDepotPath() && (! (igndel && nfe.getHeadAction().equals("delete")))) { v.addElement(nfe); } if (null == fe) { nfe = new FileEntry(); nfe.setEnv(p.getEnv()); } } if (l.startsWith("#")) { continue; } if (l.startsWith("...
 
Methods inherited from class com.perforce.api.SourceControlObject
clearCache, getEnv, getSyncTime, getUpdateTime, inSync, invalidate, outOfSync, refreshUpdateTime, setEnv, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileEntry

public FileEntry()
Default no-argument constructor.

FileEntry

public FileEntry(Env env)

FileEntry

public FileEntry(Env env,
                 String p)

FileEntry

public FileEntry(String p)
Method Detail

commit

public void commit()
No-op. This makes no sense for a FileEntry.
Overrides:
commit in class SourceControlObject

customizePath

public static String customizePath(String str,
                                   char from_char,
                                   char to_char)

depotizePath

public static String depotizePath(String str)

getCache

public HashDecay getCache()
Overrides:
getCache in class SourceControlObject

getClientPath

public String getClientPath()

getDepotPath

public String getDepotPath()

getDescription

public String getDescription()

getFile

public static FileEntry getFile(String p)
Gets the file information for the specified path.
Parameters:
p - Path of the file to gather information about.

getFileContents

public String getFileContents()

getFileContents

public String getFileContents(Env env,
                              String path)

getFileLog

public static Vector getFileLog(Env env,
                                String path)

getFiles

public static Vector getFiles(Env env,
                              String path)

getHaveRev

public int getHaveRev()

getHeadAction

public String getHeadAction()

getHeadChange

public int getHeadChange()

getHeadDate

public String getHeadDate()

getHeadRev

public int getHeadRev()

getHeadTime

public long getHeadTime()

getHeadTimeString

public String getHeadTimeString()

getHeadType

public String getHeadType()

getName

public String getName()

getOpened

public static Vector getOpened()

getOpened

public static Vector getOpened(Env env,
                               boolean stat)

getOpened

public static Vector getOpened(Env env,
                               boolean stat,
                               boolean all,
                               int changelist,
                               Vector files)

getOwner

public String getOwner()

getSource

public FileEntry getSource()

HTMLEncode

public static String HTMLEncode(String str)

localizePath

public static String localizePath(String str)

obtainLock

public void obtainLock()
                throws Exception

openForAdd

public void openForAdd()
                throws Exception

openForAdd

public void openForAdd(Change chng)
                throws Exception

openForAdd

public static FileEntry openForAdd(Env env,
                                   String path,
                                   Change chng)
                            throws Exception
Opens the file on the path for add under the change. If the change is null, the file is opened under the default changelist.
Parameters:
env - P4 Environment
path - Depot or client path to the file being opened for add.
chng - The change that the file will be opened for add in.

openForEdit

public void openForEdit()
                 throws Exception

openForEdit

public void openForEdit(boolean force,
                        boolean lock)
                 throws Exception

openForEdit

public void openForEdit(boolean force,
                        boolean lock,
                        Change chng)
                 throws Exception

openForEdit

public static FileEntry openForEdit(Env env,
                                    String path,
                                    boolean sync,
                                    boolean force,
                                    boolean lock,
                                    Change chng)
                             throws Exception
Opens the file on the path for edit under the change. If the change is null, the file is opened under the default changelist.
Parameters:
env - P4 Environment
path - Depot or client path to the file being opened for edit.
sync - If true, the file will be sync'd before opened for edit.
force - If true, the file will be opened for edit even if it isn't the most recent version.
lock - If true, the file will be locked once opened.
chng - The change that the file will be opened for edit in.

resolve

public String resolve(boolean force)
               throws IOException

resolveAll

public static String resolveAll(Env env,
                                String flags,
                                String path)
                         throws IOException

resolveAT

public static String resolveAT(Env env,
                               Enumeration en)
                        throws IOException

revert

public boolean revert()

setClientPath

public void setClientPath(String p)
Sets the client path for this file.
Parameters:
p - path for this file on the client system.

setDepotPath

public void setDepotPath(String p)
Sets the depot path for this file.
Parameters:
p - path for this file in the depot.

setDescription

public void setDescription(String d)

setHaveRev

public void setHaveRev(int rev)

setHeadAction

public void setHeadAction(String action)

setHeadChange

public void setHeadChange(int change)

setHeadDate

public void setHeadDate(String d)

setHeadRev

public void setHeadRev(int rev)

setHeadTime

public void setHeadTime(long time)

setHeadType

public void setHeadType(String type)

setOwner

public void setOwner(String o)

setSource

public void setSource(FileEntry fent)

sync

public void sync()
Synchronizes the user information with P4. This method must be called to ensure that this contains the latest information from p4.
Overrides:
sync in class SourceControlObject

syncMySpace

public String syncMySpace(Env env,
                          String path)
                   throws IOException

syncWorkspace

public static void syncWorkspace(Env env,
                                 String path)
                          throws IOException

toString

public String toString()
if (l.trim().equals("")) { if (null != nfe.getDepotPath() && (! (igndel && nfe.getHeadAction().equals("delete")))) { v.addElement(nfe); } if (null == fe) { nfe = new FileEntry(); nfe.setEnv(p.getEnv()); } } if (l.startsWith("#")) { continue; } if (l.startsWith("... clientFile ")) { nfe.setClientPath(l.substring(15).trim()); } else if (l.startsWith("... depotFile ")) { nfe.setDepotPath(l.substring(14).trim()); } else if (l.startsWith("... headType ")) { nfe.setHeadType(l.substring(13).trim()); } else if (l.startsWith("... headTime ")) { nfe.setHeadTime(Long.valueOf(l.substring(13).trim()).longValue()); } else if (l.startsWith("... headChange ")) { nfe.setHeadChange(Integer.valueOf(l.substring(15).trim()).intValue()); } else if (l.startsWith("... headRev ")) { nfe.setHeadRev(Integer.valueOf(l.substring(12).trim()).intValue()); } else if (l.startsWith("... haveRev ")) { nfe.setHaveRev(Integer.valueOf(l.substring(12).trim()).intValue()); } else if (l.startsWith("... headAction ")) { nfe.setHeadAction(l.substring(15).trim()); } else if (l.startsWith("... otherOpen ")) { //other_cnt = (Integer.valueOf(l.substring(14).trim())).intValue(); }
Overrides:
toString in class Object

Perforce

Copyright © 2001, Perforce Software, All rights reserved.