A general purpose framework for Java CLI applications based on Tcl and OSGi.
The framework consists of 2 bundles and an executable jar file:
- ScLauncher - executable
- ScAPI, ScUI - bundles
ScLauncher starts the OSGi framework and passes command line arguments to ScUI.
ScAPI provides core services such as the Tcl interpreter.
ScUI finds TclCommandProvider's, extends the Tcl interpreter with new commands, services command line arguments, and starts the Tcl shell.
For a quick demostration, clone the project, or grab the files under the demo directory. You will need the Java8 runtime installed.
demo initially contains the following:
ScLauncher-1.0.0.jar
conf
config.properties
bundle
ScAPI-1.2.0.jar
ScUI-1.0.0.jar
ScTest-1.0.0.jar
You can start the application using:
java -jar ScLauncher-1.0.0.jar
You should see the prompt of the Tcl shell:
sc_shell>
In addition to standard Tcl commands, ScAPI provides 3 commands:
- help
- printvar
- print_versions
ScTest demonstrates adding a new feature to the framework. ScTest wraps the jtcl internal tests in a bundle and provides them with a new command called internal_test.
You can also try removing ScTest from the framework:
- Move ScTest-1.0.0.jar to a different directory.
- Remove the Felix cache: rm -rf felix-cache
- java -jar ScLauncher-1.0.0.jar
Note the internal_test command is no longer available in the Tcl shell.
To return the functionality,
- Move ScTest-1.0.0.jar back to the bundle directory
- Remove the Felix cache: rm -rf felix-cache
- java -jar ScLauncher-1.0.0.jar
Now the internal_test command is available again.
The Documentation directory contains code to automate generating aspects of the application:
- Help files ready for internationalization.
- cmd classes.
- Error messages ready for internationalization.
- Internal variables declared by bundles.
- Written documentation for help, errors and variables.
The definitions are written to a XML schema and provide the means to always keep the source code and written documentation in sync. The code also checks the definitions in the XML to the code, and vice versa.
Documentation uses make as its build tool.
You will need the following to build:
- Java8
- Eclipse for RCP and RAP Developers
- Bndtools from Eclipse Marketplace
- make
- ant
- Maven
By default, Eclipse builds the bundles. You use Bndtools to release the bundles. You also may need to run ant from ScLauncher to create the executable jar under generated.
- Build the ODF jar.
cd external
mvn package
- Start Eclipse and open the Bntools perspective.
- Create a new Bnd OSGi Workspace.
- Open Projects from File System (ScLauncher, ScAPI, ScUI, ScTest).
- Eclipse automatically builds the projects.
- Use Bndtools to release bundles.
- Use ant to generate the ScLauncher executable jar.
cd ScLauncher
ant
- Create a new Bnd project.
- Create a cmd subdirectory if the bundle provides Tcl commands.
- Create XML files in the Documentation/definitions directories for commands/help, errors and variables.
- Use make to create the cmd class templates, etc.
- Use Eclipse to add functionality.
- Use Bndtools to release the bundle.
- Link the released bundle under cnf/release to the demo/bundle directory.
- Test and have fun.
Project Scandium stands on the shoulders of giants to provide its functionality.
- ANTLR ANother Tool for Language Recognition. BSD-3-clause license
- Apache Felix OSGi Release 6 layer. Apache-2.0 license
- JTcl Project Tcl. Sun Labs license
- Apache Commons CLI CLI support. Apache-2.0 license
- JLine Command line editing. BSD-2-clause license
- Java Native Access Native support for JLine. Apache-2.0 license
- Apache ODF Toolkit ODF file output. Apache-2.0 license
Any file modifications are stored under the external directory.
- 1.2.0 Changed ClassResolver for Java9
- 1.1.0 Added ANTLR v4 to ScAPI
- 1.0.0 Initial Release