com.starteam
Class File.WebCacheFile

java.lang.Object
  extended by com.starteam.LiveObject.WebCacheLiveObject
      extended by com.starteam.TrackedObject.WebCacheTrackedObject
          extended by com.starteam.VersionedObject.WebCacheVersionedObject
              extended by com.starteam.ViewMember.WebCacheViewMember
                  extended by com.starteam.Item.WebCacheItem
                      extended by com.starteam.File.WebCacheFile
All Implemented Interfaces:
ArtifactCacheManager.Securable
Enclosing class:
File

public static class File.WebCacheFile
extends Item.WebCacheItem

File accessor for cached SDK Items contained objects are obtained from the artifact cache


Method Summary
static File.WebCacheFile create(ArtifactCacheManager.Context cntxt, Folder.WebCacheFolder parent)
          Creates a File on the server.
 java.lang.String getArchiveName()
          The file name of this file's archive file in the vault.
 File.CharacterSet getCharacterSet()
          Gets the character set used by this file.
 File.Compression getCompression()
          Gets the compression level of the archive file in the vault.
 DateTime getContentModifiedTime()
          Gets the "last modified" time of the working file when it was checked in to create this version.
 int getContentVersion()
          Gets the content version number for this file.
 java.lang.String getDescription()
          Returns the description of this file.
 File.EOLFormat getEOLFormat()
          Gets the end-of-line format used by this file's working files on disk.
 java.lang.String getExtension()
          Returns the file name extension.
 int getHiveID()
          Gets the ID of the hive where the archive file is stored in the vault.
 File.KeywordFlag getKeywordFlag()
          returns the KeywordFlag property value for this File
 MD5 getMD5()
          The MD5 of the file contents for this version.
 File.WebCacheFile getMergeVersion(File.WebCacheWorkSpaceSync localSync)
          Returns a revision from this file's history that represents the most recent common ancestor of this file with the last known revision on disk.
 java.lang.String getName()
          Returns the name of this file.
 long getSize()
          The size of this file in the repository.
static File.Status getStatus(File.WebCacheWorkSpaceSync remoteSync, File.WebCacheWorkSpaceSync localSync, long size, DateTime lastModified)
          return a computed Status for a file based on the local and remote Workspace sync's specified via this interface The local Sync record is expected to have been pulled from the sync database on the client machine, the remote Sync record is expected to have been pulled from a web server surfacing web cache file objects the two sync objects are expected to be mapped to each other by fully qualified path to file name.
static File.Status getStatus(File.WebCacheWorkSpaceSync remoteSync, File.WebCacheWorkSpaceSync localSync, MD5 md5)
          return a computed Status for a file based on the local and remote Workspace sync's specified via this interface The local Sync record is expected to have been pulled from the sync database on the client machine, the remote Sync record is expected to have been pulled from a web server surfacing web cache file objects the two sync objects are expected to be mapped to each other by fully qualified path to file name.
 File.Status getStatus(File.WebCacheWorkSpaceSync sync, long size, DateTime lastModified)
          return a computed Status for this file based on the current state of the file in memory (that is representative of the content saved in the repository) and a WorkSpace Sync specified via this interface.
 File.Status getStatus(File.WebCacheWorkSpaceSync sync, MD5 md5)
          return a computed Status for this file based on the current state of the file in memory (that is representative of the content saved in the repository) and a WorkSpace Sync specified via this interface.
 boolean getUsesKeywords()
          Tells whether or not this file will use keyword expansion.
 int getVaultVersion()
          Returns the vault version number for this file.
 File.WebCacheWorkSpaceSync getWorkspaceSync()
          Returns a workspace sync representing this file's content as checked into the repository Note that this sync record need not match the sync record for the file itself on disk The file, in this case, would be in a users workspace on a file system with no direct access to the StarTeam server.
 boolean isBinary()
          Tells whether this file (in the repository) has been determined to be a binary file.
 boolean isExecutable()
          Determines whether or not this file has been marked executable in the repository.
 boolean isUnicode()
          Tells whether this file (in the repository) has been determined to be a UNICODE file.
 void setCharacterSet(File.CharacterSet s)
          Sets the character set used by this file.
 void setContentModifiedTime(DateTime time)
          Sets this file's content modification time.
 void setDescription(java.lang.String description)
          Sets the description of this file.
 void setEOLFormat(File.EOLFormat format)
          Sets the end-of-line format used by this file's working files on disk.
 void setExecutable(boolean isExecutable)
          Determines whether or not this file has been marked executable in the repository.
 void setName(java.lang.String name)
          Set the name of this file
 
