|
|
This module provides APIs needed by the infrastructure supporting Java Persistence API to locate the persistence features provided by projects.
Question (arch-overall): Describe the overall architecture. Answer:This module provides the JavaPersistenceAPISupportAPI which allows the infrastructure supporting Java Persistence API (JPA) to retrieve informatiou about JPA features provided by projects. It mainly consists of SPI interfaces which must be implemented by projects and put in their default lookups.
Question (arch-usecases): Describe the main use cases of the new API. Who will use it under what circumstances? What kind of code would typically need to be written to use the module? Answer:
The entry point to the Java Persistence API is the
persistence.xml
file, which contains persistence units.
Persistence units are logical groupings of entity classes and mapping
metadata which specifies the mapping of the entity classes to a database.
The support for Java Persistence API needs to locate the default location
for the persistence.xml
file in a project and to
trigger the creation of this location if it doesn't exist. This is
supported by the PersistenceLocation
class. It delegates
to the PersistenceLocationProvider
interface, which is
supposed to be implemented by projects and put in their lookups.
The entity classes defined by a persistence.xml
file can be
used by clients, e.g. a servlet or an EJB session bean. It must be possible
for such as client to find out if there is a persistence.xml
available and the entity classes defined by its persistence units.
For this the concept of a persistence scope was introduced. A
persistence scope is the grouping of a persistence.xml
file
and a classpath containing entity classes. A persistence scope is described
by the PersistenceScope
class. The
PersistenceScope.getPersistenceScope(FileObject)
method can be
used to retrieve the persistence scope for a given FileObject
.
This method delegates to the PersistenceScopeProvider
, which
must be implemented by projects and put in their lookups.
A PersistenceScope
instance is created by implementing the
PersistenceScopeImplementation
interface and passing it to the
PersistenceScopeFactory.createPersistenceScope()
method.
Sometimes it is necessary to retrieve a list of all persistence scopes
defined by a project and it must be possible to listen for changes to this
list. This is supported by the PersistenceScopes
class. The
PersistenceScopes.getPersistenceScopes(Project)
method can be
used to retrieve a PersistenceScopes
for a given project. This
method delegates to the PersistenceScopesProvider
, which mus
be implemented by projects and put in their lookups.
The PersistenceScopes.getPersistenceScopes()
method can be
used to retrieve an array of PersistenceScope
's. There are
also methods for adding and removing a PropertyChangeListener
for listening on the list of persistence scopes.
A PersistenceScopes
instance is created by implementing the
PersistenceScopesImplementation
interface and passing it to the
PersistenceScopesFactory.createPersistenceScopes()
method.
To help a project implement PersistenceScopesProvider
easily
the PersistenceScopesHelper
class is provided. It supports
managing a PersistenceScope
and listening to the respective
persistence.xml
file and sending property change events
accordingly.
The support for Java Persistence API needs to retrieve the entity classes
defined in a project. A project can serve as a class library containing
entity classes for other projects which does not contain a
persistence.xml
itself, thus it doesn't provide any
PersistenceScope
's. This is solved by the
PersistenceClassPathProvider
inteface, which returns a
classpath containing entity classes.
The implementation is done. The target milestone is promo-G.
Question (arch-quality): How will the quality of your code be tested and how are future regressions going to be prevented? Answer:All Javadoc-specified functionality should be covered by unit tests.
Question (arch-where): Where one can find sources for your module? Answer:
The sources for the module are in NetBeans CVS in j2ee/persistenceapi directory.
These modules are required in project.xml file:
The module does not depend on any projects outside NetBeans.
Question (dep-platform): On which platforms does your module run? Does it run in the same way on each? Answer:The module should run in the samy way on all platforms.
Question (dep-jre): Which version of JRE do you need (1.2, 1.3, 1.4, etc.)? Answer:The module requires JRE 1.4.
Question (dep-jrejdk): Do you require the JDK or is the JRE enough? Answer:JRE is enough.
Just the module JAR needs to be deployed.
Question (deploy-nbm): Can you deploy an NBM via the Update Center? Answer:Yes.
Question (deploy-shared): Do you need to be installed in the shared location only, or in the user directory only, or can your module be installed anywhere? Answer:Anywhere.
Question (deploy-packages): Are packages of your module made inaccessible by not declaring them public? Answer:Only API packages are exported, and only to the friend modules.
Question (deploy-dependencies): What do other modules need to do to declare a dependency on this one? Answer:Only friend modules can declare a dependency on this module.
The module does not contain any UI, so it does not need to be internationalized.
Question (compat-standards): Does the module implement or define any standards? Is the implementation exact or does it deviate somehow? Answer:The module does not define nor implement any standards.
Question (compat-version): Can your module coexist with earlier and future versions of itself? Can you correctly read all old settings? Will future versions be able to read your current settings? Can you read or politely ignore settings stored by a future version? Answer:The module does not save nor read any settings.
java.io.File
directly?
Answer:
No.
Question (resources-layer): Does your module provide own layer? Does it create any files or folders in it? What it is trying to communicate by that and with which components? Answer:No.
Question (resources-read): Does your module read any resources from layers? For what purpose? Answer:No.
Question (resources-mask): Does your module mask/hide/override any resources provided by other modules in their layers? Answer:No.
org.openide.util.Lookup
or any similar technology to find any components to communicate with? Which ones?
Answer:
org.netbeans.modules.j2ee.persistence.spi.PersistenceScopeProvider
-
Implementations of PersistenceScopeProvider
are searched for in the
default lookup and delegated to until one is found which returns a non-null value.
An implementation of the PersistenceScopeProvider
interface
delegating to the project which owns the FileObject
passed to
the findPersistenceScope()
method is registered in the default
lookup using META-INF/services.
No.
System.getProperty
) property?
Answer:
No.
Question (exec-component): Is execution of your code influenced by any (string) property of any of your components? Answer:No.
Question (exec-ant-tasks): Do you define or register any ant tasks that other can use? Answer:No.
Question (exec-classloader): Does your code create its own class loader(s)? Answer:No.
Question (exec-reflection): Does your code use Java Reflection to execute other code? Answer:No.
Question (exec-privateaccess): Are you aware of any other parts of the system calling some of your methods by reflection? Answer:No.
Question (exec-process): Do you execute an external process from your module? How do you ensure that the result is the same on different platforms? Do you parse output? Do you depend on result code? Answer:No.
Question (exec-introspection): Does your module use any kind of runtime type information (instanceof
,
work with java.lang.Class
, etc.)?
Answer:
No.
Question (exec-threading): What threading models, if any, does your module adhere to? Answer:The API is thread-safe. Events are fired synchronously.
Question (security-policy): Does your functionality require modifications to the standard policy file? Answer:No.
Question (security-grant): Does your code grant additional rights to some other code? Answer:No.
The module does not read or write any files.
Question (format-dnd): Which protocols (if any) does your code understand during Drag & Drop? Answer:None.
Question (format-clipboard): Which data flavors (if any) does your code read from or insert to the clipboard (by access to clipboard on means calling methods onjava.awt.datatransfer.Transferable
?
Answer:
None.
No.
Question (perf-exit): Does your module run any code on exit? Answer:No.
Question (perf-scale): Which external criteria influence the performance of your program (size of file in editor, number of files in menu, in source directory, etc.) and how well your code scales? Answer:Performance scales linearly with the number of registered clients.
Question (perf-limit): Are there any hard-coded or practical limits in the number or size of elements your code can handle? Answer:None known.
Question (perf-mem): How much memory does your component consume? Estimate with a relation to the number of windows, etc. Answer:
The implementation doesn't consume any memory apart from some
static fields, e.g. the Lookup.Result
containing
the registered PersistenceScopeProvider
's.
No.
Question (perf-progress): Does your module execute any long-running tasks? Answer:No.
Question (perf-huge_dialogs): Does your module contain any dialogs or wizards with a large number of GUI controls such as combo boxes, lists, trees, or text areas? Answer:No.
Question (perf-menus): Does your module use dynamically updated context menus, or context-sensitive actions with complicated and slow enablement logic? Answer:No.
Question (perf-spi): How the performance of the plugged in code will be enforced? Answer:The plugged-in code is expected to execute quickly.
Built on August 9 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.