Merged deployment descriptor model


Where to get it

The Java Persistence API ORM mappings model is in trunk. The other Java EE models are being developed on the merged_model_j2ee branch.

Checkout the following modules from the merged_model_j2ee branch.


If you need to branch other modules, or need to merge the trunk to into the branch let me know and I will do it.

There is a continuous build of the branch on

How to use it

See MergedDDModelGuide.

Model implementation

The MetadataModel and related classes are in


in the j2ee/metadata module.

A model implementor starts by implementing the MetadataModelImplementation interface. This interface contains just a runReadAction() method similar to MetadataModel.runReadAction(). The implementor then defines the metadata interface for his model (similar to EntityMappingsMetadata).

The implementor must then decide whether parts of the model need to be cached or not. Caching is needed when an use case exists for the model which requires quick access to parts of the metadata (for example, there is a requirement that the names of all entity classes be available quicky for use in JPA verification hints), or when the metadata are displayed in the UI and need to be always up-to-date (for example, nodes for web services need to be displayed under the Web Services node in the projects view). The latter case also requires to allow the clients to listen for changes.

It is recommended that models cache as little as possible, since caching is prone to errors and memory-consuming, and sometimes also CPU-consuming. Most metadata will be retrieved on the fly, as the client calls methods on the model objects. For example, in the JPA ORM model, only the entity names are cached. Whenever the client retrieves other parts of the model, such as the mapping of an entity class, these parts are retrieved from Java files and/or XML descriptors. Any data that was computed during a model read access and is not intended to be cached must be discarded when the client exists the read access (otherwise the data may become invalid, since the underlying Java files can change at any moment).

There will be support for caching parts of the model and notifying changes, but this support depends on support from the Java infrastructure, which is not available yet. Thus implementors should mainly implement those parts of the model that will not be cached.

When starting to implement a model it is best to generate classes for all model interfaces (that is, the root interface and the interfaces that can be obtained from it). The generated classes should throw UnsupportedOperationException for all methods. Some of these methods will then be modified to do something meaningful.

The JPA ORM metadata model is in the org.netbeans.modules.j2ee.persistenceapi.metadata.orm.annotation package in the j2ee/persistence module.

Model infrastructure

Several classes have been created to ease the implementation of models. They reside in the package in the j2ee/metadata module. It is likely these classes will be moved to a separate module.

AnnotationModelHelper - the main helper class. Its main task is to manage the ClasspathInfo and JavaSource for the Java context. A model implementor calls userActionTask() in order to enter the Java context. This class also contains some helper methods for working with and scanning for usages of annotations (e.g., getAnnotationScanner() or getAnnotationsByType()).

AnnotationParser - this class is useful in parsing annotation and extracting values of their elements, or creating new objects out of those values. This class is pretty well described by its Javadoc.

ElementModelObject - this abstract class can be used to implements the cached model objects. It is still unfinished, so it currently should not be used by implementors.

To do

High-level items

Finish the infrastructure:

  • design a way to avoid entering the model context during the initial scan.
  • finish the support for caching and change events (abadea).
  • the delegation of MetadataModel to DDProvider.getDDRoot() for XML deployment descriptors.

Finish the JPA model (abadea or emononen).

Update all Java EE modules except JPA refactoring and JPA verification to use the JPA model (abadea).

Update the JPA refactoring module to use the JPA model (emononen).

Update the JPA verification module to use the JPA model (tslota).

Finish the EJB model (madamek).

Update all Java EE modules except application servers to use the EJB model (madamek, tmysik).

Implement the web services model (mkuchtiak).

Update all Java EE modules exception application servers to use the web services model (mkuchtiak).

Implement the app client model (tmysik).

Implement the EAR model (tmysik).

Update J2eeModule.getDeploymentDescriptor() in j2eeserver and the respective implementations in all project types to return MetadataModel (abadea).

Update the GlassFish plugin to MetadataModel (pcw, vkraemer).

Update the JBoss plugin to MetadataModel (lkotouc).

Update the WebLogic plugin to MetadataModel (lkotouc).

Miscellaneous small issues

Describe PersistentObjectManager and co.

Do not call javaContextLeft() for nested java source tasks.

Update models to PersistentObjectManager.

Need a method like waitForTypeElement() in PMO tests.

ProjectWebModule.getWebApp() allows WebApp to escape the model context.

size...() methods in JPA ORM model do not work.

Remove DDProvider.getMergedRoot().

j2ee/metadata has no release version.

Parameters validity checks

Refactor EntityMappingsModelHelper and use it in all project types.

