• Adi Jaradat

Maximo AppService Explained

Updated: Feb 25

If you have acquired the habit of going through Maximo log files, you would have probably noticed Maximo initializing services at startup. Some log lines looking quite similar to the snippet below! At least we know that those services are initialized at the startup of the server.

 18 Nov 2019 10:41:17:347 [INFO] BMXAA6348I - The WORKFLOW service is initializing.
 18 Nov 2019 10:41:17:427 [INFO] BMXAA6348I - The SAFETY service is initializing.
 18 Nov 2019 10:41:17:428 [INFO] BMXAA6348I - The COMPANY service is initializing.
 18 Nov 2019 10:41:17:432 [INFO] BMXAA6348I - The ASSETCATALOG service is initializing.
 18 Nov 2019 10:41:17:433 [INFO] BMXAA6348I - The MEASUREMENT service is initializing.
 18 Nov 2019 10:41:17:434 [INFO] BMXAA6348I - The CURRENCY service is initializing.  

So what is Maximo AppService?


It’s a way to abstract capabilities that are useful to many apps and objects while having them wrapped up as a service. For example, an AppService can be application/object specific and provide capabilities for ASSET.


Another example is services which provide capabilities across the entire system like ESCLLATION or MAXVARS. Others can be targeted to serve integration with external systems.


Example of app-related services:

Example of cross system services:


How to create Maximo AppService


To create a new Service in Maximo 7.1, follow the steps:

  1. Go to Database configuration > List Tab

  2. Click on “Select Action Menu” and select “Services”

  3. A dialog box will open and display all the services.

  4. Click on New Row.

  5. Enter your service name and class name (service class) path.

  6. Enter id and click ok.

Maximo AppService Explained Database Configuration

The AppService definition is stored in MAXSERVICE table:

Select servicename, classname from maxservice where active=1 order by initorder 


Implementing Custom AppService


AppServices have status representing its life cycle:

  1. Loaded

  2. Initialized

  3. Running

  4. Stopped

To create a Maximo custom service class you need to extend AppService class. If you want to use this service class methods in your MBO classes, you have to define your method as static. Listed below are some of the AppService methods in the calling order:

Here is a skeleton code to build a custom AppService

Custom Code – Interface

 package custom.mypackage;
 import java.rmi.RemoteException;
 import psdi.security.UserInfo;
 import psdi.server.AppServiceRemote;
 import psdi.util.MXException;

 public interface CustomAppServiceRemote extends AppServiceRemote
 {
       public static final String STATICVALUE = "SOMEVALUE";
       public abstract String doSomething(UserInfo paramUserInfo, String paramString) throws MXException, RemoteException;
 } 

Custom code – Implementation

 package custom.mypackage;
 import java.rmi.RemoteException;
 import java.sql.Connection;
 import java.util.Properties;
 import psdi.security.ConnectionKey;
 import psdi.security.UserInfo;
 import psdi.server.AppService;
 import psdi.server.Dependable;
 import psdi.server.MXServer;
 import psdi.server.Service;
 import psdi.util.MXException;

 public class CustomAppService extends AppService implements CustomAppServiceRemote, Service, Dependable
 {
      public CustomAppService() throws RemoteException
      {}

      public CustomAppService(MXServer mxServer) throws RemoteException
      {
            super(mxServer);
      }

      @Override
      public void configure(Properties cf)
      {
            super.configure(cf);
      }

      @Override
      public boolean isSingletonService()
      {
            return super.isSingletonService();
      }

      @Override
      public void init()
      {
            super.init();
            // Example, register listener
            EventListener listener1 = new EventListener();
            MXServer.getEventTopicTree().register("maximo.object.event", listener1);

            // Example, initialize custom cache
            MaximoCache cache1 = new MaximoCache();
            getMXServer().addToMaximoCache(cache1.getName(), cache1);

            // Example, get DB connection
            Connection conn = null;
            ConnectionKey sKey = null;
            sKey = getMXServer().getDBManager().getSystemConnectionKey();
            conn = getMXServer().getDBManager().getConnection(sKey);getMXServer().getDBManager().freeConnection(sKey);
      }

      @Override
      public void destroy()
      {
            super.destroy();
      }

      public String doSomething(UserInfo paramUserInfo, String paramString) throws MXException, RemoteException
      {
            return STATICVALUE;
      }
 } 

Links

https://adijaradat.com/post/maximo-maxsession-table-explained/

https://adijaradat.com/post/the-power-of-maximo-url-parameters-builder/

https://adijaradat.com/post/creating-maximo-generic-iframe-custom-component/

https://developer.ibm.com/assetmanagement/7609-maximo-javadoc/

4 views0 comments

Recent Posts

See All

Maximo Events Explained

Learn about Maximo Events and how to register a new event and listen to events and re-act accordingly

 
  • LinkedIn
  • Twitter

©2021 by Adi Jaradat.