Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2010-03-04 02:54:15 +0000
committertle2010-03-04 02:54:15 +0000
commitc89333fb30a55b0f43f5a7a71e7d1db1365c1998 (patch)
treeaec4cbe3654c2f22bbc704776cf9f867bc5c8c45
parent6656e47220f791712110d04085c6a987e40be0bf (diff)
downloadwebtools.dali-c89333fb30a55b0f43f5a7a71e7d1db1365c1998.tar.gz
webtools.dali-c89333fb30a55b0f43f5a7a71e7d1db1365c1998.tar.xz
webtools.dali-c89333fb30a55b0f43f5a7a71e7d1db1365c1998.zip
294077 [JPA 2.0] Add validation for usage of EclipseLink entity caching properties
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties5
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java27
4 files changed, 43 insertions, 7 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
index f804ee701f..9c1e269a1a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -1443,9 +1443,10 @@ public abstract class AbstractPersistenceUnit
@Override
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
- validateMappingFiles(messages, reporter);
- validateClassRefs(messages, reporter);
- validateJarFileRefs(messages, reporter);
+ this.validateMappingFiles(messages, reporter);
+ this.validateClassRefs(messages, reporter);
+ this.validateJarFileRefs(messages, reporter);
+ this.validateProperties(messages, reporter);
}
protected void validateMappingFiles(List<IMessage> messages, IReporter reporter) {
@@ -1574,6 +1575,11 @@ public abstract class AbstractPersistenceUnit
}
};
}
+
+ @SuppressWarnings("unused")
+ protected void validateProperties(List<IMessage> messages, IReporter reporter) {
+ // do nothing by default
+ }
// ********** misc **********
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties
index 12df2233e2..ad0d3d7f02 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2008 Oracle. All rights reserved.
+# Copyright (c) 2008, 2010 Oracle. All rights reserved.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0, which accompanies this distribution
# and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,4 +11,5 @@
CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED=The @Cache annotation on entity \"{0}\" has both expiry() and expiryTimeOfDay() specified. Only one of the two may be specified
CONVERTER_CLASS_IMPLEMENTS_CONVERTER=The converter class \"{0}\" does not implement the org.eclipse.persistence.mappings.converters.Converter interface
CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER=The customizer class \"{0}\" does not implement the org.eclipse.persistence.config.DescriptorCustomizer interface
-MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE=Multiple object values are specified for the data value \"{0}\" \ No newline at end of file
+MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE=Multiple object values are specified for the data value \"{0}\"
+PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING=\"{0}\" is a legacy entity caching property. Consider migration to JPA 2.0 and EclipseLink cache settings via annotation or XML mapping file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java
index 352eaa4aae..460c2485b1 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -21,5 +21,7 @@ public interface EclipseLinkJpaValidationMessages {
public static final String CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER = "CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER";
public static final String MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE = "MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE";
-
+
+ public static final String PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING = "PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING";
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
index 74a5b68cb9..b0d81f3a04 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
@@ -15,6 +15,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
+
import org.eclipse.jpt.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit;
@@ -31,6 +32,8 @@ import org.eclipse.jpt.eclipselink.core.context.persistence.general.GeneralPrope
import org.eclipse.jpt.eclipselink.core.context.persistence.logging.Logging;
import org.eclipse.jpt.eclipselink.core.context.persistence.options.Options;
import org.eclipse.jpt.eclipselink.core.context.persistence.schema.generation.SchemaGeneration;
+import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.EclipseLinkCaching;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.EclipseLinkCustomization;
@@ -42,6 +45,8 @@ import org.eclipse.jpt.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
/**
* EclipseLink persistence unit
@@ -392,5 +397,27 @@ public class EclipseLinkPersistenceUnit
protected void convertersUpdated() {
fireListChanged(CONVERTERS_LIST, this.converters);
}
+
+ // ********** validation **********
+
+ @Override
+ protected void validateProperties(List<IMessage> messages, IReporter reporter) {
+
+ if(this.isJpa2_0Compatible()) {
+ Iterator<Property> properties = this.propertiesWithNamePrefix("eclipselink.cache.type."); //$NON-NLS-1$
+
+ if(properties.hasNext()) {
+ Property property = properties.next();
+ messages.add(
+ DefaultEclipseLinkJpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ EclipseLinkJpaValidationMessages.PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING,
+ new String[] {property.getName()},
+ this.getPersistenceUnit()
+ )
+ );
+ }
+ }
+ }
}

Back to the top