|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.ClassLoader
|
+--java.security.SecureClassLoader
|
+--java.net.URLClassLoader
|
+--org.PingOO.DLAI.lib.util.DLAILoader
Loader for the DLAI package.
While all was working perfectly under LINUX with code in PPM's own Request class (see save archive before 08/30/1999), some problems appears while testing the auto-update under Windows.
It seemed that the File.renameTo() and File.delete() methods did not worked under Windows for unknow reasons.
I once thought the problem occured while using DLAI.jar as part of the main CLASSPATH and decide to use an external loader and reflection process instead of letting Request do the update job by herself.
Problem was that, after modification and successfull tests under LINUX, the File.renameTo() and File.delete() still did not worked.
After various tries I came with the idea of doing basic byte-data transfert which seems to work under Windows and LINUX.
Futhermore using an external loader allows the user to still try to launch the appli event if DLAI.jar is damaged (note need to work on pseudo-fixing DLAI.jar with DLAI.tmp or DLAI.old).
We can event imagine trying to get a valid DLAI.jar from a web server on the local network.
The only downside is that at the launch time we do not have access to PWidget so we only have localized capabilities here, message will use standard JOptionPane with text in both english and french.
I also tryed to concentrate the code in only one class.
Note : after tests under Windows the code used to delete DLAI.tmp seems to work.
Jeff hypotesized this is a problem with the default SecurityManager which does not allow to deltes some files under Windows, I thisk he's right but I do not have enough remaining time to check this.
| Inner classes inherited from class java.lang.ClassLoader |
java.lang.ClassLoader.NativeLibrary |
| Field Summary | |
static java.lang.String |
BACKUP_FILE
The backup file. |
private static int |
BUFFER_SIZE
The default buffer size. |
private static java.lang.String |
CLASS_TO_START
The class to start. |
static java.lang.String |
JAR_FILE
The archive file. |
private static DLAILoader |
loader
|
static java.lang.String |
UPDATED_FILE
The tmp file created after an update. |
private java.net.URL |
url
The url of the Jar file to load. |
| Fields inherited from class java.net.URLClassLoader |
acc,
ucp |
| Fields inherited from class java.security.SecureClassLoader |
debug,
pdcache |
| Fields inherited from class java.lang.ClassLoader |
bootstrapClassPath,
classes,
defaultDomain,
defaultPermissions,
getClassLoaderPerm,
initialized,
loadedLibraryNames,
nativeLibraries,
nativeLibraryContext,
packages,
parent,
scl,
sclSet,
sys_paths,
systemNativeLibraries,
usr_paths |
| Constructor Summary | |
private |
DLAILoader(java.net.URL url)
Creates a new instance of the loader. |
| Method Summary | |
static DLAILoader |
getInstance()
Return an instance of this loader. |
java.lang.String |
getMainClassName()
Returns the name of the jar file main class, or null if no "Main-Class" manifest attributes was defined. |
void |
invokeClass(java.lang.String name,
java.lang.String[] args)
Invokes the application in this jar file given the name of the main class and an array of arguments. |
static void |
main(java.lang.String[] args)
Main method. |
static void |
update(java.io.File destinationFile,
java.io.File sourceFile)
Put the content of one file into another. |
| Methods inherited from class java.net.URLClassLoader |
addURL,
defineClass,
definePackage,
findClass,
findResource,
findResources,
getPermissions,
getURLs,
isSealed,
newInstance,
newInstance |
| Methods inherited from class java.security.SecureClassLoader |
|
| Methods inherited from class java.lang.ClassLoader |
addClass,
check,
defineClass,
defineClass,
defineClass,
defineClass0,
definePackage,
findBootstrapClass,
findLibrary,
findLoadedClass,
findNative,
findSystemClass,
getBootstrapClassPath,
getBootstrapResource,
getBootstrapResources,
getCallerClassLoader,
getDefaultDomain,
getGetClassLoaderPerm,
getPackage,
getPackages,
getParent,
getResource,
getResourceAsStream,
getResources,
getSystemClassLoader,
getSystemResource,
getSystemResourceAsStream,
getSystemResources,
initializePath,
isAncestor,
loadClass,
loadClass,
loadLibrary,
loadLibrary0,
resolveClass,
resolveClass0,
setSigners |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
| Field Detail |
private static final java.lang.String CLASS_TO_START
public static final java.lang.String UPDATED_FILE
public static final java.lang.String JAR_FILE
public static final java.lang.String BACKUP_FILE
private java.net.URL url
private static final int BUFFER_SIZE
private static DLAILoader loader
| Constructor Detail |
private DLAILoader(java.net.URL url)
| Method Detail |
public java.lang.String getMainClassName()
throws java.io.IOException
null if no "Main-Class" manifest attributes was defined.
public void invokeClass(java.lang.String name,
java.lang.String[] args)
throws java.lang.ClassNotFoundException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
name - the name of the main classargs - the arguments for the application
public static void update(java.io.File destinationFile,
java.io.File sourceFile)
I once tryed to use BufferedReader, BufferedWriter, FileReader or FileWriter to optimize access but characters where badly translated back to characters under Windows.
Again not enought time to fix that.
destinationFile - The destination file.sourceFile - The source file.public static void main(java.lang.String[] args)
args - The arguments from the command line.PPM.main(java.lang.String[])public static final DLAILoader getInstance()
null only if the main method has allready been called.null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||