com.denova.JExpress.Updater
Class CustomUpdater

java.lang.Object
  extended by com.denova.JExpress.Updater.CustomUpdater

public class CustomUpdater
extends java.lang.Object

Provides access to the updater from custom updater classes.

Author:
DeNova © 1999-2011 DeNova Last modified: 2011-11-21

Constructor Summary
CustomUpdater()
           
 
Method Summary
static void abortUpdater()
          Abort updater.
static boolean autoUpdater()
          Determines if this is an auto-updater or not.
static void cleanUpManifestFiles()
          Delete the local copy of the updated manifest.
static void exitUpdater()
          Exit updater.
static java.lang.String extendUrl(java.lang.String baseUrl, java.lang.String extension)
          Create a url.
static boolean extractFile(java.lang.String filename)
          Extracts a file to the updater's temporary directory.
static java.awt.Color getBackgroundColor()
          Get the color used for the background of panels, buttons, and dialogs.
static java.util.List getFilesToRemoveList()
          Gets a list of filenames that are not included in the updated manifest.
static java.util.List getFilesToUpdateList()
          Gets a list of manifest entries for the files to be updated.
static java.lang.String getLanguage()
          Returns the language the updater is using.
static java.lang.String getLocalizedString(java.lang.String key)
          Returns a localized string from the updater's primary resources.
static java.lang.String getLocalizedString(java.lang.String key, java.lang.String variable)
          Returns a localized string from the updater's primary resources.
static java.lang.String getLocalizedString(java.lang.String key, java.lang.String[] variables)
          Returns a localized string from the updater's primary resources.
static javax.swing.JPanel getLogoPanel()
          Returns the panel for the updater's image.
static java.util.List getNewJarFiles()
          Gets a list of new jar files downloaded.
static java.awt.Color getProgressBarColor()
          Get the color used for progress bars.
static PropertyList getPropertyList()
          Returns the updater's property list.
static boolean getResourceAsFile(java.lang.String filename)
          Looks through the classpath for the filename and saves it to a file in the updater's temporary directory.
static boolean getResourceAsFile(java.lang.String filename, java.lang.String pathname)
          Looks through the classpath for the filename and saves it to the pathname.
static java.io.InputStream getResourceAsStream(java.lang.String name)
          Opens an input stream to the resource.
static java.lang.String getTempDirectory()
          Returns the installer's temporary directory.
static java.awt.Color getTextColor()
          Get the color used for text items.
static boolean isOpaque()
          Determines if the background is opaque or not.
static void log(java.lang.Exception t)
          Log an error to updater.log, if it exists in the JExpress subdirectory.
static void log(java.lang.String message)
          Log a message to updater.log, if it exists in the JExpress subdirectory.
static void logError(java.lang.Exception t)
          Log an error to error.log, regardless if log exists.
static void logError(java.lang.String message)
          Log a message to error.log, regardless if log exists.
static void logError(java.lang.String message, java.lang.Exception t)
          Log a message and the error to error.log, regardless if log exists.
static void logError(java.lang.Throwable t)
          Log an error to error.log, regardless if log exists.
protected static boolean okToRunApp()
          Check if it's ok to run the app with CopyCheq server.
protected static boolean okToRunUpdater()
          Check if it's ok to run updater with CopyCheq server.
static void removeUpdateDir()
          Remove the temporaray "updates" directory on the user's sytem.
static void setUpdaterStatus(boolean ok)
          Set the boolean for the updater's final status.
static boolean startProgram()
          Start the application, if this is an autoupdater.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomUpdater

public CustomUpdater()
Method Detail

getFilesToUpdateList

public static java.util.List getFilesToUpdateList()
Gets a list of manifest entries for the files to be updated.

If you change the files to update "AfterFilesCompared", then those changes will be used to download the updated files.

If you do not want any of your changes to impact the standard update, you should clone the return value.

Returns:
A list of manifest entries for files to update.

getFilesToRemoveList

public static java.util.List getFilesToRemoveList()
Gets a list of filenames that are not included in the updated manifest.

If you do not want any of your changes to impact the standard update, you should clone the return value. Only available if DeleteObsoleteFiles was set to true in the installer.

Returns:
A list of filenames that are obsolete.

getNewJarFiles

public static java.util.List getNewJarFiles()
Gets a list of new jar files downloaded.

If you change the new jar files "AfterFilesCompared", then those changes will be used to download the updated files.

If you do not want any of your changes to impact the standard update, you should clone the return value.

Returns:
The new jar files list

getLogoPanel

public static javax.swing.JPanel getLogoPanel()
Returns the panel for the updater's image.

You can use this method to replace the image and create billboards. Don't forget to empty the container before you add your own image. If your image is a different size, you'll want to revalidate, etc. We strongly recommend that you always use the same size image.

Returns:
The logoPanel value

getBackgroundColor

public static java.awt.Color getBackgroundColor()
Get the color used for the background of panels, buttons, and dialogs.

Returns:
background color.

getProgressBarColor

public static java.awt.Color getProgressBarColor()
Get the color used for progress bars.

Returns:
progress bar color.

getTextColor

