livespace.osgi.bootstrap
Class Main

java.lang.Object
  extended by livespace.osgi.bootstrap.Main

public class Main
extends Object

Shell class that boots the OSGi framework JAR using parameters in the config/boot.properties file. If the JAR is remote (e.g. via an HTTP URL), the JAR is first copied to the working area. Required properties:

   livespace.osgi.work_dir: Local working directory for bundles, datastore,
     etc. e.g. "work/osgi_ics-display-rht" or just "work".
   livespace.osgi.path: Root of local/remote OSGi source data. This can be a
     local directory (usually so during testing) or a remote path accessible
     via HTTP or some other remote protocol.
   livespace.osgi.config.current: Path to the the current (e.g. the
     current room's) config set. e.g. "${livespace.osgi.path}/config/ics".
   livespace.osgi.config.default: Path to the default config set. e.g.
     "${livespace.osgi.path}/config/default".
 
Optional:
   livespace.osgi.bundle_path: If not set, this is set to
   ${livespace.osgi.path}/lib/bundles.
   
   livespace.osgi.bundle_version: If not set, this is set to the same
   property loaded from  ${livespace.osgi.path}/config/livespace.properties.
 
NOTES: This class assumes the OSGi framework jar can be copied/loaded from ${livespace.osgi.path}/lib/osgi.jar if it's not in the local lib directory and that the bundle repository is at ${livespace.osgi.path}/lib/bundles. The boot class and arguments are stored in ${livespace.osgi.path}/config/boot.properties.


Field Summary
static Object bootstrapContext
          Bundle context of bootstrap activator: set by activator on start(), cleared on stop().
 
Constructor Summary
Main()
           
 
Method Summary
static void cache(String sourceUrl, File targetFile)
           
static void cache(URL sourceUrl, File targetFile)
          Cache a file from a source URL to a local file.
protected static void info(String message)
           
static void main(String[] args)
           
static void run()
           
static void setStartLevel(int startlevel)
           
static void start()
           
static void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bootstrapContext

public static Object bootstrapContext
Bundle context of bootstrap activator: set by activator on start(), cleared on stop(). This is not declared as a BundleContext instance to avoid class not found errors in the case where osgi.jar hasn't been copied over yet.

Constructor Detail

Main

public Main()
Method Detail

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException

start

public static void start()

run

public static void run()
                throws IOException,
                       ClassNotFoundException,
                       NoSuchMethodException,
                       InvocationTargetException
Throws:
IOException
ClassNotFoundException
NoSuchMethodException
InvocationTargetException

stop

public static void stop()
                 throws org.osgi.framework.BundleException
Throws:
org.osgi.framework.BundleException

setStartLevel

public static void setStartLevel(int startlevel)
                          throws IllegalStateException
Throws:
IllegalStateException

cache

public static void cache(String sourceUrl,
                         File targetFile)
                  throws IOException
Throws:
IOException

cache

public static void cache(URL sourceUrl,
                         File targetFile)
                  throws IOException
Cache a file from a source URL to a local file. Does not copy if local file is up to date.

Parameters:
sourceUrl - An HTTP URL pointing to the source file.
targetFile - The file to copy to.
Throws:
IOException

info

protected static void info(String message)


Copyright © 2008 Commonwealth of Australia