Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2010-07-30 14:32:01 -0400
committerpfullbright2010-07-30 14:32:01 -0400
commit1b54c142e7fec9ac5b8d4dab2d04d2929c6b0a81 (patch)
treee07f20e2d0cce10fdeccc5781ceeaec292f17f8f
parent4150fda15c5f63e3cf7852e7840189a1352355e3 (diff)
downloadwebtools.dali-1b54c142e7fec9ac5b8d4dab2d04d2929c6b0a81.tar.gz
webtools.dali-1b54c142e7fec9ac5b8d4dab2d04d2929c6b0a81.tar.xz
webtools.dali-1b54c142e7fec9ac5b8d4dab2d04d2929c6b0a81.zip
added ResourceLocator implementation
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/plugin.properties1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/plugin.xml73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/schema/resourceLocators.exsd182
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JptCorePlugin.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XPointUtil.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java300
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ModuleResourceLocator.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/PluginResourceLocator.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorManager.java171
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/SimpleJavaResourceLocator.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/WebModuleResourceLocator.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/AbstractXmlResourceProvider.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/ResourceLocator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/EclipseLinkJpaProject.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties10
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_persistence.properties2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/persistence/details/ArchiveFileSelectionDialog.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/EntityClassWizardPage.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileNewFileWizardPage.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizard.java360
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java283
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java5
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java5
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java14
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java7
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java5
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java40
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_2/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java40
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmContextModelTestCase.java3
120 files changed, 2069 insertions, 1221 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
index 5445d4c1e2..6a2ec18e7b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
@@ -24,6 +24,7 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)",
org.eclipse.jst.j2ee;bundle-version="[1.1.200,1.2.0)",
org.eclipse.jst.j2ee.core;bundle-version="[1.1.200,1.3.0)",
+ org.eclipse.pde.core;bundle-version="[3.6.0,4.0.0)";resolution:=optional,
org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
@@ -65,6 +66,7 @@ Export-Package: org.eclipse.jpt.core,
org.eclipse.jpt.core.internal.operations;x-internal:=true,
org.eclipse.jpt.core.internal.prefs;x-internal:=true,
org.eclipse.jpt.core.internal.refactoring;x-internal:=true,
+ org.eclipse.jpt.core.internal.resource;x-internal:=true,
org.eclipse.jpt.core.internal.resource.contenttypes;x-internal:=true,
org.eclipse.jpt.core.internal.resource.java;x-internal:=true,
org.eclipse.jpt.core.internal.resource.java.binary;x-internal:=true,
diff --git a/jpa/plugins/org.eclipse.jpt.core/plugin.properties b/jpa/plugins/org.eclipse.jpt.core/plugin.properties
index c0c7fd1604..976f2baaf7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/plugin.properties
+++ b/jpa/plugins/org.eclipse.jpt.core/plugin.properties
@@ -23,6 +23,7 @@ pluginName = Dali Java Persistence Tools - Core
providerName = Eclipse Web Tools Platform
JPA_PLATFORM=JPA Platform
+RESOURCE_LOCATORS=Resource Locators
JPA_RESOURCE_MODEL_PROVIDERS=JPA Resource Model Providers
JPA_PROBLEM_MARKER=JPA Problem Marker
JPA_FILE_CONTENT=JPA File Content
diff --git a/jpa/plugins/org.eclipse.jpt.core/plugin.xml b/jpa/plugins/org.eclipse.jpt.core/plugin.xml
index cde2967cad..fd28e696a7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.core/plugin.xml
@@ -17,8 +17,13 @@
<extension-point
id="jpaPlatforms"
name="%JPA_PLATFORM"
- schema="schema/jpaPlatforms.exsd"
- />
+ schema="schema/jpaPlatforms.exsd"/>
+
+
+ <extension-point
+ id="resourceLocators"
+ name="%RESOURCE_LOCATORS"
+ schema="schema/resourceLocators.exsd"/>
<!-- ***** Eclipse core extensions ***** -->
@@ -186,6 +191,68 @@
</extension>
+ <extension
+ point="org.eclipse.jpt.core.resourceLocators">
+
+ <resourceLocator
+ id="org.eclipse.jpt.core.simpleJavaResourceLocator"
+ class="org.eclipse.jpt.core.internal.resource.SimpleJavaResourceLocator"
+ priority="lowest">
+ <enablement>
+ <with variable="project">
+ <test
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="java"
+ forcePluginActivation="true"/>
+ </with>
+ </enablement>
+ </resourceLocator>
+
+ <resourceLocator
+ id="org.eclipse.jpt.core.moduleResourceLocator"
+ class="org.eclipse.jpt.core.internal.resource.ModuleResourceLocator"
+ priority="low">
+ <enablement>
+ <with variable="project">
+ <test
+ property="org.eclipse.core.resources.projectNature"
+ value="org.eclipse.wst.common.modulecore.ModuleCoreNature"
+ forcePluginActivation="true"/>
+ </with>
+ </enablement>
+ </resourceLocator>
+
+ <resourceLocator
+ id="org.eclipse.jpt.core.webModuleResourceLocator"
+ class="org.eclipse.jpt.core.internal.resource.WebModuleResourceLocator"
+ priority="normal">
+ <enablement>
+ <with variable="project">
+ <test
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.web"
+ forcePluginActivation="true"/>
+ </with>
+ </enablement>
+ </resourceLocator>
+
+ <resourceLocator
+ id="org.eclipse.jpt.core.pluginResourceLocator"
+ class="org.eclipse.jpt.core.internal.resource.PluginResourceLocator"
+ priority="high">
+ <enablement>
+ <with variable="project">
+ <test
+ property="org.eclipse.core.resources.projectNature"
+ value="org.eclipse.pde.PluginNature"
+ forcePluginActivation="true"/>
+ </with>
+ </enablement>
+ </resourceLocator>
+
+ </extension>
+
+
<!--
******************************************
* Library Provider Framework Integration *
@@ -203,7 +270,7 @@
<operation
class="org.eclipse.jpt.core.internal.facet.LegacyJpaLibraryProviderInstallOperation"/>
</action>
- </provider>
+ </provider>
<provider
id="jpa-no-op-library-provider"
diff --git a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
index 58f9b94289..a46b621cd3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
+++ b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2006, 2009 Oracle. All rights reserved.
+# Copyright (c) 2006, 2010 Oracle. All rights reserved.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0, which accompanies this distribution
# and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
NONE=<None>
VALIDATE_JOB=Validation
-VALIDATE_PROJECT_NOT_SPECIFIED=Project must be specified
-VALIDATE_SOURCE_FOLDER_NOT_SPECIFIED=Source folder must be specified
-VALIDATE_SOURCE_FOLDER_ILLEGAL=Source folder path is illegal
-VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST=Source folder ''{0}'' does not exist
-VALIDATE_SOURCE_FOLDER_NOT_IN_PROJECT=Source folder ''{0}'' is not in project ''{1}''
-VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER=Source folder ''{0}'' is not an actual source folder
-VALIDATE_FILE_PATH_NOT_SPECIFIED=File path must be specified
-VALIDATE_FILE_ALREADY_EXISTS=File already exists at this location
+VALIDATE_CONTAINER_NOT_SPECIFIED=Parent folder must be specified
+VALIDATE_PROJECT_NOT_JPA=Project does not have the JPA facet
+VALIDATE_PROJECT_IMPROPER_PLATFORM=Project's JPA platform does not support this file type
+VALIDATE_CONTAINER_QUESTIONABLE=Parent folder may not be acceptable for this project
+VALIDATE_FILE_NAME_NOT_SPECIFIED=File name must be specified
+VALIDATE_FILE_ALREADY_EXISTS=File already exists
VALIDATE_FILE_VERSION_NOT_SUPPORTED=File version not supported
VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION=File version not supported for JPA facet version
VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED=Persistence unit not specified
@@ -39,9 +37,12 @@ SYNCHRONIZING_CLASSES_TASK=Synchronizing classes ...
INVALID_PERSISTENCE_XML_CONTENT=Invalid persistence.xml content
ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE=Error synchronizing classes. Could not validate.
ERROR_WRITING_FILE=Could not write to persistence.xml
-REGISTRY_MISSING_ATTRIBUTE=The extension element ''{0}'' in plug-in ''{1}'' is missing the required attribute ''{2}''.
-REGISTRY_DUPLICATE=The plug-ins ''{0}'' and ''{1}'' have registered a duplicate attribute ''{2}'' for the extension element ''{3}'': ''{4}''.
-REGISTRY_FAILED_INSTANTIATION=Unable to instantiate the class ''{0}'' for the extension element ''{1}'' in the plug-in ''{2}''.
+REGISTRY_MISSING_ATTRIBUTE=Missing required attribute ''{0}'' for element ''{1}'' in extension ''{1}'' from plug-in ''{2}''.
+REGISTRY_INVALID_ELEMENT_VALUE=Invalid value ''{0}'' for element ''{1}'' in extension ''{2}'' from plug-in ''{3}''.
+REGISTRY_DUPLICATE=An extension of ''{0}'' with the id ''{1}'' is already registered.
+REGISTRY_FAILED_CLASS_LOAD=Unable to load the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''.
+REGISTRY_FAILED_INTERFACE_ASSIGNMENT=Unable to assign the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}'' to the interface ''{3}''.
+REGISTRY_FAILED_INSTANTIATION=Unable to instantiate the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''.
UPDATE_JOB_NAME=Update JPA project: ''{0}''
PLATFORM_ID_DOES_NOT_EXIST=No JPA platform exists for the id: ''{0}''. The JPA project was not created for project ''{1}''. Ensure that the platform''s plugin has been added to this Eclipse installation.
DALI_EVENT_HANDLER_THREAD_NAME=Dali Event Handler
diff --git a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties
index 7ef934e0dc..7e79a62abf 100644
--- a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties
+++ b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties
@@ -30,7 +30,7 @@ PERSISTENCE_UNIT_DUPLICATE_CLASS=Duplicate class \"{0}\"
PERSISTENCE_UNIT_REDUNDANT_CLASS=Class \"{0}\" is already specified in mapping file \"{1}\"
PERSISTENCE_UNIT_DUPLICATE_JAR_FILE=Duplicate JAR file \"{0}\"
PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE=Unspecified JAR file
-PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING=The path to the JAR file will vary on your deployment environment. Please make sure the specified path fits your particular environment.
+PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING=The path to the JAR file will vary on your runtime environment. Please make sure the specified path fits your particular environment.
PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE=JAR file \"{0}\" cannot be resolved
GENERATOR_DUPLICATE_NAME=Duplicate generator named \"{0}\" defined in this persistence unit
QUERY_DUPLICATE_NAME=Duplicate query named \"{0}\" defined in this persistence unit
diff --git a/jpa/plugins/org.eclipse.jpt.core/schema/resourceLocators.exsd b/jpa/plugins/org.eclipse.jpt.core/schema/resourceLocators.exsd
new file mode 100644
index 0000000000..b5b8481e9f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/schema/resourceLocators.exsd
@@ -0,0 +1,182 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<schema targetNamespace="org.eclipse.jpt.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jpt.core" id="resourceLocators" name="Resource Locators"/>
+ </appInfo>
+ <documentation>
+ Used to provide custom (non-java) resource location logic to JPA projects.
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="resourceLocator" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resourceLocator">
+ <annotation>
+ <documentation>
+ Declares a resource locator. See &lt;samp&gt;org.eclipse.jpt.core.resource.ResourceLocator&lt;/samp&gt; for more information on resource locators.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="enablement" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the declared resource locator.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The implementation class, which implements &lt;samp&gt;org.eclipse.jpt.core.resource.ResourceLocator&lt;/samp&gt;.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jpt.core.resource.ResourceLocator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" default="normal">
+ <annotation>
+ <documentation>
+ Indicates the relative priority of this extension to other extensions. Used by the resource locator manager to determine which extension should be used in the case that multiple extensions apply to a given project. Defaults to &quot;normal&quot;.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="lowest"/>
+ <enumeration value="low"/>
+ <enumeration value="normal"/>
+ <enumeration value="high"/>
+ <enumeration value="highest"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ JPT 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;br&gt;
+&lt;p&gt;
+The following example is the included simple java resource locator, which is used for simple java projects. It is of &quot;lowest&quot; priority, since all JPA projects will at their roots be simple java projects.
+&lt;p&gt;
+&lt;pre&gt;
+&lt;extension
+ point=&quot;org.eclipse.jpt.core.resourceLocators&quot;&gt;
+ &lt;resourceLocator
+ id=&quot;org.eclipse.jpt.core.simpleJavaResourceLocator&quot;
+ class=&quot;org.eclipse.jpt.core.internal.resource.SimpleJavaResourceLocator&quot;
+ priority=&quot;lowest&quot;
+ &lt;enablement&gt;
+ &lt;with variable=&quot;project&quot;&gt;
+ &lt;test property=&quot;org.eclipse.wst.common.project.facet.core.projectFacet&quot; value=&quot;java&quot; forcePluginActivation=&quot;true&quot;/&gt;
+ &lt;/with&gt;
+ &lt;/enablement&gt;
+ &lt;/resourceLocator&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;
+The contributed resource locator class must implement &lt;code&gt;org.eclipse.jpt.core.resource.ResourceLocator&lt;/code&gt;.
+&lt;p&gt;
+The enablement variables include:
+&lt;ul&gt;
+&lt;li&gt;&quot;project&quot; which gives the current IProject.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/p&gt;
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;The org.eclipse.jpt.core plug-in provides the following content types:&lt;ul&gt;
+&lt;li&gt;org.eclipse.jpt.core.simpleJavaResourceLocator&lt;/li&gt;
+&lt;li&gt;org.eclipse.jpt.core.javaEEModuleResourceLocator&lt;/li&gt;
+&lt;li&gt;org.eclipse.jpt.core.webModuleResourceLocator&lt;/li&gt;
+&lt;li&gt;org.eclipse.jpt.core.pluginResourceLocator&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/p&gt;
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2010 Oracle. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0, which accompanies this distribution
+and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+Contributors:
+Oracle - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java
index 7377c39127..b5f26a8034 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java
@@ -10,10 +10,10 @@
package org.eclipse.jpt.core;
import java.util.Iterator;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.ElementChangedEvent;
@@ -47,7 +47,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface JpaProject
@@ -144,30 +144,31 @@ public interface JpaProject
// ********** XML resources **********
-
+
/**
- * Return the XML resource model corresponding to the file
+ * Return the XML resource model corresponding to the file with runtime path
* <code>META-INF/persistence.xml</code> if that file has the persistence content type
* (<code>"org.eclipse.jpt.core.content.persistence"</code>).
*
- * @see JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH
+ * @see JptCorePlugin#DEFAULT_PERSISTENCE_XML_RUNTIME_PATH
+ * @see JptCorePlugin#PERSISTENCE_XML_CONTENT_TYPE
*/
JpaXmlResource getPersistenceXmlResource();
/**
- * Return the XML resource model corresponding to the specified file
- * if that file has the mapping file content type
+ * Return the XML resource model corresponding to the file with the specified
+ * runtime path if that file has the mapping file content type
* (<code>"org.eclipse.jpt.core.content.mappingFile"</code>)
*
* @see JptCorePlugin#MAPPING_FILE_CONTENT_TYPE
*/
- JpaXmlResource getMappingFileXmlResource(String filePath);
+ JpaXmlResource getMappingFileXmlResource(IPath runtimePath);
/**
* Return the XML resource model corresponding to the file
* <code>META-INF/orm.xml</code> if that file has the mapping file content type.
*
- * @see JptCorePlugin#DEFAULT_ORM_XML_FILE_PATH
+ * @see JptCorePlugin#DEFAULT_ORM_XML_RUNTIME_PATH
*/
JpaXmlResource getDefaultOrmXmlResource();
@@ -318,10 +319,9 @@ public interface JpaProject
// ********** utility **********
/**
- * Convert the specified file name to a file mapped to the appropriate
- * deployment location.
+ * Return an {@link IFile} that best represents the given runtime location
*/
- IFile convertToPlatformFile(String fileName);
+ IFile getPlatformFile(IPath runtimePath);
// ********** validation **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JptCorePlugin.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JptCorePlugin.java
index 085b3f6cad..6434655dfd 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JptCorePlugin.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JptCorePlugin.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core;
import javax.xml.parsers.SAXParserFactory;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
@@ -34,12 +33,13 @@ import org.eclipse.jpt.core.internal.GenericJpaPlatformProvider;
import org.eclipse.jpt.core.internal.JpaPlatformRegistry;
import org.eclipse.jpt.core.internal.JptCoreMessages;
import org.eclipse.jpt.core.internal.jpa2.Generic2_0JpaPlatformProvider;
+import org.eclipse.jpt.core.internal.prefs.JpaPreferenceInitializer;
+import org.eclipse.jpt.core.internal.resource.ResourceLocatorManager;
+import org.eclipse.jpt.core.resource.ResourceLocator;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.osgi.framework.BundleContext;
import org.osgi.service.prefs.BackingStoreException;
@@ -56,7 +56,7 @@ import org.osgi.util.tracker.ServiceTracker;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public class JptCorePlugin extends Plugin {
@@ -227,14 +227,9 @@ public class JptCorePlugin extends Plugin {
*/
public static final String WEB_PROJECT_FACET_ID = IModuleConstants.JST_WEB_MODULE;
- /**
- * Web projects have some special exceptions.
- */
- public static final String WEB_PROJECT_DEPLOY_PREFIX = J2EEConstants.WEB_INF_CLASSES;
-
- public static final String DEFAULT_PERSISTENCE_XML_FILE_PATH = "META-INF/persistence.xml"; //$NON-NLS-1$
+ public static final IPath DEFAULT_PERSISTENCE_XML_RUNTIME_PATH = new Path("META-INF/persistence.xml"); //$NON-NLS-1$
- public static final String DEFAULT_ORM_XML_FILE_PATH = "META-INF/orm.xml"; //$NON-NLS-1$
+ public static final IPath DEFAULT_ORM_XML_RUNTIME_PATH = new Path("META-INF/orm.xml"); //$NON-NLS-1$
private static IContentType getJpaContentType(String jpaContentType) {
return getContentType(CONTENT_PREFIX_ + jpaContentType);
@@ -323,67 +318,39 @@ public class JptCorePlugin extends Plugin {
return false;
}
}
-
- /**
- * Return the <code>persistence.xml</code> (specified as <code>"META-INF/persistence.xml"</code>)
- * deployment URI for the specified project.
- */
- public static String getPersistenceXmlDeploymentURI(IProject project) {
- return getDeploymentURI(project, DEFAULT_PERSISTENCE_XML_FILE_PATH);
- }
-
- /**
- * Return the default mapping file (specified as <code>"META-INF/orm.xml"</code>)
- * deployment URI for the specified project.
- */
- public static String getDefaultOrmXmlDeploymentURI(IProject project) {
- return getDeploymentURI(project, DEFAULT_ORM_XML_FILE_PATH);
+
+ public static ResourceLocator getResourceLocator(IProject project) {
+ return ResourceLocatorManager.instance().getResourceLocator(project);
}
-
- /**
- * Return the mapping file (specified as {@code"META-INF/<mappingFileName>"})
- * deployment URI for the specified project.
- */
- public static String getOrmXmlDeploymentURI(IProject project, String mappingFileName) {
- return getDeploymentURI(project, mappingFileName);
+
+ public static IFile getPlatformFile(IProject project, IPath runtimePath) {
+ ResourceLocator resourceLocator = getResourceLocator(project);
+ if (resourceLocator == null) {
+ return null;
+ }
+ IPath sourcePath = resourceLocator.getResourcePath(project, runtimePath);
+ if (sourcePath == null) {
+ return null;
+ }
+ return project.getWorkspace().getRoot().getFile(sourcePath);
}
-
- /**
- * Tweak the specified deployment URI if the specified project
- * has a Web facet.
- */
- public static String getDeploymentURI(IProject project, String defaultURI) {
- return projectHasWebFacet(project) ?
- WEB_PROJECT_DEPLOY_PREFIX + '/' + defaultURI
- :
- defaultURI;
+
+ public static JpaFile getJpaFile(IProject project, IPath runtimePath) {
+ IFile xmlFile = getPlatformFile(project, runtimePath);
+ return xmlFile.exists() ? getJpaFile(xmlFile) : null;
}
-
+
/**
- * Return the deployment path to which JARs are relatively specified for
+ * Return the runtime path to which JARs are relatively specified for
* the given project.
- * (Web projects have a different deployment structure than non-web projects.)
+ * (Web projects have a different runtime structure than non-web projects.)
*/
- public static IPath getJarDeploymentRootPath(IProject project) {
- return new Path(getJarDeploymentRootPathName(project));
+ public static IPath getJarRuntimeRootPath(IProject project) {
+ return projectHasWebFacet(project) ?
+ new Path("/" + J2EEConstants.WEB_INF) //$NON-NLS-1$
+ : new Path("/"); //$NON-NLS-1$
}
-
- private static String getJarDeploymentRootPathName(IProject project) {
- return projectHasWebFacet(project) ? ("/" + J2EEConstants.WEB_INF) : "/"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public static IFile getPlatformFile(IProject project, String defaultURI) {
- IPath deploymentPath = new Path(getDeploymentURI(project, defaultURI));
- IVirtualFile vFile = ComponentCore.createFile(project, deploymentPath);
- return vFile.getUnderlyingFile();
-
- }
-
- public static JpaFile getJpaFile(IProject project, String defaultURI) {
- IFile xmlFile = getPlatformFile(project, defaultURI);
- return xmlFile.exists() ? getJpaFile(xmlFile) : null;
- }
-
+
public static void initializeDefaultPreferences() {
IEclipsePreferences node = getDefaultPreferences();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
index c075e71265..27a5fe20a1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
@@ -24,6 +24,7 @@ import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -53,6 +54,7 @@ import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
+import org.eclipse.jpt.core.resource.ResourceLocator;
import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
@@ -508,15 +510,21 @@ public abstract class AbstractJpaProject
}
return false;
}
-
+
/**
* Add a JPA file for the specified file, if appropriate, without firing
* an event; useful during construction.
* Return the new JPA file, null if it was not created.
*/
protected JpaFile addJpaFile_(IFile file) {
- if ( ! this.getJavaProject().isOnClasspath(file)) {
- return null; // the file must be on the Java classpath
+ if (isJavaFile(file)) {
+ if (! getJavaProject().isOnClasspath(file)) {
+ // a java (.jar or .java) file must be on the Java classpath
+ return null;
+ }
+ }
+ else if (! isInAcceptableResourceLocation(file)) {
+ return null;
}
JpaFile jpaFile = null;
@@ -535,7 +543,21 @@ public abstract class AbstractJpaProject
this.jpaFiles.add(jpaFile);
return jpaFile;
}
-
+
+ /* file is .java or .jar */
+ protected boolean isJavaFile(IFile file) {
+ IContentType contentType = PlatformTools.getContentType(file);
+ return contentType != null
+ && (contentType.isKindOf(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE)
+ || contentType.isKindOf(JptCorePlugin.JAR_CONTENT_TYPE));
+ }
+
+ /* (non-java resource) file is in acceptable resource location */
+ protected boolean isInAcceptableResourceLocation(IFile file) {
+ ResourceLocator resourceLocator = JptCorePlugin.getResourceLocator(getProject());
+ return resourceLocator.acceptResourceLocation(getProject(), file.getParent());
+ }
+
/**
* Remove the JPA file corresponding to the specified IFile, if it exists.
* Return true if a JPA File was removed, false otherwise
@@ -685,8 +707,8 @@ public abstract class AbstractJpaProject
// ********** utility **********
- public IFile convertToPlatformFile(String fileName) {
- return JptCorePlugin.getPlatformFile(this.project, fileName);
+ public IFile getPlatformFile(IPath runtimePath) {
+ return JptCorePlugin.getPlatformFile(this.project, runtimePath);
}
@@ -694,17 +716,16 @@ public abstract class AbstractJpaProject
public JpaXmlResource getPersistenceXmlResource() {
return (JpaXmlResource) this.getResourceModel(
- JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH,
- JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE
- );
+ JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH,
+ JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE);
}
public JpaXmlResource getDefaultOrmXmlResource() {
- return this.getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ return this.getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
}
- public JpaXmlResource getMappingFileXmlResource(String fileName) {
- return (JpaXmlResource) this.getResourceModel(fileName, JptCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ public JpaXmlResource getMappingFileXmlResource(IPath runtimePath) {
+ return (JpaXmlResource) this.getResourceModel(runtimePath, JptCorePlugin.MAPPING_FILE_CONTENT_TYPE);
}
/**
@@ -712,8 +733,8 @@ public abstract class AbstractJpaProject
* content is a "kind of" the specified content type, return the JPA
* resource model corresponding to the file; otherwise, return null.
*/
- protected JpaResourceModel getResourceModel(String fileName, IContentType contentType) {
- IFile file = this.convertToPlatformFile(fileName);
+ protected JpaResourceModel getResourceModel(IPath runtimePath, IContentType contentType) {
+ IFile file = this.getPlatformFile(runtimePath);
return file.exists() ? this.getResourceModel(file, contentType) : null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java
index 40081ca6fc..3bd1933857 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.core.internal;
+import static org.eclipse.jpt.core.internal.XPointUtil.*;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -24,7 +24,6 @@ import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.osgi.util.NLS;
/**
* Singleton registry for storing all the registered JPA platform configuration
@@ -46,6 +45,7 @@ public class JpaPlatformRegistry {
}
private static final String EXTENSION_ID = "jpaPlatforms"; //$NON-NLS-1$
+ private static final String QUALIFIED_EXTENSION_ID = JptCorePlugin.PLUGIN_ID_ + EXTENSION_ID;
private static final String PLATFORM_ELEMENT_NAME = "jpaPlatform"; //$NON-NLS-1$
private static final String ID_ATTRIBUTE_NAME = "id"; //$NON-NLS-1$
private static final String LABEL_ATTRIBUTE_NAME = "label"; //$NON-NLS-1$
@@ -105,10 +105,11 @@ public class JpaPlatformRegistry {
}
String id = configElement.getAttribute(ID_ATTRIBUTE_NAME);
- IConfigurationElement prev = configElements.put(id, configElement);
- if (prev != null) {
- configElements.put(id, prev); // replace previous(?)
- this.logDuplicatePlatform(prev, configElement, id);
+ if (configElements.containsKey(id)) {
+ logDuplicateExtension(QUALIFIED_EXTENSION_ID, id);
+ }
+ else {
+ configElements.put(id, configElement);
}
}
@@ -118,15 +119,15 @@ public class JpaPlatformRegistry {
private boolean configElementIsValid(IConfigurationElement configElement) {
boolean valid = true;
if (configElement.getAttribute(ID_ATTRIBUTE_NAME) == null) {
- this.logMissingAttribute(configElement, ID_ATTRIBUTE_NAME);
+ logMissingAttribute(configElement, ID_ATTRIBUTE_NAME);
valid = false;
}
if (configElement.getAttribute(LABEL_ATTRIBUTE_NAME) == null) {
- this.logMissingAttribute(configElement, LABEL_ATTRIBUTE_NAME);
+ logMissingAttribute(configElement, LABEL_ATTRIBUTE_NAME);
valid = false;
}
if (configElement.getAttribute(FACTORY_CLASS_ATTRIBUTE_NAME) == null) {
- this.logMissingAttribute(configElement, FACTORY_CLASS_ATTRIBUTE_NAME);
+ logMissingAttribute(configElement, FACTORY_CLASS_ATTRIBUTE_NAME);
valid = false;
}
return valid;
@@ -226,51 +227,15 @@ public class JpaPlatformRegistry {
String id = JptCorePlugin.getJpaPlatformId(project);
IConfigurationElement configElement = this.jpaPlatformConfigurationElements.get(id);
if (configElement == null) {
- this.log(JptCoreMessages.PLATFORM_ID_DOES_NOT_EXIST, id, project.getName());
+ log(JptCoreMessages.PLATFORM_ID_DOES_NOT_EXIST, id, project.getName());
return null;
}
- JpaPlatformFactory platformFactory;
- try {
- platformFactory = (JpaPlatformFactory) configElement.createExecutableExtension(FACTORY_CLASS_ATTRIBUTE_NAME);
- } catch (CoreException ex) {
- this.logFailedInstantiation(configElement, ex);
+ JpaPlatformFactory platformFactory = instantiate(
+ configElement.getContributor().getName(), QUALIFIED_EXTENSION_ID,
+ configElement.getAttribute(FACTORY_CLASS_ATTRIBUTE_NAME), JpaPlatformFactory.class);
+ if (platformFactory == null) {
throw new IllegalArgumentException(id);
}
return platformFactory.buildJpaPlatform(id);
}
-
-
- // ********** errors **********
-
- private void logMissingAttribute(IConfigurationElement configElement, String attributeName) {
- this.log(JptCoreMessages.REGISTRY_MISSING_ATTRIBUTE,
- configElement.getName(),
- configElement.getContributor().getName(),
- attributeName
- );
- }
-
- private void logDuplicatePlatform(IConfigurationElement prevConfigElement, IConfigurationElement newConfigElement, String id) {
- this.log(JptCoreMessages.REGISTRY_DUPLICATE,
- prevConfigElement.getContributor().getName(),
- newConfigElement.getContributor().getName(),
- ID_ATTRIBUTE_NAME,
- PLATFORM_ELEMENT_NAME,
- id
- );
- }
-
- private void logFailedInstantiation(IConfigurationElement configElement, CoreException ex) {
- this.log(JptCoreMessages.REGISTRY_FAILED_INSTANTIATION,
- configElement.getAttribute(FACTORY_CLASS_ATTRIBUTE_NAME),
- configElement.getName(),
- configElement.getContributor().getName()
- );
- JptCorePlugin.log(ex);
- }
-
- private void log(String msg, Object... bindings) {
- JptCorePlugin.log(NLS.bind(msg, bindings));
- }
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
index bdd4450c92..abf49e65a2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -18,13 +18,11 @@ public class JptCoreMessages {
public static String NONE;
public static String VALIDATE_JOB;
- public static String VALIDATE_PROJECT_NOT_SPECIFIED;
- public static String VALIDATE_SOURCE_FOLDER_NOT_SPECIFIED;
- public static String VALIDATE_SOURCE_FOLDER_ILLEGAL;
- public static String VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST;
- public static String VALIDATE_SOURCE_FOLDER_NOT_IN_PROJECT;
- public static String VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER;
- public static String VALIDATE_FILE_PATH_NOT_SPECIFIED;
+ public static String VALIDATE_CONTAINER_NOT_SPECIFIED;
+ public static String VALIDATE_PROJECT_NOT_JPA;
+ public static String VALIDATE_PROJECT_IMPROPER_PLATFORM;
+ public static String VALIDATE_CONTAINER_QUESTIONABLE;
+ public static String VALIDATE_FILE_NAME_NOT_SPECIFIED;
public static String VALIDATE_FILE_ALREADY_EXISTS;
public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED;
public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION;
@@ -48,7 +46,10 @@ public class JptCoreMessages {
public static String ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE;
public static String ERROR_WRITING_FILE;
public static String REGISTRY_MISSING_ATTRIBUTE;
+ public static String REGISTRY_INVALID_VALUE;
public static String REGISTRY_DUPLICATE;
+ public static String REGISTRY_FAILED_CLASS_LOAD;
+ public static String REGISTRY_FAILED_INTERFACE_ASSIGNMENT;
public static String REGISTRY_FAILED_INSTANTIATION;
public static String UPDATE_JOB_NAME;
public static String PLATFORM_ID_DOES_NOT_EXIST;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XPointUtil.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XPointUtil.java
new file mode 100644
index 0000000000..10e60ac108
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XPointUtil.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Bundle;
+
+/**
+ * Utilities for extension point management, validation, etc.
+ */
+public class XPointUtil {
+
+ public static String findRequiredAttribute(
+ IConfigurationElement configElement, String attributeName)
+ throws XPointException {
+
+ String val = configElement.getAttribute(attributeName);
+ if (val == null) {
+ logMissingAttribute(configElement, attributeName);
+ throw new XPointException();
+ }
+ return val;
+ }
+
+ public static <T> T instantiate(
+ String pluginId, String extensionPoint, String className, Class<T> interfaze) {
+
+ Class<T> clazz = loadClass(pluginId, extensionPoint, className, interfaze);
+ if (clazz == null) {
+ return null;
+ }
+ else {
+ return instantiate(pluginId, extensionPoint, clazz);
+ }
+ }
+
+ public static <T> T instantiate(String pluginId, String extensionPoint, Class<T> clazz) {
+
+ try {
+ return clazz.newInstance();
+ }
+ catch (Exception e) {
+ logFailedInstantiation(pluginId, extensionPoint, clazz.getName());
+ return null;
+ }
+ }
+
+ public static <T> Class<T> loadClass(
+ String pluginId, String extensionPoint, String className, Class<T> interfaze) {
+
+ Bundle bundle = Platform.getBundle(pluginId);
+ Class<?> clazz;
+
+ try {
+ clazz = bundle.loadClass(className);
+ }
+ catch (Exception e) {
+ logFailedClassLoad(pluginId, extensionPoint, className);
+ return null;
+ }
+
+ if (interfaze != null && ! interfaze.isAssignableFrom(clazz)) {
+ logFailedInterfaceAssignment(pluginId, extensionPoint, className, interfaze.getName());
+ return null;
+ }
+
+ return (Class<T>) clazz;
+ }
+
+ public static void logDuplicateExtension(String extensionPoint, String id) {
+
+ log(JptCoreMessages.REGISTRY_DUPLICATE, extensionPoint, id);
+ }
+
+ public static void logMissingAttribute(
+ IConfigurationElement configElement, String attributeName) {
+
+ log(JptCoreMessages.REGISTRY_MISSING_ATTRIBUTE,
+ attributeName,
+ configElement.getName(),
+ configElement.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
+ configElement.getContributor().getName());
+ }
+
+ public static void logInvalidValue(
+ IConfigurationElement configElement, String nodeName, String invalidValue) {
+
+ log(JptCoreMessages.REGISTRY_INVALID_VALUE,
+ invalidValue,
+ configElement.getName(),
+ configElement.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
+ configElement.getContributor().getName());
+ }
+
+ private static void logFailedClassLoad(String pluginId, String extensionPoint, String className) {
+
+ log(JptCoreMessages.REGISTRY_FAILED_CLASS_LOAD,
+ className,
+ extensionPoint,
+ pluginId);
+ }
+
+ private static void logFailedInterfaceAssignment(
+ String pluginId, String extensionPoint, String className, String interfaceName) {
+
+ log(JptCoreMessages.REGISTRY_FAILED_INTERFACE_ASSIGNMENT,
+ className,
+ extensionPoint,
+ pluginId,
+ interfaceName);
+ }
+
+ private static void logFailedInstantiation(String pluginId, String extensionPoint, String className) {
+
+ log(JptCoreMessages.REGISTRY_FAILED_INSTANTIATION,
+ className,
+ extensionPoint,
+ pluginId);
+ }
+
+ public static void log(String msg, String... bindings) {
+ JptCorePlugin.log(NLS.bind(msg, bindings));
+ }
+
+ public static void log(Exception e) {
+ JptCorePlugin.log(e);
+ }
+
+
+ public static final class XPointException
+ extends Exception {
+
+ private static final long serialVersionUID = 1L;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java
index 6dcf105784..cb74ccdf4b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.internal.context.persistence;
import java.util.List;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
@@ -188,8 +187,8 @@ public abstract class AbstractJarFileRef
}
private JavaResourcePackageFragmentRoot javaPackageRoot_specifically() {
- for (IPath deploymentPath : resolveDeploymentJarFilePath(new Path(this.fileName))) {
- IVirtualFile virtualJar = ComponentCore.createFile(this.getProject(), deploymentPath);
+ for (IPath runtimePath : resolveRuntimeJarFilePath(new Path(this.fileName))) {
+ IVirtualFile virtualJar = ComponentCore.createFile(this.getProject(), runtimePath);
IFile realJar = virtualJar.getUnderlyingFile();
if (realJar.exists() && realJar.getProject().equals(this.getProject())) {
return getJpaProject().getJavaResourcePackageFragmentRoot(realJar.getProjectRelativePath().toString());
@@ -212,25 +211,25 @@ public abstract class AbstractJarFileRef
}
/**
- * Return an array of deployment paths that may correspond
+ * Return an array of runtime paths that may correspond
* to the given persistence.xml jar file entry
*/
- protected IPath[] resolveDeploymentJarFilePath(IPath jarFilePath) {
- IPath root = this.getJarDeploymentRootPath();
+ protected IPath[] resolveRuntimeJarFilePath(IPath jarFilePath) {
+ IPath root = this.getJarRuntimeRootPath();
return this.projectHasWebFacet() ?
- this.resolveDeploymentJarFilePathWeb(root, jarFilePath) :
- this.resolveDeploymentJarFilePathNonWeb(root, jarFilePath);
+ this.resolveRuntimeJarFilePathWeb(root, jarFilePath) :
+ this.resolveRuntimeJarFilePathNonWeb(root, jarFilePath);
}
- protected IPath getJarDeploymentRootPath() {
- return JptCorePlugin.getJarDeploymentRootPath(this.getProject());
+ protected IPath getJarRuntimeRootPath() {
+ return JptCorePlugin.getJarRuntimeRootPath(this.getProject());
}
protected boolean projectHasWebFacet() {
return JptCorePlugin.projectHasWebFacet(this.getProject());
}
- protected IPath[] resolveDeploymentJarFilePathWeb(IPath root, IPath jarFilePath) {
+ protected IPath[] resolveRuntimeJarFilePathWeb(IPath root, IPath jarFilePath) {
return new IPath[] {
// first path entry assumes form "../lib/other.jar"
root.append(jarFilePath.removeFirstSegments(1)),
@@ -239,7 +238,7 @@ public abstract class AbstractJarFileRef
};
}
- protected IPath[] resolveDeploymentJarFilePathNonWeb(IPath root, IPath jarFilePath) {
+ protected IPath[] resolveRuntimeJarFilePathNonWeb(IPath root, IPath jarFilePath) {
return new IPath[] {
// assumes form "../lib/other.jar"
root.append(jarFilePath)
@@ -268,9 +267,7 @@ public abstract class AbstractJarFileRef
IMessage.HIGH_SEVERITY,
JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE,
this,
- this.getValidationTextRange()
- )
- );
+ this.getValidationTextRange()));
return;
}
@@ -279,9 +276,7 @@ public abstract class AbstractJarFileRef
IMessage.NORMAL_SEVERITY,
JpaValidationMessages.PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING,
this,
- this.getValidationTextRange()
- )
- );
+ this.getValidationTextRange()));
if (this.jarFile == null) {
messages.add(
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java
index f2f7fb1598..220d06c401 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.core.internal.context.persistence;
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.core.JpaResourceType;
import org.eclipse.jpt.core.JpaStructureNode;
@@ -180,7 +181,7 @@ public abstract class AbstractMappingFileRef
if (this.fileName == null) {
return null;
}
- JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(this.fileName);
+ JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
if (xmlResource == null) {
return null;
}
@@ -256,7 +257,7 @@ public abstract class AbstractMappingFileRef
int severity = IMessage.HIGH_SEVERITY;
IFile file = getPlatformFile();
if (file.exists()) {
- JpaXmlResource xmlResource = getJpaProject().getMappingFileXmlResource(this.fileName);
+ JpaXmlResource xmlResource = getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
if (xmlResource != null
&& ! getJpaPlatform().supportsResourceType(xmlResource.getResourceType())) {
return DefaultJpaValidationMessages.buildMessage(
@@ -280,7 +281,7 @@ public abstract class AbstractMappingFileRef
}
protected IFile getPlatformFile() {
- return this.getJpaProject().convertToPlatformFile(this.fileName);
+ return this.getJpaProject().getPlatformFile(new Path(this.fileName));
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
index 701d717c28..60549c85ce 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -507,7 +507,7 @@ public abstract class AbstractPersistenceUnit
}
protected boolean impliedMappingFileIsSpecified() {
- String impliedMappingFileName = JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH;
+ String impliedMappingFileName = JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString();
for (Iterator<MappingFileRef> stream = this.specifiedMappingFileRefs(); stream.hasNext(); ) {
if (impliedMappingFileName.equals(stream.next().getFileName())) {
return true;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
index 271ee5dd6b..ba9c5c2b75 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -50,7 +50,7 @@ public abstract class AbstractPersistenceXmlContextNodeFactory implements Persis
}
public MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent) {
- return new ImpliedMappingFileRef(parent, JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH );
+ return new ImpliedMappingFileRef(parent, JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
}
public ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) {
@@ -72,5 +72,4 @@ public abstract class AbstractPersistenceXmlContextNodeFactory implements Persis
public PersistenceUnit.Property buildProperty(PersistenceUnit parent, XmlProperty xmlProperty) {
return new GenericPersistenceUnitProperty(parent, xmlProperty);
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
index 243b06fb49..e8b478186e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
@@ -9,9 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.facet;
+import static org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties.CONTAINER_PATH;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jdt.core.IClasspathContainer;
@@ -19,9 +21,9 @@ import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProvider;
+import org.eclipse.jpt.core.resource.ResourceLocator;
import org.eclipse.jpt.db.JptDbPlugin;
import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
@@ -104,7 +106,7 @@ public class JpaFacetInstallDelegate
SubMonitor sm = SubMonitor.convert(monitor, 5);
IDataModel config = DataModelFactory.createDataModel(new PersistenceFileCreationDataModelProvider());
- config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, project.getName());
+ config.setProperty(CONTAINER_PATH, defaultResourceLocation(project));
sm.worked(1);
// default values for all other properties should suffice
try {
@@ -116,9 +118,9 @@ public class JpaFacetInstallDelegate
private void createOrmXml(IProject project, IProgressMonitor monitor) {
SubMonitor sm = SubMonitor.convert(monitor, 5);
-
+
IDataModel config = DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, project.getName());
+ config.setProperty(CONTAINER_PATH, defaultResourceLocation(project));
sm.worked(1);
// default values for all other properties should suffice
try {
@@ -127,4 +129,13 @@ public class JpaFacetInstallDelegate
JptCorePlugin.log(ex);
}
}
+
+ protected IPath defaultResourceLocation(IProject project) {
+ ResourceLocator resourceLocator = JptCorePlugin.getResourceLocator(project);
+ if (resourceLocator == null) {
+ JptCorePlugin.log("No resource locator for project");
+ return null;
+ }
+ return resourceLocator.getDefaultResourceLocation(project).getFullPath();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
index 1625ac7ff4..2395985b53 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
@@ -225,7 +225,7 @@ public class GenericRootContextNode
}
protected IFile getPlatformFile() {
- return this.jpaProject.convertToPlatformFile(JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH);
+ return this.jpaProject.getPlatformFile(JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
}
protected void validateOrphanClasses(List<IMessage> messages) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
index 3600851036..16804acd37 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
@@ -9,33 +9,21 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.operations;
-import java.util.Iterator;
import java.util.Set;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.core.resource.ResourceLocator;
import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -53,23 +41,23 @@ public abstract class AbstractJpaFileCreationDataModelProvider
public Set<String> getPropertyNames() {
@SuppressWarnings("unchecked")
Set<String> propertyNames = super.getPropertyNames();
- propertyNames.add(PROJECT_NAME);
- propertyNames.add(SOURCE_FOLDER);
- propertyNames.add(FILE_PATH);
+ propertyNames.add(PROJECT);
+ propertyNames.add(CONTAINER_PATH);
+ propertyNames.add(FILE_NAME);
propertyNames.add(VERSION);
return propertyNames;
}
@Override
public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(SOURCE_FOLDER)) {
- IFolder sourceFolder = getDefaultSourceFolder();
- if (sourceFolder != null && sourceFolder.exists()) {
- return sourceFolder.getFullPath().toPortableString();
+ if (propertyName.equals(CONTAINER_PATH)) {
+ IContainer sourceLocation = getDefaultContainer();
+ if (sourceLocation != null && sourceLocation.exists()) {
+ return sourceLocation.getFullPath();
}
}
- else if (propertyName.equals(FILE_PATH)) {
- return getDefaultFilePath();
+ else if (propertyName.equals(FILE_NAME)) {
+ return getDefaultFileName();
}
else if (propertyName.equals(VERSION)) {
return getDefaultVersion();
@@ -77,58 +65,25 @@ public abstract class AbstractJpaFileCreationDataModelProvider
return super.getDefaultProperty(propertyName);
}
- protected abstract String getDefaultFilePath();
+ protected abstract String getDefaultFileName();
protected abstract String getDefaultVersion();
- @Override
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean ok = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(PROJECT_NAME)) {
- this.model.notifyPropertyChange(SOURCE_FOLDER, IDataModel.DEFAULT_CHG);
- }
- return ok;
- }
-
- @Override
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(PROJECT_NAME)) {
- return ArrayTools.array(
- new TransformationIterator<IProject, DataModelPropertyDescriptor>(jpaIProjects()) {
- @Override
- protected DataModelPropertyDescriptor transform(IProject next) {
- return new DataModelPropertyDescriptor(next.getName());
- }
- },
- new DataModelPropertyDescriptor[0]);
- }
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- @Override
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(PROJECT_NAME)) {
- return new DataModelPropertyDescriptor(getStringProperty(PROJECT_NAME));
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
// **************** validation *********************************************
@Override
public IStatus validate(String propertyName) {
IStatus status = Status.OK_STATUS;
- if (propertyName.equals(PROJECT_NAME)
- || propertyName.equals(SOURCE_FOLDER)
- || propertyName.equals(FILE_PATH)) {
- status = validateProjectSourceFolderAndFilePath();
+ if (propertyName.equals(CONTAINER_PATH)
+ || propertyName.equals(FILE_NAME)) {
+ status = validateContainerPathAndFileName();
}
if (! status.isOK()) {
return status;
}
- if (propertyName.equals(PROJECT_NAME)
+ if (propertyName.equals(CONTAINER_PATH)
|| propertyName.equals(VERSION)) {
status = validateVersion();
}
@@ -139,48 +94,46 @@ public abstract class AbstractJpaFileCreationDataModelProvider
return status;
}
- protected IStatus validateProjectSourceFolderAndFilePath() {
- String projectName = (String) getProperty(PROJECT_NAME);
- if (StringTools.stringIsEmpty(projectName)) {
+ protected IStatus validateContainerPathAndFileName() {
+ IContainer container = getContainer();
+ if (container == null) {
+ // verifies container has been specified, but should be unnecessary in most cases.
+ // there is almost always a default, and the new file wizard does this validation as well.
return new Status(
IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_PROJECT_NOT_SPECIFIED);
- }
- String sourceFolderPath = getStringProperty(SOURCE_FOLDER);
- if (StringTools.stringIsEmpty(sourceFolderPath)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_SOURCE_FOLDER_NOT_SPECIFIED);
+ JptCoreMessages.VALIDATE_CONTAINER_NOT_SPECIFIED);
}
- if (sourceFolderIsIllegal(sourceFolderPath)) {
+ IProject project = getProject(container);
+ if (! hasJpaFacet(project)) {
+ // verifies project has jpa facet
return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_SOURCE_FOLDER_ILLEGAL);
- }
- if (sourceFolderNotInProject(sourceFolderPath)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(
- JptCoreMessages.VALIDATE_SOURCE_FOLDER_NOT_IN_PROJECT,
- sourceFolderPath, projectName));
+ IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
+ JptCoreMessages.VALIDATE_PROJECT_NOT_JPA);
}
- if (getVerifiedSourceFolder() == null) {
+ if (! hasSupportedPlatform(project)) {
+ // verifies project has platform that supports this file type
return new Status(
IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_SOURCE_FOLDER_DOES_NOT_EXIST, sourceFolderPath));
+ JptCoreMessages.VALIDATE_PROJECT_IMPROPER_PLATFORM);
}
- if (getVerifiedJavaSourceFolder() == null) {
+ ResourceLocator resourceLocator = JptCorePlugin.getResourceLocator(project);
+ if (resourceLocator != null /* should never be null, but there might be crazy circumstances */
+ && ! resourceLocator.acceptResourceLocation(project, container)) {
return new Status(
- IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_SOURCE_FOLDER_NOT_SOURCE_FOLDER, sourceFolderPath));
+ IStatus.WARNING, JptCorePlugin.PLUGIN_ID,
+ JptCoreMessages.VALIDATE_CONTAINER_QUESTIONABLE);
}
- String filePath = getStringProperty(FILE_PATH);
- if (StringTools.stringIsEmpty(filePath)) {
+ String fileName = getStringProperty(FILE_NAME);
+ if (StringTools.stringIsEmpty(fileName)) {
+ // verifies file name has been specified, but should be unnecessary in most cases.
+ // there is almost always a default, and the new file wizard does this validation as well.
return new Status(
IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_PATH_NOT_SPECIFIED);
+ JptCoreMessages.VALIDATE_FILE_NAME_NOT_SPECIFIED);
}
- if (getExistingFile() != null) {
+ if (container.getFile(new Path(fileName)).exists()) {
+ // verifies file does not exist, but should be unnecessary in most cases.
+ // the new file wizard does this validation as well.
return new Status(
IStatus.ERROR, JptCorePlugin.PLUGIN_ID,
JptCoreMessages.VALIDATE_FILE_ALREADY_EXISTS);
@@ -220,168 +173,61 @@ public abstract class AbstractJpaFileCreationDataModelProvider
// **************** helper methods *****************************************
- // Copied from ArtifactEditOperationDataModelProvider
- protected IProject getProject() {
- String projectName = (String) model.getProperty(PROJECT_NAME);
- if (StringTools.stringIsEmpty(projectName)) {
- return null;
- }
- return ProjectUtilities.getProject(projectName);
+ protected IPath getContainerPath() {
+ return (IPath) this.model.getProperty(CONTAINER_PATH);
}
- protected JpaProject getJpaProject() {
- IProject project = getProject();
- return (project == null) ? null : JptCorePlugin.getJpaProject(project);
+ protected IContainer getContainer() {
+ IPath containerPath = getContainerPath();
+ if (containerPath == null) {
+ return null;
+ }
+ return PlatformTools.getContainer(containerPath);
}
- /**
- * Return a best guess java source folder for the specified project
- */
- // Copied from NewJavaClassDataModelProvider
- protected IFolder getDefaultSourceFolder() {
- IProject project = getProject();
- if (project == null) {
- return null;
- }
- IPackageFragmentRoot[] sources = J2EEProjectUtilities.getSourceContainers(project);
- // Try and return the first source folder
- if (sources.length > 0) {
- try {
- return (IFolder) sources[0].getCorrespondingResource();
- } catch (Exception e) {
- return null;
- }
- }
- return null;
+ protected IProject getProject() {
+ return getProject(getContainer());
}
- /**
- * Return whether the path provided can not be a valid IFolder path
- */
- protected boolean sourceFolderIsIllegal(String folderPath) {
- IProject project = getProject();
- if (project == null) {
- return false;
- }
- try {
- project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- }
- catch (IllegalArgumentException e) {
- return true;
- }
- return false;
+ protected IProject getProject(IContainer container) {
+ return (container == null) ? null : container.getProject();
}
- /**
- * Return whether the path provided is in the current project
- */
- protected boolean sourceFolderNotInProject(String folderPath) {
- IProject project = getProject();
- if (project == null) {
- return false;
- }
- IFolder folder;
- try {
- folder = project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- }
- catch (IllegalArgumentException e) {
- return false;
- }
- return ! project.equals(folder.getProject());
+ protected JpaProject getJpaProject() {
+ return getJpaProject(getProject());
}
- /**
- * Return an IFolder represented by the SOURCE_FOLDER property, verified
- * to exist
- */
- protected IFolder getVerifiedSourceFolder() {
- String folderPath = getStringProperty(SOURCE_FOLDER);
- IProject project = getProject();
- if (project == null) {
- return null;
- }
- IFolder folder;
- try {
- folder = project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- }
- catch (IllegalArgumentException e) {
- return null;
- }
- if (folder == null || ! folder.exists()) {
- return null;
- }
- return folder;
+ protected JpaProject getJpaProject(IProject project) {
+ return (project == null) ? null : JptCorePlugin.getJpaProject(project);
}
/**
- * Return the source folder, provided it is verified to be an actual java
- * source folder
+ * Return a best guess source location for the for the specified project
*/
- protected IFolder getVerifiedJavaSourceFolder() {
- IFolder folder = getVerifiedSourceFolder();
- if (folder == null) {
- return null;
+ protected IContainer getDefaultContainer() {
+ IProject project = (IProject) this.model.getProperty(PROJECT);
+ if (project != null) {
+ return JptCorePlugin.getResourceLocator(project).getDefaultResourceLocation(project);
}
- IJavaProject jProject = JavaCore.create(getProject());
- if (jProject == null) {
- return null;
- }
- IPackageFragmentRoot packageFragmentRoot = jProject.getPackageFragmentRoot(folder);
- if (packageFragmentRoot == null || ! packageFragmentRoot.exists()) {
- return null;
- }
- return folder;
- }
-
- protected IFile getExistingFile() {
- IFolder folder = getVerifiedSourceFolder();
- if (folder == null) {
- return null;
- }
- String filePath = getStringProperty(FILE_PATH);
- IFile existingFile = folder.getFile(new Path(filePath));
- if (! existingFile.exists()) {
- return null;
- }
- return existingFile;
+ return null;
}
- protected Iterator<IProject> jpaIProjects() {
- return new FilteringIterator<IProject>(this.allIProjects(), this.buildJpaIProjectsFilter());
- }
-
- protected Iterator<IProject> allIProjects() {
- return CollectionTools.iterator(ProjectUtilities.getAllProjects());
- }
-
- protected Filter<IProject> buildJpaIProjectsFilter() {
- return new JpaIProjectsFilter();
- }
-
- protected class JpaIProjectsFilter implements Filter<IProject> {
- public boolean accept(IProject project) {
- try {
- return this.accept_(project);
- } catch (CoreException ex) {
- return false;
- }
+ protected boolean hasJpaFacet(IProject project) {
+ try {
+ return FacetedProjectFramework.hasProjectFacet(project, JptCorePlugin.FACET_ID);
}
- protected boolean accept_(IProject project) throws CoreException {
- return hasJpaFacet(project) && hasSupportedPlatformId(project);
+ catch (CoreException ce) {
+ return false;
}
}
- protected boolean hasJpaFacet(IProject project) throws CoreException {
- return FacetedProjectFramework.hasProjectFacet(project, JptCorePlugin.FACET_ID);
- }
-
protected String getJpaFacetVersion(IProject project) throws CoreException {
IFacetedProject fproj = ProjectFacetsManager.create(project);
return fproj.getProjectFacetVersion(
ProjectFacetsManager.getProjectFacet(JptCorePlugin.FACET_ID)).getVersionString();
}
- protected boolean hasSupportedPlatformId(IProject project) {
+ protected boolean hasSupportedPlatform(IProject project) {
JpaProject jpaProject = JptCorePlugin.getJpaProject(project);
return (jpaProject != null) && isSupportedPlatformId(jpaProject.getJpaPlatform().getId());
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java
index 96b0246be3..c1b526e43c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java
@@ -9,37 +9,40 @@
*******************************************************************************/
package org.eclipse.jpt.core.internal.operations;
+
+import static org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties.*;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.core.internal.utility.PlatformTools;
import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public abstract class AbstractJpaFileCreationOperation
extends AbstractDataModelOperation
- implements JpaFileCreationDataModelProperties
{
/**
- * Will be null until folder is created
+ * Will be null until container is created or verified to exist
*/
- protected IFolder createdSourceFolder;
+ protected IContainer container;
/**
- * Will be null until file is created
+ * Will be null until file is created or verified to exist
*/
- protected IFile createdFile;
+ protected IFile file;
protected AbstractJpaFileCreationOperation(IDataModel dataModel) {
@@ -50,67 +53,70 @@ public abstract class AbstractJpaFileCreationOperation
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
SubMonitor sm = SubMonitor.convert(monitor, 5);
- // Create source folder if it does not exist
- createSourceFolder(sm.newChild(1));
+ // Create folder if it does not exist
+ createContainer(sm.newChild(1));
// Create file
createFile(sm.newChild(4));
return OK_STATUS;
}
- protected IProject getProject() throws ExecutionException {
- String projectName = (String) getDataModel().getProperty(PROJECT_NAME);
- IProject project = ProjectUtilities.getProject(projectName);
- if (project == null) {
- throw new ExecutionException("No project name specified"); //$NON-NLS-1$
+ protected IContainer getContainer() throws ExecutionException {
+ IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH);
+ IContainer container = PlatformTools.getContainer(containerPath);
+ if (container == null) {
+ throw new ExecutionException("No container path specified"); //$NON-NLS-1$
}
- return project;
+ return container;
+ }
+
+ protected IProject getProject() throws ExecutionException {
+ return getContainer().getProject();
}
protected JpaProject getJpaProject() throws ExecutionException {
IProject project = getProject();
JpaProject jpaProject = JptCorePlugin.getJpaProject(project);
if (jpaProject == null) {
- throw new ExecutionException("Project does not have JPA content"); //$NON-NLS-1$
+ throw new ExecutionException("Project does not have JPA facet"); //$NON-NLS-1$
}
return jpaProject;
}
/**
- * This method will return the source folder as specified in the data model.
- * It will create the source folder if it does not exist. It will not add
- * it as a source folder to the project build path if it is not already.
- * This method may return null.
+ * This method will create the container as specified in the data model if it does not exist.
*/
- // copied from NewJavaClassOperation
- protected void createSourceFolder(IProgressMonitor monitor) throws ExecutionException {
- // Get the source folder name from the data model
- String folderPath = this.model.getStringProperty(SOURCE_FOLDER);
- IProject project = getProject();
- IFolder folder = project.getWorkspace().getRoot().getFolder(new Path(folderPath));
- // If folder does not exist, create the folder with the specified path
- if (! folder.exists()) {
- try {
- folder.create(true, true, monitor);
- } catch (CoreException e) {
- throw new ExecutionException("Could not create folder", e); //$NON-NLS-1$
+ protected void createContainer(IProgressMonitor monitor) throws ExecutionException {
+ IContainer container = getContainer();
+ if (! container.exists()) {
+ if (container.getType() == IContainer.PROJECT) {
+ throw new ExecutionException("Project does not exist");
+ }
+ else if (container.getType() == IContainer.FOLDER) {
+ try {
+ ((IFolder) container).create(true, true, null);
+ }
+ catch (CoreException e) {
+ throw new ExecutionException("Could not create folder", e); //$NON-NLS-1$
+ }
+ }
+ else {
+ throw new ExecutionException("Container is not a project or folder"); //$NON-NLS-1$
}
}
- // Return the source folder
- this.createdSourceFolder = folder;
+ this.container = container;
}
- protected void createFile(IProgressMonitor monitor) {
- String filePath = getDataModel().getStringProperty(FILE_PATH);
- IFile newFile = this.createdSourceFolder.getFile(new Path(filePath));
+ protected void createFile(IProgressMonitor monitor) throws ExecutionException {
+ String fileName = getDataModel().getStringProperty(FILE_NAME);
+ IFile newFile = this.container.getFile(new Path(fileName));
AbstractXmlResourceProvider resourceProvider = getXmlResourceProvider(newFile);
try {
resourceProvider.createFileAndResource(getDataModel(), monitor);
}
catch (CoreException e) {
- JptCorePlugin.log(e);
- newFile = null;
+ throw new ExecutionException("Could not create file", e);
}
- this.createdFile = newFile;
+ this.file = newFile;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java
index 62b1e36c80..21fc45432f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -10,25 +10,29 @@
*******************************************************************************/
package org.eclipse.jpt.core.internal.operations;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
public interface JpaFileCreationDataModelProperties
{
/**
- * Required, type String, identifies the name of the project in which to create the file
+ * Optional, type {@link IProject}, gives a clue as to the default container path
*/
- public static final String PROJECT_NAME = "JpaFileCreationDataModelProperties.PROJECT_NAME";
+ public static final String PROJECT = "JpaFileCreationDataModelProperties.PROJECT";
/**
- * Required, type String, identifies the fully pathed source folder in which to create the file
+ * Required, type {@link IPath}, identifies the full path to the container in which
+ * the file should be created
*/
- public static final String SOURCE_FOLDER = "JpaFileCreationDataModelProperties.SOURCE_FOLDER";
+ public static final String CONTAINER_PATH = "JpaFileCreationDataModelProperties.CONTAINER_PATH";
/**
- * Required, type String, identifies the file path relative to the source folder
+ * Required, type {@link String}, identifies the file name
*/
- public static final String FILE_PATH = "JpaFileCreationDataModelProperties.FILE_PATH";
+ public static final String FILE_NAME = "JpaFileCreationDataModelProperties.FILE_NAME";
/**
- * Required, type String, identifies the version of the file to create
+ * Required, type {@link String}, identifies the version of the file to create
*/
public static final String VERSION = "JpaFileCreationDataModelProperties.VERSION";
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java
index 86d5cdb701..6789d3b89d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
+ * Copyright (c) 2008, 2010 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -13,7 +13,6 @@ package org.eclipse.jpt.core.internal.operations;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
@@ -87,8 +86,8 @@ public class OrmFileCreationDataModelProvider
}
@Override
- protected String getDefaultFilePath() {
- return new Path(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH).toPortableString();
+ protected String getDefaultFileName() {
+ return JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment();
}
@Override
@@ -122,7 +121,7 @@ public class OrmFileCreationDataModelProvider
@Override
public boolean propertySet(String propertyName, Object propertyValue) {
boolean ok = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(PROJECT_NAME)) {
+ if (propertyName.equals(CONTAINER_PATH)) {
this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.DEFAULT_CHG);
this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.VALID_VALUES_CHG);
}
@@ -156,6 +155,9 @@ public class OrmFileCreationDataModelProvider
@Override
public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
+ if (propertyName.equals(DEFAULT_ACCESS)) {
+ return accessPropertyDescriptor((AccessType) getProperty(DEFAULT_ACCESS));
+ }
if (propertyName.equals(PERSISTENCE_UNIT)) {
return persistenceUnitPropertyDescriptor(getStringProperty(PERSISTENCE_UNIT));
}
@@ -214,7 +216,7 @@ public class OrmFileCreationDataModelProvider
protected IStatus validatePersistenceUnit() {
boolean addToPUnit = getBooleanProperty(ADD_TO_PERSISTENCE_UNIT);
- String projectName = getStringProperty(PROJECT_NAME);
+ String projectName = getProject().getName();
String pUnitName = getStringProperty(PERSISTENCE_UNIT);
if (addToPUnit) {
if (StringTools.stringIsEmpty(pUnitName)) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java
index c019dbc7e8..ecbb4e5bb4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java
@@ -74,14 +74,15 @@ public class OrmFileCreationOperation
if (! getDataModel().getBooleanProperty(ADD_TO_PERSISTENCE_UNIT)) {
return;
}
- JpaProject jpaProject = JptCorePlugin.getJpaProject(this.createdFile.getProject());
+ JpaProject jpaProject = JptCorePlugin.getJpaProject(this.file.getProject());
JpaXmlResource resource = jpaProject.getPersistenceXmlResource();
final PersistenceUnit pUnit = getPersistenceUnit();
resource.modify(new Runnable() {
public void run() {
- String filePath = getDataModel().getStringProperty(FILE_PATH);
+ String fileName = getDataModel().getStringProperty(FILE_NAME);
+ String filePath = "META-INF/" + fileName;
for (Iterator<MappingFileRef> stream = pUnit.specifiedMappingFileRefs(); stream.hasNext(); ) {
if (filePath.equals(stream.next().getFileName())) {
return;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java
index 9ff6f9c366..7daa2f0c38 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
+ * Copyright (c) 2009, 2010 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jpt.core.internal.operations;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.resource.persistence.JPA;
import org.eclipse.jpt.core.resource.persistence.v2_0.JPA2_0;
@@ -34,8 +33,8 @@ public class PersistenceFileCreationDataModelProvider
}
@Override
- protected String getDefaultFilePath() {
- return new Path(JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH).toPortableString();
+ protected String getDefaultFileName() {
+ return JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH.lastSegment();
}
@Override
@@ -64,5 +63,4 @@ public class PersistenceFileCreationDataModelProvider
}
return true;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
index e2e76b35ab..1eca9a11a7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
@@ -192,7 +192,7 @@ public abstract class AbstractJpaDeleteTypeParticipant
}
Iterable<DeleteEdit> mappingFileDeleteEdits = this.createMappingFileDeleteTypeEdits(mappingFileRef);
if (!CollectionTools.isEmpty(mappingFileDeleteEdits)) {
- this.mappingFilePersistentTypeDeleteEdits.put(jpaProject.getMappingFileXmlResource(mappingFileRef.getFileName()).getFile(), mappingFileDeleteEdits);
+ this.mappingFilePersistentTypeDeleteEdits.put((IFile) mappingFileRef.getMappingFile().getResource(), mappingFileDeleteEdits);
}
sm.worked(1);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ModuleResourceLocator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ModuleResourceLocator.java
new file mode 100644
index 0000000000..fbf511e08f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ModuleResourceLocator.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.resource;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+public class ModuleResourceLocator
+ extends SimpleJavaResourceLocator {
+
+ /**
+ * Return the folder representing the "META-INF" runtime location
+ */
+ @Override
+ public IContainer getDefaultResourceLocation(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ return component.getRootFolder().getFolder(META_INF_PATH).getUnderlyingFolder();
+ }
+
+ /**
+ * Return the full resource path representing the given runtime location
+ */
+ @Override
+ public IPath getResourcePath(IProject project, IPath runtimePath) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ return component.getRootFolder().getFile(runtimePath).getWorkspaceRelativePath();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/PluginResourceLocator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/PluginResourceLocator.java
new file mode 100644
index 0000000000..04a84ef7ec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/PluginResourceLocator.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.resource;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.pde.core.project.IBundleProjectService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class PluginResourceLocator
+ extends SimpleJavaResourceLocator {
+
+ @Override
+ public IContainer getDefaultResourceLocation(IProject project) {
+ try {
+ IContainer root = getBundleRoot(project);
+ return root.getFolder(META_INF_PATH);
+ }
+ catch (CoreException ce) {
+ // fall through
+ JptCorePlugin.log(ce);
+ }
+ return super.getDefaultResourceLocation(project);
+ }
+
+ @Override
+ public IPath getResourcePath(IProject project, IPath runtimePath) {
+ try {
+ IContainer root = getBundleRoot(project);
+ IPath resourcePath = root.getFullPath().append(runtimePath);
+ if (project.getWorkspace().getRoot().getFile(resourcePath).exists()) {
+ return resourcePath;
+ }
+ }
+ catch (CoreException ce) {
+ // fall through
+ JptCorePlugin.log(ce);
+ }
+ return super.getResourcePath(project, runtimePath);
+ }
+
+ protected IContainer getBundleRoot(IProject project)
+ throws CoreException {
+
+ IBundleProjectService service = getBundleProjectService();
+ IBundleProjectDescription description = service.getDescription(project);
+ IPath path = description.getBundleRoot();
+ return (path == null) ? project : project.getFolder(path);
+ }
+
+ protected IBundleProjectService getBundleProjectService() {
+ BundleContext context = JptCorePlugin.instance().getBundle().getBundleContext();
+ ServiceReference reference = context.getServiceReference(IBundleProjectService.class.getName());
+ if (reference == null) {
+ return null;
+ }
+ IBundleProjectService service = (IBundleProjectService) context.getService(reference);
+ if (service != null) {
+ context.ungetService(reference);
+ }
+ return service;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java
new file mode 100644
index 0000000000..2f0b166e7c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.resource;
+
+import static org.eclipse.jst.common.project.facet.core.internal.FacetedProjectFrameworkJavaPlugin.log;
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.core.internal.XPointUtil;
+import org.eclipse.jpt.core.resource.ResourceLocator;
+import org.eclipse.jpt.utility.internal.StringTools;
+
+public class ResourceLocatorConfig
+ implements Comparable<ResourceLocatorConfig> {
+
+ public static final String PROJECT_ENABLEMENT_VARIABLE = "project"; //$NON-NLS-1$
+
+ private String id;
+ private String pluginId;
+ private String className;
+ private Priority priority;
+ private Expression enablementCondition;
+
+
+ ResourceLocatorConfig() {
+ super();
+ }
+
+
+ public String getId() {
+ return this.id;
+ }
+
+ void setId(String id) {
+ this.id = id;
+ }
+
+ public String getPluginId() {
+ return this.pluginId;
+ }
+
+ void setPluginId(String pluginId) {
+ this.pluginId = pluginId;
+ }
+
+ public String getClassName() {
+ return this.className;
+ }
+
+ void setClassName(String className) {
+ this.className = className;
+ }
+
+ public Priority getPriority() {
+ return priority;
+ }
+
+ void setPriority(Priority priority) {
+ this.priority = priority;
+ }
+
+ public Expression getEnablementCondition() {
+ return this.enablementCondition;
+ }
+
+ void setEnablementCondition(Expression enablementCondition) {
+ this.enablementCondition = enablementCondition;
+ }
+
+ public ResourceLocator getResourceLocator() {
+ return XPointUtil.instantiate(
+ JptCorePlugin.PLUGIN_ID, ResourceLocatorManager.QUALIFIED_EXTENSION_POINT_ID,
+ this.className, ResourceLocator.class);
+ }
+
+ public boolean isEnabledFor(IProject project) {
+ EvaluationContext evalContext = new EvaluationContext(null, project);
+ evalContext.setAllowPluginActivation(true);
+ evalContext.addVariable(PROJECT_ENABLEMENT_VARIABLE, project);
+
+ if (this.enablementCondition != null) {
+ try {
+ EvaluationResult evalResult = this.enablementCondition.evaluate(evalContext);
+
+ if (evalResult == EvaluationResult.FALSE) {
+ return false;
+ }
+ }
+ catch (CoreException e) {
+ log(e);
+ }
+ }
+
+ return true;
+ }
+
+ public int compareTo(ResourceLocatorConfig other) {
+ return Priority.compare(this.priority, other.priority);
+ }
+
+
+ public static enum Priority {
+
+ /* The lowest priority for a resource locator */
+ LOWEST(4, "lowest"),
+
+ /* The second lowest priority for a resource locator */
+ LOW(3, "low"),
+
+ /* The default priority for a resource locator */
+ NORMAL(2, "normal"),
+
+ /* The second highest priority for a resource locator */
+ HIGH(1, "high"),
+
+ /* The highest priority for a resource locator */
+ HIGHEST(0, "highest");
+
+
+ public static int compare(Priority priority1, Priority priority2) {
+ return priority1.value.compareTo(priority2.value);
+ }
+
+ public static Priority get(String literal) {
+ if (literal == null) {
+ return NORMAL;
+ }
+ for (Priority priority : values()) {
+ if (StringTools.stringsAreEqual(literal, priority.literal)) {
+ return priority;
+ }
+ }
+ return null;
+ }
+
+
+ private Integer value;
+ private String literal;
+
+
+ private Priority(int value, String literal) {
+ this.value = Integer.valueOf(value);
+ this.literal = literal;
+ }
+
+
+ @Override
+ public String toString() {
+ return this.literal;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorManager.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorManager.java
new file mode 100644
index 0000000000..82d3d4f2d2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorManager.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.resource;
+
+import static org.eclipse.jpt.core.internal.XPointUtil.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.ExpressionConverter;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.core.internal.XPointUtil.XPointException;
+import org.eclipse.jpt.core.internal.resource.ResourceLocatorConfig.Priority;
+import org.eclipse.jpt.core.resource.ResourceLocator;
+import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
+
+public class ResourceLocatorManager {
+
+ public static final String EXTENSION_POINT_ID = "resourceLocators";
+ public static final String QUALIFIED_EXTENSION_POINT_ID = JptCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
+ public static final String RESOURCE_LOCATOR_ELEMENT = "resourceLocator";
+ public static final String ID_ATTRIBUTE = "id";
+ public static final String CLASS_ATTRIBUTE = "class";
+ public static final String PRIORITY_ATTRIBUTE = "priority";
+ public static final String ENABLEMENT_ELEMENT = "enablement";
+
+
+ private static ResourceLocatorManager INSTANCE;
+
+
+ public static ResourceLocatorManager instance() {
+ if (INSTANCE == null) {
+ INSTANCE = new ResourceLocatorManager();
+ }
+ return INSTANCE;
+ }
+
+
+ private Set<ResourceLocatorConfig> resourceLocatorConfigs;
+ private Map<String, ResourceLocatorConfig> resourceLocatorLookupTable;
+
+
+ private ResourceLocatorManager() {
+ this.resourceLocatorConfigs = new HashSet<ResourceLocatorConfig>();
+ this.resourceLocatorLookupTable = new HashMap<String, ResourceLocatorConfig>();
+ readExtensions();
+ }
+
+
+ /**
+ * Return the {@link ResourceLocator} of highest priority that is acceptable
+ * for the given project
+ */
+ public ResourceLocator getResourceLocator(final IProject project) {
+ return new FilteringIterable<ResourceLocator>(
+ new TransformationIterable<ResourceLocatorConfig, ResourceLocator>(
+ new FilteringIterable<ResourceLocatorConfig>(
+ new TreeSet<ResourceLocatorConfig>(this.resourceLocatorConfigs)) {
+ @Override
+ protected boolean accept(ResourceLocatorConfig o) {
+ return o.isEnabledFor(project);
+ }
+ }) {
+ @Override
+ protected ResourceLocator transform(ResourceLocatorConfig o) {
+ return o.getResourceLocator();
+ }
+ }) {
+ @Override
+ protected boolean accept(ResourceLocator o) {
+ return o != null;
+ }
+ }.iterator().next();
+ }
+
+ private void readExtensions() {
+ final IExtensionRegistry registry = Platform.getExtensionRegistry();
+
+ final IExtensionPoint xpoint
+ = registry.getExtensionPoint(JptCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID);
+
+ if (xpoint == null) {
+ throw new IllegalStateException();
+ }
+
+ final List<IConfigurationElement> configs = new ArrayList<IConfigurationElement>();
+
+ for (IExtension extension : xpoint.getExtensions()) {
+ for (IConfigurationElement element : extension.getConfigurationElements()) {
+ configs.add(element);
+ }
+ }
+
+ for (IConfigurationElement element : configs) {
+ if (element.getName().equals(RESOURCE_LOCATOR_ELEMENT)) {
+ readExtension(element);
+ }
+ }
+ }
+
+ private void readExtension(IConfigurationElement element) {
+ try {
+ final ResourceLocatorConfig rlConfig = new ResourceLocatorConfig();
+
+ // plug-in id
+ rlConfig.setPluginId(element.getContributor().getName());
+
+ // resource locator id
+ rlConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
+
+ if (this.resourceLocatorLookupTable.containsKey(rlConfig.getId())) {
+ logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, rlConfig.getId());
+ throw new XPointException();
+ }
+
+ // resource locator class name
+ rlConfig.setClassName(findRequiredAttribute(element, CLASS_ATTRIBUTE));
+
+ // priority
+ String priorityString = element.getAttribute(PRIORITY_ATTRIBUTE).trim();
+ Priority priority = Priority.get(priorityString);
+ if (priority == null) {
+ logInvalidValue(element, PRIORITY_ATTRIBUTE, priorityString);
+ throw new XPointException();
+ }
+ rlConfig.setPriority(priority);
+
+ // enablement
+ for (IConfigurationElement child : element.getChildren()) {
+ String childName = child.getName();
+ if (childName.equals(ENABLEMENT_ELEMENT)) {
+ Expression expr;
+ try {
+ expr = ExpressionConverter.getDefault().perform(child);
+ }
+ catch (CoreException e) {
+ log(e);
+ throw new XPointException();
+ }
+ rlConfig.setEnablementCondition(expr);
+ }
+ }
+
+ this.resourceLocatorConfigs.add(rlConfig);
+ this.resourceLocatorLookupTable.put(rlConfig.getId(), rlConfig);
+ }
+ catch (XPointException e) {
+ // Ignore and continue. The problem has already been reported to the user
+ // in the log.
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/SimpleJavaResourceLocator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/SimpleJavaResourceLocator.java
new file mode 100644
index 0000000000..4a82530061
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/SimpleJavaResourceLocator.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.resource;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.core.resource.ResourceLocator;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+
+public class SimpleJavaResourceLocator
+ implements ResourceLocator {
+
+ protected static IPath META_INF_PATH = new Path(J2EEConstants.META_INF);
+
+ /**
+ * Simply ensure the container is either:
+ * - on the java project classpath
+ * or
+ * - in the non-java resources, but not in the project output location
+ */
+ public boolean acceptResourceLocation(IProject project, IContainer container) {
+ IJavaProject javaProject = getJavaProject(project);
+ if (javaProject.isOnClasspath(container)) {
+ return true;
+ }
+ try {
+ IPath outputLocation = javaProject.getOutputLocation();
+ if (container.equals(project) && outputLocation.isPrefixOf(container.getFullPath())) {
+ return true;
+ }
+ for (Object resource : javaProject.getNonJavaResources()) {
+ if (resource instanceof IFolder) {
+ IFolder folder = (IFolder) resource;
+ if ((folder.equals(container) || folder.contains(container))
+ && ! outputLocation.isPrefixOf(container.getFullPath())) {
+ return true;
+ }
+ }
+ }
+ }
+ catch (JavaModelException jme) {
+ JptCorePlugin.log(jme);
+ // only happens if the java project doesn't exist. fall through.
+ }
+ return false;
+ }
+
+ /**
+ * Return
+ * - the first package fragment root (source folder) META-INF folder if it exists,
+ * or
+ * - the project rooted META-INF folder if it exists
+ * or
+ * - the non-existent META-INF folder in the first package fragment root (source folder)
+ */
+ public IContainer getDefaultResourceLocation(IProject project) {
+ IJavaProject javaProject = getJavaProject(project);
+ IContainer defaultLocation = null;
+ try {
+ for (IPackageFragmentRoot root : javaProject.getPackageFragmentRoots()) {
+ if (root.getKind() == IPackageFragmentRoot.K_SOURCE) {
+ IContainer rootContainer = (IContainer) root.getUnderlyingResource();
+ IFolder metaInfFolder = rootContainer.getFolder(META_INF_PATH);
+ if (metaInfFolder.exists()) {
+ return metaInfFolder;
+ }
+ if (defaultLocation == null) {
+ // hold on to this in case the META-INF folder can't be found
+ defaultLocation = metaInfFolder;
+ }
+ }
+ }
+ IFolder metaInfFolder = project.getFolder(META_INF_PATH);
+ if (metaInfFolder.exists()) {
+ return metaInfFolder;
+ }
+ }
+ catch (JavaModelException jme) {
+ // only happens if the java project doesn't exist or there is some problem with the
+ // java resources. fall through.
+ JptCorePlugin.log(jme);
+ }
+
+ return defaultLocation;
+ }
+
+ public IPath getResourcePath(IProject project, IPath runtimePath) {
+ IJavaProject javaProject = getJavaProject(project);
+ IPath firstResourcePath = null;
+ try {
+ for (IClasspathEntry entry : javaProject.getRawClasspath()) {
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ IPath resourcePath = entry.getPath().append(runtimePath);
+ if (firstResourcePath == null) {
+ firstResourcePath = resourcePath;
+ }
+ IFile file = project.getWorkspace().getRoot().getFile(resourcePath);
+ if (file.exists()) {
+ return file.getFullPath();
+ }
+ }
+ }
+ }
+ catch (JavaModelException jme) {
+ JptCorePlugin.log(jme);
+ return null;
+ }
+ return firstResourcePath;
+ }
+
+ private IJavaProject getJavaProject(IProject project) {
+ return JavaCore.create(project);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/WebModuleResourceLocator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/WebModuleResourceLocator.java
new file mode 100644
index 0000000000..7f9979bf60
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/WebModuleResourceLocator.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.resource;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+public class WebModuleResourceLocator
+ extends ModuleResourceLocator{
+
+ protected static IPath WEB_INF_CLASSES_PATH = new Path(J2EEConstants.WEB_INF_CLASSES);
+
+ /**
+ * Return the folder representing the "WEB-INF/classes/META-INF" location
+ */
+ @Override
+ public IContainer getDefaultResourceLocation(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ return component.getRootFolder().getFolder(WEB_INF_CLASSES_PATH.append(META_INF_PATH)).getUnderlyingFolder();
+ }
+
+ /**
+ * Return the full resource path representing the given runtime location appended
+ * to the "WEB-INF/classes" location
+ */
+ @Override
+ public IPath getResourcePath(IProject project, IPath runtimePath) {
+ return super.getResourcePath(project, WEB_INF_CLASSES_PATH.append(runtimePath));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java
index 523bacf3ee..6608c39cb9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,7 +12,6 @@ package org.eclipse.jpt.core.internal.resource.orm;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
@@ -32,32 +31,32 @@ public class OrmXmlResourceProvider
* the given file.
*/
public static OrmXmlResourceProvider getXmlResourceProvider(IFile file) {
- return getXmlResourceProvider_(file.getProject(), file.getFullPath().toString());
+ return getXmlResourceProvider_(file.getProject(), file.getFullPath());
}
/**
* (Convenience method) Returns an ORM resource model provider for
- * the given project in the specified deploy location
+ * the given project in the specified runtime location
*/
- public static OrmXmlResourceProvider getXmlResourceProvider(IProject project, String deployLocation) {
- return getXmlResourceProvider_(project, JptCorePlugin.getDeploymentURI(project, deployLocation));
+ public static OrmXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) {
+ return getXmlResourceProvider_(project, JptCorePlugin.getPlatformFile(project, runtimePath).getFullPath());
}
/**
* (Convenience method) Returns an ORM resource model provider for
- * the given project in the default deploy location
+ * the given project in the default runtime location
*/
public static OrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ return getXmlResourceProvider(project, JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
}
- private static OrmXmlResourceProvider getXmlResourceProvider_(IProject project, String location) {
- return new OrmXmlResourceProvider(project, new Path(location));
+ private static OrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
+ return new OrmXmlResourceProvider(project, fullPath);
}
public OrmXmlResourceProvider(IProject project) {
- this(project, new Path(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH));
+ this(project, JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
}
public OrmXmlResourceProvider(IProject project, IPath filePath) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
index 7db90820f7..46265a2d42 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,7 +12,6 @@ package org.eclipse.jpt.core.internal.resource.persistence;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProperties;
import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
@@ -30,32 +29,32 @@ public class PersistenceXmlResourceProvider
* the given file.
*/
public static PersistenceXmlResourceProvider getXmlResourceProvider(IFile file) {
- return getXmlResourceProvider_(file.getProject(), file.getFullPath().toString());
+ return getXmlResourceProvider_(file.getProject(), file.getFullPath());
}
/**
* (Convenience method) Returns an persistence resource model provider for
- * the given project in the specified deploy location
+ * the given project in the specified runtime location
*/
- public static PersistenceXmlResourceProvider getXmlResourceProvider(IProject project, String deployLocation) {
- return getXmlResourceProvider_(project, JptCorePlugin.getDeploymentURI(project, deployLocation));
+ public static PersistenceXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) {
+ return getXmlResourceProvider_(project, JptCorePlugin.getPlatformFile(project, runtimePath).getFullPath());
}
/**
* (Convenience method) Returns a persistence resource model provider for
- * the given project in the default deploy location
+ * the given project in the default runtime location
*/
public static PersistenceXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH);
+ return getXmlResourceProvider(project, JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
}
- private static PersistenceXmlResourceProvider getXmlResourceProvider_(IProject project, String location) {
- return new PersistenceXmlResourceProvider(project, new Path(location));
+ private static PersistenceXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
+ return new PersistenceXmlResourceProvider(project, fullPath);
}
public PersistenceXmlResourceProvider(IProject project) {
- this(project, new Path(JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH));
+ this(project, JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
}
public PersistenceXmlResourceProvider(IProject project, IPath filePath) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java
index 1974095648..9e7209ec0e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/PlatformTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,8 +11,12 @@ package org.eclipse.jpt.core.internal.utility;
import java.io.IOException;
import java.io.InputStream;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
@@ -22,7 +26,15 @@ import org.eclipse.jpt.core.JptCorePlugin;
* A collection of utilities for dealing with the Eclipse platform API.
*/
public class PlatformTools {
-
+
+ /**
+ * Return the {@link IContainer} with the workspace relative "full" path
+ */
+ public static IContainer getContainer(IPath fullContainerPath) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ return root.getContainerForLocation(root.getLocation().append(fullContainerPath));
+ }
+
/**
* Return the specified file's content type,
* using the Eclipse platform's content type manager.
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/AbstractXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/AbstractXmlResourceProvider.java
index 7b232dca0d..e6cfd7b974 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/AbstractXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/AbstractXmlResourceProvider.java
@@ -81,7 +81,7 @@ public abstract class AbstractXmlResourceProvider
* Create a new AbstractResourceModelProvider for the given project and
* resourcePath. The resourcePath may be either a) an absolute platform
* resource path (e.g. "MyProject/src/META-INF/foobar.xml") or b) a relative
- * deploy path (e.g. "META-INF/foobar.xml".) In either case,
+ * runtime path (e.g. "META-INF/foobar.xml".) In either case,
* {@link #buildFileUri(IPath)} will attempt to build an absolutely pathed
* URI for the given path.
*/
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/ResourceLocator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/ResourceLocator.java
new file mode 100644
index 0000000000..fe00d8036b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/ResourceLocator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.resource;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * 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.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface ResourceLocator {
+
+ /**
+ * Return whether the given container is an acceptable (non-java) resource
+ * location for the given project
+ */
+ boolean acceptResourceLocation(IProject project, IContainer container);
+
+ /**
+ * Return the default location in which to create new (non-java) resources
+ */
+ IContainer getDefaultResourceLocation(IProject project);
+
+ /**
+ * Return the workspace relative resource path best represented by the given
+ * runtime path for the given project
+ */
+ IPath getResourcePath(IProject project, IPath runtimePath);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.eclipselink.core/.settings/org.eclipse.core.resources.prefs
index e3143733ea..c2c87405d0 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/.settings/org.eclipse.core.resources.prefs
@@ -1,8 +1,9 @@
-#Tue Feb 23 16:52:23 EST 2010
+#Fri Jul 30 13:15:16 EDT 2010
eclipse.preferences.version=1
encoding//schemas/eclipselink_orm_1_0.xsd=UTF8
encoding//schemas/eclipselink_orm_1_1.xsd=UTF8
encoding//schemas/eclipselink_orm_1_2.xsd=UTF8
encoding//schemas/eclipselink_orm_2_0.xsd=UTF8
encoding//schemas/eclipselink_orm_2_1.xsd=UTF8
+encoding//schemas/eclipselink_sessions_2.1.xsd=UTF8
encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/EclipseLinkJpaProject.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/EclipseLinkJpaProject.java
index 0dd8e544f8..f7716dd6e2 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/EclipseLinkJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/EclipseLinkJpaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -30,7 +30,7 @@ public interface EclipseLinkJpaProject
* <code>META-INF/eclipselink-orm.xml</code> if that file has the
* EclipseLink content type.
*
- * @see org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin#DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH
+ * @see org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin#DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH
* @see org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin#ECLIPSELINK_ORM_XML_CONTENT_TYPE
*/
JpaXmlResource getDefaultEclipseLinkOrmXmlResource();
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java
index 99a9f87a3a..0c9768b955 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -18,18 +18,16 @@ import org.eclipse.jpt.eclipselink.core.EclipseLinkJpaProject;
* EclipseLink-specific JPA project.
*/
public class EclipseLinkJpaProjectImpl
- extends AbstractJpaProject
- implements EclipseLinkJpaProject
-{
+ extends AbstractJpaProject
+ implements EclipseLinkJpaProject {
+
public EclipseLinkJpaProjectImpl(JpaProject.Config config) {
super(config);
}
-
+
public JpaXmlResource getDefaultEclipseLinkOrmXmlResource() {
return (JpaXmlResource) this.getResourceModel(
- JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH,
- JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE
- );
+ JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH,
+ JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE);
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java
index 5979addca5..318394ab0d 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java
@@ -9,14 +9,14 @@
*******************************************************************************/
package org.eclipse.jpt.eclipselink.core.internal;
-import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.core.JpaResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLink;
import org.eclipse.jpt.eclipselink.core.resource.orm.v1_1.EclipseLink1_1;
import org.eclipse.jpt.eclipselink.core.resource.orm.v1_2.EclipseLink1_2;
@@ -97,7 +97,7 @@ public class JptEclipseLinkCorePlugin extends Plugin
public static final JpaResourceType ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE
= new JpaResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink2_1.SCHEMA_VERSION);
- public static final String DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH = "META-INF/eclipselink-orm.xml"; //$NON-NLS-1$
+ public static final IPath DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH = new Path("META-INF/eclipselink-orm.xml"); //$NON-NLS-1$
// ********** singleton **********
@@ -111,15 +111,6 @@ public class JptEclipseLinkCorePlugin extends Plugin
}
/**
- * Return the default mapping file deployment URI for the specified project.
- * ("WEB-INF/classes/META-INF/eclipselink-orm.xml" for web projects and
- * "META-INF/eclipselink-orm.xml" in other cases)
- */
- public static String getDefaultEclipseLinkOrmXmlDeploymentURI(IProject project) {
- return JptCorePlugin.getDeploymentURI(project, DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
- }
-
- /**
* Log the specified status.
*/
public static void log(IStatus status) {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java
index da7f13e5e3..b13877f237 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java
@@ -23,8 +23,8 @@ public class EclipseLinkJarFileRef
}
@Override
- protected IPath[] resolveDeploymentJarFilePathWeb(IPath root, IPath jarFilePath) {
- IPath[] genericPath = super.resolveDeploymentJarFilePathWeb(root, jarFilePath);
+ protected IPath[] resolveRuntimeJarFilePathWeb(IPath root, IPath jarFilePath) {
+ IPath[] genericPath = super.resolveRuntimeJarFilePathWeb(root, jarFilePath);
return ArrayTools.removeLast(genericPath);
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
index a6eafbbe53..217110119d 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
@@ -15,7 +15,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
-
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.core.context.persistence.Persistence;
@@ -366,7 +366,7 @@ public class EclipseLinkPersistenceUnit
}
private ImpliedMappingFileRef buildEclipseLinkImpliedMappingFileRef() {
- return new ImpliedMappingFileRef(this, JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ return new ImpliedMappingFileRef(this, JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
}
@Override
@@ -396,9 +396,8 @@ public class EclipseLinkPersistenceUnit
}
protected boolean impliedEclipseLinkMappingFileIsSpecified() {
- String impliedMappingFile = JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH;
for (Iterator<MappingFileRef> stream = specifiedMappingFileRefs(); stream.hasNext(); ) {
- if (impliedMappingFile.equals(stream.next().getFileName())) {
+ if (JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.equals(new Path(stream.next().getFileName()))) {
return true;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java
index 1c6c59a5b6..d194096f3b 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jpt.eclipselink.core.internal.operations;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaPlatformProvider;
import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
@@ -42,11 +41,8 @@ public class EclipseLinkOrmFileCreationDataModelProvider
}
@Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(FILE_PATH)) {
- return new Path(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH).toPortableString();
- }
- return super.getDefaultProperty(propertyName);
+ protected String getDefaultFileName() {
+ return JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment();
}
@Override
@@ -54,8 +50,14 @@ public class EclipseLinkOrmFileCreationDataModelProvider
if (getProject() == null) {
return null;
}
- return getJpaProject().getJpaPlatform().getMostRecentSupportedResourceType(
- JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE).getVersion();
+ try {
+ return getJpaProject().getJpaPlatform().getMostRecentSupportedResourceType(
+ JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE).getVersion();
+ }
+ catch (IllegalArgumentException iae) {
+ // eclipselink content not supported for project
+ return null;
+ }
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java
index d0c1e5706d..35e7693e0c 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,7 +12,6 @@ package org.eclipse.jpt.eclipselink.core.internal.resource.orm;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
@@ -34,33 +33,33 @@ public class EclipseLinkOrmXmlResourceProvider
* the given file.
*/
public static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider(IFile file) {
- return getXmlResourceProvider_(file.getProject(), file.getFullPath().toString());
+ return getXmlResourceProvider_(file.getProject(), file.getFullPath());
}
/**
* (Convenience method) Returns an EclipseLink ORM resource model provider for
- * the given project in the specified deploy location
+ * the given project in the specified runtime location
*/
- public static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider(IProject project, String deployLocation) {
- return getXmlResourceProvider_(project, JptCorePlugin.getDeploymentURI(project, deployLocation));
+ public static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) {
+ return getXmlResourceProvider_(project, JptCorePlugin.getPlatformFile(project, runtimePath).getFullPath());
}
/**
* (Convenience method) Returns an EclipseLink ORM resource model provider for
- * the given project in the default deploy location
+ * the given project in the default runtime location
*/
public static EclipseLinkOrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ return getXmlResourceProvider(project, JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
}
- private static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider_(IProject project, String location) {
- return new EclipseLinkOrmXmlResourceProvider(project, new Path(location));
+ private static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
+ return new EclipseLinkOrmXmlResourceProvider(project, fullPath);
}
public EclipseLinkOrmXmlResourceProvider(IProject project) {
- this(project, new Path(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH));
+ this(project, JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
}
public EclipseLinkOrmXmlResourceProvider(IProject project, IPath filePath) {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
index f59056519e..ae5dc5ca4d 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
@@ -9,12 +9,10 @@
################################################################################
MappingFileWizard_title=New EclipseLink Mapping File
-MappingFileWizardPage_title=EclipseLink mapping file
-MappingFileWizardPage_desc=Specify EclipseLink mapping file location and properties
-
-EclipseLink1_1MappingFileWizard_title=New EclipseLink 1.1 Mapping File
-EclipseLink1_1MappingFileWizardPage_title=EclipseLink 1.1 mapping file
-EclipseLink1_1MappingFileWizardPage_desc=Specify EclipseLink 1.1 mapping file location and properties
+MappingFileWizardPage_newFile_title=EclipseLink mapping file
+MappingFileWizardPage_newFile_desc=Specify EclipseLink mapping file name and location
+MappingFileWizardPage_options_title=EclipseLink mapping file
+MappingFileWizardPage_options_desc=Specify EclipseLink mapping file options
Boolean_True = True
Boolean_False = False
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
index 04a9a38cc9..4e56b80c13 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
@@ -17,13 +17,11 @@ import org.eclipse.osgi.util.NLS;
public class EclipseLinkUiMessages {
public static String MappingFileWizard_title;
- public static String MappingFileWizardPage_title;
- public static String MappingFileWizardPage_desc;
+ public static String MappingFileWizardPage_newFile_title;
+ public static String MappingFileWizardPage_newFile_desc;
+ public static String MappingFileWizardPage_options_title;
+ public static String MappingFileWizardPage_options_desc;
- public static String EclipseLink1_1MappingFileWizard_title;
- public static String EclipseLink1_1MappingFileWizardPage_title;
- public static String EclipseLink1_1MappingFileWizardPage_desc;
-
public static String Boolean_True;
public static String Boolean_False;
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java
index 7ffab89acb..e5580fcae9 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
+ * Copyright (c) 2008, 2010 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -12,18 +12,18 @@ package org.eclipse.jpt.eclipselink.ui.internal.wizards;
import org.eclipse.jpt.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileNewFileWizardPage;
+import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileOptionsWizardPage;
import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizard;
-import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizardPage;
-import org.eclipse.ui.INewWizard;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
/**
* This is referenced in the plugin.xml as an org.eclipse.ui.newWizards extension
*/
-public class EclipseLinkMappingFileWizard extends MappingFileWizard
- implements INewWizard
-{
+public class EclipseLinkMappingFileWizard
+ extends MappingFileWizard {
+
public EclipseLinkMappingFileWizard() {
this(null);
}
@@ -35,8 +35,19 @@ public class EclipseLinkMappingFileWizard extends MappingFileWizard
@Override
- protected MappingFileWizardPage buildMappingFileWizardPage() {
- return new EclipseLinkMappingFileWizardPage(getDataModel(), "Page_1", EclipseLinkUiMessages.MappingFileWizardPage_title, EclipseLinkUiMessages.MappingFileWizardPage_desc);
+ protected MappingFileNewFileWizardPage buildMappingFileNewFileWizardPage() {
+ return new MappingFileNewFileWizardPage(
+ "Page_1", this.mungedSelection, getDataModel(),
+ EclipseLinkUiMessages.MappingFileWizardPage_newFile_title,
+ EclipseLinkUiMessages.MappingFileWizardPage_newFile_desc);
+ }
+
+ @Override
+ protected MappingFileOptionsWizardPage buildMappingFileOptionsWizardPage() {
+ return new MappingFileOptionsWizardPage(
+ "Page_2", getDataModel(),
+ EclipseLinkUiMessages.MappingFileWizardPage_options_title,
+ EclipseLinkUiMessages.MappingFileWizardPage_options_desc);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java
deleted file mode 100644
index 98bc51270b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizardPage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.ui.internal.wizards;
-
-import org.eclipse.jpt.ui.internal.wizards.orm.MappingFileWizardPage;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class EclipseLinkMappingFileWizardPage extends MappingFileWizardPage
-{
- public EclipseLinkMappingFileWizardPage(IDataModel dataModel, String pageName, String title, String desc) {
- super(dataModel, pageName);
- setTitle(title);
- setDescription(desc);
- setPageComplete(false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
index 304aacf4ac..e332ed55c3 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
@@ -113,8 +113,10 @@ JpaProblemSeveritiesPage_Info=Info
JpaProblemSeveritiesPage_Warning=Warning
MappingFileWizard_title=New Mapping File
-MappingFileWizardPage_title=Mapping file
-MappingFileWizardPage_desc=Specify mapping file location and properties
+MappingFileWizardPage_newFile_title=Mapping file
+MappingFileWizardPage_newFile_desc=Specify mapping file name and location
+MappingFileWizardPage_options_title=Mapping file
+MappingFileWizardPage_options_desc=Specify mapping file options
MappingFileWizardPage_projectLabel=&Project:
MappingFileWizardPage_sourceFolderLabel=Source fol&der:
MappingFileWizardPage_filePathLabel=File pat&h:
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_persistence.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_persistence.properties
index ae091e70b9..5fe073792b 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_persistence.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_persistence.properties
@@ -11,7 +11,7 @@
Boolean_False=False
Boolean_True=True
-ArchiveFileSelectionDialog_jarPathHelpLabel=The correct path to the JAR file selected will vary on your deployment environment. You may alter it here to correctly reflect your particular environment.
+ArchiveFileSelectionDialog_jarPathHelpLabel=The correct path to the JAR file selected will vary on your runtime environment. You may alter it here to correctly reflect your particular environment.
ArchiveFileSelectionDialog_jarPathLabel=JAR file path:
PersistenceEditor_page_help=Help
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
index 2d7c45f46a..d5b09ae423 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
@@ -97,8 +97,10 @@ public class JptUiMessages {
public static String JpaStructureView_structureNotAvailable;
public static String JpaStructureView_numItemsSelected;
public static String MappingFileWizard_title;
- public static String MappingFileWizardPage_title;
- public static String MappingFileWizardPage_desc;
+ public static String MappingFileWizardPage_newFile_title;
+ public static String MappingFileWizardPage_newFile_desc;
+ public static String MappingFileWizardPage_options_title;
+ public static String MappingFileWizardPage_options_desc;
public static String MappingFileWizardPage_projectLabel;
public static String MappingFileWizardPage_sourceFolderLabel;
public static String MappingFileWizardPage_filePathLabel;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/persistence/details/ArchiveFileSelectionDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/persistence/details/ArchiveFileSelectionDialog.java
index 1061c2d3ce..66cc4b6423 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/persistence/details/ArchiveFileSelectionDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/persistence/details/ArchiveFileSelectionDialog.java
@@ -215,7 +215,7 @@ public class ArchiveFileSelectionDialog
protected String calculatePersistenceRootRelativePath(IVirtualFile vFile) {
IProject project = vFile.getProject();
- IPath puRootPath = JptCorePlugin.getJarDeploymentRootPath(project);
+ IPath puRootPath = JptCorePlugin.getJarRuntimeRootPath(project);
IPath path = vFile.getRuntimePath().makeRelativeTo(puRootPath);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/EntityClassWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/EntityClassWizardPage.java
index 8fa052bc14..b7a9505797 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/EntityClassWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/EntityClassWizardPage.java
@@ -1,5 +1,5 @@
/***********************************************************************
- * Copyright (c) 2008, 2009 by SAP AG, Walldorf.
+ * Copyright (c) 2008, 2010 by SAP AG, Walldorf.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,13 +12,13 @@
package org.eclipse.jpt.ui.internal.wizards.entity;
import java.io.File;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -126,7 +126,7 @@ public class EntityClassWizardPage extends NewJavaClassWizardPage{
boolean isChecked = xmlSupportButton.getSelection();
enableMappingXMLChooseGroup(isChecked);
if (isFirstCheck) {
- ormXmlName.setText(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ ormXmlName.setText(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
isFirstCheck = false;
}
}
@@ -280,7 +280,7 @@ public class EntityClassWizardPage extends NewJavaClassWizardPage{
dialog.addFilter(filter);
String ormFileName = this.ormXmlName.getText();
- JpaXmlResource resource = jpaProject.getMappingFileXmlResource(ormFileName);
+ JpaXmlResource resource = jpaProject.getMappingFileXmlResource(new Path(ormFileName));
IFile initialSelection = (resource != null) ? resource.getFile() : null;
dialog.setInput(project);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java
index 5937f91978..537fe9db2a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java
@@ -1,5 +1,5 @@
/***********************************************************************
- * Copyright (c) 2008 by SAP AG, Walldorf.
+ * Copyright (c) 2008, 2010 by SAP AG, Walldorf.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -243,7 +243,7 @@ public class CreateEntityTemplateModel {
if (getMappingXMLName().equals(IEntityDataModelProperties.EMPTY_STRING)) {
return true;
}
- return getMappingXMLName().equals(JptCorePlugin.getDefaultOrmXmlDeploymentURI(getProject()));
+ return getMappingXMLName().equals(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
}
public String getMappingXMLName() {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java
index 60d9ec9d48..cad057b9b6 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java
@@ -1,5 +1,5 @@
/***********************************************************************
- * Copyright (c) 2008, 2009 by SAP AG, Walldorf.
+ * Copyright (c) 2008, 2010 by SAP AG, Walldorf.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,13 +11,12 @@
***********************************************************************/
package org.eclipse.jpt.ui.internal.wizards.entity.data.model;
-import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
@@ -38,6 +37,7 @@ import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+import com.ibm.icu.text.MessageFormat;
public class EntityDataModelProvider extends NewJavaClassDataModelProvider implements IEntityDataModelProperties{
@@ -189,7 +189,7 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
IProject project = ProjectUtilities.getProject(projectName);
if (project != null) {
//TODO need to check content type as well since user can type in a file name, should have a different error message for invalid content type
- JpaFile jpaFile = JptCorePlugin.getJpaFile(project, xmlName);
+ JpaFile jpaFile = JptCorePlugin.getJpaFile(project, new Path(xmlName));
if (jpaFile == null) {
return new Status(
IStatus.ERROR, JptUiPlugin.PLUGIN_ID,
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
index 904ea25602..8fcdd0351a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
@@ -428,7 +428,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
if (model.isMappingXMLDefault()) {
return JptCorePlugin.getJpaProject(project).getDefaultOrmXmlResource();
}
- return JptCorePlugin.getJpaProject(project).getMappingFileXmlResource(model.getMappingXMLName());
+ return JptCorePlugin.getJpaProject(project).getMappingFileXmlResource(new Path(model.getMappingXMLName()));
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileNewFileWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileNewFileWizardPage.java
new file mode 100644
index 0000000000..78400dece1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileNewFileWizardPage.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.ui.internal.wizards.orm;
+
+import static org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties.*;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class MappingFileNewFileWizardPage
+ extends WizardNewFileCreationPage {
+
+ protected IDataModel dataModel;
+
+
+ public MappingFileNewFileWizardPage(
+ String pageName, IStructuredSelection selection, IDataModel dataModel,
+ String title, String description) {
+
+ super(pageName, selection);
+ init(dataModel);
+ setTitle(title);
+ setDescription(description);
+ }
+
+
+ protected void init(IDataModel dataModel) {
+ this.dataModel = dataModel;
+ IPath containerPath = (IPath) this.dataModel.getProperty(CONTAINER_PATH);
+ if (containerPath != null) {
+ setContainerFullPath(containerPath);
+ }
+ String fileName = (String) this.dataModel.getProperty(FILE_NAME);
+ if (fileName != null) {
+ setFileName(fileName);
+ }
+ }
+
+ @Override
+ protected boolean validatePage() {
+ this.dataModel.setProperty(CONTAINER_PATH, getContainerFullPath());
+ this.dataModel.setProperty(FILE_NAME, getFileName());
+
+ boolean valid = super.validatePage();
+ if (! valid) {
+ return valid;
+ }
+
+ IStatus validationStatus = this.dataModel.validateProperty(CONTAINER_PATH);
+ if (validationStatus.isOK()) {
+ validationStatus = this.dataModel.validateProperty(FILE_NAME);
+ }
+ if (validationStatus.isOK()) {
+ setErrorMessage(null);
+ return true;
+ }
+ else if (validationStatus.getSeverity() == IStatus.WARNING) {
+ setErrorMessage(null);
+ setMessage(validationStatus.getMessage(), IStatus.WARNING);
+ return true;
+ }
+ else {
+ setErrorMessage(validationStatus.getMessage());
+ return false;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java
new file mode 100644
index 0000000000..833890b8e5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle.
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.ui.internal.wizards.orm;
+
+import static org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties.*;
+import static org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties.*;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+public class MappingFileOptionsWizardPage
+ extends DataModelWizardPage {
+
+ private Label accessLabel;
+
+ private Combo accessCombo;
+
+ private Button addToPersistenceUnitButton;
+
+ private Label persistenceUnitLabel;
+
+ private Combo persistenceUnitCombo;
+
+
+ public MappingFileOptionsWizardPage(
+ String pageName, IDataModel dataModel,
+ String title, String description) {
+
+ super(dataModel, pageName);
+ setTitle(title);
+ setDescription(description);
+ setPageComplete(false);
+ }
+
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[] {
+ CONTAINER_PATH,
+ FILE_NAME,
+ DEFAULT_ACCESS,
+ ADD_TO_PERSISTENCE_UNIT,
+ PERSISTENCE_UNIT
+ };
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+
+ this.accessLabel = new Label(composite, SWT.NONE);
+ this.accessLabel.setText(JptUiMessages.MappingFileWizardPage_accessLabel);
+ data = new GridData();
+ this.accessLabel.setLayoutData(data);
+
+ this.accessCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ data.grabExcessHorizontalSpace = true;
+ this.accessCombo.setLayoutData(data);
+ this.synchHelper.synchCombo(this.accessCombo, DEFAULT_ACCESS, null);
+ new Label(composite, SWT.NONE);
+
+ this.addToPersistenceUnitButton = new Button(composite, SWT.CHECK | SWT.BEGINNING);
+ this.addToPersistenceUnitButton.setText(JptUiMessages.MappingFileWizardPage_addToPersistenceUnitButton);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 3;
+ data.verticalIndent = 10;
+ this.addToPersistenceUnitButton.setLayoutData(data);
+ this.synchHelper.synchCheckbox(this.addToPersistenceUnitButton, ADD_TO_PERSISTENCE_UNIT, null);
+
+ this.persistenceUnitLabel = new Label(composite, SWT.NONE);
+ this.persistenceUnitLabel.setText(JptUiMessages.MappingFileWizardPage_persistenceUnitLabel);
+ data = new GridData();
+ data.horizontalIndent = 10;
+ this.persistenceUnitLabel.setLayoutData(data);
+ this.persistenceUnitLabel.setEnabled(false);
+ this.addToPersistenceUnitButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ persistenceUnitLabel.setEnabled(addToPersistenceUnitButton.getSelection());
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {/*not called*/}
+ });
+
+ this.persistenceUnitCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ data.grabExcessHorizontalSpace = true;
+ this.persistenceUnitCombo.setLayoutData(data);
+ this.synchHelper.synchCombo(this.persistenceUnitCombo, PERSISTENCE_UNIT, null);
+
+ new Label(composite, SWT.NONE);
+
+// classText.setFocus();
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizard.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizard.java
index 2dc0c3a8a7..0988773f10 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizard.java
@@ -10,27 +10,30 @@
*******************************************************************************/
package org.eclipse.jpt.ui.internal.wizards.orm;
+import static org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties.*;
+import static org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties.*;
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.JpaContextNode;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.core.internal.utility.PlatformTools;
import org.eclipse.jpt.ui.JptUiPlugin;
import org.eclipse.jpt.ui.internal.JptUiIcons;
import org.eclipse.jpt.ui.internal.JptUiMessages;
@@ -40,15 +43,26 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
+import org.eclipse.wst.common.frameworks.internal.datamodel.IDataModelPausibleOperation;
+import org.eclipse.wst.common.frameworks.internal.dialog.ui.WarningDialog;
+import org.eclipse.wst.common.frameworks.internal.ui.ErrorDialog;
+import org.eclipse.wst.common.frameworks.internal.ui.WTPCommonUIResourceHandler;
-public class MappingFileWizard extends DataModelWizard
+public class MappingFileWizard extends Wizard
implements INewWizard
{
- private MappingFileWizardPage page;
+ protected IDataModel dataModel;
+
+ protected IStructuredSelection initialSelection;
+
+ protected IStructuredSelection mungedSelection;
+
+ private IWizardPage firstPage;
+
+ private IWizardPage secondPage;
public MappingFileWizard() {
@@ -56,30 +70,16 @@ public class MappingFileWizard extends DataModelWizard
}
public MappingFileWizard(IDataModel dataModel) {
- super(dataModel);
+ super();
+ this.dataModel = dataModel;
setWindowTitle(JptUiMessages.MappingFileWizard_title);
setDefaultPageImageDescriptor(JptUiPlugin.getImageDescriptor(JptUiIcons.JPA_FILE_WIZ_BANNER));
}
- @Override
- protected void doAddPages() {
- super.doAddPages();
- page = buildMappingFileWizardPage();
- addPage(page);
- }
-
- protected MappingFileWizardPage buildMappingFileWizardPage() {
- return new MappingFileWizardPage(getDataModel(), "Page_1");
- }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new OrmFileCreationDataModelProvider();
- }
-
public void init(IWorkbench workbench, IStructuredSelection selection) {
- // check for project, source folder, persistence unit?
+ this.initialSelection = selection;
+
if (selection == null || selection.isEmpty()) {
return;
}
@@ -87,177 +87,213 @@ public class MappingFileWizard extends DataModelWizard
Object firstSelection = selection.getFirstElement();
PersistenceUnit pUnit = extractPersistenceUnit(firstSelection);
- IFolder sourceFolder = extractSourceFolder(pUnit, firstSelection);
- IProject project = extractProject(pUnit, sourceFolder, firstSelection);
+ IContainer container = extractContainer(pUnit, firstSelection);
- if (project != null) {
- getDataModel().setStringProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, project.getName());
+ if (container != null) {
+ this.mungedSelection = new StructuredSelection(container);
}
- if (sourceFolder != null) {
- getDataModel().setStringProperty(OrmFileCreationDataModelProperties.SOURCE_FOLDER, sourceFolder.getFullPath().toPortableString());
+ else {
+ this.mungedSelection = this.initialSelection;
}
+
if (pUnit != null) {
- getDataModel().setBooleanProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, true);
- getDataModel().setStringProperty(OrmFileCreationDataModelProperties.PERSISTENCE_UNIT, pUnit.getName());
+ getDataModel().setBooleanProperty(ADD_TO_PERSISTENCE_UNIT, true);
+ getDataModel().setStringProperty(PERSISTENCE_UNIT, pUnit.getName());
}
}
private PersistenceUnit extractPersistenceUnit(Object selection) {
- if (selection instanceof PersistenceUnit) {
- return (PersistenceUnit) selection;
- }
- PersistenceUnit pUnit = null;
if (selection instanceof JpaContextNode) {
+ // may be null if node is above level of persistence unit, but in those cases
+ // null is the expected result
try {
- pUnit = ((JpaContextNode) selection).getPersistenceUnit();
+ return ((JpaContextNode) selection).getPersistenceUnit();
}
catch (Exception e) { /* do nothing, just continue */ }
}
- if (pUnit == null && selection instanceof IAdaptable) {
- pUnit = (PersistenceUnit) ((IAdaptable) selection).getAdapter(PersistenceUnit.class);
-
+
+ if (selection instanceof IAdaptable) {
+ JpaContextNode node = (JpaContextNode) ((IAdaptable) selection).getAdapter(JpaContextNode.class);
+ if (node != null) {
+ return node.getPersistenceUnit();
+ }
}
- return pUnit;
+ return null;
}
- private IFolder extractSourceFolder(PersistenceUnit pUnit, Object selection) {
- IJavaProject javaProject = null;
- IFolder srcFolder = null;
+ private IContainer extractContainer(PersistenceUnit pUnit, Object selection) {
if (pUnit != null) {
- javaProject = pUnit.getJpaProject().getJavaProject();
- srcFolder = findSourceFolder(javaProject, pUnit.getResource());
- if (srcFolder != null) {
- return srcFolder;
- }
-
+ return pUnit.getResource().getParent();
}
- if (selection instanceof IResource) {
- javaProject = JavaCore.create(((IResource) selection).getProject());
- if (javaProject.exists()) {
- srcFolder = findSourceFolder(javaProject, (IResource) selection);
- if (srcFolder != null) {
- return srcFolder;
- }
- }
+ if (selection instanceof IProject) {
+ return getDefaultContainer((IProject) selection);
+ }
+ if (selection instanceof IContainer) {
+ return (IContainer) selection;
+ }
+ if (selection instanceof JpaContextNode) {
+ return getDefaultContainer(((JpaContextNode) selection).getJpaProject().getProject());
}
if (selection instanceof IAdaptable) {
IResource resource = (IResource) ((IAdaptable) selection).getAdapter(IResource.class);
if (resource != null) {
- javaProject = JavaCore.create((resource).getProject());
- if (javaProject.exists()) {
- srcFolder = findSourceFolder(javaProject, resource);
- if (srcFolder != null) {
- return srcFolder;
- }
+ if (resource instanceof IProject) {
+ return getDefaultContainer((IProject) resource);
+ }
+ else if (resource instanceof IContainer) {
+ return (IContainer) resource;
}
}
+ JpaContextNode node = (JpaContextNode) ((IAdaptable) selection).getAdapter(JpaContextNode.class);
+ if (node != null) {
+ return getDefaultContainer(node.getJpaProject().getProject());
+ }
}
return null;
}
- private IFolder findSourceFolder(IJavaProject javaProject, IResource resource) {
- if (JptCorePlugin.getJpaProject(javaProject.getProject()) == null) {
- // not even a jpa project
- return null;
+ private IContainer getDefaultContainer(IProject project) {
+ if (JptCorePlugin.projectHasJpaFacet(project)) {
+ return JptCorePlugin.getResourceLocator(project).getDefaultResourceLocation(project);
}
- while (resource != null && ! (resource instanceof IFolder)) {
- resource = resource.getParent();
- }
- if (resource == null) {
- return null;
+ return project;
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ this.firstPage = buildMappingFileNewFileWizardPage();
+ this.secondPage = buildMappingFileOptionsWizardPage();
+ addPage(this.firstPage);
+ addPage(this.secondPage);
+ }
+
+ protected MappingFileNewFileWizardPage buildMappingFileNewFileWizardPage() {
+ return new MappingFileNewFileWizardPage(
+ "Page_1", this.mungedSelection, getDataModel(),
+ JptUiMessages.MappingFileWizardPage_newFile_title,
+ JptUiMessages.MappingFileWizardPage_newFile_desc);
+ }
+
+ protected MappingFileOptionsWizardPage buildMappingFileOptionsWizardPage() {
+ return new MappingFileOptionsWizardPage(
+ "Page_2", getDataModel(),
+ JptUiMessages.MappingFileWizardPage_options_title,
+ JptUiMessages.MappingFileWizardPage_options_desc);
+ }
+
+ @Override
+ public boolean canFinish() {
+ // override so that visit to second page is not necessary
+ return this.firstPage.isPageComplete() && getDataModel().isValid();
+ }
+
+ protected IDataModel getDataModel() {
+ if (this.dataModel == null) {
+ this.dataModel = DataModelFactory.createDataModel(getDefaultProvider());
}
- IFolder folder = (IFolder) resource;
+ return this.dataModel;
+ }
+
+ protected IDataModelProvider getDefaultProvider() {
+ return new OrmFileCreationDataModelProvider();
+ }
+
+ protected IDataModelPausibleOperation getOperation() {
+ return (IDataModelPausibleOperation) getDataModel().getDefaultOperation();
+ }
+
+ @Override
+ public final boolean performFinish() {
try {
- IPackageFragmentRoot packageFragmentRoot = null;
- while (packageFragmentRoot == null && folder != null) {
- packageFragmentRoot = javaProject.findPackageFragmentRoot(folder.getFullPath());
- if (packageFragmentRoot == null) {
- IPackageFragment packageFragment = javaProject.findPackageFragment(folder.getFullPath());
- if (packageFragment != null) {
- packageFragmentRoot = (IPackageFragmentRoot) packageFragment.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
- }
- }
- if (packageFragmentRoot == null) {
- try {
- folder = (IFolder) folder.getParent();
- }
- catch (ClassCastException cce) {
- folder = null;
- }
- }
- }
- if (packageFragmentRoot == null) {
- return null;
- }
- if (JDTTools.packageFragmentRootIsSourceFolder(packageFragmentRoot)) {
- return (IFolder) packageFragmentRoot.getResource();
+ final IStatus st = runOperations();
+
+ if (st.getSeverity() == IStatus.ERROR) {
+ JptUiPlugin.log(st);
+ Throwable t = st.getException() == null ? new CoreException(st) : st.getException();
+ ErrorDialog.openError(
+ getShell(),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}),
+ t, 0, false);
+ }
+ else if(st.getSeverity() == IStatus.WARNING){
+ WarningDialog.openWarning(
+ getShell(),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_2, new Object[]{getWindowTitle()}),
+ st.getMessage(),
+ st, IStatus.WARNING);
}
+
+ postPerformFinish();
}
- catch (JavaModelException jme) { /* do nothing, return null */ }
- return null;
+ catch (Exception e) {
+ JptUiPlugin.log(e);
+ ErrorDialog.openError(
+ getShell(),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}),
+ e, 0, false);
+ }
+ return true;
}
- private IProject extractProject(PersistenceUnit pUnit, IFolder sourceFolder, Object selection) {
- if (pUnit != null) {
- return pUnit.getJpaProject().getProject();
- }
- if (sourceFolder != null) {
- return sourceFolder.getProject();
- }
+ private IStatus runOperations() {
- IProject project = null;
- if (selection instanceof IResource) {
- project = ((IResource) selection).getProject();
- }
- if (project == null && selection instanceof IJavaElement) {
- project = ((IJavaElement) selection).getJavaProject().getProject();
- }
- if (project == null && selection instanceof JpaContextNode) {
- project = ((JpaContextNode) selection).getJpaProject().getProject();
- }
- if (project == null && selection instanceof IAdaptable) {
- project = (IProject) ((IAdaptable) selection).getAdapter(IProject.class);
- if (project == null) {
- IResource resource = (IResource) ((IAdaptable) selection).getAdapter(IResource.class);
- if (resource != null) {
- project = resource.getProject();
- }
- }
- if (project == null) {
- IJavaElement javaElement = (IJavaElement) ((IAdaptable) selection).getAdapter(IJavaElement.class);
- if (javaElement != null) {
- project = javaElement.getJavaProject().getProject();
+ class CatchThrowableRunnableWithProgress
+ implements IRunnableWithProgress {
+
+ public IStatus status = null;
+ public Throwable caught = null;
+
+ public void run(IProgressMonitor pm) {
+ try {
+ status = getOperation().execute(pm, null);
+ }
+ catch (Throwable e) {
+ caught = e;
}
}
}
- if (project != null) {
- for (DataModelPropertyDescriptor descriptor :
- getDataModel().getValidPropertyDescriptors(OrmFileCreationDataModelProperties.PROJECT_NAME)) {
- if (descriptor.getPropertyDescription().equals(project.getName())) {
- return project;
- }
- }
+ CatchThrowableRunnableWithProgress runnable = new CatchThrowableRunnableWithProgress();
+
+ try {
+ getContainer().run(true, false, runnable);
+ }
+ catch (Throwable e) {
+ runnable.caught = e;
+ }
+
+ if (runnable.caught == null) {
+ return runnable.status;
+ }
+ else {
+ JptUiPlugin.log(runnable.caught);
+ ErrorDialog.openError(
+ getShell(),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}),
+ runnable.caught, 0, false);
+ return new Status(IStatus.ERROR, "id", 0, runnable.caught.getMessage(), runnable.caught); //$NON-NLS-1$
}
- return null;
}
- @Override
- protected void postPerformFinish() throws InvocationTargetException {
- try {
- String projectName = (String) getDataModel().getProperty(OrmFileCreationDataModelProperties.PROJECT_NAME);
- IProject project = ProjectUtilities.getProject(projectName);
- String sourceFolder = getDataModel().getStringProperty(OrmFileCreationDataModelProperties.SOURCE_FOLDER);
- String filePath = getDataModel().getStringProperty(OrmFileCreationDataModelProperties.FILE_PATH);
-
- IFile file = project.getWorkspace().getRoot().getFile(new Path(sourceFolder).append(filePath));
- openEditor(file);
- }
- catch (Exception cantOpen) {
- throw new InvocationTargetException(cantOpen);
- }
- }
+ protected void postPerformFinish()
+ throws InvocationTargetException {
+
+ try {
+ IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH);
+ String fileName = getDataModel().getStringProperty(FILE_NAME);
+ IContainer container = PlatformTools.getContainer(containerPath);
+ IFile file = container.getFile(new Path(fileName));
+ openEditor(file);
+ }
+ catch (Exception cantOpen) {
+ throw new InvocationTargetException(cantOpen);
+ }
+ }
private void openEditor(final IFile file) {
if (file != null) {
@@ -274,4 +310,10 @@ public class MappingFileWizard extends DataModelWizard
});
}
}
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ getDataModel().dispose();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java
deleted file mode 100644
index 7ad77b4cd3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/orm/MappingFileWizardPage.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.ui.internal.wizards.orm;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
-import org.eclipse.jpt.ui.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-
-public class MappingFileWizardPage extends DataModelWizardPage
- implements OrmFileCreationDataModelProperties
-{
- private Label projectNameLabel;
-
- private Combo projectNameCombo;
-
- private Label sourceFolderLabel;
-
- private Text sourceFolderText;
-
- private Label filePathLabel;
-
- private Text filePathText;
-
- private Label accessLabel;
-
- private Combo accessCombo;
-
- private Button addToPersistenceUnitButton;
-
- private Label persistenceUnitLabel;
-
- private Combo persistenceUnitCombo;
-
-
- public MappingFileWizardPage(IDataModel dataModel, String pageName) {
- super(dataModel, pageName);
- setTitle(JptUiMessages.MappingFileWizardPage_title);
- setDescription(JptUiMessages.MappingFileWizardPage_desc);
- setPageComplete(false);
- }
-
-
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[] {
- PROJECT_NAME,
- SOURCE_FOLDER,
- FILE_PATH,
- DEFAULT_ACCESS,
- ADD_TO_PERSISTENCE_UNIT,
- PERSISTENCE_UNIT
- };
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
-
- this.projectNameLabel = new Label(composite, SWT.NONE);
- this.projectNameLabel.setText(JptUiMessages.MappingFileWizardPage_projectLabel);
- data = new GridData();
- this.projectNameLabel.setLayoutData(data);
-
- this.projectNameCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 1;
- data.grabExcessHorizontalSpace = true;
- this.projectNameCombo.setLayoutData(data);
- this.synchHelper.synchCombo(this.projectNameCombo, PROJECT_NAME, null);
- new Label(composite, SWT.NONE);
-
- this.sourceFolderLabel = new Label(composite, SWT.NONE);
- this.sourceFolderLabel.setText(JptUiMessages.MappingFileWizardPage_sourceFolderLabel);
- data = new GridData();
- this.sourceFolderLabel.setLayoutData(data);
-
- this.sourceFolderText = new Text(composite, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 1;
- data.grabExcessHorizontalSpace = true;
- this.sourceFolderText.setLayoutData(data);
- this.synchHelper.synchText(this.sourceFolderText, SOURCE_FOLDER, null);
-
- Button sourceFolderButton = new Button(composite, SWT.PUSH);
- sourceFolderButton.setText(JptUiMessages.General_browse);
- data = new GridData();
- data.horizontalSpan = 1;
- sourceFolderButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- handleSourceFolderButtonPressed();
- }
- });
-
- Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- data = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1);
- data.verticalIndent = 5;
- separator.setLayoutData(data);
-
- this.filePathLabel = new Label(composite, SWT.NONE);
- this.filePathLabel.setText(JptUiMessages.MappingFileWizardPage_filePathLabel);
- data = new GridData();
- data.verticalIndent = 5;
- this.filePathLabel.setLayoutData(data);
-
- this.filePathText = new Text(composite, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 1;
- data.verticalIndent = 5;
- data.grabExcessHorizontalSpace = true;
- this.filePathText.setLayoutData(data);
- this.synchHelper.synchText(this.filePathText, FILE_PATH, null);
- new Label(composite, SWT.NONE);
-
- this.accessLabel = new Label(composite, SWT.NONE);
- this.accessLabel.setText(JptUiMessages.MappingFileWizardPage_accessLabel);
- data = new GridData();
- this.accessLabel.setLayoutData(data);
-
- this.accessCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 1;
- data.grabExcessHorizontalSpace = true;
- this.accessCombo.setLayoutData(data);
- this.synchHelper.synchCombo(this.accessCombo, DEFAULT_ACCESS, null);
- new Label(composite, SWT.NONE);
-
- this.addToPersistenceUnitButton = new Button(composite, SWT.CHECK | SWT.BEGINNING);
- this.addToPersistenceUnitButton.setText(JptUiMessages.MappingFileWizardPage_addToPersistenceUnitButton);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- data.verticalIndent = 10;
- this.addToPersistenceUnitButton.setLayoutData(data);
- this.synchHelper.synchCheckbox(this.addToPersistenceUnitButton, ADD_TO_PERSISTENCE_UNIT, null);
-
- this.persistenceUnitLabel = new Label(composite, SWT.NONE);
- this.persistenceUnitLabel.setText(JptUiMessages.MappingFileWizardPage_persistenceUnitLabel);
- data = new GridData();
- data.horizontalIndent = 10;
- this.persistenceUnitLabel.setLayoutData(data);
- this.persistenceUnitLabel.setEnabled(false);
- this.addToPersistenceUnitButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- persistenceUnitLabel.setEnabled(addToPersistenceUnitButton.getSelection());
- }
- public void widgetDefaultSelected(SelectionEvent e) {/*not called*/}
- });
-
- this.persistenceUnitCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 1;
- data.grabExcessHorizontalSpace = true;
- this.persistenceUnitCombo.setLayoutData(data);
- this.synchHelper.synchCombo(this.persistenceUnitCombo, PERSISTENCE_UNIT, null);
-
- new Label(composite, SWT.NONE);
-
-// classText.setFocus();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- private void handleSourceFolderButtonPressed() {
- ISelectionStatusValidator validator = getSourceFolderDialogSelectionValidator();
- ViewerFilter filter = getSourceFolderDialogViewerFilter();
- ITreeContentProvider contentProvider = new WorkbenchContentProvider();
- ILabelProvider labelProvider = new WorkbenchLabelProvider();
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
- dialog.setValidator(validator);
- dialog.setTitle(JptUiMessages.MappingFileWizardPage_accessLabel_sourceFolderDialogTitle);
- dialog.setMessage(JptUiMessages.MappingFileWizardPage_accessLabel_sourceFolderDialogDesc);
- dialog.addFilter(filter);
- String projectName = model.getStringProperty(PROJECT_NAME);
- if (projectName==null || projectName.length()==0) {
- return;
- }
- IProject project = ProjectUtilities.getProject(projectName);
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
-
- if (project != null) {
- dialog.setInitialSelection(project);
- }
- if (dialog.open() == Window.OK) {
- Object element = dialog.getFirstResult();
- if (element instanceof IContainer) {
- IContainer container = (IContainer) element;
- model.setProperty(SOURCE_FOLDER, container.getFullPath().toPortableString());
- }
- }
- }
-
- private ISelectionStatusValidator getSourceFolderDialogSelectionValidator() {
- return new ISelectionStatusValidator() {
- public IStatus validate(Object[] selection) {
- if (selection != null && selection[0] != null && ! (selection[0] instanceof IProject)) {
- return Status.OK_STATUS;
- }
- return new Status(IStatus.ERROR, JptUiPlugin.PLUGIN_ID, JptUiMessages.MappingFileWizardPage_incorrectSourceFolderError);
- }
- };
- }
-
- private ViewerFilter getSourceFolderDialogViewerFilter() {
- return new ViewerFilter() {
- @Override
- public boolean select(Viewer viewer, Object parent, Object element) {
- if (element instanceof IProject) {
- IProject project = (IProject) element;
- return project.getName().equals(model.getProperty(PROJECT_NAME));
- }
- else if (element instanceof IFolder) {
- IFolder folder = (IFolder) element;
- // only show source folders
- IProject project = ProjectUtilities.getProject(model.getStringProperty(PROJECT_NAME));
- IJavaProject javaProject = JavaCore.create(project);
- if (JDTTools.packageFragmentRootIsSourceFolder(javaProject.getPackageFragmentRoot(folder))) {
- return true;
- }
- }
- return false;
- }
- };
- }
-
- void init(IWorkbench workbench, IStructuredSelection selection) {
-
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java
index 25819715cf..04c7c7e8a8 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaFileTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -38,7 +38,7 @@ public class JpaFileTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
index 583b0a323e..61aea8887c 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JpaProjectTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.tests.internal.context;
import junit.framework.TestCase;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.GenericJpaPlatformProvider;
@@ -84,7 +85,8 @@ public class JpaProjectTests extends TestCase
private void createPersistenceXmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new PersistenceFileCreationDataModelProvider());
- config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.getDefaultOperation().execute(null, null);
}
@@ -110,56 +112,58 @@ public class JpaProjectTests extends TestCase
private void createDefaultOrmXmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.getDefaultOperation().execute(null, null);
}
- private void createOrmXmlFile(String filePath) throws Exception {
+ private void createOrmXmlFile(String fileName) throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
- config.setProperty(JpaFileCreationDataModelProperties.FILE_PATH, filePath);
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
+ config.setProperty(JpaFileCreationDataModelProperties.FILE_NAME, fileName);
config.getDefaultOperation().execute(null, null);
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
assertNotNull(resource);
assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
assertNull(resource);
//add the orm.xml file back
createDefaultOrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
assertNotNull(resource);
assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
}
public void testGetMappingFileResourceDifferentlyName() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//create the orm2.xml file
- createOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createOrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//add the orm2.xml file back
- createOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createOrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
index 33c2f55a3b..92a467dc25 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -41,7 +41,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
index 5554e65e83..57117e30e6 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
@@ -274,7 +274,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
protected void createOrmXmlFile() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java
index ad7e948029..64c9b6ae6f 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java
@@ -492,7 +492,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
JavaPersistentType childPersistentType = getJavaPersistentType();
@@ -540,7 +540,7 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntityAnnotationOnProperty();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java
index 0fbd4cf795..84961d2ced 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java
@@ -197,7 +197,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase
public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntityWithTableGenerator();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java
index d8a64fbcfe..006c5a20b7 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java
@@ -157,7 +157,7 @@ public class JavaTableTests extends ContextModelTestCase
public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntity();
@@ -277,7 +277,7 @@ public class JavaTableTests extends ContextModelTestCase
public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntity();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java
index de8b9b1268..178b67f7be 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -40,7 +40,7 @@ public class EntityMappingsTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
index 26c540b144..e5bbc20701 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.tests.internal.context.orm;
import java.util.Iterator;
-
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
@@ -42,7 +41,7 @@ public class GenericOrmPersistentAttributeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
index c968004749..1b877674d5 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.tests.internal.context.orm;
import java.util.Iterator;
-
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.Converter;
@@ -58,7 +57,7 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java
index 0e27161a1c..1ee160231c 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle.
+ * Copyright (c) 2007, 2010 Oracle.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
index 2ef0e24111..e44571e50b 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -36,7 +36,7 @@ public class OrmAssociationOverrideTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
index 60e18b898c..9e4a3193e0 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -33,7 +33,7 @@ public class OrmAttributeOverrideTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
index 2e7f6e7c1d..1981f215a8 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
@@ -51,7 +51,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
index 25a2ff1d69..33d8060138 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -33,7 +33,7 @@ public class OrmCascadeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
index 97bdfde12b..4ddbc36075 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.tests.internal.context.orm;
import java.util.Iterator;
-
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
@@ -41,7 +40,7 @@ public class OrmColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
index 9defed0bcc..957b2470a2 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -37,7 +37,7 @@ public class OrmDiscriminatorColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java
index e80566876b..cdbac3cf90 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -37,7 +37,7 @@ public class OrmEmbeddableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
index e2ce25fbb1..ae2da9b9d8 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -58,7 +58,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
index 92ee2ed8d0..f8f1bfa089 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
@@ -58,7 +58,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java
index e3b9970cea..a406709186 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEntityTests.java
@@ -76,7 +76,7 @@ public class OrmEntityTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
index bd3ccc87ed..60774d4e73 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -39,7 +39,7 @@ import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
index 15a791252d..f40be46b45 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
@@ -54,7 +54,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
index b6ba4c7af2..d5d311776f 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -34,7 +34,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
index 751660eb7b..e60838997e 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
@@ -51,7 +51,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
index 90035a7301..aad5831a3c 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
@@ -251,7 +251,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
index 06f0599619..dc8c876c26 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
@@ -44,7 +44,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
index 688d530d7e..d62c614318 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
@@ -39,7 +39,7 @@ public class OrmMappedSuperclassTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
index 89b4e4cd8f..f9495e7d84 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -34,7 +34,7 @@ public class OrmNamedNativeQueryTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java
index 8e06b59bae..772ceebc51 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmNamedQueryTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -34,7 +34,7 @@ public class OrmNamedQueryTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
index da871ebced..436fdddeae 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
@@ -226,7 +226,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
index 1e31c7b0f5..94e53f2e83 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
@@ -60,7 +60,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
index 910556760d..df11aa43ec 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -31,7 +31,7 @@ public class OrmPrimaryKeyJoinColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java
index a74145f674..8ca1ed4d62 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmQueryHintTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -31,7 +31,7 @@ public class OrmQueryHintTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java
index f2ef9efd4c..1caed3fbbd 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSecondaryTableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -45,7 +45,7 @@ public class OrmSecondaryTableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
index 08ea9fb7f9..5ee35680f5 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -27,7 +27,7 @@ public class OrmSequenceGeneratorTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java
index 76c247de29..7b477e43ce 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableGeneratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -42,7 +42,7 @@ public class OrmTableGeneratorTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java
index c794d23b90..8058291e5d 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -41,7 +41,7 @@ public class OrmTableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
index 0b49ee047c..b7fe8f7f13 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -43,7 +43,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
index bab7a548df..a403955242 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
@@ -48,7 +48,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java
index 8a3f1ecf00..45ca8c972e 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java
@@ -30,7 +30,7 @@ public class OrmXmlTests extends ContextModelTestCase
super.setUp();
getXmlPersistenceUnit().setName("foo");
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
index 12081ad1fa..696c946522 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -30,7 +30,7 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
index 1d9850e322..dc5e1df23a 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -27,7 +27,7 @@ public class PersistenceUnitMetadataTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java
index 80181b9a8a..85c8de4bf6 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java
@@ -23,6 +23,7 @@ import org.eclipse.jpt.core.context.persistence.ClassRef;
import org.eclipse.jpt.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.core.resource.java.JPA;
@@ -1080,7 +1081,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
}
public void testGetDefaultAccess() throws Exception {
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
createOrm2XmlFile();
PersistenceUnit persistenceUnit = getPersistenceUnit();
ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().mappingFileRefs();
@@ -1104,7 +1105,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
}
public void testGetDefaultSchema() throws Exception {
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
createOrm2XmlFile();
PersistenceUnit persistenceUnit = getPersistenceUnit();
ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().mappingFileRefs();
@@ -1125,7 +1126,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
}
public void testGetDefaultCatalog() throws Exception {
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
createOrm2XmlFile();
PersistenceUnit persistenceUnit = getPersistenceUnit();
ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().mappingFileRefs();
@@ -1148,8 +1149,9 @@ public class PersistenceUnitTests extends ContextModelTestCase
protected void createOrm2XmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
- config.setProperty(OrmFileCreationDataModelProperties.FILE_PATH, "META-INF/orm2.xml");
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
+ config.setProperty(OrmFileCreationDataModelProperties.FILE_NAME, "orm2.xml");
config.getDefaultOperation().execute(null, null);
addXmlMappingFileRef("META-INF/orm2.xml");
@@ -1225,7 +1227,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
//test persistentType from orm.xml file that is specified in the persistence.xml
- addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ addXmlMappingFileRef(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
assertNotNull(persistenceUnit.getPersistentType("model.Foo"));
assertEquals(ormPersistentType, persistenceUnit.getPersistentType("model.Foo"));
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java
index 807e2b6c57..aea18e76aa 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/RootContextNodeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,7 +10,7 @@
package org.eclipse.jpt.core.tests.internal.context.persistence;
import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProperties;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProvider;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
@@ -32,7 +32,8 @@ public class RootContextNodeTests extends ContextModelTestCase
IDataModel config =
DataModelFactory.createDataModel(new PersistenceFileCreationDataModelProvider());
- config.setProperty(PersistenceFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.getDefaultOperation().execute(null, null);
assertNotNull(baseJpaContent.getPersistenceXml());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java
index 13d4ca40f0..8e195d9f2b 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java
@@ -132,7 +132,7 @@ public class GenericJavaSequenceGenerator2_0Tests extends Generic2_0ContextModel
public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntityWithSequenceGenerator();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java
index 64fae2313a..fd2c0327c4 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java
@@ -33,7 +33,7 @@ public class GenericOrmCascade2_0Tests extends Generic2_0ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java
index 1cfe681a42..5d535db954 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -49,7 +49,7 @@ public class GenericOrmCollectionTable2_0Tests extends Generic2_0ContextModelTes
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
index e7fe66bb8b..a8e73e5e32 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
@@ -65,7 +65,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
index 3ac7b8bfd5..ee9f6b327a 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
@@ -9,8 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.tests.internal.context;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.facet.JpaFacetInstallDataModelProperties;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
@@ -83,62 +85,64 @@ public class EclipseLinkJpaProjectTests extends EclipseLinkContextModelTestCase
private void createDefaultOrmXmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.getDefaultOperation().execute(null, null);
}
private void createDefaultOrmXmlFileWithEclipseLinkContentType() throws Exception {
- createEclipseLinkOrmXmlFile(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ createEclipseLinkOrmXmlFile(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
}
private void createDefaultEclipseLinkOrmXmlFile() throws Exception {
- createEclipseLinkOrmXmlFile(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ createEclipseLinkOrmXmlFile(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment());
}
- private void createEclipseLinkOrmXmlFile(String filePath) throws Exception {
+ private void createEclipseLinkOrmXmlFile(String fileName) throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
- config.setProperty(OrmFileCreationDataModelProperties.FILE_PATH, filePath);
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
+ config.setProperty(OrmFileCreationDataModelProperties.FILE_NAME, fileName);
config.getDefaultOperation().execute(null, null);
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNull(resource);
//add the eclipselink-orm.xml file
createDefaultEclipseLinkOrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNull(resource);
}
public void testGetDifferentlyNamedMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//create the orm2.xml file
- createEclipseLinkOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createEclipseLinkOrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//add the orm2.xml file back
- createEclipseLinkOrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createEclipseLinkOrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java
index 546f3dc205..40d47b6a62 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java
@@ -9,10 +9,10 @@
*******************************************************************************/
package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.eclipselink.core.EclipseLinkJpaProject;
import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkEntityMappings;
import org.eclipse.jpt.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
import org.eclipse.jpt.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationOperation;
@@ -52,7 +52,8 @@ public abstract class EclipseLinkOrmContextModelTestCase
protected IDataModel buildEclipseLinkOrmConfig(TestJpaProject testJpaProject) {
IDataModel dataModel =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- dataModel.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
+ dataModel.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ testJpaProject.getProject().getFolder("src/META-INF").getFullPath());
dataModel.setProperty(OrmFileCreationDataModelProperties.VERSION, EclipseLink.SCHEMA_VERSION);
dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.TRUE);
return dataModel;
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
index 42438946f7..b7b399f511 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.eclipselink.core.tests.internal.context.orm;
import java.util.Iterator;
-
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
@@ -42,7 +41,7 @@ public class EclipseLinkOrmPersistentAttributeTests
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
index f3789147fe..1da4983649 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
@@ -30,7 +30,7 @@ public class EclipseLinkPersistenceUnitDefaultsTests extends EclipseLinkOrmConte
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
index 9a75e3731d..314a3770f7 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
@@ -28,7 +28,7 @@ public class EclipseLinkPersistenceUnitMetadataTests extends EclipseLinkOrmConte
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
index 3a9df3a81e..8c7783538d 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
@@ -17,6 +17,7 @@ import org.eclipse.jpt.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.internal.facet.JpaFacetInstallDataModelProperties;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
@@ -54,7 +55,8 @@ public class EclipseLinkPersistenceUnitTests
protected IDataModel buildEclipseLinkOrmConfig(TestJpaProject testJpaProject) {
IDataModel dataModel =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- dataModel.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
+ dataModel.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ testJpaProject.getProject().getFolder("src/META-INF").getFullPath());
dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.FALSE);
return dataModel;
}
@@ -164,7 +166,7 @@ public class EclipseLinkPersistenceUnitTests
//test persistentType from orm.xml file that is specified in the persistence.xml
- addXmlMappingFileRef(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ addXmlMappingFileRef(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
assertNotNull(persistenceUnit.getPersistentType("model.Foo"));
assertEquals(ormPersistentType, persistenceUnit.getPersistentType("model.Foo"));
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
index a58aa26b34..c39a2a4aa5 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
@@ -9,7 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
@@ -95,71 +97,75 @@ public class EclipseLink1_1JpaProjectTests extends EclipseLink1_1ContextModelTes
private void createDefaultOrmXmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.getDefaultOperation().execute(null, null);
}
private void createDefaultOrmXmlFileWithEclipseLinkContentType() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
- config.setProperty(OrmFileCreationDataModelProperties.FILE_PATH, JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
+ config.setProperty(OrmFileCreationDataModelProperties.FILE_NAME,
+ JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
config.getDefaultOperation().execute(null, null);
}
private void createDefaultOrmXmlFileWithEclipseLink1_1ContentType() throws Exception {
- createEclipseLink1_1OrmXmlFile(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ createEclipseLink1_1OrmXmlFile(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
}
private void createDefaultEclipseLink1_1OrmXmlFile() throws Exception {
- createEclipseLink1_1OrmXmlFile(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ createEclipseLink1_1OrmXmlFile(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment());
}
- private void createEclipseLink1_1OrmXmlFile(String filePath) throws Exception {
+ private void createEclipseLink1_1OrmXmlFile(String fileName) throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
+ config.setProperty(OrmFileCreationDataModelProperties.FILE_NAME, fileName);
config.setProperty(OrmFileCreationDataModelProperties.VERSION, EclipseLink1_1.SCHEMA_VERSION);
- config.setProperty(OrmFileCreationDataModelProperties.FILE_PATH, filePath);
config.getDefaultOperation().execute(null, null);
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNull(resource);
//add the eclipselink-orm.xml 1.1 file
createDefaultEclipseLink1_1OrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNull(resource);
}
public void testGetDifferentlyNamedMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//create the orm2.xml file
- createEclipseLink1_1OrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createEclipseLink1_1OrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//add the orm2.xml file back
- createEclipseLink1_1OrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createEclipseLink1_1OrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java
index 346253a8b3..5ecdcd3096 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmContextModelTestCase.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.eclipselink1_1.core.tests.internal.context.orm;
import org.eclipse.jpt.core.internal.facet.JpaFacetInstallDataModelProperties;
+import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
@@ -59,7 +60,8 @@ public abstract class EclipseLink1_1OrmContextModelTestCase
protected IDataModel buildEclipseLinkOrmConfig(TestJpaProject testJpaProject) {
IDataModel dataModel =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- dataModel.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
+ dataModel.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ testJpaProject.getProject().getFolder("src/META-INF").getFullPath());
dataModel.setProperty(OrmFileCreationDataModelProperties.VERSION, EclipseLink1_1.SCHEMA_VERSION);
dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.TRUE);
return dataModel;
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_2/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_2/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java
index 57bf306441..b18695348a 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_2/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_2/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink1_2.core.tests.internal.context;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
@@ -96,71 +96,75 @@ public class EclipseLink1_2JpaProjectTests extends EclipseLink1_2ContextModelTes
private void createDefaultOrmXmlFile() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(OrmFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.getDefaultOperation().execute(null, null);
}
private void createDefaultOrmXmlFileWithEclipseLinkContentType() throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
- config.setProperty(JpaFileCreationDataModelProperties.FILE_PATH, JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
+ config.setProperty(JpaFileCreationDataModelProperties.FILE_NAME,
+ JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
config.getDefaultOperation().execute(null, null);
}
private void createDefaultOrmXmlFileWithEclipseLink1_2ContentType() throws Exception {
- createEclipseLink1_2OrmXmlFile(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ createEclipseLink1_2OrmXmlFile(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
}
private void createDefaultEclipseLink1_2OrmXmlFile() throws Exception {
- createEclipseLink1_2OrmXmlFile(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ createEclipseLink1_2OrmXmlFile(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment());
}
- private void createEclipseLink1_2OrmXmlFile(String filePath) throws Exception {
+ private void createEclipseLink1_2OrmXmlFile(String fileName) throws Exception {
IDataModel config =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- config.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, getJpaProject().getProject().getName());
+ config.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
+ config.setProperty(JpaFileCreationDataModelProperties.FILE_NAME, fileName);
config.setProperty(JpaFileCreationDataModelProperties.VERSION, EclipseLink1_2.SCHEMA_VERSION);
- config.setProperty(JpaFileCreationDataModelProperties.FILE_PATH, filePath);
config.getDefaultOperation().execute(null, null);
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNull(resource);
//add the eclipselink-orm.xml 1.2 file
createDefaultEclipseLink1_2OrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
assertNull(resource);
}
public void testGetDifferentlyNamedMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//create the orm2.xml file
- createEclipseLink1_2OrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createEclipseLink1_2OrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNull(resource);
//add the orm2.xml file back
- createEclipseLink1_2OrmXmlFile("META-INF/orm2.xml");
- resource = this.getJpaProject().getMappingFileXmlResource("META-INF/orm2.xml");
+ createEclipseLink1_2OrmXmlFile("orm2.xml");
+ resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
assertEquals(JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java
index 9ed05a7538..a5bfcddc13 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java
@@ -48,7 +48,7 @@ public class EclipseLink2_0OrmCollectionTableTests extends EclipseLink2_0OrmCont
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmContextModelTestCase.java
index f1a68e786f..ac136eac13 100644
--- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmContextModelTestCase.java
@@ -60,7 +60,8 @@ public abstract class EclipseLink2_0OrmContextModelTestCase
protected IDataModel buildEclipseLinkOrmConfig(TestJpaProject testJpaProject) {
IDataModel dataModel =
DataModelFactory.createDataModel(new EclipseLinkOrmFileCreationDataModelProvider());
- dataModel.setProperty(JpaFileCreationDataModelProperties.PROJECT_NAME, testJpaProject.getProject().getName());
+ dataModel.setProperty(JpaFileCreationDataModelProperties.CONTAINER_PATH,
+ testJpaProject.getProject().getFolder("src/META-INF").getFullPath());
dataModel.setProperty(JpaFileCreationDataModelProperties.VERSION, EclipseLink2_0.SCHEMA_VERSION);
dataModel.setProperty(OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT, Boolean.TRUE);
return dataModel;

Back to the top