Package org.nuxeo.osgi.application
Class FrameworkBootstrap
- java.lang.Object
-
- org.nuxeo.osgi.application.FrameworkBootstrap
-
- All Implemented Interfaces:
LoaderConstants
- Direct Known Subclasses:
DevFrameworkBootstrap
public class FrameworkBootstrap extends Object implements LoaderConstants
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DEFAULT_BUNDLES_CP
protected static String
DEFAULT_LIBS_CP
protected Map<String,Object>
env
protected boolean
flushCache
protected Class<?>
frameworkLoaderClass
protected File
home
protected MutableClassLoader
loader
protected boolean
scanForNestedJars
protected long
startTime
-
Fields inherited from interface org.nuxeo.osgi.application.LoaderConstants
ARGS, BUNDLES, CONFIG_DIR, DATA_DIR, DEVMODE, FLUSH_CACHE, HOME_DIR, HOST_NAME, HOST_VERSION, INSTALL_RELOAD_TIMER, LIBS, LOG_DIR, PREPROCESSING, SCAN_FOR_NESTED_JARS, TMP_DIR, WEB_DIR
-
-
Constructor Summary
Constructors Constructor Description FrameworkBootstrap(ClassLoader cl, File home)
FrameworkBootstrap(MutableClassLoader loader, File home)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildBundlesClassPath(String bundlesCp, List<File> bundleFiles)
protected List<File>
buildClassPath()
Fills the classloader with all jars found in the defined classpath.protected void
buildLibsClassPath(String libsCp)
protected static void
checkZipSlip(File parent, File child)
static void
copyFile(File src, File file)
static void
copyToFile(InputStream in, File file)
static void
copyTree(File src, File dst)
static void
deleteAll(File file)
Map<String,Object>
env()
protected void
extractNestedJar(JarFile file, ZipEntry entry, File dest)
protected void
extractNestedJars(File file, File tmpDir)
protected void
extractNestedJars(List<File> bundleFiles, File dir)
static File
findFileStartingWidth(File dir, String prefix)
ClassLoader
getClassLoader()
File
getHome()
MutableClassLoader
getLoader()
protected static File
getZipEntryAsFile(File parent, String childPath)
void
initialize()
protected void
initializeEnvironment()
String
installBundle(File f)
protected File
newFile(String path)
protected void
printStartedMessage()
void
setDevMode(String devMode)
void
setDoPreprocessing(boolean doPreprocessing)
void
setFlushCache(boolean flushCache)
void
setHostName(String value)
void
setHostVersion(String value)
void
setScanForNestedJars(boolean scanForNestedJars)
void
start(MutableClassLoader cl)
void
stop(MutableClassLoader cl)
void
uninstallBundle(String name)
-
-
-
Field Detail
-
DEFAULT_BUNDLES_CP
protected static final String DEFAULT_BUNDLES_CP
- See Also:
- Constant Field Values
-
DEFAULT_LIBS_CP
protected static final String DEFAULT_LIBS_CP
- See Also:
- Constant Field Values
-
home
protected File home
-
loader
protected MutableClassLoader loader
-
frameworkLoaderClass
protected Class<?> frameworkLoaderClass
-
startTime
protected long startTime
-
scanForNestedJars
protected boolean scanForNestedJars
-
flushCache
protected boolean flushCache
-
-
Constructor Detail
-
FrameworkBootstrap
public FrameworkBootstrap(ClassLoader cl, File home) throws IOException
- Throws:
IOException
-
FrameworkBootstrap
public FrameworkBootstrap(MutableClassLoader loader, File home) throws IOException
- Throws:
IOException
-
-
Method Detail
-
setHostName
public void setHostName(String value)
-
setHostVersion
public void setHostVersion(String value)
-
setDoPreprocessing
public void setDoPreprocessing(boolean doPreprocessing)
-
setDevMode
public void setDevMode(String devMode)
-
setFlushCache
public void setFlushCache(boolean flushCache)
-
setScanForNestedJars
public void setScanForNestedJars(boolean scanForNestedJars)
-
getLoader
public MutableClassLoader getLoader()
-
getClassLoader
public ClassLoader getClassLoader()
-
getHome
public File getHome()
-
initialize
public void initialize() throws ReflectiveOperationException, IOException
-
start
public void start(MutableClassLoader cl) throws ReflectiveOperationException, IOException, JMException
-
stop
public void stop(MutableClassLoader cl) throws ReflectiveOperationException, JMException
-
installBundle
public String installBundle(File f) throws ReflectiveOperationException
- Throws:
ReflectiveOperationException
-
uninstallBundle
public void uninstallBundle(String name) throws ReflectiveOperationException
- Throws:
ReflectiveOperationException
-
initializeEnvironment
protected void initializeEnvironment() throws IOException
- Throws:
IOException
-
printStartedMessage
protected void printStartedMessage()
-
newFile
protected File newFile(String path) throws IOException
- Throws:
IOException
-
buildClassPath
protected List<File> buildClassPath() throws IOException
Fills the classloader with all jars found in the defined classpath.- Returns:
- the list of bundle files.
- Throws:
IOException
-
buildLibsClassPath
protected void buildLibsClassPath(String libsCp) throws IOException
- Throws:
IOException
-
buildBundlesClassPath
protected void buildBundlesClassPath(String bundlesCp, List<File> bundleFiles) throws IOException
- Throws:
IOException
-
extractNestedJars
protected void extractNestedJars(List<File> bundleFiles, File dir) throws IOException
- Throws:
IOException
-
extractNestedJars
protected void extractNestedJars(File file, File tmpDir) throws IOException
- Throws:
IOException
-
extractNestedJar
protected void extractNestedJar(JarFile file, ZipEntry entry, File dest) throws IOException
- Throws:
IOException
-
deleteAll
public static void deleteAll(File file)
-
copyFile
public static void copyFile(File src, File file) throws IOException
- Throws:
IOException
-
copyToFile
public static void copyToFile(InputStream in, File file) throws IOException
- Throws:
IOException
-
copyTree
public static void copyTree(File src, File dst) throws IOException
- Throws:
IOException
-
-