FarragoEclipse
Contents |
Farrago Development
Instructions for setting up Eclipse for use in Farrago development:
- Get an ant-only build of Farrago working
- Download and unpack a copy of Eclipse SDK 3.1
- From Farrago, run ant createEclipseProject; this will generate .project and .classpath files with the correct thirdparty dependencies predefined.
- Start Eclipse
- Accept the default workspace location (or customize your own), and check the box to make it the default
- Choose Workbench
- From the top menu, choose File->New->Project
- Choose the Java Project wizard (but not from Existing Ant Buildfile)
- Enter farrago for the project name
- Change Contents to Create project from existing source
- Enter the path to farrago (e.g. /home/calvin/open/farrago)
- Click the Finish button
- From the top menu, choose Project->Properties
- Open the Java Code Style tree node and select Formatter
- Click the Enable project specific settings checkbox
- Click the Import button
- Browse to and select farrago/eclipse/codeFormat.xml
- Select Organize Imports in the tree
- For the Number of imports needed for .*, change the value to 0 to force imports to get collapsed
- Click the Apply button and then Yes to rebuild the project; you may get a lot of warnings, but there should be no errors
- Click OK
- Open the Java Code Style tree node and select Formatter
- You should now be able to browse source files, build, run JUnit tests, etc.
- Install the Perforce plugin
- From the Package Explorer, right-click the farrago project to get a pop-up menu
- Choose Team->Share Project
- Select Perforce for repository type and click Next
- Enter connection information for your client and click Finish
Note that whenever the thirdparty classpath defined in the ant build changes, you will need to rerun ant createEclipseProject to propagate the changes. No other action should be required.
Farrago Server Debugging
For ad-hoc SQL debugging, here's the procedure:
- Browse to class net.sf.farrago.test.FarragoDebugServer
- Debug the main method as a Java Application
- You will see the Farrago server startup messages in the console at the bottom
- Run a client such as the sqllineClient script to connect to the server
- Set breakpoints, debug, etc.
- When you are done, after disconnecting the client, go back to the Eclipse console window and enter the !quit command to shut down the server cleanly (yes, you can type stuff in that window!)
There are two errors you might encounter if you get a problem trying to load the database. The first is: "Installation error: required Java property java.util.logging.config.file not set". The second error is: "java.lang.UnsatisfiedLinkError: no farrago in java.library.path".
To fix the first error, open the Debug Configurations window within the Debug As context menu, and click the Arguments tab. Put in "-Dnet.sf.farrago.home=. -Djava.util.logging.config.file=trace/FarragoTrace.properties" under the VM Arguments option. These are normally passed with the farragoServer script so you need to include them manually for Eclipse.
To fix the second error, open the Debug Configurations window again and open the Environment tab. Add a new variable called LD_LIBRARY_PATH and set its value to be "/path/to/dev/fennel/farrago". There is a .so file (.dll for Windows) that needs to be loaded and that particular path is usually set by the user from sourcing the contents of fennelenv.sh.
LucidDB Debugging
If you want to debug the LucidDB server or tests, you can follow steps similar to the ones above for Farrago.
- Start with ant createEclipseProject from the luciddb directory, register the project, etc.
- Select the new luciddb project, configure its Build Path, and click Link Source from the Source tab.
- Enter the location of farrago/src.
- You'll need to give it an alias such as farrago_src to avoid clashing with luciddb/src.
- Click Finish to save the path.
To debug the server:
- Browse to class com.lucidera.luciddb.test.LucidDbDebugServer and debug it (as above for FarragoDebugServer).
WARNING: building the luciddb project will create duplicate class copies of farrago, which is not what you want unless you want mysterious runtime errors after making changes.
Debugging Via sqllineEngine
Here's an alternate way to debug, using sqllineEngine:
- From a shell prompt, run sqllineEngine using sh -x sqllineEngine. This will allow you to see the full java command required to run sqllineEngine. The last line of trace should be formatted as java [vm_args...] [java class] [program arguments...]
- In Eclipse, from the Run menu, select Debug.... This brings up a window for editing debug configurations.
- In the left tree pane, select Java Application and hit the button underneath the pane for New debug configuration.
- In the right window pane, under the Main tab, enter sqlline.SqlLine as your Main class
- Select the Arguments tab
- Copy and paste the Program and VM (java virtual machine) arguments that were used to run your program (as described above)
- For working directory, enter the full path to farrago (or luciddb) such as /home/calvin/open/farrago.
- To run a luciddb version of sqllineEngine, there are two extra steps. Navigate to the Classpath tab. Remove the default classpath (because it will cause Farrago to be loaded). Then, navigate to the Source tab. Click Add on the right hand side. Then, click on Java Project. This will display a list of your current projects. Select the one corresponding to your Farrago project. Then, click OK. This allows Eclipse to find the corresponding Farrago source files when you're debugging LucidDB.
- Finally, at the bottom right corner of the window, there are buttons to Apply the changes to your configuration, and to Debug using your configuration.