|
Dali Provisional API Release 3.2 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
public interface JpaProject
A JPA project is associated with an Eclipse project
(and its corresponding Java project).
It holds the resource model that corresponds to the
various JPA-related resources (the persistence.xml file, its
mapping files [orm.xml], and the Java source files). It also
holds the context model that represents
the JPA metadata, as derived from spec-defined defaults, Java source code
annotations, and XML descriptors.
To retrieve the JPA project corresponding to an Eclipse project:
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Foo Project");
JpaProject jpaProject = (JpaProject) project.getAdapter(JpaProject.class);
This is a non-blocking call; and as a result it will return null
if the JPA project is currently under construction. Use a JPA project reference to retrieve a JPA project in a blocking
fashion that will return a JPA project once it has been constructed.
See org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters.
Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
JpaProject.Reference,
ProjectAdapterFactory| Nested Class Summary | |
|---|---|
static interface |
JpaProject.Config
The settings used to construct a JPA project. |
static class |
JpaProject.ContextRootTransformer
|
static interface |
JpaProject.Manager
The JPA project manager provides behavior to be used by all the JPA projects |
static class |
JpaProject.ProjectEquals
|
static interface |
JpaProject.Reference
Standard adapter for "synchronously" retrieving a JPA project
(i.e. if necessary, wait for the JPA project to be constructed;
thus the InterruptedException):
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Foo Project");
JpaProject.Reference jpaProjectRef = (JpaProject.Reference) project.getAdapter(JpaProject.Reference.class);
JpaProject jpaProject = jpaProjectRef.getValue();
See org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters. |
| Nested classes/interfaces inherited from interface org.eclipse.jpt.jpa.core.JpaModel |
|---|
JpaModel.JpaVersionIsCompatibleWith |
| Field Summary | |
|---|---|
static org.eclipse.jpt.common.utility.transformer.Transformer<JpaProject,JpaContextRoot> |
CONTEXT_ROOT_TRANSFORMER
|
static String |
DISCOVERS_ANNOTATED_CLASSES_PROPERTY
ID string used when discoversAnnotatedClasses property is changed. |
static String |
EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION
ID string used when the JPA project's collection of external Java resource compilation units changes. |
static IProjectFacet |
FACET
The JPA project facet. |
static String |
FACET_ID
The JPA project facet ID. |
static IProjectFacetVersion |
FACET_VERSION
The JPA project facet version. |
static String |
FACET_VERSION_STRING
The JPA project facet version string. |
static String |
JPA_FILES_COLLECTION
ID string used when the JPA project's collection of JPA files changes. |
static String |
MARKER_TYPE
The JPA validation marker type (value: "org.eclipse.jpt.jpa.core.problem"). |
static String |
MARKER_TYPE_SCOPE
|
static String |
MARKER_TYPE_SCOPE_
|
static String |
RELATIVE_MARKER_TYPE
|
static String |
USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY
ID string used when the JPA project's user override default catalog changes. |
static String |
USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY
ID string used when the JPA project's user override default schema changes. |
| Method Summary | |
|---|---|
boolean |
discoversAnnotatedClasses()
Return whether the JPA project will not generate error messages for any annotated classes that are not listed in the persistence.xml
file or one of its mapping files. |
void |
dispose()
The JPA project has been removed from the JPA model. |
Iterable<JavaResourceAbstractType> |
getAnnotatedJavaSourceTypes()
Return the resource types of the JPA project's annotated Java classes (ignoring classes in JARs referenced in the persistence.xml). |
ConnectionProfile |
getConnectionProfile()
Return the JPA project's connection. |
JpaContextRoot |
getContextRoot()
Return the root of the JPA project's context model. |
JpaDataSource |
getDataSource()
Return the data source the JPA project is mapped to. |
String |
getDefaultCatalog()
Return the JPA project's default catalog; which is either the user override catalog or the database's default catalog. |
Catalog |
getDefaultDbCatalog()
Return the JPA project's default database catalog. |
Schema |
getDefaultDbSchema()
Return the JPA project's default database schema. |
SchemaContainer |
getDefaultDbSchemaContainer()
Return the JPA project's default database schema container; which is either the JPA project's default catalog or the JPA project's database, depending on how the DTP model is implemented. |
JptXmlResource |
getDefaultOrmXmlResource()
Return the XML resource model corresponding to the file META-INF/orm.xml if that file has the mapping file content type. |
String |
getDefaultSchema()
Return the JPA project's default schema; which can be one of the following: the user override schema the default catalog's default schema the database's default schema (if catalogs are not supported) |
Iterable<JavaResourceCompilationUnit> |
getExternalJavaResourceCompilationUnits()
Return the JPA project's external Java resource compilation units. |
int |
getExternalJavaResourceCompilationUnitsSize()
Return the size of the JPA project's external Java resource compilation units. |
JavaResourceTypeCache |
getExternalJavaResourceTypeCache()
Return the JPA project's external Java resource type cache. |
Iterable<JpaFile> |
getJarJpaFiles()
Return the JPA project's JPA files for jars. |
IJavaProject |
getJavaProject()
Return the Java project associated with the JPA project. |
JavaResourcePackage |
getJavaResourcePackage(String packageName)
Return the Java resource package for the specified package. |
JavaResourcePackageFragmentRoot |
getJavaResourcePackageFragmentRoot(String jarFileName)
Return the Java resource package fragement root for the specified JAR. |
Iterable<JavaResourcePackage> |
getJavaResourcePackages()
Return the Java resource packages for the project. |
JavaResourceAbstractType |
getJavaResourceType(String typeName)
Return the Java resource type for the fully qualified type name. |
JavaResourceAbstractType |
getJavaResourceType(String typeName,
JavaResourceAnnotatedElement.AstNodeType astNodeType)
Return the JavaResourceAbstractType with the fully qualified type name and astNodeType. |
JpaFile |
getJpaFile(IFile file)
Return the JPA file corresponding to the specified file. |
Iterable<JpaFile> |
getJpaFiles()
Return the JPA project's JPA files. |
int |
getJpaFilesSize()
Return the size of the JPA project's JPA files. |
Iterable<String> |
getManagedTypeAnnotationNames()
Return only the valid managed type annotation names (i.e. |
JpaProject.Manager |
getManager()
Return the JPA project manager. |
JptXmlResource |
getMappingFileXmlResource(IPath runtimePath)
Return the XML resource model corresponding to the file with the specified runtime path if that file has the mapping file content type ( org.eclipse.jpt.jpa.core.content.mappingFile) |
String |
getName()
Return the JPA project's name, which is the same as the associated Eclipse project's name. |
JptXmlResource |
getPersistenceXmlResource()
Return the XML resource model corresponding to the file with runtime path META-INF/persistence.xml if that file has the persistence content type
("org.eclipse.jpt.jpa.core.content.persistence"). |
IFile |
getPlatformFile(IPath runtimePath)
Return an IFile that best represents the given runtime location |
Iterable<JavaResourceAbstractType> |
getPotentialJavaSourceTypes()
Return only the valid potential types (i.e. those annotated with @Entity, @Embeddable, @MappedSuperclass,
@Converter in JPA 2.1). |
IProject |
getProject()
Return the Eclipse project associated with the JPA project. |
Iterable<String> |
getTypeMappingAnnotationNames()
Return the valid type mapping annotation names (i.e. |
String |
getUserOverrideDefaultCatalog()
Return the identifier of the catalog to be used as a default for the JPA project instead of the one that is associated by default with the connection profile. |
String |
getUserOverrideDefaultSchema()
Return the identifier of the schema to be used as a default for the JPA project instead of the one that is associated by default with the connection profile. |
Iterable<IMessage> |
getValidationMessages(IReporter reporter)
Return JPA project's validation messages. |
void |
javaElementChanged(ElementChangedEvent event)
Synchronize the JPA project with the specified Java change. |
void |
projectChanged(IResourceDelta delta)
Synchronize the JPA project with the specified project resource delta, watching for added and removed files in particular. |
void |
setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses)
Set whether the JPA project will not generate error messages for any annotated classes that are not listed in the persistence.xml
file or one of its mapping files. |
void |
setUserOverrideDefaultCatalog(String catalog)
Set the identifier of the catalog to be used as a default for the JPA project instead of the one that is associated by default with the connection profile. |
void |
setUserOverrideDefaultSchema(String schema)
Set the identifier of the schema to be used as a default for the JPA project instead of the one that is associated by default with the connection profile. |
void |
synchronizeContextModel()
Should only be used by [incorrectly written] tests.... |
| Methods inherited from interface org.eclipse.jpt.jpa.core.JpaModel |
|---|
getJpaPlatform, getJpaProject, getJpaProjectManager, getParent, getResource, stateChanged |
| Methods inherited from interface org.eclipse.jpt.common.utility.model.Model |
|---|
addChangeListener, addCollectionChangeListener, addListChangeListener, addPropertyChangeListener, addStateChangeListener, removeChangeListener, removeCollectionChangeListener, removeListChangeListener, removePropertyChangeListener, removeStateChangeListener |
| Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
|---|
getAdapter |
| Field Detail |
|---|
static final String FACET_ID
Value: "jpt.jpa"
static final IProjectFacet FACET
static final String FACET_VERSION_STRING
Value: "1.0"
static final IProjectFacetVersion FACET_VERSION
static final String MARKER_TYPE_SCOPE
static final String MARKER_TYPE_SCOPE_
static final String RELATIVE_MARKER_TYPE
static final String MARKER_TYPE
"org.eclipse.jpt.jpa.core.problem").
See org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.resources.markers.
IMarker.getType()static final org.eclipse.jpt.common.utility.transformer.Transformer<JpaProject,JpaContextRoot> CONTEXT_ROOT_TRANSFORMER
static final String JPA_FILES_COLLECTION
Model.addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener),
Constant Field Valuesstatic final String EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION
Model.addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener),
Constant Field Valuesstatic final String USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY
Model.addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener),
Constant Field Valuesstatic final String USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY
Model.addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener),
Constant Field Valuesstatic final String DISCOVERS_ANNOTATED_CLASSES_PROPERTY
Model.addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener),
Constant Field Values| Method Detail |
|---|
JpaProject.Manager getManager()
String getName()
IProject getProject()
IJavaProject getJavaProject()
JpaContextRoot getContextRoot()
void dispose()
Iterable<JpaFile> getJpaFiles()
int getJpaFilesSize()
JpaFile getJpaFile(IFile file)
Iterable<JavaResourceCompilationUnit> getExternalJavaResourceCompilationUnits()
int getExternalJavaResourceCompilationUnitsSize()
JavaResourceTypeCache getExternalJavaResourceTypeCache()
JptXmlResource getPersistenceXmlResource()
META-INF/persistence.xml if that file has the persistence content type
("org.eclipse.jpt.jpa.core.content.persistence").
XmlPersistence.DEFAULT_RUNTIME_PATH,
XmlPersistence.CONTENT_TYPEJptXmlResource getMappingFileXmlResource(IPath runtimePath)
org.eclipse.jpt.jpa.core.content.mappingFile)
ResourceMappingFile.Root.CONTENT_TYPEJptXmlResource getDefaultOrmXmlResource()
META-INF/orm.xml if that file has the mapping file content type.
XmlEntityMappings.DEFAULT_RUNTIME_PATHIterable<JavaResourceAbstractType> getAnnotatedJavaSourceTypes()
persistence.xml).
Iterable<JavaResourceAbstractType> getPotentialJavaSourceTypes()
@Entity, @Embeddable, @MappedSuperclass,
@Converter in JPA 2.1). Java resource
types that are directly part of the JPA project, ignoring
those in JARs referenced in persistence.xml.
getManagedTypeAnnotationNames()Iterable<String> getManagedTypeAnnotationNames()
@Entity, @Embeddable,
@MappedSuperclass, @Converter in JPA 2.1).
JavaManagedTypeDefinition.getAnnotationNames(JpaProject),
JpaPlatform.getJavaManagedTypeDefinitions()Iterable<String> getTypeMappingAnnotationNames()
@Entity, @Embeddable, @MappedSuperclass).
JavaTypeMappingDefinition.getAnnotationName(),
JpaPlatform.getJavaTypeMappingDefinitions()JavaResourceAbstractType getJavaResourceType(String typeName)
JavaResourceAbstractType getJavaResourceType(String typeName,
JavaResourceAnnotatedElement.AstNodeType astNodeType)
JavaResourceAbstractType with the fully qualified type name and astNodeType.
Return null if invalid or absent or if the astNodeType does not match.
JavaResourcePackage getJavaResourcePackage(String packageName)
Iterable<JavaResourcePackage> getJavaResourcePackages()
JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(String jarFileName)
Iterable<JpaFile> getJarJpaFiles()
void projectChanged(IResourceDelta delta)
void javaElementChanged(ElementChangedEvent event)
void synchronizeContextModel()
IFile getPlatformFile(IPath runtimePath)
IFile that best represents the given runtime location
Iterable<IMessage> getValidationMessages(IReporter reporter)
JpaDataSource getDataSource()
ConnectionProfile getConnectionProfile()
SchemaContainer getDefaultDbSchemaContainer()
String getDefaultCatalog()
Catalog getDefaultDbCatalog()
getDefaultCatalog()String getDefaultSchema()
Schema getDefaultDbSchema()
getDefaultSchema(),
getDefaultDbSchemaContainer()String getUserOverrideDefaultCatalog()
void setUserOverrideDefaultCatalog(String catalog)
String getUserOverrideDefaultSchema()
void setUserOverrideDefaultSchema(String schema)
boolean discoversAnnotatedClasses()
persistence.xml
file or one of its mapping files. If this flag is set to
false, error messages will be generated for all of the
annotated classes that are not explicitly listed. The JPA project
always "discovers" annotated classes and allows the user to
reference them throughout the model; this flag simply controls whether
the error messages are generated during validation.
This is a user-specified preference that is probably only helpful when deploying to a JavaSE environment. The JPA spec says annotated classes are to be discovered automatically in a JavaEE environment; while the managed persistence classes must be explicitly listed in a JavaSE environment: "A list of all named managed persistence classes must be specified in Java SE environments to insure portability". This flag allows Dali to behave consistently with the user's JPA implementation, which may allow "discovery" in a JavaSE environment (e.g. EclipseLink). This setting can also be used when the user wants to explicitly list classes, even when the classes are "discovered" by the JPA implementation.
void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses)
persistence.xml
file or one of its mapping files.
discoversAnnotatedClasses()
|
Dali Provisional API Release 3.2 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||