POGO Java Program


pogo.gene
Class Cmd

java.lang.Object
  |
  +--pogo.gene.Cmd

public class Cmd
extends java.lang.Object
implements TangoDs.TangoConst, PogoDefs

This class defines a command for server code. This class describe the command sent by a client to be executed by the server. These Cmd class are located in a java.util.Vector known as CmdTable class.

Version:
$Revision: 1.22 $
Author:
$Author: verdier $

Field Summary
 TangoTypes argin
          The command's argument in (type, description....)
 TangoTypes argout
          The command's argument out (type, description....)
 java.lang.String cmd_class
          The command's class name
 java.lang.String command
          The command's name itself
 java.lang.String description
          The command's description
 java.lang.String exec_method
          The method's name where the command is realy executed.
 DevStateTable notAllowedFor
          DevState list which for the command is NOT allowed.
 int override_method
          Virtual method must be overrided or not.
 boolean virtual_method
          use a virtual command's method or not.
 
Fields inherited from interface TangoDs.TangoConst
Attr_Description, Attr_Name, Attr_State, Attr_Status, Attr_Unknown, Op_BlackBox, Op_Command, Op_Command_inout, Op_Command_list, Op_Get_Attr_Config, Op_Info, Op_Ping, Op_Read_Attr, Op_Set_Attr_Config, Op_Unknown, Op_Write_Attr, Req_Attribute, Req_Operation, Req_Unknown, Tango_AllAttr, Tango_AlrmValueNotSpec, Tango_AssocWritNotSpec, Tango_CmdArgTypeName, Tango_DbErr_DeviceNotDefined, Tango_DbObjName, Tango_DefaultBlackBoxDepth, Tango_DefaultDocUrl, Tango_DefaultWritableProp, Tango_DescNotSet, Tango_DEV_BOOLEAN, Tango_DEV_DOUBLE, Tango_DEV_FLOAT, Tango_DEV_LONG, Tango_DEV_SHORT, Tango_DEV_STATE, Tango_DEV_STRING, Tango_DEV_ULONG, Tango_DEV_USHORT, Tango_DEV_VOID, Tango_DevErr_AttrMandatoryProp, Tango_DevErr_AttrNoAlarm, Tango_DevErr_AttrNotFound, Tango_DevErr_AttrNotWritable, Tango_DevErr_AttrOptProp, Tango_DevErr_AttrValueNotSet, Tango_DevErr_BlackBoxArgument, Tango_DevErr_BlackBoxEmpty, Tango_DevErr_CannotOpenFile, Tango_DevErr_CantInstallSignal, Tango_DevErr_CantRetrieveClassList, Tango_DevErr_ClassNotFound, Tango_DevErr_CmdArgumentTypeNotSupported, Tango_DevErr_CommandNotAllowed, Tango_DevErr_CommandNotFound, Tango_DevErr_DeviceNotFound, Tango_DevErr_IncompatibleAttrDataType, Tango_DevErr_IncompatibleCmdArgumentType, Tango_DevErr_InitMethodNotFound, Tango_DevErr_InitNotPublic, Tango_DevErr_InitThrowsException, Tango_DevErr_JavaRuntimeSecurityException, Tango_DevErr_MemoryAllocation, Tango_DevErr_MethodArgument, Tango_DevErr_MethodNotFound, Tango_DevErr_OverloadingNotSupported, Tango_DevErr_SignalOutOfRange, Tango_DevErr_WAttrOutsideLimit, Tango_DevStateName, Tango_DEVVAR_CHARARRAY, Tango_DEVVAR_DOUBLEARRAY, Tango_DEVVAR_DOUBLESTRINGARRAY, Tango_DEVVAR_FLOATARRAY, Tango_DEVVAR_LONGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, Tango_DEVVAR_SHORTARRAY, Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_ULONGARRAY, Tango_DEVVAR_USHORTARRAY, Tango_DevVersion, Tango_DSDeviceDomain, Tango_InitialOutput, Tango_MaxServerNameLength, Tango_ResNotDefined, Tango_SysProperty
 
