org.tranche.scripts
Class ScriptsUtil

java.lang.Object
  extended by org.tranche.scripts.ScriptsUtil

public class ScriptsUtil
extends java.lang.Object

Utilities for scripts.

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

Nested Class Summary
static class ScriptsUtil.ChunkType
          The types of chunk: data, meta, project.
 
Constructor Summary
ScriptsUtil()
           
 
Method Summary
static ProjectFile getProjectFile(BigHash projectFileHash)
          Recycles from GetFileTool.
static ProjectFile getProjectFile(BigHash projectFileHash, java.lang.String passphrase)
          Recycles from GetFileTool.
static java.util.List<java.lang.String> getServersWithChunk(BigHash hash, ScriptsUtil.ChunkType type)
          Finds all online core servers with a particular chunk.
static java.util.List<java.lang.String> getServersWithChunk(BigHash hash, ScriptsUtil.ChunkType type, java.util.List<java.lang.String> serversToUse)
          Finds all online core servers with a particular chunk.
static java.util.List<java.lang.String> getServersWithoutChunk(BigHash hash, ScriptsUtil.ChunkType type)
          Finds all online core servers without a particular chunk.
static java.util.List<java.lang.String> getServersWithoutChunk(BigHash hash, ScriptsUtil.ChunkType type, java.util.List<java.lang.String> serversToUse)
          Finds all online core servers without a particular chunk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptsUtil

public ScriptsUtil()
Method Detail

getServersWithChunk

public static java.util.List<java.lang.String> getServersWithChunk(BigHash hash,
                                                                   ScriptsUtil.ChunkType type)
                                                            throws java.lang.Exception

Finds all online core servers with a particular chunk.

Parameters:
hash - The big hash of the chunk
type - The ChunkType of the chunk (enumerated value), specifying whether data or meta data. Don't use PROJECT type as parameter.
Returns:
Throws:
java.lang.Exception

getServersWithChunk

public static java.util.List<java.lang.String> getServersWithChunk(BigHash hash,
                                                                   ScriptsUtil.ChunkType type,
                                                                   java.util.List<java.lang.String> serversToUse)
                                                            throws java.lang.Exception

Finds all online core servers with a particular chunk.

Parameters:
hash - The big hash of the chunk
type - The ChunkType of the chunk (enumerated value), specifying whether data or meta data. Don't use PROJECT type as parameter.
serversToUse - List of server urls to consider.
Returns:
Throws:
java.lang.Exception

getServersWithoutChunk

public static java.util.List<java.lang.String> getServersWithoutChunk(BigHash hash,
                                                                      ScriptsUtil.ChunkType type)
                                                               throws java.lang.Exception

Finds all online core servers without a particular chunk.

Parameters:
hash - The big hash of the chunk
type - The ChunkType of the chunk (enumerated value), specifying whether data or meta data. Don't use PROJECT type as parameter.
Returns:
Throws:
java.lang.Exception

getServersWithoutChunk

public static java.util.List<java.lang.String> getServersWithoutChunk(BigHash hash,
                                                                      ScriptsUtil.ChunkType type,
                                                                      java.util.List<java.lang.String> serversToUse)
                                                               throws java.lang.Exception

Finds all online core servers without a particular chunk.

Parameters:
hash - The big hash of the chunk
type - The ChunkType of the chunk (enumerated value), specifying whether data or meta data. Don't use PROJECT type as parameter.
serversToUse - List of urls for servers you want to consider.
Returns:
Throws:
java.lang.Exception

getProjectFile

public static ProjectFile getProjectFile(BigHash projectFileHash)
                                  throws java.lang.Exception

Recycles from GetFileTool. =)

Parameters:
projectFileHash -
Returns:
Throws:
java.lang.Exception

getProjectFile

public static ProjectFile getProjectFile(BigHash projectFileHash,
                                         java.lang.String passphrase)
                                  throws java.lang.Exception

Recycles from GetFileTool. =)

Parameters:
projectFileHash -
passphrase -
Returns:
Throws:
java.lang.Exception


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