com.partnersoft.update.web
Class WebUpdate

java.lang.Object
  extended by com.partnersoft.update.web.WebUpdate
All Implemented Interfaces:
WebUpdateConstants

public class WebUpdate
extends java.lang.Object
implements WebUpdateConstants

A JavaWebStart-launched installation/update facility.

This is designed to be standalone; it does not depend on any other Partner packages and a minimal set of third-party libraries. Therefore, it has many redundancies with com.partnersoft.io and com.partnersoft.update classes.

NOTE: this class must compile under Java 1.4 to ensure broad compatibility across computers, since it will be launched using JavaWebStart and not our own Java. This means you can't use generics or for-each loops or other 1.5+ features.

Copyright 2005-2009 Partner Software, Inc.

Version:
$Id: WebUpdate.java 2474 2010-03-13 14:28:43Z paul $
Author:
Paul Reavis

Field Summary
 int BUFFER_SIZE
           
 
Fields inherited from interface com.partnersoft.update.web.WebUpdateConstants
CENTRAL_HUB, CONFIG_LEVELS, DISTRIBUTION, INSTALL_TYPES, MAP_TRANSLATOR, MASTER_INSTALL, OS, OS_DIRS, PALM_USER, PROVIDER, SHORT_INSTALL_TYPES, SITE_HUB, USER, WEB_USER
 
Constructor Summary
WebUpdate(java.lang.String action, java.lang.String source, java.lang.String installType, java.lang.String destination)
           
 
Method Summary
 java.util.ArrayList contentsForPackage(java.lang.String packageName)
           
 java.io.File createFile(java.io.File base, java.lang.String path)
           
 java.io.File createFile(java.lang.String path)
           
 java.io.File createFileMakeDir(java.lang.String path)
           
 java.net.URL createURL(java.lang.String path)
           
 java.net.URL createURL(java.net.URL base, java.lang.String path)
           
 void die(java.lang.String message, java.lang.Throwable oopsie)
           
 long downloadAndChecksum(java.io.InputStream source, java.io.OutputStream sink)
          Copies (or downloads) from the source to the sink, using a large buffer, while simultaneously generating a checksum that can be used to verify that the copied data matches what was expected.
 long downloadAndChecksum(java.io.InputStream source, java.io.OutputStream sink, long howMany, boolean showProgress)
          Copies (or downloads) from the source to the sink, using a large buffer, while simultaneously generating a checksum that can be used to verify that the copied data matches what was expected.
 void execAndHalt(java.lang.String command)
          Executes the given OS-specific command; then halts the current Java session.
 void execAndHalt(java.lang.String command, java.io.File currentDir)
          Executes the given OS-specific command; then halts the current Java session.
 void execAndWait(java.lang.String command, java.io.File currentDir)
           
 java.lang.Process execNoWait(java.lang.String command)
          Same as execNoWait(command, currentDir) but defaulted to the install directory.
 java.lang.Process execNoWait(java.lang.String command, java.io.File currentDir)
          Same as execAndWait(command, currentDir) but does not wait - the process continues in a separate thread.
 boolean getExitWhenDone()
           
 java.lang.String getOSType()
           
 java.lang.String humaneTimestamp()
           
 boolean isFailOnChecksumMismatch()
           
 boolean isHeadless()
           
 void logOutput(java.lang.Process proc)
           
static void main(java.lang.String[] argv)
           
