This article describes my favoured Eclipse set up to work with OPA web applications (ODS and OWD) in Java. I will describe a set up for OWD, but this can easily be adapted for ODS.
Select a target runtime, I am using Tomcat 7. If you don’t have one set up already then follow the usual Eclipse method of adding or installing a web runtime. And use 2.4 for the web module version.
Locate your OPA Java runtime (downloaded from Oracle). Unzip the archive somewhere and locate the "web-determinations" directory. Expand the contained web-determinations.war using an unzip tool.
I now re-use this expanded WAR across several projects that share the same OPA version.
The next step is to link this directory into you web project.
So your Eclipse project contents should look like this.
Now we need to tell Eclipse to use the OWD war directory. Go to the project properties (alt-enter or right click on project and select properties). Go to the Deployment Assembly section and select Add and select the Folder directive.
Select the expanded WAR directory this is now accessible via the folder linked into the Eclipse project
The deployment assembly should now look like
Depending on what you want to do you may decide to remove the Eclipse generated "WebContent" directory completely. However if you will be making any changes to the web context then it is useful to have a second web content directory as it acts as an overlay allowing you to override files in the out of the box web application without changing the original. However you will have to remove the additional web.xml at this point to allow things to work - so delete or rename the WebContent/WEB-INF/web.xml file.
You can now run your Eclipse hosted OWD. Right click on the project and select Run As -> Run on Server. The console should start to show the Tomcat (in my case) start up logging and a browser window will open on the OWD home url.
Now for some rulebases. If you are working on a specific rulebase then link it in whatever way suits you best. For this article I am going to expose all of the compiled rulebases that are supplied in the OPA Java Runtime.
Using the standard out of the box OWD configuration this directory should be mapped to the WEB-INF/classes/rulebases directory.
Now restart the server and refresh the OWD url.
You are now ready to go developing Java extensions, playing around with configuration files or Velocity templates. Some things to note.
- Any resources that are present in the out of the box WEB-INF/classes directory can be overriden without changing the originals by adding them into the project src directory, this includes Velocity templates and properties files found in OWD.
- You can override web.xml settings by placing a copy appropriately in your project WebContent directory, and this can be used to add other public web resources also.