|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpl.gda.pg.eti.ask.przemyslawbielicki.aeh.info.MethodInfo
MethodInfo contains information about classes and methods (more precisely: information
about reliability). Every method statistics contains invocation counter. It also contains counters
for erroreous and exceptional invocation. User can get those informations and can decide to use
this method or not.
MethodInfo contains methods that enable retrieving methods statistics that exist in XML
database. It also contains methods that enable adding new method statistics to database.
XML database is automatically loaded and saved from and to filesystem.
TODO convert to EJB class
| Field Summary | |
private Hashtable |
classStats_
Table containing statistics for concrete class. |
private static String |
databasePath_
Path where XML database is stored - file name |
private static boolean |
initialized_
Indicates if object is initialized_ or not. |
private static MethodInfo |
methodInfo_
Instance of singleton class. |
| Constructor Summary | |
private |
MethodInfo()
Default constructor is private to prevent calling it by anyone. |
| Method Summary | |
void |
addClassStat(ClassStat stat)
Adds class statistics to database. |
void |
addClassStat(Method method)
Adds method statistics to database. |
void |
addCorrectInvocation(Method method)
Increases correct invocation counter by 1 (one). |
void |
addErrorInvocation(Method method)
Increases erroreous invocation counter by 1 (one). |
void |
addExceptionClientInvocation(Method method)
Increases client exceptional invocation counter by 1 (one). |
void |
addExceptionServerInvocation(Method method)
Increases server exceptional invocation counter by 1 (one). |
boolean |
deserializeMethodInfo(String fileName)
Deserializes method statistics XML database from file fileName to objects form.
|
static MethodInfo |
getInstance()
Typical getInstance method. |
MethodStat |
getMethodInfo(Method method)
Retrieves method statistics. |
MethodStat |
getMethodInfo(Method method,
boolean addNewStats)
Retrieves method statistics for given method. |
boolean |
serializeMethodInfo(String fileName)
Serializes method statistics XML database from objects form to file fileName.
|
static void |
setDatabasePath(String path)
Setter method for XML database path |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Hashtable classStats_
ClassStat.className_.
private static boolean initialized_
private static MethodInfo methodInfo_
private static String databasePath_
| Constructor Detail |
private MethodInfo()
| Method Detail |
public static MethodInfo getInstance()
getInstance method. If object is not initialized_
this method runs private constructor MethodInfo()
and creates a singleton instance.
MethodInfo instancepublic static void setDatabasePath(String path)
path - to XML databasepublic void addErrorInvocation(Method method)
method doesn't exist it will be automatically
added to database by getMethodInfo(Method, boolean) method. After this
operation method automatically serializes XML database to file.
method - to increase erroreous invocation counter topublic void addExceptionClientInvocation(Method method)
method doesn't exist it will be automatically
added to database by getMethodInfo(Method, boolean) method. After this
operation method automatically serializes XML database to file.
method - to increase client exceptional invocation counter topublic void addExceptionServerInvocation(Method method)
method doesn't exist it will be automatically
added to database by getMethodInfo(Method, boolean) method. After this
operation method automatically serializes XML database to file.
method - to increase server exceptional invocation counter topublic void addCorrectInvocation(Method method)
method doesn't exist it will be automatically
added to database by getMethodInfo(Method, boolean) method. After this
operation method automatically serializes XML database to file.
method - to increase correct invocation counter to
public void addClassStat(ClassStat stat)
throws DuplicateClassStatException
DuplicateClassStatException is thrown.
stat - class statistics to add
DuplicateClassStatException - statistics for given class name already exists in
database
public void addClassStat(Method method)
throws DuplicateMethodStatException
method
belongs to already exists in database this method try to add statistics to this
existing subtree. In this case if statistics for method already exists
in class subtree DuplicateMethodStatException is thrown.In other case (class
subtree doesn't exist) this method creates statistics for class and then adds statistics
for method.
method - user want to add statistics for
DuplicateMethodStatException - statistics for method already exists
in class subtree
public MethodStat getMethodInfo(Method method)
throws ClassNotFoundException,
MethodNotFoundException
method belongs to
doesn't exist in database ClassNotFoundException is thrown. If class subtree
exists but given method statistics doesn't exist MethodNotFoundException
is thrown.
method - user want statistics for
ClassNotFoundException - class that method belongs to doesn't
MethodNotFoundException - method statistics doesn't exist
public MethodStat getMethodInfo(Method method,
boolean addNewStats)
throws ClassNotFoundException,
MethodNotFoundException
method. If class that method
belongs to doesn't exist in database ClassNotFoundException is thrown. If class subtree
exists but given method statistics doesn't exist MethodNotFoundException
is thrown.
If addNewStats is set to true this method adds statistics for
given method to database. If class that given method belongs to
exists in database this method adds only method statistics. In other case this method
first adds class subtree and then method statistics.
method - user want statistics foraddNewStats - indicate if user want to add statistics if they don't exist
ClassNotFoundException - class that method belongs to doesn't
MethodNotFoundException - method statistics doesn't existpublic boolean deserializeMethodInfo(String fileName)
fileName to objects form.
Simply creates objects structure from XML file.
fileName - path to file where method statistics XML database is
true when deserializing finishes correctly and false
in other casepublic boolean serializeMethodInfo(String fileName)
fileName.
Simply creates XML document and then writes it to file.
fileName - path to file where method statistics XML database is
true when serializing finishes correctly and false
in other case
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||