Sample JEE Application: Contoso Order Service

To get a better understanding of how to use the SCOM 2012 Add-on of the JEE Application Server feature in future blog posts, it is going to be necessary to have an application to talk about (and write Management Packs (MPs) against). For that reason, I am going to introduce a simple application dubbed the Contoso Order Service. For this particular case, the application developed is a RESTful-like servlet representing an online ordering system.

Overview

To fulfill the demo needs, this application has a few URLs that can be hit to modify/set availability and performance data to exercises different features of the customer management pack.

When the servlet deploys, a ServletContextListener deploys Availability and Performance MBeans to the JVM’s MBean store. The ServletContextListener also unregisters the MBeans when the application stops or un-deploys.

The Servlet itself does not do much, but it does offer several URLs for tweaking the Availability and Performance MBeans.

Availability MBean

The Availability MBean provides several stock pieces of metadata describing the online ordering system:

  • Department
  • IsRunning
  • Organization Code
  • Start Time
  • Version

The IsRunning parameter is set to false when the application deploys.  The IsRunning parameter can be modified by a HTTP GET of the following URLs:

Performance MBean

The Performance MBean provides three statistics:

  • Average Transaction Time
  • Faults For Interval
  • Transactions For Interval

 

These are integers and are randomly generated for each query. The MBean may be configured to increase a baseline number so that the performance metrics will exceed a given threshold. The baseline can be modified by a HTTP GET of the following URLs:

 

ContosoOrderService.zip