Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » UOMo » Osgi requirements
Osgi requirements [message #1015250] Wed, 27 February 2013 21:40 Go to next message
Barry DeZonia is currently offline Barry DeZoniaFriend
Messages: 3
Registered: January 2013
Junior Member
Hello,

Some time ago I played with uomo to determine the minimal set of jars I would require for the kinds of operations I would need. I wrote a very simple test (below) and determined which jars would be required. Osgi turned out to be one of those jars. Is it always required? Could the design be massaged to allow users to use your library without osgi? Or am I doing something wrong?

public static void main(String[] args) {
// SystemOfUnits system = SI.getInstance();
Unit<Length> km = SI.METRE.multiply(1000);
Unit<Length> foot = Imperial.INCH.multiply(12);
UnitConverter converter = km.getConverterTo(foot);
Parser<String, Unit<?>> p = null;
Unit<?> userDefinedUnit = (p == null) ? null : p.parse("m/s^2");
System.out.println("0.1 km in feet = " + converter.convert(0.1));
}
Re: Osgi requirements [message #1015257 is a reply to message #1015250] Wed, 27 February 2013 22:07 Go to previous messageGo to next message
Barry DeZonia is currently offline Barry DeZoniaFriend
Messages: 3
Registered: January 2013
Junior Member
Here was the list of jars required to compile that example:

icu4j-4.8.1.1.jar
osgi-3.5.0.v20090520.jar : DAMN!
unit-api-0.6.1.jar (units of measure interface api)
uomo core, uomo ucum, and uomo units jars
Re: Osgi requirements [message #1032110 is a reply to message #1015250] Tue, 02 April 2013 15:24 Go to previous message
Werner Keil is currently offline Werner KeilFriend
Messages: 1087
Registered: July 2009
Senior Member
Barry,

Thanks a lot for your message and suggestions.

Funny you say, OSGi was the bigger issue than ICU4J, at least from a size
perspective that may scare some people;-)
The projects are defined as OSGi bundles, thus a minimal OSGi reference is
hard to avoid, and at least for Eclipse projects this is quite mandatory;-)
Another reference to OSGi or related Eclipse JARs is i18n via Eclipse
Babel/OSGi NLS: org.eclipse.osgi.util.NLS
It is also recommended if not required to use this in Eclipse projects.

I added the following console example based on your suggested example:
http://git.eclipse.org/c/uomo/org.eclipse.uomo.git/tree/examples/units/org.eclipse.uomo.examples.units.console/src/main/java/org/eclipse/uomo/examples/units/console/sandbox/OSGiRequirements.java

Unless you add these kinds of things via Git/Gerrit those who are not
official Eclipse committers can't be mentioned as @author, else we have all
kinds of IP troubles, please let me know, if you have any issue with this
example, that's why it is in the "sandbox", a test bed for examples that may
be changed or removed at any time;-)

All parts of your example code but the unit (UCUM) parser call were correct
and working.
As for the correct UCUM syntax, I added a somewhat similar usage of Parser
to the existing UCUM Test project:
http://git.eclipse.org/c/uomo/org.eclipse.uomo.git/tree/bundles/org.eclipse.uomo.ucum.tests/src/test/java/org/eclipse/uomo/ucum/tests/UcumServiceTest.java

This test passes, it would fail (and theoretically something like that could
be added to the unit test, too;-) if you use "m/s^2" since the correct UCUM
code is "m/s2".

To run the examples or unit tests locally, it is best to follow my
instructions from the "How to download and use" thread I just answered here.
Once you have a local Maven repository, you can run standalone apps without
OSGi, while for obvious reasons the UOMo bundles require some very basic
OSGi dependencies internally. Like with other Maven artifacts, those can be
loaded using Maven just as well.

Kind Regards,
Werner

"Barry DeZonia" schrieb im Newsbeitrag
news:kglufj$t81$1@xxxxxxxxe.org...

Here was the list of jars required to compile that example:

icu4j-4.8.1.1.jar
osgi-3.5.0.v20090520.jar : DAMN!
unit-api-0.6.1.jar (units of measure interface api)
uomo core, uomo ucum, and uomo units jars

Hello,

Some time ago I played with uomo to determine the minimal set of jars I
would require for the kinds of operations I would need. I wrote a very
simple test (below) and determined which jars would be required. Osgi turned
out to be one of those jars. Is it always required? Could the design be
massaged to allow users to use your library without osgi? Or am I doing
something wrong?

public static void main(String[] args) {
// SystemOfUnits system = SI.getInstance();
Unit<Length> km = SI.METRE.multiply(1000);
Unit<Length> foot = Imperial.INCH.multiply(12);
UnitConverter converter = km.getConverterTo(foot);
Parser<String, Unit<?>> p = null;
Unit<?> userDefinedUnit = (p == null) ? null : p.parse("m/s^2");
System.out.println("0.1 km in feet = " + converter.convert(0.1));
}
Previous Topic:Please vote for UOMo at Eclipse Awards 2013
Next Topic:How to download and use
Goto Forum:
  


Current Time: Thu Mar 28 11:39:36 GMT 2024

Powered by FUDForum. Page generated in 0.06727 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top