AMH.userActionTask() should be runInJavaContext()

Fix at least some of the XXX and FIXME tags.

Common impl of MetadataModelImplementation.

Delegation to the XML descriptor or annotations depending on the version.

Model state when the annotations (e.g., TopLink) are not on the classpath.

MetadataModelCompatibilityTest: test if value returned by action is returned by runReadAction().

Should not use MetadataModel to implement J2eeModuleImplementation.getModuleVersion(), since this method may be called at any time.

Branches and tags

j2ee/archiveproject: trunk -> merged_model_j2ee
j2ee/clientproject: trunk -> merged_model
j2ee/clientproject: trunk -> merged_model_j2ee
j2ee/earproject: trunk -> merged_model_j2ee
j2ee/ejbcore: trunk -> merged_model -> merged_model_j2ee
j2ee/ejbfreeform: trunk -> merged_model_j2ee
j2ee/ejbjarproject: trunk -> merged_model -> merged_model_j2ee
j2ee/metadata: trunk -> merged_model
j2ee/persistence: trunk -> merged_model
j2ee/persistenceapi: trunk -> merged_model
java/j2seproject: trunk -> merged_model
j2ee/ddapi: trunk -> merged_model_j2ee
j2ee/ejbapi: trunk -> merged_model_j2ee
j2eeserver: trunk -> merged_model_j2ee
nbbuild: trunk -> merged_model
serverplugins: trunk -> merged_model_j2ee
tomcatint: trunk -> merged_model_j2ee
web/freeform: trunk -> merged_model_j2ee
web/project: trunk -> merged_model -> merged_model_j2ee
web/webapi: trunk -> merged_model_j2ee
websvc/core: trunk -> merged_model_j2ee
websvc/websvcddapi: trunk -> merged_model_j2ee

Branch merged_model is rooted at merged_model_root. Branch merged_model_j2ee is rooted at merged_model_j2ee_root.

Branch maintenance: merges into the branches

merged_model from the trunk


j2ee/clientproject: merged_model_root, merged_model_trunk_merge_1
j2ee/ejbcore: merged_model_root, merged_model_trunk_merge_1
j2ee/ejbjarproject: merged_model_root, merged_model_trunk_merge_1
web/project: merged_model_root, merged_model_trunk_merge_1


j2ee/ejbcore: merged_model_trunk_merge_1, merged_model_trunk_merge_2


nbbuild: merged_model_root, merged_model_trunk_merge_1


nbbuild: merged_model_trunk_merge_1, merged_model_trunk_merge_2

merged_model_j2ee from the merged_model branch


web/project: merged_model_j2ee_root, merged_model_j2ee_merged_model_merge_1


j2ee/ejbcore: merged_model_j2ee_root, merged_model_j2ee_merged_model_merge_1


web/project: merged_model_j2ee_merged_model_merge_1, merged_model_j2ee_merged_model_merge_2


j2ee/ejbcore: merged_model_j2ee_merged_model_merge_1, merged_model_j2ee_merged_model_merge_2

merged_model_j2ee from the trunk


websvc/core: merged_model_j2ee_root, merged_model_j2ee_trunk_merge_1


web/project: merged_model_trunk_merge_1, merged_model_before_merge_trunk_1
web/project: merged_model_after_merge_trunk_1, merged_model_j2ee_trunk_merge_1


websvc/core: merged_model_j2ee_trunk_merge_1, merged_model_j2ee_trunk_merge_2


web/project: merged_model_j2ee_trunk_merge_1, merged_model_j2ee_trunk_merge_2


j2ee/ejbcore: merged_model_trunk_merge_2, merged_model_before_merge_trunk_1
j2ee/ejbcore: merged_model_after_merge_trunk_1, merged_model_j2ee_trunk_merge_1

Branch maintenance: merges into the trunk



j2ee/metadata: merged_model_root, merged_model_merge_trunk_1
j2ee/persistence: merged_model_root, merged_model_merge_trunk_1
j2ee/persistenceapi: merged_model_root, merged_model_merge_trunk_1
java/j2seproject: merged_model_root, merged_model_merge_trunk_1

j2ee/clientproject: merged_model_trunk_merge_1, merged_model_merge_trunk_1
j2ee/ejbjarproject: merged_model_trunk_merge_1, merged_model_merge_trunk_1
web/project: merged_model_trunk_merge_1, merged_model_merge_trunk_1

j2ee/ejbcore: merged_model_trunk_merge_2, merged_model_merge_trunk_1
nbbuild: merged_model_trunk_merge_2, merged_model_merge_trunk_1
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