BioCoRE Java APIThis page describes the Java interface to BioCoRE. By using the Java BioCoRE API you can write support for BioCoRE directly into Java programs that you develop. The BioCoRE Control Panel is the premier example of a program that uses the API for interactions with the BioCoRE Server. You can download the source for the server and look in the
applets/ControlPanel/and find many use cases for the API.
The API is being provided as a BioCoRE java package and is available for download. The API is a jar file, and some browsers interpret jar files strangely, so if you have problems downloading the API we suggest that you right click on the link and choose the 'Save Link As' option.
Javadocs are available for the API, which you will want to refer to when you design your own programs. A test program is available, though, that shows example uses of the BioCoRE API and is actually what we use for validation testing of the server's API code.
The TestBioCoRE.java file depends on a few jar files that you will need to download to be able to compile and run it. If you download the server source code and set it up, you can compile and test the program by doing:
ant testJavaAPIIf you don't want to do that, you will need to download the Jakarta Slide Webdav library as well as the Jakarta commons httpclient library.
javac -classpath /PATH/TO/biocoreAPI.jar:/PATH/TO/SLIDE.JAR:/PATH/TO/HTTPCLIENT.JAR TestBioCoRE.javaand you can test with a command like the following. Replace the URLs with the proper URL for the BioCoRE server you are connecting to (all of it is on one line):
java -cp biocoreAPI.jar:. TestBioCoRE https://biocore-s.ks.uiuc.edu/biocore/ http://biocore.ks.uiuc.edu/biocore/If you run TestBioCoRE with no options, it will look for the API session file on your system (typically written by logging into BioCoRE and opening the Control Panel).
The TestBioCoRE program is pretty straight-forward. The main program consists of a menu loop, and methods exist for each call to the API. The methods can be used as example calls that you would wish to make in your own programs. The main difference is that the methods typically just catch an ApiException, and there is actually an entire family of ApiException subclasses that can provide much more information about an error condition, and it is recommended that these subclasses be caught individually, in order to provide the user a more meaningful experience.
To interact with the BioFS, we recommend using WebDAV. The Jakarta Slide project (mentioned earlier) is how we are doing it here, and that gives a full compliment of tools that you can use to get and deposit files and directory information.
So, a user logs into BioCoRE. By clicking on the Utilities link in the bottom left hand corner of the screen they will be presented with the Utilities menu.
An option near the end of that menu is
API Connection Information. Clicking on this will present
a table that looks something like:
URL: https://biocore-s.ks.uiuc.edu/biocore/ Session ID: A443B2E5C7534CD91B361B836D066949 Project list. Choose the ID associated with the project that you are working on: All User Test Project 1 Project X 2 Project Y 27 Project Z 93The URL, Session ID, and project ID are all values that you will need.
API Usage:See the source code for the TestBioCoRE program and the Control Panel. For JavaDocs, go to the javadoc page.