UtilsInIdeCluster

Utility Module in IDE Cluster

Background

The j2ee/persistence module was moved to the IDE cluster in 6.0 M8 in order to provide JPA support for Java SE projects without requiring the J2EE cluster (see JPAInIdeCluster for more info). That required copying some classes, mainly from j2ee/utilities, to j2ee/persistence since the module can not depend on anything from the J2EE cluster anymore. To get rid of these copies and to have a place for putting common functionality needed by j2ee/persistence and the other modules of the Java EE team, a new module is needed in the IDE cluster.

Copied classes

The j2ee/persistence module contains copies of the following classes (the copy in j2ee/persistence is in parenthesis):

  • o.n.m.j2ee.common.source.GenarationUtils (o.n.m.j2ee.persistence.util.GenerationUtils)
  • o.n.m.j2ee.common.source.SourceUtils (o.n.m.j2ee.persistence.util.SourceUtils)
  • o.n.m.j2ee.common.ProgressPanel (o.n.m.j2ee.persistence.util.ProgressPanel) (This is just an implementation class and should not be exposed in the API. -- Andrei)
  • o.n.m.j2ee.common.EventRequestProcessor (o.n.m.j2ee.persistence.util.EventRequestProcessor) (Should probably take the opportunity to rename this to something more meaningful, perhaps ProgressSupport. -- Andrei)
  • o.n.m.j2ee.common.source.AbstracTask (o.n.m.j2ee.persistence.util.AbstractTask) (This class should be removed, since JavaSource.runUserActionTask() now also takes a Task with a single method, run(). -- Andrei)
  • o.n.m.j2ee.common.source.DelegatingWizardDescriptorPanel(o.n.m.j2ee.persistence.wizard.DelegatingWizardDescriptorPanel)
  • o.n.m.j2ee.persistence.wizard.Util contains copied functionality both from o.n.m.j2ee.ejbcore.Utils and o.n.m.j2ee.common.Util that needs to be refactored into one class in the new module.

Additionally there is some duplicate functionality, such as isSourceLevel14orLower in o.n.m.j2ee.common.Util (identical functionally as in o.n.m.j2ee.persistence.util.SourceLevelChecker). (This method is wrong, since the source level of a project is not well-defined (think freeform). But it serves the current needs of j2ee/persistence well, so I would just let SourceLevelChecker there. -- Andrei)

Other candidates

In addition to the copied classes, the new module could contain common functionality needed in Java EE refactorings. Currently the RefactoringUtil classes in j2ee/persistence/refactoring and web/refactoring contain duplicate code. Furthermore, implementing the new datasource API in j2ee/persistence will likely require common UI components with j2ee/ejbcore, which could placed into the new module.

Package hierarchy

The base package name of the module will be o.n.m.j2ee.core.api.support.

Proposed hierarchy:

  • o.n.m.j2ee.core.api.support.source for Java source helper classes, initially Source- and GenerationUtils (and possibly the common refactoring funtionality)
  • o.n.m.j2ee.core.api.support.ui for UI support classes (TODO, needIt contains to investigate which parts, if any, of the new datasources API implementation in ejbcore could be put here)
  • TODO: DelegatingWizardDescriptorPanel and EventRequestProcessor/ProgressSuppport, can't think of now anything that is not too specific or too general.

Sources

initial sources for the module

The module does not have tests yet, some existing ones can be moved over and some needs to be written.

In addition to the copied classes listed above, there are three new classes, namely SourceGroups (former SourceGroupSupport from j2ee/persistence), Wizards (split from j2ee/persistence Util) and Strings. The last one contains functionality needed in refactorings and also some methods from j2ee/persistence Util. A better name for it would be most welcomed. In general the naming scheme is not that consistent due to the usage of both *Utils and *s. For the most part the classes are as they were, I've added JavaDocs, done some minor improvements and made some of them use generics. Needs more work still, but that can be done after the sources are in CVS. I would commit as soon as we have an agreement on the package structure / naming and then continue working on this.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo