Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaJpqlQueryHelper.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaJpqlQueryHelper.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaJpqlQueryHelper.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java)52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/ClassConstructor.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java)19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/IJpaType.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java)11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaConstructor.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java)21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaType.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java)32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java)33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaConstructor.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java)17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEmbeddable.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java)26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEntity.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java)32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedType.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java)79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedTypeProvider.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java)244
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMappedSuperclass.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java)26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMapping.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java)219
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaNullManagedType.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java)20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaQuery.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java)22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java)37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeDeclaration.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java)15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeRepository.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java)43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/SimpleType.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java)20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLinkJpaJpqlQueryHelper.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlIdentifierMessages.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF1
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaJpqlQueryHelper.java86
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java19
62 files changed, 1882 insertions, 609 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
index d691ef0d6f..bf3b9657c4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
@@ -25,7 +25,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,2.0.0)",
org.eclipse.jst.j2ee.core;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.persistence.jpa.jpql;bundle-version="[1.0.0, 2.0.0)",
+ org.eclipse.persistence.jpa.jpql;bundle-version="[2.0.0, 3.0.0)",
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)",
@@ -63,7 +63,6 @@ Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;x-internal:=true,
- org.eclipse.jpt.jpa.core.internal.jpql;x-friends:="org.eclipse.jpt.jpa.ui",
org.eclipse.jpt.jpa.core.internal.libprov;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.libval;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.operations;x-internal:=true,
@@ -87,6 +86,8 @@ Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection,
org.eclipse.jpt.jpa.core.jpa2.context.persistence.options,
org.eclipse.jpt.jpa.core.jpa2.resource.java,
+ org.eclipse.jpt.jpa.core.jpql,
+ org.eclipse.jpt.jpa.core.jpql.spi,
org.eclipse.jpt.jpa.core.libprov,
org.eclipse.jpt.jpa.core.platform,
org.eclipse.jpt.jpa.core.resource,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
index 6eae60b1d3..84492737ae 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
@@ -3,12 +3,14 @@
* 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.jpa.core;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.AnnotationProvider;
@@ -21,13 +23,13 @@ import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
/**
- * This interface is to be implemented by a JPA vendor to provide extensions to
+ * This interface is to be implemented by a JPA vendor to provide extensions to
* the core JPA model. The core JPA model will provide functionality for JPA
* spec annotations in Java, <code>persistence.xml</code> and mapping
* (<code>orm.xml</code>) files.
- * The <code>org.eclipse.jpt.jpa.core.generic</code> extension supplies
- * resource models for those file types. As another vendor option you
- * will have to supply those resource models as well or different ones
+ * The <code>org.eclipse.jpt.jpa.core.generic</code> extension supplies
+ * resource models for those file types. As another vendor option you
+ * will have to supply those resource models as well or different ones
* as necessary. In the extension point you actually provide a
* {@link JpaPlatformFactory} that will build the JPA platform.
* <p>
@@ -40,8 +42,8 @@ import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
* See the <code>org.eclipse.jpt.jpa.core.jpaPlatforms</code> extension point.
* @see JpaPlatformFactory
* @see JpaPlatformProvider
- *
- * @version 3.0
+ *
+ * @version 3.1
* @since 2.0
*/
public interface JpaPlatform
@@ -52,18 +54,18 @@ public interface JpaPlatform
* Get the ID for this platform
*/
String getId();
-
+
/**
* Return the description for this platform
*/
JpaPlatformDescription getDescription();
-
+
/**
- * Get the version object for this platform.
+ * Get the version object for this platform.
*/
Version getJpaVersion();
-
-
+
+
// ********** factory **********
/**
@@ -121,15 +123,15 @@ public interface JpaPlatform
*/
Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions();
-
+
// ********** resource types and definitions **********
-
+
/**
* Return whether the platform supports the specified resource type.
* This method is consistent with {@link #getResourceDefinition(JptResourceType)}.
*/
boolean supportsResourceType(JptResourceType resourceType);
-
+
/**
* Return the platform's resource definition for the specified resource type.
* The returned definition describes the platform's corresponding context model.
@@ -138,15 +140,15 @@ public interface JpaPlatform
* This method is consistent with {@link #supportsResourceType(JptResourceType)}.
*/
ResourceDefinition getResourceDefinition(JptResourceType resourceType);
-
+
/**
* Return the most recent supported resource type for the specified content
* type. Throw an {@link IllegalArgumentException} if the content type is not
* supported by the platform.
*/
JptResourceType getMostRecentSupportedResourceType(IContentType contentType);
-
-
+
+
// ********** database **********
/**
@@ -162,7 +164,7 @@ public interface JpaPlatform
*/
EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder();
-
+
// ********** platform variation **********
/**
@@ -170,21 +172,31 @@ public interface JpaPlatform
*/
JpaPlatformVariation getJpaVariation();
-
+
+ // ********** Hermes integration **********
+
+ /**
+ * Return the helper that integrates into the Hermes parser and that provides functionality
+ * related to JPQL queries (example: content assist, validation).
+ * @since 3.1
+ */
+ JpaJpqlQueryHelper getJpqlQueryHelper();
+
+
interface Version {
-
+
/**
* Return the platform's version.
*/
String getVersion();
-
+
/**
* Return the highest JPA specification version supported by the platform.
* @see JpaFacet#VERSION_1_0
* @see JpaFacet#VERSION_2_0
*/
String getJpaVersion();
-
+
/**
* Return whether the platform is compatible with the specified JPA
* specification version.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..1c44fd11e2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaJpqlQueryHelper.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+import org.eclipse.jpt.jpa.core.jpql.spi.GenericMappingBuilder;
+import org.eclipse.jpt.jpa.core.jpql.spi.JpaManagedTypeProvider;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.persistence.jpa.jpql.AbstractContentAssistVisitor;
+import org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator;
+import org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator;
+import org.eclipse.persistence.jpa.jpql.DefaultContentAssistVisitor;
+import org.eclipse.persistence.jpa.jpql.DefaultGrammarValidator;
+import org.eclipse.persistence.jpa.jpql.DefaultJPQLQueryContext;
+import org.eclipse.persistence.jpa.jpql.DefaultSemanticValidator;
+import org.eclipse.persistence.jpa.jpql.JPQLQueryContext;
+import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
+
+/**
+ * The default implementation of {@link JpaJpqlQueryHelper} that provides support based on the Java
+ * Persistence functional specification (version 1.0 and 2.0).
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public abstract class AbstractJpaJpqlQueryHelper extends JpaJpqlQueryHelper {
+
+ /**
+ * Creates a new <code>AbstractJpaJpqlQueryHelper</code>.
+ *
+ * @param jpqlGrammar The grammar that defines how to parse a JPQL query
+ */
+ protected AbstractJpaJpqlQueryHelper(JPQLGrammar jpqlGrammar) {
+ super(jpqlGrammar);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractContentAssistVisitor buildContentAssistVisitor(JPQLQueryContext queryContext) {
+ return new DefaultContentAssistVisitor(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractGrammarValidator buildGrammarValidator(JPQLQueryContext queryContext) {
+ return new DefaultGrammarValidator(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected JPQLQueryContext buildJPQLQueryContext(JPQLGrammar jpqlGrammar) {
+ return new DefaultJPQLQueryContext(jpqlGrammar);
+ }
+
+ protected IMappingBuilder<AttributeMapping> buildMappingBuilder() {
+ return new GenericMappingBuilder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JpaManagedTypeProvider buildProvider(NamedQuery query) {
+ return new JpaManagedTypeProvider(
+ query.getJpaProject(),
+ query.getPersistenceUnit(),
+ buildMappingBuilder()
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractSemanticValidator buildSemanticValidator(JPQLQueryContext queryContext) {
+ return new DefaultSemanticValidator(queryContext);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..822208847e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaJpqlQueryHelper.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar1_0;
+
+/**
+ * The default implementation of {@link JpaJpqlQueryHelper} that provides support based on the Java
+ * Persistence functional specification version 1.0.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class GenericJpaJpqlQueryHelper extends AbstractJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new GenericJpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>GenericJpaJpqlQueryHelper</code>.
+ */
+ private GenericJpaJpqlQueryHelper() {
+ super(JPQLGrammar1_0.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
index 405d0914aa..141a270b2f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.AnnotationProvider;
@@ -53,8 +55,10 @@ public class GenericJpaPlatform
private final JpaPlatformVariation jpaVariation;
+ private final JpaJpqlQueryHelper jpqlQueryHelper;
+
- public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, AnnotationProvider annotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) {
+ public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, AnnotationProvider annotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation, JpaJpqlQueryHelper jpqlQueryHelper) {
super();
this.id = id;
this.jpaVersion = jpaVersion;
@@ -62,6 +66,7 @@ public class GenericJpaPlatform
this.annotationProvider = annotationProvider;
this.jpaVariation = jpaVariation;
this.platformProvider = platformProvider;
+ this.jpqlQueryHelper = jpqlQueryHelper;
}
@@ -195,4 +200,11 @@ public class GenericJpaPlatform
public JpaPlatformVariation getJpaVariation() {
return this.jpaVariation;
}
-}
+
+
+ // ********** Hermes integration **********
+
+ public JpaJpqlQueryHelper getJpqlQueryHelper() {
+ return jpqlQueryHelper;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
index c3cacc7ae6..fc25535ca5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -30,22 +30,23 @@ public class GenericJpaPlatformFactory
public GenericJpaPlatformFactory() {
super();
}
-
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
this.buildJpaVersion(),
- new GenericJpaFactory(),
+ new GenericJpaFactory(),
new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
- GenericJpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
+ GenericJpaPlatformProvider.instance(),
+ this.buildJpaPlatformVariation(),
+ GenericJpaJpqlQueryHelper.instance());
}
-
-
+
+
private JpaPlatform.Version buildJpaVersion() {
return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -74,7 +75,7 @@ public class GenericJpaPlatformFactory
public String getVersion() {
return this.getJpaVersion();
}
-
+
public String getJpaVersion() {
return this.jpaVersion;
}
@@ -85,7 +86,7 @@ public class GenericJpaPlatformFactory
public boolean isCompatibleWithJpaVersion(String version) {
return JPA_VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0;
}
-
+
@Override
public String toString() {
return "JPA version: " + this.getJpaVersion(); //$NON-NLS-1$
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
index 156ebd7c89..f3d72e898e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
@@ -9,13 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -36,7 +37,7 @@ public class GenericJavaNamedQuery
@Override
protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
+ JpaJpqlQueryHelper helper = getJpaPlatform().getJpqlQueryHelper();
helper.validate(this, this.query, this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages);
}
@@ -45,4 +46,4 @@ public class GenericJavaNamedQuery
public Class<NamedQuery> getType() {
return NamedQuery.class;
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
index f788ff1c06..7e7dbcb415 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
@@ -9,11 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -35,10 +36,11 @@ public class GenericOrmNamedQuery
@Override
protected void validateQuery_(java.util.List<IMessage> messages, IReporter reporter) {
+
// Convert the literal escape characters into actual escape characters
String jpqlQuery = ExpressionTools.unescape(this.query, new int[1]);
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
+ JpaJpqlQueryHelper helper = getJpaPlatform().getJpqlQueryHelper();
helper.validate(this, jpqlQuery, this.getQueryTextRange(), 0, messages);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..44f944978c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaJpqlQueryHelper.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaJpqlQueryHelper;
+import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar2_0;
+
+/**
+ * The default implementation of {@link JpaJpqlQueryHelper} that provides support based on the Java
+ * Persistence functional specification version 2.0.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class Generic2_0JpaJpqlQueryHelper extends AbstractJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new Generic2_0JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>Generic2_0JpaJpqlQueryHelper</code>.
+ */
+ private Generic2_0JpaJpqlQueryHelper() {
+ super(JPQLGrammar2_0.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
index 6a0db9b94a..f555be49ef 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -13,9 +13,9 @@ import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
/**
* All the state in the JPA platform should be "static" (i.e. unchanging once
@@ -30,8 +30,8 @@ public class Generic2_0JpaPlatformFactory
public Generic2_0JpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
@@ -39,13 +39,14 @@ public class Generic2_0JpaPlatformFactory
new GenericJpaFactory2_0(),
new JpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()),
Generic2_0JpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
+ this.buildJpaPlatformVariation(),
+ Generic2_0JpaJpqlQueryHelper.instance());
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new SimpleVersion(JpaFacet.VERSION_2_0.getVersionString());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
//table_per_class inheritance support is optional in the 2.0 spec
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
index 3314c4ab02..270975f862 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
@@ -9,13 +9,14 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaNamedQuery2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
@@ -99,7 +100,7 @@ public class GenericJavaNamedQuery2_0
@Override
protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
+ JpaJpqlQueryHelper helper = getJpaPlatform().getJpqlQueryHelper();
helper.validate(this, this.query, this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages);
}
@@ -114,4 +115,4 @@ public class GenericJavaNamedQuery2_0
public Class<NamedQuery> getType() {
return NamedQuery.class;
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
index af0569b466..78eaeabc64 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
@@ -9,11 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmNamedQuery2_0;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
@@ -97,10 +98,11 @@ public class GenericOrmNamedQuery2_0
@Override
protected void validateQuery_(java.util.List<IMessage> messages, IReporter reporter) {
+
// Convert the literal escape characters into actual escape characters
String jpqlQuery = ExpressionTools.unescape(this.query, new int[1]);
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
+ JpaJpqlQueryHelper helper = getJpaPlatform().getJpqlQueryHelper();
helper.validate(this, jpqlQuery, this.getQueryTextRange(), 0, messages);
}
@@ -115,4 +117,4 @@ public class GenericOrmNamedQuery2_0
public Class<NamedQuery> getType() {
return NamedQuery.class;
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
deleted file mode 100644
index 61bde80b3c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-
-/**
- * This class was removed and then added back as a stub to provide compatibility with Dali 3.0.
- * It is a legacy class that should be removed in 3.2 stream for Juno.
- * The concrete implementation that is wrapping the design-time representation of a persistence unit.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-public final class JpaPersistenceUnit extends JpaManagedTypeProvider {
-
- /**
- * Creates a new <code>JpaPersistenceUnit</code>.
- *
- * @param jpaProject The project that gives access to the application's metadata
- * @param persistentUnit The design-time persistence unit
- */
- public JpaPersistenceUnit(JpaProject jpaProject, PersistenceUnit persistentUnit) {
- super(jpaProject, persistentUnit);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java
index 0250271842..3f03e5ce04 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java
@@ -11,7 +11,10 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql;
+
+import org.eclipse.jpt.jpa.core.jpql.spi.JpaManagedTypeProvider;
+import org.eclipse.jpt.jpa.core.jpql.spi.JpaQuery;
import java.util.List;
import org.eclipse.jpt.common.core.internal.utility.SimpleTextRange;
@@ -20,9 +23,11 @@ import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationPreferences;
+import org.eclipse.persistence.jpa.jpql.AbstractJPQLQueryHelper;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.persistence.jpa.jpql.JPQLQueryHelper;
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
+import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -40,24 +45,31 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
* <li>{@link #validateSemantic()}.</li>
* </ul></li>
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
@SuppressWarnings("nls")
-public final class JpaJpqlQueryHelper extends JPQLQueryHelper {
+public abstract class JpaJpqlQueryHelper extends AbstractJPQLQueryHelper {
/**
* Caches the provider in order to prevent recreating the SPI representation of the JPA artifacts
* more than once.
*/
- private JpaManagedTypeProvider managedTypeProvider;
+ private IManagedTypeProvider managedTypeProvider;
/**
* Creates a new <code>JpaQueryHelper</code>.
+ *
+ * @param jpqlGrammar The grammar that defines how to parse a JPQL query
*/
- public JpaJpqlQueryHelper() {
- super();
+ protected JpaJpqlQueryHelper(JPQLGrammar jpqlGrammar) {
+ super(jpqlGrammar);
}
/**
@@ -111,12 +123,12 @@ public final class JpaJpqlQueryHelper extends JPQLQueryHelper {
* @return A new {@link IMessage} that has the required information to display the problem
* underline and the error message in the Problems view
*/
- private IMessage buildProblem(NamedQuery namedQuery,
- TextRange textRange,
- JPQLQueryProblem problem,
- String parsedJpqlQuery,
- String actualQuery,
- int offset) {
+ protected IMessage buildProblem(NamedQuery namedQuery,
+ TextRange textRange,
+ JPQLQueryProblem problem,
+ String parsedJpqlQuery,
+ String actualQuery,
+ int offset) {
// Convert the positions from the parsed JPQL query to the actual JPQL query
int[] positions = buildPositions(problem, parsedJpqlQuery, actualQuery);
@@ -149,9 +161,13 @@ public final class JpaJpqlQueryHelper extends JPQLQueryHelper {
return message;
}
- private JpaManagedTypeProvider buildProvider(NamedQuery query) {
- return new JpaManagedTypeProvider(query.getJpaProject(), query.getPersistenceUnit());
- }
+ /**
+ * Creates
+ *
+ * @param query
+ * @return
+ */
+ public abstract JpaManagedTypeProvider buildProvider(NamedQuery query);
/**
* Disposes the provider so the application metadata is not kept in memory.
@@ -185,14 +201,14 @@ public final class JpaJpqlQueryHelper extends JPQLQueryHelper {
* problem
* @return The global severity for validating JPQL queries
*/
- private int severity(Object targetObject) {
+ protected int severity(Object targetObject) {
return JpaValidationPreferences.getProblemSeverityPreference(
targetObject,
JpaValidationMessages.JPQL_QUERY_VALIDATION
);
}
- private boolean shouldValidate(NamedQuery namedQuery) {
+ protected boolean shouldValidate(NamedQuery namedQuery) {
return JpaValidationPreferences.getProblemSeverityPreference(
namedQuery,
JpaValidationMessages.JPQL_QUERY_VALIDATION
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/ClassConstructor.java
index ffff5e0fa5..f803abb9db 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/ClassConstructor.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import org.eclipse.jdt.core.BindingKey;
import org.eclipse.jdt.core.IMethod;
@@ -26,11 +26,16 @@ import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
* representation of a Java constructor (either coming from a Java compiled file or a Java source
* file).
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class ClassConstructor implements IConstructor {
+public class ClassConstructor implements IConstructor {
/**
* The information of the constructor.
@@ -54,13 +59,13 @@ final class ClassConstructor implements IConstructor {
* @param type The declaring type of this constructor
* @param methodInfo The information of the constructor
*/
- ClassConstructor(JpaType type, IMethod method) {
+ public ClassConstructor(JpaType type, IMethod method) {
super();
this.type = type;
this.method = method;
}
- private ITypeDeclaration[] buildParameterTypes() {
+ protected ITypeDeclaration[] buildParameterTypes() {
BindingKey bindingKey = new BindingKey(method.getKey());
String signature = bindingKey.toSignature();
@@ -88,7 +93,7 @@ final class ClassConstructor implements IConstructor {
return typeDeclarations;
}
- private ITypeDeclaration[] buildTypeParameters(String signature) {
+ protected ITypeDeclaration[] buildTypeParameters(String signature) {
String[] typeParameters = Signature.getTypeArguments(signature);
ITypeDeclaration[] generics = new ITypeDeclaration[typeParameters.length];
@@ -137,7 +142,7 @@ final class ClassConstructor implements IConstructor {
return typeDeclarations;
}
- private ITypeRepository getTypeRepository() {
+ protected ITypeRepository getTypeRepository() {
return type.getTypeRepository();
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java
new file mode 100644
index 0000000000..fc9cde27aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericJpaMapping.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+
+/**
+ * A default implementation of Hermes' {@link IMapping}.
+ *
+ * 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.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class GenericJpaMapping extends JpaMapping {
+
+ /**
+ * Creates a new <code>GenericJpaMapping</code>.
+ *
+ * @param parent The parent of this mapping
+ * @param mapping The design-time {@link AttributeMapping} wrapped by this class
+ */
+ public GenericJpaMapping(IManagedType parent, AttributeMapping mapping) {
+ super(parent, mapping);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java
new file mode 100644
index 0000000000..c86f76e740
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/GenericMappingBuilder.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+import org.eclipse.persistence.jpa.jpql.spi.IMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
+
+/**
+ * The default implementation of {@link IMappingBuilder}.
+ *
+ * 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.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class GenericMappingBuilder implements IMappingBuilder<AttributeMapping> {
+
+ /**
+ * Creates a new <code>GenericMappingBuilder</code>.
+ */
+ public GenericMappingBuilder() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IMapping buildMapping(IManagedType parent, AttributeMapping value) {
+ return new GenericJpaMapping(parent, value);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/IJpaType.java
index 0d914a9e04..e7e102ef1e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/IJpaType.java
@@ -11,22 +11,27 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import org.eclipse.persistence.jpa.jpql.spi.IType;
/**
* An internal interface used by all 3 implementations of {@link IType}.
*
+ * 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.
+ *
* @see JavaType
* @see JpaType
* @see SimpleType
*
- * @version 3.0
+ * @version 3.1
* @since 3.0
* @author Pascal Filion
*/
-interface IJpaType extends IType {
+public interface IJpaType extends IType {
/**
* Manually sets the declaration of this {@link IType}, which gives the information about type
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaConstructor.java
index 63a63a8d82..288940c2c1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaConstructor.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.lang.reflect.Constructor;
import java.lang.reflect.Type;
@@ -23,11 +23,16 @@ import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
/**
* The concrete implementation of {@link IConstructor} that is wrapping a Java constructor.
*
- * @version 2.3
- * @since 2.3
+ * 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.1
+ * @since 3.0
* @author Pascal Filion
*/
-final class JavaConstructor implements IConstructor {
+public class JavaConstructor implements IConstructor {
/**
* The actual Java constructor.
@@ -50,13 +55,13 @@ final class JavaConstructor implements IConstructor {
* @param type The declaring type of this constructor
* @param constructor The actual Java constructor
*/
- JavaConstructor(JavaType type, Constructor<?> constructor) {
+ public JavaConstructor(JavaType type, Constructor<?> constructor) {
super();
this.type = type;
this.constructor = constructor;
}
- private ITypeDeclaration[] buildParameterTypes() {
+ protected ITypeDeclaration[] buildParameterTypes() {
Class<?>[] types = constructor.getParameterTypes();
Type[] genericTypes = constructor.getGenericParameterTypes();
@@ -69,7 +74,7 @@ final class JavaConstructor implements IConstructor {
return typeDeclarations;
}
- private ITypeDeclaration buildTypeDeclaration(Class<?> javaType, Type genericType) {
+ protected ITypeDeclaration buildTypeDeclaration(Class<?> javaType, Type genericType) {
ITypeRepository typeRepository = getTypeRepository();
IType type = typeRepository.getType(javaType);
return new JavaTypeDeclaration(typeRepository, type, genericType, javaType.isArray());
@@ -85,7 +90,7 @@ final class JavaConstructor implements IConstructor {
return parameterTypes;
}
- private ITypeRepository getTypeRepository() {
+ protected ITypeRepository getTypeRepository() {
return type.getTypeRepository();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaType.java
index 517e08caf1..0ffb4ac60f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaType.java
@@ -11,27 +11,33 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
import org.eclipse.persistence.jpa.jpql.spi.IType;
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
+import org.eclipse.persistence.jpa.jpql.util.iterator.CloneIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
/**
* The concrete implementation of {@link IType} that is wrapping a Java type.
*
- * @version 2.3
- * @since 2.3
+ * 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.1
+ * @since 3.0
* @author Pascal Filion
*/
-final class JavaType implements IJpaType {
+public class JavaType implements IJpaType {
/**
* The cached {@link IConstructor IConstructors}.
@@ -69,18 +75,18 @@ final class JavaType implements IJpaType {
* @param typeRepository The external form of a type repository
* @param type The actual Java type wrapped by this class
*/
- JavaType(ITypeRepository typeRepository, Class<?> type) {
+ public JavaType(ITypeRepository typeRepository, Class<?> type) {
super();
this.type = type;
this.typeName = type.getName();
this.typeRepository = typeRepository;
}
- private IConstructor buildConstructor(Constructor<?> constructor) {
+ protected IConstructor buildConstructor(Constructor<?> constructor) {
return new JavaConstructor(this, constructor);
}
- private Collection<IConstructor> buildConstructors() {
+ protected Collection<IConstructor> buildConstructors() {
Constructor<?>[] javaConstructors = type.getDeclaredConstructors();
Collection<IConstructor> constructors = new ArrayList<IConstructor>(javaConstructors.length);
@@ -92,7 +98,7 @@ final class JavaType implements IJpaType {
return constructors;
}
- private String[] buildEnumConstants() {
+ protected String[] buildEnumConstants() {
if (!type.isEnum()) {
return ExpressionTools.EMPTY_STRING_ARRAY;
@@ -111,11 +117,11 @@ final class JavaType implements IJpaType {
/**
* {@inheritDoc}
*/
- public Iterable<IConstructor> constructors() {
+ public IterableIterator<IConstructor> constructors() {
if (constructors == null) {
constructors = buildConstructors();
}
- return Collections.unmodifiableCollection(constructors);
+ return new CloneIterator<IConstructor>(constructors);
}
/**
@@ -155,7 +161,7 @@ final class JavaType implements IJpaType {
*
* @return The actual Java type, if <code>null</code> is returned; then the class could not be resolved
*/
- Class<?> getType() {
+ protected Class<?> getType() {
return type;
}
@@ -174,7 +180,7 @@ final class JavaType implements IJpaType {
*
* @return The repository of {@link IType ITypes}
*/
- ITypeRepository getTypeRepository() {
+ protected ITypeRepository getTypeRepository() {
return typeRepository;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java
index d33231a442..419a657094 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JavaTypeDeclaration.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
@@ -28,15 +28,20 @@ import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
* The concrete implementation of {@link ITypeDeclaration} that is wrapping the representation
* of the declaration description of a type.
*
+ * 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.
+ *
* @see IMapping
* @see IType
*
- * @version 2.3
- * @since 2.3
+ * @version 3.1
+ * @since 3.0
* @author Pascal Filion
*/
@SuppressWarnings("nls")
-final class JavaTypeDeclaration implements ITypeDeclaration {
+public class JavaTypeDeclaration implements ITypeDeclaration {
/**
* Determines whether the type declaration represents an array.
@@ -72,10 +77,10 @@ final class JavaTypeDeclaration implements ITypeDeclaration {
* @param genericType The actual type that contains the generics, if any is present
* @param array Determines whether the type declaration represents an array
*/
- JavaTypeDeclaration(ITypeRepository typeRepository,
- IType type,
- Object genericType,
- boolean array) {
+ public JavaTypeDeclaration(ITypeRepository typeRepository,
+ IType type,
+ Object genericType,
+ boolean array) {
super();
this.type = type;
@@ -84,7 +89,7 @@ final class JavaTypeDeclaration implements ITypeDeclaration {
this.typeRepository = typeRepository;
}
- private String buildArrayTypeName(String arrayTypeName) {
+ protected String buildArrayTypeName(String arrayTypeName) {
StringBuilder sb = new StringBuilder();
int index = arrayTypeName.indexOf('[');
@@ -107,7 +112,7 @@ final class JavaTypeDeclaration implements ITypeDeclaration {
return sb.toString();
}
- private ITypeDeclaration[] buildParameterTypes() {
+ protected ITypeDeclaration[] buildParameterTypes() {
List<ITypeDeclaration> parameterTypes = new ArrayList<ITypeDeclaration>();
@@ -147,7 +152,7 @@ final class JavaTypeDeclaration implements ITypeDeclaration {
return parameterTypes.toArray(new ITypeDeclaration[parameterTypes.size()]);
}
- private JavaTypeDeclaration buildTypeDeclaration(Class<?> javaType) {
+ protected JavaTypeDeclaration buildTypeDeclaration(Class<?> javaType) {
return new JavaTypeDeclaration(
typeRepository,
getType(javaType),
@@ -156,7 +161,7 @@ final class JavaTypeDeclaration implements ITypeDeclaration {
);
}
- private JavaTypeDeclaration buildTypeDeclaration(Object genericType) {
+ protected JavaTypeDeclaration buildTypeDeclaration(Object genericType) {
// <T1, ..., Tn>
if (genericType instanceof ParameterizedType) {
@@ -199,7 +204,7 @@ final class JavaTypeDeclaration implements ITypeDeclaration {
return buildTypeDeclaration((Class<?>) genericType);
}
- private String elementType(String typeName) {
+ protected String elementType(String typeName) {
if (typeName.equals("boolean")) return "Z";
if (typeName.equals("byte")) return "B";
@@ -235,7 +240,7 @@ final class JavaTypeDeclaration implements ITypeDeclaration {
return type;
}
- private IType getType(Class<?> type) {
+ protected IType getType(Class<?> type) {
return typeRepository.getType(type);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaConstructor.java
index 001937bdcc..6dca9bf47a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaConstructor.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
@@ -24,11 +24,16 @@ import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
* The concrete implementation of {@link IConstructor} that is wrapping the design-time
* representation of a Java constructor.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class JpaConstructor implements IConstructor {
+public class JpaConstructor implements IConstructor {
/**
* The design-time representation of a Java constructor.
@@ -52,13 +57,13 @@ final class JpaConstructor implements IConstructor {
* @param type The type owning the constructor
* @param constructor The design-time representation of a Java constructor
*/
- JpaConstructor(JpaType type, IMethodBinding constructor) {
+ public JpaConstructor(JpaType type, IMethodBinding constructor) {
super();
this.type = type;
this.constructor = constructor;
}
- private ITypeDeclaration buildTypeDeclaration(ITypeBinding parameterType) {
+ protected ITypeDeclaration buildTypeDeclaration(ITypeBinding parameterType) {
boolean array = parameterType.isArray();
String typeParameterName;
@@ -108,7 +113,7 @@ final class JpaConstructor implements IConstructor {
);
}
- private ITypeDeclaration[] buildTypeDeclarations() {
+ protected ITypeDeclaration[] buildTypeDeclarations() {
ITypeBinding[] parameterTypes = constructor.getParameterTypes();
ITypeDeclaration[] declarations = new ITypeDeclaration[parameterTypes.length];
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEmbeddable.java
index 2bbf9b4639..cd19c4dc92 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEmbeddable.java
@@ -11,31 +11,43 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.Embeddable;
import org.eclipse.persistence.jpa.jpql.spi.IEmbeddable;
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
/**
* The concrete implementation of {@link IEmbeddable} that is wrapping the design-time
* representation of a JPA embeddable.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class JpaEmbeddable extends JpaManagedType
- implements IEmbeddable {
+public class JpaEmbeddable extends JpaManagedType
+ implements IEmbeddable {
/**
* Creates a new <code>JpaEmbeddable</code>.
*
* @param provider The provider of JPA managed types
* @param embeddable The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
*/
- JpaEmbeddable(JpaManagedTypeProvider provider, Embeddable embeddable) {
- super(provider, embeddable);
+ public JpaEmbeddable(JpaManagedTypeProvider provider,
+ Embeddable embeddable,
+ IMappingBuilder<AttributeMapping> mappingBuilder) {
+
+ super(provider, embeddable, mappingBuilder);
}
/**
@@ -49,7 +61,7 @@ final class JpaEmbeddable extends JpaManagedType
* {@inheritDoc}
*/
@Override
- Embeddable getManagedType() {
+ protected Embeddable getManagedType() {
return (Embeddable) super.getManagedType();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEntity.java
index a3b251f9ed..53d1b45800 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaEntity.java
@@ -11,27 +11,34 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
/**
* The concrete implementation of {@link IEntity} that is wrapping the design-time representation
* of a JPA entity.
*
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class JpaEntity extends JpaManagedType
- implements IEntity {
+public class JpaEntity extends JpaManagedType
+ implements IEntity {
/**
* The cached used to quickly retrieve any queries that have been cached.
@@ -43,9 +50,14 @@ final class JpaEntity extends JpaManagedType
*
* @param provider The provider of JPA managed types
* @param entity The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
*/
- JpaEntity(JpaManagedTypeProvider provider, Entity entity) {
- super(provider, entity);
+ public JpaEntity(JpaManagedTypeProvider provider,
+ Entity entity,
+ IMappingBuilder<AttributeMapping> mappingBuilder) {
+
+ super(provider, entity, mappingBuilder);
}
/**
@@ -55,7 +67,7 @@ final class JpaEntity extends JpaManagedType
visitor.visit(this);
}
- private IQuery buildQuery(JpaManagedTypeProvider provider, NamedQuery namedQuery) {
+ protected IQuery buildQuery(JpaManagedTypeProvider provider, NamedQuery namedQuery) {
return new JpaQuery(provider, namedQuery);
}
@@ -63,7 +75,7 @@ final class JpaEntity extends JpaManagedType
* {@inheritDoc}
*/
@Override
- Entity getManagedType() {
+ protected Entity getManagedType() {
return (Entity) super.getManagedType();
}
@@ -82,21 +94,21 @@ final class JpaEntity extends JpaManagedType
return queries.get(queryName);
}
- private void initializeQueries() {
+ protected void initializeQueries() {
if (queries == null) {
queries = new HashMap<String, IQuery>();
initializeQueries(queries);
}
}
- private void initializeQueries(Map<String, IQuery> queries) {
+ protected void initializeQueries(Map<String, IQuery> queries) {
JpaManagedTypeProvider provider = getProvider();
for (NamedQuery namedQuery : getNamedQueries()) {
queries.put(namedQuery.getName(), buildQuery(provider, namedQuery));
}
}
- private ListIterable<? extends NamedQuery> getNamedQueries() {
+ protected ListIterable<? extends NamedQuery> getNamedQueries() {
return getManagedType().getQueryContainer().getNamedQueries();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedType.java
index 57d78884bc..e769866140 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedType.java
@@ -11,26 +11,33 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
import org.eclipse.persistence.jpa.jpql.spi.IType;
+import org.eclipse.persistence.jpa.jpql.util.iterator.CloneIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
/**
* The abstract definition of {@link IManagedType} defined for wrapping the design-time mapped class
* object.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-abstract class JpaManagedType implements IManagedType {
+public abstract class JpaManagedType implements IManagedType {
/**
* The design-time model object wrapped by this class.
@@ -38,6 +45,12 @@ abstract class JpaManagedType implements IManagedType {
private final TypeMapping managedType;
/**
+ * The builder that is responsible to create the {@link IMapping} wrapping a persistent attribute
+ * or property.
+ */
+ private IMappingBuilder<AttributeMapping> mappingBuilder;
+
+ /**
* The cached collection of {@link IMapping mappings} that prevent rebuilding them every time one
* is requested.
*/
@@ -58,18 +71,37 @@ abstract class JpaManagedType implements IManagedType {
*
* @param managedType The provider of JPA managed types
* @param mappedClass The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
*/
- JpaManagedType(JpaManagedTypeProvider provider, TypeMapping managedType) {
+ protected JpaManagedType(JpaManagedTypeProvider provider,
+ TypeMapping managedType,
+ IMappingBuilder<AttributeMapping> mappingBuilder) {
+
super();
- this.provider = provider;
- this.managedType = managedType;
+ this.provider = provider;
+ this.managedType = managedType;
+ this.mappingBuilder = mappingBuilder;
}
- private IMapping buildMapping(AttributeMapping mapping) {
- return new JpaMapping(this, mapping);
+ /**
+ * Creates the external form that needs to wrap the given {@link AttributeMapping}. By default,
+ * the call is delegated to {@link IMappingBuilder}.
+ *
+ * @param mapping The mapping to wrap with a {@link IMapping}
+ * @return A new concrete instance of {@link IMapping}
+ */
+ protected IMapping buildMapping(AttributeMapping mapping) {
+ return mappingBuilder.buildMapping(this, mapping);
}
- private Map<String, IMapping> buildMappings() {
+ /**
+ * Creates an external form for each {@link AttributeMapping} and stores them by using their
+ * mapping name.
+ *
+ * @return The mappings mapped by their name
+ */
+ protected Map<String, IMapping> buildMappings() {
Map<String, IMapping> mappings = new HashMap<String, IMapping>();
for (AttributeMapping mapping : managedType.getAllAttributeMappings()) {
mappings.put(mapping.getName(), buildMapping(mapping));
@@ -89,14 +121,24 @@ abstract class JpaManagedType implements IManagedType {
*
* @return The managed type wrapped by this external form
*/
- TypeMapping getManagedType() {
+ protected TypeMapping getManagedType() {
return managedType;
}
/**
+ * Returns the builder that is responsible to create the {@link IMapping} wrapping a persistent
+ * attribute or property.
+ *
+ * @return The concrete implementation of {@link IMappingBuilder}
+ */
+ protected IMappingBuilder<AttributeMapping> getMappingBuilder() {
+ return mappingBuilder;
+ }
+
+ /**
* {@inheritDoc}
*/
- public final IMapping getMappingNamed(String name) {
+ public IMapping getMappingNamed(String name) {
initializeMappings();
return mappings.get(name);
}
@@ -104,21 +146,24 @@ abstract class JpaManagedType implements IManagedType {
/**
* {@inheritDoc}
*/
- public final JpaManagedTypeProvider getProvider() {
+ public JpaManagedTypeProvider getProvider() {
return provider;
}
/**
* {@inheritDoc}
*/
- public final IType getType() {
+ public IType getType() {
if (type == null) {
type = provider.getTypeRepository().getType(managedType.getPersistentType().getName());
}
return type;
}
- private void initializeMappings() {
+ /**
+ * Initializes this managed type.
+ */
+ protected void initializeMappings() {
if (mappings == null) {
mappings = buildMappings();
}
@@ -127,8 +172,8 @@ abstract class JpaManagedType implements IManagedType {
/**
* {@inheritDoc}
*/
- public final Iterable<IMapping> mappings() {
+ public IterableIterator<IMapping> mappings() {
initializeMappings();
- return Collections.unmodifiableCollection(mappings.values());
+ return new CloneIterator<IMapping>(mappings.values());
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedTypeProvider.java
index d332d82d54..9f1dc2dd22 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaManagedTypeProvider.java
@@ -11,50 +11,54 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.Map;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.Embeddable;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaProject;
import org.eclipse.persistence.jpa.jpql.spi.IEmbeddable;
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
-import org.eclipse.persistence.jpa.jpql.spi.IJPAVersion;
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
import org.eclipse.persistence.jpa.jpql.spi.IMappedSuperclass;
-import org.eclipse.persistence.jpa.jpql.spi.IPlatform;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
import org.eclipse.persistence.jpa.jpql.spi.IType;
+import org.eclipse.persistence.jpa.jpql.util.iterator.CloneIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
/**
* The abstract implementation of {@link IManagedTypeProvider} that is wrapping the design-time
* representation of a provider of managed types.
*
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-
-//TODO This class has been altered to provide compatibility to Dali 3.0. These changes should be removed in Dali 3.2 stream.
-//class should be final and persistenceTypes() method should be removed.
public class JpaManagedTypeProvider implements IManagedTypeProvider {
/**
- * The filtered collection of managed types that are the abstract schema types.
+ * The filtered collection of managed types that are {@link IEmbeddable}.
*/
- private Collection<IEntity> abstractSchemaTypes;
+ private Collection<IEmbeddable> embeddables;
+
+ /**
+ * The filtered collection of managed types that are the entities.
+ */
+ private Collection<IEntity> entities;
/**
* The project that gives access to the application's metadata.
@@ -67,6 +71,17 @@ public class JpaManagedTypeProvider implements IManagedTypeProvider {
private Map<String, IManagedType> managedTypes;
/**
+ * The filtered collection of managed types that are {@link IMappedSuperclass}.
+ */
+ private Collection<IMappedSuperclass> mappedSuperclasses;
+
+ /**
+ * The builder that is responsible to create the {@link IMapping} wrapping a persistent attribute
+ * or property.
+ */
+ private IMappingBuilder<AttributeMapping> mappingBuilder;
+
+ /**
* The design-time provider of managed types.
*/
private final PersistentTypeContainer persistentTypeContainer;
@@ -77,61 +92,49 @@ public class JpaManagedTypeProvider implements IManagedTypeProvider {
private JpaTypeRepository typeRepository;
/**
- * The version of the Java Persistence this entity for which it was defined.
- */
- private IJPAVersion version;
-
- /**
* Creates a new <code>JpaManagedTypeProvider</code>.
*
* @param jpaProject The project that gives access to the application's metadata
* @param persistentTypeContainer The design-time provider of managed types
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
*/
public JpaManagedTypeProvider(JpaProject jpaProject,
- PersistentTypeContainer persistentTypeContainer) {
+ PersistentTypeContainer persistentTypeContainer,
+ IMappingBuilder<AttributeMapping> mappingBuilder) {
super();
this.jpaProject = jpaProject;
+ this.mappingBuilder = mappingBuilder;
this.persistentTypeContainer = persistentTypeContainer;
}
- /**
- * {@inheritDoc}
- */
- public Iterable<IEntity> abstractSchemaTypes() {
- if (abstractSchemaTypes == null) {
- initializeManagedTypes();
- EntityCollector visitor = new EntityCollector();
- for (IManagedType managedType : managedTypes.values()) {
- managedType.accept(visitor);
- }
- abstractSchemaTypes = visitor.entities;
- }
- return Collections.unmodifiableCollection(abstractSchemaTypes);
- }
-
-// abstract JpaEntity buildEntity(TypeMapping mappedClass);
-
- private IManagedType buildManagedType(PersistentType persistentType) {
+ protected IManagedType buildManagedType(PersistentType persistentType) {
TypeMapping mappedClass = persistentType.getMapping();
if (mappedClass instanceof Entity) {
- return new JpaEntity(this, (Entity) mappedClass);
+ JpaEntity entity = new JpaEntity(this, (Entity) mappedClass, mappingBuilder);
+ entities.add(entity);
+ return entity;
}
if (mappedClass instanceof MappedSuperclass) {
- return new JpaMappedSuperclass(this, (MappedSuperclass) mappedClass);
+ JpaMappedSuperclass mappedSuperclass = new JpaMappedSuperclass(this, (MappedSuperclass) mappedClass, mappingBuilder);
+ mappedSuperclasses.add(mappedSuperclass);
+ return mappedSuperclass;
}
if (mappedClass instanceof Embeddable) {
- return new JpaEmbeddable(this, (Embeddable) mappedClass);
+ JpaEmbeddable embeddable = new JpaEmbeddable(this, (Embeddable) mappedClass, mappingBuilder);
+ embeddables.add(embeddable);
+ return embeddable;
}
return new JpaNullManagedType(this, mappedClass);
}
- private Map<String, IManagedType> buildManagedTypes() {
+ protected Map<String, IManagedType> buildManagedTypes() {
Map<String, IManagedType> managedTypes = new HashMap<String, IManagedType>();
@@ -153,26 +156,65 @@ public class JpaManagedTypeProvider implements IManagedTypeProvider {
return managedTypes;
}
- private IJPAVersion convert(JpaPlatform.Version version) {
+ /**
+ * {@inheritDoc}
+ */
+ public IterableIterator<IEntity> entities() {
+ initializeManagedTypes();
+ return new CloneIterator<IEntity>(entities);
+ }
- String jpaVersion = version.getJpaVersion();
+ /**
+ * {@inheritDoc}
+ */
+ public IEmbeddable getEmbeddable(IType type) {
+ return getEmbeddable(type.getName());
+ }
- if (JpaFacet.VERSION_1_0.getVersionString().equals(jpaVersion)) {
- return IJPAVersion.VERSION_1_0;
- }
+ /**
+ * {@inheritDoc}
+ */
+ public IEmbeddable getEmbeddable(String typeName) {
+ return getManagedType(embeddables, typeName);
+ }
- return IJPAVersion.VERSION_2_0;
+ /**
+ * {@inheritDoc}
+ */
+ public IEntity getEntity(IType type) {
+ return getEntity(type.getName());
}
/**
* {@inheritDoc}
*/
- public IManagedType getManagedType(IType type) {
+ public IEntity getEntity(String typeName) {
+ return getManagedType(entities, typeName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IEntity getEntityNamed(String entityName) {
+
+ initializeManagedTypes();
+
+ for (IEntity entity : entities) {
+ if (entity.getName().equals(entityName)) {
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+ protected <T extends IManagedType> T getManagedType(Collection<T> managedTypes,
+ String typeName) {
initializeManagedTypes();
- for (IManagedType managedType : managedTypes.values()) {
- if (managedType.getType() == type) {
+ for (T managedType : managedTypes) {
+ if (managedType.getType().getName().equals(typeName)) {
return managedType;
}
}
@@ -183,25 +225,38 @@ public class JpaManagedTypeProvider implements IManagedTypeProvider {
/**
* {@inheritDoc}
*/
- public IManagedType getManagedType(String abstractSchemaName) {
- initializeManagedTypes();
- return managedTypes.get(abstractSchemaName);
+ public IManagedType getManagedType(IType type) {
+ return getManagedType(type.getName());
}
/**
- * Returns the container of managed types.
- *
- * @return The container of managed types
+ * {@inheritDoc}
*/
- PersistentTypeContainer getPersistentTypeContainer() {
- return persistentTypeContainer;
+ public IManagedType getManagedType(String typeName) {
+ return getManagedType(managedTypes.values(), typeName);
}
/**
* {@inheritDoc}
*/
- public IPlatform getPlatform() {
- return (jpaProject instanceof GenericJpaProject) ? IPlatform.JAVA : IPlatform.ECLIPSE_LINK;
+ public IMappedSuperclass getMappedSuperclass(IType type) {
+ return getMappedSuperclass(type.getName());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IMappedSuperclass getMappedSuperclass(String typeName) {
+ return getManagedType(mappedSuperclasses, typeName);
+ }
+
+ /**
+ * Returns the container of managed types.
+ *
+ * @return The container of managed types
+ */
+ public PersistentTypeContainer getPersistentTypeContainer() {
+ return persistentTypeContainer;
}
/**
@@ -209,7 +264,7 @@ public class JpaManagedTypeProvider implements IManagedTypeProvider {
*
* @return The design-time representation of a managed type provider
*/
- PersistentTypeContainer getProvider() {
+ protected PersistentTypeContainer getProvider() {
return persistentTypeContainer;
}
@@ -223,71 +278,20 @@ public class JpaManagedTypeProvider implements IManagedTypeProvider {
return typeRepository;
}
- /**
- * {@inheritDoc}
- */
- public IJPAVersion getVersion() {
- if (version == null) {
- version = convert(jpaProject.getJpaPlatform().getJpaVersion());
- }
- return version;
- }
-
- private void initializeManagedTypes() {
+ protected void initializeManagedTypes() {
if (managedTypes == null) {
- managedTypes = buildManagedTypes();
+ this.entities = new LinkedList<IEntity>();
+ this.embeddables = new LinkedList<IEmbeddable>();
+ this.mappedSuperclasses = new LinkedList<IMappedSuperclass>();
+ this.managedTypes = buildManagedTypes();
}
}
/**
* {@inheritDoc}
*/
- public Iterable<IManagedType> managedTypes() {
+ public IterableIterator<IManagedType> managedTypes() {
initializeManagedTypes();
- return Collections.unmodifiableCollection(managedTypes.values());
- }
-
- /**
- * Retrieves the managed types from the design-time provider.
- *
- * @return The managed types that are defined only in the provider
- */
- Iterable<? extends PersistentType> persistenceTypes(){
- return this.persistentTypeContainer.getPersistentTypes();
- }
-
- private static class EntityCollector implements IManagedTypeVisitor {
-
- /**
- * The collection of {@link IEntity entities} that got visited.
- */
- private final Collection<IEntity> entities;
-
- /**
- * Creates a new <code>EntityCollector</code>.
- */
- EntityCollector() {
- super();
- entities = new ArrayList<IEntity>();
- }
-
- /**
- * {@inheritDoc}
- */
- public void visit(IEmbeddable embeddable) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void visit(IEntity entity) {
- entities.add(entity);
- }
-
- /**
- * {@inheritDoc}
- */
- public void visit(IMappedSuperclass mappedSuperclass) {
- }
+ return new CloneIterator<IManagedType>(managedTypes.values());
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMappedSuperclass.java
index 3f40e32af5..17187cdd39 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMappedSuperclass.java
@@ -11,31 +11,43 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
import org.eclipse.persistence.jpa.jpql.spi.IMappedSuperclass;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
/**
* The concrete implementation of {@link IMappedSuperclass} that is wrapping the design-time
* representation of a JPA mapped superclass.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class JpaMappedSuperclass extends JpaManagedType
- implements IMappedSuperclass {
+public class JpaMappedSuperclass extends JpaManagedType
+ implements IMappedSuperclass {
/**
* Creates a new <code>JpaMappedSuperclass</code>.
*
* @param provider The provider of JPA managed types
* @param mappedSuperclass The design-time model object wrapped by this class
+ * @param mappingBuilder The builder that is responsible to create the {@link IMapping} wrapping
+ * a persistent attribute or property
*/
- JpaMappedSuperclass(JpaManagedTypeProvider provider, MappedSuperclass mappedSuperclass) {
- super(provider, mappedSuperclass);
+ public JpaMappedSuperclass(JpaManagedTypeProvider provider,
+ MappedSuperclass mappedSuperclass,
+ IMappingBuilder<AttributeMapping> mappingBuilder) {
+
+ super(provider, mappedSuperclass, mappingBuilder);
}
/**
@@ -49,7 +61,7 @@ final class JpaMappedSuperclass extends JpaManagedType
* {@inheritDoc}
*/
@Override
- MappedSuperclass getManagedType() {
+ protected MappedSuperclass getManagedType() {
return (MappedSuperclass) super.getManagedType();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMapping.java
index 8152bbdf67..b012aacc3e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaMapping.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.lang.annotation.Annotation;
import java.util.List;
@@ -26,20 +26,27 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
-import org.eclipse.persistence.jpa.jpql.spi.IMappingType;
import org.eclipse.persistence.jpa.jpql.spi.IType;
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
+
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.*;
/**
* The concrete implementation of {@link IMapping} that is wrapping the design-time representation
* of a mapping.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
@SuppressWarnings("nls")
-final class JpaMapping implements IMapping {
+public abstract class JpaMapping implements IMapping {
/**
* The design-time {@link AttributeMapping} wrapped by this class.
@@ -49,12 +56,12 @@ final class JpaMapping implements IMapping {
/**
* The type of the actual mapping.
*/
- private IMappingType mappingType;
+ private int mappingType;
/**
* The parent of this mapping.
*/
- private final JpaManagedType parent;
+ private final IManagedType parent;
/**
* The {@link IType} of the property represented by the mapping.
@@ -72,20 +79,21 @@ final class JpaMapping implements IMapping {
* @param parent The parent of this mapping
* @param mapping The design-time {@link AttributeMapping} wrapped by this class
*/
- JpaMapping(JpaManagedType parent, AttributeMapping mapping) {
+ protected JpaMapping(IManagedType parent, AttributeMapping mapping) {
super();
- this.parent = parent;
- this.mapping = mapping;
+ this.parent = parent;
+ this.mapping = mapping;
+ this.mappingType = -1;
}
- private ITypeDeclaration[] buildGenericTypeDeclarations() {
+ protected ITypeDeclaration[] buildGenericTypeDeclarations() {
JavaPersistentAttribute javaPersistentAttribute = mapping.getPersistentAttribute().getJavaPersistentAttribute();
JavaResourceAttribute resource = javaPersistentAttribute.getResourceAttribute();
List<ITypeDeclaration> declarations = CollectionTools.list(buildGenericTypeDeclarations(resource));
return declarations.toArray(new ITypeDeclaration[declarations.size()]);
}
- private Iterable<ITypeDeclaration> buildGenericTypeDeclarations(JavaResourceAttribute resource) {
+ protected Iterable<ITypeDeclaration> buildGenericTypeDeclarations(JavaResourceAttribute resource) {
return new TransformationIterable<String, ITypeDeclaration>(resource.getTypeTypeArgumentNames()) {
@Override
protected ITypeDeclaration transform(String next) {
@@ -94,7 +102,7 @@ final class JpaMapping implements IMapping {
};
}
- private ITypeDeclaration buildTypeDeclaration() {
+ protected ITypeDeclaration buildTypeDeclaration() {
PersistentAttribute property = mapping.getPersistentAttribute();
boolean array = property.getTypeName().endsWith("[]");
@@ -112,6 +120,69 @@ final class JpaMapping implements IMapping {
}
/**
+ * Calculates the type of the persistent attribute represented by this external form.
+ *
+ * @return The mapping type, which is one of the constants defined in {@link org.eclipse.
+ * persistence.jpa.jpql.spi.IMappingType IMappingType} when the provider is generic JPA
+ */
+ protected int calculateMappingType() {
+
+ String type = mapping.getKey();
+
+ // Basic
+ if (type == MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
+ return BASIC;
+ }
+
+ // Embedded
+ if (type == MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
+ return EMBEDDED;
+ }
+
+ // Embedded Id
+ if (type == MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
+ return EMBEDDED_ID;
+ }
+
+ // Id
+ if (type == MappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
+ return ID;
+ }
+
+ // M:M
+ if (type == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ return MANY_TO_MANY;
+ }
+
+ // 1:M
+ if (type == MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ return ONE_TO_MANY;
+ }
+
+ // M:1
+ if (type == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ return MANY_TO_ONE;
+ }
+
+ // 1:1
+ if (type == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ return ONE_TO_ONE;
+ }
+
+ // Version
+ if (type == MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
+ return VERSION;
+ }
+
+ // Element Collection
+ if (type == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
+ return ELEMENT_COLLECTION;
+ }
+
+ return TRANSIENT;
+ }
+
+ /**
* {@inheritDoc}
*/
public int compareTo(IMapping mapping) {
@@ -119,12 +190,21 @@ final class JpaMapping implements IMapping {
}
/**
+ * Returns
+ *
+ * @return
+ */
+ protected AttributeMapping getMapping() {
+ return mapping;
+ }
+
+ /**
* {@inheritDoc}
*/
- public IMappingType getMappingType() {
- if (mappingType == null) {
+ public int getMappingType() {
+ if (mappingType == -1) {
getTypeDeclaration();
- mappingType = mappingType();
+ mappingType = calculateMappingType();
}
return mappingType;
}
@@ -164,7 +244,7 @@ final class JpaMapping implements IMapping {
return typeDeclaration;
}
- private JpaTypeRepository getTypeRepository() {
+ protected ITypeRepository getTypeRepository() {
return parent.getProvider().getTypeRepository();
}
@@ -176,81 +256,50 @@ final class JpaMapping implements IMapping {
return attribute.getAnnotation(annotationType.getName()) != null;
}
- private IMappingType mappingType() {
-
- String type = mapping.getKey();
-
- // Basic
- if (type == MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.BASIC;
- }
-
- // Embedded
- if (type == MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.EMBEDDED;
- }
-
- // Embedded Id
- if (type == MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.EMBEDDED_ID;
- }
-
- // Id
- if (type == MappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ID;
- }
-
- // M:M
- if (type == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.MANY_TO_MANY;
- }
-
- // 1:M
- if (type == MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ONE_TO_MANY;
- }
-
- // M:1
- if (type == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.MANY_TO_ONE;
- }
-
- // 1:1
- if (type == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ONE_TO_ONE;
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isCollection() {
+ switch (getMappingType()) {
+ case ELEMENT_COLLECTION:
+ case MANY_TO_MANY:
+ case ONE_TO_MANY: return true;
+ default: return false;
}
+ }
- // Version
- if (type == MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.VERSION;
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isProperty() {
+ switch (getMappingType()) {
+ case BASIC:
+ case ID:
+ case VERSION: return true;
+ default: return false;
}
+ }
- // Element Collection
- if (type == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ELEMENT_COLLECTION;
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isRelationship() {
+ switch (getMappingType()) {
+ case ELEMENT_COLLECTION:
+ case EMBEDDED_ID:
+ case MANY_TO_MANY:
+ case MANY_TO_ONE:
+ case ONE_TO_MANY:
+ case ONE_TO_ONE: return true;
+ default: return false;
}
+ }
- // Basic Collection
-// if (type == EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.BASIC_COLLECTION;
-// }
-//
-// // Basic Map
-// if (type == EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.BASIC_MAP;
-// }
-//
-// // Transformation
-// if (type == EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.TRANSFORMATION;
-// }
-//
-// // Variable 1:1
-// if (type == EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.VARIABLE_ONE_TO_ONE;
-// }
-
- return IMappingType.TRANSIENT;
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isTransient() {
+ return getMappingType() == TRANSIENT;
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaNullManagedType.java
index fcb6384435..86272628e4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaNullManagedType.java
@@ -11,25 +11,31 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
import org.eclipse.persistence.jpa.jpql.spi.IType;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.NullIterator;
/**
* The concrete implementation of {@link IManagedType} that is wrapping the design-time
* representation a "null" managed type.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class JpaNullManagedType implements IManagedType {
+public class JpaNullManagedType implements IManagedType {
/**
* The provider of JPA managed types.
@@ -52,7 +58,7 @@ final class JpaNullManagedType implements IManagedType {
* @param managedType The provider of JPA managed types
* @param typeMapping The design-time model object wrapped by this class
*/
- JpaNullManagedType(JpaManagedTypeProvider provider, TypeMapping typeMapping) {
+ public JpaNullManagedType(JpaManagedTypeProvider provider, TypeMapping typeMapping) {
super();
this.provider = provider;
this.typeMapping = typeMapping;
@@ -98,8 +104,8 @@ final class JpaNullManagedType implements IManagedType {
/**
* {@inheritDoc}
*/
- public Iterable<IMapping> mappings() {
- return EmptyIterable.instance();
+ public IterableIterator<IMapping> mappings() {
+ return NullIterator.instance();
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaQuery.java
index 33ffb130ed..901f7116ab 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaQuery.java
@@ -11,22 +11,28 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
import org.eclipse.persistence.jpa.jpql.spi.IQuery;
/**
* The concrete implementation of {@link IQuery} that is wrapping the design-time representation
* of a JPQL query.
*
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
@SuppressWarnings("nls")
-public final class JpaQuery implements IQuery {
+public class JpaQuery implements IQuery {
/**
* The actual JPQL query, which can differ from the one owned by the model object, which happens
@@ -37,7 +43,7 @@ public final class JpaQuery implements IQuery {
/**
* The provider of managed types.
*/
- private JpaManagedTypeProvider provider;
+ private IManagedTypeProvider provider;
/**
* The model object holding onto the JPQL query.
@@ -50,7 +56,7 @@ public final class JpaQuery implements IQuery {
* @param provider The provider of managed types
* @param query The model object of the JPQL query
*/
- public JpaQuery(JpaManagedTypeProvider provider, NamedQuery query) {
+ public JpaQuery(IManagedTypeProvider provider, NamedQuery query) {
this(provider, query, query.getQuery());
}
@@ -62,7 +68,7 @@ public final class JpaQuery implements IQuery {
* @param actualQuery The actual JPQL query, which can differ from the one owned by the model
* object, which happens when the model is out of sync because it has not been updated yet
*/
- JpaQuery(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
+ public JpaQuery(IManagedTypeProvider provider, NamedQuery query, String actualQuery) {
super();
initialize(provider, query, actualQuery);
}
@@ -77,7 +83,7 @@ public final class JpaQuery implements IQuery {
/**
* {@inheritDoc}
*/
- public JpaManagedTypeProvider getProvider() {
+ public IManagedTypeProvider getProvider() {
return provider;
}
@@ -86,11 +92,11 @@ public final class JpaQuery implements IQuery {
*
* @return The design-time representation of a JPQL query
*/
- NamedQuery getQuery() {
+ protected NamedQuery getQuery() {
return query;
}
- private void initialize(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
+ protected void initialize(IManagedTypeProvider provider, NamedQuery query, String actualQuery) {
this.query = query;
this.provider = provider;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
index 3e12d029c6..461bc7b0bf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
@@ -43,16 +43,23 @@ import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.util.iterator.CloneIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
/**
* The concrete implementation of {@link org.eclipse.persistence.jpa.query.spi.IType IType} that is
* wrapping the design-time representation of a Java type.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class JpaType implements IJpaType {
+public class JpaType implements IJpaType {
/**
* The cached collection of {@link IConstructor constructors}.
@@ -108,14 +115,14 @@ final class JpaType implements IJpaType {
* @param typeRepository The external form of a type repository
* @param type The design-time representation of a Java type
*/
- JpaType(JpaTypeRepository typeRepository, IType type) {
+ public JpaType(JpaTypeRepository typeRepository, IType type) {
super();
this.type = type;
this.typeName = type.getFullyQualifiedName();
this.typeRepository = typeRepository;
}
- private CompilationUnit buildCompilationUnit() {
+ protected CompilationUnit buildCompilationUnit() {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(type.getTypeRoot());
@@ -126,7 +133,7 @@ final class JpaType implements IJpaType {
return (CompilationUnit) parser.createAST(new NullProgressMonitor());
}
- private Collection<IConstructor> buildConstructors() {
+ protected Collection<IConstructor> buildConstructors() {
ITypeBinding typeBinding = getTypeBinding();
@@ -174,7 +181,7 @@ final class JpaType implements IJpaType {
return Collections.emptyList();
}
- private String[] buildEnumConstants() {
+ protected String[] buildEnumConstants() {
try {
// Retrieve the enum constants from IType
@@ -197,7 +204,7 @@ final class JpaType implements IJpaType {
return ExpressionTools.EMPTY_STRING_ARRAY;
}
- private ITypeBinding buildTypeBinding() {
+ protected ITypeBinding buildTypeBinding() {
// This code was copied from ASTNodes.getTypeBinding(CompilationUnit, IType)
try {
@@ -243,18 +250,18 @@ final class JpaType implements IJpaType {
return null;
}
- private ITypeDeclaration buildTypeDeclaration() {
+ protected ITypeDeclaration buildTypeDeclaration() {
return new JpaTypeDeclaration(this, new ITypeDeclaration[0]);
}
/**
* {@inheritDoc}
*/
- public Iterable<IConstructor> constructors() {
+ public IterableIterator<IConstructor> constructors() {
if (constructors == null) {
constructors = buildConstructors();
}
- return constructors;
+ return new CloneIterator<IConstructor>(constructors);
}
/**
@@ -289,7 +296,7 @@ final class JpaType implements IJpaType {
return typeName;
}
- private ASTNode getParent(ASTNode node, Class<? extends ASTNode> parentClass) {
+ protected ASTNode getParent(ASTNode node, Class<? extends ASTNode> parentClass) {
do {
node = node.getParent();
@@ -304,11 +311,11 @@ final class JpaType implements IJpaType {
*
* @return The design-time representation of a Java type
*/
- IType getType() {
+ protected IType getType() {
return type;
}
- private ITypeBinding getTypeBinding() {
+ protected ITypeBinding getTypeBinding() {
if ((typeBinding == null) && !typeBindingResolved) {
typeBinding = buildTypeBinding();
typeBindingResolved = true;
@@ -331,7 +338,7 @@ final class JpaType implements IJpaType {
*
* @return The external form of the type repository
*/
- JpaTypeRepository getTypeRepository() {
+ protected JpaTypeRepository getTypeRepository() {
return typeRepository;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeDeclaration.java
index 7927bb9d3f..dda053c5c2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeDeclaration.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import org.eclipse.persistence.jpa.jpql.spi.IType;
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
@@ -20,11 +20,16 @@ import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
* The concrete implementation of {@link ITypeDeclaration} that is wrapping the design-time
* representation of the declaration description of a type.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class JpaTypeDeclaration implements ITypeDeclaration {
+public class JpaTypeDeclaration implements ITypeDeclaration {
/**
* The dimensionality of the array or 0 if the type is not an array.
@@ -48,7 +53,7 @@ final class JpaTypeDeclaration implements ITypeDeclaration {
* @param genericTypes The generics of the given type or an empty list if the type is not
* parameterized
*/
- JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes) {
+ public JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes) {
this(type, genericTypes, 0);
}
@@ -60,7 +65,7 @@ final class JpaTypeDeclaration implements ITypeDeclaration {
* parameterized
* @param dimensionality The dimensionality of the array or 0 if it's not an array
*/
- JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes, int dimensionality) {
+ public JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes, int dimensionality) {
super();
this.type = type;
this.genericTypes = genericTypes;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeRepository.java
index ece1dbd131..67dfa83b5b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaTypeRepository.java
@@ -11,7 +11,7 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.util.HashMap;
import java.util.Map;
@@ -28,12 +28,17 @@ import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
* The concrete implementation of {@link ITypeRepository} that is wrapping the design-time
* representation of a type repository.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
@SuppressWarnings("nls")
-final class JpaTypeRepository implements ITypeRepository {
+public class JpaTypeRepository implements ITypeRepository {
/**
* The Java project that gives access the design-time objects representing the Java types.
@@ -67,13 +72,13 @@ final class JpaTypeRepository implements ITypeRepository {
* @param javaProject The Java project that gives access the design-time objects representing
* the Java types
*/
- JpaTypeRepository(IJavaProject javaProject) {
+ public JpaTypeRepository(IJavaProject javaProject) {
super();
this.javaProject = javaProject;
this.types = new HashMap<String, IJpaType>();
}
- private String buildInnerTypeName(String typeName, int index) {
+ protected String buildInnerTypeName(String typeName, int index) {
StringBuilder sb = new StringBuilder();
sb.append(typeName.substring(0, index));
sb.append("$");
@@ -81,7 +86,7 @@ final class JpaTypeRepository implements ITypeRepository {
return sb.toString();
}
- private Map<String, Class<?>> buildPrimitives() {
+ protected Map<String, Class<?>> buildPrimitives() {
Map<String, Class<?>> primitives = new HashMap<String, Class<?>>();
primitives.put(Byte .TYPE.getName(), Byte .TYPE);
primitives.put(Short .TYPE.getName(), Short .TYPE);
@@ -94,25 +99,25 @@ final class JpaTypeRepository implements ITypeRepository {
return primitives;
}
- private IJpaType buildType(Class<?> javaType) {
+ protected IJpaType buildType(Class<?> javaType) {
JavaType jpaType = new JavaType(this, javaType);
types.put(jpaType.getName(), jpaType);
return jpaType;
}
- private IJpaType buildType(IType type) {
+ protected IJpaType buildType(IType type) {
JpaType jpaType = new JpaType(this, type);
types.put(jpaType.getName(), jpaType);
return jpaType;
}
- private IJpaType buildType(String typeName) {
+ protected IJpaType buildType(String typeName) {
IJpaType jpaType = new SimpleType(this, typeName);
types.put(typeName, jpaType);
return jpaType;
}
- private String convertToJavaArrayType(String typeName) {
+ protected String convertToJavaArrayType(String typeName) {
int index = typeName.indexOf("[]");
int dimensionality = (typeName.length() - index) / 2;
@@ -159,7 +164,7 @@ final class JpaTypeRepository implements ITypeRepository {
return sb.toString();
}
- private Class<?> findPrimitive(String typeName) {
+ protected Class<?> findPrimitive(String typeName) {
if (primitives == null) {
primitives = buildPrimitives();
}
@@ -173,7 +178,7 @@ final class JpaTypeRepository implements ITypeRepository {
* @param typeName The fully qualified type name
* @return The design-time Java type if it could be retrieved; <code>null</code> otherwise
*/
- IType findType(String typeName) {
+ protected IType findType(String typeName) {
try {
return javaProject.findType(typeName);
}
@@ -216,7 +221,7 @@ final class JpaTypeRepository implements ITypeRepository {
*
* @return The Java project, which gives access to the class path
*/
- IJavaProject getJavaProject() {
+ protected IJavaProject getJavaProject() {
return javaProject;
}
@@ -237,7 +242,7 @@ final class JpaTypeRepository implements ITypeRepository {
* @param resource The workspace location of the {@link IType} to retrieve
* @return The design-time representation of a Java type
*/
- IType getType(IResource resource) {
+ protected IType getType(IResource resource) {
try {
return (IType) javaProject.findElement((IPath) resource);
}
@@ -276,7 +281,7 @@ final class JpaTypeRepository implements ITypeRepository {
return typeHelper;
}
- private IJpaType loadArrayType(String typeName) {
+ protected IJpaType loadArrayType(String typeName) {
IJpaType type = types.get(typeName);
@@ -305,7 +310,7 @@ final class JpaTypeRepository implements ITypeRepository {
return type;
}
- private IJpaType loadInnerType(String typeName) {
+ protected IJpaType loadInnerType(String typeName) {
while (true) {
@@ -332,7 +337,7 @@ final class JpaTypeRepository implements ITypeRepository {
}
}
- private IJpaType loadJavaArrayType(String typeName) {
+ protected IJpaType loadJavaArrayType(String typeName) {
IJpaType type = types.get(typeName);
@@ -360,7 +365,7 @@ final class JpaTypeRepository implements ITypeRepository {
return type;
}
- private IJpaType loadTypeImp(String typeName) {
+ protected IJpaType loadTypeImp(String typeName) {
IJpaType type = types.get(typeName);
@@ -395,7 +400,7 @@ final class JpaTypeRepository implements ITypeRepository {
return type;
}
- private IJpaType unresolvableType() {
+ protected IJpaType unresolvableType() {
if (unresolvableType == null) {
unresolvableType = new SimpleType(this, IJpaType.UNRESOLVABLE_TYPE);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/SimpleType.java
index b30248266e..0719161dae 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/SimpleType.java
@@ -11,23 +11,29 @@
* Oracle - initial API and implementation
*
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
+package org.eclipse.jpt.jpa.core.jpql.spi;
import java.lang.annotation.Annotation;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
import org.eclipse.persistence.jpa.jpql.spi.IType;
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
+import org.eclipse.persistence.jpa.jpql.util.iterator.IterableIterator;
+import org.eclipse.persistence.jpa.jpql.util.iterator.NullIterator;
/**
* The concrete implementation of {@link IType} that is wrapping the type name only.
*
- * @version 3.0
+ * 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.1
* @since 3.0
* @author Pascal Filion
*/
-final class SimpleType implements IJpaType {
+public class SimpleType implements IJpaType {
/**
* Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time.
@@ -49,7 +55,7 @@ final class SimpleType implements IJpaType {
*
* @param typeName The fully qualified name of the Java type
*/
- SimpleType(JpaTypeRepository typeRepository, String typeName) {
+ public SimpleType(JpaTypeRepository typeRepository, String typeName) {
super();
this.typeRepository = typeRepository;
this.typeName = typeName;
@@ -58,8 +64,8 @@ final class SimpleType implements IJpaType {
/**
* {@inheritDoc}
*/
- public Iterable<IConstructor> constructors() {
- return EmptyIterable.instance();
+ public IterableIterator<IConstructor> constructors() {
+ return NullIterator.instance();
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath
index 90eb4c9f25..6e71931eb8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath
@@ -5,6 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/jpa/eclipselink/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/jpa/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF
index 526bc557f9..8cf0f01e2e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.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.jpt.common.utility;bundle-version="[2.0.0,3.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.402,2.0.0)",
+ org.eclipse.persistence.jpa.jpql;bundle-version="[2.0.0,3.0.0)",
org.eclipse.text;bundle-version="[3.5.0,4.0.0)",
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)",
@@ -49,6 +50,7 @@ Export-Package: org.eclipse.jpt.jpa.eclipselink.core,
org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.binary;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.source;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.internal.resource.orm;x-internal:=true,
+ org.eclipse.jpt.jpa.eclipselink.core.jpql.spi,
org.eclipse.jpt.jpa.eclipselink.core.platform,
org.eclipse.jpt.jpa.eclipselink.core.resource.java,
org.eclipse.jpt.jpa.eclipselink.core.resource.orm,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLinkJpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLinkJpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..b36f56141c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLinkJpaJpqlQueryHelper.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.eclipselink.core.jpql.spi.EclipseLinkMappingBuilder;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+import org.eclipse.jpt.jpa.core.jpql.spi.JpaManagedTypeProvider;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.persistence.jpa.jpql.AbstractContentAssistVisitor;
+import org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator;
+import org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator;
+import org.eclipse.persistence.jpa.jpql.EclipseLinkContentAssistVisitor;
+import org.eclipse.persistence.jpa.jpql.EclipseLinkGrammarValidator;
+import org.eclipse.persistence.jpa.jpql.EclipseLinkJPQLQueryContext;
+import org.eclipse.persistence.jpa.jpql.EclipseLinkSemanticValidator;
+import org.eclipse.persistence.jpa.jpql.JPQLQueryContext;
+import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
+
+/**
+ * The abstract implementation of {@link JpaJpqlQueryHelper} that supports EclipseLink.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public abstract class AbstractEclipseLinkJpaJpqlQueryHelper extends JpaJpqlQueryHelper {
+
+ /**
+ * Creates a new <code>AbstractEclipseLinkJpaJpqlQueryHelper</code>.
+ *
+ * @param jpqlGrammar The grammar that defines how to parse a JPQL query
+ */
+ protected AbstractEclipseLinkJpaJpqlQueryHelper(JPQLGrammar jpqlGrammar) {
+ super(jpqlGrammar);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractContentAssistVisitor buildContentAssistVisitor(JPQLQueryContext queryContext) {
+ return new EclipseLinkContentAssistVisitor(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractGrammarValidator buildGrammarValidator(JPQLQueryContext queryContext) {
+ return new EclipseLinkGrammarValidator(queryContext);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected JPQLQueryContext buildJPQLQueryContext(JPQLGrammar jpqlGrammar) {
+ return new EclipseLinkJPQLQueryContext(jpqlGrammar);
+ }
+
+ protected IMappingBuilder<AttributeMapping> buildMappingBuilder() {
+ return new EclipseLinkMappingBuilder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JpaManagedTypeProvider buildProvider(NamedQuery query) {
+ return new JpaManagedTypeProvider(
+ query.getJpaProject(),
+ query.getPersistenceUnit(),
+ buildMappingBuilder()
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractSemanticValidator buildSemanticValidator(JPQLQueryContext queryContext) {
+ return new EclipseLinkSemanticValidator(queryContext);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..b2bb50c880
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
+
+/**
+ * The EclipseLink 1.1 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink1_1JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink1_1JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLink1_1JpaJpqlQueryHelper</code>.
+ */
+ private EclipseLink1_1JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
index 452c6b9bfc..84c3d31263 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -33,24 +33,25 @@ public class EclipseLink1_1JpaPlatformFactory
public EclipseLink1_1JpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLinkJpaFactory(),
+ new EclipseLinkJpaFactory(),
buildAnnotationProvider(),
- EclipseLink1_1JpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ EclipseLink1_1JpaPlatformProvider.instance(),
+ buildJpaPlatformVariation(),
+ EclipseLink1_1JpaJpqlQueryHelper.instance());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
GenericJpaAnnotationDefinitionProvider.instance(),
EclipseLinkJpaAnnotationDefinitionProvider.instance());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -61,7 +62,7 @@ public class EclipseLink1_1JpaPlatformFactory
}
};
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_1,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..6aa2b5add5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
+
+/**
+ * The EclipseLink 1.2 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink1_2JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink1_2JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLink1_2JpaJpqlQueryHelper</code>.
+ */
+ private EclipseLink1_2JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
index ceaf168d89..42bb704f41 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -33,25 +33,26 @@ public class EclipseLink1_2JpaPlatformFactory
public EclipseLink1_2JpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLinkJpaFactory(),
+ new EclipseLinkJpaFactory(),
buildAnnotationProvider(),
- EclipseLink1_2JpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ EclipseLink1_2JpaPlatformProvider.instance(),
+ buildJpaPlatformVariation(),
+ EclipseLink1_2JpaJpqlQueryHelper.instance());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
GenericJpaAnnotationDefinitionProvider.instance(),
EclipseLinkJpaAnnotationDefinitionProvider.instance(),
EclipseLink1_2JpaAnnotationDefinitionProvider.instance());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -62,7 +63,7 @@ public class EclipseLink1_2JpaPlatformFactory
}
};
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_2,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..e8f4128e1d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_0;
+
+/**
+ * The EclipseLink 2.0 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_0JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_0JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLink2_0JpaJpqlQueryHelper</code>.
+ */
+ private EclipseLink2_0JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_0.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
index 412486fc13..898397b9a4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
*******************************************************************************/
@@ -38,18 +38,19 @@ public class EclipseLink2_0JpaPlatformFactory
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
this.buildAnnotationProvider(),
- EclipseLink2_0JpaPlatformProvider.instance(),
- this.buildJpaVariation());
+ EclipseLink2_0JpaPlatformProvider.instance(),
+ this.buildJpaVariation(),
+ EclipseLink2_0JpaJpqlQueryHelper.instance());
}
-
+
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_0,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..443560da55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_1;
+
+/**
+ * The EclipseLink 2.1 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_1JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_1JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLink2_1JpaJpqlQueryHelper</code>.
+ */
+ private EclipseLink2_1JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
index fcd0abf99f..e8bf3a029c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
+ * Copyright (c) 2010, 2011 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -28,40 +28,41 @@ public class EclipseLink2_1JpaPlatformFactory
public EclipseLink2_1JpaPlatformFactory() {
super();
}
-
-
+
+
@Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
this.buildAnnotationProvider(),
- EclipseLink2_1JpaPlatformProvider.instance(),
- this.buildJpaVariation());
+ EclipseLink2_1JpaPlatformProvider.instance(),
+ this.buildJpaVariation(),
+ EclipseLink2_1JpaJpqlQueryHelper.instance());
}
-
+
@Override
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
@Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_1JpaAnnotationDefinitionProvider.instance());
}
-
+
// @Override
// protected JpaPlatformVariation buildJpaVariation() {
// return new JpaPlatformVariation() {
// public Supported getTablePerConcreteClassInheritanceIsSupported() {
// return Supported.YES;
// }
-//
+//
// public boolean isJoinTableOverridable() {
// return true;
// }
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..762e694583
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_2;
+
+/**
+ * The EclipseLink 2.2 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_2JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_2JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLink2_2JpaJpqlQueryHelper</code>.
+ */
+ private EclipseLink2_2JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_2.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
index e0760dcc53..0f239825ba 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
+ * Copyright (c) 2010, 2011 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -28,40 +28,41 @@ public class EclipseLink2_2JpaPlatformFactory
public EclipseLink2_2JpaPlatformFactory() {
super();
}
-
-
+
+
@Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
this.buildAnnotationProvider(),
- EclipseLink2_2JpaPlatformProvider.instance(),
- this.buildJpaVariation());
+ EclipseLink2_2JpaPlatformProvider.instance(),
+ this.buildJpaVariation(),
+ EclipseLink2_2JpaJpqlQueryHelper.instance());
}
-
+
@Override
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_2,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
@Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_2JpaAnnotationDefinitionProvider.instance());
}
-
+
// @Override
// protected JpaPlatformVariation buildJpaVariation() {
// return new JpaPlatformVariation() {
// public Supported getTablePerConcreteClassInheritanceIsSupported() {
// return Supported.YES;
// }
-//
+//
// public boolean isJoinTableOverridable() {
// return true;
// }
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..206936e1b0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_3;
+
+/**
+ * The EclipseLink 2.3 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_3JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_3JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLink2_3JpaJpqlQueryHelper</code>.
+ */
+ private EclipseLink2_3JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_3.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
index 3ef604182f..eab5437766 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
@@ -3,8 +3,8 @@
* 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -21,33 +21,34 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFacto
public class EclipseLink2_3JpaPlatformFactory
extends EclipseLink2_0JpaPlatformFactory {
-
+
/**
* zero-argument constructor
*/
public EclipseLink2_3JpaPlatformFactory() {
super();
}
-
-
+
+
@Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
buildAnnotationProvider(),
- EclipseLink2_3JpaPlatformProvider.instance(),
- buildJpaVariation());
+ EclipseLink2_3JpaPlatformProvider.instance(),
+ buildJpaVariation(),
+ EclipseLink2_3JpaJpqlQueryHelper.instance());
}
-
+
@Override
protected JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_3,
JpaFacet.VERSION_2_0.getVersionString());
}
-
+
@Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..980a41636f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_4;
+
+/**
+ * The EclipseLink 2.4 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class EclipseLink2_4JpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLink2_4JpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLink2_4JpaJpqlQueryHelper</code>.
+ */
+ private EclipseLink2_4JpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar2_4.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
index 76f8db01cc..c2dc4abfb7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
@@ -3,8 +3,8 @@
* 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:
+ *
+ * Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
@@ -35,10 +35,11 @@ public class EclipseLink2_4JpaPlatformFactory
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLink2_0JpaFactory(),
+ new EclipseLink2_0JpaFactory(),
buildAnnotationProvider(),
- EclipseLink2_4JpaPlatformProvider.instance(),
- buildJpaVariation());
+ EclipseLink2_4JpaPlatformProvider.instance(),
+ buildJpaVariation(),
+ EclipseLink2_4JpaJpqlQueryHelper.instance());
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..0bc8f32318
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaJpqlQueryHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.internal;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
+import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
+
+/**
+ * The EclipseLink 1.0 implementation of {@link JpaJpqlQueryHelper}.
+ *
+ * @version 2.4
+ * @since 2.4
+ * @author Pascal Filion
+ */
+public class EclipseLinkJpaJpqlQueryHelper extends AbstractEclipseLinkJpaJpqlQueryHelper {
+
+ /**
+ * The singleton instance of this helper.
+ */
+ private static final JpaJpqlQueryHelper INSTANCE = new EclipseLinkJpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>EclipseLinkJpaJpqlQueryHelper</code>.
+ */
+ private EclipseLinkJpaJpqlQueryHelper() {
+ super(EclipseLinkJPQLGrammar1.instance());
+ }
+
+ /**
+ * Returns the singleton instance of this helper.
+ *
+ * @return The singleton instance of this helper
+ */
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
index 5b510eebc0..011b6dc46c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -16,9 +16,9 @@ import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
@@ -36,29 +36,30 @@ public class EclipseLinkJpaPlatformFactory
public EclipseLinkJpaPlatformFactory() {
super();
}
-
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new EclipseLinkJpaFactory(),
- buildAnnotationProvider(),
- EclipseLinkJpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ new EclipseLinkJpaFactory(),
+ buildAnnotationProvider(),
+ EclipseLinkJpaPlatformProvider.instance(),
+ buildJpaPlatformVariation(),
+ EclipseLinkJpaJpqlQueryHelper.instance());
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new EclipseLinkVersion(
JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_0,
JpaFacet.VERSION_1_0.getVersionString());
}
-
+
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
GenericJpaAnnotationDefinitionProvider.instance(),
EclipseLinkJpaAnnotationDefinitionProvider.instance());
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -85,7 +86,7 @@ public class EclipseLinkJpaPlatformFactory
public String getVersion() {
return this.eclipseLinkVersion;
}
-
+
/**
* Return whether the platform is compatible with the specified EclipseLink version.
* @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java
new file mode 100644
index 0000000000..d39bc2b6ee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMapping.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.jpql.spi.JpaMapping;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+
+import static org.eclipse.persistence.jpa.jpql.spi.IEclipseLinkMappingType.*;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.*;
+
+/**
+ * The EclipseLink implementation of Hermes' {@link IMapping}, which adds EclipseLink specific
+ * mapping support.
+ *
+ * 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.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+@SuppressWarnings("unused" /* For the extra import statement, see bug 330740 */)
+public class EclipseLinkMapping extends JpaMapping {
+
+ /**
+ * Creates a new <code>EclipseLinkMapping</code>.
+ *
+ * @param parent The parent of this mapping
+ * @param mapping The design-time {@link AttributeMapping} wrapped by this class
+ */
+ public EclipseLinkMapping(IManagedType parent, AttributeMapping mapping) {
+ super(parent, mapping);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected int calculateMappingType() {
+
+ String type = getMapping().getKey();
+
+ // Basic Collection
+ if (type == EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
+ return BASIC_COLLECTION;
+ }
+
+ // Basic Map
+ if (type == EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY) {
+ return BASIC_MAP;
+ }
+
+ // Transformation
+ if (type == EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY) {
+ return TRANSFORMATION;
+ }
+
+ // Variable 1:1
+ if (type == EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ return VARIABLE_ONE_TO_ONE;
+ }
+
+ return super.calculateMappingType();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isCollection() {
+ switch (getMappingType()) {
+ case BASIC_COLLECTION:
+ case BASIC_MAP:
+ case ELEMENT_COLLECTION:
+ case MANY_TO_MANY:
+ case ONE_TO_MANY: return true;
+ default: return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isRelationship() {
+ switch (getMappingType()) {
+ case ELEMENT_COLLECTION:
+ case EMBEDDED_ID:
+ case MANY_TO_MANY:
+ case MANY_TO_ONE:
+ case ONE_TO_MANY:
+ case ONE_TO_ONE:
+ case VARIABLE_ONE_TO_ONE: return true;
+ default: return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java
new file mode 100644
index 0000000000..9e21d20087
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/jpql/spi/EclipseLinkMappingBuilder.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.eclipselink.core.jpql.spi;
+
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
+import org.eclipse.persistence.jpa.jpql.spi.IMapping;
+import org.eclipse.persistence.jpa.jpql.spi.IMappingBuilder;
+
+/**
+ * An implementation of {@link IMappingBuilder} that creates the EclipseLink version of Hermes's
+ * {@link IMapping}.
+ *
+ * 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 2.4
+ * @since 2.4
+ * @author Pascal Filion
+ */
+public class EclipseLinkMappingBuilder implements IMappingBuilder<AttributeMapping> {
+
+ /**
+ * Creates a new <code>EclipseLinkMappingBuilder</code>.
+ */
+ public EclipseLinkMappingBuilder() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IMapping buildMapping(IManagedType parent, AttributeMapping value) {
+ return new EclipseLinkMapping(parent, value);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
index 678761d693..18c3ab1397 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
@@ -32,7 +32,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jst.common.project.facet.ui;bundle-version="[1.3.100,2.0.0)",
org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)",
org.eclipse.jst.j2ee.ui;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.persistence.jpa.jpql;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.persistence.jpa.jpql;bundle-version="[2.0.0,3.0.0)",
org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.3.100,4.0.0)",
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
index 7f6301b8e9..c7c4d5c3fb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
@@ -417,8 +417,10 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
}
private void disposeQueryHelper() {
- queryHelper.dispose();
- queryHelper.disposeProvider();
+ if (queryHelper != null) {
+ queryHelper.dispose();
+ queryHelper.disposeProvider();
+ }
}
private KeyStroke findContentAssistTrigger() {
@@ -550,11 +552,14 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
private void subjectChanged(PropertyChangeEvent e) {
- // Disposes of the internal data since the subject changed
disposeQueryHelper();
// Prevent undoing the actual query that was set
if (e.getNewValue() != null) {
+
+ namedQuery = (NamedQuery) e.getNewValue();
+ queryHelper = namedQuery.getJpaProject().getJpaPlatform().getJpqlQueryHelper();
+
sourceViewer.getUndoManager().reset();
validate();
}
@@ -568,29 +573,35 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
*/
private void validate() {
- NamedQuery query = query();
+ // First clear any existing problems
annotationModel.removeAllAnnotations();
- if ((query != null) && !styledText.isDisposed()) {
- try {
- String jpqlQuery = styledText.getText();
- queryHelper.setQuery(query, jpqlQuery);
- String parsedJpqlQuery = queryHelper.getParsedJPQLQuery();
+ // Nothing to validate
+ if ((query() == null) ||
+ styledText.isDisposed() ||
+ StringTools.stringIsEmpty(styledText.getText())) {
- for (JPQLQueryProblem problem : sortProblems(queryHelper.validate())) {
+ return;
+ }
- // Create the range
- int[] positions = queryHelper.buildPositions(problem, parsedJpqlQuery, jpqlQuery);
+ try {
+ String jpqlQuery = styledText.getText();
+ queryHelper.setQuery(query(), jpqlQuery);
+ String parsedJpqlQuery = queryHelper.getParsedJPQLQuery();
- // Add the problem to the tool tip
- Annotation annotation = new Annotation(ERROR_TYPE, true, buildMessage(problem));
- annotationModel.addAnnotation(annotation, new Position(positions[0], positions[1] - positions[0]));
- }
- }
- finally {
- queryHelper.dispose();
+ for (JPQLQueryProblem problem : sortProblems(queryHelper.validate())) {
+
+ // Create the range
+ int[] positions = queryHelper.buildPositions(problem, parsedJpqlQuery, jpqlQuery);
+
+ // Add the problem to the tool tip
+ Annotation annotation = new Annotation(ERROR_TYPE, true, buildMessage(problem));
+ annotationModel.addAnnotation(annotation, new Position(positions[0], positions[1] - positions[0]));
}
}
+ finally {
+ queryHelper.dispose();
+ }
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
index a6afab7c0c..bea30857c3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
@@ -13,6 +13,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.jpql;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@@ -21,29 +23,27 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
-import org.eclipse.persistence.jpa.internal.jpql.WordParser;
-import org.eclipse.persistence.jpa.internal.jpql.parser.Expression;
-import org.eclipse.persistence.jpa.internal.jpql.parser.IdentifierRole;
-import org.eclipse.persistence.jpa.internal.jpql.parser.JPQLExpression;
import org.eclipse.persistence.jpa.jpql.ContentAssistProposals;
+import org.eclipse.persistence.jpa.jpql.WordParser;
+import org.eclipse.persistence.jpa.jpql.parser.Expression;
+import org.eclipse.persistence.jpa.jpql.parser.IdentifierRole;
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import static org.eclipse.jpt.common.utility.internal.CollectionTools.*;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.*;
/**
* The abstract definition of JPQL content assist support.
*
- * @version 3.0
+ * @version 3.1
* @since 3.0
* @author Pascal Filion
*/
-@SuppressWarnings({"nls", "restriction"})
+@SuppressWarnings("nls")
abstract class JpqlCompletionProposalComputer<T> {
/**
@@ -91,14 +91,13 @@ abstract class JpqlCompletionProposalComputer<T> {
* This helper is responsible to retrieve the possible proposals to complete or to add more
* information to a JPQL based on the position of the cursor.
*/
- final JpaJpqlQueryHelper queryHelper;
+ JpaJpqlQueryHelper queryHelper;
/**
* Creates a new <code>JpqlCompletionProposalComputer</code>.
*/
public JpqlCompletionProposalComputer() {
super();
- queryHelper = new JpaJpqlQueryHelper();
}
/**
@@ -188,7 +187,7 @@ abstract class JpqlCompletionProposalComputer<T> {
private T buildIdentifierProposal(String proposal) {
String additionalInfo = additionalInfo(proposal);
- IdentifierRole role = JPQLExpression.identifierRole(proposal);
+ IdentifierRole role = queryHelper.getQueryContext().getExpressionRegistry().getIdentifierRole(proposal);
boolean realFunction = (role == IdentifierRole.FUNCTION) && isRealFunction(proposal);
int cursorOffset = 0;
@@ -265,6 +264,7 @@ abstract class JpqlCompletionProposalComputer<T> {
this.offset = offset;
this.actualQuery = actualQuery;
this.namedQuery = namedQuery;
+ this.queryHelper = namedQuery.getJpaProject().getJpaPlatform().getJpqlQueryHelper();
// It's possible the string has literal representation of the escape characters, if required,
// convert them into actual escape characters and adjust the position accordingly
@@ -273,17 +273,21 @@ abstract class JpqlCompletionProposalComputer<T> {
this.position = positions[0];
this.partialWord = partialWord();
- // Gather the possible proposals
- this.queryHelper.setQuery(namedQuery, jpqlQuery);
- this.contentAssistProposals = queryHelper.buildContentAssistProposals(positions[0]);
- this.queryHelper.dispose();
-
- // Create the proposals for those proposals
List<T> proposals = new ArrayList<T>();
- addAbstractSchemaNames (proposals);
- addIdentificationVariables(proposals);
- addIdentifiers (proposals);
- addMappings (proposals);
+
+ try {
+ this.queryHelper.setQuery(namedQuery, jpqlQuery);
+ this.contentAssistProposals = queryHelper.buildContentAssistProposals(positions[0]);
+
+ // Create the proposals for those proposals
+ addAbstractSchemaNames (proposals);
+ addIdentificationVariables(proposals);
+ addIdentifiers (proposals);
+ addMappings (proposals);
+ }
+ finally {
+ this.queryHelper.dispose();
+ }
return proposals;
}
@@ -367,8 +371,8 @@ abstract class JpqlCompletionProposalComputer<T> {
private Image mappingImage(IMapping mapping) {
switch (mapping.getMappingType()) {
case BASIC: return getImage(JptUiIcons.BASIC);
- case BASIC_COLLECTION: return getImage(JptUiIcons.ELEMENT_COLLECTION);
- case BASIC_MAP: return getImage(JptUiIcons.ELEMENT_COLLECTION);
+// case BASIC_COLLECTION: return getImage(JptUiIcons.ELEMENT_COLLECTION);
+// case BASIC_MAP: return getImage(JptUiIcons.ELEMENT_COLLECTION);
case ELEMENT_COLLECTION: return getImage(JptUiIcons.ELEMENT_COLLECTION);
case EMBEDDED: return getImage(JptUiIcons.EMBEDDED);
case EMBEDDED_ID: return getImage(JptUiIcons.EMBEDDED_ID);
@@ -377,8 +381,8 @@ abstract class JpqlCompletionProposalComputer<T> {
case MANY_TO_ONE: return getImage(JptUiIcons.MANY_TO_ONE);
case ONE_TO_MANY: return getImage(JptUiIcons.ONE_TO_MANY);
case ONE_TO_ONE: return getImage(JptUiIcons.ONE_TO_ONE);
- case TRANSFORMATION: return getImage(JptUiIcons.BASIC); // TODO
- case VARIABLE_ONE_TO_ONE: return getImage(JptUiIcons.ONE_TO_ONE); // TODO
+// case TRANSFORMATION: return getImage(JptUiIcons.BASIC); // TODO
+// case VARIABLE_ONE_TO_ONE: return getImage(JptUiIcons.ONE_TO_ONE); // TODO
case VERSION: return getImage(JptUiIcons.VERSION);
default: return getImage(JptUiIcons.TRANSIENT);
}
@@ -407,7 +411,10 @@ abstract class JpqlCompletionProposalComputer<T> {
*/
public void sessionEnded() {
- queryHelper.disposeProvider();
+ if (queryHelper != null) {
+ queryHelper.disposeProvider();
+ }
+
clearInformation();
if (imageRegistry != null) {
@@ -431,6 +438,10 @@ abstract class JpqlCompletionProposalComputer<T> {
return JptJpaUiPlugin.JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE.equals(value);
}
+ private <I extends Comparable<? super I>> Iterable<I> sort(Iterable<I> iterator) {
+ return CollectionTools.sort(iterator);
+ }
+
private Iterable<IEntity> sortByNames(Iterable<IEntity> abstractSchemaTypes) {
return CollectionTools.sort(abstractSchemaTypes, buildEntityNameComparator());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlIdentifierMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlIdentifierMessages.java
index e3739def27..a8e66038c3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlIdentifierMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlIdentifierMessages.java
@@ -17,16 +17,16 @@ import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.persistence.jpa.internal.jpql.parser.Expression;
+import org.eclipse.persistence.jpa.jpql.parser.Expression;
/**
* The localized messages describing the JPQL identifiers.
*
- * @version 3.0
+ * @version 3.1
* @since 3.0
* @author Pascal Filion
*/
-@SuppressWarnings({"nls", "restriction"})
+@SuppressWarnings("nls")
final class JpqlIdentifierMessages extends NLS {
// JPA 1.0 identifiers
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
index 5720562bec..79f0917d2d 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.jpt.jpa.gen,
org.eclipse.jpt.jpa.db,
org.eclipse.jpt.common.utility,
+ org.eclipse.persistence.jpa.jpql,
org.eclipse.swt,
org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.validation
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaJpqlQueryHelper.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaJpqlQueryHelper.java
new file mode 100644
index 0000000000..c14292c265
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaJpqlQueryHelper.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+import org.eclipse.jpt.jpa.core.jpql.spi.JpaManagedTypeProvider;
+
+import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.persistence.jpa.jpql.AbstractContentAssistVisitor;
+import org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator;
+import org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator;
+import org.eclipse.persistence.jpa.jpql.JPQLQueryContext;
+import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar;
+import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar2_0;
+
+/**
+ * @version 3.1
+ * @since 3.1
+ * @author Pascal Filion
+ */
+public class TestJpaJpqlQueryHelper extends JpaJpqlQueryHelper {
+
+ private static final JpaJpqlQueryHelper INSTANCE = new TestJpaJpqlQueryHelper();
+
+ /**
+ * Creates a new <code>TestJpaJpqlQueryHelper</code>.
+ */
+ public TestJpaJpqlQueryHelper() {
+ super(JPQLGrammar2_0.instance());
+ }
+
+ public static JpaJpqlQueryHelper instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractContentAssistVisitor buildContentAssistVisitor(JPQLQueryContext queryContext) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractGrammarValidator buildGrammarValidator(JPQLQueryContext queryContext) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected JPQLQueryContext buildJPQLQueryContext(JPQLGrammar jpqlGrammar) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JpaManagedTypeProvider buildProvider(NamedQuery query) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected AbstractSemanticValidator buildSemanticValidator(JPQLQueryContext queryContext) {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
index 754eeeb007..5dc1eb4e3b 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -14,9 +14,9 @@ import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
/**
* All the state in the JPA platform should be "static" (i.e. unchanging once
@@ -32,18 +32,19 @@ public class TestJpaPlatformFactory
public TestJpaPlatformFactory() {
super();
}
-
-
+
+
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
buildJpaVersion(),
- new TestJpaFactory(),
- new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
+ new TestJpaFactory(),
+ new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
TestJpaPlatformProvider.instance(),
- buildJpaPlatformVariation());
+ buildJpaPlatformVariation(),
+ TestJpaJpqlQueryHelper.instance());
}
-
+
private JpaPlatform.Version buildJpaVersion() {
return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString()) {
@Override
@@ -52,7 +53,7 @@ public class TestJpaPlatformFactory
}
};
}
-
+
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {

Back to the top