The bundles provide modularity by separating conserns like server, gogo shell, and different types of conversions.
The system is extensible because the server uses @Reference and can take in any Converter component, which it will use.
To extend with a new converter, register a new bundle with a Converter component, or use the gogo shell with addConversion "F = C * 1.8 + 32"
.
Disclaimer: I worked alongside Morten Stulen, so our assignments are inspired by each other.
Also, please evaluate assignment 1 again: https://github.com/krissrex/ntnu-tdt4250-study-emf .
Blackboard did not allow resubmission after deadline, and feedback came after deadline...
The main bundle is no.ntnu.tdt4250.oving2.server
.
Run that one.
The project was made with Java 11, but no 11 specific APIs are used. Make sure your distribution has Nashorn (Java's javascript engine). It is scheduled for removal in newer JDKs.
http://localhost:8080/convert?from=mph&to=kmh&value=50
http://localhost:8080/convert/list
http://localhost:8080/convert/list?from=kg
conversion:addConversion expression:String
conversion:convert value:Double from:String to:String
conversion:list
conversion:removeConversion from:String to:String
addConversion "G = 50 * H + 1"
http://localhost:8080/convert?from=H&to=G&value=25
removeConversion "H" "G"
conversion:list
Listing all conversions
Conversion [from=g, to=kg]
Conversion [from=kg, to=g]
Conversion [from=kg, to=lb]
Conversion [from=mph, to=kmh]
addConversion "F = C * 1.8 + 32"
convert 20 F C
Converting 20.0 C to F
68.0