diff options
author | tle | 2008-12-23 19:40:54 +0000 |
---|---|---|
committer | tle | 2008-12-23 19:40:54 +0000 |
commit | d558aac29b15ba14c711d01e8d6c04a0baafb941 (patch) | |
tree | 90a40e9969cb853e1e434bd088733ae8d390eb83 /jpa/plugins | |
parent | 3cbfc2a5fa8ac98f7d2f695a6bdfda9452adf80c (diff) | |
download | webtools.dali-d558aac29b15ba14c711d01e8d6c04a0baafb941.tar.gz webtools.dali-d558aac29b15ba14c711d01e8d6c04a0baafb941.tar.xz webtools.dali-d558aac29b15ba14c711d01e8d6c04a0baafb941.zip |
228213 - EclipseLink persistence.xml - other properties not supported
Diffstat (limited to 'jpa/plugins')
14 files changed, 624 insertions, 18 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java index 1c4cac45ed..e1d9cb238f 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java @@ -66,6 +66,14 @@ public interface Caching extends PersistenceUnitProperties static final String ECLIPSELINK_SHARED_CACHE = "eclipselink.cache.shared."; static final Boolean DEFAULT_SHARED_CACHE = Boolean.TRUE; + FlushClearCache getDefaultFlushClearCache(); + FlushClearCache getFlushClearCache(); + void setFlushClearCache(FlushClearCache newFlushClearCache); + static final String FLUSH_CLEAR_CACHE_PROPERTY = "flushClearCacheProperty"; + // EclipseLink key string + static final String ECLIPSELINK_FLUSH_CLEAR_CACHE = "eclipselink.flush-clear.cache"; + static final FlushClearCache DEFAULT_FLUSH_CLEAR_CACHE = FlushClearCache.drop_invalidate; + ListIterator<String> entities(); int entitiesSize(); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java index 1252760ab1..1f23223917 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java @@ -30,11 +30,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties private CacheType cacheTypeDefault; private Integer cacheSizeDefault; private Boolean sharedCacheDefault; + private FlushClearCache flushClearCache; // key = Entity name ; value = Cache properties private Map<String, CacheProperties> entitiesCacheProperties; - - private static final long serialVersionUID = 1L; // ********** constructors ********** public EclipseLinkCaching(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { @@ -56,6 +55,8 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties this.getIntegerValue(ECLIPSELINK_CACHE_SIZE_DEFAULT); this.sharedCacheDefault = this.getBooleanValue(ECLIPSELINK_CACHE_SHARED_DEFAULT); + this.flushClearCache = + this.getEnumValue(ECLIPSELINK_FLUSH_CLEAR_CACHE, FlushClearCache.values()); Set<Property> cacheTypeProperties = this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_TYPE); @@ -108,6 +109,9 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties propertyNames.put( ECLIPSELINK_CACHE_SHARED_DEFAULT, SHARED_CACHE_DEFAULT_PROPERTY); + propertyNames.put( + ECLIPSELINK_FLUSH_CLEAR_CACHE, + FLUSH_CLEAR_CACHE_PROPERTY); // Don't need to initialize propertyNames for: // cacheType, sharedCache, cacheSize @@ -173,6 +177,9 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties else if (aspectName.equals(SHARED_CACHE_PROPERTY)) { this.sharedCacheChanged(event); } + else if (aspectName.equals(FLUSH_CLEAR_CACHE_PROPERTY)) { + this.flushClearCacheChanged(event); + } else { throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); } @@ -326,6 +333,31 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties return DEFAULT_SHARED_CACHE_DEFAULT; } + // ********** FlushClearCache ********** + + public FlushClearCache getFlushClearCache() { + return this.flushClearCache; + } + + public void setFlushClearCache(FlushClearCache newFlushClearCache) { + FlushClearCache old = this.flushClearCache; + this.flushClearCache = newFlushClearCache; + this.putProperty(FLUSH_CLEAR_CACHE_PROPERTY, newFlushClearCache); + this.firePropertyChanged(FLUSH_CLEAR_CACHE_PROPERTY, old, newFlushClearCache); + } + + private void flushClearCacheChanged(PropertyChangeEvent event) { + String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); + FlushClearCache newValue = getEnumValueOf(stringValue, FlushClearCache.values()); + FlushClearCache old = this.flushClearCache; + this.flushClearCache = newValue; + this.firePropertyChanged(event.getAspectName(), old, newValue); + } + + public FlushClearCache getDefaultFlushClearCache() { + return DEFAULT_FLUSH_CLEAR_CACHE; + } + // ****** CacheProperties ******* /** * Convenience method to update the CacheType in entitiesCache map. Returns diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/FlushClearCache.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/FlushClearCache.java new file mode 100644 index 0000000000..c29a27f718 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/FlushClearCache.java @@ -0,0 +1,24 @@ +/******************************************************************************* +* Copyright (c) 2008 Oracle. All rights reserved. +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v1.0, which accompanies this distribution +* and is available at http://www.eclipse.org/legal/epl-v10.html. +* +* Contributors: +* Oracle - initial API and implementation +*******************************************************************************/ +package org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching; + +/** + * FlushClearCache + */ +public enum FlushClearCache { + drop, + drop_invalidate, + merge; + + // EclipseLink value string + public static final String DROP = "Drop"; + public static final String DROP_INVALIDATE = "DropInvalidate"; + public static final String MERGE = "Merge"; +} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java index 238f411d7f..cb503b2d66 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java @@ -110,4 +110,28 @@ public interface Customization extends PersistenceUnitProperties static final String DEFAULT_PROFILER = EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(Profiler.no_profiler); + Boolean getDefaultValidationOnly(); + Boolean getValidationOnly(); + void setValidationOnly(Boolean newValidationOnly); + static final String VALIDATION_ONLY_PROPERTY = "validationOnlyProperty"; + // EclipseLink key string + static final String ECLIPSELINK_VALIDATION_ONLY = "eclipselink.validation-only"; + static final Boolean DEFAULT_VALIDATION_ONLY = Boolean.TRUE; + + String getDefaultClassLoader(); + String getClassLoader(); + void setClassLoader(String newClassLoader); + static final String CLASSLOADER_PROPERTY = "classLoaderProperty"; + // EclipseLink key string + static final String ECLIPSELINK_CLASSLOADER = "eclipselink.classloader"; + static final String DEFAULT_CLASSLOADER = null; // no default + + String getDefaultExceptionHandler(); + String getExceptionHandler(); + void setExceptionHandler(String newExceptionHandler); + static final String EXCEPTION_HANDLER_PROPERTY = "exceptionHandlerProperty"; + // EclipseLink key string + static final String ECLIPSELINK_EXCEPTION_HANDLER = "eclipselink.exception-handler"; + static final String DEFAULT_EXCEPTION_HANDLER = null; // no default + } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java index 6a7ca4c363..93febd010b 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java @@ -39,14 +39,15 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti private Boolean weavingFetchGroups; private Boolean weavingInternal; private Boolean weavingEager; + private Boolean validationOnly; private ArrayList<ClassRef> sessionCustomizers; private String profiler; // storing EclipseLinkStringValue since value can be Profiler or custom class + private String classLoader; + private String exceptionHandler; // key = Entity name ; value = Customizer properties private Map<String, CustomizerProperties> entitiesCustomizerProperties; - private static final long serialVersionUID = 1L; - // ********** constructors ********** public EclipseLinkCustomization(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { super(parent, propertyListAdapter); @@ -76,6 +77,8 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti this.getBooleanValue(ECLIPSELINK_WEAVING_INTERNAL); this.weavingEager = this.getBooleanValue(ECLIPSELINK_WEAVING_EAGER); + this.validationOnly = + this.getBooleanValue(ECLIPSELINK_VALIDATION_ONLY); this.initializeSessionCustomizersFromPersistenceUnit(); Set<Property> properties = @@ -83,6 +86,10 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti this.initializeEntitiesCustomizerClass(properties); this.profiler = this.getProfilerProtertyValue(); + this.classLoader = + this.getStringValue(ECLIPSELINK_CLASSLOADER); + this.exceptionHandler = + this.getStringValue(ECLIPSELINK_EXCEPTION_HANDLER); } private void initializeSessionCustomizersFromPersistenceUnit() { @@ -166,11 +173,20 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti ECLIPSELINK_WEAVING_EAGER, WEAVING_EAGER_PROPERTY); propertyNames.put( + ECLIPSELINK_VALIDATION_ONLY, + VALIDATION_ONLY_PROPERTY); + propertyNames.put( ECLIPSELINK_SESSION_CUSTOMIZER, SESSION_CUSTOMIZER_PROPERTY); propertyNames.put( ECLIPSELINK_PROFILER, PROFILER_PROPERTY); + propertyNames.put( + ECLIPSELINK_CLASSLOADER, + CLASSLOADER_PROPERTY); + propertyNames.put( + ECLIPSELINK_EXCEPTION_HANDLER, + EXCEPTION_HANDLER_PROPERTY); // Don't need to initialize propertyNames for: // descriptorCustomizerProperty @@ -231,6 +247,9 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti else if (aspectName.equals(WEAVING_EAGER_PROPERTY)) { this.weavingEagerChanged(event); } + else if (aspectName.equals(VALIDATION_ONLY_PROPERTY)) { + this.validationOnlyChanged(event); + } else if (aspectName.equals(SESSION_CUSTOMIZER_PROPERTY)) { this.sessionCustomizersChanged(event); } @@ -240,6 +259,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti else if (aspectName.equals(PROFILER_PROPERTY)) { this.profilerChanged(event); } + else if (aspectName.equals(CLASSLOADER_PROPERTY)) { + this.classLoaderChanged(event); + } + else if (aspectName.equals(EXCEPTION_HANDLER_PROPERTY)) { + this.exceptionHandlerChanged(event); + } else { throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); } @@ -397,6 +422,31 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti return DEFAULT_WEAVING_EAGER; } + // ********** ValidationOnly ********** + public Boolean getValidationOnly() { + return this.validationOnly; + } + + public void setValidationOnly(Boolean newValidationOnly) { + Boolean old = this.validationOnly; + this.validationOnly = newValidationOnly; + this.putProperty(VALIDATION_ONLY_PROPERTY, newValidationOnly); + this.firePropertyChanged(VALIDATION_ONLY_PROPERTY, old, newValidationOnly); + } + + private void validationOnlyChanged(PropertyChangeEvent event) { + String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); + Boolean newValue = getBooleanValueOf(stringValue); + + Boolean old = this.validationOnly; + this.validationOnly = newValue; + this.firePropertyChanged(event.getAspectName(), old, newValue); + } + + public Boolean getDefaultValidationOnly() { + return DEFAULT_VALIDATION_ONLY; + } + // ********** SessionCustomizers ********** public ListIterator<ClassRef> sessionCustomizers(){ return new CloneListIterator<ClassRef>(this.sessionCustomizers); @@ -450,7 +500,7 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti return null; } - private void sessionCustomizersChanged(PropertyChangeEvent event) { + private void sessionCustomizersChanged(@SuppressWarnings("unused") PropertyChangeEvent event) { this.initializeSessionCustomizersFromPersistenceUnit(); this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY); @@ -481,6 +531,52 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti return DEFAULT_WEAVING; } + // ********** ClassLoader ********** + public String getClassLoader() { + return this.classLoader; + } + + public void setClassLoader(String newClassLoader) { + String old = this.classLoader; + this.classLoader = newClassLoader; + this.putProperty(CLASSLOADER_PROPERTY, newClassLoader); + this.firePropertyChanged(CLASSLOADER_PROPERTY, old, newClassLoader); + } + + private void classLoaderChanged(PropertyChangeEvent event) { + String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); + String old = this.classLoader; + this.classLoader = newValue; + this.firePropertyChanged(event.getAspectName(), old, newValue); + } + + public String getDefaultClassLoader() { + return DEFAULT_CLASSLOADER; + } + + // ********** ExceptionHandler ********** + public String getExceptionHandler() { + return this.exceptionHandler; + } + + public void setExceptionHandler(String newExceptionHandler) { + String old = this.exceptionHandler; + this.exceptionHandler = newExceptionHandler; + this.putProperty(EXCEPTION_HANDLER_PROPERTY, newExceptionHandler); + this.firePropertyChanged(EXCEPTION_HANDLER_PROPERTY, old, newExceptionHandler); + } + + private void exceptionHandlerChanged(PropertyChangeEvent event) { + String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); + String old = this.exceptionHandler; + this.exceptionHandler = newValue; + this.firePropertyChanged(event.getAspectName(), old, newValue); + } + + public String getDefaultExceptionHandler() { + return DEFAULT_EXCEPTION_HANDLER; + } + // ********** DescriptorCustomizer ********** public String getDescriptorCustomizer(String entityName) { diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java index 156404464c..015885836b 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java @@ -19,8 +19,9 @@ public enum LoggingLevel { info, config, fine, - finer, - finest; + finer, + finest, + all; // EclipseLink value string public static final String OFF = "OFF"; @@ -31,4 +32,5 @@ public enum LoggingLevel { public static final String FINE = "FINE"; public static final String FINER = "FINER"; public static final String FINEST = "FINEST"; + public static final String ALL = "ALL"; } diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties index b675fb1830..29d9670c31 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties @@ -164,7 +164,13 @@ CachingEntityListComposite_editButton = Edit... CachingEntityListComposite_dialogMessage=&Enter type name prefix or pattern (*, ?, or camel case): CachingEntityListComposite_dialogTitle=Entity Selection - + +PersistenceXmlCachingTab_FlushClearCacheLabel = Flush clear cache: + +FlushClearCacheComposite_drop = Drop +FlushClearCacheComposite_drop_invalidate = Drop Invalidate +FlushClearCacheComposite_merge = Merge + # Customization PersistenceXmlCustomizationTab_title = Customization PersistenceXmlCustomizationTab_sectionTitle = Persistence Unit Customization @@ -172,9 +178,6 @@ PersistenceXmlCustomizationTab_sectionDescription = Set default or entity specif PersistenceXmlCustomizationTab_defaultWithOneParam = Default ({0}) PersistenceXmlCustomizationTab_defaultEmpty = Default () -PersistenceXmlCustomizationTab_throwExceptionsLabelDefault = Throw exceptions ({0}) -PersistenceXmlCustomizationTab_throwExceptionsLabel = Throw exceptions - PersistenceXmlCustomizationTab_weavingLabel = Weaving: PersistenceXmlCustomizationTab_weavingLazyLabelDefault = Weaving lazy ({0}) @@ -192,6 +195,11 @@ PersistenceXmlCustomizationTab_weavingInternalLabelDefault = Weaving internal ({ PersistenceXmlCustomizationTab_weavingEagerLabel = Weaving eager PersistenceXmlCustomizationTab_weavingEagerLabelDefault = Weaving eager ({0}) +PersistenceXmlCustomizationTab_throwExceptionsLabelDefault = Throw exceptions ({0}) +PersistenceXmlCustomizationTab_throwExceptionsLabel = Throw exceptions + +PersistenceXmlCustomizationTab_exceptionHandlerLabel = Exception handler: + WeavingComposite_true_ = Weave Dynamically WeavingComposite_false_ = No Weaving WeavingComposite_static_ = Weave Statically @@ -207,6 +215,11 @@ PersistenceXmlCustomizationTab_sessionCustomizerLabel = Session customizers PersistenceXmlCustomizationTab_noName=<name not set> +PersistenceXmlCustomizationTab_validationOnlyLabel = Validation only +PersistenceXmlCustomizationTab_validationOnlyLabelDefault = Validation only ({0}) + +PersistenceXmlCustomizationTab_classLoaderLabel = Class loader: + PersistenceXmlCustomizationTab_profilerLabel = Profiler: PersistenceXmlCustomizationTab_browse = Browse... @@ -231,6 +244,7 @@ LoggingLevelComposite_config = Config LoggingLevelComposite_fine = Fine LoggingLevelComposite_finer = Finer LoggingLevelComposite_finest = Finest +LoggingLevelComposite_all = All PersistenceXmlLoggingTab_loggerLabel = Logger: PersistenceXmlLoggingTab_browse = Browse... diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java index 01ef06d0e9..6e517877ed 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java @@ -174,15 +174,17 @@ public class EclipseLinkUiMessages { public static String CachingEntityListComposite_dialogMessage; public static String CachingEntityListComposite_dialogTitle; + public static String PersistenceXmlCachingTab_FlushClearCacheLabel; + + public static String FlushClearCacheComposite_drop; + public static String FlushClearCacheComposite_drop_invalidate; + public static String FlushClearCacheComposite_merge; + // Customization public static String PersistenceXmlCustomizationTab_title; public static String PersistenceXmlCustomizationTab_sectionTitle; public static String PersistenceXmlCustomizationTab_sectionDescription; public static String PersistenceXmlCustomizationTab_defaultWithOneParam; - public static String PersistenceXmlCustomizationTab_defaultEmpty; - - public static String PersistenceXmlCustomizationTab_throwExceptionsLabelDefault; - public static String PersistenceXmlCustomizationTab_throwExceptionsLabel; public static String PersistenceXmlCustomizationTab_weavingLabel; @@ -200,6 +202,12 @@ public class EclipseLinkUiMessages { public static String PersistenceXmlCustomizationTab_weavingEagerLabelDefault; public static String PersistenceXmlCustomizationTab_weavingEagerLabel; + public static String PersistenceXmlCustomizationTab_defaultEmpty; + + public static String PersistenceXmlCustomizationTab_throwExceptionsLabelDefault; + public static String PersistenceXmlCustomizationTab_throwExceptionsLabel; + + public static String PersistenceXmlCustomizationTab_exceptionHandlerLabel; public static String WeavingComposite_true_; public static String WeavingComposite_false_; @@ -214,6 +222,11 @@ public class EclipseLinkUiMessages { public static String PersistenceXmlCustomizationTab_customizerLabel; public static String PersistenceXmlCustomizationTab_sessionCustomizerLabel; public static String PersistenceXmlCustomizationTab_noName; + + public static String PersistenceXmlCustomizationTab_validationOnlyLabel; + public static String PersistenceXmlCustomizationTab_validationOnlyLabelDefault; + + public static String PersistenceXmlCustomizationTab_classLoaderLabel; public static String PersistenceXmlCustomizationTab_profilerLabel; public static String PersistenceXmlCustomizationTab_browse; @@ -239,6 +252,7 @@ public class EclipseLinkUiMessages { public static String LoggingLevelComposite_fine; public static String LoggingLevelComposite_finer; public static String LoggingLevelComposite_finest; + public static String LoggingLevelComposite_all; public static String PersistenceXmlLoggingTab_loggerLabel; public static String PersistenceXmlLoggingTab_browse; diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java index 3852009073..225909b3a7 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java @@ -28,16 +28,16 @@ public class EclipseLinkCachingComposite extends FormPane<Caching> @Override protected void initializeLayout(Composite container) { - container = addSection( + container = this.addSection( container, EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionTitle, EclipseLinkUiMessages.PersistenceXmlCachingTab_sectionDescription ); // Default pane - int groupBoxMargin = getGroupBoxMargin(); + int groupBoxMargin = this.getGroupBoxMargin(); - Composite defaultPane = addSubPane( + Composite defaultPane = this.addSubPane( container, 0, groupBoxMargin, 0, groupBoxMargin ); @@ -53,5 +53,8 @@ public class EclipseLinkCachingComposite extends FormPane<Caching> // EntitiesList new EntityListComposite(this, container); + + // Flush Clear Cache + new FlushClearCacheComposite(this, container); } }
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java new file mode 100644 index 0000000000..c2a1ddeb72 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2008 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + *******************************************************************************/ +package org.eclipse.jpt.eclipselink.ui.internal.persistence.caching; + +import java.util.Collection; + +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching; +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.FlushClearCache; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; +import org.eclipse.jpt.ui.internal.widgets.FormPane; +import org.eclipse.swt.widgets.Composite; + +/** + * FlushClearCacheComposite + */ +public class FlushClearCacheComposite extends FormPane<Caching> +{ + /** + * Creates a new <code>FlushClearCacheComposite</code>. + * + * @param parentController + * The parent container of this one + * @param parent + * The parent container + */ + public FlushClearCacheComposite( + FormPane<? extends Caching> parentComposite, + Composite parent) { + + super(parentComposite, parent); + } + + private EnumFormComboViewer<Caching, FlushClearCache> addFlushClearCacheCombo(Composite container) { + return new EnumFormComboViewer<Caching, FlushClearCache>(this, container) { + @Override + protected void addPropertyNames(Collection<String> propertyNames) { + super.addPropertyNames(propertyNames); + propertyNames.add(Caching.FLUSH_CLEAR_CACHE_PROPERTY); + } + + @Override + protected FlushClearCache[] getChoices() { + return FlushClearCache.values(); + } + + @Override + protected boolean sortChoices() { + return false; + } + + @Override + protected FlushClearCache getDefaultValue() { + return this.getSubject().getDefaultFlushClearCache(); + } + + @Override + protected String displayString(FlushClearCache value) { + return this.buildDisplayString(EclipseLinkUiMessages.class, FlushClearCacheComposite.this, value); + } + + @Override + protected FlushClearCache getValue() { + return this.getSubject().getFlushClearCache(); + } + + @Override + protected void setValue(FlushClearCache value) { + this.getSubject().setFlushClearCache(value); + } + }; + } + + @Override + protected void initializeLayout(Composite container) { + this.addLabeledComposite( + container, + EclipseLinkUiMessages.PersistenceXmlCachingTab_FlushClearCacheLabel, + this.addFlushClearCacheCombo(container), + null // TODO IJpaHelpContextIds. + ); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ClassLoaderComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ClassLoaderComposite.java new file mode 100644 index 0000000000..6d03022be6 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ClassLoaderComposite.java @@ -0,0 +1,97 @@ +/******************************************************************************* +* Copyright (c) 2008 Oracle. All rights reserved. +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v1.0, which accompanies this distribution +* and is available at http://www.eclipse.org/legal/epl-v10.html. +* +* Contributors: +* Oracle - initial API and implementation +*******************************************************************************/ +package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization; + +import org.eclipse.jdt.core.IType; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; +import org.eclipse.jpt.ui.internal.widgets.Pane; +import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; +import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; +import org.eclipse.swt.widgets.Composite; + +/** + * ClassLoaderComposite + */ +public class ClassLoaderComposite extends Pane<Customization> +{ + /** + * Creates a new <code>ClassLoaderComposite</code>. + * + * @param parentPane The parent pane of this one + * @param parent The parent container + */ + public ClassLoaderComposite(Pane<? extends Customization> parentPane, + Composite parent) { + + super(parentPane, parent); + } + + private ClassChooserPane<Customization> initializeClassChooser(Composite container) { + + return new ClassChooserPane<Customization>(this, container) { + + @Override + protected WritablePropertyValueModel<String> buildTextHolder() { + return new PropertyAspectAdapter<Customization, String>( + this.getSubjectHolder(), Customization.CLASSLOADER_PROPERTY) { + @Override + protected String buildValue_() { + return this.subject.getClassLoader(); + } + + @Override + protected void setValue_(String value) { + + if (value.length() == 0) { + value = null; + } + this.subject.setClassLoader(value); + } + }; + } + + @Override + protected String getClassName() { + return this.getSubject().getClassLoader(); + } + + @Override + protected String getLabelText() { + return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_classLoaderLabel; + } + + @Override + protected JpaProject getJpaProject() { + return getSubject().getJpaProject(); + } + + @Override + protected void promptType() { + IType type = chooseType(); + + if (type != null) { + String className = type.getFullyQualifiedName('.'); + this.getSubject().setClassLoader(className); + } + } + }; + } + + /* + * (non-Javadoc) + */ + @Override + protected void initializeLayout(Composite container) { + this.initializeClassChooser(container); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java index 0f4ea53aa3..49a9fd3232 100644 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java @@ -68,11 +68,20 @@ public class EclipseLinkCustomizationComposite extends FormPane<Customization> // Throw Exceptions new ThrowExceptionsComposite(this, defaultPane); + // Exception Handler + new ExceptionHandlerComposite(this, defaultPane); + // Session Customizer new SessionCustomizersComposite(this, defaultPane); // EntitiesList new EntityListComposite(this, composite); + + // Validation Only + new ValidationOnlyComposite(this, composite); + + // Class Loader + new ClassLoaderComposite(this, composite); // Profiler: new ProfilerComposite(this, composite); diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java new file mode 100644 index 0000000000..6fd3242a46 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java @@ -0,0 +1,97 @@ +/******************************************************************************* +* Copyright (c) 2008 Oracle. All rights reserved. +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v1.0, which accompanies this distribution +* and is available at http://www.eclipse.org/legal/epl-v10.html. +* +* Contributors: +* Oracle - initial API and implementation +*******************************************************************************/ +package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization; + +import org.eclipse.jdt.core.IType; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; +import org.eclipse.jpt.ui.internal.widgets.Pane; +import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; +import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; +import org.eclipse.swt.widgets.Composite; + +/** + * ExceptionHandlerComposite + */ +public class ExceptionHandlerComposite extends Pane<Customization> +{ + /** + * Creates a new <code>ExceptionHandlerComposite</code>. + * + * @param parentPane The parent pane of this one + * @param parent The parent container + */ + public ExceptionHandlerComposite(Pane<? extends Customization> parentPane, + Composite parent) { + + super(parentPane, parent); + } + + private ClassChooserPane<Customization> initializeClassChooser(Composite container) { + + return new ClassChooserPane<Customization>(this, container) { + + @Override + protected WritablePropertyValueModel<String> buildTextHolder() { + return new PropertyAspectAdapter<Customization, String>( + this.getSubjectHolder(), Customization.EXCEPTION_HANDLER_PROPERTY) { + @Override + protected String buildValue_() { + return this.subject.getExceptionHandler(); + } + + @Override + protected void setValue_(String value) { + + if (value.length() == 0) { + value = null; + } + this.subject.setExceptionHandler(value); + } + }; + } + + @Override + protected String getClassName() { + return this.getSubject().getExceptionHandler(); + } + + @Override + protected String getLabelText() { + return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_exceptionHandlerLabel; + } + + @Override + protected JpaProject getJpaProject() { + return getSubject().getJpaProject(); + } + + @Override + protected void promptType() { + IType type = chooseType(); + + if (type != null) { + String className = type.getFullyQualifiedName('.'); + this.getSubject().setExceptionHandler(className); + } + } + }; + } + + /* + * (non-Javadoc) + */ + @Override + protected void initializeLayout(Composite container) { + this.initializeClassChooser(container); + } +} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java new file mode 100644 index 0000000000..7af56bc4d4 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2008 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + *******************************************************************************/ +package org.eclipse.jpt.eclipselink.ui.internal.persistence.customization; + +import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; +import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; +import org.eclipse.jpt.ui.internal.widgets.FormPane; +import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; +import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; +import org.eclipse.jpt.utility.model.value.PropertyValueModel; +import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Composite; + +/** + * ValidationOnlyComposite + */ +public class ValidationOnlyComposite extends FormPane<Customization> +{ + /** + * Creates a new <code>ValidationOnlyComposite</code>. + * + * @param parentController + * The parent container of this one + * @param parent + * The parent container + */ + public ValidationOnlyComposite( + FormPane<? extends Customization> parentComposite, + Composite parent) { + + super(parentComposite, parent); + } + + private WritablePropertyValueModel<Boolean> buildValidationOnlyHolder() { + return new PropertyAspectAdapter<Customization, Boolean>(getSubjectHolder(), Customization.VALIDATION_ONLY_PROPERTY) { + @Override + protected Boolean buildValue_() { + return subject.getValidationOnly(); + } + + @Override + protected void setValue_(Boolean value) { + subject.setValidationOnly(value); + } + + @Override + protected void subjectChanged() { + Object oldValue = this.getValue(); + super.subjectChanged(); + Object newValue = this.getValue(); + + // Make sure the default value is appended to the text + if (oldValue == newValue && newValue == null) { + this.fireAspectChange(Boolean.TRUE, newValue); + } + } + }; + } + + private PropertyValueModel<String> buildValidationOnlyStringHolder() { + return new TransformationPropertyValueModel<Boolean, String>(buildValidationOnlyHolder()) { + @Override + protected String transform(Boolean value) { + if ((getSubject() != null) && (value == null)) { + Boolean defaultValue = getSubject().getDefaultValidationOnly(); + if (defaultValue != null) { + String defaultStringValue = defaultValue ? EclipseLinkUiMessages.Boolean_True : EclipseLinkUiMessages.Boolean_False; + return NLS.bind(EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabelDefault, defaultStringValue); + } + } + return EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabel; + } + }; + } + + @Override + protected void initializeLayout(Composite container) { + + this.addTriStateCheckBoxWithDefault( + container, + EclipseLinkUiMessages.PersistenceXmlCustomizationTab_validationOnlyLabel, + this.buildValidationOnlyHolder(), + this.buildValidationOnlyStringHolder(), + null +// EclipseLinkHelpContextIds. + ); + } +} |