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 StringDEFAULT_BUNDLES_CPprotected static StringDEFAULT_LIBS_CPprotected Map<String,Object>envprotected booleanflushCacheprotected Class<?>frameworkLoaderClassprotected Filehomeprotected MutableClassLoaderloaderprotected booleanscanForNestedJarsprotected longstartTime-
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 voidbuildBundlesClassPath(String bundlesCp, List<File> bundleFiles)protected List<File>buildClassPath()Fills the classloader with all jars found in the defined classpath.protected voidbuildLibsClassPath(String libsCp)static voidcopyFile(File src, File file)static voidcopyToFile(InputStream in, File file)static voidcopyTree(File src, File dst)static voiddeleteAll(File file)Map<String,Object>env()protected voidextractNestedJar(JarFile file, ZipEntry entry, File dest)protected voidextractNestedJars(File file, File tmpDir)protected voidextractNestedJars(List<File> bundleFiles, File dir)static FilefindFileStartingWidth(File dir, String prefix)ClassLoadergetClassLoader()FilegetHome()MutableClassLoadergetLoader()voidinitialize()protected voidinitializeEnvironment()StringinstallBundle(File f)protected FilenewFile(String path)protected voidprintStartedMessage()voidsetDevMode(String devMode)voidsetDoPreprocessing(boolean doPreprocessing)voidsetFlushCache(boolean flushCache)voidsetHostName(String value)voidsetHostVersion(String value)voidsetScanForNestedJars(boolean scanForNestedJars)voidstart(MutableClassLoader cl)voidstop(MutableClassLoader cl)voiduninstallBundle(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
-
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()
-
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
-
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
-
findFileStartingWidth
public static File findFileStartingWidth(File dir, String prefix)
-
copyTree
public static void copyTree(File src, File dst) throws IOException
- Throws:
IOException
-
-