Building JAS3 from source requires Apache Ant.
wget http://apache.oregonstate.edu/ant/binaries/apache-ant-1.6.5-bin.zip unzip apache-ant-1.6.5-bin.zip |
JAS3 and most of its non-external dependencies can be found on the FreeHep SVN.
This command will checkout the JAS3 trunk from SVN.
svn co svn://svn.freehep.org/svn/jas/trunk/ |
Much of JAS3's functionality is found in the freehep package.
CVS checkout command.
setenv CVSROOT :pserver:anoncvs@cvs.freehep.org:/cvs/freehep cvs login [jascvs] cvs co -P freehep |
cd freehep export FREEHEP=`pwd` tools/ant |
cd jas3 ant |
Make a file ~/jas3.properties containing the following:
FREEHEP=C:\path\to\freehep |
On Windows, the path separators need to be double backslashes. (Check same for Unix???) |
Now, run from JAS3:
ant extLibs |
This pulls all FreeHep external library jars files into the jas3/extensions directory.
JAS uses plugins for most of its functionality. A plugin (org.freehep.application.Studio.Plugin) is a loadable module that is supposed to encapsulate certain functionality, such as handling of a specific data format.
On startup, JAS looks for this path in the jar file to load a plugin.
PLUGIN-inf/plugins.xml |
For example, here is the contents of that file for the org.lcsim plugin.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plugins SYSTEM "http://java.freehep.org/schemas/plugin/1.0/plugin.dtd"> <plugins> <plugin> <information> <name>org.lcsim</name> <category>hep.linearcollider</category> <author>LCSIM Team</author> <version>0.9</version> <description kind="short">org.lcsim plugin for JAS3</description> <description>org.lcsim plugin for JAS3.</description> <load-at-start/> </information> <resources> <j2se minVersion="1.5"/> <file href="http://jas.freehep.org/jas3/plugins/lcsim/0.9/lcsim.jar" location="lcsim.jar"/> <file href="http://jas.freehep.org/jas3/plugins/lcsim/0.9/freehep-physics.jar" location="freehep-physics.jar"/> <file href="http://jas.freehep.org/jas3/plugins/lcsim/0.9/sio.jar" location="sio.jar"/> <file href="http://jas.freehep.org/jas3/plugins/lcsim/0.9/GeomConverter.jar" location="GeomConverter.jar"/> <file href="http://jas.freehep.org/jas3/plugins/lcsim/0.9/commons-math.jar" location="commons-math.jar"/> </resources> <plugin-desc class="org.lcsim.plugin.LCSimPlugin"/> </plugin> </plugins> |
The load-at-start tag under information means that JAS will automatically instantiate this plugin when the application starts.
The class to be loaded is listed under plugin-desc as org.lcsim.plugin.LCSimPlugin.
Any initialization should be performed in the init() method. The postInit() method is used for any initialization that involves other plugins that may not have been loaded when init() was called.
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE MenuSystem SYSTEM "http://java.freehep.org/schemas/menus/1.0/menus.dtd"> <MenuSystem> <MenuBar id="mainMenu"> <Menu name="File" mnemonic="F" location="100"> <Menu name="New" mnemonic="N" location="50"> <Component type="default" icon="/classpath/to/examplePluginIcon.gif" name="Example Plugin" mnemonic="E" command="ExamplePlugin" location="1200"/> </Menu> </Menu> </MenuBar> </MenuSystem> |
Within the init() function of the plugin class, the following lines of code should be used to build the menus.
Studio app = getApplication(); XMLMenuBuilder builder = app.getXMLMenuBuilder(); URL xml = getClass().getResource("ExamplePlugin.menus"); builder.build(xml); |