diff options
37 files changed, 170 insertions, 257 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java index 2b27f8eb39..e11054ca35 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -175,7 +175,7 @@ public interface JpaFactory { // ********** Java Context Model ********** - JavaPersistentType buildJavaPersistentType(PersistentType.Parent parent, JavaResourceType jrt); + JavaPersistentType buildJavaPersistentType(JavaPersistentType.Parent parent, JavaResourceType jrt); JavaEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java index 1540e66d4a..d8a967ab05 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Oracle. All rights reserved. + * Copyright (c) 2008, 2015 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. @@ -69,13 +69,6 @@ public interface MappingFile */ void addRootStructureNodesTo(JpaFile jpaFile, Collection<JpaStructureNode> rootStructureNodes); - /** - * Dispose the structure node and its children. - * Typically this would be used to update the structure node's - * JPA file's root structure nodes. - */ - void dispose(); - // ********** queries/generators ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java index 48971a997f..674aff9042 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java @@ -119,6 +119,12 @@ public interface PersistentType */ TypeBinding getAttributeTypeBinding(PersistentAttribute attribute); + /** + * One of the persistent type's attributes changed. + * Notify interested parties (e.g. "virtual" copies of the attribute). + */ + void attributeChanged(PersistentAttribute attribute); + // ********** inheritance ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java index e448246a43..0b422b5aba 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Oracle. All rights reserved. + * Copyright (c) 2009, 2015 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. @@ -67,12 +67,6 @@ public interface XmlFile */ void addRootStructureNodesTo(JpaFile jpaFile, Collection<JpaStructureNode> rootStructureNodes); - /** - * Dispose the structure node and its children. - * Typically this would be used to update the structure node's - * JPA file's root structure nodes. - */ - void dispose(); // ********** XML file root element ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java index 2ac7358c94..8644cb4746 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 Oracle. All rights reserved. + * Copyright (c) 2006, 2015 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. @@ -48,4 +48,17 @@ public interface JavaPersistentType boolean hasAnyAnnotatedAttributes(); JavaSpecifiedPersistentAttribute getAttributeFor(JavaResourceAttribute javaResourceAttribute); + + + // ********** parent ********** + + interface Parent + extends PersistentType.Parent + { + /** + * One of the persistent type's persistent attribute changed. + * Notify interested parties (e.g. "virtual" copies of the persistent attribute). + */ + void attributeChanged(JavaSpecifiedPersistentAttribute javaAttribute); + } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java index c2de52c9b7..704944ff22 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -223,7 +223,4 @@ public interface EntityMappings * corresponding mapping types. */ void addPersistentTypes(PersistentType.Config[] typeConfigs, IProgressMonitor monitor); - - //TODO would like to remove this eventually - void dispose(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManagedType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManagedType.java index aa8e71282c..f056b8da8b 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManagedType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManagedType.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2013 Oracle. All rights reserved.
+ * Copyright (c) 2013, 2015 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.
@@ -95,7 +95,4 @@ public interface OrmManagedType * mappings.
*/
String getDefaultPackage();
-
- //TODO would like to remove this eventually
- void dispose();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java index 8445368a56..50aa043d63 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 Oracle. All rights reserved. + * Copyright (c) 2010, 2015 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. @@ -105,6 +105,12 @@ public interface OrmPersistentAttribute */ OrmSpecifiedPersistentAttribute addToXml(String mappingKey); - //TODO would like to remove this eventually - void dispose(); + + // ********** Java to virtual notification ********** + + /** + * The specified Java persistent attribute changed in some way; + * so the corresponding virtual persistent attribute may need to update its state. + */ + void javaAttributeChanged(JavaSpecifiedPersistentAttribute attribute); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java index 80e3d7bf82..904748e5d7 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -167,7 +167,4 @@ public interface MappingFileRef return ref.getMappingFileGenerators(); } } - - //TODO would like to remove this eventually - void dispose(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java index 29b96c7498..cd81565a87 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -86,8 +86,4 @@ public interface Persistence * Remove the persistence unit at the specified index from the persistence node. */ void removePersistenceUnit(int index); - - //TODO would like to remove this eventually - void dispose(); - } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java index 929eec7fdd..ec1cdd1555 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -840,7 +840,4 @@ public interface PersistenceUnit * (For instance, if the connection is not active, then it should not.) */ boolean validatesAgainstDatabase(); - - //TODO would like to remove this eventually - void dispose(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java index 0e2e6b72dd..65f5bcf6ce 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -205,7 +205,7 @@ public abstract class AbstractJpaFactory // ********** Java Context Model ********** - public JavaPersistentType buildJavaPersistentType(PersistentType.Parent parent, JavaResourceType jrt) { + public JavaPersistentType buildJavaPersistentType(JavaPersistentType.Parent parent, JavaResourceType jrt) { return new GenericJavaPersistentType(parent, jrt); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java index c68ec2e108..3299a467b4 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java @@ -113,6 +113,17 @@ public abstract class AbstractJavaPersistentAttribute throw new UnsupportedOperationException(); } + /** + * Notify the persistent type of any change. + * This is relevant only when the persistent type's parent is an ORM persistent type, + * which will update its default attribute corresponding to this attribute. + */ + @Override + public void stateChanged() { + this.parent.attributeChanged(this); + super.stateChanged(); + } + // ********** name ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java index c640846df5..497030caf6 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java @@ -57,7 +57,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; * </ul> */ public abstract class AbstractJavaPersistentType - extends AbstractJavaManagedType<PersistentType.Parent> + extends AbstractJavaManagedType<JavaPersistentType.Parent> implements JavaPersistentType { protected AccessType specifiedAccess; @@ -70,7 +70,7 @@ public abstract class AbstractJavaPersistentType protected final Vector<JavaSpecifiedPersistentAttribute> structureChildren = new Vector<>(); - protected AbstractJavaPersistentType(PersistentType.Parent parent, JavaResourceType resourceType) { + protected AbstractJavaPersistentType(JavaPersistentType.Parent parent, JavaResourceType resourceType) { super(parent, resourceType); this.specifiedAccess = this.buildSpecifiedAccess(); @@ -652,6 +652,15 @@ public abstract class AbstractJavaPersistentType return (setterMethod != null) || getterMethod.isAnnotated(); } + /** + * Forward notification to parent. + * This is relevant only when the parent is an ORM persistent type, + * which will update its default attributes. + */ + public void attributeChanged(PersistentAttribute attribute) { + this.parent.attributeChanged((JavaSpecifiedPersistentAttribute) attribute); + } + // ********** inheritance ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java index 4ad8913d7d..99963c13f9 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 Oracle. All rights reserved. + * Copyright (c) 2010, 2015 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. @@ -17,9 +17,9 @@ import org.eclipse.jpt.common.core.utility.TextRange; import org.eclipse.jpt.common.utility.internal.ObjectTools; import org.eclipse.jpt.jpa.core.context.AccessType; import org.eclipse.jpt.jpa.core.context.IdTypeMapping; -import org.eclipse.jpt.jpa.core.context.PersistentType; import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedPersistentAttribute; import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation; import org.eclipse.jpt.jpa.core.validation.JptJpaCoreValidationMessages; @@ -31,7 +31,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; */ public class GenericJavaIdClassReference extends AbstractJavaContextModel<JavaTypeMapping> - implements JavaIdClassReference, PersistentType.Parent { + implements JavaIdClassReference, JavaPersistentType.Parent { protected String specifiedIdClassName; @@ -256,7 +256,7 @@ public class GenericJavaIdClassReference } - // ********** PersistentType.Parent implementation ********** + // ********** JavaPersistentType.Parent implementation ********** public AccessType getOverridePersistentTypeAccess() { return this.getPersistentType().getAccess(); @@ -267,6 +267,10 @@ public class GenericJavaIdClassReference return this.getPersistentType().getAccess(); } + public void attributeChanged(JavaSpecifiedPersistentAttribute attribute) { + // NOP + } + // ********** validation ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentTypeDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentTypeDefinition.java index 852817dff8..19b519fdfd 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentTypeDefinition.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentTypeDefinition.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2013 Oracle. All rights reserved.
+ * Copyright (c) 2013, 2015 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.
@@ -46,6 +46,6 @@ public class JavaPersistentTypeDefinition }
public JavaPersistentType buildContextManagedType(JpaContextModel parent, JavaResourceType jrt, JpaFactory factory) {
- return factory.buildJavaPersistentType((PersistentType.Parent) parent, jrt);
+ return factory.buildJavaPersistentType((JavaPersistentType.Parent) parent, jrt);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java index 4b3b6d6546..76bc4900b9 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 Oracle. All rights reserved. + * Copyright (c) 2006, 2015 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. @@ -268,12 +268,6 @@ public abstract class AbstractEntityMappings return this; } - public void dispose() { - for (OrmPersistentType persistentType : this.getPersistentTypes()) { - persistentType.dispose(); - } - } - // ********** PersistentType.Parent implementation ********** @@ -857,13 +851,8 @@ public abstract class AbstractEntityMappings managedType.removeXmlManagedTypeFrom(this.xmlEntityMappings); } - /** - * dispose and return the managed type - */ protected OrmManagedType removeManagedType_(int index) { - OrmManagedType managedType = this.removeItemFromList(index, this.managedTypes, MANAGED_TYPES_LIST); - managedType.dispose(); - return managedType; + return this.removeItemFromList(index, this.managedTypes, MANAGED_TYPES_LIST); } public void removeManagedType(OrmManagedType managedType) { diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmPersistentAttribute.java index 911c883bff..92dda336e2 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmPersistentAttribute.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 Oracle. All rights reserved. + * Copyright (c) 2006, 2015 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. @@ -429,6 +429,13 @@ public abstract class AbstractOrmPersistentAttribute throw new UnsupportedOperationException(); } + /** + * This should be called on only "virtual" attributes. + */ + public void javaAttributeChanged(JavaSpecifiedPersistentAttribute attribute) { + throw new UnsupportedOperationException(); + } + // ********** JpaStructureNode implementation ********** @@ -464,10 +471,6 @@ public abstract class AbstractOrmPersistentAttribute return this.mapping.getSelectionTextRange(); } - public void dispose() { - // nothing to dispose - } - // ********** refactoring ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java index 4b6fab8204..bbadb37356 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 Oracle. All rights reserved. + * Copyright (c) 2010, 2015 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. @@ -22,9 +22,9 @@ import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterable.IterableTools; import org.eclipse.jpt.jpa.core.context.AccessType; import org.eclipse.jpt.jpa.core.context.IdTypeMapping; -import org.eclipse.jpt.jpa.core.context.PersistentType; import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedPersistentAttribute; import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference; import org.eclipse.jpt.jpa.core.context.orm.OrmIdTypeMapping; @@ -43,7 +43,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; */ public class GenericOrmIdClassReference extends AbstractOrmXmlContextModel<OrmIdTypeMapping> - implements OrmIdClassReference, PersistentType.Parent { + implements OrmIdClassReference, JavaPersistentType.Parent { protected String specifiedIdClassName; protected String defaultIdClassName; @@ -285,7 +285,7 @@ public class GenericOrmIdClassReference } - // ********** PersistentType.Parent implementation ********** + // ********** JavaPersistentType.Parent implementation ********** public AccessType getOverridePersistentTypeAccess() { return this.getPersistentType().getAccess(); @@ -296,6 +296,10 @@ public class GenericOrmIdClassReference return this.getPersistentType().getAccess(); } + public void attributeChanged(JavaSpecifiedPersistentAttribute attribute) { + // NOP + } + // ********** refactoring ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java index 705eabd83c..695167f8fc 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java @@ -48,6 +48,7 @@ import org.eclipse.jpt.jpa.core.context.TypeMapping; import org.eclipse.jpt.jpa.core.context.TypeRefactoringParticipant; import org.eclipse.jpt.jpa.core.context.java.JavaManagedType; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedPersistentAttribute; import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; @@ -81,7 +82,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; */ public abstract class SpecifiedOrmPersistentType extends AbstractOrmManagedType<EntityMappings> - implements OrmPersistentType, PersistentType2_0, PersistentType.Parent + implements OrmPersistentType, PersistentType2_0, JavaPersistentType.Parent { protected OrmTypeMapping mapping; // never null @@ -300,8 +301,12 @@ public abstract class SpecifiedOrmPersistentType public TypeBinding getAttributeTypeBinding(PersistentAttribute attribute) { return (this.getJavaPersistentType() == null) ? null : this.getJavaPersistentType().getAttributeTypeBinding(attribute); } - - + + public void attributeChanged(PersistentAttribute attribute) { + // NOP + } + + // ********** attribute conversions ********** public OrmSpecifiedPersistentAttribute addAttributeToXml(OrmPersistentAttribute defaultAttribute) { @@ -328,7 +333,6 @@ public abstract class SpecifiedOrmPersistentType // silently remove the default attribute int defaultIndex = this.defaultAttributes.indexOf(defaultAttribute); this.defaultAttributes.remove(defaultIndex); - defaultAttribute.dispose(); // silently add the specified attribute OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey); @@ -902,7 +906,6 @@ public abstract class SpecifiedOrmPersistentType } protected void removeDefaultAttribute(OrmPersistentAttribute defaultAttribute) { - defaultAttribute.dispose(); this.removeItemFromList(defaultAttribute, this.defaultAttributes, DEFAULT_ATTRIBUTES_LIST); } @@ -1058,14 +1061,8 @@ public abstract class SpecifiedOrmPersistentType return this; } - public void dispose() { - for (OrmPersistentAttribute defaultAttribute : this.getDefaultAttributes()) { - defaultAttribute.dispose(); - } - } - - // ********** PersistentType.Parent implementation ********** + // ********** JavaPersistentType.Parent implementation ********** public AccessType getOverridePersistentTypeAccess() { if (this.specifiedAccess != null) { @@ -1101,6 +1098,17 @@ public abstract class SpecifiedOrmPersistentType return this.getEntityMappings().getDefaultPersistentTypeAccess(); } + /** + * One of the {@link #javaManagedType} attributes changed. + * Forward notification to the default attributes, as one of them + * will need to sync with the Java attribute. + */ + public void attributeChanged(JavaSpecifiedPersistentAttribute javaAttribute) { + for (OrmPersistentAttribute attribute : this.getDefaultAttributes()) { + attribute.javaAttributeChanged(javaAttribute); + } + } + //*********** refactoring *********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java index 8c0608a067..473f16ad50 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java @@ -54,33 +54,34 @@ public class VirtualOrmPersistentAttribute * because the Java attribute's <em>context</em> is the <code>orm.xml</code> * type (e.g. the Java attribute's default table is the table set in the * <code>orm.xml</code> type, not the Java type). - * The {@link #originalJavaAttributeListener} keeps this attribute in sync - * with any changes made via the Java context model. + * We can keep this attribute in sync because we are notified of + * any changes made via the Java context model + * (see {@link org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute#stateChanged()}). */ protected final JavaSpecifiedPersistentAttribute annotatedJavaAttribute; /** * This is the "original" Java persistent attribute corresponding to * {@link #javaAccessor} from the Java context model. - * If it is found (it can be <code>null</code> if the <code>orm.xml</code> - * access type differs from the Java access type), we need to listen to it - * for changes so we can refresh our "local" Java attributes (since the + * (It can be <code>null</code> if the <code>orm.xml</code> + * access type differs from the Java access type.) + * We are notified when it changes + * (see {@link org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute#stateChanged()}) + * so we can refresh our "local" Java attributes (since the * Java resource model does not fire change events, and trigger a * <em>sync</em>, when it is modified by the Java context model - if there * is no Java context attribute, the Java resource model can only be * modified via source code editing and we will <em>sync</em> appropriately). */ protected JavaSpecifiedPersistentAttribute originalJavaAttribute; - protected StateChangeListener originalJavaAttributeListener; /** * This is a simulated "unannotated" Java persistent attribute. It is built * only if necessary (i.e. when the <code>orm.xml</code> persistent type * has been tagged <em>metadata complete</em>). Like * {@link #annotatedJavaAttribute}, its parent is an - * <code>orm.xml</code> persistent type. - * The {@link #originalJavaAttributeListener} keeps this attribute in sync - * with any changes made via the Java context model. + * <code>orm.xml</code> persistent type and we are notified of any + * changes made via the Java context model. */ protected JavaSpecifiedPersistentAttribute unannotatedJavaAttribute; @@ -204,34 +205,7 @@ public class VirtualOrmPersistentAttribute // ********** original Java persistent attribute ********** protected void updateOriginalJavaAttribute() { - JavaSpecifiedPersistentAttribute newJavaAttribute = this.resolveJavaPersistentAttribute(); //yes, this is the "original" java attribute - if (newJavaAttribute != this.originalJavaAttribute) { - if (newJavaAttribute == null) { - this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener()); - this.originalJavaAttribute = null; - } else { - if (this.originalJavaAttribute != null) { - this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener()); - } - this.originalJavaAttribute = newJavaAttribute; - this.originalJavaAttribute.addStateChangeListener(this.getOriginalJavaAttributeListener()); - } - } - } - - protected StateChangeListener getOriginalJavaAttributeListener() { - if (this.originalJavaAttributeListener == null) { - this.originalJavaAttributeListener = this.buildOriginalJavaAttributeListener(); - } - return this.originalJavaAttributeListener; - } - - protected StateChangeListener buildOriginalJavaAttributeListener() { - return new StateChangeListener() { - public void stateChanged(StateChangeEvent event) { - VirtualOrmPersistentAttribute.this.originalJavaAttributeChanged(); - } - }; + this.originalJavaAttribute = this.resolveJavaPersistentAttribute(); // yes, this is the "original" java attribute } /** @@ -241,8 +215,10 @@ public class VirtualOrmPersistentAttribute * context model is modifying the Java resource model, but is redundant when * the Java resource model is triggering a <em>sync</em>. */ - protected void originalJavaAttributeChanged() { - this.syncLocalJavaAttributes(); + public void javaAttributeChanged(JavaSpecifiedPersistentAttribute attribute) { + if (this.originalJavaAttribute == attribute) { + this.syncLocalJavaAttributes(); + } } @@ -336,12 +312,6 @@ public class VirtualOrmPersistentAttribute throw new UnsupportedOperationException(); } - public void dispose() { - if (this.originalJavaAttribute != null) { - this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener()); - } - } - // ********** validation ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java index d804a6b737..8afd50cca5 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -129,10 +129,7 @@ public abstract class AbstractMappingFileRef<MF extends MappingFile> protected void syncMappingFile(boolean sync) { Object newResourceMappingFile = this.resolveResourceMappingFile(); if (newResourceMappingFile == null) { - if (this.mappingFile != null) { - this.mappingFile.dispose(); - this.setMappingFile(null); - } + this.setMappingFile(null); } else { if (this.mappingFile == null) { this.setMappingFile(this.buildMappingFile(newResourceMappingFile)); @@ -152,7 +149,6 @@ public abstract class AbstractMappingFileRef<MF extends MappingFile> // it will not be possible to hit it now that I null out the mappingFile in dispose() ~kfb] // System.out.println("AbstractMappingFileRef.syncMappingFile"); // if the resource's content type has changed, we completely rebuild the mapping file - this.mappingFile.dispose(); this.setMappingFile(this.buildMappingFile(newResourceMappingFile)); } } @@ -188,14 +184,6 @@ public abstract class AbstractMappingFileRef<MF extends MappingFile> return this; } - public void dispose() { - if (this.mappingFile != null) { - this.mappingFile.dispose(); - //need to null this because we are storing the "potential" mappingFileRef in the PersistenceUnit - this.mappingFile = null; - } - } - public Iterable<JpaStructureNode> getStructureChildren() { return IterableTools.emptyIterable(); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java index bec46f3395..e0b78f02f0 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java @@ -386,12 +386,6 @@ public abstract class AbstractPersistenceUnit return this; } - public void dispose() { - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - mappingFileRef.dispose(); - } - } - // ********** name ********** @@ -621,8 +615,7 @@ public abstract class AbstractPersistenceUnit } protected ContextListContainer<MappingFileRef, XmlMappingFileRef> buildSpecifiedMappingFileRefContainer() { - return new SpecifiedMappingFileRefContainer(SPECIFIED_MAPPING_FILE_REFS_LIST, new SpecifiedMappingFileRefContainerAdapter()); - // return this.buildSpecifiedContextListContainer(SPECIFIED_MAPPING_FILE_REFS_LIST, new SpecifiedMappingFileRefContainerAdapter()); + return this.buildSpecifiedContextListContainer(SPECIFIED_MAPPING_FILE_REFS_LIST, new SpecifiedMappingFileRefContainerAdapter()); } /** @@ -642,41 +635,6 @@ public abstract class AbstractPersistenceUnit } } - // TODO - remove once we remove need for dispose... - public class SpecifiedMappingFileRefContainer - extends SpecifiedContextListContainer<MappingFileRef, XmlMappingFileRef> - { - public SpecifiedMappingFileRefContainer(String aspectName, Container.Adapter<MappingFileRef, XmlMappingFileRef> adapter) { - super(aspectName, adapter); - } - @Override - public void clear() { - Object[] temp = this.elements.toArray(); - super.clear(); - for (Object element : temp) { - ((MappingFileRef) element).dispose(); - } - } - @Override - public MappingFileRef remove(int index) { - MappingFileRef element = super.remove(index); - element.dispose(); - return element; - } - @Override - public void remove(MappingFileRef element) { - super.remove(element); - element.dispose(); - } - @Override - public void removeAll(Iterable<MappingFileRef> contextElements) { - super.removeAll(contextElements); - for (MappingFileRef element : contextElements) { - element.dispose(); - } - } - } - // ********** implied mapping file ref ********** @@ -702,9 +660,7 @@ public abstract class AbstractPersistenceUnit if (this.usesImpliedMappingFile()) { this.setImpliedMappingFileRef(this.potentialImpliedMappingFileRef); this.impliedMappingFileRef.update(); - } - else if (this.impliedMappingFileRef != null) { - this.impliedMappingFileRef.dispose(); + } else { this.setImpliedMappingFileRef(null); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericContextRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericContextRoot.java index 26a6320d0e..ef9cf5ef60 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericContextRoot.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericContextRoot.java @@ -114,10 +114,7 @@ public class GenericContextRoot protected void syncPersistenceXml(boolean sync) { JptXmlResource xmlResource = this.resolvePersistenceXmlResource(); if (xmlResource == null) { - if (this.persistenceXml != null) { - this.persistenceXml.dispose(); - this.setPersistenceXml(null); - } + this.setPersistenceXml(null); } else { if (this.persistenceXml == null) { this.setPersistenceXml(this.buildPersistenceXml(xmlResource)); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java index 993ea8d4ba..a083bb1c8a 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Oracle. All rights reserved. + * Copyright (c) 2009, 2015 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. @@ -29,6 +29,7 @@ import org.eclipse.jpt.jpa.core.context.java.JarFile; import org.eclipse.jpt.jpa.core.context.java.JavaManagedType; import org.eclipse.jpt.jpa.core.context.java.JavaManagedTypeDefinition; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedPersistentAttribute; import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; import org.eclipse.jpt.jpa.core.internal.context.java.JavaPersistentTypeDefinition; import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextModel; @@ -40,7 +41,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; */ public class GenericJarFile extends AbstractPersistenceXmlContextModel<JarFileRef> - implements JarFile, PersistentType.Parent + implements JarFile, JavaPersistentType.Parent { protected final JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot; @@ -205,7 +206,7 @@ public class GenericJarFile } - // ********** PersistentType.Parent implementation ********** + // ********** JavaPersistentType.Parent implementation ********** public AccessType getDefaultPersistentTypeAccess() { return this.getPersistenceUnit().getDefaultAccess(); @@ -216,6 +217,10 @@ public class GenericJarFile return null; } + public void attributeChanged(JavaSpecifiedPersistentAttribute attribute) { + // NOP + } + // ********** JpaNode implementation ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java index 81c6a2f45b..4bd2e6194c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. + * Copyright (c) 2006, 2015 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; +import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType; /** @@ -21,7 +21,7 @@ import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType public class GenericJavaPersistentType extends AbstractJavaPersistentType { - public GenericJavaPersistentType(PersistentType.Parent parent, JavaResourceType jrt) { + public GenericJavaPersistentType(JavaPersistentType.Parent parent, JavaResourceType jrt) { super(parent, jrt); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java index 719e16cb85..a89ed36b35 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -140,10 +140,7 @@ public class GenericOrmXml (newXmlEntityMappings == null) || ObjectTools.notEquals(this.resourceType, newResourceType) ) { - if (this.root != null) { - this.root.dispose(); - this.setRoot(null); - } + this.setRoot(null); } this.resourceType = newResourceType; @@ -276,12 +273,6 @@ public class GenericOrmXml } } - public void dispose() { - if (this.root != null) { - this.root.dispose(); - } - } - // ********** PersistentTypeContainer implementation ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java index a4e2b20467..db04d14ee2 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -29,6 +29,7 @@ import org.eclipse.jpt.jpa.core.context.PersistentType; import org.eclipse.jpt.jpa.core.context.java.JavaManagedType; import org.eclipse.jpt.jpa.core.context.java.JavaManagedTypeDefinition; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; +import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedPersistentAttribute; import org.eclipse.jpt.jpa.core.context.persistence.ClassRef; import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; @@ -49,7 +50,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; */ public class GenericClassRef extends AbstractPersistenceXmlContextModel<PersistenceUnit> - implements ClassRef, PersistentType.Parent + implements ClassRef, JavaPersistentType.Parent { /** * This is <code>null</code> for a <em>virtual</em> class ref. @@ -301,7 +302,7 @@ public class GenericClassRef } - // ********** PersistentType.Parent implementation ********** + // ********** JavaPersistentType.Parent implementation ********** public AccessType getOverridePersistentTypeAccess() { // no access type at this level overrides any local access type specification @@ -312,6 +313,10 @@ public class GenericClassRef return this.getPersistenceUnit().getDefaultAccess(); } + public void attributeChanged(JavaSpecifiedPersistentAttribute attribute) { + // NOP + } + //*********** refactoring *********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java index 220cca90c0..9965f3a89c 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -61,10 +61,7 @@ public class GenericOrmXmlRef String old = this.fileName; this.fileName = xmlFileName; if (this.firePropertyChanged(FILE_NAME_PROPERTY, old, xmlFileName)) { - if (this.mappingFile != null) { - this.mappingFile.dispose(); - this.setMappingFile(null); - } + this.setMappingFile(null); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java index 8f6a575a42..ba2ce52170 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -140,7 +140,6 @@ public class GenericPersistence throw this.buildIOOBE(index); } PersistenceUnit old = this.persistenceUnit; - this.persistenceUnit.dispose(); this.persistenceUnit = null; this.xmlPersistence.getPersistenceUnits().remove(index); this.fireItemRemoved(PERSISTENCE_UNITS_LIST, index, old); @@ -187,7 +186,6 @@ public class GenericPersistence protected void removePersistenceUnit_() { PersistenceUnit old = this.persistenceUnit; this.persistenceUnit = null; - old.dispose(); this.fireItemRemoved(PERSISTENCE_UNITS_LIST, 0, old); } @@ -286,12 +284,6 @@ public class GenericPersistence return this.structureChildren.size(); } - public void dispose() { - for (PersistenceUnit pu : this.getPersistenceUnits()) { - pu.dispose(); - } - } - // ********** validation ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java index 07ff3b91ed..36b0f6e41e 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Oracle. All rights reserved. + * Copyright (c) 2007, 2015 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. @@ -120,10 +120,7 @@ public class GenericPersistenceXml (newXmlPersistence == null) || ObjectTools.notEquals(this.resourceType, newResourceType) ) { - if (this.root != null) { - this.root.dispose(); - this.setRoot(null); - } + this.setRoot(null); } this.resourceType = newResourceType; @@ -204,11 +201,6 @@ public class GenericPersistenceXml } } - public void dispose() { - if (this.root != null) { - this.root.dispose(); - } - } // ********** metamodel ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java index 6eabf4756a..384dadf294 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Oracle. All rights reserved. + * Copyright (c) 2009, 2015 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. @@ -14,7 +14,6 @@ import org.eclipse.jpt.jpa.core.JpaDataSource; import org.eclipse.jpt.jpa.core.JpaProject; import org.eclipse.jpt.jpa.core.JpaProject.Config; import org.eclipse.jpt.jpa.core.context.Orderable; -import org.eclipse.jpt.jpa.core.context.PersistentType; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; @@ -88,7 +87,7 @@ public class GenericJpaFactory2_0 // ********** Java Context Model ********** @Override - public JavaPersistentType buildJavaPersistentType(PersistentType.Parent parent, JavaResourceType jrt) { + public JavaPersistentType buildJavaPersistentType(JavaPersistentType.Parent parent, JavaResourceType jrt) { return new GenericJavaPersistentType2_0(parent, jrt); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java index 8c7a1fac7c..1b4d952cf1 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Oracle. All rights reserved. + * Copyright (c) 2009, 2015 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. @@ -14,7 +14,7 @@ import java.util.Map; import org.eclipse.core.resources.IFile; import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.common.core.utility.BodySourceWriter; -import org.eclipse.jpt.jpa.core.context.PersistentType; +import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType; import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType2_0; import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0; @@ -32,7 +32,7 @@ public class GenericJavaPersistentType2_0 protected final MetamodelSourceType2_0.Synchronizer metamodelSynchronizer; - public GenericJavaPersistentType2_0(PersistentType.Parent parent, JavaResourceType jrt) { + public GenericJavaPersistentType2_0(JavaPersistentType.Parent parent, JavaResourceType jrt) { super(parent, jrt); this.declaringTypeName = this.buildDeclaringTypeName(); this.metamodelSynchronizer = this.buildMetamodelSynchronizer(); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/orm/GenericOrmConverterType2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/orm/GenericOrmConverterType2_1.java index 5fbf0d0efb..7ca34ec5c0 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/orm/GenericOrmConverterType2_1.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2_1/context/orm/GenericOrmConverterType2_1.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2013 Oracle. All rights reserved.
+ * Copyright (c) 2013, 2015 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.
@@ -100,10 +100,6 @@ public class GenericOrmConverterType2_1 return ConverterType2_1.class;
}
- public void dispose() {
- //do nothing
- }
-
// ********** OrmManagedType implementation **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java index 902a23f655..e4f9c63e61 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java @@ -336,9 +336,7 @@ public class EclipseLinkPersistenceUnit if (this.usesImpliedEclipseLinkMappingFile()) { this.setImpliedEclipseLinkMappingFileRef(this.potentialImpliedEclipseLinkMappingFileRef); this.impliedEclipseLinkMappingFileRef.update(); - } - else if (this.impliedEclipseLinkMappingFileRef != null) { - this.impliedEclipseLinkMappingFileRef.dispose(); + } else { this.setImpliedEclipseLinkMappingFileRef(null); } } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory2_0.java index c3e2ee3da8..6182bb1f2b 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory2_0.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 Oracle. All rights reserved. + * Copyright (c) 2009, 2015 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. @@ -13,7 +13,6 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceType; import org.eclipse.jpt.jpa.core.JpaDataSource; import org.eclipse.jpt.jpa.core.JpaProject.Config; import org.eclipse.jpt.jpa.core.context.Orderable; -import org.eclipse.jpt.jpa.core.context.PersistentType; import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; @@ -84,7 +83,7 @@ public class EclipseLinkJpaFactory2_0 // ********** Java Context Model ********** @Override - public JavaPersistentType buildJavaPersistentType(PersistentType.Parent parent, JavaResourceType jrt) { + public JavaPersistentType buildJavaPersistentType(JavaPersistentType.Parent parent, JavaResourceType jrt) { return new GenericJavaPersistentType2_0(parent, jrt); } diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkVirtualJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkVirtualJavaPersistentType.java index 2321142bce..a8f42bf531 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkVirtualJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkVirtualJavaPersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2013 Oracle. All rights reserved. + * Copyright (c) 2012, 2015 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. @@ -195,6 +195,10 @@ public class EclipseLinkVirtualJavaPersistentType return null; } + public void attributeChanged(PersistentAttribute attribute) { + // NOP + } + // ********** JpaStructureNode implementation ********** |