PKI Eclipse

From Dogtag
Jump to: navigation, search

Overview

It is recommended that you use Eclipse for Dogtag development. The source tree is set up such that you can easily import it as a project into Eclipse. Aside from being a nice IDE for Java development, Eclipse is able to ensure that your code meets some of our code formatting standards. To import Dogtag as a project in Eclipse, perform the following steps:

  • Clone the pki Git repository
  • In Eclipse, choose File->Import...
  • In the Import dialog box, select General->Existing Projects into Workspace, then click the Next button
  • Click the Browse... button and select the top level pki directory that you cloned from Git as your root directory.
  • Ensure that the pki project is listed and checked in your Projects list, then click the Finish button.

At this point, Dogtag will be imported as a project in Eclipse. You will likely have many build errors at this point due to missing build dependencies. It is best to consult the pki-common specfile in the source tree to see what the build dependencies are, then install them with yum. A simple way of doing this is to run the following command from within the pki directory that you cloned from Git:

$ yum install `awk '/^BuildRequires:/ {print $2}' ./specs/pki-core.spec`

Getting Eclipse

Yum install eclipse-platform eclipse-jdt

eclipse-cdt for C/C++ 

but that is a tale for another day Tomcat not included either

Getting started

Running Eclipse Workspaces

Importing the project

 file menu -> import -> general -> existing project into workspace
 Find the pki source code you checked out from Git

Getting Dependencies

  • cd pki/pki
  • sudo yum install `awk '/^BuildRequires:/ {print $2}' ./specs/pki-core.spec`

Getting JEE For Eclipse

Help->Install New Software Repository:Indigo URL http://Download.eclipse.org/releases/indigo Install New Software -> Web, XML and Java EE Developer

Tomcat Instance

  • User is you: Directory under your control:
  • The PKI Tomcat instance is very customized: Much easier to use the tomcat instance created by pkicreate than to try and make your own or work with one downloaded by eclipse.

Creating the Tomcat Instance

sudo pkicreate -pki_instance_root=$HOME/apps -subsystem_type=ca -pki_instance_name=pki-ca-dev -secure_port=8443 -unsecure_port=8080 -tomcat_server_port=8005 -user=$USER -group=$USER -verbose

Symlinks

  • demo-pki-ca -> /etc/rc.d/init.d/tomcat6
  • bin -> /usr/share/tomcat6/bin
  • lib -> /usr/share/tomcat6/lib
  • Remove webapps/ca/WEB-INF/lib/pki*\
  • Symlink webapps/ca/WEB-INF/classes to pki project in Eclipse

Runtime Environment

  • Windows->Preferences->Server->Runtime Environments
  • add a “Runtime Environment”  : tomcat6
  • choose the directory that pkicreate put the tomcat instance in.
  • If you missed one of the symlinks, it will give you and angry icon

Server Project

Create Server Project

  • File->New->Other->Server->Server Project

-- OR --

  • Window->Perspectives->Other->JEE
  • Right click in Server View

Server View

  • JEE Perspective: server view
  • tab on the bottom of the window
  • double click it and you should get a property sheet in the main window
  • “Use Tomcat Installation”
  • Open launch configuration
  • Classpath
  • under user entries: Add tomcat-juli.jar

Debugging

Link Source To PKI Breakpoint in known path of the application

References