[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/management JobConnectorHelper.j
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-09-13 23:29:49
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25427/framework/management Modified Files: JobConnectorHelper.java JobManagementAgent.java Log Message: no message Index: JobManagementAgent.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobManagementAgent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JobManagementAgent.java 6 Sep 2006 22:07:43 -0000 1.4 --- JobManagementAgent.java 13 Sep 2006 23:29:45 -0000 1.5 *************** *** 11,14 **** --- 11,16 ---- import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.ErrorCode; + import org.jmonks.batchserver.framework.JobContext; + import org.jmonks.batchserver.framework.Main; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.controller.JobController; *************** *** 115,121 **** * @throws IllegalStateException If manager is already started or already stopped. */ ! public boolean start(String jobName,JobController jobController) { logger.trace("Entering start"); if(this.started) throw new IllegalStateException("job management agent has been already started."); --- 117,127 ---- * @throws IllegalStateException If manager is already started or already stopped. */ ! public boolean start(JobContext jobContext, JobController jobController, Main agentManager) { logger.trace("Entering start"); + + if(!(agentManager instanceof Main)) + throw new SecurityException("Not authorized to manage the agent."); + if(this.started) throw new IllegalStateException("job management agent has been already started."); *************** *** 123,132 **** throw new IllegalStateException("job management agent has been already stopped."); ! if(jobName==null || "".equals(jobName)) ! throw new IllegalArgumentException("job name cannot be null or empty to start the job management agent."); if(jobController==null) throw new IllegalArgumentException("controller object cannot be null to start the job management agent."); ! this.jobName=jobName; try --- 129,138 ---- throw new IllegalStateException("job management agent has been already stopped."); ! if(jobContext==null) ! throw new IllegalArgumentException("job context cannot be null to start the job management agent."); if(jobController==null) throw new IllegalArgumentException("controller object cannot be null to start the job management agent."); ! this.jobName=jobContext.getJobName(); try *************** *** 164,168 **** */ this.jmxConnectorServer.start(); ! boolean registered=this.jobConnectorHelper.registerConnectorServer(jobName,this.jmxConnectorServer); if(registered) { --- 170,174 ---- */ this.jmxConnectorServer.start(); ! boolean registered=this.jobConnectorHelper.registerConnectorServer(jobContext,this.jmxConnectorServer); if(registered) { *************** *** 220,226 **** * @throws IllegalStateException If agent is already stopped or it not yet started. */ ! public boolean stop(ErrorCode exitCode) { logger.trace("Entering stop"); if(!this.started) throw new IllegalStateException("Job management agent has not been started."); --- 226,236 ---- * @throws IllegalStateException If agent is already stopped or it not yet started. */ ! public boolean stop(JobContext jobContext, ErrorCode exitCode, Main agentManager) { logger.trace("Entering stop"); + + if(!(agentManager instanceof Main)) + throw new SecurityException("Not authorized to manage the agent."); + if(!this.started) throw new IllegalStateException("Job management agent has not been started."); *************** *** 228,231 **** --- 238,244 ---- if(this.stopped) throw new IllegalStateException("Job management agent has been stopped already."); + + if(jobContext==null) + throw new IllegalArgumentException("Job context cannot be null to stop the server."); if(exitCode==null) *************** *** 234,238 **** { this.jmxConnectorServer.stop(); ! this.jobConnectorHelper.unregisterConnectorServer(this.jobName); this.stopped=true; logger.debug("unregistered the jmx connector server from lookup location"); --- 247,251 ---- { this.jmxConnectorServer.stop(); ! this.jobConnectorHelper.unregisterConnectorServer(jobContext); this.stopped=true; logger.debug("unregistered the jmx connector server from lookup location"); Index: JobConnectorHelper.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/management/JobConnectorHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JobConnectorHelper.java 12 Sep 2006 23:24:09 -0000 1.3 --- JobConnectorHelper.java 13 Sep 2006 23:29:45 -0000 1.4 *************** *** 10,19 **** package org.jmonks.batchserver.framework.management; - - import java.util.List; import java.util.Map; - import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorServer; import org.apache.log4j.Logger; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; --- 10,17 ---- package org.jmonks.batchserver.framework.management; import java.util.Map; import javax.management.remote.JMXConnectorServer; import org.apache.log4j.Logger; + import org.jmonks.batchserver.framework.JobContext; import org.jmonks.batchserver.framework.config.ConfigurationException; import org.jmonks.batchserver.framework.config.FrameworkConfig; *************** *** 140,144 **** * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean registerConnectorServer(String jobName,JMXConnectorServer connectorServer); /** --- 138,142 ---- * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean registerConnectorServer(JobContext jobContext,JMXConnectorServer connectorServer); /** *************** *** 152,156 **** * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean unregisterConnectorServer(String jobName); } --- 150,154 ---- * @throws IllegalArgumentException If job name paramter is null. */ ! public abstract boolean unregisterConnectorServer(JobContext jobContext); } |