soap tutorial

adriani.jws.template.service
Class GeneralAnalyzer

java.lang.Object
  extended by adriani.jws.template.service.GeneralAnalyzer
Direct Known Subclasses:
ServiceAnalyzer

public abstract class GeneralAnalyzer
extends java.lang.Object

This class is used to collect and analyze performance data. Average data are shown between square brackets. Following data are collected:

  1. Total calls to the service: number of service invocations.
  2. Calls still running: number of calls still hung up (included current one).
  3. Calls interrupted by a macro error: number of times an Exception has been thrown at the macro level.
  4. Calls to the service that provided no result: number of times the logic did not find any data.
  5. Calls stopped because the database was missing: number of times a database has not been found.
  6. Calls interrupted by a logic error: invocations not completed for some error at the logical level.
  7. Calls completed with a validation error: invocations that produced invalid output data.
  8. Calls completed returning valid data: invocations that provided a complete valid response.
  9. Calls due to a command code (with valid data): invocations used to manage the service (which however produced valid output), without considering the current call.
The total number of calls (1st point) should be equal the sum of all other seven entries.

  1. Execution completed at macro level: number of times the macro level completed execution.
  2. Number of tries at the DAO level: number of times we executed at least one DAO call at the macro level.
  3. Number of time measurements: number of times we counted an execution time.
  4. Total execution time: total execution time measured by the chronwatch.
  5. Total SQL queries: total number of queries executed by the DAO layer.
  6. The first point is used to evaluate the average execution time. The second point is used to evaluate the average number of SQL queries for each service call (considering also the invocations stopped after just one query to the database).
    1. SQL queries without problems: number of successfully executed SQL queries.
    2. SQL queries with no result: number of queries with no results (no record found).
    3. SQL statement in error state: number of queries that generated an SQL error.
    4. DAO errors: number of DAO execution not completed and not handled.


    Field Summary
    protected  int calls
              Total number of times this service has been invoked.
    protected  int command
              Number calls not executed because the input parameters was a command for the manageService() method of the ServiceLogic() class.
    protected  int dao_error
              Number of errors not properly handlef during execution of a DBA method.
    protected  int last_dump
              The day of the month of the last automatic dump.
    protected static java.lang.String leadingName
              Beginning of each logging message produced by this class.
    protected  java.util.ArrayList list
              List of all measured execution times.
    protected static WSLogger logger
              Retrieving the logger instance to be used for this class (static).
    protected  int logic_error
              Number of errors at the main ServiceLogic level.
    protected  int macro_error
              Number of errors at the intermediate ServiceMacro level.
    protected  int no_db
              Number of calls to the web service failed because there was no database connection.
    protected  int no_error
              Number of calls to the web service ended without problems.
    protected  int no_record
              Number of SQL SELECT query performed with result "NO RECORD".
    protected  int no_result
              Number of times the web service logic found no data at all.
    protected  int sql_error
              Number of SQL statement that generated an SQL error.
    protected  int sql_query
              Number of SQL statement executed without problems.
    protected  java.util.Date startup
              The timestamp of the startup time of the web service (i.e. the time of the first call).
    protected  java.util.Hashtable table
              The hash table tracking all the threads that are collecting results.
    protected  int validation_error
              Number of errors due to an ADBBean exception.
     
    Constructor Summary
    GeneralAnalyzer()
              Standard constructor.
     
    Method Summary
     void addCommand()
              Mutator method.
     void addDAOError()
              Mutator method.
     void addLogicError()
              Mutator method.
     void addMacroError()
              Mutator method.
     void addNoDatabase()
              Mutator method.
     void addNoError()
              Mutator method.
     void addNoRecord()
              Mutator method.
     void addNoResult()
              Mutator method.
     void addSQLError()
              Mutator method.
     void addSQLQuery()
              Mutator method.
     void addValidationError()
              Mutator method.
     void collect(int code)
              Collect a generic single ServiceDAO event and increment the related counter, using the integer code values defined in the ErrorMessage class.
    abstract  void endCall(int code)
              Stop the chronwatch after the end of one call service, even if the call generated an error.
     int getCalls()
              Accessor method.
     int getCommand()
              Accessor method.
     int getDAOError()
              Accessor method.
     int getLastDump()
              Accessor method.
     int getLogicError()
              Accessor method.
     int getMacroError()
              Accessor method.
     int getNoDatabase()
              Mutator method.
     int getNoError()
              Mutator method.
     int getNoRecord()
              Accessor method.
     int getNoResult()
              Accessor method.
    abstract  java.lang.StringBuffer getResults()
              Produce a StringBuffer object containing all the analysis data already formatted and ready for printing.
     int getSQLError()
              Accessor method.
     int getSQLQuery()
              Mutator method.
     java.util.Date getStartup()
              Accessor method.
     int getValidationError()
              Accessor method.
     void logResults()
              Log the analysis results produced by the getResults() method in the LOG file.
     void printResults()
              Print the analysis results produced by the getResults() method on the standard output.
     void setLastDump(int value)
              Mutator method.
     void startCall()
              Start the chronwatch at the beginning of one call service.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    table

    protected java.util.Hashtable table
    The hash table tracking all the threads that are collecting results.
    By this mechanism, if two (or more) different threads invoke the startCall() method before ending the call, we can acknowledge the identity of the caller, in order to match each endCall() method with the proper starting time.
    The hash table contains the pairs: caller thread (key) and starting time (value). Subclass should use the table.size() method to acknowledge the number of calls still hanging up.


    list

    protected java.util.ArrayList list
    List of all measured execution times.


    calls

    protected int calls
    Total number of times this service has been invoked.


    no_error

    protected int no_error
    Number of calls to the web service ended without problems.


    logic_error

    protected int logic_error
    Number of errors at the main ServiceLogic level.


    macro_error

    protected int macro_error
    Number of errors at the intermediate ServiceMacro level.


    validation_error

    protected int validation_error
    Number of errors due to an ADBBean exception.


    no_result

    protected int no_result
    Number of times the web service logic found no data at all.


    no_db

    protected int no_db
    Number of calls to the web service failed because there was no database connection.


    sql_query

    protected int sql_query
    Number of SQL statement executed without problems.


    sql_error

    protected int sql_error
    Number of SQL statement that generated an SQL error.


    no_record

    protected int no_record
    Number of SQL SELECT query performed with result "NO RECORD".


    dao_error

    protected int dao_error
    Number of errors not properly handlef during execution of a DBA method.


    command

    protected int command
    Number calls not executed because the input parameters was a command for the manageService() method of the ServiceLogic() class.


    startup

    protected java.util.Date startup
    The timestamp of the startup time of the web service (i.e. the time of the first call).


    last_dump

    protected int last_dump
    The day of the month of the last automatic dump.


    leadingName

    protected static java.lang.String leadingName
    Beginning of each logging message produced by this class.


    logger

    protected static WSLogger logger
    Retrieving the logger instance to be used for this class (static).

    Constructor Detail

    GeneralAnalyzer

    public GeneralAnalyzer()
    Standard constructor. This constructor is called implicitly by any "empty constructor" of any subclass of this GeneralAnalyzer class (i.e. without the need to write super()).
    Hence here we instantiate all the general purposes object, such as:
    - the Hashtable that will store the threads references.
    - the timestamp attribute storing the startup time of the service (i.e. the first call time).

    Method Detail

    collect

    public void collect(int code)
    Collect a generic single ServiceDAO event and increment the related counter, using the integer code values defined in the ErrorMessage class.

    Parameters:
    code - the integer code describing the status of the DBA after execution
    See Also:
    ErrorMessage

    getResults

    public abstract java.lang.StringBuffer getResults()
    Produce a StringBuffer object containing all the analysis data already formatted and ready for printing.

    Remark: implementation of this method is left to the child class because some of the logical analysis data can depend by the web service feature.

    Returns:
    a string buffer object containing the formatted results of the analysis

    printResults

    public void printResults()
    Print the analysis results produced by the getResults() method on the standard output.

    See Also:
    getResults()

    logResults

    public void logResults()
    Log the analysis results produced by the getResults() method in the LOG file.

    See Also:
    getResults()

    startCall

    public void startCall()
    Start the chronwatch at the beginning of one call service. This method should be called only once by the main ServiceLogic.


    endCall

    public abstract void endCall(int code)
    Stop the chronwatch after the end of one call service, even if the call generated an error. If the chronwatch is stopped after an execution error, the error code is identified using the static values defined in the ErrorMessage class.
    This method should be called only once at the end of the service call. This means that this method could be called by the ServiceLogic class or by a ServiceMacro, depending by the particular "logic branch" executed at run-time.

    Remark: implementation of this method is left to the child class because the range of Possible error codes depends by the web service feature.

    Parameters:
    code - the integer code describing the event or error
    See Also:
    ErrorMessage

    addNoError

    public void addNoError()
    Mutator method.


    addCommand

    public void addCommand()
    Mutator method.


    addLogicError

    public void addLogicError()
    Mutator method.


    addValidationError

    public void addValidationError()
    Mutator method.


    addNoResult

    public void addNoResult()
    Mutator method.


    addNoDatabase

    public void addNoDatabase()
    Mutator method.


    addMacroError

    public void addMacroError()
    Mutator method.


    addSQLQuery

    public void addSQLQuery()
    Mutator method.


    addNoRecord

    public void addNoRecord()
    Mutator method.


    addSQLError

    public void addSQLError()
    Mutator method.


    addDAOError

    public void addDAOError()
    Mutator method.


    setLastDump

    public void setLastDump(int value)
    Mutator method.


    getNoError

    public int getNoError()
    Mutator method.


    getCommand

    public int getCommand()
    Accessor method.


    getLogicError

    public int getLogicError()
    Accessor method.


    getValidationError

    public int getValidationError()
    Accessor method.


    getNoResult

    public int getNoResult()
    Accessor method.


    getNoDatabase

    public int getNoDatabase()
    Mutator method.


    getMacroError

    public int getMacroError()
    Accessor method.


    getSQLQuery

    public int getSQLQuery()
    Mutator method.


    getNoRecord

    public int getNoRecord()
    Accessor method.


    getSQLError

    public int getSQLError()
    Accessor method.


    getDAOError

    public int getDAOError()
    Accessor method.


    getCalls

    public int getCalls()
    Accessor method.


    getStartup

    public java.util.Date getStartup()
    Accessor method.


    getLastDump

    public int getLastDump()
    Accessor method.


    Build 18/09/2012

    Morpheus Quality Technologies - Making the Zion software
    Copyright © 2009-2013 Morpheus Quality Technologies. All Rights Reserved