Fields inherited from interface pogo.gene.PogoDefs
ALREADY_OVERRIDING, ATTR_IMAGE, ATTR_READ, ATTR_READ_WITH_WRITE, ATTR_READ_WRITE, ATTR_SCALAR, ATTR_SPECTRUM, ATTR_WRITE, AttrDataArray, AttrRWtypeArray, AttrTypeArray, authorRes, classDescRes, cppAddAttrib, cppAddCommands, cppExtention, cppFile, cppLang, dataCommands, dataExtention, dataFile, dataStartCmd, dataStartStates, endGeneTag, errDetected, javaAddAttrib, javaAddCommands, javaExtention, javaFile, javaLang, languageRes, NEW_STR, NOT_OVERRIDE, outputFiles, OVERRIDE, pageTitleRes, pogoLang, projectTitleRes, readAttrProto1, readAttrProto2, readAttrProto3, readFile, revisionRes, startGeneTag, STATE, statesDescRes, STATUS, Tango_ALARM, Tango_CLOSE, Tango_CONST_DEV_STRING, Tango_DISABLE, Tango_EXTRACT, Tango_FAULT, Tango_INSERT, Tango_MOVING, Tango_OFF, Tango_ON, Tango_OPEN, Tango_RUNNING, Tango_STANDBY, Tango_TYPE_UNKNOWN, Tango_UNKNOWN, Tango_WARMUP, TangoStatesArray, templateBlock, templateClass, templateClassCmd, templateCmd, templateExecuteCmd, templateFile, writeAttrProto, writeFile
 
Constructor Summary
Cmd(java.lang.String cmdLine)
          Constructs a newly allocated Cmd object from all its creation parameters.
Cmd(java.lang.String name, java.lang.String cc, java.lang.String in_type, java.lang.String out_type, java.lang.String in_desc, java.lang.String out_desc, java.lang.String desc)
          Constructs a newly allocated Cmd object from all its creation parameters.
 
Method Summary
 java.lang.String AddCmdObjectList(int lang)
          Add commands the command Obeject list.
 void addNotAllowedFor(DevState state)
          Add a new DevState to the Not Allowed states list.
 java.lang.String buildCppCmdClassBlock(java.lang.String str, java.lang.String class_name)
          Build the C++ definition for class where the command is really executed on the device.
 java.lang.String buildCppCmdClassDefs(java.lang.String str)
          Build the C++ definition for class where the command is really executed on the device.
 java.lang.String buildCppCmdProtypes()
          Build the C++ prototye for method where the command is really executed on the device.
 java.lang.String buildCppExecCmdMethod(java.lang.String class_name)
          Build the method where the command is really executed on the device.
 java.lang.String buildCppExecCmdMethodComments(java.lang.String class_name)
          Build the method where the command is really executed on the device.
 java.lang.String buildCppExecCmdMethodSignature(java.lang.String class_name)
          Build the declaration line for the method where the command is really executed on the device.
private  java.lang.String buildExecCmdMethodName()
          Build the execute method's name from command's name
 java.lang.String buildIsAllowedMethod(PogoString method, int lang)
          Build or modify the class_name::is_allowed() method using notAllowedFor DevStateTable.
 java.lang.String buildJavaExecCmdMethod()
          Build the method where the command is really executed on the device.
 java.lang.String buildJavaExecCmdMethodComments()
          Build the description for method where the command is really executed on the device.
 java.lang.String buildJavaExecCmdMethodSignature()
          Build the method where the command is really executed on the device.
 java.lang.String buildJavaExecuteMethodBlock(java.lang.String class_name)
          Build the execute method block in Cmd files.
 void checkCppExecCmdMethodName(java.lang.String filename)
          Get the execute method's name from C++ source files if exist or does'nt change.
 void checkJavaExecCmdMethodName(java.lang.String filename)
          Get the execute method's name from Java source files if exist or does'nt change.
 boolean execMethodArgsChanged(java.lang.String line, int lang)
          Check if the exec command method's arguments have been modified.
 void getExecMethodDescription(java.lang.String str, int lang)
          Get the execute method description from String
 boolean isExecMethod(java.lang.String line)
          Check if in line the exec method is exactly the ecec method's name.
 void removeNotAllowedFor(DevState state)
          Remove a DevState in the Not Allowed states list.
 void setDescription(java.lang.String str)
          Set the Description field.
 void setNotAllowedFor(DevStateTable stTable)
          Set DevStateTable list for the Not Allowed states list .
 void setNotAllowedFor(java.lang.String str, int lang)
          Set DevStateTable list for the Not Allowed states list .
 java.lang.String toString()
          Make command as a String
 void updateCppExecCmdMethodComments(PogoString codeStr, java.lang.String class_name)
          Update the method where the command is really executed on the device, because they could have been changed.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