Methods inherited from class com.starteam.Item.WebCacheItem
create, getLabels, getLinks, getParentFolder, moveTo, moveTo
 
Methods inherited from class com.starteam.ViewMember.WebCacheViewMember
getAttachments, getComment, getDisplayValue, getDotNotation, getExternalID, getExternalURL, getHistory, getLocker, getPresentationID, getRights, getShareTree, getTraces, getView, isDeleted, isFloating, isPinned, isUnread, lock, lock, modifyReadStatus, pinTo, setAttachments, setExternalID, setExternalURL, setRights, unlock, unpin, updateRevisionComment
 
Methods inherited from class com.starteam.VersionedObject.WebCacheVersionedObject
getRevisionNumber, getRootObjectID, getViewVersion, isFromHistory
 
Methods inherited from class com.starteam.TrackedObject.WebCacheTrackedObject
getModifiedBy, getModifiedTime
 
Methods inherited from class com.starteam.LiveObject.WebCacheLiveObject
addTo, equals, getContext, getCreatedBy, getCreatedTime, getDisplayName, getID, getObjectID, getServer, getType, getValue, getValue, hashCode, hasValue, isDirty, isNew, refresh, remove, removeFrom, setValue, setValue, toStarTeamURL, update
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static File.WebCacheFile create(ArtifactCacheManager.Context cntxt,
                                       Folder.WebCacheFolder parent)
Creates a File on the server. This file may be saved by assigning the various properties and then calling update() on the WebCacheItem object, or it may be added to a WebCacheViewMemberCollection, which is then saved in a transacted context.

Parameters:
cntxt - the ArtifactCacheManager User Session Context
parent - the parent folder in which this new file will be created. The parent folder should be from the artifact cache
Returns:
the newly created File.WebCacheFile, wrapping a new File

getStatus

public static File.Status getStatus(File.WebCacheWorkSpaceSync remoteSync,
                                    File.WebCacheWorkSpaceSync localSync,
                                    MD5 md5)
return a computed Status for a file based on the local and remote Workspace sync's specified via this interface The local Sync record is expected to have been pulled from the sync database on the client machine, the remote Sync record is expected to have been pulled from a web server surfacing web cache file objects the two sync objects are expected to be mapped to each other by fully qualified path to file name.

Parameters:
remoteSync - a sync record extracted from a web server surfacing web cache file objects
localSync - a sync record extracted from a syncdb on an end user's local machine
md5 - the md5 of the disk file that maps the two sync records to each other
Returns:
the computed status of the disk file
See Also:
File.WebCacheFile.getWorkspaceSync()

getStatus

public static File.Status getStatus(File.WebCacheWorkSpaceSync remoteSync,
                                    File.WebCacheWorkSpaceSync localSync,
                                    long size,
                                    DateTime lastModified)
return a computed Status for a file based on the local and remote Workspace sync's specified via this interface The local Sync record is expected to have been pulled from the sync database on the client machine, the remote Sync record is expected to have been pulled from a web server surfacing web cache file objects the two sync objects are expected to be mapped to each other by fully qualified path to file name.

Parameters:
remoteSync - a sync record extracted from a web server surfacing web cache file objects
localSync - a sync record extracted from a syncdb on an end user's local machine
size - the size of the disk file that maps the two sync records to each other
lastModified - the last modified time of the disk file that maps the two sync records to each other
Returns:
the computed status of the disk file
See Also:
File.WebCacheFile.getWorkspaceSync()

setName

public void setName(java.lang.String name)
Set the name of this file

Parameters:
name - the name of this file

getName

public java.lang.String getName()
Returns the name of this file. This is the name only--contrast with getFullName.

Returns:
the name of this file
See Also:
File.getFullName(), LiveObject.Type.NameProperty, File.Type.PropertyCollection.NAME

getSize

public long getSize()
The size of this file in the repository. Note that this may be different than the size of the local file if end-of-line conversion or keyword expansion is used.

Returns:
the size of this file in the repository
See Also:
File.Type.SizeProperty, File.Type.PropertyCollection.SIZE

getArchiveName

public java.lang.String getArchiveName()
The file name of this file's archive file in the vault.

Returns:
The file name of this file's archive file in the vault.
See Also:
File.Type.ArchiveNameProperty, File.Type.PropertyCollection.ARCHIVE_NAME

getHiveID

public int getHiveID()
Gets the ID of the hive where the archive file is stored in the vault.

Returns:
The ID of the hive where the archive file is stored in the vault.
See Also:
File.Type.HiveProperty, File.Type.PropertyCollection.HIVE

