org.jmonks.batch.framework.management
Class JobConnectorHelper

java.lang.Object
  extended byorg.jmonks.batch.framework.management.JobConnectorHelper
Direct Known Subclasses:
JMXMPConnectorHelper

public abstract class JobConnectorHelper
extends java.lang.Object

JobConnectorHelper defines the helper methods will be used in creating the JMX connector server, registering and unregistering the JMX connector server in lookup location. Because of many possible implementations available in creating the JMX connector server and lookup locations, this class defines the methods to choose their own implementations. Mainly, Agent looks for the following information and activities from the concrete implementations of the connector helper class.


This class provides the factory method to return the configured JobConnectorHelper instance by looking at the framework configuration and make sure only one instance will be created for the job.

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Constructor Summary
JobConnectorHelper()
           
 
Method Summary
abstract  javax.management.remote.JMXConnectorServer createConnectorServer()
          Creates the JMX connector server based on the desired connector protocol.
static JobConnectorHelper getJobConnectorHelper(FrameworkConfig.JobConnectorConfig jobConnectorConfig, JobManagementAgent agent)
          This factory method creates the correct implementation of JobConnectorHelper based on the given configuration which is defined in framework-config.xml file.
protected abstract  void init(java.util.Map configProps)
          This method will be called after instantiating the JobConnectorHelper to initialize JobConnectorHelper with the properties needed to create JMX connector server and initialize the lookup location needed to register and unregister the JMX connector servers.
abstract  boolean registerConnectorServer(JobContext jobContext, javax.management.remote.JMXConnectorServer connectorServer)
          Registers the jmx connector server with the job name taken from job context in the desired lookup location.
abstract  boolean unregisterConnectorServer(JobContext jobContext)
          Unregisters the jmx connector server registered in desired lookup location with the job name available in job context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobConnectorHelper

public JobConnectorHelper()
Method Detail

getJobConnectorHelper

public static JobConnectorHelper getJobConnectorHelper(FrameworkConfig.JobConnectorConfig jobConnectorConfig,
                                                       JobManagementAgent agent)
This factory method creates the correct implementation of JobConnectorHelper based on the given configuration which is defined in framework-config.xml file. This looks for the following configuration and uses the class name provided at the job-connector-helper-class-name attribute to create the helper instance.
    <job-connector-config job-connector-helper-class-name="org.jmonks.batch.framework.management.jmxmp.repository.RepositoryJMXMPConnectorHelper">
          <property key="mgmt-mntr-config-key">mgmt-mntr-config-value</property>
    </job-connector-config>
 

Returns:
Returns the JobConnectorHelper implemenation.
Throws:
java.lang.SecurityException - If there is any attempt to create the job connector helper by other than JobManagementAgent.
ConfigurationException - If configuration could not be found or implementation class cannot be accessed or instantiated.

init

protected abstract void init(java.util.Map configProps)
This method will be called after instantiating the JobConnectorHelper to initialize JobConnectorHelper with the properties needed to create JMX connector server and initialize the lookup location needed to register and unregister the JMX connector servers.

Parameters:
configProps - Properties defined for this connector server as a map.
Throws:
ConfigurationException - If required properties for this connector server are missing.

createConnectorServer

public abstract javax.management.remote.JMXConnectorServer createConnectorServer()
Creates the JMX connector server based on the desired connector protocol.

Returns:
Returns the JMX connector server, null, if helper cannot create the connector server.

registerConnectorServer

public abstract boolean registerConnectorServer(JobContext jobContext,
                                                javax.management.remote.JMXConnectorServer connectorServer)
Registers the jmx connector server with the job name taken from job context in the desired lookup location.

Parameters:
jobContext - Context of the job is being run.
Returns:
Returns true, if it successfully registred in lookup location, false, otherwise.
Throws:
java.lang.IllegalArgumentException - If job name paramter is null.

unregisterConnectorServer

public abstract boolean unregisterConnectorServer(JobContext jobContext)
Unregisters the jmx connector server registered in desired lookup location with the job name available in job context.

Parameters:
jobContext - Context of the job is being run.
Returns:
Returns true, if it successfully unregistered, false otherwise.
Throws:
java.lang.IllegalArgumentException - If job name paramter is null.