openInstaller: During configuration , Correct update progress should be shown on installer screen.


Project Description:

OpenInstaller should show the correct update progress to the user.The Installer should show the messages on screen ,about the task configurator is doing, e.g Starting the server, stopping the server etc.Installer should log configuration related messages too.


Use Cases:

UC-001

1. User start the installer.
2. User see the correct update progress during configuration.
3. User see the messages from configurator, about the task, is doing during configuration.
4. All the configuration messages are logged.


Requirements:

  • Scenario where configurator takes more than 15 min and so,user sometime feels that installer

is hung and she abort the installer in mid.So user must be presented with correct update progress
during configuration.(Must requirement for portal)

  • During configuration update progress,the messages related to configuration activities should

be shown on screen,e.g. configurator is starting server , stopping server etc.

  • Proper configuration log messages should be logged.

Currently we log the messages in installer log.

  • Loosely coupled configurator- This requirement need to be discussed with James.

First rough design draft

  • OI will be using the JMX for updating the progress bar for configuration.OI will be implementing the Mbeans

for notification.Mbean will be having the methods to updates the attributes for messages on screen and for
progress on screen.Mbean provides the operation that will be invoked by component configurator to update its
progress,Once the attributes for message, progress are modified , these beans will be emitting the notifications
that can be captured by OI to show the accurate update progress.

  • Mbeans will be created with defined interfaces and will be registered with object name in Mbean server in OI JVM.Once Mbeans are

created and registered in OI JVM, through RMI connector it will be available to remote clients.
So in OI side Mbean need to create and register in Mbean server, Also OI need to create the connector server,
So remote client can invoke operation on Mbeans.

  • Component configurator can invoke the operation on Mbeans by creating a connector, once they are connected to Mbean server

they can invoke operation on Mbeans using Mbean's objectname.Component team dont need any OI jar to compile their configurator.

  • OI is using RMI for connector server, So it need to run rmiregistry on some port known to client.

Here as port is available for connection ,that may cause security hacks.JMX provides way to secure the connection, that OI
will be using when it creates and start the connector server.

The above is first draft, there may be changes.

Design illustration

Discussion

  • 20th JULY 2007 with James Falkner.Two issue came up
    1. Do component team need to have OI jars to compile their

java configurators.
2. What about the security when ports are open for any connection.
Both issues are addresed in design doc.

Project Completion Date

  • 27th July 2007

But We need to dig JMX more to implement the design , that may require 7 more days from the scheduled date ,to complete this project (03-08-2007).

Project Team

  • Lead: Sandeep
  • Team: James

Project Status

  • Completed

How To Use

To use this you need to write JMX client code , that you can invoke it from init-config script.

OI provides three new ENV variable available to init-config , that you should pass to JMX client code.

These variables you need, to connect to OI JMX server and send progress.
INIT_CONFIG_PROGRESS_PASSWORD
INIT_CONFIG_PROGRESS_RMIPORT

INIT_CONFIG_PROGRESS_OBJECTNAME

Below is the Sample init-config script , This is template for Solaris or Linux, For Windows you need to write VBS/BAT script to achieve same functionality.

#init-config script
MYDIR=`dirname $0` 
cd ${MYDIR}
#This is the java that is being used in the main installer, so we
#can re-use it when we call our java-based wrapper.
JAVA_HOME=${INIT_CONFIG_JAVA_HOME}
#This classpath includes the necessary paths to allow our wrapper to
#find helper classes such as WrapperHelper and the application wrapper
#itself.
JAVA_CLASSPATH=${CLASSPATH}:${INIT_CONFIG_JAVA_CLASSPATH}:${MYDIR}
${JAVA_HOME}/bin/java -cp ${JAVA_CLASSPATH} Client ${INIT_CONFIG_PROGRESS_PASSWORD} ${INIT_CONFIG_PROGRESS_RMIPORT}  ${INIT_CONFIG_PROGRESS_OBJECTNAME} $*

Below is the Client code that is invoked by init-config script to update progress.

import java.util.HashMap;
  import javax.management.Attribute;
  import javax.management.MBeanServerConnection;
  import javax.management.MBeanServerInvocationHandler;
  import javax.management.ObjectName;
  import javax.management.remote.JMXConnector;
  import javax.management.remote.JMXConnectorFactory;
  import javax.management.remote.JMXServiceURL;
 
  public class Client {
   
    public static void main(String[] aArgs) {
      try {
      /* Create an RMI connector client and
         connect it to the RMI connector server */
//Step 1:  Getting the passwd from init-config
        String thePassword = aArgs[0];

// Step 2: Getting RMI port
        String thePort = aArgs[1];

//Step 3: Getting the OI Progress object
        String theObjectName = aArgs[2];

//Step 4: Create a hashmap and store the password obtained in Step 1 .
        HashMap<String, String> theEnv = new HashMap<String, String>();
        theEnv.put("jmx.remote.credentials", thePassword);

//Step 5 : Create a JMX service URL , port you have to use that you got in Step 2.
        JMXServiceURL theUrl = new JMXServiceURL(
         "service:jmx:rmi:///jndi/rmi://localhost:"+thePort+"/server");

//Step 6: Create a JMX connector by passing url (obtained in step 5) and theEnv ( obtained in step 4)
        JMXConnector jmxc = JMXConnectorFactory.connect(theUrl, theEnv);
       
        /* Get an MBeanServerConnection */
// Step 7 : Create an MBeanServerConnection from JMXConnector instance obtained in step 6.
        MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

//Step 8: create a objectname using theObjectName
        ObjectName mbeanName = new ObjectName(theObjectName);
        for (int i=1;i<=100;i++){

// Step 9: Send the progress( from 1 to 100) and messages to OI Screen , To send the progress and message to OI you need to call the invoke method of MBeanServerConnection instance.Following is an example.
// i is progress of configurator , and second argument "Test_Configurator_Messages" is the message set by configurator on OI screen.
//Every time you execute some step , you need to update the third argument of invoke with progress and configurator message.
          mbsc.invoke(mbeanName,"configProgress",new Object[]{i,"Test_Configurator_Messages"},new String[]{"int","java.lang.String"});
// Do some config operation and call invoke (mbeanName,"configProgress",new Object[]{progress,"Some Configurator message "},new String[]{"int","java.lang.String"});
        }
       
        /* Close MBeanServer connection*/
// Step 10: Close the connection
        jmxc.close();
// Step 11: Finally send the Result report to OI .
        printResultReport("SUCCESS",null,null,null,"NO Next STEP");
      } catch (Exception theEx) {
        theEx.printStackTrace();
      }
    }
   
    public static void printResultReport(final String aConfigStatus, final String aPlatformError,
     final String aProductError, final String aDocReference, final String aNextSteps) {
      System.err.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
      System.err.print("<resultReport xmlns=\'http://openinstaller.org/config/resultreport/V1\'>");
      System.err.print("<configStatus>" + aConfigStatus + "</configStatus>");
      System.err.print("<platformError>" + aPlatformError + "</platformError>");
      System.err.print("<productError>" + aProductError + "</productError>");
      System.err.print("<docReference>" + aDocReference + "</docReference>");
      System.err.print("<nextSteps>" + aNextSteps + "</nextSteps>");
      System.err.print("</resultReport>");
    }
  }


conf-1.png (image/png)