command

public java.lang.String command
The command's name itself

description

public java.lang.String description
The command's description

exec_method

public java.lang.String exec_method
The method's name where the command is realy executed.

cmd_class

public java.lang.String cmd_class
The command's class name

argin

public TangoTypes argin
The command's argument in (type, description....)

argout

public TangoTypes argout
The command's argument out (type, description....)

notAllowedFor

public DevStateTable notAllowedFor
DevState list which for the command is NOT allowed.

virtual_method

public boolean virtual_method
use a virtual command's method or not.

override_method

public int override_method
Virtual method must be overrided or not.
Constructor Detail

Cmd

public Cmd(java.lang.String name,
           java.lang.String cc,
           java.lang.String in_type,
           java.lang.String out_type,
           java.lang.String in_desc,
           java.lang.String out_desc,
           java.lang.String desc)
Constructs a newly allocated Cmd object from all its creation parameters.
Parameters:
name - The command's name.
cc - The command's class name
in_type - The command's tango argument in.
out_type - The command's tango argument out.
in_desc - The command's argument in description.
out_desc - The command's argument out description.
desc - The command's description.

Cmd

public Cmd(java.lang.String cmdLine)
    throws PogoException
Constructs a newly allocated Cmd object from all its creation parameters.
Parameters:
cmdLine - Command line from source file.
Throws:
PogoException - If Synthax error detected in cmdLine.
Method Detail

setDescription

public void setDescription(java.lang.String str)
Set the Description field.
Parameters:
str - New description text.

buildExecCmdMethodName

private java.lang.String buildExecCmdMethodName()
Build the execute method's name from command's name
Returns:
The method's name built.

isExecMethod

public boolean isExecMethod(java.lang.String line)
Check if in line the exec method is exactly the ecec method's name.
Parameters:
line - program line to be analysed.
Returns:
true if the exec method is in line.

checkCppExecCmdMethodName

public void checkCppExecCmdMethodName(java.lang.String filename)
                               throws PogoException
Get the execute method's name from C++ source files if exist or does'nt change.
Parameters:
class_name - The class name for this method.
Throws:
PogoException - If synthax error is detected in input file.

checkJavaExecCmdMethodName

public void checkJavaExecCmdMethodName(java.lang.String filename)
                                throws PogoException
Get the execute method's name from Java source files if exist or does'nt change.
Parameters:
filename - File where check the execute method.
Throws:
PogoException - If synthax error is detected in input file.

AddCmdObjectList

public java.lang.String AddCmdObjectList(int lang)
Add commands the command Obeject list.
Parameters:
language - The output language (Cpp or Java).
Returns:
the source code to be inserted to add the command in object list.

execMethodArgsChanged

public boolean execMethodArgsChanged(java.lang.String line,
                                     int lang)
Check if the exec command method's arguments have been modified.
Parameters:
line - Source program line.
lang - Language to be generated (Cpp or Java)
Returns:
true if the parameters have changed.

buildJavaExecuteMethodBlock

public java.lang.String buildJavaExecuteMethodBlock(java.lang.String class_name)
Build the execute method block in Cmd files. This block is used to call the method where the command is really executed on device.
Parameters:
class_name - The class'name of object treated.
Returns:
Java source code to be insterted.

