System services

  • Each service should have a corresponding LifeCycle MBean registered
    with an ObjectName independant of the implementation (use the interface
    instead of the class name)
  • Management services should always throw RuntimeException with a message
    compliant with the xml description
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jbi-task version="1.0"
          xmlns="http://java.sun.com/xml/ns/jbi/management-message">
  <jbi-task-result>
    <frmwk-task-result>
      <frmwk-task-result-details>
        <task-result-details>
          <task-id>deploy</task-id>
          <task-result>FAILED</task-result>
          <message-type>ERROR</message-type>
          <exception-info>
            <nesting-level>1</nesting-level>
            <msg-loc-info>
              <loc-token>JBI1009</loc-token>
              <loc-message>Unable to deploy {1}. Missing {2} section in jbi.xml
              </loc-message>
              <loc-param>file://d/jbi/samples/1/sampleAU.jar</loc-param>
              <loc-param>service-unit</loc-param>
            </msg-loc-info>
            <stack-trace>....</stack-trace>
          </exception-info>
          <locale>en</locale>
        </task-result-details>
      </frmwk-task-result-details>
      <is-cause-framework>YES</is-cause-framework>
    </frmwk-task-result>
  </jbi-task-result>
</jbi-task>
  • Internationalisation

InstallationService:

loadNewInstaller

  • unpack jar in a temp dir
  • parse / validate the jbi descriptor
  • if a component with the same name is already loaded (installed or not installed but with an installer loaded)
    fail the request
  • create a directory for this installer
    check the component name first, then patterns with (component name + "." + index)
    until one non existing directory is found
  • create / init bootstrap
  • create and register the installer mbean

loadInstaller

  • check for an already loaded installer and return it if found
  • check that the requested component is installed
  • create / init bootstrap
  • create and register the installer mbean

unloadInstaller

  • if the component is installed throw an exception
  • locate the installer mbean
  • if found, unregister it
  • delete directory if requested
    if not possible to delete directory, put a ".delete" file at root
    these directories should be removed when container restarts

installSharedLibrary

  • TODO

uninstallSharedLibrary

  • TODO

Installer

getInstallerConfigurationMBean

  • query the bootstrap for the configuration bean name and return it

install

  • call bootstrap onInstall / cleanUp sequence
  • create the component (no lifecycle involved)
  • save its state (SHUTDOWN)

uninstall

  • check that the component is stopped and has no service units
  • shutdown the component
  • call bootstrap onUninstall / cleanUp sequence

ComponentLifeCycle

NOTE

The jbi container must ensure that valid transitions are propagated to
the component

start

  • if component is running, do nothing
  • if component is shutdown, call init on its lifecycle
  • call start
  • persist state if not system restart
  • if system restart,
    initialize all SUs (they become stopped)
    restore previous state (started, stopped or shutdown)

stop

  • if component is shutdown, throw an exception
  • if component is stopped, return
  • if component is running,
    stop all service units
    call stop on component lifecycle
    persist state if not system shutdown

shutdown

  • if component is running, stop it
  • if component is stopped,
    shutdown all service units
    call shutdown on component lifecycle
  • persist state if not system restart

DeploymentService

TODO