getKeywordFlag

public File.KeywordFlag getKeywordFlag()
returns the KeywordFlag property value for this File

Returns:
the value of the KeywordFlag property
See Also:
File.Type.KeywordFlagProperty, File.Type.PropertyCollection.KEYWORD_FLAG

getMD5

public MD5 getMD5()
The MD5 of the file contents for this version. This is the value for the file contents in the repository which may differ from that of the corresponding file on disk if end-of-line or keyword expansion has been applied.

Returns:
the MD5 has bytes of the repository contents of this file
See Also:
File.Type.MD5Property, File.Type.PropertyCollection.MD5, MD5

getCompression

public File.Compression getCompression()
Gets the compression level of the archive file in the vault.

Returns:
The compression level of the archive file in the vault.
See Also:
File.Compression, File.Type.CompressionProperty, File.Type.PropertyCollection.COMPRESSION

getCharacterSet

public File.CharacterSet getCharacterSet()
Gets the character set used by this file.

Returns:
The character set used by this file, or null if it is unknown.
See Also:
File.WebCacheFile.isBinary(), File.WebCacheFile.isUnicode(), File.Type.CharacterSetProperty, File.Type.PropertyCollection.CHARACTER_SET

setCharacterSet

public void setCharacterSet(File.CharacterSet s)
Sets the character set used by this file. The character set is normally determined automatically if it has not yet been specified by the time the file is checked in.

Parameters:
s - The character set. May not be null.
See Also:
File.Type.CharacterSetProperty, File.Type.PropertyCollection.CHARACTER_SET

getEOLFormat

public File.EOLFormat getEOLFormat()
Gets the end-of-line format used by this file's working files on disk. Supported only on StarTeam Server version 11.0 and later; on earlier servers, the value is always reported as null.

Returns:
The end-of-line format, or null if it has not yet been initialized.
See Also:
File.EOLFormat, File.Type.EOLFormatProperty, File.Type.PropertyCollection.EOL_FORMAT

getExtension

public java.lang.String getExtension()
Returns the file name extension. E.g. for "foo.txt" this would return "txt", for "foo" it would return the empty string.

Returns:
the file name extension.
See Also:
File.Type.ExtensionProperty.NAME

setEOLFormat

public void setEOLFormat(File.EOLFormat format)
Sets the end-of-line format used by this file's working files on disk. Supported only on StarTeam Server version 11.0 and later.

Parameters:
format - The end-of-line format. Must not be null.

isBinary

public boolean isBinary()
Tells whether this file (in the repository) has been determined to be a binary file. StarTeam flags a file as "binary" if any null (0x0) characters are found in the file.

Returns:
true if this repository file has been determined to be binary
See Also:
FileUtils.isBinary(java.io.File)

isUnicode

public boolean isUnicode()
Tells whether this file (in the repository) has been determined to be a UNICODE file.

Returns:
true if this repository file has been determined to be UNICODE
See Also:
FileUtils.isUnicode(byte[], int)

isExecutable

public boolean isExecutable()
Determines whether or not this file has been marked executable in the repository. Note that this doesn't mean the working file on disk is executable.

Returns:
true if the file has been marked executable in the repository; false otherwise.
See Also:
File.Type.IsExecutableProperty, File.Type.PropertyCollection.IS_EXECUTABLE

setExecutable

public void setExecutable(boolean isExecutable)
Determines whether or not this file has been marked executable in the repository. Note that this doesn't mean the working file on disk is executable.

Parameters:
isExecutable - true if the file has been marked executable in the repository; false otherwise.
See Also:
File.Type.IsExecutableProperty, File.Type.PropertyCollection.IS_EXECUTABLE

getDescription

public java.lang.String getDescription()
Returns the description of this file.

Returns:
the description of this file
See Also:
LiveObject.Type.DescriptionProperty.NAME

setDescription

public void setDescription(java.lang.String description)
Sets the description of this file. To actually change the description in the repository you must call update() or one of the checkin methods.

Parameters:
description - the new description of this file
See Also:
LiveObject.Type.DescriptionProperty.NAME, LiveObject.WebCacheLiveObject.update()

getVaultVersion

public int getVaultVersion()
Returns the vault version number for this file. The vault revision number is really an implementation detail of the StarTeam vault and the value of this property is not of much general use.

Returns:
the vault version number for this file
See Also:
File.Type.VaultVersionProperty

getContentVersion

