Java Issues

  1. How do I see dependencies between jar files or between directories?
  2. When you create a project for the first time using the New Project Dialog, remember to ensure that the option Create Subsystem for Input File is selected. As a result, you will see a partition being created for each of the input jar files. You will now be able to see the dependencies between jar files and drill down.

  3. How can I see all dependencies of a jar files?
  4. Once you create a subsystem corresponding to the jar file, you can see all dependencies associated with the jar file just as any other subsystem. Click on the row or column header for the subsystem and you will see all its dependencies in the Usage tab.

  5. How can I see dependencies by packages?
  6. Create a project for the first time using the New Project Wizard with the option Create Subsystem for Input File not selected. You will see the partitions by package. Click on a subsystem corresponding to the package of interest and you will see all dependencies of the package in the Usage tab.

  7. How do I exclude certain classes (such as test classes)?

    Here are a couple of ways of doing it:

    When you create a Project, simply go to the Options tab and specify the pattern to exclude certain classes. Note that the pattern is specified in Java stye regular expressions, (which is the same as perl style regular expression). Example:

    • To exclude all classes that contain the name test specify the pattern .*test.*.
    • To exclude all classes that contain the strings test and Test specify the pattern .*[Tt]est.*.
    • To exclude all classes with a package com.package. specify the pattern com.package\..*.

    Here is a more sophisticated way of dealing with this issue.

    • Load all the classes.
    • In Search/Tags pane specify a search string such as test to identify all classes that have test in their name.
    • In the Search Result, select $root, right click and select the menu item Cut Branch.
    • Create a Test subsystem under $root. Paste the classes you just cut into that subsystem. This will move all your test classes into the Test subsystem.

    Why is this more powerful? It allows you to see if there are any dependencies on tests from your regular code. It allows you to see how your tests depend on each other. It allows you to see what tests should be rerun if you change something in your code. Of course, if none of this matters, you can then always delete or hide the test subsystem thereby removing tests from the model.

  8. How can I look at dependencies at a finer granularity such as method level dependencies?

    You can do this in two ways:

    • You can create a new project with member level enabled and you will see dependencies at a finer granularity of methods and data members. Note that once a project is created, you can see the members for a subsystem by selecting it (select $root to do this for the entire project), right click and select Expand Members. The members for the selected subsystem are then shown in the DSM.
    • If you already have a project which doesn't have member level enabled, you can simply select a subsystem, right click and select Expand Members. The dialog box then allows you to update the entire project for member level or just the selected subsystem. It then prompts you to do a Project Update. You will then see members in the DSM.
  9. Does Lattix support Java Server Pages (JSPs)?
  10. Yes. When Java Server Pages are compiled, you get Java classes. These Java classes can be analyzed using the Java module.

    A Java Server Page (JSP) looks like a mixture of html and Java. The web server compiles a JSP the first time it is invoked. Internally, this is a two phase process. First the Jasper compiler is called which produces Java source code, and then the Java compiler is invoked on the source code to generate the Java class. For purposes of analysis, we need to pre-compile the JSPs. On the steps for doing this, please read the description of the JSP Analyzer under Additional Tools. JSPs can also have 'include' and 'forward' source level dependencies between each other. The JSP Analyzer in Additional Tools will extract those dependencies.

  11. How can I break up a large class into multiple classes?
  12. Expand a large class into its methods and data members. Now partition the class. The partitioning will suggest an inheritance hierarchy. Look for virtual partitions which are independent of each other, there may be other ways to split the class as well.

  13. How do I create a project for Hibernate?
  14. In order to create a project for Hibernate, load in the Hibernate configuration file or Hibernate xml files in the New Project Dialog. Hibernate generates a mapping between java classes and database tables. In a multi-module project with java, Hibernate, and Oracle you can see a model which shows the dependencies not just between elements of the application and elements of the database but also between application and database.

  15. How do I create a project for Spring?
  16. In order to create a project for Spring, load in the Spring xml files in the New Project Dialog. This creates a project which shows you the dependencies between Spring beans and between classes.

  17. I don't see the option for Spring and Hibernate in my New Project Dialog?
  18. This is because you have a standard evaluation download from the web which does not include those plugins. In order to get the plugins for Spring and Hibernate please contact Lattix and you can get a download which includes those plugins.