Creating many business applications from one grouping pattern

Learn how to create a universal grouping pattern that generates many business applications automatically.

In the following example, a database with sample data is used. The database contains the following components:
  • WebSphere Cell with some servers and deployed Java Platform, Enterprise Edition applications
  • JBoss servers with some applications
  • Computer systems, of which some are a part of virtual environment
  • DB2 databases
  • Web servers
  • other components

The aim of this task is to create a separate business application for each Java Platform, Enterprise Edition application that is deployed on every application server in the example environment. You do not have to create separate grouping patterns for them, only one is enough. Moreover, when you add an application to the database after you created the grouping pattern, a business application is still automatically created for such application.

  1. Open Data Management Portal.
  2. In the Functions pane, click Discovery if you use TADDM 7.3.0, or, or Analytics, if you use TADDM, or later.
  3. Click Grouping Patterns. The Grouping Patterns table is displayed.
  4. In the name field, enter Generic J2EE applications.
  5. Set the pattern type to Business Application.
  6. For the Schedule option, choose Every day at 1am.
  7. In the Description field, enter Generic J2EE applications and click Next.
  8. Create new selector. In the Name field, enter Generic J2EE Selector.
  9. In the Description field, enter Selector creating separate Business Application for every J2EE application, and click Choose.
  10. In the query editor, select the MQL query as the selection type and in the Query field enter 2EEApplication WHERE domain is-null.
  11. The grouping name expression resolves to a business application name, which is a unique key that identifies business applications. Therefore, it cannot resolve to a pattern name, as only one business application would be created. To avoid it, you can use the Java Platform, Enterprise Edition application name as the grouping name expression. In the Grouping Name Expression field enter the following expression:
    To see the results, click Test.
    The names are long. To shorten them, instead of the displayName attribute, you can use the name attribute:
    To see the results, click Test.
    You can further change some of the names, for example, the ones which have ear file name. You can remove the .ear extension by using the following expression:
    $utils.regex(${}, "(.*)\.ear", "(.*)" )
    In this expression, the "(.*)\.ear" expression removes the .ear extension from the file name, and the resulting name is the remaining part of that file name. The "(.*)" expression leaves the name as it is. To see the results, click Test.
    You do not need to modify the names any further. However, there are applications with the same name from different environments, for example the test and production environments. To distinguish them, you can add to their names a prefix with JBoss domain name, or WebSphere Cell name. Use the following expression:
    $utils.or($, $coreCI.parent.parent.displayName)$utils.regex(${}, "(.*)\.ear", "(.*)" )
    WebSphere Cells have always the name attribute set, so the $ expression returns all WebSphere Cell names. It is not always the case for JBoss domain, where sometimes the displayName attribute is set. Use the or expression so that the first argument that is not null is returned for each application. To see the results, click Test.
    You can still have more information, for example server type and a prefix to easily distinguish Java Platform, Enterprise Edition based applications from others. To add the prefix, enter J2EE in front of the expression:
    J2EE $utils.or($, $coreCI.parent.parent.displayName)$utils.regex(${}, "(.*)\.ear", "(.*)" )
    To add the server type, use the following expression:
    J2EE [${coreCI.parent.productName}] $utils.or($, $coreCI.parent.parent.displayName)$utils.regex(${}, "(.*)\.ear", "(.*)" )
    The server type is taken from the productName attribute of application servers. Because application servers are parents of Java Platform, Enterprise Edition applications, the expression that generates server type is in square brackets. To see the results, click Test.
    The server type names are too long. You can remove the Application word from the server type name by using the following expression:
    J2EE [$utils.regex($coreCI.parent.productName, "(.*) Application.*", "(.*)")] $utils.or($, $coreCI.parent.parent.displayName)$utils.regex(${}, "(.*)\.ear", "(.*)" )
    If the name contains the Application word, it is removed by the "(.*) Application.*" expression. If the name does not contain such word, the "(.*)") expression leaves it as it is. To see the results, click Test.
    The results look good. Click OK.
  12. To save the new grouping pattern, click Next and then Finish.
To see the new business applications, open the Grouping Patterns pane, select the grouping pattern that you created and click Execute. Wait for a while and then click Refresh View. After the grouping pattern is generated, you can view the new business applications in the Dicovered Components pane.