Using the Programming Environment

This chapter describes how to work with the programming environment.

About the Development Environment

The DirX Identity development team uses Eclipse for Java development and Apache Ant for building the jar files. Therefore, delivered projects are Eclipse projects and you will often find a build.xml file for building the project with Ant. You can download the latest Eclipse version from http://www.eclipse.org/downloads/ and Apache Ant from http://ant.apache.org/bindownload.cgi.

See the extensive Eclipse Help for instructions on how to set up a Java project and work with Eclipse.

You can use other integrated development environments (IDEs) such as NetBeans for Java and JavaScript development, but this document does not provide any additional hints about their use.

Since most members of the DirX Identity development team work in a Windows environment, file paths are given in Windows notation.

Debugging

To debug a standalone application that you can start directly with Eclipse, simply follow the Eclipse documentation.

Debugging in IdS-J

To debug your classes in the Java Server IdS-J, you need to:

  • Set up a batch file debugServer.bat from runServer.bat.

  • Create an Eclipse Debug Configuration for a Remote Java Application.

To run the IdS-J server in debug mode, start the server via a batch file rather than as a service. Copy the file runServer.bat in the folder install_path\ids-j\bin to a new file, for example debugServer.bat. Uncomment the line that sets the debug options. The line now reads:

SET debug=-DIDM_DEBUG=ON -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,address=48174,suspend=n,server=y

This means you can now access the debug port 48174. Of course, you can change the port if needed.

Next, create a Debug Configuration for the IdS-J server in Eclipse. From the Run menu, select Debug Configurations …. In the left-hand tree, select Remote Java Application and then click New. Now you can enter the properties for your Debug Configuration. Select the project with your Java sources under test. Keep Standard (Socket Attach) as the connection type. For the host, enter the IP address or DNS name where the IdS-J server is running (usually localhost) and the port that you entered in the file debugServer.bat, typically 48174.

Note that you can debug an IdS-J server running on a separate system, even running in a virtual machine (VM), provided that the firewall settings permit remote access to the debug port.

To debug, first start the server by running the batch file debugServer.bat and then click Debug in the Eclipse Debug Configuration. The Eclipse Debug perspective should open and you should see the IdS-J threads running.

Debugging in Tomcat

To debug your classes in Apache Tomcat (especially Web Center and SPML Provisioning Services user hooks), there are the following scenarios:

  1. Tomcat is installed as a service.

  2. You have installed the zip version of Tomcat and start it via catalina.bat.

If you have installed Tomcat as a service, open the Tomcat configuration via Start > Programs > Apache > Configure Tomcat. Select the java tab and then enter the following JVM options analogous to debugging the IdS-J:

  • -Xdebug

  • -Xrunjdwp:transport=dt_socket,address=48175,server=y,suspend=n

Make sure you are using a port that is not used by another application.

Set up an Eclipse Debug Configuration the same way as described for IdS-J, but use another name for your configuration and enter the correct debug port for Tomcat. For more details, see http://tomcat.apache.org/faq/development.html#rd.

If you start your Tomcat via a batch file, set the following environment variables:

  • JPDA_ADDRESS=8000 (or another value such as 48175)

  • JPDA_TRANSPORT=dt_socket

Start Tomcat using catalina jpda start.

An open source Eclipse plug-in is also available (http://www.eclipsetotale.com/tomcatPlugin.html) that allows you to start, stop and debug Tomcat from within Eclipse in addition to creating war files and configuring Tomcat easily.