public static java.awt.Color getTextColor()
Get the color used for text items.

Returns:
text color.

isOpaque

public static boolean isOpaque()
Determines if the background is opaque or not.

Returns:
true if opaque.

autoUpdater

public static boolean autoUpdater()
Determines if this is an auto-updater or not.

Returns:
true if autoupdater.

startProgram

public static boolean startProgram()
Start the application, if this is an autoupdater.

This can be most effectively used if you want to stop the update process, but want the application to launch any ways.

Returns:
true if successful.

setUpdaterStatus

public static void setUpdaterStatus(boolean ok)
Set the boolean for the updater's final status.

If you want the updater to skip certain standard procedures, but still have a particular final status, then call this routine and disable whichever panels you don't want activated during the update. ok: true, if you want the updater's final status to be ok, regardless if update actually completed all standard procedures or not.

Parameters:
ok - The new updaterStatus value

getTempDirectory

public static java.lang.String getTempDirectory()
Returns the installer's temporary directory.

If the installer is not using a temporary directory, then it returns a blank.

Returns:
The tempDirectory value

extractFile

public static boolean extractFile(java.lang.String filename)
Extracts a file to the updater's temporary directory. The file is automatically deleted at the end of the update. If any of your custom panels use other files, such as images or property files, then you must extract them before your custom class needs them.

Parameters:
filename - the name of the file to extract
Returns:
true if successful

getResourceAsFile

public static boolean getResourceAsFile(java.lang.String filename)
Looks through the classpath for the filename and saves it to a file in the updater's temporary directory.

Parameters:
filename - name of file to get
Returns:
true if successful

getResourceAsFile

public static boolean getResourceAsFile(java.lang.String filename,
                                        java.lang.String pathname)
Looks through the classpath for the filename and saves it to the pathname.

Parameters:
filename - name of file to get
pathname - full pathname to save file, not just the directory
Returns:
true if successful

getResourceAsStream

public static java.io.InputStream getResourceAsStream(java.lang.String name)
Opens an input stream to the resource.

Parameters:
name - name of the resource
Returns:
The resource as input stream

log

public static void log(java.lang.String message)
Log a message to updater.log, if it exists in the JExpress subdirectory. See the manual about diagnostic logs (Manual/Diagnostics/updlogs.html).

Parameters:
message - message to record

log

public static void log(java.lang.Exception t)
Log an error to updater.log, if it exists in the JExpress subdirectory. See the manual about diagnostic logs (Manual/Diagnostics/updlogs.html).

Parameters:
t - exception

logError

public static void logError(java.lang.String message)
Log a message to error.log, regardless if log exists. See the manual about diagnostic logs (Manual/Diagnostics/updlogs.html).

Parameters:
message - message to record

logError

public static void logError(java.lang.Exception t)
Log an error to error.log, regardless if log exists. See the manual about diagnostic logs (Manual/Diagnostics/updlogs.html).

Parameters:
t - exception error.

logError

public static void logError(java.lang.Throwable t)
Log an error to error.log, regardless if log exists. See the manual about diagnostic logs (Manual/Diagnostics/updlogs.html).

Parameters:
t - throwable error.

logError

public static void logError(java.lang.String message,
                            java.lang.Exception t)
Log a message and the error to error.log, regardless if log exists. See the manual about diagnostic logs (Manual/Diagnostics/updlogs.html).

Parameters:
message - message to record
t - error

getPropertyList

public static PropertyList getPropertyList()
Returns the updater's property list.

Returns:
updater's properties

getLanguage

public static java.lang.String getLanguage()
Returns the language the updater is using.

Returns:
The language value

getLocalizedString

public static java.lang.String getLocalizedString(java.lang.String key)
Returns a localized string from the updater's primary resources.

Parameters:
key - the attribute for the value
Returns:
The localizedString value

getLocalizedString

public static java.lang.String getLocalizedString(java.lang.String key,
                                                  java.lang.String variable)
Returns a localized string from the updater's primary resources.

Parameters:
key - the attribute for the value
variable - the variable's value
Returns:
The localizedString value

getLocalizedString

public static java.lang.String getLocalizedString(java.lang.String key,
                                                  java.lang.String[] variables)
Returns a localized string from the updater's primary resources.

Parameters:
key - the attribute for the value
variables - the list of variables' value
Returns:
The localizedString value

extendUrl

public static java.lang.String extendUrl(java.lang.String baseUrl,
                                         java.lang.String extension)
Create a url.

Parameters:
baseUrl - base url
extension - extension
Returns:
full url

cleanUpManifestFiles

public static void cleanUpManifestFiles()
Delete the local copy of the updated manifest.


removeUpdateDir

public static void removeUpdateDir()
Remove the temporaray "updates" directory on the user's sytem.


exitUpdater

public static void exitUpdater()
Exit updater. If auto-updater, then start program.


abortUpdater

public static void abortUpdater()
Abort updater. If auto-updater, do *not* start program.


okToRunUpdater

protected static boolean okToRunUpdater()
Check if it's ok to run updater with CopyCheq server.


okToRunApp

protected static boolean okToRunApp()
Check if it's ok to run the app with CopyCheq server.