Save This Page
Home » org.apache.sling.launchpad.base-2.2.0-source-release » org.apache.sling.launchpad.base.shared » [javadoc | source]
org.apache.sling.launchpad.base.shared
public class: Loader [javadoc | source]
java.lang.Object
   org.apache.sling.launchpad.base.shared.Loader
The Loader class provides utility methods for the actual launchers to help launching the framework.
Constructor:
 public Loader(String slingHome) throws IllegalArgumentException 
    Creates a loader instance to load from the given Sling home folder. Besides ensuring the existence of the Sling home folder, the constructor also removes all but the most recent launcher JAR files from the Sling home folder (thus cleaning up from previous upgrades).
    Parameters:
    slingHome - The Sling home folder. If this is null the default value SharedConstants#SLING_HOME_DEFAULT is assumed.
    Throws:
    IllegalArgumentException - If the Sling home folder exists but is not a directory or if the Sling home folder cannot be created.
Method from org.apache.sling.launchpad.base.shared.Loader Summary:
cleanupVM,   getBundleInfo,   info,   installLauncherJar,   loadLauncher,   spool
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.sling.launchpad.base.shared.Loader Detail:
 public  void cleanupVM() 
    Tries to remove as many traces of class loaded by the framework from the Java VM as possible. Most notably the following traces are removed:
    • JavaBeans property caches
    • Close the Launcher Jar File (if opened by the platform)

    This method must be called when the notifier is called.

 static String getBundleInfo(BundleVersionInfo<?> v) 
    Return relevant bundle version info for logging
 protected  void info(String msg) 
    Meant to be overridden to display or log info
 public boolean installLauncherJar(URL launcherJar) throws IOException 
    Copies the contents of the launcher JAR as indicated by the URL to the sling home directory. If the existing file is is a more recent bundle version than the supplied launcher JAR file, it is is not replaced.
 public Object loadLauncher(String launcherClassName) 
    Creates an URLClassLoader from a _launcher JAR_ file in the given slingHome directory and loads and returns the launcher class identified by the launcherClassName.
 public static  void spool(InputStream ins,
    File destFile) throws IOException 
    Spools the contents of the input stream to the given file replacing the contents of the file with the contents of the input stream. When this method returns, the input stream is guaranteed to be closed.