fr.dyade.aaa.agent
Class SCAdminHelper

java.lang.Object
  extended by fr.dyade.aaa.agent.SCAdminHelper

public class SCAdminHelper
extends java.lang.Object


Field Summary
protected  java.util.Hashtable ASP
          Hashtable that contain all Process of running AgentServer
protected  org.objectweb.util.monolog.api.Logger logmon
           
 
Constructor Summary
SCAdminHelper()
           
 
Method Summary
 void closeServerStream(java.lang.Process p)
          Closes all subsequent streams of the process to avoid deadlock due to limited buffer size.
 void crashAgentServer(short sid, int port)
          Stops violently an agent server from its id.
 void crashAgentServer(short sid, java.lang.String host, int port)
          Stops violently an agent server from its id.
 void destroyAgentServer(short sid)
          Kill an agent server and remove it from the ASP table.
 java.lang.Process execAgentServer(short sid, java.io.File dir, java.lang.String[] jvmargs, java.lang.String className, java.lang.String[] args)
          Runs an agent server from its id and specific parameters.
 int exitValue(short sid)
          Ask for the exit value of an agent server.
 int joinAgentServer(short sid)
          Causes the current thread to wait, if necessary, until the process running this agent server has terminated.
 void killAgentServer(short sid)
          Kills this agent server process.
 java.lang.String startAgentServer(short sid)
          Starts an agent server from its id.
 java.lang.String startAgentServer(short sid, java.io.File dir, java.lang.String[] jvmargs)
          Starts an agent server from its id using specific jvmargs and storage directory.
 java.lang.String startAgentServer(short sid, java.io.File dir, java.lang.String[] jvmargs, java.lang.String[] args)
          Starts an agent server from its id using specific jvmargs and storage directory.
 java.lang.String startAgentServer(short sid, java.io.File dir, java.lang.String[] jvmargs, java.lang.String className, java.lang.String[] args)
          Starts an agent server from its id.
 java.lang.String startAgentServer(short sid, java.lang.String[] jvmargs)
          Starts an agent server from its id using specific jvmargs.
 void stopAgentServer(short sid, int port)
          Stops cleanly an agent server from its id.
 void stopAgentServer(short sid, java.lang.String host, int port)
          Stops cleanly an agent server from its id.
 java.lang.String waitServerStarting(java.lang.Process p)
          Waits for the starting of an AgentServer pointed out by its process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASP

protected java.util.Hashtable ASP
Hashtable that contain all Process of running AgentServer


logmon

protected org.objectweb.util.monolog.api.Logger logmon
Constructor Detail

SCAdminHelper

public SCAdminHelper()
Method Detail

startAgentServer

public java.lang.String startAgentServer(short sid)
                                  throws java.lang.Exception
Starts an agent server from its id.

Parameters:
sid - id of agent server to start
Throws:
java.lang.Exception

startAgentServer

public java.lang.String startAgentServer(short sid,
                                         java.lang.String[] jvmargs)
                                  throws java.lang.Exception
Starts an agent server from its id using specific jvmargs.

Parameters:
sid - id of agent server to start
jvmargs - arguments to pass to the created java program
Throws:
java.lang.Exception

startAgentServer

public java.lang.String startAgentServer(short sid,
                                         java.io.File dir,
                                         java.lang.String[] jvmargs)
                                  throws java.lang.Exception
Starts an agent server from its id using specific jvmargs and storage directory.

Parameters:
sid - id of agent server to start
dir - new working directory for the created agent server, current working directory if null
jvmargs - arguments to pass to the created java program
Throws:
java.lang.Exception

startAgentServer

public java.lang.String startAgentServer(short sid,
                                         java.io.File dir,
                                         java.lang.String[] jvmargs,
                                         java.lang.String[] args)
                                  throws java.lang.Exception
Starts an agent server from its id using specific jvmargs and storage directory.

Parameters:
sid - id of agent server to start
dir - new working directory for the created agent server, current working directory if null
jvmargs - arguments to pass to the created java program
args - additional arguments to pass to the created java program
Throws:
java.lang.Exception

