wiki:Doc/SCDB/Eclipse

Version 17 (modified by /C=BE/O=BEGRID/OU=VUB/OU=IIHE/CN=Stijn De Weirdt, 16 years ago) (diff)

--

Using Eclipse with SCDB

Eclipse is an open source, multi-platform IDE (Integrated Development Environment) written in Java that provides a file browser, an editor, a SVN client, access to compilers and lot of other tools. It is neither part of SCDB, nor a requirement to use SCDB.

When used with SCDB, it brings a graphical interface for administering SCDB and editing templates. With very few customizations, Eclipse can be used to edit templates, compile them, and deploy machine profiles while taking advantage of all the advanced features you find in Eclipse: local history, file browsing and searching, ability to open a template directly at the line causing an error, and others.

Instructions in this page explain how to customize Eclipse for SCDB. This is not an introduction to Eclipse usage itself. Refer to online documentation in Eclipse. Configuration described here has already been tested on Linux, MacOS, and Windows but should work on any other platforms as all components used are pure Java.

Installation

Installing Eclipse

Eclipse can be downloaded from http://www.eclipse.org. The site provides pre-built distributions for Windows, Linux, and MacOSX making installation trivial. Recent versions of Eclipse offer several different pre-configured versions. For SCDB, the "Eclipse Classic" is the most appropriate.

Before being able to run Eclipse, you need to install Java JRE or JDK on your machine. SCDB requires Java 1.5 or later. You need to check on Eclipse site minimum Java version required by Eclipse. As of Eclipse 3.2, it was lower than SCDB.

If you have several Java JREs or JDKs installed on your machine, run Eclipse, goto Preferences->Java (in Window menu) and check the version used by Eclipse matches both Eclipse and SCDB requirements.

Note : Java JDK is required only for some advanced operations like generating new OS templates. Java JRE is enough for daily administration of SCDB.

Installating Eclipse plugins

For Eclipse to work with SCDB, some additional software, called plugins, needs to be installed. To do this, run Eclipse and use Software Updates->Find and Install...->Search for New Features to Install -> Next in Help menu. Then add a new remote site for each of the following plugins :

After adding each site, select them and click on Finish button.

Configuration

File Encoding

You are encouraged to change the default encoding for the files that eclipse creates.

  • To do so, go to Window -> Preferences -> General -> Workspace, and change the Text file encoding to something that's supported on the nodes managed by quattor (iso8859-1 ?).
  • Also, you'll probably want to use UNIX newline styles, which you can choose in New text file line delimiter

SVNKit

The default SVN interface chosen by Subclipse is JavaHL (JNI). This needs to be changed to SVNKit.

  • To do so goto Window -> Preferences -> Team -> SVN and select SVNKit (Pure Java) in SVN Interface. Then press Apply and OK.
    • This might prompt an error message saying Failed to load JavaHL library. This can be ignored by pressing OK.

Colorer

Colorer is used to do syntax coloring when editing PAN templates.

Syntax coloring rules are defined in a file pan.hrc that can be downloaded from Quattor CVS (in elfms/Quattor/utils/eclipse). This file must be placed in /path/to/eclipse/plugins/net.sf.colorer_VERSION/colorer/hrc/auto.

Then an entry for these syntax colouring rules must be added to /path/to/eclipse/plugins/net.sf.colorer_VERSION/colorer/catalog.xml. This is done by editing this file and adding the following line to the hrc-sets: <location link="hrc/auto/pan.hrc"/>

Last, add an association between .tpl file extension and Colorer Editor. To do this, go to Window->Preferences->General->Editors->File Associations, add .tpl and associate the Colorer Editor with it.

For the new Colorer configuration to be taken into account, you need to restart Eclipse.

If you run into an error message like Error in initialization of native part of the Colorer library, this might mean 2 things

  • colorer can't find the catalog.xml file
  • it can't load the libnet_sf_colorer library
    • it can't find it
      • this shouldn't happen by default setup
    • the library is built against code that is not on your system
      • linux
        • locate the file (typically in $ECLIPSE_HOME/plugins/net.sf.colorer_x.y.z/os/linux/x86/
        • runn ldd $PATH_TO_DIR/libnet_sf_colorer.so
        • see if you have everything
          • eg on FC8, you need to install an additional rpm called compat-libstdc++-33

Sunshade

If you have Sunshade installed inside eclipse, then you can hyperlink between errors generated by the pan compiler and the file. To do this you need to add some regular expressions to the Sunshade "Error Link" configuration. Open the Eclipse options panel (using Window->Preferences) and then navigate to the "Sunshade" and then "Error Link" pages. On this page add the following regular expressions:

\[panc\]\s*DEPRECATED:\s+(.*)\s+\[(\d+):(\d+)\]
\[([^\[\]]+\.tpl)(?::(\d+)\.(\d+)-\d+\.\d+)\]

The links identified with these expressions will take you to the start of the expression causing the error. Note that the error messages give you the full range of the expression in the format "beginLine.beginChar-endLine.endChar".

Note : The regexp above are intended for panc v7 and later. If you are still using panc v6 or before, you need to use a different set of regular expressions. Both can coexist.

\[pan-syntax\]\s*(.*\.tpl):(\d+):
\[pan-compile\]\s*(.*\.tpl):(\d+)
\[pan-syntax\].*[\s\(](.*\.tpl)

JavaSVN and certificates

When using JavaSVN in combination with certificates, you must add the password in the ~/.subversion/servers file. Make sure that this file has correct access rights (as it contains cleartext password, it must have mode 400).

A full example looks like :

[groups]
somegroup = some.full.host, *.some.domain
[somegroup]
ssl-client-cert-file = /bla/bla/bla.p12
ssl-client-cert-password=hahahahaha
[global]
ssl-authority-files = /bla/bla/bla/ca_local.crt

Configuring Java VM for Ant

Be sure to read instructions about running PAN compiler if you experiment any strange behaviour or slowness. Itis recommended to run SCDB Ant tasks in the same Java VM as Eclipse workspace, especially if your machine doesn't have a lot of memory (1 GB or more). You can check the current setting by right-clicking on the build.xml file in ant pane and choosing Run As...->External Tools and then clicking on JRE tab.

Note : it is not possible to use the same Java VM as the workspace if you need to adjust some VM parameters like maximum memory.

Known Problems

WARNING: missing modifyThread permission

Look at PAN compiler FAQ. Short summary : use Java 1.6 and configure Eclipse to use it (Windows->Preferences->Jave->Installed JREs).