Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2012-03-28 18:46:49 -0400
committertle2012-03-28 18:46:49 -0400
commit390f632f1ce6d9adc14d564c4b9e9eaf4d5e1785 (patch)
tree507286cbda3b3903bd712ad16f91dabfa52dc44b
parent5347e87691b1a7e4bc624f6bb429413ad1762ed9 (diff)
downloadwebtools.dali-390f632f1ce6d9adc14d564c4b9e9eaf4d5e1785.tar.gz
webtools.dali-390f632f1ce6d9adc14d564c4b9e9eaf4d5e1785.tar.xz
webtools.dali-390f632f1ce6d9adc14d564c4b9e9eaf4d5e1785.zip
373870 - Should support table generation for OSGi persistence bundle project
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java26
2 files changed, 29 insertions, 4 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
index a5f75fa8ae..22dd3b8d85 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
@@ -240,7 +240,12 @@ public abstract class AbstractJptGenerator
return archiveEntry;
}
-
+
+ protected static IRuntimeClasspathEntry getVariableRuntimeClasspathEntry(IPath path) {
+ IRuntimeClasspathEntry varEntry = JavaRuntime.newVariableRuntimeClasspathEntry(path);
+ varEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
+ return varEntry;
+ }
// ********** LaunchConfig **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java
index b860b4e77f..41965323a5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java
@@ -19,6 +19,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
@@ -38,6 +39,7 @@ import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlEnumValue;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection;
@@ -155,7 +157,7 @@ public abstract class AbstractEclipseLinkDDLGenerator extends AbstractJptGenerat
protected List<String> buildClasspath() throws CoreException {
List<String> classpath = new ArrayList<String>();
// DDL_GEN jar
- classpath.add(getBootstrapJarClasspathEntry().getMemento());
+ classpath.add(this.getBootstrapJarClasspathEntry().getMemento());
// Default Project classpath
classpath.add(this.getDefaultProjectClasspathEntry().getMemento());
// Osgi Bundles
@@ -164,6 +166,10 @@ public abstract class AbstractEclipseLinkDDLGenerator extends AbstractJptGenerat
classpath.add(this.getJdbcJarClasspathEntry().getMemento());
// System Library
classpath.add(this.getSystemLibraryClasspathEntry().getMemento());
+ // meta-inf
+ if(this.metaInfIsNotOnClasspath()) {
+ classpath.add(this.getMetaInfClasspathEntry().getMemento());
+ }
return classpath;
}
@@ -195,6 +201,9 @@ public abstract class AbstractEclipseLinkDDLGenerator extends AbstractJptGenerat
return bundleEntry;
}
+ private IRuntimeClasspathEntry getMetaInfClasspathEntry() {
+ return getVariableRuntimeClasspathEntry(this.getMetaInfPath());
+ }
// ********** EclipseLink properties **********
@@ -233,14 +242,14 @@ public abstract class AbstractEclipseLinkDDLGenerator extends AbstractJptGenerat
}
protected void putProperty(Properties properties, String key, PersistenceXmlEnumValue value) {
- this.putProperty(properties, key, getPropertyStringValueOf(value));
+ this.putProperty(properties, key, this.getPropertyStringValueOf(value));
}
/**
* Returns the Property string value of the given property value.
*/
protected String getPropertyStringValueOf(PersistenceXmlEnumValue value) {
- if (value == null) {
+ if(value == null) {
return null;
}
return value.getPropertyValue();
@@ -320,6 +329,17 @@ public abstract class AbstractEclipseLinkDDLGenerator extends AbstractJptGenerat
}
}
}
+
+ private IPath getMetaInfPath() {
+ JpaXmlResource persistenceXmlResource = this.jpaProject.getPersistenceXmlResource();
+ IPath persistenceXmlPath = persistenceXmlResource.getFile().getLocation();
+ return persistenceXmlPath.removeLastSegments(2);
+ }
+
+ private boolean metaInfIsNotOnClasspath() {
+ JpaXmlResource persistenceXmlResource = this.jpaProject.getPersistenceXmlResource();
+ return ! this.jpaProject.getJavaProject().isOnClasspath(persistenceXmlResource.getFile());
+ }
/**
* Performs validation after tables have been generated

Back to the top