startAgentServer

public java.lang.String startAgentServer(short sid,
                                         java.io.File dir,
                                         java.lang.String[] jvmargs,
                                         java.lang.String className,
                                         java.lang.String[] args)
                                  throws java.lang.Exception
Starts an agent server from its id.

Parameters:
sid - id of agent server to start
dir - new working directory for the created agent server, current working directory if null
jvmargs - arguments to pass to the created java program
className - the name of the main class
args - additional arguments to pass to the created java program
Throws:
java.lang.Exception

execAgentServer

public java.lang.Process execAgentServer(short sid,
                                         java.io.File dir,
                                         java.lang.String[] jvmargs,
                                         java.lang.String className,
                                         java.lang.String[] args)
                                  throws java.lang.Exception
Runs an agent server from its id and specific parameters.

Parameters:
sid - id of agent server to start
dir - new working directory for the created agent server, current working directory if null
jvmargs - arguments to pass to the created java program
className - the name of the main class
args - additional arguments to pass to the created java program
Throws:
java.lang.Exception

waitServerStarting

public java.lang.String waitServerStarting(java.lang.Process p)
                                    throws java.lang.Exception
Waits for the starting of an AgentServer pointed out by its process.

Parameters:
p - the AgentServer process.
Throws:
java.lang.Exception

closeServerStream

public void closeServerStream(java.lang.Process p)
                       throws java.lang.Exception
Closes all subsequent streams of the process to avoid deadlock due to limited buffer size.

Parameters:
p - the AgentServer process.
Throws:
java.lang.Exception

killAgentServer

public void killAgentServer(short sid)
                     throws java.lang.Exception
Kills this agent server process.

Parameters:
sid - id of agent server to stop
Throws:
java.lang.Exception

joinAgentServer

public int joinAgentServer(short sid)
                    throws java.lang.Exception
Causes the current thread to wait, if necessary, until the process running this agent server has terminated.

Parameters:
sid - id of agent server to stop
Returns:
the exit value of the agent server.
Throws:
UnknownServerException - if the agent server is unknown.
java.lang.Exception

exitValue

public int exitValue(short sid)
              throws java.lang.IllegalThreadStateException,
                     UnknownServerException
Ask for the exit value of an agent server.

Parameters:
sid - id of agent server to stop
Returns:
the exit value of the agent server.
Throws:
java.lang.IllegalThreadStateException - if the agent server is still running.
UnknownServerException - if the agent server is unknown.

destroyAgentServer

public void destroyAgentServer(short sid)
                        throws java.lang.Exception
Kill an agent server and remove it from the ASP table.

Parameters:
sid - id of agent server to stop
Throws:
java.lang.Exception

stopAgentServer

public void stopAgentServer(short sid,
                            int port)
                     throws java.lang.Exception
Stops cleanly an agent server from its id.

Parameters:
sid - id of agent server to stop
port - port of the corresponding AdminProxy.
Throws:
java.lang.Exception

stopAgentServer

public void stopAgentServer(short sid,
                            java.lang.String host,
                            int port)
                     throws java.lang.Exception
Stops cleanly an agent server from its id.

Parameters:
sid - id of agent server to stop
host - hostname of the agent server.
port - port of the corresponding AdminProxy.
Throws:
java.lang.Exception

crashAgentServer

public void crashAgentServer(short sid,
                             int port)
                      throws java.lang.Exception
Stops violently an agent server from its id.

Parameters:
sid - id of agent server to stop
port - port of the corresponding AdminProxy.
Throws:
java.lang.Exception

crashAgentServer

public void crashAgentServer(short sid,
                             java.lang.String host,
                             int port)
                      throws java.lang.Exception
Stops violently an agent server from its id.

Parameters:
sid - id of agent server to stop
host - hostname of the agent server.
port - port of the corresponding AdminProxy.
Throws:
java.lang.Exception


Copyright © 2011 ScalAgent D.T.. All Rights Reserved.