Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Stardust/Knowledge Base/BuildChangeMgmt/UtilityProjects

Introduction

This article describes how to build and use Utility projects within Stardust J2EE projects. Utility projects support re-use of components across multiple projects and can simplify upgrade of Stardust versions by separating custom logic from the Stardust runtime. JARs and projects are often provided within Knowledge Base examples.

Scope

This document describes how to package and import Utility projects as utility JARs, or components according to Sun Java Project Conventions.

Utility Projects

Utility project structure complies with Sun Java Project Conventions and the Maven Standard Directory Layout.

Project Structure

To build this example of my-Utility by hand:

  • Create a new utility project in Eclipse e.g. my-Utility
  • Remove the source folder /src from Java Build Path
  • Create the following folder paths and add */java and */resource as source folders
  • my-webContent/src/main/java
  • my-webContent/src/main/resource
  • my-webContent/src/test/java
  • my-webContent/src/test/resources
  • Place WEB-INF in /src/main/resource

If your project uses Stardust classes then also add a User Library to the project's Java Build Path containing all JARs within e.g. %Stardust_INSTALL%/lib

src/main

Examples of main source are:

  • All Java classes except test classes
  • All Javascript classes, e.g. transformation application scripts

Examples of main resources are:

  • XSD referenced in XPDL -/main/resources/xsd
  • Process (XPDL) models -/main/resources/xpdl
  • Configuration files used by the component - /main/resources/config
  • Images - /main/resources/images
  • Email templates - /main/resources/email
  • XHTML content - /main/resources/xhtml - additional steps are required to create a web content utility project

src/test

Each classes should have a corresponding test class as part of test driven development. These classes should be placed in /test/java, with any supporting test resources in test/resources Examples of test resources are

XML generated from main XSD, e.g. for use in testing JMS or Web Service payloads -/test/resources/xsd

SOAP-UI calls - test/resources/soap

Of course in the case of production deployment, /test/resources and /test/java should be removed as a source folders, and/or not exported into JARs.

Importing utility projects as a J2EE Web component

Import <my_utility> as a project into your workspace, then add:

  • <my_utility> as a required project on build path (Projects tab) within Project properties (Java Build Path)
  • <my_utility> as a J2EE Module Dependency in Project properties

Exporting a project as Jar

You can select the File->Export->Java->JAR file option from Eclipse to export the utility project as a JAR. This can then be copied into your Stardust WAR and used within your process.

Back to the top