Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2009-04-24 22:14:48 +0000
committerkmoore2009-04-24 22:14:48 +0000
commitc7cbc6a437694cb11aaa7037cda9148b5058b842 (patch)
treeed0f8ed02a1cc8a8355301ade222cc19ce5b2ac2 /jpa/plugins
parentd4a5c4c3597856a524b52dc5fdecac924a010a61 (diff)
downloadwebtools.dali-c7cbc6a437694cb11aaa7037cda9148b5058b842.tar.gz
webtools.dali-c7cbc6a437694cb11aaa7037cda9148b5058b842.tar.xz
webtools.dali-c7cbc6a437694cb11aaa7037cda9148b5058b842.zip
272964 - changing properties in persistence.xml source does not properly update the UI - I have changed the context model to be updated more explicitly instead of via model listeners on the properties
Diffstat (limited to 'jpa/plugins')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceUnitProperty.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitPropertyListListener.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java158
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java342
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java28
18 files changed, 733 insertions, 805 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java
index 2d6aff1b36..7efd1abb23 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java
@@ -474,6 +474,16 @@ public interface PersistenceUnit
void removeProperty(String propertyName, String value);
/**
+ * Call back method for Property name changing.
+ */
+ void propertyNameChanged(String oldPropertyName, String newPropertyName, String value);
+
+ /**
+ * Call back method for Property value changing.
+ */
+ void propertyValueChanged(String propertyName, String newValue);
+
+ /**
* Simple property interface.
*/
interface Property
@@ -490,7 +500,8 @@ public interface PersistenceUnit
void setValue(String value);
String getValue();
- void update(XmlProperty property);
+ XmlProperty getXmlProperty();
+ void update();
}
// ********** ORM persistence unit defaults **********
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 51dc8d7a34..30e1cb2d20 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
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.context.persistence;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -668,6 +669,9 @@ public abstract class AbstractPersistenceUnit
this.properties.add(index, property);
xmlProperties.getProperties().add(index, xmlProperty);
this.fireItemAdded(PROPERTIES_LIST, index, property);
+ if (property.getName() != null) {
+ this.propertyAdded(property.getName(), property.getValue());
+ }
return property;
}
@@ -753,17 +757,58 @@ public abstract class AbstractPersistenceUnit
}
this.fireItemRemoved(PROPERTIES_LIST, index, removedProperty);
+ if (removedProperty.getName() != null) {
+ this.propertyRemoved(removedProperty.getName());
+ }
}
- protected void addProperty_(Property property) {
- this.addItemToList(property, this.properties, PROPERTIES_LIST);
+ protected void addProperty_(int index, Property property) {
+ this.addItemToList(index, property, this.properties, PROPERTIES_LIST);
+ if (property.getName() != null) {
+ this.propertyAdded(property.getName(), property.getValue());
+ }
+ }
+
+ protected void removeProperty_(int index) {
+ removeProperty_(this.properties.get(index));
}
protected void removeProperty_(Property property) {
this.removeItemFromList(property, this.properties, PROPERTIES_LIST);
+ if (property.getName() != null) {
+ this.propertyRemoved(property.getName());
+ }
+ }
+
+ protected void moveProperty_(int index, Property property) {
+ this.moveItemInList(index, this.properties.indexOf(property), this.properties, PROPERTIES_LIST);
+ }
+
+ public void propertyNameChanged(String oldPropertyName, String newPropertyName, String value) {
+ if (oldPropertyName == null && value == null) {
+ //this is a property that is currently being added, we don't need to deal with it until the value is set
+ return;
+ }
+ if (oldPropertyName != null) {
+ this.propertyRemoved(oldPropertyName);
+ }
+ if (newPropertyName != null) {
+ this.propertyAdded(newPropertyName, value);
+ }
+ }
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ // do nothing, override in subclasses as necessary
}
-
+ public void propertyAdded(String propertyName, String value) {
+ this.propertyValueChanged(propertyName, value);
+ }
+
+ public void propertyRemoved(String propertyName) {
+ // do nothing, override in subclasses as necessary
+ }
+
// ********** ORM persistence unit defaults **********
public AccessType getDefaultAccess() {
@@ -1095,23 +1140,32 @@ public abstract class AbstractPersistenceUnit
}
/**
- * Since this is a *list*, we simply loop through the elements and match
- * the context to the resource element by index, not by name like we do
- * with 'impliedClassRefs'.
+ * Match the elements based on the XmlProperty resource object and also keep the order
+ * the same as the source.
*/
- protected void updateProperties() {
- Iterator<XmlProperty> xmlProperties = this.xmlProperties();
-
- for (Property contextProperty : this.getProperties()) {
- if (xmlProperties.hasNext()) {
- contextProperty.update(xmlProperties.next());
- } else {
- this.removeProperty_(contextProperty);
+ protected void updateProperties() {
+ Collection<Property> contextPropertiesToRemove = CollectionTools.collection(properties());
+ int resourceIndex = 0;
+
+ for (Iterator<XmlProperty> xmlProperties = this.xmlProperties(); xmlProperties.hasNext(); ) {
+ XmlProperty xmlProperty = xmlProperties.next();
+ boolean contextPropertyFound = false;
+ for (Property contextProperty : contextPropertiesToRemove) {
+ if (contextProperty.getXmlProperty() == xmlProperty) {
+ moveProperty_(resourceIndex, contextProperty);
+ contextProperty.update();
+ contextPropertiesToRemove.remove(contextProperty);
+ contextPropertyFound = true;
+ break;
+ }
+ }
+ if (!contextPropertyFound) {
+ addProperty_(resourceIndex, this.buildProperty(xmlProperty));
}
+ resourceIndex++;
}
-
- while (xmlProperties.hasNext()) {
- this.addProperty_(this.buildProperty(xmlProperties.next()));
+ for (Property contextProperty : contextPropertiesToRemove) {
+ removeProperty_(contextProperty);
}
}
@@ -1120,6 +1174,11 @@ public abstract class AbstractPersistenceUnit
// make a copy of the XML properties (to prevent ConcurrentModificationException)
return (xmlProperties != null) ? new CloneIterator<XmlProperty>(xmlProperties.getProperties()) : EmptyIterator.<XmlProperty>instance();
}
+
+ protected int xmlPropertiesSize() {
+ XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
+ return xmlProperties == null ? 0 : xmlProperties.getProperties().size();
+ }
protected void updatePersistenceUnitDefaults() {
MappingFilePersistenceUnitDefaults defaults = this.getDefaults();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceUnitProperty.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceUnitProperty.java
index f7ab8b7ceb..7f5ede4711 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceUnitProperty.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceUnitProperty.java
@@ -22,20 +22,16 @@ public class GenericPersistenceUnitProperty
extends AbstractXmlContextNode
implements PersistenceUnit.Property
{
- protected XmlProperty xmlProperty;
+ protected final XmlProperty xmlProperty;
protected String name;
protected String value;
public GenericPersistenceUnitProperty(PersistenceUnit parent, XmlProperty xmlProperty) {
super(parent);
- this.initialize(xmlProperty);
- }
-
- protected void initialize(XmlProperty xp) {
- this.xmlProperty = xp;
- this.name = xp.getName();
- this.value = xp.getValue();
+ this.xmlProperty = xmlProperty;
+ this.name = xmlProperty.getName();
+ this.value = xmlProperty.getValue();
}
@Override
@@ -43,7 +39,10 @@ public class GenericPersistenceUnitProperty
return (PersistenceUnit) super.getParent();
}
-
+ public XmlProperty getXmlProperty() {
+ return this.xmlProperty;
+ }
+
// ********** name **********
public String getName() {
@@ -53,8 +52,11 @@ public class GenericPersistenceUnitProperty
public void setName(String name) {
String old = this.name;
this.name = name;
- this.xmlProperty.setName(name);
- this.firePropertyChanged(NAME_PROPERTY, old, name);
+ if (attributeValueHasChanged(old, name)) {
+ this.xmlProperty.setName(name);
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ getParent().propertyNameChanged(old, this.name, this.value);
+ }
}
@@ -67,17 +69,19 @@ public class GenericPersistenceUnitProperty
public void setValue(String value) {
String old = this.value;
this.value = value;
- this.xmlProperty.setValue(value);
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ if (attributeValueHasChanged(old, value)) {
+ this.xmlProperty.setValue(value);
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ getParent().propertyValueChanged(this.name, value);
+ }
}
// ********** updating **********
- public void update(XmlProperty xp) {
- this.xmlProperty = xp;
- this.setName(xp.getName());
- this.setValue(xp.getValue());
+ public void update() {
+ this.setName(this.xmlProperty.getName());
+ this.setValue(this.xmlProperty.getValue());
}
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 15a8573da5..d6a8908afe 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
@@ -17,7 +17,6 @@ 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.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit;
import org.eclipse.jpt.core.internal.context.persistence.ImpliedMappingFileRef;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
@@ -43,9 +42,6 @@ import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
import org.eclipse.jpt.utility.internal.iterators.ReadOnlyCompositeListIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLink persistence unit
@@ -55,7 +51,7 @@ public class EclipseLinkPersistenceUnit
{
protected MappingFileRef impliedEclipseLinkMappingFileRef;
- private GeneralProperties generalProperties;
+ private/*final*/ GeneralProperties generalProperties;
private Connection connection;
private Customization customization;
private Caching caching;
@@ -74,32 +70,14 @@ public class EclipseLinkPersistenceUnit
@Override
protected void initializeProperties() {
super.initializeProperties();
- ListValueModel<Property> propertyListAdapter = this.buildPropertyListAdapter();
- this.generalProperties = new EclipseLinkGeneralProperties(this, propertyListAdapter);
- this.connection = new EclipseLinkConnection(this, propertyListAdapter);
- this.customization = new EclipseLinkCustomization(this, propertyListAdapter);
- this.caching = new EclipseLinkCaching(this, propertyListAdapter);
- this.logging = new EclipseLinkLogging(this, propertyListAdapter);
- this.options = new EclipseLinkOptions(this, propertyListAdapter);
- this.schemaGeneration = new EclipseLinkSchemaGeneration(this, propertyListAdapter);
- }
-
- private ListValueModel<Property> buildPropertyListAdapter() {
- return new ItemPropertyListValueModelAdapter<Property>(this.buildPropertiesAdapter(), Property.VALUE_PROPERTY);
- }
-
- private ListValueModel<Property> buildPropertiesAdapter() {
- return new ListAspectAdapter<PersistenceUnit, Property>(PROPERTIES_LIST, this) {
- @Override
- protected ListIterator<Property> listIterator_() {
- return this.subject.properties();
- }
- @Override
- protected int size_() {
- return this.subject.propertiesSize();
- }
- };
+ this.generalProperties = new EclipseLinkGeneralProperties(this);
+ this.connection = new EclipseLinkConnection(this);
+ this.customization = new EclipseLinkCustomization(this);
+ this.caching = new EclipseLinkCaching(this);
+ this.logging = new EclipseLinkLogging(this);
+ this.options = new EclipseLinkOptions(this);
+ this.schemaGeneration = new EclipseLinkSchemaGeneration(this);
}
@Override
@@ -107,8 +85,32 @@ public class EclipseLinkPersistenceUnit
super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
nonUpdateAspectNames.add(CONVERTERS_LIST);
}
-
-
+
+ @Override
+ public void propertyValueChanged(String propertyName, String newValue) {
+ super.propertyValueChanged(propertyName, newValue);
+ this.generalProperties.propertyValueChanged(propertyName, newValue);
+ this.connection.propertyValueChanged(propertyName, newValue);
+ this.customization.propertyValueChanged(propertyName, newValue);
+ this.caching.propertyValueChanged(propertyName, newValue);
+ this.logging.propertyValueChanged(propertyName, newValue);
+ this.options.propertyValueChanged(propertyName, newValue);
+ this.schemaGeneration.propertyValueChanged(propertyName, newValue);
+ }
+
+ @Override
+ public void propertyRemoved(String propertyName) {
+ super.propertyRemoved(propertyName);
+ this.generalProperties.propertyRemoved(propertyName);
+ this.connection.propertyRemoved(propertyName);
+ this.customization.propertyRemoved(propertyName);
+ this.caching.propertyRemoved(propertyName);
+ this.logging.propertyRemoved(propertyName);
+ this.options.propertyRemoved(propertyName);
+ this.schemaGeneration.propertyRemoved(propertyName);
+ }
+
+
// **************** mapping file refs **************************************
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java
index 81127d614c..ad8a421909 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java
@@ -18,7 +18,6 @@ import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkPersistenceUnitProperties
@@ -30,29 +29,20 @@ public abstract class EclipseLinkPersistenceUnitProperties extends AbstractModel
{
private PersistenceUnit persistenceUnit;
- private PersistenceUnitPropertyListListener propertyListListener;
-
// key = EclipseLink property key; value = property id
private Map<String, String> propertyNames;
private static final long serialVersionUID = 1L;
// ********** constructors / initialization **********
- protected EclipseLinkPersistenceUnitProperties(
- PersistenceUnit parent,
- ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
+ protected EclipseLinkPersistenceUnitProperties(PersistenceUnit parent) {
super();
- this.initialize(parent, propertyListAdapter);
+ this.initialize(parent);
}
- protected void initialize(
- PersistenceUnit parent,
- ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
+ protected void initialize(PersistenceUnit parent) {
this.persistenceUnit = parent;
- this.propertyListListener = new PersistenceUnitPropertyListListener(this);
- propertyListAdapter.addListChangeListener(ListValueModel.LIST_VALUES, this.propertyListListener);
-
this.initializePropertyNames();
this.initializeProperties();
}
@@ -76,10 +66,6 @@ public abstract class EclipseLinkPersistenceUnitProperties extends AbstractModel
return this.persistenceUnit.getJpaProject();
}
- public PersistenceUnitPropertyListListener propertyListListener() {
- return this.propertyListListener;
- }
-
private Map<String, String> propertyNames() {
return this.propertyNames;
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java
index 91da757676..d13ad8a244 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java
@@ -12,12 +12,11 @@ package org.eclipse.jpt.eclipselink.core.internal.context.persistence;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.utility.model.Model;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
/**
* PersistenceUnitProperties
*/
-public interface PersistenceUnitProperties extends Model, PropertyChangeListener
+public interface PersistenceUnitProperties extends Model
{
/**
* Method used for identifying the given property.
@@ -38,4 +37,16 @@ public interface PersistenceUnitProperties extends Model, PropertyChangeListener
* Return the JPA project the PersistenceUnit belongs to.
*/
JpaProject getJpaProject();
+
+ /**
+ * A Property with the given name had its value changed
+ */
+ void propertyValueChanged(String propertyName, String newValue);
+
+ /**
+ * A Property with the given name was removed
+ */
+ void propertyRemoved(String propertyName);
+
+
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitPropertyListListener.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitPropertyListListener.java
deleted file mode 100644
index d59816b5d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitPropertyListListener.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.eclipselink.core.internal.context.persistence;
-
-import java.util.Iterator;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.utility.model.Model;
-import org.eclipse.jpt.utility.model.event.ListChangeEvent;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.ListChangeListener;
-
-/**
- * PersistenceUnitPropertyListListener Notifies the given parent when a change
- * occured in JPT PersistenceUnit properties
- */
-public class PersistenceUnitPropertyListListener implements ListChangeListener
-{
- private PersistenceUnitProperties parent;
-
- // ********** constructors / initialization **********
- public PersistenceUnitPropertyListListener(PersistenceUnitProperties parent) {
- this.parent = parent;
- }
-
- // ********** Behavior **********
- protected boolean add(PersistenceUnit.Property newItem, Model source) {
- if (this.model().itemIsProperty(newItem)) {
- String propertyName = this.model().propertyIdFor(newItem);
- this.model().propertyChanged(
- new PropertyChangeEvent(source, propertyName, null, newItem));
- return true;
- }
- return false;
- }
-
- protected boolean remove(PersistenceUnit.Property item, Model source) {
- if (this.model().itemIsProperty(item)) {
- String propertyName = this.model().propertyIdFor(item);
- this.model().propertyChanged(
- new PropertyChangeEvent(source, propertyName, item, null)); // oldItem is the removed property
- return true;
- }
- return false;
- }
-
- // replace
- protected PersistenceUnit.Property set(PersistenceUnit.Property newItem, Model source) {
- if (this.model().itemIsProperty(newItem)) {
- String propertyName = this.model().propertyIdFor(newItem);
- this.model().propertyChanged(
- new PropertyChangeEvent(source, propertyName, null, newItem)); // oldItem unknown
- return newItem;
- }
- return null;
- }
-
- // ********** ListChangeListener implementation **********
- public void itemsAdded(ListChangeEvent e) {
- for (Iterator<PersistenceUnit.Property> stream = this.items(e); stream.hasNext();) {
- this.add(stream.next(), e.getSource());
- }
- }
-
- public void itemsRemoved(ListChangeEvent e) {
- for (Iterator<PersistenceUnit.Property> stream = this.items(e); stream.hasNext();) {
- this.remove(stream.next(), e.getSource());
- }
- }
-
- public void itemsReplaced(ListChangeEvent e) {
- // ItemAspectListValueModelAdapter(270) does not provide old value
- for (Iterator<PersistenceUnit.Property> newStream = this.items(e); newStream.hasNext();) {
- this.set(newStream.next(), e.getSource());
- }
- }
-
- public void itemsMoved(ListChangeEvent e) {
- throw new UnsupportedOperationException("source: " + e.getSource() + " - aspect: " + e.getAspectName());
- }
-
- public void listCleared(ListChangeEvent e) {
- throw new UnsupportedOperationException("source: " + e.getSource() + " - aspect: " + e.getAspectName());
- }
-
- public void listChanged(ListChangeEvent e) {
- throw new UnsupportedOperationException("source: " + e.getSource() + " - aspect: " + e.getAspectName());
- }
-
- // ********** standard methods **********
- @Override
- public String toString() {
- return this.getClass().getSimpleName() + "( " + this.model().getClass().getSimpleName() + ")";
- }
-
- // ********** internal methods **********
- private PersistenceUnitProperties model() {
- return this.parent;
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<PersistenceUnit.Property> items(ListChangeEvent event) {
- return (Iterator<PersistenceUnit.Property>) event.items();
- }
-}
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 c1fd79a847..c5b7ce8ad1 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
@@ -16,8 +16,6 @@ import java.util.Set;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkCaching encapsulates EclipseLink Caching properties.
@@ -35,8 +33,8 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
private Map<String, CacheProperties> entitiesCacheProperties;
// ********** constructors **********
- public EclipseLinkCaching(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super(parent, propertyListAdapter);
+ public EclipseLinkCaching(PersistenceUnit parent) {
+ super(parent);
}
// ********** initialization **********
@@ -72,26 +70,74 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
private void initializeEntitiesCacheType(Set<PersistenceUnit.Property> properties) {
for (PersistenceUnit.Property property : properties) {
String entityName = this.getEntityName(property);
- CacheType cacheType = getEnumValueOf(property.getValue(), CacheType.values());
- this.setCacheType_(cacheType, entityName);
+ this.setCacheType_(property.getValue(), entityName);
}
}
private void initializeEntitiesCacheSize(Set<PersistenceUnit.Property> properties) {
for (PersistenceUnit.Property property : properties) {
String entityName = this.getEntityName(property);
- this.setCacheSize_(property, entityName);
+ this.setCacheSize_(property.getValue(), entityName);
}
}
private void initializeEntitiesSharedCache(Set<PersistenceUnit.Property> properties) {
for (PersistenceUnit.Property property : properties) {
String entityName = this.getEntityName(property);
- this.setSharedCache_(property, entityName);
+ this.setSharedCache_(property.getValue(), entityName);
}
}
// ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(ECLIPSELINK_CACHE_TYPE_DEFAULT)) {
+ this.cacheTypeDefaultChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_SIZE_DEFAULT)) {
+ this.cacheSizeDefaultChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_SHARED_DEFAULT)) {
+ this.sharedCacheDefaultChanged(newValue);
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_CACHE_TYPE)) {
+ this.cacheTypeChanged(propertyName, newValue);
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_CACHE_SIZE)) {
+ this.cacheSizeChanged(propertyName, newValue);
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_SHARED_CACHE)) {
+ this.sharedCacheChanged(propertyName, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_FLUSH_CLEAR_CACHE)) {
+ this.flushClearCacheChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(ECLIPSELINK_CACHE_TYPE_DEFAULT)) {
+ this.cacheTypeDefaultChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_SIZE_DEFAULT)) {
+ this.cacheSizeDefaultChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_SHARED_DEFAULT)) {
+ this.sharedCacheDefaultChanged(null);
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_CACHE_TYPE)) {
+ this.cacheTypeChanged(propertyName, null);
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_CACHE_SIZE)) {
+ this.cacheSizeChanged(propertyName, null);
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_SHARED_CACHE)) {
+ this.sharedCacheChanged(propertyName, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_FLUSH_CLEAR_CACHE)) {
+ this.flushClearCacheChanged(null);
+ }
+ }
+
/**
* Adds property names key/value pairs, where:
* key = EclipseLink property key;
@@ -156,35 +202,6 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
throw new IllegalArgumentException("Illegal property: " + property.toString());
}
- public void propertyChanged(PropertyChangeEvent event) {
- String aspectName = event.getAspectName();
- if (aspectName.equals(CACHE_TYPE_DEFAULT_PROPERTY)) {
- this.cacheTypeDefaultChanged(event);
- }
- else if (aspectName.equals(CACHE_SIZE_DEFAULT_PROPERTY)) {
- this.cacheSizeDefaultChanged(event);
- }
- else if (aspectName.equals(SHARED_CACHE_DEFAULT_PROPERTY)) {
- this.sharedCacheDefaultChanged(event);
- }
- else if (aspectName.equals(CACHE_TYPE_PROPERTY)) {
- this.cacheTypeChanged(event);
- }
- else if (aspectName.equals(CACHE_SIZE_PROPERTY)) {
- this.cacheSizeChanged(event);
- }
- 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);
- }
- return;
- }
-
// ********** CacheType **********
public CacheType getCacheType(String entityName) {
CacheProperties cache = this.cachePropertiesOf(entityName);
@@ -197,14 +214,12 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.cachePropertiesOf(entityName));
}
- private void cacheTypeChanged(PropertyChangeEvent event) {
- PersistenceUnit.Property property = (PersistenceUnit.Property) event.getNewValue();
- // property == null when removed
- String entityName = (property == null) ? this.getEntityName((PersistenceUnit.Property) event.getOldValue()) : this.getEntityName(property);
- CacheProperties old = this.setCacheType_(property, entityName);
- this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName));
+ private void cacheTypeChanged(String propertyName, String stringValue) {
+ String entityName = this.getEntityName(propertyName);
+ CacheProperties old = this.setCacheType_(stringValue, entityName);
+ this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.cachePropertiesOf(entityName));
}
-
+
public CacheType getDefaultCacheType() {
return (this.cacheTypeDefault == null) ? DEFAULT_CACHE_TYPE : this.cacheTypeDefault;
}
@@ -221,12 +236,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.cachePropertiesOf(entityName));
}
- private void cacheSizeChanged(PropertyChangeEvent event) {
- PersistenceUnit.Property property = (PersistenceUnit.Property) event.getNewValue();
- // property == null when removed
- String entityName = (property == null) ? this.getEntityName((PersistenceUnit.Property) event.getOldValue()) : this.getEntityName(property);
- CacheProperties old = this.setCacheSize_(property, entityName);
- this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName));
+ private void cacheSizeChanged(String propertyName, String stringValue) {
+ String entityName = this.getEntityName(propertyName);
+ CacheProperties old = this.setCacheSize_(stringValue, entityName);
+ this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.cachePropertiesOf(entityName));
}
public Integer getDefaultCacheSize() {
@@ -245,14 +258,10 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.cachePropertiesOf(entityName));
}
- private void sharedCacheChanged(PropertyChangeEvent event) {
- String entityName;
- PersistenceUnit.Property newProperty = (PersistenceUnit.Property) event.getNewValue();
- // property == null when removed
- entityName = (newProperty == null) ?
- this.getEntityName((PersistenceUnit.Property) event.getOldValue()) : this.getEntityName(newProperty);
- CacheProperties old = this.setSharedCache_(newProperty, entityName);
- this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName));
+ private void sharedCacheChanged(String propertyName, String stringValue) {
+ String entityName = this.getEntityName(propertyName);
+ CacheProperties old = this.setSharedCache_(stringValue, entityName);
+ this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.cachePropertiesOf(entityName));
}
public Boolean getDefaultSharedCache() {
@@ -271,12 +280,11 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(CACHE_TYPE_DEFAULT_PROPERTY, old, newCacheTypeDefault);
}
- private void cacheTypeDefaultChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void cacheTypeDefaultChanged(String stringValue) {
CacheType newValue = getEnumValueOf(stringValue, CacheType.values());
CacheType old = this.cacheTypeDefault;
this.cacheTypeDefault = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(CACHE_TYPE_DEFAULT_PROPERTY, old, newValue);
}
public CacheType getDefaultCacheTypeDefault() {
@@ -295,12 +303,11 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(CACHE_SIZE_DEFAULT_PROPERTY, old, newCacheSizeDefault);
}
- private void cacheSizeDefaultChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void cacheSizeDefaultChanged(String stringValue) {
Integer newValue = getIntegerValueOf(stringValue);
Integer old = this.cacheSizeDefault;
this.cacheSizeDefault = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(CACHE_SIZE_DEFAULT_PROPERTY, old, newValue);
}
public Integer getDefaultCacheSizeDefault() {
@@ -319,13 +326,12 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(SHARED_CACHE_DEFAULT_PROPERTY, old, newSharedCacheDefault);
}
- private void sharedCacheDefaultChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void sharedCacheDefaultChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.sharedCacheDefault;
this.sharedCacheDefault = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(SHARED_CACHE_DEFAULT_PROPERTY, old, newValue);
}
public Boolean getDefaultSharedCacheDefault() {
@@ -345,12 +351,11 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(FLUSH_CLEAR_CACHE_PROPERTY, old, newFlushClearCache);
}
- private void flushClearCacheChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void flushClearCacheChanged(String stringValue) {
FlushClearCache newValue = getEnumValueOf(stringValue, FlushClearCache.values());
FlushClearCache old = this.flushClearCache;
this.flushClearCache = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(FLUSH_CLEAR_CACHE_PROPERTY, old, newValue);
}
public FlushClearCache getDefaultFlushClearCache() {
@@ -362,8 +367,7 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
* Convenience method to update the CacheType in entitiesCache map. Returns
* the old value of CacheProperties
*/
- private CacheProperties setCacheType_(PersistenceUnit.Property newProperty, String entityName) {
- String stringValue = (newProperty == null) ? null : newProperty.getValue();
+ private CacheProperties setCacheType_(String stringValue, String entityName) {
CacheType newValue = getEnumValueOf(stringValue, CacheType.values());
return this.setCacheType_(newValue, entityName);
}
@@ -380,8 +384,7 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
* Convenience method to update the CacheSize in entitiesCache map. Returns
* the old value of CacheProperties
*/
- private CacheProperties setCacheSize_(PersistenceUnit.Property newProperty, String entityName) {
- String stringValue = (newProperty == null) ? null : newProperty.getValue();
+ private CacheProperties setCacheSize_(String stringValue, String entityName) {
Integer newValue = getIntegerValueOf(stringValue);
return this.setCacheSize_(newValue, entityName);
}
@@ -398,11 +401,6 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
* Convenience method to update the SharedCache in entitiesCacheProperties map.
* Returns the old value of CacheProperties
*/
- private CacheProperties setSharedCache_(PersistenceUnit.Property newProperty, String entityName) {
- String newValue = (newProperty == null) ? null : newProperty.getValue();
- return this.setSharedCache_(newValue, entityName);
- }
-
private CacheProperties setSharedCache_(String newString, String entityName) {
Boolean newValue = getBooleanValueOf(newString);
return setSharedCache_(newValue, entityName);
@@ -466,7 +464,7 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
public String addEntity(String entity) {
if (entityExists(entity)) {
- throw new IllegalStateException("Entity " + entity + " already exist.");
+ throw new IllegalStateException("Entity " + entity + " already exists.");
}
return this.addOrReplacePropertiesForEntity(entity, new CacheProperties(entity));
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java
index 22de7dacab..2467819382 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2008 Oracle. All rights reserved.
+* Copyright (c) 2008, 2009 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
*******************************************************************************/
package org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties;
/**
@@ -17,26 +16,6 @@ import org.eclipse.jpt.eclipselink.core.internal.context.persistence.Persistence
*/
public interface Connection extends PersistenceUnitProperties
{
- PersistenceUnitTransactionType getDefaultTransactionType();
- PersistenceUnitTransactionType getTransactionType();
- void setTransactionType(PersistenceUnitTransactionType newTransactionType);
- // PersistenceUnit property
- static final String TRANSACTION_TYPE_PROPERTY = "transactionType"; //$NON-NLS-1$
- static final PersistenceUnitTransactionType DEFAULT_TRANSACTION_TYPE = PersistenceUnitTransactionType.JTA;
-
- String getDefaultJtaDataSource();
- String getJtaDataSource();
- void setJtaDataSource(String newJtaDataSource);
- // PersistenceUnit property
- static final String JTA_DATA_SOURCE_PROPERTY = "jtaDataSource"; //$NON-NLS-1$
- static final String DEFAULT_JTA_DATA_SOURCE = ""; //$NON-NLS-1$
-
- String getDefaultNonJtaDataSource();
- String getNonJtaDataSource();
- void setNonJtaDataSource(String newNonJtaDataSource);
- // PersistenceUnit property
- static final String NON_JTA_DATA_SOURCE_PROPERTY = "nonJtaDataSource"; //$NON-NLS-1$
- static final String DEFAULT_NON_JTA_DATA_SOURCE = ""; //$NON-NLS-1$
Boolean getDefaultNativeSql();
Boolean getNativeSql();
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java
index bbe7b49c0a..af7f845c74 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java
@@ -11,11 +11,7 @@ package org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection
import java.util.Map;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkConnection
@@ -23,10 +19,6 @@ import org.eclipse.jpt.utility.model.value.ListValueModel;
public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
implements Connection
{
- // ********** PersistenceUnit properties **********
- private PersistenceUnitTransactionType transactionType;
- private String jtaDataSource;
- private String nonJtaDataSource;
// ********** EclipseLink properties **********
private BatchWriting batchWriting;
@@ -46,8 +38,8 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
// ********** constructors **********
- public EclipseLinkConnection(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super(parent, propertyListAdapter);
+ public EclipseLinkConnection(PersistenceUnit parent) {
+ super(parent);
}
// ********** initialization **********
@@ -57,12 +49,6 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
@Override
protected void initializeProperties() {
// TOREVIEW - handle incorrect String in persistence.xml
- this.transactionType =
- this.getPersistenceUnit().getSpecifiedTransactionType();
- this.jtaDataSource =
- this.getPersistenceUnit().getJtaDataSource();
- this.nonJtaDataSource =
- this.getPersistenceUnit().getNonJtaDataSource();
this.batchWriting =
this.getEnumValue(ECLIPSELINK_BATCH_WRITING, BatchWriting.values());
this.nativeSql =
@@ -94,25 +80,98 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
}
- /**
- * Initialize and add listeners to the persistence unit.
- */
- @Override
- protected void initialize(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super.initialize(parent, propertyListAdapter);
-
- this.getPersistenceUnit().addPropertyChangeListener(
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
- this.buildTransactionTypeChangeListener());
- this.getPersistenceUnit().addPropertyChangeListener(
- PersistenceUnit.JTA_DATA_SOURCE_PROPERTY,
- this.buildJtaDataSourceChangeListener());
- this.getPersistenceUnit().addPropertyChangeListener(
- PersistenceUnit.NON_JTA_DATA_SOURCE_PROPERTY,
- this.buildNonJtaDataSourceChangeListener());
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(ECLIPSELINK_NATIVE_SQL)) {
+ this.nativeSqlChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_BATCH_WRITING)) {
+ this.batchWritingChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS)) {
+ this.cacheStatementsChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_DRIVER)) {
+ this.driverChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_URL)) {
+ this.urlChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_USER)) {
+ this.userChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PASSWORD)) {
+ this.passwordChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_BIND_PARAMETERS)) {
+ this.bindParametersChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_SHARED)) {
+ this.readConnectionsSharedChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS_SIZE)) {
+ this.cacheStatementsSizeChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MIN)) {
+ readConnectionsMinChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MAX)) {
+ readConnectionsMaxChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MIN)) {
+ writeConnectionsMinChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MAX)) {
+ writeConnectionsMaxChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(ECLIPSELINK_NATIVE_SQL)) {
+ this.nativeSqlChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_BATCH_WRITING)) {
+ this.batchWritingChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS)) {
+ this.cacheStatementsChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_DRIVER)) {
+ this.driverChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_URL)) {
+ this.urlChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_USER)) {
+ this.userChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PASSWORD)) {
+ this.passwordChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_BIND_PARAMETERS)) {
+ this.bindParametersChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_SHARED)) {
+ this.readConnectionsSharedChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_STATEMENTS_SIZE)) {
+ this.cacheStatementsSizeChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MIN)) {
+ readConnectionsMinChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_READ_CONNECTIONS_MAX)) {
+ readConnectionsMaxChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MIN)) {
+ writeConnectionsMinChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WRITE_CONNECTIONS_MAX)) {
+ writeConnectionsMaxChanged(null);
+ }
}
- // ********** behavior **********
/**
* Adds property names key/value pairs, where:
* key = EclipseLink property key
@@ -164,151 +223,6 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
WRITE_CONNECTIONS_MAX_PROPERTY);
}
- public void propertyChanged(PropertyChangeEvent event) {
- String aspectName = event.getAspectName();
- if (aspectName.equals(NATIVE_SQL_PROPERTY)) {
- this.nativeSqlChanged(event);
- }
- else if (aspectName.equals(BATCH_WRITING_PROPERTY)) {
- this.batchWritingChanged(event);
- }
- else if (aspectName.equals(CACHE_STATEMENTS_PROPERTY)) {
- this.cacheStatementsChanged(event);
- }
- else if (aspectName.equals(DRIVER_PROPERTY)) {
- this.driverChanged(event);
- }
- else if (aspectName.equals(URL_PROPERTY)) {
- this.urlChanged(event);
- }
- else if (aspectName.equals(USER_PROPERTY)) {
- this.userChanged(event);
- }
- else if (aspectName.equals(PASSWORD_PROPERTY)) {
- this.passwordChanged(event);
- }
- else if (aspectName.equals(BIND_PARAMETERS_PROPERTY)) {
- this.bindParametersChanged(event);
- }
- else if (aspectName.equals(READ_CONNECTIONS_SHARED_PROPERTY)) {
- this.readConnectionsSharedChanged(event);
- }
- else if (aspectName.equals(CACHE_STATEMENTS_SIZE_PROPERTY)) {
- this.cacheStatementsSizeChanged(event);
- }
- else if (aspectName.equals(READ_CONNECTIONS_MIN_PROPERTY)) {
- this.readConnectionsMinChanged(event);
- }
- else if (aspectName.equals(READ_CONNECTIONS_MAX_PROPERTY)) {
- this.readConnectionsMaxChanged(event);
- }
- else if (aspectName.equals(WRITE_CONNECTIONS_MIN_PROPERTY)) {
- this.writeConnectionsMinChanged(event);
- }
- else if (aspectName.equals(WRITE_CONNECTIONS_MAX_PROPERTY)) {
- this.writeConnectionsMaxChanged(event);
- }
- }
-
- // ********** TransactionType **********
-
- public PersistenceUnitTransactionType getTransactionType() {
- return this.transactionType;
- }
-
- public void setTransactionType(PersistenceUnitTransactionType newTransactionType) {
- PersistenceUnitTransactionType old = this.transactionType;
- this.transactionType = newTransactionType;
-
- this.getPersistenceUnit().setSpecifiedTransactionType( newTransactionType);
- this.firePropertyChanged(TRANSACTION_TYPE_PROPERTY, old, newTransactionType);
- }
-
- private void transactionTypeChanged(PropertyChangeEvent event) {
- PersistenceUnitTransactionType newValue = (PersistenceUnitTransactionType) event.getNewValue();
- PersistenceUnitTransactionType old = this.transactionType;
- this.transactionType = newValue;
- this.firePropertyChanged(TRANSACTION_TYPE_PROPERTY, old, newValue);
- }
-
- public PersistenceUnitTransactionType getDefaultTransactionType() {
- return DEFAULT_TRANSACTION_TYPE;
- }
-
- protected PropertyChangeListener buildTransactionTypeChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- EclipseLinkConnection.this.transactionTypeChanged(event);
- }
- };
- }
-
- // ********** JtaDataSource **********
-
- public String getJtaDataSource() {
- return this.jtaDataSource;
- }
-
- public void setJtaDataSource(String newJtaDataSource) {
- String old = this.jtaDataSource;
- this.jtaDataSource = newJtaDataSource;
-
- this.getPersistenceUnit().setJtaDataSource( newJtaDataSource);
- this.firePropertyChanged(JTA_DATA_SOURCE_PROPERTY, old, newJtaDataSource);
- }
-
- private void jtaDataSourceChanged(PropertyChangeEvent event) {
- String newValue = (String) event.getNewValue();
- String old = this.jtaDataSource;
- this.jtaDataSource = newValue;
- this.firePropertyChanged(JTA_DATA_SOURCE_PROPERTY, old, newValue);
- }
-
- public String getDefaultJtaDataSource() {
- return DEFAULT_JTA_DATA_SOURCE;
- }
-
- protected PropertyChangeListener buildJtaDataSourceChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- EclipseLinkConnection.this.jtaDataSourceChanged(event);
- }
- };
- }
-
- // ********** NonJtaDataSource **********
-
- public String getNonJtaDataSource() {
- return this.nonJtaDataSource;
- }
-
- public void setNonJtaDataSource(String newNonJtaDataSource) {
- String old = this.nonJtaDataSource;
- this.nonJtaDataSource = newNonJtaDataSource;
-
- this.getPersistenceUnit().setNonJtaDataSource( newNonJtaDataSource);
- this.firePropertyChanged(NON_JTA_DATA_SOURCE_PROPERTY, old, newNonJtaDataSource);
- }
-
- private void nonJtaDataSourceChanged(PropertyChangeEvent event) {
- String newValue = (String) event.getNewValue();
- String old = this.nonJtaDataSource;
- this.nonJtaDataSource = newValue;
- this.firePropertyChanged(NON_JTA_DATA_SOURCE_PROPERTY, old, newValue);
- }
-
- public String getDefaultNonJtaDataSource() {
- return DEFAULT_NON_JTA_DATA_SOURCE;
- }
-
- protected PropertyChangeListener buildNonJtaDataSourceChangeListener() {
- return new PropertyChangeListener() {
- public void propertyChanged(PropertyChangeEvent event) {
- EclipseLinkConnection.this.nonJtaDataSourceChanged(event);
- }
- };
- }
-
// ********** NativeSql **********
public Boolean getNativeSql() {
return this.nativeSql;
@@ -320,14 +234,13 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.putProperty(NATIVE_SQL_PROPERTY, newNativeSql);
this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newNativeSql);
}
-
- private void nativeSqlChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+
+ private void nativeSqlChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.nativeSql;
this.nativeSql = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newValue);
}
public Boolean getDefaultNativeSql() {
@@ -347,12 +260,11 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newBatchWriting);
}
- private void batchWritingChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void batchWritingChanged(String stringValue) {
BatchWriting newValue = getEnumValueOf(stringValue, BatchWriting.values());
BatchWriting old = this.batchWriting;
this.batchWriting = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newValue);
}
public BatchWriting getDefaultBatchWriting() {
@@ -371,13 +283,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newCacheStatements);
}
- private void cacheStatementsChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void cacheStatementsChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.cacheStatements;
this.cacheStatements = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newValue);
}
public Boolean getDefaultCacheStatements() {
@@ -396,13 +307,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(CACHE_STATEMENTS_SIZE_PROPERTY, old, newCacheStatementsSize);
}
- private void cacheStatementsSizeChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void cacheStatementsSizeChanged(String stringValue) {
Integer newValue = getIntegerValueOf(stringValue);
Integer old = this.cacheStatementsSize;
this.cacheStatementsSize = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(CACHE_STATEMENTS_SIZE_PROPERTY, old, newValue);
}
public Integer getDefaultCacheStatementsSize() {
@@ -421,11 +331,10 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver);
}
- private void driverChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void driverChanged(String newValue) {
String old = this.driver;
this.driver = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(DRIVER_PROPERTY, old, newValue);
}
public String getDefaultDriver() {
@@ -444,11 +353,10 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(URL_PROPERTY, old, newUrl);
}
- private void urlChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void urlChanged(String newValue) {
String old = this.url;
this.url = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(URL_PROPERTY, old, newValue);
}
public String getDefaultUrl() {
@@ -467,11 +375,10 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(USER_PROPERTY, old, newUser);
}
- private void userChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void userChanged(String newValue) {
String old = this.user;
this.user = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(USER_PROPERTY, old, newValue);
}
public String getDefaultUser() {
@@ -490,11 +397,10 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword);
}
- private void passwordChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void passwordChanged(String newValue) {
String old = this.password;
this.password = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue);
}
public String getDefaultPassword() {
@@ -513,13 +419,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newBindParameters);
}
- private void bindParametersChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void bindParametersChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.bindParameters;
this.bindParameters = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newValue);
}
public Boolean getDefaultBindParameters() {
@@ -538,13 +443,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(READ_CONNECTIONS_SHARED_PROPERTY, old, newReadConnectionsShared);
}
- private void readConnectionsSharedChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void readConnectionsSharedChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.readConnectionsShared;
this.readConnectionsShared = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(READ_CONNECTIONS_SHARED_PROPERTY, old, newValue);
}
public Boolean getDefaultReadConnectionsShared() {
@@ -563,13 +467,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(READ_CONNECTIONS_MIN_PROPERTY, old, newReadConnectionsMin);
}
- private void readConnectionsMinChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void readConnectionsMinChanged(String stringValue) {
Integer newValue = getIntegerValueOf(stringValue);
Integer old = this.readConnectionsMin;
this.readConnectionsMin = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(READ_CONNECTIONS_MIN_PROPERTY, old, newValue);
}
public Integer getDefaultReadConnectionsMin() {
@@ -588,13 +491,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(READ_CONNECTIONS_MAX_PROPERTY, old, newReadConnectionsMax);
}
- private void readConnectionsMaxChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void readConnectionsMaxChanged(String stringValue) {
Integer newValue = getIntegerValueOf(stringValue);
Integer old = this.readConnectionsMax;
this.readConnectionsMax = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(READ_CONNECTIONS_MAX_PROPERTY, old, newValue);
}
public Integer getDefaultReadConnectionsMax() {
@@ -613,13 +515,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(WRITE_CONNECTIONS_MIN_PROPERTY, old, newWriteConnectionsMin);
}
- private void writeConnectionsMinChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void writeConnectionsMinChanged(String stringValue) {
Integer newValue = getIntegerValueOf(stringValue);
Integer old = this.writeConnectionsMin;
this.writeConnectionsMin = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WRITE_CONNECTIONS_MIN_PROPERTY, old, newValue);
}
public Integer getDefaultWriteConnectionsMin() {
@@ -638,13 +539,12 @@ public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(WRITE_CONNECTIONS_MAX_PROPERTY, old, newWriteConnectionsMax);
}
- private void writeConnectionsMaxChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void writeConnectionsMaxChanged(String stringValue) {
Integer newValue = getIntegerValueOf(stringValue);
Integer old = this.writeConnectionsMax;
this.writeConnectionsMax = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WRITE_CONNECTIONS_MAX_PROPERTY, old, newValue);
}
public Integer getDefaultWriteConnectionsMax() {
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 a3949376ef..bb656bb68e 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
@@ -18,8 +18,6 @@ import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkCustomization
@@ -44,8 +42,8 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
private Map<String, CustomizerProperties> entitiesCustomizerProperties;
// ********** constructors **********
- public EclipseLinkCustomization(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super(parent, propertyListAdapter);
+ public EclipseLinkCustomization(PersistenceUnit parent) {
+ super(parent);
}
// ********** initialization **********
@@ -120,6 +118,86 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
}
// ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(ECLIPSELINK_THROW_EXCEPTIONS)) {
+ this.throwExceptionsChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING)) {
+ this.weavingChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_LAZY)) {
+ this.weavingLazyChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_CHANGE_TRACKING)) {
+ this.weavingChangeTrackingChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_FETCH_GROUPS)) {
+ this.weavingFetchGroupsChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_INTERNAL)) {
+ this.weavingInternalChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_EAGER)) {
+ this.weavingEagerChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_VALIDATION_ONLY)) {
+ this.validationOnlyChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION_CUSTOMIZER)) {
+ this.sessionCustomizersChanged();
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) {
+ this.descriptorCustomizerChanged(propertyName, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PROFILER)) {
+ this.profilerChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EXCEPTION_HANDLER)) {
+ this.exceptionHandlerChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(ECLIPSELINK_THROW_EXCEPTIONS)) {
+ this.throwExceptionsChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING)) {
+ this.weavingChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_LAZY)) {
+ this.weavingLazyChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_CHANGE_TRACKING)) {
+ this.weavingChangeTrackingChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_FETCH_GROUPS)) {
+ this.weavingFetchGroupsChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_INTERNAL)) {
+ this.weavingInternalChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVING_EAGER)) {
+ this.weavingEagerChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_VALIDATION_ONLY)) {
+ this.validationOnlyChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION_CUSTOMIZER)) {
+ this.sessionCustomizersChanged();
+ }
+ else if (propertyName.startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) {
+ this.descriptorCustomizerChanged(propertyName, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PROFILER)) {
+ this.profilerChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EXCEPTION_HANDLER)) {
+ this.exceptionHandlerChanged(null);
+ }
+
+ }
+
/**
* Adds property names key/value pairs, where:
* key = EclipseLink property key
@@ -197,50 +275,6 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
throw new IllegalArgumentException("Illegal property: " + property); //$NON-NLS-1$
}
- public void propertyChanged(PropertyChangeEvent event) {
- String aspectName = event.getAspectName();
- if (aspectName.equals(THROW_EXCEPTIONS_PROPERTY)) {
- this.throwExceptionsChanged(event);
- }
- else if (aspectName.equals(WEAVING_PROPERTY)) {
- this.weavingChanged(event);
- }
- else if (aspectName.equals(WEAVING_LAZY_PROPERTY)) {
- this.weavingLazyChanged(event);
- }
- else if (aspectName.equals(WEAVING_CHANGE_TRACKING_PROPERTY)) {
- this.weavingChangeTrackingChanged(event);
- }
- else if (aspectName.equals(WEAVING_FETCH_GROUPS_PROPERTY)) {
- this.weavingFetchGroupsChanged(event);
- }
- else if (aspectName.equals(WEAVING_INTERNAL_PROPERTY)) {
- this.weavingInternalChanged(event);
- }
- 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);
- }
- else if (aspectName.equals(DESCRIPTOR_CUSTOMIZER_PROPERTY)) {
- this.descriptorCustomizerChanged(event);
- }
- else if (aspectName.equals(PROFILER_PROPERTY)) {
- this.profilerChanged(event);
- }
- else if (aspectName.equals(EXCEPTION_HANDLER_PROPERTY)) {
- this.exceptionHandlerChanged(event);
- }
- else {
- throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); //$NON-NLS-1$
- }
- return;
- }
-
// ********** ThrowExceptions **********
public Boolean getThrowExceptions() {
@@ -254,13 +288,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(THROW_EXCEPTIONS_PROPERTY, old, newThrowExceptions);
}
- private void throwExceptionsChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void throwExceptionsChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.throwExceptions;
this.throwExceptions = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(THROW_EXCEPTIONS_PROPERTY, old, newValue);
}
public Boolean getDefaultThrowExceptions() {
@@ -279,13 +312,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(WEAVING_LAZY_PROPERTY, old, newWeavingLazy);
}
- private void weavingLazyChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void weavingLazyChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.weavingLazy;
this.weavingLazy = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WEAVING_LAZY_PROPERTY, old, newValue);
}
public Boolean getDefaultWeavingLazy() {
@@ -304,13 +336,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(WEAVING_CHANGE_TRACKING_PROPERTY, old, newWeavingChangeTracking);
}
- private void weavingChangeTrackingChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void weavingChangeTrackingChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.weavingChangeTracking;
this.weavingChangeTracking = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WEAVING_CHANGE_TRACKING_PROPERTY, old, newValue);
}
public Boolean getDefaultWeavingChangeTracking() {
@@ -329,13 +360,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(WEAVING_FETCH_GROUPS_PROPERTY, old, newWeavingFetchGroups);
}
- private void weavingFetchGroupsChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void weavingFetchGroupsChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.weavingFetchGroups;
this.weavingFetchGroups = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WEAVING_FETCH_GROUPS_PROPERTY, old, newValue);
}
public Boolean getDefaultWeavingFetchGroups() {
@@ -354,13 +384,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(WEAVING_INTERNAL_PROPERTY, old, newWeavingInternal);
}
- private void weavingInternalChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void weavingInternalChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.weavingInternal;
this.weavingInternal = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WEAVING_INTERNAL_PROPERTY, old, newValue);
}
public Boolean getDefaultWeavingInternal() {
@@ -379,13 +408,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(WEAVING_EAGER_PROPERTY, old, newWeavingEager);
}
- private void weavingEagerChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void weavingEagerChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.weavingEager;
this.weavingEager = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WEAVING_EAGER_PROPERTY, old, newValue);
}
public Boolean getDefaultWeavingEager() {
@@ -404,13 +432,12 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(VALIDATION_ONLY_PROPERTY, old, newValidationOnly);
}
- private void validationOnlyChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void validationOnlyChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.validationOnly;
this.validationOnly = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(VALIDATION_ONLY_PROPERTY, old, newValue);
}
public Boolean getDefaultValidationOnly() {
@@ -467,7 +494,7 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
return null;
}
- private void sessionCustomizersChanged(@SuppressWarnings("unused") PropertyChangeEvent event) {
+ private void sessionCustomizersChanged() {
this.initializeSessionCustomizersFromPersistenceUnit();
this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY);
@@ -486,12 +513,11 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(WEAVING_PROPERTY, old, newWeaving);
}
- private void weavingChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void weavingChanged(String stringValue) {
Weaving newValue = getEnumValueOf(stringValue, Weaving.values());
Weaving old = this.weaving;
this.weaving = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(WEAVING_PROPERTY, old, newValue);
}
public Weaving getDefaultWeaving() {
@@ -510,11 +536,10 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(EXCEPTION_HANDLER_PROPERTY, old, newExceptionHandler);
}
- private void exceptionHandlerChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void exceptionHandlerChanged(String newValue) {
String old = this.exceptionHandler;
this.exceptionHandler = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(EXCEPTION_HANDLER_PROPERTY, old, newValue);
}
public String getDefaultExceptionHandler() {
@@ -534,14 +559,10 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.customizerPropertiesOf(entityName));
}
- private void descriptorCustomizerChanged(PropertyChangeEvent event) {
- String entityName;
- PersistenceUnit.Property newProperty = (PersistenceUnit.Property) event.getNewValue();
- // property == null when removed
- entityName = (newProperty == null) ?
- this.getEntityName((PersistenceUnit.Property) event.getOldValue()) : this.getEntityName(newProperty);
- CustomizerProperties old = this.setCustomizerClass_(newProperty, entityName);
- this.firePropertyChanged(event.getAspectName(), old, this.customizerPropertiesOf(entityName));
+ private void descriptorCustomizerChanged(String propertyName, String stringValue) {
+ String entityName = this.getEntityName(propertyName);
+ CustomizerProperties old = this.setCustomizerClass_(stringValue, entityName);
+ this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.customizerPropertiesOf(entityName));
}
public String getDefaultDescriptorCustomizer() {
@@ -722,11 +743,10 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
this.firePropertyChanged(PROFILER_PROPERTY, old, newProfiler);
}
- private void profilerChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void profilerChanged(String newValue) {
String old = this.profiler;
this.profiler = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(PROFILER_PROPERTY, old, newValue);
}
public String getDefaultProfiler() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java
index dbcf4bfb3a..3069db7479 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java
@@ -13,8 +13,6 @@ import java.util.Map;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkGeneralProperties
@@ -26,8 +24,8 @@ public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProp
private Boolean excludeEclipselinkOrm;
// ********** constructors **********
- public EclipseLinkGeneralProperties(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super(parent, propertyListAdapter);
+ public EclipseLinkGeneralProperties(PersistenceUnit parent) {
+ super(parent);
}
// ********** initialization **********
@@ -43,6 +41,20 @@ public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProp
// ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM)) {
+ excludeEclipselinkOrmChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM)) {
+ excludeEclipselinkOrmChanged(null);
+ }
+ }
+
+
/**
* Adds property names key/value pairs, where:
* key = EclipseLink property key
@@ -55,17 +67,6 @@ public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProp
EXCLUDE_ECLIPSELINK_ORM_PROPERTY);
}
- public void propertyChanged(PropertyChangeEvent event) {
- String aspectName = event.getAspectName();
- if (aspectName.equals(EXCLUDE_ECLIPSELINK_ORM_PROPERTY)) {
- this.excludeEclipselinkOrmChanged(event);
- }
- else {
- throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); //$NON-NLS-1$
- }
- return;
- }
-
// ********** ExcludeEclipselinkOrm **********
public Boolean getExcludeEclipselinkOrm() {
@@ -79,13 +80,12 @@ public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProp
this.firePropertyChanged(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, old, newExcludeEclipselinkOrm);
}
- private void excludeEclipselinkOrmChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void excludeEclipselinkOrmChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.excludeEclipselinkOrm;
this.excludeEclipselinkOrm = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, old, newValue);
}
public Boolean getDefaultExcludeEclipselinkOrm() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java
index 3a3cf744e8..5ab06afe1f 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java
@@ -12,8 +12,6 @@ package org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging;
import java.util.Map;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkLogging
@@ -31,8 +29,8 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
private String logger; // storing EclipseLinkStringValue since value can be Logger or custom class
// ********** constructors **********
- public EclipseLinkLogging(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super(parent, propertyListAdapter);
+ public EclipseLinkLogging(PersistenceUnit parent) {
+ super(parent);
}
// ********** initialization **********
@@ -72,6 +70,55 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
}
// ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(ECLIPSELINK_LEVEL)) {
+ this.levelChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TIMESTAMP)) {
+ this.timestampChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_THREAD)) {
+ this.threadChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION)) {
+ this.sessionChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EXCEPTIONS)) {
+ this.exceptionsChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_LOG_FILE_LOCATION)) {
+ this.logFileLocationChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_LOGGER)) {
+ this.loggerChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(ECLIPSELINK_LEVEL)) {
+ this.levelChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TIMESTAMP)) {
+ this.timestampChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_THREAD)) {
+ this.threadChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION)) {
+ this.sessionChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EXCEPTIONS)) {
+ this.exceptionsChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_LOG_FILE_LOCATION)) {
+ this.logFileLocationChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_LOGGER)) {
+ this.loggerChanged(null);
+ }
+ }
+
/**
* Adds property names key/value pairs, where:
* key = EclipseLink property key
@@ -102,35 +149,6 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
LOGGER_PROPERTY);
}
- public void propertyChanged(PropertyChangeEvent event) {
- String aspectName = event.getAspectName();
- if (aspectName.equals(LEVEL_PROPERTY)) {
- this.levelChanged(event);
- }
- else if (aspectName.equals(TIMESTAMP_PROPERTY)) {
- this.timestampChanged(event);
- }
- else if (aspectName.equals(THREAD_PROPERTY)) {
- this.threadChanged(event);
- }
- else if (aspectName.equals(SESSION_PROPERTY)) {
- this.sessionChanged(event);
- }
- else if (aspectName.equals(EXCEPTIONS_PROPERTY)) {
- this.exceptionsChanged(event);
- }
- else if (aspectName.equals(LOG_FILE_LOCATION_PROPERTY)) {
- this.logFileLocationChanged(event);
- }
- else if (aspectName.equals(LOGGER_PROPERTY)) {
- this.loggerChanged(event);
- }
- else {
- throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); //$NON-NLS-1$
- }
- return;
- }
-
// ********** LoggingLevel **********
public LoggingLevel getLevel() {
@@ -144,12 +162,11 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(LEVEL_PROPERTY, old, newLevel);
}
- private void levelChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void levelChanged(String stringValue) {
LoggingLevel newValue = getEnumValueOf(stringValue, LoggingLevel.values());
LoggingLevel old = this.level;
this.level = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(LEVEL_PROPERTY, old, newValue);
}
public LoggingLevel getDefaultLevel() {
@@ -168,13 +185,12 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newTimestamp);
}
- private void timestampChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void timestampChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.timestamp;
this.timestamp = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newValue);
}
public Boolean getDefaultTimestamp() {
@@ -193,13 +209,12 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(THREAD_PROPERTY, old, newThread);
}
- private void threadChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void threadChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.thread;
this.thread = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(THREAD_PROPERTY, old, newValue);
}
public Boolean getDefaultThread() {
@@ -218,13 +233,12 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(SESSION_PROPERTY, old, newSession);
}
- private void sessionChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void sessionChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.session;
this.session = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(SESSION_PROPERTY, old, newValue);
}
public Boolean getDefaultSession() {
@@ -243,13 +257,12 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newExceptions);
}
- private void exceptionsChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void exceptionsChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.exceptions;
this.exceptions = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newValue);
}
public Boolean getDefaultExceptions() {
@@ -268,11 +281,10 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, newLogFileLocation);
}
- private void logFileLocationChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void logFileLocationChanged(String newValue) {
String old = this.logFileLocation;
this.logFileLocation = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, newValue);
}
public String getDefaultLogFileLocation() {
@@ -330,11 +342,10 @@ public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(LOGGER_PROPERTY, old, newLogger);
}
- private void loggerChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void loggerChanged(String newValue) {
String old = this.logger;
this.logger = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(LOGGER_PROPERTY, old, newValue);
}
public String getDefaultLogger() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java
index 2a805c6103..fcaf4154c8 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java
@@ -12,8 +12,6 @@ package org.eclipse.jpt.eclipselink.core.internal.context.persistence.options;
import java.util.Map;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkOptions
@@ -32,8 +30,8 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
// ********** constructors **********
- public EclipseLinkOptions(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super(parent, propertyListAdapter);
+ public EclipseLinkOptions(PersistenceUnit parent) {
+ super(parent);
}
// ********** initialization **********
@@ -78,6 +76,55 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
}
// ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(ECLIPSELINK_SESSION_NAME)) {
+ this.sessionNameChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSIONS_XML)) {
+ this.sessionsXmlChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TARGET_DATABASE)) {
+ this.targetDatabaseChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TARGET_SERVER)) {
+ this.targetServerChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES)) {
+ this.includeDescriptorQueriesChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION_EVENT_LISTENER)) {
+ this.eventListenerChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TEMPORAL_MUTABLE)) {
+ this.temporalMutableChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(ECLIPSELINK_SESSION_NAME)) {
+ this.sessionNameChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSIONS_XML)) {
+ this.sessionsXmlChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TARGET_DATABASE)) {
+ this.targetDatabaseChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TARGET_SERVER)) {
+ this.targetServerChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES)) {
+ this.includeDescriptorQueriesChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SESSION_EVENT_LISTENER)) {
+ this.eventListenerChanged(null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TEMPORAL_MUTABLE)) {
+ this.temporalMutableChanged(null);
+ }
+ }
+
/**
* Adds property names key/value pairs, where:
* key = EclipseLink property key
@@ -108,35 +155,6 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
TEMPORAL_MUTABLE_PROPERTY);
}
- public void propertyChanged(PropertyChangeEvent event) {
- String aspectName = event.getAspectName();
- if (aspectName.equals(SESSION_NAME_PROPERTY)) {
- this.sessionNameChanged(event);
- }
- else if (aspectName.equals(SESSIONS_XML_PROPERTY)) {
- this.sessionsXmlChanged(event);
- }
- else if (aspectName.equals(TARGET_DATABASE_PROPERTY)) {
- this.targetDatabaseChanged(event);
- }
- else if (aspectName.equals(TARGET_SERVER_PROPERTY)) {
- this.targetServerChanged(event);
- }
- else if (aspectName.equals(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) {
- this.includeDescriptorQueriesChanged(event);
- }
- else if (aspectName.equals(SESSION_EVENT_LISTENER_PROPERTY)) {
- this.eventListenerChanged(event);
- }
- else if (aspectName.equals(TEMPORAL_MUTABLE_PROPERTY)) {
- this.temporalMutableChanged(event);
- }
- else {
- throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); //$NON-NLS-1$
- }
- return;
- }
-
// ********** SessionName **********
public String getSessionName() {
return this.sessionName;
@@ -149,39 +167,37 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newSessionName);
}
- private void sessionNameChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void sessionNameChanged(String newValue) {
String old = this.sessionName;
this.sessionName = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newValue);
}
public String getDefaultSessionName() {
return DEFAULT_SESSION_NAME;
}
- // ********** SessionsXml **********
- public String getSessionsXml() {
- return this.sessionsXml;
- }
+ // ********** SessionsXml **********
+ public String getSessionsXml() {
+ return this.sessionsXml;
+ }
- public void setSessionsXml(String newSessionsXml) {
- String old = this.sessionsXml;
- this.sessionsXml = newSessionsXml;
- this.putProperty(SESSIONS_XML_PROPERTY, newSessionsXml);
- this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newSessionsXml);
- }
+ public void setSessionsXml(String newSessionsXml) {
+ String old = this.sessionsXml;
+ this.sessionsXml = newSessionsXml;
+ this.putProperty(SESSIONS_XML_PROPERTY, newSessionsXml);
+ this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newSessionsXml);
+ }
- private void sessionsXmlChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
- String old = this.sessionsXml;
- this.sessionsXml = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
- }
+ private void sessionsXmlChanged(String newValue) {
+ String old = this.sessionsXml;
+ this.sessionsXml = newValue;
+ this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newValue);
+ }
- public String getDefaultSessionsXml() {
- return DEFAULT_SESSIONS_XML;
- }
+ public String getDefaultSessionsXml() {
+ return DEFAULT_SESSIONS_XML;
+ }
// ********** IncludeDescriptorQueries **********
public Boolean getIncludeDescriptorQueries() {
@@ -195,13 +211,12 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newIncludeDescriptorQueries);
}
- private void includeDescriptorQueriesChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void includeDescriptorQueriesChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.includeDescriptorQueries;
this.includeDescriptorQueries = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newValue);
}
public Boolean getDefaultIncludeDescriptorQueries() {
@@ -259,11 +274,10 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newTargetDatabase);
}
- private void targetDatabaseChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void targetDatabaseChanged(String newValue) {
String old = this.targetDatabase;
this.targetDatabase = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newValue);
}
public String getDefaultTargetDatabase() {
@@ -321,11 +335,10 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newTargetServer);
}
- private void targetServerChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void targetServerChanged(String newValue) {
String old = this.targetServer;
this.targetServer = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newValue);
}
public String getDefaultTargetServer() {
@@ -344,11 +357,10 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newEventListener);
}
- private void eventListenerChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void eventListenerChanged(String newValue) {
String old = this.eventListener;
this.eventListener = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newValue);
}
public String getDefaultEventListener() {
@@ -368,13 +380,12 @@ public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties
this.firePropertyChanged(TEMPORAL_MUTABLE_PROPERTY, old, newTemporalMutable);
}
- private void temporalMutableChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void temporalMutableChanged(String stringValue) {
Boolean newValue = getBooleanValueOf(stringValue);
Boolean old = this.temporalMutable;
this.temporalMutable = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(TEMPORAL_MUTABLE_PROPERTY, old, newValue);
}
public Boolean getDefaultTemporalMutable() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java
index 24d4ef042f..685ff175c5 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java
@@ -12,8 +12,6 @@ package org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.gen
import java.util.Map;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
-import org.eclipse.jpt.utility.model.event.PropertyChangeEvent;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
/**
* EclipseLinkSchemaGeneration encapsulates EclipseLink SchemaGeneration
@@ -32,8 +30,8 @@ public class EclipseLinkSchemaGeneration
// ********** constructors/initialization **********
- public EclipseLinkSchemaGeneration(PersistenceUnit parent, ListValueModel<PersistenceUnit.Property> propertyListAdapter) {
- super(parent, propertyListAdapter);
+ public EclipseLinkSchemaGeneration(PersistenceUnit parent) {
+ super(parent);
}
/**
@@ -77,28 +75,41 @@ public class EclipseLinkSchemaGeneration
}
// ********** behavior **********
- public void propertyChanged(PropertyChangeEvent event) {
- String aspectName = event.getAspectName();
-
- if (aspectName.equals(OUTPUT_MODE_PROPERTY)) {
- this.outputModeChanged(event);
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE)) {
+ this.outputModeChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_TYPE)) {
+ this.ddlGenerationTypeChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CREATE_FILE_NAME)) {
+ this.createFileNameChanged(newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_DROP_FILE_NAME)) {
+ this.dropFileNameChanged(newValue);
}
- else if (aspectName.equals(DDL_GENERATION_TYPE_PROPERTY)) {
- this.ddlGenerationTypeChanged(event);
+ else if (propertyName.equals(ECLIPSELINK_APPLICATION_LOCATION)) {
+ this.applicationLocationChanged(newValue);
+ }
+ }
+
+ public void propertyRemoved(String propertyName) {
+ if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE)) {
+ this.outputModeChanged(null);
}
- else if (aspectName.equals(CREATE_FILE_NAME_PROPERTY)) {
- this.createFileNameChanged(event);
+ else if (propertyName.equals(ECLIPSELINK_DDL_GENERATION_TYPE)) {
+ this.ddlGenerationTypeChanged(null);
}
- else if (aspectName.equals(DROP_FILE_NAME_PROPERTY)) {
- this.dropFileNameChanged(event);
+ else if (propertyName.equals(ECLIPSELINK_CREATE_FILE_NAME)) {
+ this.createFileNameChanged(null);
}
- else if (aspectName.equals(APPLICATION_LOCATION_PROPERTY)) {
- this.applicationLocationChanged(event);
+ else if (propertyName.equals(ECLIPSELINK_DROP_FILE_NAME)) {
+ this.dropFileNameChanged(null);
}
- else {
- throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName);
+ else if (propertyName.equals(ECLIPSELINK_APPLICATION_LOCATION)) {
+ this.applicationLocationChanged(null);
}
- return;
}
// ********** DdlGenerationType **********
@@ -113,12 +124,11 @@ public class EclipseLinkSchemaGeneration
this.firePropertyChanged(DDL_GENERATION_TYPE_PROPERTY, old, newDdlGenType);
}
- private void ddlGenerationTypeChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void ddlGenerationTypeChanged(String stringValue) {
DdlGenerationType newValue = getEnumValueOf(stringValue, DdlGenerationType.values());
DdlGenerationType old = this.ddlGenerationType;
this.ddlGenerationType = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(DDL_GENERATION_TYPE_PROPERTY, old, newValue);
}
public DdlGenerationType getDefaultDdlGenerationType() {
@@ -137,12 +147,11 @@ public class EclipseLinkSchemaGeneration
this.firePropertyChanged(OUTPUT_MODE_PROPERTY, old, newOutputMode);
}
- private void outputModeChanged(PropertyChangeEvent event) {
- String stringValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void outputModeChanged(String stringValue) {
OutputMode newValue = getEnumValueOf(stringValue, OutputMode.values());
OutputMode old = this.outputMode;
this.outputMode = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(OUTPUT_MODE_PROPERTY, old, newValue);
}
public OutputMode getDefaultOutputMode() {
@@ -161,11 +170,10 @@ public class EclipseLinkSchemaGeneration
this.firePropertyChanged(CREATE_FILE_NAME_PROPERTY, old, newCreateFileName);
}
- private void createFileNameChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void createFileNameChanged(String newValue) {
String old = this.createFileName;
this.createFileName = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(CREATE_FILE_NAME_PROPERTY, old, newValue);
}
public String getDefaultCreateFileName() {
@@ -184,11 +192,10 @@ public class EclipseLinkSchemaGeneration
this.firePropertyChanged(DROP_FILE_NAME_PROPERTY, old, newDropFileName);
}
- private void dropFileNameChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void dropFileNameChanged(String newValue) {
String old = this.dropFileName;
this.dropFileName = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(DROP_FILE_NAME_PROPERTY, old, newValue);
}
public String getDefaultDropFileName() {
@@ -207,11 +214,10 @@ public class EclipseLinkSchemaGeneration
this.firePropertyChanged(APPLICATION_LOCATION_PROPERTY, old, newApplicationLocation);
}
- private void applicationLocationChanged(PropertyChangeEvent event) {
- String newValue = (event.getNewValue() == null) ? null : ((PersistenceUnit.Property) event.getNewValue()).getValue();
+ private void applicationLocationChanged(String newValue) {
String old = this.applicationLocation;
this.applicationLocation = newValue;
- this.firePropertyChanged(event.getAspectName(), old, newValue);
+ this.firePropertyChanged(APPLICATION_LOCATION_PROPERTY, old, newValue);
}
public String getDefaultApplicationLocation() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java
index fa7d9b329f..cd6fe7d8bd 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
@@ -41,10 +42,10 @@ public class DataSourcePropertiesComposite extends Pane<Connection> {
}
private WritablePropertyValueModel<String> buildJtaDataSourceHolder() {
- return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.JTA_DATA_SOURCE_PROPERTY) {
+ return new PropertyAspectAdapter<PersistenceUnit, String>(buildPersistenceUnitHolder(), PersistenceUnit.JTA_DATA_SOURCE_PROPERTY) {
@Override
protected String buildValue_() {
- return subject.getJtaDataSource();
+ return this.subject.getJtaDataSource();
}
@Override
@@ -52,7 +53,7 @@ public class DataSourcePropertiesComposite extends Pane<Connection> {
if (value.length() == 0) {
value = null;
}
- subject.setJtaDataSource(value);
+ this.subject.setJtaDataSource(value);
}
};
}
@@ -67,10 +68,10 @@ public class DataSourcePropertiesComposite extends Pane<Connection> {
}
private WritablePropertyValueModel<String> buildNonJtaDataSourceHolder() {
- return new PropertyAspectAdapter<Connection, String>(getSubjectHolder(), Connection.NON_JTA_DATA_SOURCE_PROPERTY) {
+ return new PropertyAspectAdapter<PersistenceUnit, String>(buildPersistenceUnitHolder(), PersistenceUnit.NON_JTA_DATA_SOURCE_PROPERTY) {
@Override
protected String buildValue_() {
- return subject.getNonJtaDataSource();
+ return this.subject.getNonJtaDataSource();
}
@Override
@@ -78,7 +79,7 @@ public class DataSourcePropertiesComposite extends Pane<Connection> {
if (value.length() == 0) {
value = null;
}
- subject.setNonJtaDataSource(value);
+ this.subject.setNonJtaDataSource(value);
}
};
}
@@ -87,20 +88,33 @@ public class DataSourcePropertiesComposite extends Pane<Connection> {
return new TransformationPropertyValueModel<PersistenceUnitTransactionType, Boolean>(buildTransactionTypeHolder()) {
@Override
protected Boolean transform(PersistenceUnitTransactionType value) {
- return value == PersistenceUnitTransactionType.RESOURCE_LOCAL;
+ return Boolean.valueOf(value == PersistenceUnitTransactionType.RESOURCE_LOCAL);
}
};
}
private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeHolder() {
- return new PropertyAspectAdapter<Connection, PersistenceUnitTransactionType>(getSubjectHolder(), Connection.TRANSACTION_TYPE_PROPERTY) {
+ return new PropertyAspectAdapter<PersistenceUnit, PersistenceUnitTransactionType>(
+ buildPersistenceUnitHolder(),
+ PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
+ PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
@Override
protected PersistenceUnitTransactionType buildValue_() {
- return subject.getTransactionType();
+ return this.subject.getTransactionType();
}
};
}
+ private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
+ return new PropertyAspectAdapter<Connection, PersistenceUnit>(getSubjectHolder()) {
+ @Override
+ protected PersistenceUnit buildValue_() {
+ return this.subject.getPersistenceUnit();
+ }
+ };
+
+ }
+
@Override
protected void initializeLayout(Composite container) {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java
index aade59a729..a4b532efac 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2008 Oracle. All rights reserved.
+* Copyright (c) 2008, 2009 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
@@ -40,14 +41,27 @@ public class JdbcPropertiesComposite extends Pane<Connection>
}
private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeHolder() {
- return new PropertyAspectAdapter<Connection, PersistenceUnitTransactionType>(getSubjectHolder(), Connection.TRANSACTION_TYPE_PROPERTY) {
+ return new PropertyAspectAdapter<PersistenceUnit, PersistenceUnitTransactionType>(
+ buildPersistenceUnitHolder(),
+ PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
+ PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
@Override
protected PersistenceUnitTransactionType buildValue_() {
- return subject.getTransactionType();
+ return this.subject.getTransactionType();
}
};
}
+ private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
+ return new PropertyAspectAdapter<Connection, PersistenceUnit>(getSubjectHolder()) {
+ @Override
+ protected PersistenceUnit buildValue_() {
+ return this.subject.getPersistenceUnit();
+ }
+ };
+
+ }
+
@Override
protected void initializeLayout(Composite container) {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java
index 36b689271a..195c44c55a 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,11 +10,15 @@
package org.eclipse.jpt.eclipselink.ui.internal.persistence.connection;
import java.util.Collection;
+
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection;
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.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
/**
@@ -37,12 +41,12 @@ public class TransactionTypeComposite extends FormPane<Connection>
super( parentComposite, parent);
}
- private EnumFormComboViewer<Connection, PersistenceUnitTransactionType> addTransactionTypeCombo(Composite container) {
- return new EnumFormComboViewer<Connection, PersistenceUnitTransactionType>(this, container) {
+ private EnumFormComboViewer<PersistenceUnit, PersistenceUnitTransactionType> addTransactionTypeCombo(Composite container) {
+ return new EnumFormComboViewer<PersistenceUnit, PersistenceUnitTransactionType>(this, buildPersistenceUnitHolder(), container) {
@Override
protected void addPropertyNames(Collection<String> propertyNames) {
super.addPropertyNames(propertyNames);
- propertyNames.add(Connection.TRANSACTION_TYPE_PROPERTY);
+ propertyNames.add(PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY);
}
@Override
@@ -67,7 +71,7 @@ public class TransactionTypeComposite extends FormPane<Connection>
@Override
protected void setValue(PersistenceUnitTransactionType value) {
- getSubject().setTransactionType(value);
+ getSubject().setSpecifiedTransactionType(value);
if (value == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
clearJTAProperties();
@@ -79,13 +83,23 @@ public class TransactionTypeComposite extends FormPane<Connection>
};
}
+ private PropertyValueModel<PersistenceUnit> buildPersistenceUnitHolder() {
+ return new PropertyAspectAdapter<Connection, PersistenceUnit>(getSubjectHolder()) {
+ @Override
+ protected PersistenceUnit buildValue_() {
+ return this.subject.getPersistenceUnit();
+ }
+ };
+
+ }
+
private void clearJTAProperties() {
- getSubject().setJtaDataSource(null);
+ getSubject().getPersistenceUnit().setJtaDataSource(null);
}
private void clearResourceLocalProperties() {
Connection connection = getSubject();
- connection.setNonJtaDataSource(null);
+ connection.getPersistenceUnit().setNonJtaDataSource(null);
connection.setDriver(null);
connection.setUrl(null);
connection.setUser(null);

Back to the top