intarsys runtime library

de.intarsys.tools.installresource
Class Install

java.lang.Object
  extended by de.intarsys.tools.installresource.Install
Direct Known Subclasses:
InstallFile, InstallFileList, InstallZip

public abstract class Install
extends Object

Abstract superclass for implementing file resource deployment behavior.

This is a useful package to deploy file based resources along with the classloader. Files or directories are detected via classloader and copied temporarily to the file system. Here you can access the resources locally - for example for loading a native library.

Platform dependent resources are supported via subdirectories.

When loading a non platform dependent resource, the file is searched in the class loader with getResourceAsStream(x) where x is

When loading a platform dependent resource, the file is searched in the class loader with getResourceAsStream(x) where x is one of In this definition For example, with InstallFile("foo", "bar.dll", true) on a Windows Vista machine you will search for:


Constructor Summary
Install(String path, String name, boolean platformDependent)
           
 
Method Summary
 boolean delete()
          Delete the temporary installation.
 ClassLoader getClassLoader()
           
 File getFile()
           
 File[] getFiles()
           
 String getName()
           
 String getPath()
           
static String getPlatformDefaultId()
           
static String getPlatformFallbackId()
           
static String getPlatformId()
           
 boolean isPlatformDependent()
           
 File load()
          Load the first occurrence of the designated target from the classloader and save it as a local temporary resource.
 File[] loadAll()
          Load all occurrences of the designated target from the classloader.
 void setClassLoader(ClassLoader classLoader)
           
static void setPlatformFallbackId(String value)
           
static void setPlatformId(String value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Install

public Install(String path,
               String name,
               boolean platformDependent)
Method Detail

getPlatformDefaultId

public static String getPlatformDefaultId()

getPlatformFallbackId

public static String getPlatformFallbackId()

getPlatformId

public static String getPlatformId()

setPlatformFallbackId

public static void setPlatformFallbackId(String value)

setPlatformId

public static void setPlatformId(String value)

delete

public boolean delete()
Delete the temporary installation.

Returns:
true if all artifacts are deleted.

getClassLoader

public ClassLoader getClassLoader()

getFile

public File getFile()

getFiles

public File[] getFiles()

getName

public String getName()

getPath

public String getPath()

isPlatformDependent

public boolean isPlatformDependent()

load

public File load()
          throws IOException
Load the first occurrence of the designated target from the classloader and save it as a local temporary resource. The path to this resource is returned.

Returns:
Load the first occurrence of the designated target from the classloader.
Throws:
IOException

loadAll

public File[] loadAll()
               throws IOException
Load all occurrences of the designated target from the classloader.

Returns:
Load all occurrences of the designated target from the classloader.
Throws:
IOException

setClassLoader

public void setClassLoader(ClassLoader classLoader)

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.