public int getContentVersion()
Gets the content version number for this file. The first revision of any file item will have a value of 1 for this property. The value only changes when a new revision of the file is checked-in for which the file contents or the file name has changed. This value does not increment if only meta properties are modified (for example, the description). When a file item branches the value of this property does not revert to 1 but rather continues to increase as new revisions are added. This value is maintained in order to make status computation easier and more "accurate" (for example, a file should not need checkout if only its description changed).

Returns:
The content version number for this file
See Also:
File.Type.ContentVersionProperty, File.Type.PropertyCollection.CONTENT_VERSION, File.WebCacheFile.getStatus(com.starteam.File.WebCacheWorkSpaceSync, com.starteam.File.WebCacheWorkSpaceSync, com.starteam.util.MD5)

getMergeVersion

public File.WebCacheFile getMergeVersion(File.WebCacheWorkSpaceSync localSync)
Returns a revision from this file's history that represents the most recent common ancestor of this file with the last known revision on disk. It may return null if the status is Unknown or if the sync version is not from the same version graph.

Parameters:
localSync - a sync record extracted from a syncdb on an end user's local machine
Returns:
the most recent common ancestor of this file and the last known version of this file on disk.

getContentModifiedTime

public DateTime getContentModifiedTime()
Gets the "last modified" time of the working file when it was checked in to create this version. Note that this value comes from the local machine where the checkin occured.

Returns:
The "last modified" time of the working file when this revision was checked in.
See Also:
File.Type.PropertyCollection.CONTENT_MODIFIFIED_TIME, File.WebCacheFile.setContentModifiedTime(DateTime)

setContentModifiedTime

public void setContentModifiedTime(DateTime time)
Sets this file's content modification time. You need to call update to persist this information. Note that the content modification time is automatically set by CheckinManager if file content is added or changed, from the file on disk last modified time However, this api may be explicitly used if an application chooses to update file properties directly without any content change

Parameters:
time - the content modification time for this file
See Also:
File.Type.PropertyCollection.CONTENT_MODIFIFIED_TIME, File.WebCacheFile.getContentModifiedTime()

getWorkspaceSync

public File.WebCacheWorkSpaceSync getWorkspaceSync()
Returns a workspace sync representing this file's content as checked into the repository Note that this sync record need not match the sync record for the file itself on disk The file, in this case, would be in a users workspace on a file system with no direct access to the StarTeam server. Sync information would be negotiated between the client http application and a web server surfacing web cache objects and with direct access to the StarTeam server

Returns:
a workspace sync representing the content as checked into the repository
See Also:
FileBasedStatusManager

getStatus

public File.Status getStatus(File.WebCacheWorkSpaceSync sync,
                             MD5 md5)
return a computed Status for this file based on the current state of the file in memory (that is representative of the content saved in the repository) and a WorkSpace Sync specified via this interface. The Sync record is expected to have been pulled from the sync database on the client machine, negotiated directly between the client http application and a web server surfacing web cache objects (and with direct access to the StarTeam server) Note that applications may find a file with a specific root object id or object id or name by iterating through all the cached files in a given folder Applications may find a folder with a fully qualified path by iterating through all the folders in a given view

Parameters:
sync - the sync to test against
md5 - the MD5 of the working file on disk (which may be different from the md5 stored in the sync database and/or the md5 of the file in the repository)
Returns:
the expected status of this file w.r.t. content in the repository
See Also:
FileBasedStatusManager, File.Status

getUsesKeywords

public boolean getUsesKeywords()
Tells whether or not this file will use keyword expansion. This is determined by looking at the project's keyword properties and this file's extension.

Returns:
true if this file uses keyword expansion
Throws:
DisembodiedException - if this File is disembodied
See Also:
ViewMember.isDisembodied()

getStatus

public File.Status getStatus(File.WebCacheWorkSpaceSync sync,
                             long size,
                             DateTime lastModified)
return a computed Status for this file based on the current state of the file in memory (that is representative of the content saved in the repository) and a WorkSpace Sync specified via this interface. The Sync record is expected to have been pulled from the sync database on the client machine, negotiated directly between the client http application and a web server surfacing web cache objects (and with direct access to the StarTeam server) Note that applications may find a file with a specific root object id or object id or name by iterating through all the cached files in a given folder Applications may find a folder with a fully qualified path by iterating through all the folders in a given view

Parameters:
sync - the sync to test against
size - the size of the working file on disk (which may be different from the size stored in the sync database and/or the size of the file in the repository)
lastModified - the last modified time of the working file on disk (which may be different from the last modified time stored in the sync database and/or the last modified time of the file in the repository)
Returns:
the expected status of this file w.r.t. content in the repository
See Also:
FileBasedStatusManager, File.Status


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