org.jlab.coda.afecs.sqldb
Class Db2Cool

java.lang.Object
  extended by org.jlab.coda.afecs.sqldb.Db2Cool

public class Db2Cool
extends java.lang.Object

JSA: Thomas Jefferson National Accelerator Facility
This software was developed under a United States Government license,
described in the NOTICE file included as part of this distribution.
Copyright (c), Oct 1, 2009


Field Summary
 java.lang.String coolHome
           
 java.lang.String expid
           
 boolean isConnected
           
 
Constructor Summary
Db2Cool()
          Constructor
 
Method Summary
 void closeDbConnection()
          Closes connection to the database
 void generateComponentDescriptionFile(java.lang.String cnf, DbComponent dc)
          Generates .rf cool files describing components of the control
 void generateControl(java.lang.String cnf, java.util.ArrayList<DbComponent> components, DbOption opt)
          Generates .rf cool file describing control
 void generateCool(java.lang.String cnf)
          Creates cool file.
 void generateOptionDescriptionFile(java.lang.String cnf, DbOption opt)
           
 void generateProcessDescriptionFile(java.lang.String cnf, java.lang.String dcname, java.lang.String pp, java.lang.String statename, java.lang.String prcommand, int pnum)
           
 void generateSupervisorDescriptionFile(java.lang.String cnf, DbComponent dc)
          Generates .rf cool files describing supervisor of the control
 java.util.ArrayList<DbComponent> getDbComponents(java.lang.String cnf)
          Returns arraylist of components described in the configuration(runtype) table.
 void getDbConnection()
          Creats connection objaect to the database.
 DbOption getDbOption(java.lang.String cnf)
          Get options table for the specified configuration.
 java.util.ArrayList<java.lang.String> getDbRuntypes()
          Reads the coda db runtypes table and returns all the runtype( configuration) names.
 java.util.ArrayList<java.lang.String> getDbSessions()
          Reads the coda db sessions table and returns all sessions names.
static void main(java.lang.String[] args)
          The main method of the class
 ASessionInfo translateDbSession(java.lang.String sessionName)
          Reads the db sessions table and creates ASessionInfo object
 void translateToCool(java.lang.String tmpruntype)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coolHome

public java.lang.String coolHome

expid

public java.lang.String expid

isConnected

public boolean isConnected
Constructor Detail

Db2Cool

public Db2Cool()
Constructor

Method Detail

getDbConnection

public void getDbConnection()
Creats connection objaect to the database.


closeDbConnection

public void closeDbConnection()
Closes connection to the database


getDbRuntypes

public java.util.ArrayList<java.lang.String> getDbRuntypes()
Reads the coda db runtypes table and returns all the runtype( configuration) names.

Returns:
ArrayList of runtype names

getDbSessions

public java.util.ArrayList<java.lang.String> getDbSessions()
Reads the coda db sessions table and returns all sessions names.

Returns:
ArrayList of session names

translateDbSession

public ASessionInfo translateDbSession(java.lang.String sessionName)
Reads the db sessions table and creates ASessionInfo object

Returns:
ASessionInfo object

getDbComponents

public java.util.ArrayList<DbComponent> getDbComponents(java.lang.String cnf)
Returns arraylist of components described in the configuration(runtype) table.

Parameters:
cnf - The name of the configuration
Returns:
ArrayList of DbComponent objects

getDbOption

public DbOption getDbOption(java.lang.String cnf)
Get options table for the specified configuration. If option table exists the supervisor agent will be created.

Parameters:
cnf - configuration(runtype) name
Returns:
DbOption object

main

public static void main(java.lang.String[] args)
The main method of the class

Parameters:
args - array of arguments

translateToCool

public void translateToCool(java.lang.String tmpruntype)

generateControl

public void generateControl(java.lang.String cnf,
                            java.util.ArrayList<DbComponent> components,
                            DbOption opt)
Generates .rf cool file describing control

Parameters:
cnf - control name ( the same as db runtype name)
components - arraylist of DbComponent objects
opt - DbOption object

generateComponentDescriptionFile

public void generateComponentDescriptionFile(java.lang.String cnf,
                                             DbComponent dc)
Generates .rf cool files describing components of the control

Parameters:
cnf - the name of the configuration
dc - DbComponent objects

generateSupervisorDescriptionFile

public void generateSupervisorDescriptionFile(java.lang.String cnf,
                                              DbComponent dc)
Generates .rf cool files describing supervisor of the control

Parameters:
cnf - the name of the configuration
dc - DbComponent objects

generateProcessDescriptionFile

public void generateProcessDescriptionFile(java.lang.String cnf,
                                           java.lang.String dcname,
                                           java.lang.String pp,
                                           java.lang.String statename,
                                           java.lang.String prcommand,
                                           int pnum)
Parameters:
cnf - the name of the configuration
dcname - component name
pp - "pre" or "post" if pre execute process before the state
statename - state name
prcommand - command string
pnum - number of the process attached to this component and transition

generateOptionDescriptionFile

public void generateOptionDescriptionFile(java.lang.String cnf,
                                          DbOption opt)
Parameters:
cnf - the name of the configuration
opt - DbOption object

generateCool

public void generateCool(java.lang.String cnf)
Creates cool file. N.B. the file will be stored in the coolHome/Control dir. So, make sure coolHome defined through the -o comandline option has a config/Control sub directory structure.

Parameters:
cnf - cool configuration name = db runtype name.