fr.dyade.aaa.agent
Class SCAdminBase

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

public class SCAdminBase
extends java.lang.Object


Field Summary
protected  A3CMLConfig a3config
           
protected  org.objectweb.util.monolog.api.Logger logmon
           
protected  SCAdminHelper scadmin
           
 
Constructor Summary
SCAdminBase()
           
SCAdminBase(java.lang.String path)
           
 
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)
          Stops violently an agent server from its id.
 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)
          Starts an agent server from its id using specific storage directory.
 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[] servargs)
          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.
 void stopAgentServer(short sid)
          Stops cleanly an agent server from its id.
 void update()
          Updates the configuration.
 void update(java.lang.String path)
           
 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

a3config

protected A3CMLConfig a3config

logmon

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

scadmin

protected SCAdminHelper scadmin
Constructor Detail

SCAdminBase

public SCAdminBase()

SCAdminBase

public SCAdminBase(java.lang.String path)
            throws java.lang.Exception
Throws:
java.lang.Exception
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.io.File dir)
                                  throws java.lang.Exception
Starts an agent server from its id using specific storage directory. JVM arguments are initialized from A3 configuration.

Parameters:
sid - id of agent server to start
dir - new working directory for the created agent server, current working directory if null
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[] servargs)
                                  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:
name - id of agent server to start
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. Closes all subsequent streams of the process to avoid deadlock due to limited buffer size.

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.

stopAgentServer

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

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

crashAgentServer

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

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

update

public void update()
            throws java.lang.Exception
Updates the configuration.

Throws:
java.lang.Exception

update

public void update(java.lang.String path)
            throws java.lang.Exception
Throws:
java.lang.Exception


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