com.partnersoft.update.model
Class UpdateInstallation

java.lang.Object
  extended by com.partnersoft.update.model.UpdateInstallation

public class UpdateInstallation
extends java.lang.Object

A platform installation that can be used as either a source or destination for Update.

Copyright 2010 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
UpdateInstallation(java.lang.String urlOrFilePath)
           
 
Method Summary
 java.io.BufferedReader createBufferedReaderFor(java.lang.String path)
           
 java.io.BufferedWriter createBufferedWriterFor(java.lang.String path)
           
 java.io.InputStream createInputStreamFor(java.lang.String path)
           
 java.io.OutputStream createOutputStreamFor(java.lang.String path)
           
 java.io.PrintWriter createPrintWriterFor(java.lang.String path)
           
 java.io.File fileFor(java.lang.String path)
           
 java.io.File getBaseDirectory()
           
 java.net.URL getBaseUrl()
           
 boolean isLocked()
           
 void lock(java.lang.String explanation)
           
static void makeAbsolutelySureItAintA3xInstall(java.io.File installDir)
           
 void move(java.lang.String fromPath, java.lang.String toPath)
           
 java.lang.String readFirstLineFrom(java.lang.String path)
          Reads just the first line from the file at the given path.
 java.util.Map readInstalledPackages()
           
 UpdateInstallType readInstallType()
           
 java.util.List readLinesFrom(java.lang.String path)
          Reads all lines from the file at the given path, returns them as a List of Strings.
 long readLongFrom(java.lang.String path)
          Reads the first line from the file at the given path and forces it to a long.
 java.util.Map readUpdateChain()
           
 void remove(java.io.File fileOrDirectory)
          Removes the file or directory for the given File object, and all contents and subdirectories.
 void remove(java.lang.String path)
          Removes the file or directory specified by the given path, and all contents and subdirectories.
 java.lang.String toString()
           
 void unlock()
           
 java.net.URL urlFor(java.lang.String path)
           
 void writeInstallType(UpdateInstallType installType)
           
 void writeLinesTo(java.util.Collection lines, java.lang.String path)
          Writes lines of text to the given file.
 void writeLineTo(java.lang.String line, java.lang.String path)
          Writes a single line of text to the given file.
 void writeLongTo(long value, java.lang.String path)
          Writes the given long to the file at the given path.
 void writeUpdateChain(java.util.Map updateChain)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UpdateInstallation

public UpdateInstallation(java.lang.String urlOrFilePath)
                   throws java.io.IOException
Throws:
java.io.IOException
Method Detail

readInstallType

public UpdateInstallType readInstallType()
                                  throws java.io.IOException
Throws:
java.io.IOException

writeInstallType

public void writeInstallType(UpdateInstallType installType)
                      throws java.io.IOException
Throws:
java.io.IOException

readInstalledPackages

public java.util.Map readInstalledPackages()
                                    throws java.io.IOException
Throws:
java.io.IOException

readUpdateChain

public java.util.Map readUpdateChain()
                              throws java.io.IOException
Throws:
java.io.IOException

writeUpdateChain

public void writeUpdateChain(java.util.Map updateChain)
                      throws java.io.IOException
Throws:
java.io.IOException

urlFor

public java.net.URL urlFor(java.lang.String path)
                    throws java.io.IOException
Throws:
java.io.IOException

fileFor

public java.io.File fileFor(java.lang.String path)
                     throws java.io.IOException
Throws:
java.io.IOException

createInputStreamFor

public java.io.InputStream createInputStreamFor(java.lang.String path)
                                         throws java.io.IOException
Throws:
java.io.IOException

createBufferedReaderFor

public java.io.BufferedReader createBufferedReaderFor(java.lang.String path)
                                               throws java.io.IOException
Throws:
java.io.IOException

createOutputStreamFor

public java.io.OutputStream createOutputStreamFor(java.lang.String path)
                                           throws java.io.IOException
Throws:
java.io.IOException

createBufferedWriterFor

public java.io.BufferedWriter createBufferedWriterFor(java.lang.String path)
                                               throws java.io.IOException
Throws:
java.io.IOException

createPrintWriterFor

public java.io.PrintWriter createPrintWriterFor(java.lang.String path)
                                         throws java.io.IOException
Throws:
java.io.IOException

readFirstLineFrom

public java.lang.String readFirstLineFrom(java.lang.String path)
                                   throws java.io.IOException
Reads just the first line from the file at the given path.

Throws:
java.io.IOException

readLongFrom

public long readLongFrom(java.lang.String path)
                  throws java.io.IOException
Reads the first line from the file at the given path and forces it to a long. Good for loading checksum values and not much else.

Throws:
java.io.IOException

writeLongTo

public void writeLongTo(long value,
                        java.lang.String path)
                 throws java.io.IOException
Writes the given long to the file at the given path. Good for saving checksum values and not much else.

Throws:
java.io.IOException

readLinesFrom

public java.util.List readLinesFrom(java.lang.String path)
                             throws java.io.IOException
Reads all lines from the file at the given path, returns them as a List of Strings.

Throws:
java.io.IOException

writeLineTo

public void writeLineTo(java.lang.String line,
                        java.lang.String path)
                 throws java.io.IOException
Writes a single line of text to the given file. Replaces the existing file, if any.

Throws:
java.io.IOException

writeLinesTo

public void writeLinesTo(java.util.Collection lines,
                         java.lang.String path)
                  throws java.io.IOException
Writes lines of text to the given file. Replaces the existing file, if any.

Throws:
java.io.IOException

makeAbsolutelySureItAintA3xInstall

public static void makeAbsolutelySureItAintA3xInstall(java.io.File installDir)
                                               throws java.io.IOException
Throws:
java.io.IOException

remove

public void remove(java.lang.String path)
            throws java.io.IOException
Removes the file or directory specified by the given path, and all contents and subdirectories.

Throws:
java.io.IOException

remove

public void remove(java.io.File fileOrDirectory)
            throws java.io.IOException
Removes the file or directory for the given File object, and all contents and subdirectories.

Throws:
java.io.IOException

lock

public void lock(java.lang.String explanation)
          throws java.io.IOException
Throws:
java.io.IOException

unlock

public void unlock()
            throws java.io.IOException
Throws:
java.io.IOException

isLocked

public boolean isLocked()
                 throws java.io.IOException
Throws:
java.io.IOException

move

public void move(java.lang.String fromPath,
                 java.lang.String toPath)
          throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getBaseUrl

public java.net.URL getBaseUrl()

getBaseDirectory

public java.io.File getBaseDirectory()