buildJavaExecCmdMethodComments

public java.lang.String buildJavaExecCmdMethodComments()
Build the description for method where the command is really executed on the device.
Returns:
Java source code to be insterted.

buildJavaExecCmdMethodSignature

public java.lang.String buildJavaExecCmdMethodSignature()
Build the method where the command is really executed on the device.
Returns:
Java source code to be insterted.

buildJavaExecCmdMethod

public java.lang.String buildJavaExecCmdMethod()
Build the method where the command is really executed on the device.
Returns:
Java source code to be insterted.

buildCppCmdProtypes

public java.lang.String buildCppCmdProtypes()
Build the C++ prototye for method where the command is really executed on the device.
Returns:
C++ source code to be insterted.

buildCppCmdClassDefs

public java.lang.String buildCppCmdClassDefs(java.lang.String str)
Build the C++ definition for class where the command is really executed on the device.
Parameters:
str - The template file read.
Returns:
C++ source code to be insterted.

buildCppCmdClassBlock

public java.lang.String buildCppCmdClassBlock(java.lang.String str,
                                              java.lang.String class_name)
                                       throws PogoException
Build the C++ definition for class where the command is really executed on the device.
Parameters:
str - The template file read.
class_name - The class'name of object treated.
Returns:
C++ source code to be insterted.
Throws:
PogoException - Thrown if a synthax error is detected in input file.

buildCppExecCmdMethodComments

public java.lang.String buildCppExecCmdMethodComments(java.lang.String class_name)
Build the method where the command is really executed on the device.
Parameters:
class_name - The class'name of object treated.
Returns:
C++ source code to be insterted.

updateCppExecCmdMethodComments

public void updateCppExecCmdMethodComments(PogoString codeStr,
                                           java.lang.String class_name)
                                    throws PogoException
Update the method where the command is really executed on the device, because they could have been changed.
Parameters:
codeStr - The source code where the header must be replaced.
class_name - The class'name of object treated.
Returns:
C++ source code to be insterted.

buildCppExecCmdMethodSignature

public java.lang.String buildCppExecCmdMethodSignature(java.lang.String class_name)
Build the declaration line for the method where the command is really executed on the device.
Parameters:
class_name - The class'name of object treated.
Returns:
C++ source code line to be insterted.

buildCppExecCmdMethod

public java.lang.String buildCppExecCmdMethod(java.lang.String class_name)
Build the method where the command is really executed on the device.
Parameters:
class_name - The class'name of object treated.
Returns:
C++ source code to be insterted.

getExecMethodDescription

public void getExecMethodDescription(java.lang.String str,
                                     int lang)
Get the execute method description from String
Parameters:
str - Source code read where the description will be find.

setNotAllowedFor

public void setNotAllowedFor(java.lang.String str,
                             int lang)
Set DevStateTable list for the Not Allowed states list .
Parameters:
str - The DevStateTable will be taken from this source code String.

setNotAllowedFor

public void setNotAllowedFor(DevStateTable stTable)
Set DevStateTable list for the Not Allowed states list .
Parameters:
stTable - List to replace the existance one.

addNotAllowedFor

public void addNotAllowedFor(DevState state)
Add a new DevState to the Not Allowed states list.
Parameters:
state - Object to be aded in the list.

removeNotAllowedFor

public void removeNotAllowedFor(DevState state)
Remove a DevState in the Not Allowed states list.
Parameters:
state - Object to be removed in the list.

buildIsAllowedMethod

public java.lang.String buildIsAllowedMethod(PogoString method,
                                             int lang)
                                      throws PogoException
Build or modify the class_name::is_allowed() method using notAllowedFor DevStateTable.
Parameters:
method - Existing method from template or source file.
Returns:
the new method generated.

toString

public java.lang.String toString()
Make command as a String
Overrides:
toString in class java.lang.Object
Returns:
Command's name.

POGO Java Program