This page is for JAVA developers who evaluate http://abeans.cosylab.com/ library
Please add any
- evaluation results
- success in compiling (my eclipse compiled it, see below - Marcell)
- success in running demos
- criticism
- usage ideas
Overview
Abeans is a framework for control applications.
- it implements a powerful mediator that dispatches events, requests, responses and supports indexing and archiving them.
- nice, readymade GUI code, like the flexible gauge, piper, wheelswitch, gradient, histogram and chart viewer. These widgets support parametrization at construction time and from user (right-click, preferences...)
- we need to make a so called "pluggable" package with one or more "Plug"-s (to configure GenBoard and read binary logs), an implementation of a "DatabaseProxy" ; We also need a builder that creates (hierarchy of) objects and connects them according to an XML file (these objects will make up our application).
Understanding Abeans
We started to browse around in the imported abeans source projects in eclipse to see what does what. To understand you need to
- read the javadoc comments
- check call-hierarchy
- try to understand how the demos work
- google around to find interesting stuff, classnames can be useful keywords, eg.: "abeans Plug DatabaseProxy"
Here are some classes that are very good for understanding abeans:
package com.cosylab.gui.demo.displayerdemo;
public class NumberProducerPanel extends JPanel
NumberProducerPanel builds heavily on
public class NumberDataSource extends DataSourceSupport
NumberProducerPanel makes a table of editable properties:
DefaultPropertiesTable table = new DefaultPropertiesTable();
Understand how JButton set = new JButton("Set Characteristics"); button's ActionListener sends around the changed properties to all consumers from source.setCharacteristics(map);.
in ..datatypes project:
public interface NumericProperty extends AbstractProperty
The following must be understood to make a "Plug" to talk to GenBoard:
abean_abeans project:
package abeans.pluggable;
The communication must be realized through Plug:
public abstract class Plug extends ComponentSupport implements QoSProvider
what to evaluate?
http://abeans.cosylab.com/ is a nice library, however we need to evaluate
- footprint: is it reasonable if we use just what we need from it: it seems so, if we depend on a JRE anyway, the abeans lib is relatively slim.
- license is acceptable: GPL (http://www.cosylab.com/legal/abeans_license.htm). LGPL would be better, since GPL means that anything built on it must be GPL too. Not too bad, we would most likely licence it GPL anyway.
- dependencies: abeans doesn't depend on anything special. I tried on 1.4 java. The plug we make will depend on some javax.comm implementation (such as rxtx or sun's) if rs232 is used.
libraries to compile
You don't need to compile the libraries, as abeans is also available in 8 jars, totalling to about 3 megabyte. However it is nice to make eclipse resolve the libraries, so you can jump around the objects and methods.
I made a snapshot from my disk after the below procedures:
- http://www.vems.hu/files/java/abeans-classpath.zip (4kbyte) only the .classpath (easier to copy these than clicking it together in project-buildpath-addexternaljar); this will be enough if you have already downloaded everything
- ... abeans-full.zip (7Mbyte) could not upload this due to filesize restriction
Original location: http://www.cosylab.com/abeans/distributions/3.1/
I downloaded all sources so I can jump around variables in eclipse (press F3 when mouse is over a variable)
I downloaded some jars:
- java-common...
- jca2-common...
- cosybeans-common-3.1.0-b2.jar
- [ http://192.18.97.47/ECom/EComTicketServlet/BEGINsdlcweb1d.sun.com-14200%3A4126f991%3Acef5a02d93337da9/-2147483648/488910243/1/461138/461126/488910243/2ts+/westCoastFSEND/7026-jaws_dev_pack-1.2-oth-JPR/7026-jaws_dev_pack-1.2-oth-JPR:2/javaws-1_2-i-dev.zip download JNLP] - required for com.cosylab.gui.core.test.AllCosyBeansTests
- [Infobus library]
(maybe less would be enough) and added to the build CLASSPATH (in eclipse.org project, properties, build, add external jar)
Do we want a conveniency tarball of jars?
First I copied all the sources into the same project, but a "project rebuild" took ages. Therefore I separated to separate projects (8 projects). The downside is that the required libraries (jar-s) must be added to each. I did this manually, maybe some script would have been useful.
To find the jars I ran this command with sh in my jar-collection tree eclipse/lib and searched for the "unable to resolve" classes (like "junit/framework/TestC" .. ) in the result output textfile to locate the jar for the given library class.\n
for i do echo $i jar tvf $i done
don't miss:
among millions of other useful classes:
- com.cosylab.util.Heap
- com.cosylab.gui.components.demo.GaugerDemo
- com.cosylab.gui.core.test.AllCosyBeansTests (reqires jnlp.jar)
- com.cosylab.gui.components.SplashScreen main()
successfully run :
- com.cosylab.gui.demo.DisplayerDemo see the picture above. Click-right on the widgets, and set preferences: colors, texts, numberformat, scale, auto-stretch, logarithmic, alarm threshold etc.. This is 'the most useful demo to follow inside eclipse to understand how all the gui components interact.
- abeans/cosybeans... source folder, com.cosylab.gui.demo.CosyBeansRootDemo ; However it only displays some pic, and a pane, but nothing useful.
- abeans_cosybeans_common project com.cosylab.gui.components.demo.CosyBeansCommonRootDemo is very nice (note: the hifichart ain't work for me). The Gauger is the most important one (gauge type depends on X-Y ratio!), same as seen before.
Dummy question: How to run com.cosylab.gui.demo.DisplayerDemo ?
In eclipse you select the class and say "Run, Run as, application".
If you have the CLASSPATH set, you can say java com.cosylab.gui.demo.DisplayerDemo from a command prompt which will run the public static void main(String[]) method of the given class.
Gabor: I successfully ran all of above.
com.cosylab.gui.components.Demonstrator main() can take an argument, the name of a class that extends com.cosylab.gui.components.demonstrator.AbstractDemoPanel;
surely com.cosylab.gui.components.Demonstrator does have
public static void main(String[] args) method (really, I just copy-pasted from the file). I think you checked sg. else than Demonstrator class in package com.cosylab.gui.components;
You maybe messed up your eclipse so it does not understand the file as a java file ! (make new java project, make source folder, copy the classes there, refresh from eclipse).
At least try to pass classnames (set command line Arguments in the Run... menu)
- com.cosylab.abeans.demo.LauncherStartingDemoPanel (this will let you select from many demos)
- com.cosylab.gui.components.demo.GaugerDemo (very nice, and resizable: can be vertical bar, round gauge or horizontal type depending on X-Y ratio)
- continue listing ... with your notes
Notes:
- getting the object of given class happens com.cosylab.gui.components.Demonstrator main()
- see AbstractDemoPanel references and type hierarchy to see what demos can be run this way.
- first it said java.lang.Error: Unresolved compilation problem: The method assert(boolean) is undefined .. Solution: switch compilation to 1.4 mode in eclipse project, build, compiler, compliance, all tabs to 1.4 ... if in doubt, see http://java.sun.com/developer/onlineTraining/new2java/supplements/2004/may04.html
rxtx working
Works on linux. I had some mixnmatch with different versions of the library, that caused problem.\n
root@oops:/h/t/java/commapi/samples/Simple# java -noverify SimpleRead Found port: /dev/ttyS0 primep=20 primep_temp_scaling=A0
(the SimpleRead class reads only, I typed mct on PS2)
I found that jcl.jar (besides RXTXcomm.jar, javax.comm.properties and the .so files must be in place, CLASSPATH and LD_LIBRARY_PATH set accordingly).
I used the 2.1.7pre17 from http://www.rxtx.org/
the main guideline was:
http://wass.homelinux.net/howtos/Comm_How-To.shtml
that suggested the -noverify. Note that the rxtx 2.1.x version required less steps than in the guideline.
Misc links
- [Understand Abeans - start here]
- http://www.cosylab.com/page.php?mid=3&sid=34
- http://kgb.ijs.si/KGB/articles/2003-ICALEPCS/Where_and_What_Exactly_is_Knowledge_in_Control_Systems.doc
- http://abeans.cosylab.com/Abeans/cosydocs/PGM-Plug_Classes.html
Go back to