static void makeAbsolutelySureItAintA3xInstall(java.io.File installDir)
           
 void makeDirsFor(java.io.File file)
           
 void move(java.lang.String fromPath, java.lang.String toPath)
           
 java.lang.String readLineFromDestination(java.lang.String path)
           
 java.lang.String readLineFromSource(java.lang.String path)
           
 java.util.List readListFromSource(java.lang.String path)
           
 java.util.Set readSetFromSource(java.lang.String path)
           
 void setExitWhenDone(boolean tizit)
           
 void setFailOnChecksumMismatch(boolean failOnChecksumMismatch)
           
 void setHeadless(boolean tizit)
           
 java.lang.String slashToSeparator(java.lang.String filename)
          Unscrubs a string, turning Unix-style slashes into native File.separator strings.
 long streamCopy(java.io.InputStream source, java.io.OutputStream sink, long howMany, boolean showProgress)
           
 long streamCopyLengthUnknown(java.io.InputStream source, java.io.OutputStream sink)
           
 long streamSkip(java.io.InputStream source, long howMany, boolean showProgress)
           
 boolean testBoxcar(java.io.File boxcarFile)
           
 void unpack(java.io.File boxcarFile, java.io.File destinationDir)
           
 void update()
          The driver function; calls the full update sequence.
 java.util.TreeSet whichPackages(java.lang.String sourceType, java.lang.String destinationType, java.lang.String osType, java.util.Collection mapPackages)
           
 void writeLine(java.lang.String path, java.lang.String line)
           
 void writeList(java.lang.String path, java.util.Collection list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

WebUpdate

public WebUpdate(java.lang.String action,
                 java.lang.String source,
                 java.lang.String installType,
                 java.lang.String destination)
Method Detail

main

public static void main(java.lang.String[] argv)

update

public void update()
            throws java.io.IOException
The driver function; calls the full update sequence.

Throws:
java.io.IOException

contentsForPackage

public java.util.ArrayList contentsForPackage(java.lang.String packageName)

unpack

public void unpack(java.io.File boxcarFile,
                   java.io.File destinationDir)
            throws java.io.IOException
Throws:
java.io.IOException

testBoxcar

public boolean testBoxcar(java.io.File boxcarFile)
                   throws java.io.IOException
Throws:
java.io.IOException

makeAbsolutelySureItAintA3xInstall

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

slashToSeparator

public java.lang.String slashToSeparator(java.lang.String filename)
Unscrubs a string, turning Unix-style slashes into native File.separator strings.


createURL

public java.net.URL createURL(java.net.URL base,
                              java.lang.String path)
                       throws java.io.IOException
Throws:
java.io.IOException

createURL

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

createFile

public java.io.File createFile(java.io.File base,
                               java.lang.String path)
                        throws java.io.IOException
Throws:
java.io.IOException

createFile

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

makeDirsFor

public void makeDirsFor(java.io.File file)
                 throws java.io.IOException
Throws:
java.io.IOException

createFileMakeDir

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

readLineFromSource

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

readListFromSource

public java.util.List readListFromSource(java.lang.String path)
                                  throws java.io.IOException
Throws:
java.io.IOException

readSetFromSource

public java.util.Set readSetFromSource(java.lang.String path)
                                throws java.io.IOException
Throws:
java.io.IOException

readLineFromDestination

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

writeLine

public void writeLine(java.lang.String path,
                      java.lang.String line)
               throws java.io.IOException
Throws:
java.io.IOException

writeList

public void writeList(java.lang.String path,
                      java.util.Collection list)
               throws java.io.IOException
Throws:
java.io.IOException

getOSType

public java.lang.String getOSType()

humaneTimestamp

public java.lang.String humaneTimestamp()

whichPackages

public java.util.TreeSet whichPackages(java.lang.String sourceType,
                                       java.lang.String destinationType,
                                       java.lang.String osType,
                                       java.util.Collection mapPackages)

downloadAndChecksum

public long downloadAndChecksum(java.io.InputStream source,
                                java.io.OutputStream sink,
                                long howMany,
                                boolean showProgress)
                         throws java.io.IOException
Copies (or downloads) from the source to the sink, using a large buffer, while simultaneously generating a checksum that can be used to verify that the copied data matches what was expected.

Throws:
java.io.IOException

downloadAndChecksum

public long downloadAndChecksum(java.io.InputStream source,
                                java.io.OutputStream sink)
                         throws java.io.IOException
Copies (or downloads) from the source to the sink, using a large buffer, while simultaneously generating a checksum that can be used to verify that the copied data matches what was expected.

Throws:
java.io.IOException

streamCopy

public long streamCopy(java.io.InputStream source,
                       java.io.OutputStream sink,
                       long howMany,
                       boolean showProgress)
                throws java.io.IOException
Throws:
java.io.IOException

streamSkip

public long streamSkip(java.io.InputStream source,
                       long howMany,
                       boolean showProgress)
                throws java.io.IOException
Throws:
java.io.IOException

streamCopyLengthUnknown

public long streamCopyLengthUnknown(java.io.InputStream source,
                                    java.io.OutputStream sink)
                             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

execAndWait

public void execAndWait(java.lang.String command,
                        java.io.File currentDir)
                 throws java.io.IOException
Throws:
java.io.IOException

execNoWait

public java.lang.Process execNoWait(java.lang.String command)
                             throws java.io.IOException
Same as execNoWait(command, currentDir) but defaulted to the install directory.

Throws:
java.io.IOException

execNoWait

public java.lang.Process execNoWait(java.lang.String command,
                                    java.io.File currentDir)
                             throws java.io.IOException
Same as execAndWait(command, currentDir) but does not wait - the process continues in a separate thread.

Throws:
java.io.IOException

execAndHalt

public void execAndHalt(java.lang.String command)
                 throws java.io.IOException
Executes the given OS-specific command; then halts the current Java session.

Throws:
java.io.IOException

execAndHalt

public void execAndHalt(java.lang.String command,
                        java.io.File currentDir)
                 throws java.io.IOException
Executes the given OS-specific command; then halts the current Java session.

Throws:
java.io.IOException

logOutput

public void logOutput(java.lang.Process proc)

die

public void die(java.lang.String message,
                java.lang.Throwable oopsie)

isHeadless

public boolean isHeadless()

setHeadless

public void setHeadless(boolean tizit)

getExitWhenDone

public boolean getExitWhenDone()

setExitWhenDone

public void setExitWhenDone(boolean tizit)

isFailOnChecksumMismatch

public boolean isFailOnChecksumMismatch()

setFailOnChecksumMismatch

public void setFailOnChecksumMismatch(boolean failOnChecksumMismatch)