Installation of Oscar
by Michel D'Hooge
If you are behind a firewall, download the four jar files (oscar, api,
bundle, doc) from
http://forge.objectweb.org/project/showfiles.php?group_id=113
and the bundle repository description at
http://oscar-osgi.sf.net/repo/repository.xml
Install with java -jar <oscarpackage> (and replace the
URLs by file:oscar... for local access).
Unjar the installed files src.jar and bundlesrc.jar (there is a warning about
the manifest file present in both jar - normal)
To check that everything is correct, you can run ANT on the build file.
Eclipse
Do as usual for the installation :-)
Creation of an Oscar Project
Create a java project with the contents pointing to oscar directory,
choose src and classes for source and output folders. Remove all the
libraries automatically selected but the ones defined in the build
file: org.mortbay.jetty-jdk1.2.jar, siena.jar, tablelayout.jar,
javax.servlet.jar, org.apache.jasper.jar, dtw.TelnetD.jar and
apache-xmlrpc.jar. I am not sure if it is important, but I advise to
order
the libraries in the same order as the ant build file.
2nd check: Build the project with the eclipse project build command.
"Of course", this won't create the
jar files, but it is still convenient; and the compiled classes are
"shared" with the ant build file (so no time lost). Finally you can run
the Ant
plug-in on the build file to generate the bundles.
Note: Since a bunch of warnings are reported in the Tasks view by eclipse,
I changed the filter to "selected resource and its children".
Launching Oscar
First we will create a new perspective with a big console view, then a
run action.
In
window menu, save perspective as... Console. Then remove everything but
the console and hide the editors. Then, maybe save again...
Create a Run Java Application with org.ungoverned.oscar.Main as the
main class. In the user classes classpath, remove everything and add
instead oscar.jar, moduleloader.jar and osgi.jar. In the source look-up
path, put the project itself. In the common tab, choose Console as the
perspective for Run mode.
Note that with the default options of Eclipse (i.e. using the classes
folder) the framework blocks after entering profile name. I did not
investigate/debug it because in any cases you will need all the other
bundles to be available... but if you modify Oscar, remember to run the
ant build file.
3rd check: You can now launch Oscar within eclipse.
Put a breakpoint in the Main class and start the debug mode, you can go
step by step. In the same way, it is possible to debug an installed
bundle (you only need to provide the path to the source).
OBR
The obr command is using the bundle repository in sourceforge. However,
if you are behind a firewall or if you want to test your bundles, or
simply because now you have all the bundles recompiled locally, you
need to modify OBR.
First copy the file repository.xml in the root of oscar
(don't put it into the bundle folder otherwise it will be clean-ed by
the ant build file). Then replace all the lines
http://oscar-osgi.sf.net/repo/XXX/XXX.jar
by file:bundle/XXX.jar.
See org.ungoverned.oscar.service.bundlerepository.BundleRecord for
details of the format.
Second, point OBR to your local copy by issuing a command like
obr urls file:repository.xml. It is also possible to define
the property oscar.repository.url with the same URL.
Third-party bundles are available on the sourceforge repository, but
will not be generated by the ant script (because the source are not
provided with oscar!). My advice is to download them when needed (for
instance the Log Reader may be of interest) and put them in the folder
bundle-3P. You must then modify the bundlerepository.txt
file to point to the correct place.
Last, when you develop your own bundles, if you want them to be available
through OBR, create another bundle meta-data file and point to both files
with the obr urls command.