org.tranche.project
Class ArbitraryProjectBuildingTool

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

public class ArbitraryProjectBuildingTool
extends java.lang.Object

Create an arbitrary project from existing files on the network.

Author:
Bryan E. Smith - bryanesmith@gmail.com

Constructor Summary
ArbitraryProjectBuildingTool(java.security.cert.X509Certificate cert, java.security.PrivateKey key, java.lang.String directoryName)
          Instantiate.
 
Method Summary
 boolean addDataSet(BigHash hash)
          Add an entire data.
 boolean addFileFromProject(BigHash projectHash, BigHash fileHash)
          Adds a file chunkHash to the project chunkHash.
 boolean addFileFromProject(BigHash projectHash, ProjectFilePart pfp)
          Add a file that should be added to the project.
 boolean addIndividualFile(BigHash hash)
          Add a file that should be added to the project.
 void addServerToUse(java.lang.String host)
          Add a server to use.
 java.lang.String getDescription()
          The description for the new proejct.
 java.lang.String getTitle()
          This title for the new project.
static boolean isPrintServerPerformanceSummary()
           
static void main(java.lang.String[] args)
           
 BigHash run()
          After setting all the files, run to create the project from existing files on the network.
 void setDescription(java.lang.String description)
          The description for the new proejct.
static void setIsPrintServerPerformanceSummary(boolean aIsPrintServerPerformanceSummary)
           
 void setTitle(java.lang.String title)
          This title for the new project.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArbitraryProjectBuildingTool

public ArbitraryProjectBuildingTool(java.security.cert.X509Certificate cert,
                                    java.security.PrivateKey key,
                                    java.lang.String directoryName)

Instantiate.

Parameters:
cert - Certificate of user who can write to network
key - Key for user who can write to network
directoryName - The name to be used for the directory holding all the files. (Title and description can be set using setters, and are different.)
Method Detail

isPrintServerPerformanceSummary

public static boolean isPrintServerPerformanceSummary()

setIsPrintServerPerformanceSummary

public static void setIsPrintServerPerformanceSummary(boolean aIsPrintServerPerformanceSummary)

main

public static void main(java.lang.String[] args)
Parameters:
args -

addFileFromProject

public boolean addFileFromProject(BigHash projectHash,
                                  ProjectFilePart pfp)

Add a file that should be added to the project. This file should exist already on network.

Parameters:
projectHash -
pfp - An existing ProjectFilePart. Could use chunkHash, but if already have this, can save a little time.
Returns:
True if added, false otherwise.

addFileFromProject

public boolean addFileFromProject(BigHash projectHash,
                                  BigHash fileHash)

Adds a file chunkHash to the project chunkHash.

Parameters:
projectHash -
fileHash -
Returns:

addIndividualFile

public boolean addIndividualFile(BigHash hash)

Add a file that should be added to the project. This file should exist already on network and must not be part of a data set.

Parameters:
chunkHash - The BigHash for the file. Will go to network to get MetaData for file. If have ProjectFilePart, use instead to save time.
Returns:
True if added, false otherwise.

addDataSet

public boolean addDataSet(BigHash hash)

Add an entire data. This tool will include all its files with other files you specify.

The data set should exist on the network.

Parameters:
hash - The BigHash for the data set.
Returns:

run

public BigHash run()
            throws java.lang.Exception

After setting all the files, run to create the project from existing files on the network.

Returns:
BigHash for the newly-created project.
Throws:
java.lang.Exception - Any exception will stop the tool. This partially ensures the integrity of the project. Note that can succeed even if data chunks are missing. If ProjectFilePart objects were directly added, could succeed even with missing meta data.

getTitle

public java.lang.String getTitle()

This title for the new project.

Returns:

setTitle

public void setTitle(java.lang.String title)

This title for the new project.

Parameters:
title -

getDescription

public java.lang.String getDescription()

The description for the new proejct.

Returns:

setDescription

public void setDescription(java.lang.String description)

The description for the new proejct.

Parameters:
description -

addServerToUse

public void addServerToUse(java.lang.String host)

Add a server to use.

If no server urls added, will use core servers for network.

If servers added, will use those instead.

Uses same contract as AddFileTool.

Parameters:
host -


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