org.tranche.project
Class ProjectFile

java.lang.Object
  extended by org.tranche.project.ProjectFile

public class ProjectFile
extends java.lang.Object

This represents a special file on Tranche that encapsulates the information about a directory upload.

Author:
Jayson Falkner - jfalkner@umich.edu, Bryan Smith - bryanesmith@gmail.com, James "Augie" Hill - augman85@gmail.com

Field Summary
static java.lang.String DEFAULT_PROJECT_FILE_NAME
          The default project file name
static java.lang.String OLD_PROJECT_FILE_NAME
          DO NOT CHANGE -- EVER
static java.lang.String VERSION_FOUR
          Identifies the fourth project file version.
static java.lang.String VERSION_LATEST
          Identifies the latest project file version.
static java.lang.String VERSION_ONE
          Identifies the first project file version.
static java.lang.String VERSION_THREE
          Identifies the third project file version.
static java.lang.String VERSION_TWO
          Identifies the second project file version.
 
Constructor Summary
ProjectFile()
           
 
Method Summary
 void addPart(ProjectFilePart pfp)
          Adds a project file part to this project.
 void calculateSize()
           
 void close()
          Closes off any resources that might be used.
static ProjectFile createFromFile(java.io.File file)
           
protected  void finalize()
          Destroys the disk backed project file part set.
 java.lang.String getDescription()
          Gets the description for this project file.
 BigHash getLicenseHash()
           
 java.lang.String getName()
          Gets the name for this project file.
 java.util.Set<ProjectFilePart> getParts()
          Gets the parts for this project file.
 java.math.BigInteger getSize()
          Gets the size on disk in bytes of the directory that this object represents.
 java.lang.String getVersion()
          Gets the version of this project file.
 boolean isSizeSet()
          Was the method called to set the size of the data set?
 void setDescription(java.lang.String description)
          Sets the description of this projet file.
 void setLicenseHash(BigHash licenseHash)
           
 void setName(java.lang.String name)
          Sets the name for this project file.
 void setParts(java.util.Set<ProjectFilePart> parts)
          Sets the parts for this project file.
protected  void setSize(java.math.BigInteger size)
           
 void setVersion(java.lang.String version)
          Sets the version of this project file.
 byte[] toByteArray()
           
 byte[] toByteArray(java.lang.String version)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROJECT_FILE_NAME

public static final java.lang.String DEFAULT_PROJECT_FILE_NAME

The default project file name

See Also:
Constant Field Values

OLD_PROJECT_FILE_NAME

public static final java.lang.String OLD_PROJECT_FILE_NAME

DO NOT CHANGE -- EVER

See Also:
Constant Field Values

VERSION_ONE

public static final java.lang.String VERSION_ONE

Identifies the first project file version.

See Also:
Constant Field Values

VERSION_TWO

public static final java.lang.String VERSION_TWO

Identifies the second project file version.

The second version includes padding for each project file part.

See Also:
Constant Field Values

VERSION_THREE

public static final java.lang.String VERSION_THREE

Identifies the third project file version.

The third version discludes the name and description.

See Also:
Constant Field Values

VERSION_FOUR

public static final java.lang.String VERSION_FOUR

Identifies the fourth project file version.

The fourth version includes the license hash, name, and description -- need to keep these for encrypted files where the uploader does not want the title and description to be public.

See Also:
Constant Field Values

VERSION_LATEST

public static final java.lang.String VERSION_LATEST

Identifies the latest project file version.

See Also:
Constant Field Values
Constructor Detail

ProjectFile

public ProjectFile()
Method Detail

getVersion

public java.lang.String getVersion()

Gets the version of this project file.

Returns:

setVersion

public void setVersion(java.lang.String version)

Sets the version of this project file.

Parameters:
version -

getDescription

public java.lang.String getDescription()

Gets the description for this project file.

Returns:

setDescription

public void setDescription(java.lang.String description)

Sets the description of this projet file.

Parameters:
description -

setName

public void setName(java.lang.String name)

Sets the name for this project file.

Parameters:
name -

getName

public java.lang.String getName()

Gets the name for this project file.

Returns:

setLicenseHash

public void setLicenseHash(BigHash licenseHash)
Parameters:
licenseHash -

getLicenseHash

public BigHash getLicenseHash()
Returns:

getSize

public java.math.BigInteger getSize()

Gets the size on disk in bytes of the directory that this object represents.

Returns:

setSize

protected void setSize(java.math.BigInteger size)
Parameters:
size -

calculateSize

public void calculateSize()

isSizeSet

public boolean isSizeSet()

Was the method called to set the size of the data set?

Returns:

getParts

public java.util.Set<ProjectFilePart> getParts()

Gets the parts for this project file.

Returns:

setParts

public void setParts(java.util.Set<ProjectFilePart> parts)

Sets the parts for this project file.

Parameters:
parts -

addPart

public void addPart(ProjectFilePart pfp)

Adds a project file part to this project.

Parameters:
pfp -

finalize

protected void finalize()

Destroys the disk backed project file part set.

Overrides:
finalize in class java.lang.Object

close

public void close()

Closes off any resources that might be used.


toByteArray

public final byte[] toByteArray()
                         throws java.lang.Exception
Returns:
Throws:
java.lang.Exception

toByteArray

public final byte[] toByteArray(java.lang.String version)
                         throws java.lang.Exception
Parameters:
version -
Returns:
Throws:
java.lang.Exception

createFromFile

public static final ProjectFile createFromFile(java.io.File file)
                                        throws java.lang.Exception
Parameters:
file -
Returns:
Throws:
java.lang.Exception


This code is free for use both commercially and non-commercially as stated in the project's license