org.designwizard.main
Class DesignWizard

java.lang.Object
  extended by org.designwizard.main.DesignWizard

public class DesignWizard
extends java.lang.Object

This class provides methods to get access to information about a given application. The information is extracted from the binary files of the application when an instance of DesignWizard is created:

        DesignWizard dw = new DesignWizard("/home/user/application/classes");
 
Once you have created an instance of DesignWizard class, you can use its methods to acquire information about the components (Packages, Classes, Methods and Fields) of the application, such as "which are the methods that call the class MyAplicationClassExample":
                ClassNode c = dw.getClass("MyAplicationClassExample");
                Set callers = c.getCallers();
 

Author:
Joao Brunet

Constructor Summary
DesignWizard(java.lang.String path)
          Creates a new DesignWizard.
DesignWizard(java.lang.String path, java.lang.String... internalPath)
          Creates a new DesignWizard.
 
Method Summary
 ResultOfImpact analyseFromEntitiesFile()
          Returns a ResultManager object that contains the result of impact analysis.
 void generateEntitiesFile()
          This method generates a file containing all the entities extracted from jar file.
 java.util.Set<ClassNode> getAllClasses()
          Returns a java.util.Set containing ClassNode objects reflecting all the classes extracted.
 java.util.Set<MethodNode> getAllMethods()
          Returns a java.util.Set containing MethodNode objects reflecting all the methods extracted.
 java.util.Set<PackageNode> getAllPackages()
          Returns a java.util.Set containing PackageNode objects reflecting all the packages extracted.
 ClassNode getClass(java.lang.Class classEntity)
          Returns the ClassNode object associated with the class or interface with the given java class.
 ClassNode getClass(java.lang.String className)
          Returns the ClassNode object associated with the class or interface with the given string name.
 FieldNode getField(java.lang.String fieldName)
          Returns the FieldNode object associated with the field with the given string name.
 MethodNode getMethod(java.lang.String methodSignature)
          Returns the MethodNode object associated with the method or constructor with the given string signature.
 PackageNode getPackage(java.lang.String fullyQualifiedNamePackage)
          Returns the PackageNode object associated with the package with the given string name.
 ResultOfImpact getResultOfAnalyzedEntities()
          Returns the result of the analysis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DesignWizard

public DesignWizard(java.lang.String path)
             throws java.io.IOException
Creates a new DesignWizard. DesignWizard will extract information about the jar/class files and you can use the methods of this class to get this information.

Parameters:
path - the path of the .jar file or the path of binaries (.class) to be extracted.
Throws:
java.io.IOException - An exception used for signaling run-time failure of reading jar file.

DesignWizard

public DesignWizard(java.lang.String path,
                    java.lang.String... internalPath)
             throws java.io.IOException
Creates a new DesignWizard. DesignWizard will extract information about the jar/class files and you can use the methods of this class to get this information.

Parameters:
path - the path of the .jar file or the path of binaries (.class) to be extracted.
Throws:
java.io.IOException - An exception used for signaling run-time failure of reading jar file.
Method Detail

getPackage

public PackageNode getPackage(java.lang.String fullyQualifiedNamePackage)
                       throws InexistentEntityException
Returns the PackageNode object associated with the package with the given string name.

Parameters:
fullyQualifiedNamePackage - the fully qualified name of the desired package.
Returns:
the PackageNode object for the package with the specified name.
Throws:
InexistentEntityException - if the class cannot be located

getClass

public ClassNode getClass(java.lang.String className)
                   throws InexistentEntityException
Returns the ClassNode object associated with the class or interface with the given string name.

Parameters:
className - the fully qualified name of the desired class.
Returns:
the ClassNode object for the class or interface with the specified name.
Throws:
InexistentEntityException - if the class cannot be located

getClass

public ClassNode getClass(java.lang.Class classEntity)
                   throws InexistentEntityException
Returns the ClassNode object associated with the class or interface with the given java class.

Parameters:
classEntity - the desired class.
Returns:
the ClassNode object for the class or interface represented by the classEntity.
Throws:
InexistentEntityException - if the class cannot be located

getMethod

public MethodNode getMethod(java.lang.String methodSignature)
                     throws InexistentEntityException
Returns the MethodNode object associated with the method or constructor with the given string signature. Constructors have the special identifier <init>. For example:
                MethodNode constructor = dw.getMethod("foo.bar.MyClass.<init>()")
 

Parameters:
methodSignature - the signature of the desired method (e.g foo.bar.MyClass.methodName(java.lang.Integer,AnotherType)).
Returns:
the MethodNode object for the method or constructor represented by the methodName.
Throws:
InexistentEntityException - if the method cannot be located

getField

public FieldNode getField(java.lang.String fieldName)
                   throws InexistentEntityException
Returns the FieldNode object associated with the field with the given string name.

Parameters:
fieldName - the fully qualified name the desired field (e.g foo.bar.MyClass.fieldName).
Returns:
the FieldNode object for the field with the given string name.
Throws:
InexistentEntityException - if the field cannot be located

getAllClasses

public java.util.Set<ClassNode> getAllClasses()
Returns a java.util.Set containing ClassNode objects reflecting all the classes extracted.

Returns:
the set of ClassNode objects representing the classes extracted.

getAllMethods

public java.util.Set<MethodNode> getAllMethods()
Returns a java.util.Set containing MethodNode objects reflecting all the methods extracted.

Returns:
the set of MethodNode objects representing the methods extracted.

getAllPackages

public java.util.Set<PackageNode> getAllPackages()
Returns a java.util.Set containing PackageNode objects reflecting all the packages extracted.

Returns:
the set of PackageNode objects representing the packages extracted.

generateEntitiesFile

public void generateEntitiesFile()
This method generates a file containing all the entities extracted from jar file. The file will be saved as a text one named entities.txt in the directory specified on designwizard.properties. Developers can use this file to optimize the task of analyzing impacts of a change on several methods. The entities in the file will be preceded with the special character # before its name. Remove the special character before the entities that you want to analyze impact.


analyseFromEntitiesFile

public ResultOfImpact analyseFromEntitiesFile()
                                       throws java.io.IOException
Returns a ResultManager object that contains the result of impact analysis. on each entity read from entities.txt.

Throws:
java.io.IOException
See Also:
ResultManager.

getResultOfAnalyzedEntities

public ResultOfImpact getResultOfAnalyzedEntities()
Returns the result of the analysis.

Returns:
the result of the analysis.