diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal')
182 files changed, 0 insertions, 21440 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java deleted file mode 100644 index a8198e009f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.wst.validation.internal.core.Message; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class DefaultEclipseLinkJpaValidationMessages { - - private static String[] DEFAULT_PARMS = new String[0]; - private static TextRange DEFAULT_TEXT_RANGE = TextRange.Empty.instance(); - - public static IMessage buildMessage( - int severity, String messageId, Object targetObject) { - return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject); - } - - public static IMessage buildMessage( - int severity, String messageId, String[] parms, Object targetObject) { - return buildMessage(severity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE); - } - - public static IMessage buildMessage( - int severity, String messageId, Object targetObject, TextRange textRange) { - return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject, textRange); - } - - public static IMessage buildMessage( - int severity, String messageId, String[] parms, Object targetObject, TextRange textRange) { - IMessage message = new EclipseLinkMessage(EclipseLinkJpaValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject); - if (textRange == null) { - //log an exception and then continue without setting location information - //At least the user will still get the validation message and will - //be able to see other validation messages with valid textRanges - JptCorePlugin.log(new IllegalArgumentException("Null text range for message ID: " + messageId)); //$NON-NLS-1$ - } - else { - message.setLineNo(textRange.getLineNumber()); - message.setOffset(textRange.getOffset()); - message.setLength(textRange.getLength()); - } - return message; - } - - - private DefaultEclipseLinkJpaValidationMessages() { - super(); - throw new UnsupportedOperationException(); - } - - /** - * Used so that we can find the resource bundle using this classLoader. - * Otherwise the wst validation message attempts to use the ClassLoader - * of JpaValidator which is in the org.eclipse.jpt.core plugin. - * - * Another way we could potentially solve this is to have a separate - * EclispeLinkJpaValidator and set up the extension points so that - * it only runs against jpaProjects with the EclispeLinkPlatform - * while JpaValidator runs against jpaProjects with the GenericPlatform. - * I am unsure if this is possible - */ - private static class EclipseLinkMessage extends Message { - public EclipseLinkMessage(String aBundleName, int aSeverity, String anId, String[] aParams, Object aTargetObject) { - super(aBundleName, aSeverity, anId, aParams, aTargetObject); - } - - @Override - public ResourceBundle getBundle(Locale locale, ClassLoader classLoader) { - ResourceBundle bundle = null; - try { - bundle = ResourceBundle.getBundle(getBundleName(), locale, getClass().getClassLoader()); - } catch (MissingResourceException e) { - return super.getBundle(locale, classLoader); - } - return bundle; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkConstants.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkConstants.java deleted file mode 100644 index 2f777d2b19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkConstants.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -public interface EclipseLinkConstants -{ - String ECLIPSELINK_ORM_NS_URL = "http://www.eclipse.org/eclipselink/xsds/persistence/orm"; //$NON-NLS-1$ - String ECLIPSELINK_ORM_SCHEMA_LOC_1_0 = "http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_1_0.xsd"; //$NON-NLS-1$ - - String VERSION_1_0_TEXT = "1.0"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationProvider.java deleted file mode 100644 index dd614ea98d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaAnnotationProvider.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -import java.util.List; - -import org.eclipse.jpt.core.internal.platform.GenericJpaAnnotationProvider; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.BasicCollectionImpl.BasicCollectionAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.BasicMapImpl.BasicMapAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.CacheImpl.CacheAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.ChangeTrackingImpl.ChangeTrackingAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.ConvertImpl.ConvertAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.ConverterImpl.ConverterAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.CustomizerImpl.CustomizerAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.ExistenceCheckingImpl.ExistenceCheckingAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.JoinFetchImpl.JoinFetchAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.MutableImpl.MutableAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.ObjectTypeConverterImpl.ObjectTypeConverterAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.PrivateOwnedImpl.PrivateOwnedAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.ReadOnlyImpl.ReadOnlyAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.ReadTransformerImpl.ReadTransformerAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.StructConverterImpl.StructConverterAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.TransformationImpl.TransformationAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.TypeConverterImpl.TypeConverterAnnotationDefinition; -import org.eclipse.jpt.eclipselink.core.internal.resource.java.WriteTransformerImpl.WriteTransformerAnnotationDefinition; - -public class EclipseLinkJpaAnnotationProvider - extends GenericJpaAnnotationProvider -{ - - @Override - protected void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - super.addTypeSupportingAnnotationDefinitionsTo(definitions); - definitions.add(CacheAnnotationDefinition.instance()); - definitions.add(ChangeTrackingAnnotationDefinition.instance()); - definitions.add(ConverterAnnotationDefinition.instance()); - definitions.add(CustomizerAnnotationDefinition.instance()); - definitions.add(ExistenceCheckingAnnotationDefinition.instance()); - definitions.add(ObjectTypeConverterAnnotationDefinition.instance()); - definitions.add(ReadOnlyAnnotationDefinition.instance()); - definitions.add(StructConverterAnnotationDefinition.instance()); - definitions.add(TypeConverterAnnotationDefinition.instance()); - } - - // 245996 addresses how the attribute mapping annotations should be ordered - @Override - protected void addAttributeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - super.addAttributeMappingAnnotationDefinitionsTo(definitions); - definitions.add(BasicCollectionAnnotationDefinition.instance()); - definitions.add(BasicMapAnnotationDefinition.instance()); - definitions.add(TransformationAnnotationDefinition.instance()); - } - - @Override - protected void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) { - super.addAttributeSupportingAnnotationDefinitionsTo(definitions); - definitions.add(ConvertAnnotationDefinition.instance()); - definitions.add(ConverterAnnotationDefinition.instance()); - definitions.add(JoinFetchAnnotationDefinition.instance()); - definitions.add(MutableAnnotationDefinition.instance()); - definitions.add(ObjectTypeConverterAnnotationDefinition.instance()); - definitions.add(PrivateOwnedAnnotationDefinition.instance()); - definitions.add(ReadTransformerAnnotationDefinition.instance()); - definitions.add(StructConverterAnnotationDefinition.instance()); - definitions.add(TypeConverterAnnotationDefinition.instance()); - definitions.add(WriteTransformerAnnotationDefinition.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaFactory.java deleted file mode 100644 index 0b3c3ad684..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaFactory.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -import org.eclipse.jpt.core.context.JpaContextNode; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.core.context.java.JavaIdMapping; -import org.eclipse.jpt.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.core.context.orm.EntityMappings; -import org.eclipse.jpt.core.context.orm.OrmBasicMapping; -import org.eclipse.jpt.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.core.context.orm.OrmEntity; -import org.eclipse.jpt.core.context.orm.OrmIdMapping; -import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.context.orm.OrmPersistentTypeContext; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.context.orm.OrmVersionMapping; -import org.eclipse.jpt.core.context.orm.OrmXml; -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.platform.GenericJpaFactory; -import org.eclipse.jpt.core.resource.common.JpaXmlResource; -import org.eclipse.jpt.core.resource.orm.XmlBasic; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.core.resource.orm.XmlId; -import org.eclipse.jpt.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.core.resource.orm.XmlVersion; -import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.EclipseLinkJpaFile; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaEntityImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaTransformationMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkEntityMappingsImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmBasicMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEmbeddableImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmEntityImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmIdMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToManyMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmManyToOneMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmMappedSuperclassImpl; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmPersistentType; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmVersionMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkOrmXml; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkVirtualXmlBasic; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkVirtualXmlId; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkVirtualXmlManyToMany; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkVirtualXmlManyToOne; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkVirtualXmlOneToMany; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkVirtualXmlOneToOne; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkVirtualXmlVersion; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.OrmBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.OrmBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.OrmTransformationMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.VirtualXmlBasicCollection; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.VirtualXmlBasicMap; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.VirtualXmlTransformation; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmResource; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -public class EclipseLinkJpaFactory - extends GenericJpaFactory -{ - protected EclipseLinkJpaFactory() { - super(); - } - - - // **************** Context objects **************************************** - - @Override - public XmlContextNode buildContextNode(JpaContextNode parent, JpaXmlResource resource) { - if (resource.getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return buildEclipseLinkOrmXml((MappingFileRef) parent, (EclipseLinkOrmResource) resource); - } - return super.buildContextNode(parent, resource); - } - - protected EclipseLinkOrmXml buildEclipseLinkOrmXml(MappingFileRef parent, EclipseLinkOrmResource resource) { - return new EclipseLinkOrmXml(parent, resource); - } - - - // **************** persistence context objects **************************** - - @Override - public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit persistenceUnit) { - return new EclipseLinkPersistenceUnit(parent, persistenceUnit); - } - - @Override - public EntityMappings buildEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkEntityMappingsImpl((EclipseLinkOrmXml) parent, (org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings) xmlEntityMappings); - } - return super.buildEntityMappings(parent, xmlEntityMappings); - } - - - // **************** orm resource objects *********************************** - - @Override - public XmlBasic buildVirtualXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) { - if (ormTypeMapping.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkVirtualXmlBasic(ormTypeMapping, javaBasicMapping); - } - return super.buildVirtualXmlBasic(ormTypeMapping, javaBasicMapping); - } - - @Override - public XmlId buildVirtualXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) { - if (ormTypeMapping.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkVirtualXmlId(ormTypeMapping, javaIdMapping); - } - return super.buildVirtualXmlId(ormTypeMapping, javaIdMapping); - } - - @Override - public XmlManyToMany buildVirtualXmlManyToMany(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) { - if (ormTypeMapping.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkVirtualXmlManyToMany(ormTypeMapping, javaManyToManyMapping); - } - return super.buildVirtualXmlManyToMany(ormTypeMapping, javaManyToManyMapping); - } - - @Override - public XmlManyToOne buildVirtualXmlManyToOne(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) { - if (ormTypeMapping.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkVirtualXmlManyToOne(ormTypeMapping, javaManyToOneMapping); - } - return super.buildVirtualXmlManyToOne(ormTypeMapping, javaManyToOneMapping); - } - - @Override - public XmlOneToMany buildVirtualXmlOneToMany(OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) { - if (ormTypeMapping.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkVirtualXmlOneToMany(ormTypeMapping, javaOneToManyMapping); - } - return super.buildVirtualXmlOneToMany(ormTypeMapping, javaOneToManyMapping); - } - - @Override - public XmlOneToOne buildVirtualXmlOneToOne(OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) { - if (ormTypeMapping.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkVirtualXmlOneToOne(ormTypeMapping, javaOneToOneMapping); - } - return super.buildVirtualXmlOneToOne(ormTypeMapping, javaOneToOneMapping); - } - - @Override - public XmlVersion buildVirtualXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) { - if (ormTypeMapping.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkVirtualXmlVersion(ormTypeMapping, javaVersionMapping); - } - return super.buildVirtualXmlVersion(ormTypeMapping, javaVersionMapping); - } - - - // **************** eclipselink orm context objects ************************ - - @Override - public OrmPersistentType buildOrmPersistentType(OrmPersistentTypeContext parent, String mappingKey) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmPersistentType(parent, mappingKey); - } - return super.buildOrmPersistentType(parent, mappingKey); - } - - @Override - public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmEmbeddableImpl(parent); - } - return super.buildOrmEmbeddable(parent); - } - - @Override - public OrmEntity buildOrmEntity(OrmPersistentType parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmEntityImpl(parent); - } - return super.buildOrmEntity(parent); - } - - @Override - public OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmMappedSuperclassImpl(parent); - } - return super.buildOrmMappedSuperclass(parent); - } - - @Override - public OrmIdMapping buildOrmIdMapping(OrmPersistentAttribute parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmIdMapping(parent); - } - return super.buildOrmIdMapping(parent); - } - - @Override - public OrmBasicMapping buildOrmBasicMapping(OrmPersistentAttribute parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmBasicMapping(parent); - } - return super.buildOrmBasicMapping(parent); - } - - @Override - public OrmVersionMapping buildOrmVersionMapping(OrmPersistentAttribute parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmVersionMapping(parent); - } - return super.buildOrmVersionMapping(parent); - } - - @Override - public OrmManyToOneMapping buildOrmManyToOneMapping(OrmPersistentAttribute parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmManyToOneMapping(parent); - } - return super.buildOrmManyToOneMapping(parent); - } - - @Override - public OrmOneToManyMapping buildOrmOneToManyMapping(OrmPersistentAttribute parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmOneToManyMapping(parent); - } - return super.buildOrmOneToManyMapping(parent); - } - - @Override - public OrmOneToOneMapping buildOrmOneToOneMapping(OrmPersistentAttribute parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmOneToOneMapping(parent); - } - return super.buildOrmOneToOneMapping(parent); - } - - @Override - public OrmManyToManyMapping buildOrmManyToManyMapping(OrmPersistentAttribute parent) { - if (parent.getEResource().getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) { - return new EclipseLinkOrmManyToManyMapping(parent); - } - return super.buildOrmManyToManyMapping(parent); - } - - - // **************** java context objects *********************************** - - @Override - public JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent) { - return new EclipseLinkJavaBasicMappingImpl(parent); - } - - @Override - public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent) { - return new EclipseLinkJavaEmbeddableImpl(parent); - } - - @Override - public EclipseLinkJavaEntity buildJavaEntity(JavaPersistentType parent) { - return new EclipseLinkJavaEntityImpl(parent); - } - - @Override - public JavaIdMapping buildJavaIdMapping(JavaPersistentAttribute parent) { - return new EclipseLinkJavaIdMappingImpl(parent); - } - - @Override - public EclipseLinkJavaMappedSuperclass buildJavaMappedSuperclass(JavaPersistentType parent) { - return new EclipseLinkJavaMappedSuperclassImpl(parent); - } - - @Override - public JavaVersionMapping buildJavaVersionMapping(JavaPersistentAttribute parent) { - return new EclipseLinkJavaVersionMappingImpl(parent); - } - - @Override - public JavaOneToManyMapping buildJavaOneToManyMapping(JavaPersistentAttribute parent) { - return new EclipseLinkJavaOneToManyMappingImpl(parent); - } - - @Override - public JavaOneToOneMapping buildJavaOneToOneMapping(JavaPersistentAttribute parent) { - return new EclipseLinkJavaOneToOneMappingImpl(parent); - } - - @Override - public JavaManyToManyMapping buildJavaManyToManyMapping(JavaPersistentAttribute parent) { - return new EclipseLinkJavaManyToManyMappingImpl(parent); - } - - @Override - public JavaManyToOneMapping buildJavaManyToOneMapping(JavaPersistentAttribute parent) { - return new EclipseLinkJavaManyToOneMappingImpl(parent); - } - - public JavaBasicCollectionMapping buildJavaBasicCollectionMapping(JavaPersistentAttribute parent) { - return new JavaBasicCollectionMapping(parent); - } - - public JavaBasicMapMapping buildJavaBasicMapMapping(JavaPersistentAttribute parent) { - return new JavaBasicMapMapping(parent); - } - - public JavaTransformationMapping buildJavaTransformationMapping(JavaPersistentAttribute parent) { - return new JavaTransformationMapping(parent); - } - - public OrmBasicCollectionMapping buildOrmBasicCollectionMapping(OrmPersistentAttribute parent) { - return new OrmBasicCollectionMapping(parent); - } - - public OrmBasicMapMapping buildOrmBasicMapMapping(OrmPersistentAttribute parent) { - return new OrmBasicMapMapping(parent); - } - - public OrmTransformationMapping buildOrmTransformationMapping(OrmPersistentAttribute parent) { - return new OrmTransformationMapping(parent); - } - - public XmlBasicCollection buildVirtualXmlBasicCollection(OrmTypeMapping ormTypeMapping, JavaBasicCollectionMapping javaBasicCollectionMapping) { - return new VirtualXmlBasicCollection(ormTypeMapping, javaBasicCollectionMapping); - } - - public XmlBasicMap buildVirtualXmlBasicMap(OrmTypeMapping ormTypeMapping, JavaBasicMapMapping javaBasicMapMapping) { - return new VirtualXmlBasicMap(ormTypeMapping, javaBasicMapMapping); - } - - public XmlTransformation buildVirtualXmlTransformation(OrmTypeMapping ormTypeMapping, JavaTransformationMapping javaTransformationMapping) { - return new VirtualXmlTransformation(ormTypeMapping, javaTransformationMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaPlatform.java deleted file mode 100644 index 94f8d39ea5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaPlatform.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -import java.util.List; -import org.eclipse.jpt.core.JpaAnnotationProvider; -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.JpaFileProvider; -import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider; -import org.eclipse.jpt.core.internal.platform.GenericJpaPlatform; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingProvider; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingProvider; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicCollectionMappingProvider; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicMapMappingProvider; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaTransformationMappingProvider; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.OrmBasicCollectionMappingProvider; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.OrmBasicMapMappingProvider; -import org.eclipse.jpt.eclipselink.core.internal.context.orm.OrmTransformationMappingProvider; - -/** - * EclipseLink platform - */ -public class EclipseLinkJpaPlatform - extends GenericJpaPlatform -{ - public static final String ID = "org.eclipse.eclipselink.platform"; //$NON-NLS-1$ - - - public EclipseLinkJpaPlatform() { - super(); - } - - @Override - public String getId() { - return EclipseLinkJpaPlatform.ID; - } - - // ********* factory ********* - @Override - protected JpaFactory buildJpaFactory() { - return new EclipseLinkJpaFactory(); - } - - // ********* JPA files ********* - @Override - protected void addJpaFileProvidersTo(List<JpaFileProvider> providers) { - super.addJpaFileProvidersTo(providers); - providers.add(EclipseLinkOrmJpaFileProvider.instance()); - } - - // ********* java annotations ********* - @Override - protected JpaAnnotationProvider buildAnnotationProvider() { - return new EclipseLinkJpaAnnotationProvider(); - } - - @Override - protected void addJavaAttributeMappingProvidersTo(List<JavaAttributeMappingProvider> providers) { - super.addJavaAttributeMappingProvidersTo(providers); - providers.add(JavaBasicCollectionMappingProvider.instance()); - providers.add(JavaBasicMapMappingProvider.instance()); - providers.add(JavaTransformationMappingProvider.instance()); - } - - @Override - protected void addDefaultJavaAttributeMappingProvidersTo(List<DefaultJavaAttributeMappingProvider> providers) { - providers.add(EclipseLinkJavaOneToOneMappingProvider.instance()); - providers.add(EclipseLinkJavaOneToManyMappingProvider.instance()); - //add these before calling super, want to check for Basic last in case the reference object is Serializable - super.addDefaultJavaAttributeMappingProvidersTo(providers); - } - - @Override - protected void addOrmAttributeMappingProvidersTo(List<OrmAttributeMappingProvider> providers) { - super.addOrmAttributeMappingProvidersTo(providers); - providers.add(OrmBasicCollectionMappingProvider.instance()); - providers.add(OrmBasicMapMappingProvider.instance()); - providers.add(OrmTransformationMappingProvider.instance()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java deleted file mode 100644 index 352eaa4aae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -@SuppressWarnings("nls") -public interface EclipseLinkJpaValidationMessages { - - public static final String BUNDLE_NAME = "eclipselink_jpa_validation"; - - public static final String CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED = "CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED"; - - public static final String CONVERTER_CLASS_IMPLEMENTS_CONVERTER = "CONVERTER_CLASS_IMPLEMENTS_CONVERTER"; - - public static final String CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER = "CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER"; - - public static final String MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE = "MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkOrmJpaFileProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkOrmJpaFileProvider.java deleted file mode 100644 index 671eac4873..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkOrmJpaFileProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.JpaFile; -import org.eclipse.jpt.core.JpaFileProvider; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.internal.XmlJpaFile; -import org.eclipse.jpt.eclipselink.core.internal.resource.orm.EclipseLinkOrmResourceModelProvider; - -/** - * EclipseLink orm.xml - */ -public class EclipseLinkOrmJpaFileProvider - implements JpaFileProvider -{ - - // singleton - private static final EclipseLinkOrmJpaFileProvider INSTANCE = new EclipseLinkOrmJpaFileProvider(); - - /** - * Return the singleton. - */ - public static EclipseLinkOrmJpaFileProvider instance() { - return INSTANCE; - } - - /** - * Ensure non-instantiability. - */ - private EclipseLinkOrmJpaFileProvider() { - super(); - } - - public String getContentId() { - return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE; - } - - public JpaFile buildJpaFile(JpaProject jpaProject, IFile file, JpaFactory factory) { - return new XmlJpaFile(jpaProject, file, EclipseLinkOrmResourceModelProvider.getModelProvider(file).getResource()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java deleted file mode 100644 index 626a913327..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/JptEclipseLinkCorePlugin.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.core.JptCorePlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class JptEclipseLinkCorePlugin extends Plugin -{ - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.eclipselink.core"; //$NON-NLS-1$ - - /** - * Value of the content-type for eclipselink-orm.xml mappings files. Use this - * value to retrieve the ORM xml content type from the content type manager - * and to add new eclipselink-orm.xml-like extensions to this content type. - * - * @see org.eclipse.core.runtime.content.IContentTypeManager#getContentType(String) - */ - public static final String ECLIPSELINK_ORM_XML_CONTENT_TYPE = PLUGIN_ID + ".content.orm"; //$NON-NLS-1$ - - public static final String DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH = "META-INF/eclipselink-orm.xml"; //$NON-NLS-1$ - - - // The shared instance - private static JptEclipseLinkCorePlugin plugin; - - - /** - * The constructor - */ - public JptEclipseLinkCorePlugin() {} - - - /** - * Return the default mapping file deployment URI for the specified project. - * ("WEB-INF/classes/META-INF/eclipselink-orm.xml" for web projects and - * "META-INF/eclipselink-orm.xml" in other cases) - */ - public static String getDefaultEclipseLinkOrmXmlDeploymentURI(IProject project) { - return JptCorePlugin.getDeploymentURI(project, DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH); - } - - /** - * Log the specified status. - */ - public static void log(IStatus status) { - plugin.getLog().log(status); - } - - /** - * Log the specified message. - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - /** - * Log the specified exception or error. - */ - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - - // ********** plug-in implementation ********** - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static JptEclipseLinkCorePlugin getDefault() { - return plugin; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingImpl.java deleted file mode 100644 index 3859a0abd4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaBasicMappingImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaBasicMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaBasicMappingImpl extends GenericJavaBasicMapping implements EclipseLinkBasicMapping -{ - - protected final EclipseLinkJavaMutable mutable; - - public EclipseLinkJavaBasicMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkJavaMutable(this); - } - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkJavaConvert(this, this.resourcePersistentAttribute); - } - return null; - } - - @Override - protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) { - //check @Convert first, this is the order that EclipseLink searches - if (jrpa.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME) != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(jrpa); - } - - //************ EclipselinkJavaBasicMapping implementation **************** - - public Mutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.mutable.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.mutable.update(jrpa); - } - - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.mutable.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCaching.java deleted file mode 100644 index f16ace15c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCaching.java +++ /dev/null @@ -1,557 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.CacheType; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExistenceType; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaCaching extends AbstractJavaJpaContextNode implements JavaCaching -{ - - protected CacheType specifiedType; - protected Integer specifiedSize; - protected Boolean specifiedShared; - protected Boolean specifiedAlwaysRefresh; - protected Boolean specifiedRefreshOnlyIfNewer; - protected Boolean specifiedDisableHits; - - protected boolean existenceChecking; - protected ExistenceType specifiedExistenceType; - protected ExistenceType defaultExistenceType; - - protected CacheCoordinationType specifiedCoordinationType; - - protected Integer expiry; - protected EclipseLinkJavaExpiryTimeOfDay expiryTimeOfDay; - - - protected JavaResourcePersistentType resourcePersistentType; - - public EclipseLinkJavaCaching(JavaTypeMapping parent) { - super(parent); - } - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - - //query for the cache annotation every time on setters. - //call one setter and the CacheAnnotation could change. - //You could call more than one setter before this object has received any notification - //from the java resource model - protected CacheAnnotation getCacheAnnotation() { - return (CacheAnnotation) this.resourcePersistentType.getNonNullSupportingAnnotation(getCacheAnnotationName()); - } - - protected ExistenceCheckingAnnotation getExistenceCheckingAnnotation() { - return (ExistenceCheckingAnnotation) this.resourcePersistentType.getSupportingAnnotation(getExistenceCheckingAnnotationName()); - } - - protected String getCacheAnnotationName() { - return CacheAnnotation.ANNOTATION_NAME; - } - - protected String getExistenceCheckingAnnotationName() { - return ExistenceCheckingAnnotation.ANNOTATION_NAME; - } - - public CacheType getType() { - return (this.getSpecifiedType() == null) ? this.getDefaultType() : this.getSpecifiedType(); - } - - public CacheType getDefaultType() { - return DEFAULT_TYPE; - } - - public CacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(CacheType newSpecifiedType) { - CacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - this.getCacheAnnotation().setType(CacheType.toJavaResourceModel(newSpecifiedType)); - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedType_(CacheType newSpecifiedType) { - CacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - public int getSize() { - return (this.getSpecifiedSize() == null) ? getDefaultSize() : this.getSpecifiedSize().intValue(); - } - - public int getDefaultSize() { - return Caching.DEFAULT_SIZE; - } - - public Integer getSpecifiedSize() { - return this.specifiedSize; - } - - public void setSpecifiedSize(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - getCacheAnnotation().setSize(newSpecifiedSize); - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - protected void setSpecifiedSize_(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - - public boolean isShared() { - return (this.specifiedShared == null) ? this.isDefaultShared() : this.specifiedShared.booleanValue(); - } - - public boolean isDefaultShared() { - return Caching.DEFAULT_SHARED; - } - - public Boolean getSpecifiedShared() { - return this.specifiedShared; - } - - public void setSpecifiedShared(Boolean newSpecifiedShared) { - Boolean oldShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - this.getCacheAnnotation().setShared(newSpecifiedShared); - firePropertyChanged(Caching.SPECIFIED_SHARED_PROPERTY, oldShared, newSpecifiedShared); - - if (newSpecifiedShared == Boolean.FALSE) { - setSpecifiedType(null); - setSpecifiedSize(null); - setSpecifiedAlwaysRefresh(null); - setSpecifiedRefreshOnlyIfNewer(null); - setSpecifiedDisableHits(null); - setSpecifiedCoordinationType(null); - setExpiry(null); - if (this.expiryTimeOfDay != null) { - removeExpiryTimeOfDay(); - } - } - } - - protected void setSpecifiedShared_(Boolean newSpecifiedShared) { - Boolean oldSpecifiedShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - firePropertyChanged(Caching.SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh == null) ? this.isDefaultAlwaysRefresh() : this.specifiedAlwaysRefresh.booleanValue(); - } - - public boolean isDefaultAlwaysRefresh() { - return Caching.DEFAULT_ALWAYS_REFRESH; - } - - public Boolean getSpecifiedAlwaysRefresh() { - return this.specifiedAlwaysRefresh; - } - - public void setSpecifiedAlwaysRefresh(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - this.getCacheAnnotation().setAlwaysRefresh(newSpecifiedAlwaysRefresh); - firePropertyChanged(Caching.SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - protected void setSpecifiedAlwaysRefresh_(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - firePropertyChanged(Caching.SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer == null) ? this.isDefaultRefreshOnlyIfNewer() : this.specifiedRefreshOnlyIfNewer.booleanValue(); - } - - public boolean isDefaultRefreshOnlyIfNewer() { - return Caching.DEFAULT_REFRESH_ONLY_IF_NEWER; - } - - public Boolean getSpecifiedRefreshOnlyIfNewer() { - return this.specifiedRefreshOnlyIfNewer; - } - - public void setSpecifiedRefreshOnlyIfNewer(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - this.getCacheAnnotation().setRefreshOnlyIfNewer(newSpecifiedRefreshOnlyIfNewer); - firePropertyChanged(Caching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - protected void setSpecifiedRefreshOnlyIfNewer_(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - firePropertyChanged(Caching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - public boolean isDisableHits() { - return (this.specifiedDisableHits == null) ? this.isDefaultDisableHits() : this.specifiedDisableHits.booleanValue(); - } - - public boolean isDefaultDisableHits() { - return Caching.DEFAULT_DISABLE_HITS; - } - - public Boolean getSpecifiedDisableHits() { - return this.specifiedDisableHits; - } - - public void setSpecifiedDisableHits(Boolean newSpecifiedDisableHits) { - Boolean oldDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - this.getCacheAnnotation().setDisableHits(newSpecifiedDisableHits); - firePropertyChanged(Caching.SPECIFIED_DISABLE_HITS_PROPERTY, oldDisableHits, newSpecifiedDisableHits); - } - - protected void setSpecifiedDisableHits_(Boolean newSpecifiedDisableHits) { - Boolean oldDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - firePropertyChanged(Caching.SPECIFIED_DISABLE_HITS_PROPERTY, oldDisableHits, newSpecifiedDisableHits); - } - - public CacheCoordinationType getCoordinationType() { - return (this.getSpecifiedCoordinationType() == null) ? this.getDefaultCoordinationType() : this.getSpecifiedCoordinationType(); - } - - public CacheCoordinationType getDefaultCoordinationType() { - return DEFAULT_COORDINATION_TYPE; - } - - public CacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - this.getCacheAnnotation().setCoordinationType(CacheCoordinationType.toJavaResourceModel(newSpecifiedCoordinationType)); - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedCoordinationType_(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - public boolean hasExistenceChecking() { - return this.existenceChecking; - } - - public void setExistenceChecking(boolean newExistenceChecking) { - boolean oldExistenceChecking = this.existenceChecking; - this.existenceChecking = newExistenceChecking; - if (newExistenceChecking) { - this.resourcePersistentType.addSupportingAnnotation(getExistenceCheckingAnnotationName()); - } - else { - this.resourcePersistentType.removeSupportingAnnotation(getExistenceCheckingAnnotationName()); - } - firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, oldExistenceChecking, newExistenceChecking); - setDefaultExistenceType(caclulateDefaultExistenceType()); - } - - protected void setExistenceChecking_(boolean newExistenceChecking) { - boolean oldExistenceChecking = this.existenceChecking; - this.existenceChecking = newExistenceChecking; - firePropertyChanged(EXISTENCE_CHECKING_PROPERTY, oldExistenceChecking, newExistenceChecking); - } - - protected ExistenceType caclulateDefaultExistenceType() { - if (hasExistenceChecking()) { - return ExistenceType.CHECK_CACHE; - } - return DEFAULT_EXISTENCE_TYPE; - } - - public ExistenceType getExistenceType() { - return (this.getSpecifiedExistenceType() == null) ? this.getDefaultExistenceType() : this.getSpecifiedExistenceType(); - } - - public ExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(ExistenceType newDefaultExistenceType) { - ExistenceType oldDefaultExistenceType = this.defaultExistenceType; - this.defaultExistenceType = newDefaultExistenceType; - firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, oldDefaultExistenceType, newDefaultExistenceType); - } - - public ExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(ExistenceType newSpecifiedExistenceType) { - if (!hasExistenceChecking()) { - if (newSpecifiedExistenceType != null) { - setExistenceChecking(true); - } - else { - return; - } - } - ExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - this.getExistenceCheckingAnnotation().setValue(ExistenceType.toJavaResourceModel(newSpecifiedExistenceType)); - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedExistenceType_(ExistenceType newSpecifiedExistenceType) { - ExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - getCacheAnnotation().setExpiry(newExpiry); - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - if (newExpiry != null && this.expiryTimeOfDay != null) { - removeExpiryTimeOfDay(); - } - } - - protected void setExpiry_(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - public ExpiryTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public ExpiryTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiryTimeOfDay already exists, use getExpiryTimeOfDay()"); //$NON-NLS-1$ - } - if (this.resourcePersistentType.getSupportingAnnotation(getCacheAnnotationName()) == null) { - this.resourcePersistentType.addSupportingAnnotation(getCacheAnnotationName()); - } - EclipseLinkJavaExpiryTimeOfDay newExpiryTimeOfDay = new EclipseLinkJavaExpiryTimeOfDay(this); - this.expiryTimeOfDay = newExpiryTimeOfDay; - TimeOfDayAnnotation timeOfDayAnnotation = getCacheAnnotation().addExpiryTimeOfDay(); - newExpiryTimeOfDay.initialize(timeOfDayAnnotation); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, null, newExpiryTimeOfDay); - setExpiry(null); - return newExpiryTimeOfDay; - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("timeOfDayExpiry does not exist"); //$NON-NLS-1$ - } - ExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = null; - getCacheAnnotation().removeExpiryTimeOfDay(); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, null); - } - - protected void setExpiryTimeOfDay(EclipseLinkJavaExpiryTimeOfDay newExpiryTimeOfDay) { - EclipseLinkJavaExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = newExpiryTimeOfDay; - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, newExpiryTimeOfDay); - } - - public void initialize(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - initialize(getCacheAnnotation()); - initialize(getExistenceCheckingAnnotation()); - } - - protected void initialize(CacheAnnotation cache) { - this.specifiedType = this.specifiedType(cache); - this.specifiedSize = this.specifiedSize(cache); - this.specifiedShared = this.specifiedShared(cache); - this.specifiedAlwaysRefresh = this.specifiedAlwaysRefresh(cache); - this.specifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer(cache); - this.specifiedDisableHits = this.specifiedDisableHits(cache); - this.specifiedCoordinationType = this.specifiedCoordinationType(cache); - this.initializeExpiry(cache); - } - - protected void initialize(ExistenceCheckingAnnotation existenceChecking) { - this.existenceChecking = existenceChecking != null; - this.specifiedExistenceType = specifiedExistenceType(existenceChecking); - this.defaultExistenceType = this.caclulateDefaultExistenceType(); - } - - protected void initializeExpiry(CacheAnnotation cache) { - if (cache.getExpiryTimeOfDay() == null) { - this.expiry = cache.getExpiry(); - } - else { - if (cache.getExpiry() == null) { //handle with validation if both expiry and expiryTimeOfDay are set - this.expiryTimeOfDay = new EclipseLinkJavaExpiryTimeOfDay(this); - this.expiryTimeOfDay.initialize(cache.getExpiryTimeOfDay()); - } - } - } - - public void update(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - update(getCacheAnnotation()); - update(getExistenceCheckingAnnotation()); - updateExpiry(getCacheAnnotation()); - } - - protected void update(CacheAnnotation cache) { - setSpecifiedType_(this.specifiedType(cache)); - setSpecifiedSize_(this.specifiedSize(cache)); - setSpecifiedShared_(this.specifiedShared(cache)); - setSpecifiedAlwaysRefresh_(this.specifiedAlwaysRefresh(cache)); - setSpecifiedRefreshOnlyIfNewer_(this.specifiedRefreshOnlyIfNewer(cache)); - setSpecifiedDisableHits_(this.specifiedDisableHits(cache)); - setSpecifiedCoordinationType_(this.specifiedCoordinationType(cache)); - } - - protected void update(ExistenceCheckingAnnotation existenceChecking) { - setExistenceChecking_(existenceChecking != null); - setSpecifiedExistenceType_(specifiedExistenceType(existenceChecking)); - setDefaultExistenceType(caclulateDefaultExistenceType()); - } - - protected void updateExpiry(CacheAnnotation cache) { - if (cache.getExpiryTimeOfDay() == null) { - setExpiryTimeOfDay(null); - setExpiry_(cache.getExpiry()); - } - else { - if (this.expiryTimeOfDay != null) { - this.expiryTimeOfDay.update(cache.getExpiryTimeOfDay()); - } - else if (cache.getExpiry() == null){ - setExpiryTimeOfDay(new EclipseLinkJavaExpiryTimeOfDay(this)); - this.expiryTimeOfDay.initialize(cache.getExpiryTimeOfDay()); - } - else { //handle with validation if both expiry and expiryTimeOfDay are set - setExpiryTimeOfDay(null); - } - } - } - - protected CacheType specifiedType(CacheAnnotation cache) { - return CacheType.fromJavaResourceModel(cache.getType()); - } - - protected Integer specifiedSize(CacheAnnotation cache) { - return cache.getSize(); - } - - protected Boolean specifiedShared(CacheAnnotation cache) { - return cache.getShared(); - } - - protected Boolean specifiedAlwaysRefresh(CacheAnnotation cache) { - return cache.getAlwaysRefresh(); - } - - protected Boolean specifiedRefreshOnlyIfNewer(CacheAnnotation cache) { - return cache.getRefreshOnlyIfNewer(); - } - - protected Boolean specifiedDisableHits(CacheAnnotation cache) { - return cache.getDisableHits(); - } - - protected CacheCoordinationType specifiedCoordinationType(CacheAnnotation cache) { - return CacheCoordinationType.fromJavaResourceModel(cache.getCoordinationType()); - } - - protected Integer expiry(CacheAnnotation cache) { - return cache.getExpiry(); - } - - protected ExistenceType specifiedExistenceType(ExistenceCheckingAnnotation existenceChecking) { - if (existenceChecking == null) { - return null; - } - return ExistenceType.fromJavaResourceModel(existenceChecking.getValue()); - } - - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = getCacheAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.validateExpiry(messages, astRoot); - } - - protected void validateExpiry(List<IMessage> messages, CompilationUnit astRoot) { - CacheAnnotation cache = getCacheAnnotation(); - if (cache.getExpiry() != null && cache.getExpiryTimeOfDay() != null) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CACHE_EXPIRY_AND_EXPIRY_TIME_OF_DAY_BOTH_SPECIFIED, - new String[] {this.getParent().getPersistentType().getName()}, - this, - getValidationTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaChangeTracking.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaChangeTracking.java deleted file mode 100644 index 429c3281fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaChangeTracking.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation; - -public class EclipseLinkJavaChangeTracking extends AbstractJavaJpaContextNode implements ChangeTracking -{ - protected JavaResourcePersistentType resourcePersistentType; - - protected ChangeTrackingType specifiedType; - - - public EclipseLinkJavaChangeTracking(JavaTypeMapping parent) { - super(parent); - } - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - protected String getChangeTrackingAnnotationName() { - return ChangeTrackingAnnotation.ANNOTATION_NAME; - } - - protected ChangeTrackingAnnotation getChangeTrackingAnnotation() { - return (ChangeTrackingAnnotation) this.resourcePersistentType.getSupportingAnnotation(getChangeTrackingAnnotationName()); - } - - protected void addChangeTrackingAnnotation() { - this.resourcePersistentType.addSupportingAnnotation(getChangeTrackingAnnotationName()); - } - - protected void removeChangeTrackingAnnotation() { - this.resourcePersistentType.removeSupportingAnnotation(getChangeTrackingAnnotationName()); - } - - public ChangeTrackingType getType() { - return (this.getSpecifiedType() != null) ? this.getSpecifiedType() : this.getDefaultType(); - } - - public ChangeTrackingType getDefaultType() { - return DEFAULT_TYPE; - } - - public ChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(ChangeTrackingType newSpecifiedType) { - if (this.specifiedType == newSpecifiedType) { - return; - } - - ChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - - if (newSpecifiedType != null) { - if (getChangeTrackingAnnotation() == null) { - addChangeTrackingAnnotation(); - } - getChangeTrackingAnnotation().setValue(ChangeTrackingType.toJavaResourceModel(newSpecifiedType)); - } - else { - if (getChangeTrackingAnnotation() != null) { - removeChangeTrackingAnnotation(); - } - } - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setSpecifiedType_(ChangeTrackingType newSpecifiedType) { - ChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - public void initialize(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - ChangeTrackingAnnotation changeTrackingAnnotation = this.getChangeTrackingAnnotation(); - this.specifiedType = changeTrackingType(changeTrackingAnnotation); - } - - public void update(JavaResourcePersistentType resourcePersistentType) { - this.resourcePersistentType = resourcePersistentType; - ChangeTrackingAnnotation changeTrackingAnnotation = this.getChangeTrackingAnnotation(); - this.setSpecifiedType_(changeTrackingType(changeTrackingAnnotation)); - } - - protected ChangeTrackingType changeTrackingType(ChangeTrackingAnnotation changeTracking) { - if (changeTracking == null) { - return null; - } - else if (changeTracking.getValue() == null) { - return ChangeTracking.DEFAULT_TYPE; - } - else { - return ChangeTrackingType.fromJavaResourceModel(changeTracking.getValue()); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - ChangeTrackingAnnotation changeTrackingAnnotation = getChangeTrackingAnnotation(); - TextRange textRange = changeTrackingAnnotation == null ? null : changeTrackingAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConversionValue.java deleted file mode 100644 index c1c579d3b9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConversionValue.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaConversionValue extends AbstractJavaJpaContextNode implements ConversionValue -{ - private ConversionValueAnnotation resourceConversionValue; - - private String dataValue; - - private String objectValue; - - public EclipseLinkJavaConversionValue(EclipseLinkJavaObjectTypeConverter parent) { - super(parent); - } - - @Override - public EclipseLinkJavaObjectTypeConverter getParent() { - return (EclipseLinkJavaObjectTypeConverter) super.getParent(); - } - - protected String getAnnotationName() { - return ConversionValueAnnotation.ANNOTATION_NAME; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourceConversionValue.getTextRange(astRoot); - } - - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - this.resourceConversionValue.setDataValue(newDataValue); - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - protected void setDataValue_(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - this.resourceConversionValue.setObjectValue(newObjectValue); - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - protected void setObjectValue_(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - public void initialize(ConversionValueAnnotation resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.dataValue = this.dataValue(); - this.objectValue = this.objectValue(); - } - - public void update(ConversionValueAnnotation resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.setDataValue_(this.dataValue()); - this.setObjectValue_(this.objectValue()); - } - - protected String dataValue() { - return this.resourceConversionValue.getDataValue(); - } - - protected String objectValue() { - return this.resourceConversionValue.getObjectValue(); - } - - public TextRange getDataValueTextRange(CompilationUnit astRoot) { - return this.resourceConversionValue.getDataValueTextRange(astRoot); - } - - public TextRange getObjectValueTextRange(CompilationUnit astRoot) { - return this.resourceConversionValue.getObjectValueTextRange(astRoot); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - validateDataValuesUnique(messages, astRoot); - } - - protected void validateDataValuesUnique(List<IMessage> messages, CompilationUnit astRoot) { - List<String> dataValues = CollectionTools.list(getParent().dataValues()); - dataValues.remove(this.dataValue); - if (dataValues.contains(this.dataValue)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {this.dataValue}, - this, - this.getDataValueTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConvert.java deleted file mode 100644 index dd06dc52d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConvert.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaConvert extends AbstractJavaJpaContextNode implements Convert, JavaConverter -{ - private String specifiedConverterName; - - private JavaResourcePersistentAttribute resourcePersistentAttribute; - - private EclipseLinkJavaConverter converter; - - public EclipseLinkJavaConvert(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) { - super(parent); - this.initialize(jrpa); - } - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - public String getType() { - return Convert.ECLIPSE_LINK_CONVERTER; - } - - protected String getAnnotationName() { - return ConvertAnnotation.ANNOTATION_NAME; - } - - public void addToResourceModel() { - this.resourcePersistentAttribute.addSupportingAnnotation(getAnnotationName()); - } - - public void removeFromResourceModel() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getAnnotationName()); - if (getConverter() != null) { - this.resourcePersistentAttribute.removeSupportingAnnotation(getConverter().getAnnotationName()); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getResourceConvert().getTextRange(astRoot); - } - - protected ConvertAnnotation getResourceConvert() { - return (ConvertAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getAnnotationName()); - } - - public String getConverterName() { - return getSpecifiedConverterName() == null ? getDefaultConverterName() : getSpecifiedConverterName(); - } - - public String getDefaultConverterName() { - return DEFAULT_CONVERTER_NAME; - } - - public String getSpecifiedConverterName() { - return this.specifiedConverterName; - } - - public void setSpecifiedConverterName(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - getResourceConvert().setValue(newSpecifiedConverterName); - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - protected void setSpecifiedConverterName_(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - public EclipseLinkJavaConverter getConverter() { - return this.converter; - } - - protected String getConverterType() { - if (this.converter == null) { - return EclipseLinkConverter.NO_CONVERTER; - } - return this.converter.getType(); - } - - public void setConverter(String converterType) { - if (getConverterType() == converterType) { - return; - } - EclipseLinkJavaConverter oldConverter = this.converter; - EclipseLinkJavaConverter newConverter = buildConverter(converterType); - this.converter = null; - if (oldConverter != null) { - this.resourcePersistentAttribute.removeSupportingAnnotation(oldConverter.getAnnotationName()); - } - this.converter = newConverter; - if (newConverter != null) { - this.resourcePersistentAttribute.addSupportingAnnotation(newConverter.getAnnotationName()); - } - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void setConverter(EclipseLinkJavaConverter newConverter) { - EclipseLinkJavaConverter oldConverter = this.converter; - this.converter = newConverter; - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.specifiedConverterName = this.specifiedConverterName(getResourceConvert()); - this.converter = this.buildConverter(this.converterType(jrpa)); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.setSpecifiedConverterName_(this.specifiedConverterName(getResourceConvert())); - if (converterType(jrpa) == getConverterType()) { - getConverter().update(jrpa); - } - else { - EclipseLinkJavaConverter javaConverter = buildConverter(converterType(jrpa)); - setConverter(javaConverter); - } - } - - protected String specifiedConverterName(ConvertAnnotation resourceConvert) { - return resourceConvert == null ? null : resourceConvert.getValue(); - } - - - protected EclipseLinkJavaConverter buildConverter(String converterType) { - if (converterType == EclipseLinkConverter.NO_CONVERTER) { - return null; - } - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkJavaCustomConverter(this, this.resourcePersistentAttribute); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkJavaTypeConverter(this, this.resourcePersistentAttribute); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentAttribute); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkJavaStructConverter(this, this.resourcePersistentAttribute); - } - return null; - } - - protected String converterType(JavaResourcePersistentAttribute jrpa) { - if (jrpa.getSupportingAnnotation(ConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - else if (jrpa.getSupportingAnnotation(TypeConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.TYPE_CONVERTER; - } - else if (jrpa.getSupportingAnnotation(ObjectTypeConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - else if (jrpa.getSupportingAnnotation(StructConverterAnnotation.ANNOTATION_NAME) != null) { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - return null; - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - if (getConverter() != null) { - getConverter().validate(messages, astRoot); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverter.java deleted file mode 100644 index ec670aba04..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverter.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.java.NamedConverterAnnotation; -import org.eclipse.jpt.utility.internal.StringTools; - -public abstract class EclipseLinkJavaConverter extends AbstractJavaJpaContextNode - implements EclipseLinkConverter -{ - private JavaResourcePersistentMember resourcePersistentMember; - - private String name; - - - protected EclipseLinkJavaConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent); - this.initialize(jrpm); - } - - - protected NamedConverterAnnotation getAnnotation() { - return (NamedConverterAnnotation) this.resourcePersistentMember.getSupportingAnnotation(getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // **************** name *************************************************** - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - getAnnotation().setName(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - protected void setName_(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - - // **************** resource interaction *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - this.resourcePersistentMember = jrpm; - this.name = this.name(getAnnotation()); - getPersistenceUnit().addConverter(this); - } - - protected void update(JavaResourcePersistentMember jrpm) { - this.resourcePersistentMember = jrpm; - this.setName_(this.name(getAnnotation())); - getPersistenceUnit().addConverter(this); - } - - protected String name(NamedConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getName(); - } - - - // **************** validation ********************************************* - - public boolean overrides(EclipseLinkConverter converter) { - // java is at the base of the tree - return false; - } - - public boolean duplicates(EclipseLinkConverter converter) { - return (this != converter) - && ! StringTools.stringIsEmpty(this.name) - && this.name.equals(converter.getName()) - && ! this.overrides(converter) - && ! converter.overrides(this); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getAnnotation().getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverterHolder.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverterHolder.java deleted file mode 100644 index 56ec6898f6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaConverterHolder.java +++ /dev/null @@ -1,345 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaConverterHolder extends AbstractJavaJpaContextNode implements JavaConverterHolder -{ - protected JavaResourcePersistentType resourcePersistentType; - - protected EclipseLinkJavaCustomConverter converter; - protected EclipseLinkJavaObjectTypeConverter objectTypeConverter; - protected EclipseLinkJavaStructConverter structConverter; - protected EclipseLinkJavaTypeConverter typeConverter; - - public EclipseLinkJavaConverterHolder(JavaTypeMapping parent) { - super(parent); - } - - //************** converter ************* - public CustomConverter getConverter() { - return this.converter; - } - - public CustomConverter addConverter() { - if (this.converter != null) { - throw new IllegalStateException("converter already exists"); //$NON-NLS-1$ - } - this.converter = new EclipseLinkJavaCustomConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.converter.getAnnotationName()); - firePropertyChanged(CONVERTER_PROPERTY, null, this.converter); - return this.converter; - } - - protected void addConverter_() { - this.converter = new EclipseLinkJavaCustomConverter(this, this.resourcePersistentType); - firePropertyChanged(CONVERTER_PROPERTY, null, this.converter); - } - - public void removeConverter() { - if (this.converter == null) { - throw new IllegalStateException("converter is null"); //$NON-NLS-1$ - } - EclipseLinkJavaCustomConverter oldConverter = this.converter; - this.converter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeConverter_() { - this.converter = null; - firePropertyChanged(CONVERTER_PROPERTY, this.converter, null); - } - - protected String getConverterAnnotationName() { - return ConverterAnnotation.ANNOTATION_NAME; - } - - protected ConverterAnnotation getResourceConverter() { - return (ConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getConverterAnnotationName()); - } - - - //************** object type converter ************* - public ObjectTypeConverter getObjectTypeConverter() { - return this.objectTypeConverter; - } - - public ObjectTypeConverter addObjectTypeConverter() { - if (this.objectTypeConverter != null) { - throw new IllegalStateException("object type converter already exists"); //$NON-NLS-1$ - } - this.objectTypeConverter = new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.objectTypeConverter.getAnnotationName()); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, null, this.objectTypeConverter); - return this.objectTypeConverter; - } - - protected void addObjectTypeConverter_() { - this.objectTypeConverter = new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentType); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, null, this.objectTypeConverter); - } - - public void removeObjectTypeConverter() { - if (this.objectTypeConverter == null) { - throw new IllegalStateException("object type converter is null"); //$NON-NLS-1$ - } - EclipseLinkJavaObjectTypeConverter oldConverter = this.objectTypeConverter; - this.objectTypeConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeObjectTypeConverter_() { - ObjectTypeConverter oldConverter = this.objectTypeConverter; - this.objectTypeConverter = null; - firePropertyChanged(OBJECT_TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getObjectTypeConverterAnnotationName() { - return ObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - - protected ObjectTypeConverterAnnotation getResourceObjectTypeConverter() { - return (ObjectTypeConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getObjectTypeConverterAnnotationName()); - } - - - //************** type converter ************* - public TypeConverter getTypeConverter() { - return this.typeConverter; - } - - public TypeConverter addTypeConverter() { - if (this.typeConverter != null) { - throw new IllegalStateException("type converter already exists"); //$NON-NLS-1$ - } - this.typeConverter = new EclipseLinkJavaTypeConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.typeConverter.getAnnotationName()); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, null, this.typeConverter); - return this.typeConverter; - } - - protected void addTypeConverter_() { - this.typeConverter = new EclipseLinkJavaTypeConverter(this, this.resourcePersistentType); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, null, this.typeConverter); - } - - public void removeTypeConverter() { - if (this.typeConverter == null) { - throw new IllegalStateException("type converter is null"); //$NON-NLS-1$ - } - EclipseLinkJavaTypeConverter oldConverter = this.typeConverter; - this.typeConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeTypeConverter_() { - TypeConverter oldConverter = this.typeConverter; - this.typeConverter = null; - firePropertyChanged(TYPE_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getTypeConverterAnnotationName() { - return TypeConverterAnnotation.ANNOTATION_NAME; - } - - protected TypeConverterAnnotation getResourceTypeConverter() { - return (TypeConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getTypeConverterAnnotationName()); - } - - - //************** struct converter ************* - public StructConverter getStructConverter() { - return this.structConverter; - } - - public StructConverter addStructConverter() { - if (this.structConverter != null) { - throw new IllegalStateException("struct converter already exists"); //$NON-NLS-1$ - } - this.structConverter = new EclipseLinkJavaStructConverter(this, this.resourcePersistentType); - this.resourcePersistentType.addSupportingAnnotation(this.structConverter.getAnnotationName()); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, null, this.structConverter); - return this.structConverter; - } - - protected void addStructConverter_() { - this.structConverter = new EclipseLinkJavaStructConverter(this, this.resourcePersistentType); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, null, this.structConverter); - } - - public void removeStructConverter() { - if (this.structConverter == null) { - throw new IllegalStateException("struct converter is null"); //$NON-NLS-1$ - } - EclipseLinkJavaStructConverter oldConverter = this.structConverter; - this.structConverter = null; - this.resourcePersistentType.removeSupportingAnnotation(oldConverter.getAnnotationName()); - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, oldConverter, null); - } - - protected void removeStructConverter_() { - StructConverter oldConverter = this.structConverter; - this.structConverter = null; - firePropertyChanged(STRUCT_CONVERTER_PROPERTY, oldConverter, null); - } - - protected String getStructConverterAnnotationName() { - return StructConverterAnnotation.ANNOTATION_NAME; - } - - protected StructConverterAnnotation getResourceStructConverter() { - return (StructConverterAnnotation) this.resourcePersistentType.getSupportingAnnotation(getStructConverterAnnotationName()); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.updateConverter(); - this.updateObjectTypeConverter(); - this.updateTypeConverter(); - this.updateStructConverter(); - } - - protected void updateConverter() { - if (getResourceConverter() != null) { - if (this.converter != null) { - this.converter.update(this.resourcePersistentType); - } - else { - addConverter_(); - } - } - else { - if (this.converter != null) { - removeConverter_(); - } - } - } - - protected void updateObjectTypeConverter() { - if (getResourceObjectTypeConverter() != null) { - if (this.objectTypeConverter != null) { - this.objectTypeConverter.update(this.resourcePersistentType); - } - else { - addObjectTypeConverter_(); - } - } - else { - if (this.objectTypeConverter != null) { - removeObjectTypeConverter_(); - } - } - } - - protected void updateTypeConverter() { - if (getResourceTypeConverter() != null) { - if (this.typeConverter != null) { - this.typeConverter.update(this.resourcePersistentType); - } - else { - addTypeConverter_(); - } - } - else { - if (this.typeConverter != null) { - removeTypeConverter(); - } - } - } - - protected void updateStructConverter() { - if (getResourceStructConverter() != null) { - if (this.structConverter != null) { - this.structConverter.update(this.resourcePersistentType); - } - else { - addStructConverter_(); - } - } - else { - if (this.structConverter != null) { - removeStructConverter_(); - } - } - } - - public void initialize(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.initializeConverter(); - this.initializeObjectTypeConverter(); - this.initializeTypeConverter(); - this.initializeStructConverter(); - } - - protected void initializeConverter() { - if (getResourceConverter() != null) { - this.converter = new EclipseLinkJavaCustomConverter(this, this.resourcePersistentType); - } - } - - protected void initializeObjectTypeConverter() { - if (getResourceObjectTypeConverter() != null) { - this.objectTypeConverter = new EclipseLinkJavaObjectTypeConverter(this, this.resourcePersistentType); - } - } - - protected void initializeTypeConverter() { - if (getResourceTypeConverter() != null) { - this.typeConverter = new EclipseLinkJavaTypeConverter(this, this.resourcePersistentType); - } - } - - protected void initializeStructConverter() { - if (getResourceStructConverter() != null) { - this.structConverter = new EclipseLinkJavaStructConverter(this, this.resourcePersistentType); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourcePersistentType.getTextRange(astRoot); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - if (this.converter != null) { - this.converter.validate(messages, astRoot); - } - if (this.objectTypeConverter != null) { - this.objectTypeConverter.validate(messages, astRoot); - } - if (this.typeConverter != null) { - this.typeConverter.validate(messages, astRoot); - } - if (this.structConverter != null) { - this.structConverter.validate(messages, astRoot); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomConverter.java deleted file mode 100644 index 8f0cc2736c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomConverter.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaCustomConverter extends EclipseLinkJavaConverter - implements CustomConverter -{ - private String converterClass; - - public EclipseLinkJavaCustomConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - } - - - public String getType() { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - - public String getAnnotationName() { - return ConverterAnnotation.ANNOTATION_NAME; - } - - @Override - protected ConverterAnnotation getAnnotation() { - return (ConverterAnnotation) super.getAnnotation(); - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getAnnotation().setConverterClass(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - this.converterClass = this.converterClass(getAnnotation()); - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - this.setConverterClass_(this.converterClass(getAnnotation())); - } - - protected String converterClass(ConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getConverterClass(); - } - - public TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return getAnnotation().getConverterClassTextRange(astRoot); - } - - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - validateConverterClass(messages, astRoot); - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - if (! getAnnotation().implementsConverter()) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, - new String[] {this.converterClass}, - this, - getConverterClassTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomizer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomizer.java deleted file mode 100644 index 527aaf1d8c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaCustomizer.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaCustomizer extends AbstractJavaJpaContextNode implements Customizer -{ - private JavaResourcePersistentType resourcePersistentType; - - private String customizerClass; - - public EclipseLinkJavaCustomizer(JavaJpaContextNode parent) { - super(parent); - } - - @Override - protected EclipseLinkJpaFactory getJpaFactory() { - return (EclipseLinkJpaFactory) super.getJpaFactory(); - } - - protected String getAnnotationName() { - return CustomizerAnnotation.ANNOTATION_NAME; - } - - protected void addResourceCustomizer() { - this.resourcePersistentType.addSupportingAnnotation(getAnnotationName()); - } - - protected void removeResourceCustomizer() { - this.resourcePersistentType.removeSupportingAnnotation(getAnnotationName()); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getResourceCustomizer().getTextRange(astRoot); - } - - protected CustomizerAnnotation getResourceCustomizer() { - return (CustomizerAnnotation) this.resourcePersistentType.getSupportingAnnotation(getAnnotationName()); - } - - public String getCustomizerClass() { - return getSpecifiedCustomizerClass(); - } - - public String getDefaultCustomizerClass() { - return null; - } - - public String getSpecifiedCustomizerClass() { - return this.customizerClass; - } - - public void setSpecifiedCustomizerClass(String newCustomizerClass) { - if (attributeValueHasNotChanged(this.customizerClass, newCustomizerClass)) { - return; - } - String oldCustomizerClass = this.customizerClass; - this.customizerClass = newCustomizerClass; - if (this.customizerClass != null) { - addResourceCustomizer(); - } - else { - removeResourceCustomizer(); - } - if (newCustomizerClass != null) { - getResourceCustomizer().setValue(newCustomizerClass); - } - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - protected void setCustomizerClass_(String newCustomizerClass) { - String oldCustomizerClass = this.customizerClass; - this.customizerClass = newCustomizerClass; - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - public void initialize(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - CustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - this.customizerClass = this.customizerClass(resourceCustomizer); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - CustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - this.setCustomizerClass_(this.customizerClass(resourceCustomizer)); - } - - protected String customizerClass(CustomizerAnnotation resourceCustomizer) { - return resourceCustomizer == null ? null : resourceCustomizer.getValue(); - } - - public TextRange getCustomizerClassTextRange(CompilationUnit astRoot) { - return getResourceCustomizer().getValueTextRange(astRoot); - } - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - validateConverterClass(messages, astRoot); - } - - protected void validateConverterClass(List<IMessage> messages, CompilationUnit astRoot) { - CustomizerAnnotation resourceCustomizer = getResourceCustomizer(); - if (resourceCustomizer != null && !resourceCustomizer.implementsDescriptorCustomizer()) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.CUSTOMIZER_CLASS_IMPLEMENTS_DESCRIPTOR_CUSTOMIZER, - new String[] {this.customizerClass}, - this, - getCustomizerClassTextRange(astRoot) - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableImpl.java deleted file mode 100644 index d3e1c24a66..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEmbeddableImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.internal.context.java.GenericJavaEmbeddable; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEmbeddable; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaEmbeddableImpl extends GenericJavaEmbeddable implements EclipseLinkJavaEmbeddable -{ - - protected final JavaConverterHolder converterHolder; - - protected final EclipseLinkJavaCustomizer customizer; - - protected final EclipseLinkJavaChangeTracking changeTracking; - - public EclipseLinkJavaEmbeddableImpl(JavaPersistentType parent) { - super(parent); - this.converterHolder = new EclipseLinkJavaConverterHolder(this); - this.customizer = new EclipseLinkJavaCustomizer(this); - this.changeTracking = new EclipseLinkJavaChangeTracking(this); - } - - public JavaConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - @Override - public void initialize(JavaResourcePersistentType jrpt) { - super.initialize(jrpt); - this.converterHolder.initialize(jrpt); - this.customizer.initialize(jrpt); - this.changeTracking.initialize(jrpt); - } - - @Override - public void update(JavaResourcePersistentType jrpt) { - super.update(jrpt); - this.converterHolder.update(jrpt); - this.customizer.update(jrpt); - this.changeTracking.update(jrpt); - } - - - //********** Validation ******************************************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.converterHolder.validate(messages, astRoot); - this.customizer.validate(messages, astRoot); - this.changeTracking.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEntityImpl.java deleted file mode 100644 index e8f0dfc4d0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaEntityImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.internal.context.java.GenericJavaEntity; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaEntityImpl extends GenericJavaEntity implements EclipseLinkJavaEntity -{ - protected final JavaCaching eclipseLinkCaching; - - protected final JavaConverterHolder converterHolder; - - protected final EclipseLinkJavaReadOnly readOnly; - - protected final EclipseLinkJavaCustomizer customizer; - - protected final EclipseLinkJavaChangeTracking changeTracking; - - public EclipseLinkJavaEntityImpl(JavaPersistentType parent) { - super(parent); - this.eclipseLinkCaching = new EclipseLinkJavaCaching(this); - this.converterHolder = new EclipseLinkJavaConverterHolder(this); - this.readOnly = new EclipseLinkJavaReadOnly(this); - this.changeTracking = new EclipseLinkJavaChangeTracking(this); - this.customizer = new EclipseLinkJavaCustomizer(this); - } - - public JavaCaching getCaching() { - return this.eclipseLinkCaching; - } - - public JavaConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public ReadOnly getReadOnly() { - return this.readOnly; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - @Override - public void initialize(JavaResourcePersistentType jrpt) { - super.initialize(jrpt); - this.eclipseLinkCaching.initialize(jrpt); - this.converterHolder.initialize(jrpt); - this.readOnly.initialize(jrpt); - this.customizer.initialize(jrpt); - this.changeTracking.initialize(jrpt); - } - - @Override - public void update(JavaResourcePersistentType jrpt) { - super.update(jrpt); - this.eclipseLinkCaching.update(jrpt); - this.converterHolder.update(jrpt); - this.readOnly.update(jrpt); - this.customizer.update(jrpt); - this.changeTracking.update(jrpt); - } - - - //********** Validation ******************************************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.eclipseLinkCaching.validate(messages, astRoot); - this.converterHolder.validate(messages, astRoot); - this.readOnly.validate(messages, astRoot); - this.customizer.validate(messages, astRoot); - this.changeTracking.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaExpiryTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaExpiryTimeOfDay.java deleted file mode 100644 index b893c2c6cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaExpiryTimeOfDay.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation; - -public class EclipseLinkJavaExpiryTimeOfDay extends AbstractJavaJpaContextNode - implements ExpiryTimeOfDay -{ - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - protected TimeOfDayAnnotation timeOfDay; - - public EclipseLinkJavaExpiryTimeOfDay(Caching parent) { - super(parent); - } - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - this.timeOfDay.setHour(newHour); - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - protected void setHour_(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - this.timeOfDay.setMinute(newMinute); - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - protected void setMinute_(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - this.timeOfDay.setSecond(newSecond); - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - protected void setSecond_(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - this.timeOfDay.setMillisecond(newMillisecond); - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - protected void setMillisecond_(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.timeOfDay.getTextRange(astRoot); - } - - public void initialize(TimeOfDayAnnotation timeOfDay) { - this.timeOfDay = timeOfDay; - this.hour = getHour(timeOfDay); - this.minute = getMinute(timeOfDay); - this.second = getSecond(timeOfDay); - this.millisecond = getMillisecond(timeOfDay); - } - - public void update(TimeOfDayAnnotation timeOfDay) { - this.timeOfDay = timeOfDay; - this.setHour_(getHour(timeOfDay)); - this.setMinute_(getMinute(timeOfDay)); - this.setSecond_(getSecond(timeOfDay)); - this.setMillisecond_(getMillisecond(timeOfDay)); - } - - protected Integer getHour(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getHour(); - } - - protected Integer getMinute(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getMinute(); - } - - protected Integer getSecond(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getSecond(); - } - - protected Integer getMillisecond(TimeOfDayAnnotation timeOfDay) { - return timeOfDay.getMillisecond(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingImpl.java deleted file mode 100644 index 5ec2f068ab..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaIdMappingImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaIdMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaIdMappingImpl extends GenericJavaIdMapping implements EclipseLinkIdMapping -{ - protected final EclipseLinkJavaMutable mutable; - - public EclipseLinkJavaIdMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkJavaMutable(this); - } - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkJavaConvert(this, this.resourcePersistentAttribute); - } - return null; - } - - @Override - protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) { - //check @Convert first, this is the order that EclipseLink searches - if (jrpa.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME) != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(jrpa); - } - - - //************ EclipselinkJavaIdMapping implementation **************** - - public Mutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.mutable.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.mutable.update(jrpa); - } - - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.mutable.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaJoinFetch.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaJoinFetch.java deleted file mode 100644 index 73d73b83c7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaJoinFetch.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation; - -public class EclipseLinkJavaJoinFetch extends AbstractJavaJpaContextNode implements JoinFetch -{ - protected JoinFetchType joinFetchValue; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - - public EclipseLinkJavaJoinFetch(JavaAttributeMapping parent) { - super(parent); - } - - - protected String getJoinFetchAnnotationName() { - return JoinFetchAnnotation.ANNOTATION_NAME; - } - - protected JoinFetchAnnotation getResourceJoinFetch() { - return (JoinFetchAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getJoinFetchAnnotationName()); - } - - protected void addResourceJoinFetch() { - this.resourcePersistentAttribute.addSupportingAnnotation(getJoinFetchAnnotationName()); - } - - protected void removeResourceJoinFetch() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getJoinFetchAnnotationName()); - } - - public JoinFetchType getValue() { - return this.joinFetchValue; - } - - protected JoinFetchType getDefaultValue() { - return JoinFetch.DEFAULT_VALUE; - } - - public void setValue(JoinFetchType newJoinFetchValue) { - if (this.joinFetchValue == newJoinFetchValue) { - return; - } - - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - - if (newJoinFetchValue != null) { - if (getResourceJoinFetch() == null) { - addResourceJoinFetch(); - } - getResourceJoinFetch().setValue(JoinFetchType.toJavaResourceModel(newJoinFetchValue)); - } - else { - if (getResourceJoinFetch() != null) { - removeResourceJoinFetch(); - } - } - firePropertyChanged(JoinFetch.VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - /** - * internal setter used only for updating from the resource model. - * There were problems with InvalidThreadAccess exceptions in the UI - * when you set a value from the UI and the annotation doesn't exist yet. - * Adding the annotation causes an update to occur and then the exception. - */ - protected void setValue_(JoinFetchType newJoinFetchValue) { - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - firePropertyChanged(JoinFetch.VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - public void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - JoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - this.joinFetchValue = this.joinFetch(resourceJoinFetch); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - JoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - setValue_(joinFetch(resourceJoinFetch)); - } - - private JoinFetchType joinFetch(JoinFetchAnnotation resourceJoinFetch) { - if (resourceJoinFetch == null) { - return null; - } - if (resourceJoinFetch.getValue() == null) { - // @JoinFetch is equivalent to @JoinFetch(JoinFetch.INNER) - return getDefaultValue(); - } - return JoinFetchType.fromJavaResourceModel(resourceJoinFetch.getValue()); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - JoinFetchAnnotation resourceJoinFetch = this.getResourceJoinFetch(); - return resourceJoinFetch == null ? null : resourceJoinFetch.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingImpl.java deleted file mode 100644 index 16581ea2bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToManyMappingImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToManyMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaManyToManyMappingImpl extends GenericJavaManyToManyMapping implements EclipseLinkRelationshipMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - - public EclipseLinkJavaManyToManyMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingImpl.java deleted file mode 100644 index 3eff7dc4ca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaManyToOneMappingImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToOneMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaManyToOneMappingImpl extends GenericJavaManyToOneMapping implements EclipseLinkRelationshipMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - - public EclipseLinkJavaManyToOneMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassImpl.java deleted file mode 100644 index de0fa20727..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMappedSuperclassImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentType; -import org.eclipse.jpt.core.internal.context.java.GenericJavaMappedSuperclass; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.context.java.JavaConverterHolder; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaMappedSuperclassImpl extends GenericJavaMappedSuperclass implements EclipseLinkJavaMappedSuperclass -{ - protected JavaCaching eclipseLinkCaching; - - protected final JavaConverterHolder converterHolder; - - protected final EclipseLinkJavaReadOnly readOnly; - - protected final EclipseLinkJavaCustomizer customizer; - - protected final EclipseLinkJavaChangeTracking changeTracking; - - public EclipseLinkJavaMappedSuperclassImpl(JavaPersistentType parent) { - super(parent); - this.eclipseLinkCaching = new EclipseLinkJavaCaching(this); - this.converterHolder = new EclipseLinkJavaConverterHolder(this); - this.readOnly = new EclipseLinkJavaReadOnly(this); - this.customizer = new EclipseLinkJavaCustomizer(this); - this.changeTracking = new EclipseLinkJavaChangeTracking(this); - } - - public JavaCaching getCaching() { - return this.eclipseLinkCaching; - } - - public JavaConverterHolder getConverterHolder() { - return this.converterHolder; - } - - public ReadOnly getReadOnly() { - return this.readOnly; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - @Override - public void initialize(JavaResourcePersistentType jrpt) { - super.initialize(jrpt); - this.eclipseLinkCaching.initialize(jrpt); - this.converterHolder.initialize(jrpt); - this.readOnly.initialize(jrpt); - this.customizer.initialize(jrpt); - this.changeTracking.initialize(jrpt); - } - - @Override - public void update(JavaResourcePersistentType jrpt) { - super.update(jrpt); - this.eclipseLinkCaching.update(jrpt); - this.converterHolder.update(jrpt); - this.readOnly.update(jrpt); - this.customizer.update(jrpt); - this.changeTracking.update(jrpt); - } - - - //********** Validation ******************************************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.eclipseLinkCaching.validate(messages, astRoot); - this.converterHolder.validate(messages, astRoot); - this.readOnly.validate(messages, astRoot); - this.customizer.validate(messages, astRoot); - this.changeTracking.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMutable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMutable.java deleted file mode 100644 index 154baa39be..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaMutable.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation; - -public class EclipseLinkJavaMutable extends AbstractJavaJpaContextNode implements Mutable -{ - protected boolean defaultMutable; - protected Boolean specifiedMutable; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - public EclipseLinkJavaMutable(JavaAttributeMapping parent) { - super(parent); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected String getMutableAnnotationName() { - return MutableAnnotation.ANNOTATION_NAME; - } - - protected MutableAnnotation getResourceMutable() { - return (MutableAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getMutableAnnotationName()); - } - - protected void addResourceMutable() { - this.resourcePersistentAttribute.addSupportingAnnotation(getMutableAnnotationName()); - } - - protected void removeResourceMutable() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getMutableAnnotationName()); - } - - protected boolean calculateDefaultMutable() { - if (this.resourcePersistentAttribute.typeIsDateOrCalendar()) { - Boolean persistenceUnitDefaultMutable = getPersistenceUnit().getOptions().getTemporalMutable(); - return persistenceUnitDefaultMutable == null ? false : persistenceUnitDefaultMutable.booleanValue(); - } - return this.resourcePersistentAttribute.typeIsSerializable(); - } - - public boolean isMutable() { - return this.specifiedMutable != null ? this.specifiedMutable.booleanValue() : this.defaultMutable; - } - - public boolean isDefaultMutable() { - return this.defaultMutable; - } - - protected void setDefaultMutable(boolean newDefaultMutable) { - boolean oldDefaultMutable = this.defaultMutable; - this.defaultMutable = newDefaultMutable; - firePropertyChanged(DEFAULT_MUTABLE_PROPERTY, oldDefaultMutable, newDefaultMutable); - } - - public Boolean getSpecifiedMutable() { - return this.specifiedMutable; - } - - public void setSpecifiedMutable(Boolean newSpecifiedMutable) { - if (this.specifiedMutable == newSpecifiedMutable) { - return; - } - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - - if (newSpecifiedMutable != null) { - if (getResourceMutable() == null) { - addResourceMutable(); - } - if (newSpecifiedMutable.booleanValue()) { - if (getResourceMutable().getValue() == Boolean.FALSE) { - getResourceMutable().setValue(null); - } - } - else { - getResourceMutable().setValue(Boolean.FALSE); - } - } - else { - removeResourceMutable(); - } - firePropertyChanged(Mutable.SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - protected void setSpecifiedMutable_(Boolean newSpecifiedMutable) { - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - public void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - MutableAnnotation resourceMutable = this.getResourceMutable(); - this.specifiedMutable = this.specifiedMutable(resourceMutable); - this.defaultMutable = this.calculateDefaultMutable(); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - MutableAnnotation resourceMutable = this.getResourceMutable(); - this.setSpecifiedMutable_(this.specifiedMutable(resourceMutable)); - this.setDefaultMutable(this.calculateDefaultMutable()); - } - - private Boolean specifiedMutable(MutableAnnotation resourceMutable) { - if (resourceMutable == null) { - return null; - } - if (resourceMutable.getValue() == null) { //@Mutable is equivalent to @Mutable(true) - return Boolean.TRUE; - } - return resourceMutable.getValue(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - MutableAnnotation resourceMutable = this.getResourceMutable(); - return resourceMutable == null ? null : resourceMutable.getTextRange(astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaObjectTypeConverter.java deleted file mode 100644 index d85b55954f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaObjectTypeConverter.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaObjectTypeConverter extends EclipseLinkJavaConverter - implements ObjectTypeConverter -{ - private String dataType; - - private String objectType; - - private String defaultObjectValue; - - private final List<EclipseLinkJavaConversionValue> conversionValues; - - - public EclipseLinkJavaObjectTypeConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - this.conversionValues = new ArrayList<EclipseLinkJavaConversionValue>(); - } - - - public String getType() { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - - public String getAnnotationName() { - return ObjectTypeConverterAnnotation.ANNOTATION_NAME; - } - - protected ObjectTypeConverterAnnotation getAnnotation() { - return (ObjectTypeConverterAnnotation) super.getAnnotation(); - } - - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getAnnotation().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getAnnotation().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** conversion values ************************************** - - public ListIterator<EclipseLinkJavaConversionValue> conversionValues() { - return new CloneListIterator<EclipseLinkJavaConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public EclipseLinkJavaConversionValue addConversionValue(int index) { - EclipseLinkJavaConversionValue conversionValue = new EclipseLinkJavaConversionValue(this); - this.conversionValues.add(index, conversionValue); - ConversionValueAnnotation resourceConversionValue = getAnnotation().addConversionValue(index); - conversionValue.initialize(resourceConversionValue); - fireItemAdded(CONVERSION_VALUES_LIST, index, conversionValue); - return conversionValue; - } - - public EclipseLinkJavaConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - protected void addConversionValue(int index, EclipseLinkJavaConversionValue conversionValue) { - addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected void addConversionValue(EclipseLinkJavaConversionValue conversionValue) { - this.addConversionValue(this.conversionValues.size(), conversionValue); - } - - public void removeConversionValue(ConversionValue conversionValue) { - this.removeConversionValue(this.conversionValues.indexOf(conversionValue)); - } - - public void removeConversionValue(int index) { - EclipseLinkJavaConversionValue removedConversionValue = this.conversionValues.remove(index); - getAnnotation().removeConversionValue(index); - fireItemRemoved(CONVERSION_VALUES_LIST, index, removedConversionValue); - } - - protected void removeConversionValue_(EclipseLinkJavaConversionValue conversionValue) { - removeItemFromList(conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - CollectionTools.move(this.conversionValues, targetIndex, sourceIndex); - getAnnotation().moveConversionValue(targetIndex, sourceIndex); - fireItemMoved(CONVERSION_VALUES_LIST, targetIndex, sourceIndex); - } - - public ListIterator<String> dataValues() { - return new TransformationListIterator<EclipseLinkJavaConversionValue, String>(conversionValues()) { - @Override - protected String transform(EclipseLinkJavaConversionValue next) { - return next.getDataValue(); - } - }; - } - - - // **************** default object value *********************************** - - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - getAnnotation().setDefaultObjectValue(newDefaultObjectValue); - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - protected void setDefaultObjectValue_(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - - // **************** resource interaction *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - ObjectTypeConverterAnnotation resourceConverter = getAnnotation(); - this.dataType = this.dataType(resourceConverter); - this.objectType = this.objectType(resourceConverter); - this.defaultObjectValue = this.defaultObjectValue(resourceConverter); - this.initializeConversionValues(resourceConverter); - } - - protected void initializeConversionValues(ObjectTypeConverterAnnotation resourceConverter) { - if (resourceConverter == null) { - return; - } - ListIterator<ConversionValueAnnotation> resourceConversionValues = resourceConverter.conversionValues(); - - while(resourceConversionValues.hasNext()) { - this.conversionValues.add(buildConversionValue(resourceConversionValues.next())); - } - } - - protected EclipseLinkJavaConversionValue buildConversionValue(ConversionValueAnnotation resourceConversionValue) { - EclipseLinkJavaConversionValue conversionValue = new EclipseLinkJavaConversionValue(this); - conversionValue.initialize(resourceConversionValue); - return conversionValue; - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - ObjectTypeConverterAnnotation resourceConverter = getAnnotation(); - this.setDataType_(this.dataType(resourceConverter)); - this.setObjectType_(this.objectType(resourceConverter)); - this.setDefaultObjectValue_(this.defaultObjectValue(resourceConverter)); - this.updateConversionValues(resourceConverter); - } - - protected void updateConversionValues(ObjectTypeConverterAnnotation resourceConverter) { - ListIterator<EclipseLinkJavaConversionValue> contextConversionValues = conversionValues(); - ListIterator<ConversionValueAnnotation> resourceConversionValues = resourceConverter.conversionValues(); - while (contextConversionValues.hasNext()) { - EclipseLinkJavaConversionValue conversionValues = contextConversionValues.next(); - if (resourceConversionValues.hasNext()) { - conversionValues.update(resourceConversionValues.next()); - } - else { - removeConversionValue_(conversionValues); - } - } - - while (resourceConversionValues.hasNext()) { - addConversionValue(buildConversionValue(resourceConversionValues.next())); - } - } - - protected String dataType(ObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDataType(); - } - - protected String objectType(ObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getObjectType(); - } - - protected String defaultObjectValue(ObjectTypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDefaultObjectValue(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - for (Iterator<EclipseLinkJavaConversionValue> stream = conversionValues(); stream.hasNext();) { - stream.next().validate(messages, astRoot); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingImpl.java deleted file mode 100644 index 7f368c17a7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToManyMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaOneToManyMappingImpl extends GenericJavaOneToManyMapping implements EclipseLinkOneToManyMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - protected final EclipseLinkJavaPrivateOwned privateOwned; - - - public EclipseLinkJavaOneToManyMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - this.privateOwned = new EclipseLinkJavaPrivateOwned(this); - } - - // ********** NonOwningMapping implementation ********** - @Override - public boolean mappedByIsValid(AttributeMapping mappedByMapping) { - return super.mappedByIsValid(mappedByMapping) || (mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - } - - protected String getPrivateOwnedAnnotationName() { - return PrivateOwnedAnnotation.ANNOTATION_NAME; - } - - protected PrivateOwnedAnnotation getResourcePrivateOwned() { - return (PrivateOwnedAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void addResourcePrivateOwned() { - this.resourcePersistentAttribute.addSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void removeResourcePrivateOwned() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - this.privateOwned.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - this.privateOwned.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - this.privateOwned.validate(messages, astRoot); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingProvider.java deleted file mode 100644 index 9f03ae01bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyMappingProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMappingProvider; - -public class EclipseLinkJavaOneToManyMappingProvider - implements DefaultJavaAttributeMappingProvider -{ - - // singleton - private static final EclipseLinkJavaOneToManyMappingProvider INSTANCE = new EclipseLinkJavaOneToManyMappingProvider(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkJavaOneToManyMappingProvider() { - super(); - } - - public String getKey() { - return JavaOneToManyMappingProvider.instance().getKey(); - } - - public String getAnnotationName() { - return JavaOneToManyMappingProvider.instance().getAnnotationName(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return JavaOneToManyMappingProvider.instance().buildMapping(parent, factory); - } - - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { - if (!persistentAttribute.getResourcePersistentAttribute().typeIsContainer()) { - return false; - } - String targetEntity = persistentAttribute.getResourcePersistentAttribute().getQualifiedReferenceEntityElementTypeName(); - if (targetEntity == null) { - return false; - } - return persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingImpl.java deleted file mode 100644 index 214d9229fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToOneMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaOneToOneMappingImpl extends GenericJavaOneToOneMapping implements EclipseLinkOneToOneMapping -{ - protected final EclipseLinkJavaJoinFetch joinFetch; - - protected final EclipseLinkJavaPrivateOwned privateOwned; - - - public EclipseLinkJavaOneToOneMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkJavaJoinFetch(this); - this.privateOwned = new EclipseLinkJavaPrivateOwned(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.joinFetch.initialize(jrpa); - this.privateOwned.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.joinFetch.update(jrpa); - this.privateOwned.update(jrpa); - } - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.joinFetch.validate(messages, astRoot); - this.privateOwned.validate(messages, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingProvider.java deleted file mode 100644 index 47c6915148..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaOneToOneMappingProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMappingProvider; - -public class EclipseLinkJavaOneToOneMappingProvider - implements DefaultJavaAttributeMappingProvider -{ - - // singleton - private static final EclipseLinkJavaOneToOneMappingProvider INSTANCE = new EclipseLinkJavaOneToOneMappingProvider(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EclipseLinkJavaOneToOneMappingProvider() { - super(); - } - - public String getKey() { - return JavaOneToOneMappingProvider.instance().getKey(); - } - - public String getAnnotationName() { - return JavaOneToOneMappingProvider.instance().getAnnotationName(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return JavaOneToOneMappingProvider.instance().buildMapping(parent, factory); - } - - public boolean defaultApplies(JavaPersistentAttribute persistentAttribute) { - if (persistentAttribute.getResourcePersistentAttribute().typeIsContainer()) { - return false; - } - String targetEntity = persistentAttribute.getResourcePersistentAttribute().getQualifiedReferenceEntityTypeName(); - if (targetEntity == null) { - return false; - } - return persistentAttribute.getPersistenceUnit().getEntity(targetEntity) != null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaPrivateOwned.java deleted file mode 100644 index 98cf3ec2bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaPrivateOwned.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation; - -public class EclipseLinkJavaPrivateOwned extends AbstractJavaJpaContextNode implements PrivateOwned -{ - protected boolean privateOwned; - - protected JavaResourcePersistentAttribute resourcePersistentAttribute; - - public EclipseLinkJavaPrivateOwned(JavaAttributeMapping parent) { - super(parent); - } - - protected String getPrivateOwnedAnnotationName() { - return PrivateOwnedAnnotation.ANNOTATION_NAME; - } - - protected PrivateOwnedAnnotation getResourcePrivateOwned() { - return (PrivateOwnedAnnotation) this.resourcePersistentAttribute.getSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void addResourcePrivateOwned() { - this.resourcePersistentAttribute.addSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - protected void removeResourcePrivateOwned() { - this.resourcePersistentAttribute.removeSupportingAnnotation(getPrivateOwnedAnnotationName()); - } - - public boolean isPrivateOwned() { - return this.privateOwned; - } - - public void setPrivateOwned(boolean newPrivateOwned) { - if (this.privateOwned == newPrivateOwned) { - return; - } - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - - if (newPrivateOwned) { - addResourcePrivateOwned(); - } - else { - //have to check if annotation exists in case the change is from false to null or vice versa - if (getResourcePrivateOwned() != null) { - removeResourcePrivateOwned(); - } - } - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - protected void setPrivateOwned_(boolean newPrivateOwned) { - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - public void initialize(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.privateOwned = privateOwned(); - } - - public void update(JavaResourcePersistentAttribute jrpa) { - this.resourcePersistentAttribute = jrpa; - this.setPrivateOwned_(privateOwned()); - } - - private boolean privateOwned() { - return getResourcePrivateOwned() != null; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - PrivateOwnedAnnotation resourcePrivateOwned = this.getResourcePrivateOwned(); - return resourcePrivateOwned == null ? null : resourcePrivateOwned.getTextRange(astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaReadOnly.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaReadOnly.java deleted file mode 100644 index f7caeddb82..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaReadOnly.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation; - -public class EclipseLinkJavaReadOnly extends AbstractJavaJpaContextNode implements ReadOnly -{ - protected Boolean specifiedReadOnly; - - protected JavaResourcePersistentType resourcePersistentType; - - - public EclipseLinkJavaReadOnly(JavaTypeMapping parent) { - super(parent); - } - - - protected String getReadOnlyAnnotationName() { - return ReadOnlyAnnotation.ANNOTATION_NAME; - } - - protected ReadOnlyAnnotation getResourceReadOnly() { - return (ReadOnlyAnnotation) this.resourcePersistentType.getSupportingAnnotation(getReadOnlyAnnotationName()); - } - - protected void addResourceReadOnly() { - this.resourcePersistentType.addSupportingAnnotation(getReadOnlyAnnotationName()); - } - - protected void removeResourceReadOnly() { - this.resourcePersistentType.removeSupportingAnnotation(getReadOnlyAnnotationName()); - } - - public boolean isReadOnly() { - return (this.getSpecifiedReadOnly() != null) ? this.getSpecifiedReadOnly().booleanValue() : this.isDefaultReadOnly(); - } - - public boolean isDefaultReadOnly() { - return ReadOnly.DEFAULT_READ_ONLY; - } - - public Boolean getSpecifiedReadOnly() { - return this.specifiedReadOnly; - } - - public void setSpecifiedReadOnly(Boolean newReadOnly) { - if (this.specifiedReadOnly == newReadOnly) { - return; - } - Boolean oldReadOnly = this.specifiedReadOnly; - this.specifiedReadOnly = newReadOnly; - - if (newReadOnly != null && newReadOnly.booleanValue()) { - addResourceReadOnly(); - } - else { - //have to check if annotation exists in case the change is from false to null or vice versa - if (getResourceReadOnly() != null) { - removeResourceReadOnly(); - } - } - firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldReadOnly, newReadOnly); - } - - protected void setSpecifiedReadOnly_(Boolean newReadOnly) { - Boolean oldReadOnly = this.specifiedReadOnly; - this.specifiedReadOnly = newReadOnly; - firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldReadOnly, newReadOnly); - } - - public void initialize(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.specifiedReadOnly = readOnly(); - } - - public void update(JavaResourcePersistentType jrpt) { - this.resourcePersistentType = jrpt; - this.setSpecifiedReadOnly_(readOnly()); - } - - private Boolean readOnly() { - return getResourceReadOnly() == null ? null : Boolean.TRUE; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - ReadOnlyAnnotation resourceReadOnly = this.getResourceReadOnly(); - return resourceReadOnly == null ? null : resourceReadOnly.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaStructConverter.java deleted file mode 100644 index ee59f71802..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaStructConverter.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation; - -public class EclipseLinkJavaStructConverter extends EclipseLinkJavaConverter - implements StructConverter -{ - private String converterClass; - - - public EclipseLinkJavaStructConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - } - - - public String getType() { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - public String getAnnotationName() { - return StructConverterAnnotation.ANNOTATION_NAME; - } - - protected StructConverterAnnotation getAnnotation() { - return (StructConverterAnnotation) super.getAnnotation(); - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getAnnotation().setConverter(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - this.converterClass = this.converterClass(getAnnotation()); - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - this.setConverterClass_(this.converterClass(getAnnotation())); - } - - protected String converterClass(StructConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getConverter(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaTypeConverter.java deleted file mode 100644 index 7c5f222705..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaTypeConverter.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation; - -public class EclipseLinkJavaTypeConverter extends EclipseLinkJavaConverter - implements TypeConverter -{ - private String dataType; - - private String objectType; - - - public EclipseLinkJavaTypeConverter(JavaJpaContextNode parent, JavaResourcePersistentMember jrpm) { - super(parent, jrpm); - } - - public String getType() { - return EclipseLinkConverter.TYPE_CONVERTER; - } - - public String getAnnotationName() { - return TypeConverterAnnotation.ANNOTATION_NAME; - } - - protected TypeConverterAnnotation getAnnotation() { - return (TypeConverterAnnotation) super.getAnnotation(); - } - - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getAnnotation().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getAnnotation().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** resource interaction *********************************** - - protected void initialize(JavaResourcePersistentMember jrpm) { - super.initialize(jrpm); - TypeConverterAnnotation resourceConverter = getAnnotation(); - this.dataType = this.dataType(resourceConverter); - this.objectType = this.objectType(resourceConverter); - } - - public void update(JavaResourcePersistentMember jrpm) { - super.update(jrpm); - TypeConverterAnnotation resourceConverter = getAnnotation(); - this.setDataType_(this.dataType(resourceConverter)); - this.setObjectType_(this.objectType(resourceConverter)); - } - - protected String dataType(TypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getDataType(); - } - - protected String objectType(TypeConverterAnnotation resourceConverter) { - return resourceConverter == null ? null : resourceConverter.getObjectType(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingImpl.java deleted file mode 100644 index 0f5490e4f8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/EclipseLinkJavaVersionMappingImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.context.java.JavaConverter; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.GenericJavaVersionMapping; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkJavaVersionMappingImpl extends GenericJavaVersionMapping implements EclipseLinkVersionMapping -{ - protected final EclipseLinkJavaMutable mutable; - - public EclipseLinkJavaVersionMappingImpl(JavaPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkJavaMutable(this); - } - - @Override - protected JavaConverter buildSpecifiedConverter(String converterType) { - JavaConverter javaConverter = super.buildSpecifiedConverter(converterType); - if (javaConverter != null) { - return javaConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkJavaConvert(this, this.resourcePersistentAttribute); - } - return null; - } - - @Override - protected String specifiedConverterType(JavaResourcePersistentAttribute jrpa) { - //check @Convert first, this is the order that EclipseLink searches - if (jrpa.getSupportingAnnotation(ConvertAnnotation.ANNOTATION_NAME) != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(jrpa); - } - - - - //************ EclipselinkVersionMapping implementation **************** - - public Mutable getMutable() { - return this.mutable; - } - - - //************ initialization/update **************** - - @Override - public void initialize(JavaResourcePersistentAttribute jrpa) { - super.initialize(jrpa); - this.mutable.initialize(jrpa); - } - - @Override - public void update(JavaResourcePersistentAttribute jrpa) { - super.update(jrpa); - this.mutable.update(jrpa); - } - - - //************ validation **************** - - @Override - public void validate(List<IMessage> messages, CompilationUnit astRoot) { - super.validate(messages, astRoot); - this.mutable.validate(messages, astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMapping.java deleted file mode 100644 index 6f193da06b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMapping.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; - -public class JavaBasicCollectionMapping extends AbstractJavaAttributeMapping<BasicCollectionAnnotation> implements BasicCollectionMapping -{ - - public JavaBasicCollectionMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicCollectionAnnotation.ANNOTATION_NAME; - } - - public Iterator<String> correspondingAnnotationNames() { - return EmptyIterator.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMappingProvider.java deleted file mode 100644 index b2c084cc27..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicCollectionMappingProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation; - -public class JavaBasicCollectionMappingProvider - implements JavaAttributeMappingProvider -{ - - // singleton - private static final JavaBasicCollectionMappingProvider INSTANCE = new JavaBasicCollectionMappingProvider(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaBasicCollectionMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicCollectionAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaBasicCollectionMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMapping.java deleted file mode 100644 index 0fda365086..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMapping.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; - -public class JavaBasicMapMapping extends AbstractJavaAttributeMapping<BasicMapAnnotation> implements BasicMapMapping -{ - - public JavaBasicMapMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicMapAnnotation.ANNOTATION_NAME; - } - - public Iterator<String> correspondingAnnotationNames() { - return EmptyIterator.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMappingProvider.java deleted file mode 100644 index 7c1eadad99..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaBasicMapMappingProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation; - -public class JavaBasicMapMappingProvider - implements JavaAttributeMappingProvider -{ - - // singleton - private static final JavaBasicMapMappingProvider INSTANCE = new JavaBasicMapMappingProvider(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaBasicMapMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicMapAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaBasicMapMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMapping.java deleted file mode 100644 index 8e5d78fcd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMapping.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.TransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation; -import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; - -public class JavaTransformationMapping extends AbstractJavaAttributeMapping<TransformationAnnotation> implements TransformationMapping -{ - - public JavaTransformationMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return TransformationAnnotation.ANNOTATION_NAME; - } - - public Iterator<String> correspondingAnnotationNames() { - return EmptyIterator.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMappingProvider.java deleted file mode 100644 index ea3f9ee390..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaTransformationMappingProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider; -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation; - -public class JavaTransformationMappingProvider - implements JavaAttributeMappingProvider -{ - - // singleton - private static final JavaTransformationMappingProvider INSTANCE = new JavaTransformationMappingProvider(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaTransformationMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return TransformationAnnotation.ANNOTATION_NAME; - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildJavaTransformationMapping(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/ConverterHolder.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/ConverterHolder.java deleted file mode 100644 index b814c8e125..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/ConverterHolder.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.core.context.JpaContextNode; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; - -public interface ConverterHolder extends JpaContextNode -{ - //************ customConverters ********************* - - /** - * Return a list iterator of the custom converters. - * This will not be null. - */ - <T extends CustomConverter> ListIterator<T> customConverters(); - - /** - * Return the number of custom converters. - */ - int customConvertersSize(); - - /** - * Add a custom converter to the converter holder, return the object representing it. - */ - CustomConverter addCustomConverter(int index); - - /** - * Remove the custom converter at the index from the converter holder. - */ - void removeCustomConverter(int index); - - /** - * Remove the custom converter at from the converter holder. - */ - void removeCustomConverter(CustomConverter converter); - - /** - * Move the custom converter from the source index to the target index. - */ - void moveCustomConverter(int targetIndex, int sourceIndex); - - String CUSTOM_CONVERTERS_LIST = "customConvertersList"; //$NON-NLS-1$ - - - //************ object type converters ********************* - - /** - * Return a list iterator of the object type converters. - * This will not be null. - */ - <T extends ObjectTypeConverter> ListIterator<T> objectTypeConverters(); - - /** - * Return the number of object type converters. - */ - int objectTypeConvertersSize(); - - /** - * Add a object type converter to the converter holder, return the object representing it. - */ - ObjectTypeConverter addObjectTypeConverter(int index); - - /** - * Remove the object type converter at the index from the converter holder. - */ - void removeObjectTypeConverter(int index); - - /** - * Remove the object type converter at from the converter holder. - */ - void removeObjectTypeConverter(ObjectTypeConverter converter); - - /** - * Move the object type converter from the source index to the target index. - */ - void moveObjectTypeConverter(int targetIndex, int sourceIndex); - - String OBJECT_TYPE_CONVERTERS_LIST = "objectTypeConvertersList"; //$NON-NLS-1$ - - - //************ struct converters ********************* - - /** - * Return a list iterator of the struct converters. - * This will not be null. - */ - <T extends StructConverter> ListIterator<T> structConverters(); - - /** - * Return the number of struct converters. - */ - int structConvertersSize(); - - /** - * Add a struct converter to the converter holder, return the object representing it. - */ - StructConverter addStructConverter(int index); - - /** - * Remove the struct converter at the index from the converter holder. - */ - void removeStructConverter(int index); - - /** - * Remove the struct converter at from the converter holder. - */ - void removeStructConverter(StructConverter converter); - - /** - * Move the struct converter from the source index to the target index. - */ - void moveStructConverter(int targetIndex, int sourceIndex); - - String STRUCT_CONVERTERS_LIST = "structConvertersList"; //$NON-NLS-1$ - - - //************ type converters ********************* - - /** - * Return a list iterator of the type converters. - * This will not be null. - */ - <T extends TypeConverter> ListIterator<T> typeConverters(); - - /** - * Return the number of type converters. - */ - int typeConvertersSize(); - - /** - * Add a type converter to the converter holder, return the object representing it. - */ - TypeConverter addTypeConverter(int index); - - /** - * Remove the type converter at the index from the converter holder. - */ - void removeTypeConverter(int index); - - /** - * Remove the type converter at from the converter holder. - */ - void removeTypeConverter(TypeConverter converter); - - /** - * Move the type converter from the source index to the target index. - */ - void moveTypeConverter(int targetIndex, int sourceIndex); - - String TYPE_CONVERTERS_LIST = "typeConvertersList"; //$NON-NLS-1$ - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappings.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappings.java deleted file mode 100644 index bbec02a44a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappings.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.EntityMappings; - -public interface EclipseLinkEntityMappings - extends EntityMappings -{ - - ConverterHolder getConverterHolder(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java deleted file mode 100644 index 90cb72e86f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmStructureNodes; -import org.eclipse.jpt.core.internal.context.orm.GenericEntityMappings; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkEntityMappingsImpl - extends GenericEntityMappings - implements EclipseLinkEntityMappings -{ - - protected final EclipseLinkOrmConverterHolder converterHolder; - - public EclipseLinkEntityMappingsImpl(EclipseLinkOrmXml parent, XmlEntityMappings xmlEntityMappings) { - super(parent, xmlEntityMappings); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); - this.converterHolder.initialize(xmlEntityMappings); - } - - - // **************** JpaNode impl ******************************************* - - @Override - public EclipseLinkOrmXml getParent() { - return (EclipseLinkOrmXml) super.getParent(); - } - - // **************** JpaStructureNode impl ********************************** - - @Override - public String getId() { - return OrmStructureNodes.ENTITY_MAPPINGS_ID; - } - - - // **************** EclipseLinkEntityMappings impl ********************************** - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - @Override - public void update() { - super.update(); - this.converterHolder.update((XmlEntityMappings) this.xmlEntityMappings); - } - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.converterHolder.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMapping.java deleted file mode 100644 index 82bf185cbe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmBasicMapping.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmBasicMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmBasicMapping extends GenericOrmBasicMapping - implements EclipseLinkBasicMapping -{ - protected EclipseLinkOrmMutable mutable; - - - public EclipseLinkOrmBasicMapping(OrmPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkOrmMutable(this); - } - - - public Mutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkOrmConvert(this, (XmlBasic) this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String specifiedConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlBasic) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(); - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlBasic addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlBasic basic = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicImpl(); - getPersistentAttribute().initialize(basic); - typeMapping.getAttributes().getBasics().add(basic); - return basic; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.mutable.initialize((XmlMutable) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCaching.java deleted file mode 100644 index 2ddb5884c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCaching.java +++ /dev/null @@ -1,652 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.CacheType; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExistenceType; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCache; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTimeOfDay; - -public class EclipseLinkOrmCaching extends AbstractXmlContextNode - implements Caching -{ - protected XmlCacheHolder resource; - - protected int defaultSize; - protected Integer specifiedSize; - - protected boolean defaultShared; - protected Boolean specifiedShared; - - protected CacheType defaultType; - protected CacheType specifiedType; - - protected boolean defaultAlwaysRefresh; - protected Boolean specifiedAlwaysRefresh; - - protected boolean defaultRefreshOnlyIfNewer; - protected Boolean specifiedRefreshOnlyIfNewer; - - protected boolean defaultDisableHits; - protected Boolean specifiedDisableHits; - - protected CacheCoordinationType defaultCoordinationType; - protected CacheCoordinationType specifiedCoordinationType; - - protected ExistenceType specifiedExistenceType; - protected ExistenceType defaultExistenceType; - - protected Integer expiry; - protected EclipseLinkOrmExpiryTimeOfDay expiryTimeOfDay; - - public EclipseLinkOrmCaching(OrmTypeMapping parent) { - super(parent); - } - - public int getSize() { - return (this.specifiedSize == null) ? this.defaultSize : this.specifiedSize.intValue(); - } - - public int getDefaultSize() { - return this.defaultSize; - } - - protected void setDefaultSize(int newSize) { - int oldSize = this.defaultSize; - this.defaultSize = newSize; - firePropertyChanged(DEFAULT_SIZE_PROPERTY, oldSize, newSize); - } - - public Integer getSpecifiedSize() { - return this.specifiedSize; - } - - public void setSpecifiedSize(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - if (oldSpecifiedSize != newSpecifiedSize) { - if (this.getResourceCache() != null) { - this.getResourceCache().setSize(newSpecifiedSize); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedSize != null) { - addResourceCache(); - getResourceCache().setSize(newSpecifiedSize); - } - } - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - protected void setSpecifiedSize_(Integer newSpecifiedSize) { - Integer oldSpecifiedSize = this.specifiedSize; - this.specifiedSize = newSpecifiedSize; - firePropertyChanged(SPECIFIED_SIZE_PROPERTY, oldSpecifiedSize, newSpecifiedSize); - } - - - public boolean isShared() { - return (this.specifiedShared == null) ? this.defaultShared : this.specifiedShared.booleanValue(); - } - - public boolean isDefaultShared() { - return this.defaultShared; - } - - protected void setDefaultShared(boolean newDefaultShared) { - boolean oldDefaultShared = this.defaultShared; - this.defaultShared = newDefaultShared; - firePropertyChanged(DEFAULT_SHARED_PROPERTY, oldDefaultShared, newDefaultShared); - } - - public Boolean getSpecifiedShared() { - return this.specifiedShared; - } - - public void setSpecifiedShared(Boolean newSpecifiedShared) { - Boolean oldSpecifiedShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - if (oldSpecifiedShared != newSpecifiedShared) { - if (this.getResourceCache() != null) { - this.getResourceCache().setShared(newSpecifiedShared); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedShared != null) { - addResourceCache(); - getResourceCache().setShared(newSpecifiedShared); - } - } - firePropertyChanged(SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - protected void setSpecifiedShared_(Boolean newSpecifiedShared) { - Boolean oldSpecifiedShared = this.specifiedShared; - this.specifiedShared = newSpecifiedShared; - firePropertyChanged(SPECIFIED_SHARED_PROPERTY, oldSpecifiedShared, newSpecifiedShared); - } - - - public boolean isAlwaysRefresh() { - return (this.specifiedAlwaysRefresh == null) ? this.defaultAlwaysRefresh : this.specifiedAlwaysRefresh.booleanValue(); - } - - public boolean isDefaultAlwaysRefresh() { - return this.defaultAlwaysRefresh; - } - - protected void setDefaultAlwaysRefresh(boolean newDefaultAlwaysRefresh) { - boolean oldDefaultAlwaysRefresh = this.defaultAlwaysRefresh; - this.defaultAlwaysRefresh = newDefaultAlwaysRefresh; - firePropertyChanged(DEFAULT_ALWAYS_REFRESH_PROPERTY, oldDefaultAlwaysRefresh, newDefaultAlwaysRefresh); - } - - public Boolean getSpecifiedAlwaysRefresh() { - return this.specifiedAlwaysRefresh; - } - - public void setSpecifiedAlwaysRefresh(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldSpecifiedAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - if (oldSpecifiedAlwaysRefresh != newSpecifiedAlwaysRefresh) { - if (this.getResourceCache() != null) { - this.getResourceCache().setAlwaysRefresh(newSpecifiedAlwaysRefresh); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedAlwaysRefresh != null) { - addResourceCache(); - getResourceCache().setAlwaysRefresh(newSpecifiedAlwaysRefresh); - } - } - firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldSpecifiedAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - protected void setSpecifiedAlwaysRefresh_(Boolean newSpecifiedAlwaysRefresh) { - Boolean oldSpecifiedAlwaysRefresh = this.specifiedAlwaysRefresh; - this.specifiedAlwaysRefresh = newSpecifiedAlwaysRefresh; - firePropertyChanged(SPECIFIED_ALWAYS_REFRESH_PROPERTY, oldSpecifiedAlwaysRefresh, newSpecifiedAlwaysRefresh); - } - - - public boolean isRefreshOnlyIfNewer() { - return (this.specifiedRefreshOnlyIfNewer == null) ? this.defaultRefreshOnlyIfNewer : this.specifiedRefreshOnlyIfNewer.booleanValue(); - } - - public boolean isDefaultRefreshOnlyIfNewer() { - return this.defaultRefreshOnlyIfNewer; - } - - protected void setDefaultRefreshOnlyIfNewer(boolean newDefaultRefreshOnlyIfNewer) { - boolean oldDefaultRefreshOnlyIfNewer = this.defaultRefreshOnlyIfNewer; - this.defaultRefreshOnlyIfNewer = newDefaultRefreshOnlyIfNewer; - firePropertyChanged(DEFAULT_REFRESH_ONLY_IF_NEWER_PROPERTY, oldDefaultRefreshOnlyIfNewer, newDefaultRefreshOnlyIfNewer); - } - - public Boolean getSpecifiedRefreshOnlyIfNewer() { - return this.specifiedRefreshOnlyIfNewer; - } - - public void setSpecifiedRefreshOnlyIfNewer(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldSpecifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - if (oldSpecifiedRefreshOnlyIfNewer != newSpecifiedRefreshOnlyIfNewer) { - if (this.getResourceCache() != null) { - this.getResourceCache().setRefreshOnlyIfNewer(newSpecifiedRefreshOnlyIfNewer); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedRefreshOnlyIfNewer != null) { - addResourceCache(); - getResourceCache().setRefreshOnlyIfNewer(newSpecifiedRefreshOnlyIfNewer); - } - } - firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldSpecifiedRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - protected void setSpecifiedRefreshOnlyIfNewer_(Boolean newSpecifiedRefreshOnlyIfNewer) { - Boolean oldSpecifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer; - this.specifiedRefreshOnlyIfNewer = newSpecifiedRefreshOnlyIfNewer; - firePropertyChanged(SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY, oldSpecifiedRefreshOnlyIfNewer, newSpecifiedRefreshOnlyIfNewer); - } - - - public boolean isDisableHits() { - return (this.specifiedDisableHits == null) ? this.defaultDisableHits : this.specifiedDisableHits.booleanValue(); - } - - public boolean isDefaultDisableHits() { - return this.defaultDisableHits; - } - - protected void setDefaultDisableHits(boolean newDefaultDisableHits) { - boolean oldDefaultDisableHits = this.defaultDisableHits; - this.defaultDisableHits = newDefaultDisableHits; - firePropertyChanged(DEFAULT_DISABLE_HITS_PROPERTY, oldDefaultDisableHits, newDefaultDisableHits); - } - - public Boolean getSpecifiedDisableHits() { - return this.specifiedDisableHits; - } - - public void setSpecifiedDisableHits(Boolean newSpecifiedDisableHits) { - Boolean oldSpecifiedDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - if (oldSpecifiedDisableHits != newSpecifiedDisableHits) { - if (this.getResourceCache() != null) { - this.getResourceCache().setDisableHits(newSpecifiedDisableHits); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedDisableHits != null) { - addResourceCache(); - getResourceCache().setDisableHits(newSpecifiedDisableHits); - } - } - firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, oldSpecifiedDisableHits, newSpecifiedDisableHits); - } - - protected void setSpecifiedDisableHits_(Boolean newSpecifiedDisableHits) { - Boolean oldSpecifiedDisableHits = this.specifiedDisableHits; - this.specifiedDisableHits = newSpecifiedDisableHits; - firePropertyChanged(SPECIFIED_DISABLE_HITS_PROPERTY, oldSpecifiedDisableHits, newSpecifiedDisableHits); - } - - public CacheType getType() { - return (this.specifiedType == null) ? this.defaultType : this.specifiedType; - } - - public CacheType getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType(CacheType newDefaultType) { - CacheType oldDefaultType= this.defaultType; - this.defaultType = newDefaultType; - firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, newDefaultType); - } - - public CacheType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(CacheType newSpecifiedType) { - CacheType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - if (oldSpecifiedType != newSpecifiedType) { - if (this.getResourceCache() != null) { - this.getResourceCache().setType(CacheType.toOrmResourceModel(newSpecifiedType)); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedType != null) { - addResourceCache(); - getResourceCache().setType(CacheType.toOrmResourceModel(newSpecifiedType)); - } - } - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - protected void setSpecifiedType_(CacheType newSpecifiedType) { - CacheType oldSpecifiedType= this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - - public CacheCoordinationType getCoordinationType() { - return (this.specifiedCoordinationType == null) ? this.defaultCoordinationType : this.specifiedCoordinationType; - } - - public CacheCoordinationType getDefaultCoordinationType() { - return this.defaultCoordinationType; - } - - protected void setDefaultCoordinationType(CacheCoordinationType newDefaultcCoordinationType) { - CacheCoordinationType oldDefaultcCoordinationType= this.defaultCoordinationType; - this.defaultCoordinationType = newDefaultcCoordinationType; - firePropertyChanged(DEFAULT_COORDINATION_TYPE_PROPERTY, oldDefaultcCoordinationType, newDefaultcCoordinationType); - } - - public CacheCoordinationType getSpecifiedCoordinationType() { - return this.specifiedCoordinationType; - } - - public void setSpecifiedCoordinationType(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - if (oldSpecifiedCoordinationType != newSpecifiedCoordinationType) { - if (this.getResourceCache() != null) { - this.getResourceCache().setCoordinationType(CacheCoordinationType.toOrmResourceModel(newSpecifiedCoordinationType)); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newSpecifiedCoordinationType != null) { - addResourceCache(); - getResourceCache().setCoordinationType(CacheCoordinationType.toOrmResourceModel(newSpecifiedCoordinationType)); - } - } - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - protected void setSpecifiedCoordinationType_(CacheCoordinationType newSpecifiedCoordinationType) { - CacheCoordinationType oldSpecifiedCoordinationType = this.specifiedCoordinationType; - this.specifiedCoordinationType = newSpecifiedCoordinationType; - firePropertyChanged(SPECIFIED_COORDINATION_TYPE_PROPERTY, oldSpecifiedCoordinationType, newSpecifiedCoordinationType); - } - - public ExistenceType getExistenceType() { - return (this.specifiedExistenceType == null) ? this.defaultExistenceType : this.specifiedExistenceType; - } - - public ExistenceType getDefaultExistenceType() { - return this.defaultExistenceType; - } - - protected void setDefaultExistenceType(ExistenceType newDefaultExistenceType) { - ExistenceType oldDefaultExistenceType = this.defaultExistenceType; - this.defaultExistenceType = newDefaultExistenceType; - firePropertyChanged(DEFAULT_EXISTENCE_TYPE_PROPERTY, oldDefaultExistenceType, newDefaultExistenceType); - } - - public ExistenceType getSpecifiedExistenceType() { - return this.specifiedExistenceType; - } - - public void setSpecifiedExistenceType(ExistenceType newSpecifiedExistenceType) { - ExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - this.resource.setExistenceChecking(ExistenceType.toOrmResourceModel(newSpecifiedExistenceType)); - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - protected void setSpecifiedExistenceType_(ExistenceType newSpecifiedExistenceType) { - ExistenceType oldSpecifiedExistenceType = this.specifiedExistenceType; - this.specifiedExistenceType = newSpecifiedExistenceType; - firePropertyChanged(SPECIFIED_EXISTENCE_TYPE_PROPERTY, oldSpecifiedExistenceType, newSpecifiedExistenceType); - } - - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - if (oldExpiry != newExpiry) { - if (this.getResourceCache() != null) { - this.getResourceCache().setExpiry(newExpiry); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - } - else if (newExpiry != null) { - addResourceCache(); - this.getResourceCache().setExpiry(newExpiry); - } - } - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - protected void setExpiry_(Integer newExpiry) { - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - public ExpiryTimeOfDay getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public ExpiryTimeOfDay addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("expiryTimeOfDay already exists, use getExpiryTimeOfDay()"); //$NON-NLS-1$ - } - if (getResourceCache() == null) { - addResourceCache(); - } - EclipseLinkOrmExpiryTimeOfDay newExpiryTimeOfDay = new EclipseLinkOrmExpiryTimeOfDay(this); - this.expiryTimeOfDay = newExpiryTimeOfDay; - XmlTimeOfDay resourceTimeOfDay = EclipseLinkOrmFactory.eINSTANCE.createXmlTimeOfDay(); - newExpiryTimeOfDay.initialize(resourceTimeOfDay); - getResourceCache().setExpiryTimeOfDay(resourceTimeOfDay); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, null, newExpiryTimeOfDay); - setExpiry(null); - return newExpiryTimeOfDay; - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("timeOfDayExpiry does not exist"); //$NON-NLS-1$ - } - ExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = null; - getResourceCache().setExpiryTimeOfDay(null); - if (this.getResourceCache().isAllFeaturesUnset()) { - removeResourceCache(); - } - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, null); - } - - protected void setExpiryTimeOfDay(EclipseLinkOrmExpiryTimeOfDay newExpiryTimeOfDay) { - EclipseLinkOrmExpiryTimeOfDay oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = newExpiryTimeOfDay; - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, newExpiryTimeOfDay); - } - - protected XmlCache getResourceCache() { - return this.resource.getCache(); - } - - protected void addResourceCache() { - this.resource.setCache(EclipseLinkOrmFactory.eINSTANCE.createXmlCache()); - } - - protected void removeResourceCache() { - this.resource.setCache(null); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlCacheHolder resource, JavaCaching javaCaching) { - this.resource = resource; - XmlCache resourceCache = getResourceCache(); - this.defaultSize = this.defaultSize(javaCaching); - this.specifiedSize = specifiedSize(resourceCache); - this.defaultShared = this.defaultShared(javaCaching); - this.specifiedShared = this.specifiedShared(resourceCache); - this.defaultAlwaysRefresh = this.defaultAlwaysRefresh(javaCaching); - this.specifiedAlwaysRefresh = this.specifiedAlwaysRefresh(resourceCache); - this.defaultRefreshOnlyIfNewer = this.defaultRefreshOnlyIfNewer(javaCaching); - this.specifiedRefreshOnlyIfNewer = this.specifiedRefreshOnlyIfNewer(resourceCache); - this.defaultDisableHits = this.defaultDisableHits(javaCaching); - this.specifiedDisableHits = this.specifiedDisableHits(resourceCache); - this.defaultType = this.defaultType(javaCaching); - this.specifiedType = this.specifiedType(resourceCache); - this.defaultCoordinationType = this.defaultCoordinationType(javaCaching); - this.specifiedCoordinationType = this.specifiedCoordinationType(resourceCache); - this.defaultExistenceType = this.defaultExistenceType(javaCaching); - this.specifiedExistenceType = this.specifiedExistenceType(resource); - this.initializeExpiry(resourceCache); - } - - protected void initializeExpiry(XmlCache resourceCache) { - if (resourceCache == null) { - return; - } - if (resourceCache.getExpiryTimeOfDay() == null) { - this.expiry = resourceCache.getExpiry(); - } - else { - if (resourceCache.getExpiry() == null) { //handle with validation if both expiry and expiryTimeOfDay are set - this.expiryTimeOfDay = new EclipseLinkOrmExpiryTimeOfDay(this); - this.expiryTimeOfDay.initialize(resourceCache.getExpiryTimeOfDay()); - } - } - } - - protected void update(XmlCacheHolder resource, JavaCaching javaCaching) { - this.resource = resource; - XmlCache resourceCache = getResourceCache(); - setDefaultSize(this.defaultSize(javaCaching)); - setSpecifiedSize_(this.specifiedSize(resourceCache)); - setDefaultShared(this.defaultShared(javaCaching)); - setSpecifiedShared_(this.specifiedShared(resourceCache)); - setDefaultAlwaysRefresh(this.defaultAlwaysRefresh(javaCaching)); - setSpecifiedAlwaysRefresh_(this.specifiedAlwaysRefresh(resourceCache)); - setDefaultRefreshOnlyIfNewer(this.defaultRefreshOnlyIfNewer(javaCaching)); - setSpecifiedRefreshOnlyIfNewer_(this.specifiedRefreshOnlyIfNewer(resourceCache)); - setDefaultDisableHits(this.defaultDisableHits(javaCaching)); - setSpecifiedDisableHits_(this.specifiedDisableHits(resourceCache)); - setDefaultType(this.defaultType(javaCaching)); - setSpecifiedType_(this.specifiedType(resourceCache)); - setDefaultCoordinationType(this.defaultCoordinationType(javaCaching)); - setSpecifiedCoordinationType_(this.specifiedCoordinationType(resourceCache)); - setDefaultExistenceType(this.defaultExistenceType(javaCaching)); - setSpecifiedExistenceType_(this.specifiedExistenceType(resource)); - this.updateExpiry(resourceCache); - } - - protected void updateExpiry(XmlCache resourceCache) { - if (resourceCache == null) { - setExpiryTimeOfDay(null); - setExpiry_(null); - return; - } - if (resourceCache.getExpiryTimeOfDay() == null) { - setExpiryTimeOfDay(null); - setExpiry_(resourceCache.getExpiry()); - } - else { - if (this.expiryTimeOfDay != null) { - this.expiryTimeOfDay.update(resourceCache.getExpiryTimeOfDay()); - } - else if (resourceCache.getExpiry() == null){ - setExpiryTimeOfDay(new EclipseLinkOrmExpiryTimeOfDay(this)); - this.expiryTimeOfDay.initialize(resourceCache.getExpiryTimeOfDay()); - } - else { //handle with validation if both expiry and expiryTimeOfDay are set - setExpiryTimeOfDay(null); - } - } - } - - protected int defaultSize(JavaCaching javaCaching) { - return (javaCaching == null) ? DEFAULT_SIZE : javaCaching.getSize(); - } - - protected Integer specifiedSize(XmlCache resource) { - return (resource == null) ? null : resource.getSize(); - } - - protected boolean defaultShared(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_SHARED; - } - return getResourceCache() == null ? javaCaching.isShared() : DEFAULT_SHARED; - } - - protected Boolean specifiedShared(XmlCache resource) { - return (resource == null) ? null : resource.getShared(); - } - - protected boolean defaultAlwaysRefresh(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_ALWAYS_REFRESH; - } - return getResourceCache() == null ? javaCaching.isAlwaysRefresh() : DEFAULT_ALWAYS_REFRESH; - } - - protected Boolean specifiedAlwaysRefresh(XmlCache resource) { - return (resource == null) ? null : resource.getAlwaysRefresh(); - } - - protected boolean defaultRefreshOnlyIfNewer(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_REFRESH_ONLY_IF_NEWER; - } - return getResourceCache() == null ? javaCaching.isRefreshOnlyIfNewer() : DEFAULT_REFRESH_ONLY_IF_NEWER; - } - - protected Boolean specifiedRefreshOnlyIfNewer(XmlCache resource) { - return (resource == null) ? null : resource.getRefreshOnlyIfNewer(); - } - - protected boolean defaultDisableHits(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_DISABLE_HITS; - } - return getResourceCache() == null ? javaCaching.isDisableHits() : DEFAULT_DISABLE_HITS; - } - - protected Boolean specifiedDisableHits(XmlCache resource) { - return (resource == null) ? null : resource.getDisableHits(); - } - - protected CacheType defaultType(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_TYPE; - } - return getResourceCache() == null ? javaCaching.getType() : DEFAULT_TYPE; - } - - protected CacheType specifiedType(XmlCache resource) { - return (resource == null) ? null : CacheType.fromOrmResourceModel(resource.getType()); - } - - protected CacheCoordinationType defaultCoordinationType(JavaCaching javaCaching) { - if (javaCaching == null) { - return DEFAULT_COORDINATION_TYPE; - } - return getResourceCache() == null ? javaCaching.getCoordinationType() : DEFAULT_COORDINATION_TYPE; - } - - protected CacheCoordinationType specifiedCoordinationType(XmlCache resource) { - return (resource == null) ? null : CacheCoordinationType.fromOrmResourceModel(resource.getCoordinationType()); - } - - protected ExistenceType defaultExistenceType(JavaCaching javaCaching) { - return (javaCaching == null) ? DEFAULT_EXISTENCE_TYPE : javaCaching.getExistenceType(); - } - - protected ExistenceType specifiedExistenceType(XmlCacheHolder resource) { - return (resource == null) ? null : ExistenceType.fromOrmResourceModel(resource.getExistenceChecking()); - } - - protected Integer expiry(XmlCache resource) { - return (resource == null) ? null : resource.getExpiry(); - } - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - XmlCache resource = getResourceCache(); - return resource == null ? null : resource.getValidationTextRange(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmChangeTracking.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmChangeTracking.java deleted file mode 100644 index fe7d564d88..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmChangeTracking.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTracking; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; - -public class EclipseLinkOrmChangeTracking extends AbstractXmlContextNode - implements ChangeTracking -{ - protected XmlChangeTrackingHolder resource; - - protected ChangeTrackingType defaultType; - - protected ChangeTrackingType specifiedType; - - - public EclipseLinkOrmChangeTracking(OrmTypeMapping parent) { - super(parent); - } - - - public ChangeTrackingType getType() { - return (getSpecifiedType() != null) ? getSpecifiedType() : getDefaultType(); - } - - public ChangeTrackingType getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType_(ChangeTrackingType newDefaultType) { - ChangeTrackingType oldDefaultType = this.defaultType; - this.defaultType = newDefaultType; - firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, newDefaultType); - } - - public ChangeTrackingType getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(ChangeTrackingType newSpecifiedType) { - ChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - - if (newSpecifiedType == null) { - this.resource.setChangeTracking(null); - } - else { - if (this.resource.getChangeTracking() == null) { - this.resource.setChangeTracking(EclipseLinkOrmFactory.eINSTANCE.createXmlChangeTracking()); - } - this.resource.getChangeTracking().setType(ChangeTrackingType.toOrmResourceModel(newSpecifiedType)); - } - - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - protected void setSpecifiedType_(ChangeTrackingType newSpecifiedType) { - ChangeTrackingType oldSpecifiedType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldSpecifiedType, newSpecifiedType); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlChangeTrackingHolder xmlChangeTrackingHolder, ChangeTracking javaChangeTracking) { - this.resource = xmlChangeTrackingHolder; - this.defaultType = calculateDefaultType(javaChangeTracking); - this.specifiedType = calculateSpecifiedType(xmlChangeTrackingHolder); - } - - protected void update(XmlChangeTrackingHolder xmlChangeTrackingHolder, ChangeTracking javaChangeTracking) { - setDefaultType_(calculateDefaultType(javaChangeTracking)); - setSpecifiedType_(calculateSpecifiedType(xmlChangeTrackingHolder)); - } - - protected ChangeTrackingType calculateDefaultType(ChangeTracking javaChangeTracking) { - return (javaChangeTracking != null) ? javaChangeTracking.getType() : ChangeTracking.DEFAULT_TYPE; - } - - protected ChangeTrackingType calculateSpecifiedType(XmlChangeTrackingHolder xmlChangeTrackingHolder) { - XmlChangeTracking xmlChangeTracking = xmlChangeTrackingHolder.getChangeTracking(); - return (xmlChangeTracking != null) ? ChangeTrackingType.fromOrmResourceModel(xmlChangeTracking.getType()) : null; - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java deleted file mode 100644 index d12cc740d9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConversionValue.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmConversionValue extends AbstractXmlContextNode implements ConversionValue -{ - private XmlConversionValue resourceConversionValue; - - private String dataValue; - - private String objectValue; - - public EclipseLinkOrmConversionValue(EclipseLinkOrmObjectTypeConverter parent) { - super(parent); - } - - @Override - public EclipseLinkOrmObjectTypeConverter getParent() { - return (EclipseLinkOrmObjectTypeConverter) super.getParent(); - } - - public TextRange getValidationTextRange() { - return this.resourceConversionValue.getValidationTextRange(); - } - - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - this.resourceConversionValue.setDataValue(newDataValue); - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - protected void setDataValue_(String newDataValue) { - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - this.resourceConversionValue.setObjectValue(newObjectValue); - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - protected void setObjectValue_(String newObjectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - public void initialize(XmlConversionValue resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.dataValue = this.dataValue(); - this.objectValue = this.objectValue(); - } - - public void update(XmlConversionValue resourceConversionValue) { - this.resourceConversionValue = resourceConversionValue; - this.setDataValue_(this.dataValue()); - this.setObjectValue_(this.objectValue()); - } - - protected String dataValue() { - return this.resourceConversionValue.getDataValue(); - } - - protected String objectValue() { - return this.resourceConversionValue.getObjectValue(); - } - - public TextRange getDataValueTextRange() { - return this.resourceConversionValue.getDataValueTextRange(); - } - - public TextRange getObjectValueTextRange() { - return this.resourceConversionValue.getObjectValueTextRange(); - } - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - validateDataValuesUnique(messages); - } - - protected void validateDataValuesUnique(List<IMessage> messages) { - List<String> dataValues = CollectionTools.list(getParent().dataValues()); - dataValues.remove(this.dataValue); - if (dataValues.contains(this.dataValue)) { - messages.add( - DefaultEclipseLinkJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - EclipseLinkJpaValidationMessages.MULTIPLE_OBJECT_VALUES_FOR_DATA_VALUE, - new String[] {this.dataValue}, - this, - this.getDataValueTextRange() - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java deleted file mode 100644 index adce47c718..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConvert.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.resource.common.JpaEObject; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertibleMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmConvert extends AbstractXmlContextNode implements Convert, OrmConverter -{ - protected String specifiedConverterName; - - protected XmlConvertibleMapping resourceMapping; - - protected EclipseLinkOrmConverter converter; - - public EclipseLinkOrmConvert(OrmAttributeMapping parent, XmlConvertibleMapping resourceMapping) { - super(parent); - this.initialize(resourceMapping); - } - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - public String getType() { - return Convert.ECLIPSE_LINK_CONVERTER; - } - - public void addToResourceModel() { - this.resourceMapping.setConvert(""); //$NON-NLS-1$ - } - - public void removeFromResourceModel() { - this.resourceMapping.setConvert(null); - } - - public TextRange getValidationTextRange() { - return this.resourceMapping.getConvertTextRange(); - } - - public String getConverterName() { - return getSpecifiedConverterName() == null ? getDefaultConverterName() : getSpecifiedConverterName(); - } - - public String getDefaultConverterName() { - return DEFAULT_CONVERTER_NAME; - } - - public String getSpecifiedConverterName() { - return this.specifiedConverterName; - } - - public void setSpecifiedConverterName(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - this.resourceMapping.setConvert(newSpecifiedConverterName); - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - protected void setSpecifiedConverterName_(String newSpecifiedConverterName) { - String oldSpecifiedConverterName = this.specifiedConverterName; - this.specifiedConverterName = newSpecifiedConverterName; - firePropertyChanged(SPECIFIED_CONVERTER_NAME_PROPERTY, oldSpecifiedConverterName, newSpecifiedConverterName); - } - - public EclipseLinkOrmConverter getConverter() { - return this.converter; - } - - protected String getConverterType() { - if (this.converter == null) { - return EclipseLinkConverter.NO_CONVERTER; - } - return this.converter.getType(); - } - - public void setConverter(String converterType) { - if (getConverterType() == converterType) { - return; - } - EclipseLinkOrmConverter oldConverter = this.converter; - if (oldConverter != null) { - this.converter = null; //set to null now to avoid update triggering events - removeConverter(oldConverter.getType()); - } - JpaEObject resourceConverter = buildResourceConverter(converterType); - EclipseLinkOrmConverter newConverter = buildConverter(converterType, resourceConverter); - this.converter = newConverter; - if (newConverter != null) { - addConverter(converterType, resourceConverter); - } - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - //TODO yes, i know, many if/else type checks in the methods below. - //will look at factoring this out when I have time after M3! Also EclipseLinkJavaConvert - protected void removeConverter(String converterType) { - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - this.resourceMapping.setConverter(null); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - this.resourceMapping.setTypeConverter(null); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - this.resourceMapping.setObjectTypeConverter(null); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - this.resourceMapping.setStructConverter(null); - } - } - - protected JpaEObject buildResourceConverter(String converterType) { - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConverterImpl(); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverterImpl(); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverterImpl(); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverterImpl(); - } - return null; - } - - protected void addConverter(String converterType, JpaEObject resourceConverter) { - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - this.resourceMapping.setConverter((XmlConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - this.resourceMapping.setTypeConverter((XmlTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - this.resourceMapping.setObjectTypeConverter((XmlObjectTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - this.resourceMapping.setStructConverter((XmlStructConverter) resourceConverter); - } - } - - protected EclipseLinkOrmConverter buildConverter(String converterType, JpaEObject resourceConverter) { - if (converterType == EclipseLinkConverter.NO_CONVERTER) { - return null; - } - if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkOrmCustomConverter(this, (XmlConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkOrmTypeConverter(this, (XmlTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkOrmObjectTypeConverter(this, (XmlObjectTypeConverter) resourceConverter); - } - else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkOrmStructConverter(this, (XmlStructConverter) resourceConverter); - } - return null; - } - - protected void setConverter(EclipseLinkOrmConverter newConverter) { - EclipseLinkOrmConverter oldConverter = this.converter; - this.converter = newConverter; - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - protected void initialize(XmlConvertibleMapping resourceMapping) { - this.resourceMapping = resourceMapping; - this.specifiedConverterName = this.specifiedConverterName(); - this.converter = this.buildConverter(); - } - - public void update() { - this.setSpecifiedConverterName_(this.specifiedConverterName()); - if (converterType() == getConverterType()) { - this.converter.update(); - } - else { - setConverter(buildConverter()); - } - } - - protected String specifiedConverterName() { - return this.resourceMapping == null ? null : this.resourceMapping.getConvert(); - } - - protected String converterType() { - if (this.resourceMapping.getConverter() != null) { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - else if (this.resourceMapping.getTypeConverter() != null) { - return EclipseLinkConverter.TYPE_CONVERTER; - } - else if (this.resourceMapping.getObjectTypeConverter() != null) { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - else if (this.resourceMapping.getStructConverter() != null) { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - return null; - } - protected EclipseLinkOrmConverter buildConverter() { - if (this.resourceMapping.getConverter() != null) { - return new EclipseLinkOrmCustomConverter(this, this.resourceMapping.getConverter()); - } - else if (this.resourceMapping.getTypeConverter() != null) { - return new EclipseLinkOrmTypeConverter(this, this.resourceMapping.getTypeConverter()); - } - else if (this.resourceMapping.getObjectTypeConverter() != null) { - return new EclipseLinkOrmObjectTypeConverter(this, this.resourceMapping.getObjectTypeConverter()); - } - else if (this.resourceMapping.getStructConverter() != null) { - return new EclipseLinkOrmStructConverter(this, this.resourceMapping.getStructConverter()); - } - - return null; - } - - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - if (getConverter() != null) { - getConverter().validate(messages); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java deleted file mode 100644 index 1405c7fe75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverter.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlNamedConverter; -import org.eclipse.jpt.utility.internal.StringTools; - -public abstract class EclipseLinkOrmConverter - extends AbstractXmlContextNode implements EclipseLinkConverter -{ - private XmlNamedConverter xmlResource; - - private String name; - - - public EclipseLinkOrmConverter(XmlContextNode parent, XmlNamedConverter xmlResource) { - super(parent); - initialize(xmlResource); - } - - - protected XmlNamedConverter getXmlResource() { - return this.xmlResource; - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - - // **************** name *************************************************** - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - getXmlResource().setName(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - protected void setName_(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - - // **************** resource interaction *********************************** - - protected void initialize(XmlNamedConverter resource) { - this.xmlResource = resource; - this.name = calculateName(); - getPersistenceUnit().addConverter(this); - } - - public void update() { - this.setName_(calculateName()); - getPersistenceUnit().addConverter(this); - } - - protected String calculateName() { - return getXmlResource().getName(); - } - - - // **************** validation ********************************************* - - public boolean overrides(EclipseLinkConverter converter) { - if (getName() == null) { - return false; - } - // this isn't ideal, but it will have to do until we have further adopter input - return this.getName().equals(converter.getName()) && converter instanceof EclipseLinkJavaConverter; - } - - public boolean duplicates(EclipseLinkConverter converter) { - return (this != converter) - && ! StringTools.stringIsEmpty(this.name) - && this.name.equals(converter.getName()) - && ! this.overrides(converter) - && ! converter.overrides(this); - } - - public TextRange getValidationTextRange() { - return getXmlResource().getValidationTextRange(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterHolder.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterHolder.java deleted file mode 100644 index 4fd428e2b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmConverterHolder.java +++ /dev/null @@ -1,430 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmConverterHolder extends AbstractXmlContextNode implements ConverterHolder -{ - private XmlConvertersHolder resourceConvertersHolder; - - protected final List<EclipseLinkOrmCustomConverter> customConverters; - protected final List<EclipseLinkOrmObjectTypeConverter> objectTypeConverters; - protected final List<EclipseLinkOrmStructConverter> structConverters; - protected final List<EclipseLinkOrmTypeConverter> typeConverters; - - public EclipseLinkOrmConverterHolder(XmlContextNode parent) { - super(parent); - this.customConverters = new ArrayList<EclipseLinkOrmCustomConverter>(); - this.objectTypeConverters = new ArrayList<EclipseLinkOrmObjectTypeConverter>(); - this.structConverters = new ArrayList<EclipseLinkOrmStructConverter>(); - this.typeConverters = new ArrayList<EclipseLinkOrmTypeConverter>(); - } - - public ListIterator<EclipseLinkOrmCustomConverter> customConverters() { - return this.customConverters.listIterator(); - } - - public int customConvertersSize() { - return this.customConverters.size(); - } - - public CustomConverter addCustomConverter(int index) { - XmlConverter resourceConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlConverterImpl(); - EclipseLinkOrmCustomConverter contextConverter = new EclipseLinkOrmCustomConverter(this, resourceConverter); - this.customConverters.add(index, contextConverter); - this.resourceConvertersHolder.getConverters().add(index, resourceConverter); - this.fireItemAdded(CUSTOM_CONVERTERS_LIST, index, contextConverter); - return contextConverter; - } - - protected void addCustomConverter(int index, EclipseLinkOrmCustomConverter converter) { - addItemToList(index, converter, this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - protected void addCustomConverter(EclipseLinkOrmCustomConverter converter) { - this.addCustomConverter(this.customConverters.size(), converter); - } - - public void removeCustomConverter(int index) { - EclipseLinkOrmCustomConverter removedConverter = this.customConverters.remove(index); - this.resourceConvertersHolder.getConverters().remove(index); - fireItemRemoved(CUSTOM_CONVERTERS_LIST, index, removedConverter); - } - - public void removeCustomConverter(CustomConverter converter) { - this.removeCustomConverter(this.customConverters.indexOf(converter)); - } - - protected void removeConverter_(CustomConverter converter) { - removeItemFromList(converter, this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - public void moveCustomConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.customConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getConverters().move(targetIndex, sourceIndex); - fireItemMoved(CUSTOM_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveCustomConverter_(int index, EclipseLinkOrmCustomConverter converter) { - moveItemInList(index, this.customConverters.indexOf(converter), this.customConverters, CUSTOM_CONVERTERS_LIST); - } - - public ListIterator<EclipseLinkOrmObjectTypeConverter> objectTypeConverters() { - return this.objectTypeConverters.listIterator(); - } - - public int objectTypeConvertersSize() { - return this.objectTypeConverters.size(); - } - - public ObjectTypeConverter addObjectTypeConverter(int index) { - XmlObjectTypeConverter resourceObjectTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverterImpl(); - EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter = new EclipseLinkOrmObjectTypeConverter(this, resourceObjectTypeConverter); - this.objectTypeConverters.add(index, contextObjectTypeConverter); - this.resourceConvertersHolder.getObjectTypeConverters().add(index, resourceObjectTypeConverter); - this.fireItemAdded(OBJECT_TYPE_CONVERTERS_LIST, index, contextObjectTypeConverter); - return contextObjectTypeConverter; - } - - protected void addObjectTypeConverter(int index, EclipseLinkOrmObjectTypeConverter converter) { - addItemToList(index, converter, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - protected void addObjectTypeConverter(EclipseLinkOrmObjectTypeConverter converter) { - this.addObjectTypeConverter(this.objectTypeConverters.size(), converter); - } - - public void removeObjectTypeConverter(int index) { - EclipseLinkOrmObjectTypeConverter removedObjectTypeConverter = this.objectTypeConverters.remove(index); - this.resourceConvertersHolder.getObjectTypeConverters().remove(index); - fireItemRemoved(OBJECT_TYPE_CONVERTERS_LIST, index, removedObjectTypeConverter); - } - - public void removeObjectTypeConverter(ObjectTypeConverter converter) { - this.removeObjectTypeConverter(this.objectTypeConverters.indexOf(converter)); - } - - protected void removeObjectTypeConverter_(ObjectTypeConverter converter) { - removeItemFromList(converter, this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - public void moveObjectTypeConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.objectTypeConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getObjectTypeConverters().move(targetIndex, sourceIndex); - fireItemMoved(OBJECT_TYPE_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveObjectTypeConverter_(int index, EclipseLinkOrmObjectTypeConverter converter) { - moveItemInList(index, this.objectTypeConverters.indexOf(converter), this.objectTypeConverters, OBJECT_TYPE_CONVERTERS_LIST); - } - - public ListIterator<EclipseLinkOrmStructConverter> structConverters() { - return this.structConverters.listIterator(); - } - - public int structConvertersSize() { - return this.structConverters.size(); - } - - public StructConverter addStructConverter(int index) { - XmlStructConverter resourceStructConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverterImpl(); - EclipseLinkOrmStructConverter contextStructConverter = new EclipseLinkOrmStructConverter(this, resourceStructConverter); - this.structConverters.add(index, contextStructConverter); - this.resourceConvertersHolder.getStructConverters().add(index, resourceStructConverter); - this.fireItemAdded(STRUCT_CONVERTERS_LIST, index, contextStructConverter); - return contextStructConverter; - } - - protected void addStructConverter(int index, EclipseLinkOrmStructConverter converter) { - addItemToList(index, converter, this.structConverters, STRUCT_CONVERTERS_LIST); - } - - protected void addStructConverter(EclipseLinkOrmStructConverter converter) { - this.addStructConverter(this.structConverters.size(), converter); - } - - public void removeStructConverter(int index) { - EclipseLinkOrmStructConverter removedStructConverter = this.structConverters.remove(index); - this.resourceConvertersHolder.getStructConverters().remove(index); - fireItemRemoved(STRUCT_CONVERTERS_LIST, index, removedStructConverter); - } - - public void removeStructConverter(StructConverter converter) { - this.removeStructConverter(this.structConverters.indexOf(converter)); - } - - protected void removeStructConverter_(StructConverter converter) { - removeItemFromList(converter, this.structConverters, STRUCT_CONVERTERS_LIST); - } - - public void moveStructConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.structConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getStructConverters().move(targetIndex, sourceIndex); - fireItemMoved(STRUCT_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveStructConverter_(int index, EclipseLinkOrmStructConverter converter) { - moveItemInList(index, this.structConverters.indexOf(converter), this.structConverters, STRUCT_CONVERTERS_LIST); - } - - - public ListIterator<EclipseLinkOrmTypeConverter> typeConverters() { - return this.typeConverters.listIterator(); - } - - public int typeConvertersSize() { - return this.typeConverters.size(); - } - - public TypeConverter addTypeConverter(int index) { - XmlTypeConverter resourceTypeConverter = EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverterImpl(); - EclipseLinkOrmTypeConverter contextTypeConverter = new EclipseLinkOrmTypeConverter(this, resourceTypeConverter); - this.typeConverters.add(index, contextTypeConverter); - this.resourceConvertersHolder.getTypeConverters().add(index, resourceTypeConverter); - this.fireItemAdded(TYPE_CONVERTERS_LIST, index, contextTypeConverter); - return contextTypeConverter; - } - - protected void addTypeConverter(int index, EclipseLinkOrmTypeConverter converter) { - addItemToList(index, converter, this.typeConverters, TYPE_CONVERTERS_LIST); - } - - protected void addTypeConverter(EclipseLinkOrmTypeConverter converter) { - this.addTypeConverter(this.typeConverters.size(), converter); - } - - public void removeTypeConverter(int index) { - EclipseLinkOrmTypeConverter removedTypeConverter = this.typeConverters.remove(index); - this.resourceConvertersHolder.getTypeConverters().remove(index); - fireItemRemoved(TYPE_CONVERTERS_LIST, index, removedTypeConverter); - } - - public void removeTypeConverter(TypeConverter converter) { - this.removeTypeConverter(this.typeConverters.indexOf(converter)); - } - - protected void removeTypeConverter_(TypeConverter converter) { - removeItemFromList(converter, this.typeConverters, TYPE_CONVERTERS_LIST); - } - - public void moveTypeConverter(int targetIndex, int sourceIndex) { - CollectionTools.move(this.typeConverters, targetIndex, sourceIndex); - this.resourceConvertersHolder.getTypeConverters().move(targetIndex, sourceIndex); - fireItemMoved(TYPE_CONVERTERS_LIST, targetIndex, sourceIndex); - } - - protected void moveTypeConverter_(int index, EclipseLinkOrmTypeConverter converter) { - moveItemInList(index, this.typeConverters.indexOf(converter), this.typeConverters, TYPE_CONVERTERS_LIST); - } - - - - public void initialize(XmlConvertersHolder resourceConvertersHolder) { - this.resourceConvertersHolder = resourceConvertersHolder; - this.initializeCustomConverters(); - this.initializeObjectTypeConverters(); - this.initializeStructConverters(); - this.initializeTypeConverters(); - } - - protected void initializeCustomConverters() { - for (XmlConverter resourceConverter : this.resourceConvertersHolder.getConverters()) { - this.customConverters.add(new EclipseLinkOrmCustomConverter(this, resourceConverter)); - } - } - - protected void initializeObjectTypeConverters() { - for (XmlObjectTypeConverter resourceConverter : this.resourceConvertersHolder.getObjectTypeConverters()) { - this.objectTypeConverters.add(new EclipseLinkOrmObjectTypeConverter(this, resourceConverter)); - } - } - - protected void initializeStructConverters() { - for (XmlStructConverter resourceConverter : this.resourceConvertersHolder.getStructConverters()) { - this.structConverters.add(new EclipseLinkOrmStructConverter(this, resourceConverter)); - } - } - - protected void initializeTypeConverters() { - for (XmlTypeConverter resourceConverter : this.resourceConvertersHolder.getTypeConverters()) { - this.typeConverters.add(new EclipseLinkOrmTypeConverter(this, resourceConverter)); - } - } - - public void update(XmlConvertersHolder resourceConvertersHolder) { - this.resourceConvertersHolder = resourceConvertersHolder; - this.updateCustomConverters(); - this.updateObjectTypeConverters(); - this.updateStructConverters(); - this.updateTypeConverters(); - } - - protected void updateCustomConverters() { - Collection<EclipseLinkOrmCustomConverter> contextConvertersToRemove = CollectionTools.collection(customConverters()); - Collection<EclipseLinkOrmCustomConverter> contextConvertersToUpdate = new ArrayList<EclipseLinkOrmCustomConverter>(); - ListIterator<XmlConverter> resourceConverters = new CloneListIterator<XmlConverter>(this.resourceConvertersHolder.getConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlConverter resourceConverter : CollectionTools.iterable(resourceConverters)) { - boolean contextConverterFound = false; - for (EclipseLinkOrmCustomConverter contextConverter : contextConvertersToRemove) { - if (contextConverter.getXmlResource() == resourceConverter) { - moveCustomConverter_(resourceIndex, contextConverter); - contextConvertersToRemove.remove(contextConverter); - contextConvertersToUpdate.add(contextConverter); - contextConverterFound = true; - break; - } - } - if (!contextConverterFound) { - addCustomConverter(new EclipseLinkOrmCustomConverter(this, resourceConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmCustomConverter contextConverter : contextConvertersToRemove) { - removeConverter_(contextConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmCustomConverter contextConverter : contextConvertersToUpdate) { - contextConverter.update(); - } - } - - protected void updateObjectTypeConverters() { - Collection<EclipseLinkOrmObjectTypeConverter> contextObjectTypeConvertersToRemove = CollectionTools.collection(objectTypeConverters()); - Collection<EclipseLinkOrmObjectTypeConverter> contextObjectTypeConvertersToUpdate = new ArrayList<EclipseLinkOrmObjectTypeConverter>(); - ListIterator<XmlObjectTypeConverter> resourceObjectTypeConverters = new CloneListIterator<XmlObjectTypeConverter>(this.resourceConvertersHolder.getObjectTypeConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlObjectTypeConverter resourceObjectTypeConverter : CollectionTools.iterable(resourceObjectTypeConverters)) { - boolean contextObjectTypeConverterFound = false; - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextObjectTypeConvertersToRemove) { - if (contextObjectTypeConverter.getXmlResource() == resourceObjectTypeConverter) { - moveObjectTypeConverter_(resourceIndex, contextObjectTypeConverter); - contextObjectTypeConvertersToRemove.remove(contextObjectTypeConverter); - contextObjectTypeConvertersToUpdate.add(contextObjectTypeConverter); - contextObjectTypeConverterFound = true; - break; - } - } - if (!contextObjectTypeConverterFound) { - addObjectTypeConverter(new EclipseLinkOrmObjectTypeConverter(this, resourceObjectTypeConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextObjectTypeConvertersToRemove) { - removeObjectTypeConverter_(contextObjectTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmObjectTypeConverter contextObjectTypeConverter : contextObjectTypeConvertersToUpdate) { - contextObjectTypeConverter.update(); - } - } - - protected void updateTypeConverters() { - Collection<EclipseLinkOrmTypeConverter> contextTypeConvertersToRemove = CollectionTools.collection(typeConverters()); - Collection<EclipseLinkOrmTypeConverter> contextTypeConvertersToUpdate = new ArrayList<EclipseLinkOrmTypeConverter>(); - ListIterator<XmlTypeConverter> resourceTypeConverters = new CloneListIterator<XmlTypeConverter>(this.resourceConvertersHolder.getTypeConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlTypeConverter resourceTypeConverter : CollectionTools.iterable(resourceTypeConverters)) { - boolean contextTypeConverterFound = false; - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextTypeConvertersToRemove) { - if (contextTypeConverter.getXmlResource() == resourceTypeConverter) { - moveTypeConverter_(resourceIndex, contextTypeConverter); - contextTypeConvertersToRemove.remove(contextTypeConverter); - contextTypeConvertersToUpdate.add(contextTypeConverter); - contextTypeConverterFound = true; - break; - } - } - if (!contextTypeConverterFound) { - addTypeConverter(new EclipseLinkOrmTypeConverter(this, resourceTypeConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextTypeConvertersToRemove) { - removeTypeConverter_(contextTypeConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmTypeConverter contextTypeConverter : contextTypeConvertersToUpdate) { - contextTypeConverter.update(); - } - } - - protected void updateStructConverters() { - Collection<EclipseLinkOrmStructConverter> contextStructConvertersToRemove = CollectionTools.collection(structConverters()); - Collection<EclipseLinkOrmStructConverter> contextStructConvertersToUpdate = new ArrayList<EclipseLinkOrmStructConverter>(); - ListIterator<XmlStructConverter> resourceStructConverters = new CloneListIterator<XmlStructConverter>(this.resourceConvertersHolder.getStructConverters());//prevent ConcurrentModificiationException - int resourceIndex = 0; - - for (XmlStructConverter resourceStructConverter : CollectionTools.iterable(resourceStructConverters)) { - boolean contextStructConverterFound = false; - for (EclipseLinkOrmStructConverter contextStructConverter : contextStructConvertersToRemove) { - if (contextStructConverter.getXmlResource() == resourceStructConverter) { - moveStructConverter_(resourceIndex, contextStructConverter); - contextStructConvertersToRemove.remove(contextStructConverter); - contextStructConvertersToUpdate.add(contextStructConverter); - contextStructConverterFound = true; - break; - } - } - if (!contextStructConverterFound) { - addStructConverter(new EclipseLinkOrmStructConverter(this, resourceStructConverter)); - } - resourceIndex++; - } - for (EclipseLinkOrmStructConverter contextStructConverter : contextStructConvertersToRemove) { - removeStructConverter_(contextStructConverter); - } - //first handle adding/removing of the converters, then update the others last, - //this causes less churn in the update process - for (EclipseLinkOrmStructConverter contextStructConverter : contextStructConvertersToUpdate) { - contextStructConverter.update(); - } - } - - //************ validation *************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - } - - - public TextRange getValidationTextRange() { - return this.resourceConvertersHolder.getValidationTextRange(); - } - - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomConverter.java deleted file mode 100644 index 6c63448ffc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomConverter.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmCustomConverter extends EclipseLinkOrmConverter - implements CustomConverter -{ - private String converterClass; - - - public EclipseLinkOrmCustomConverter(XmlContextNode parent, XmlConverter xmlResource) { - super(parent, xmlResource); - } - - - public String getType() { - return EclipseLinkConverter.CUSTOM_CONVERTER; - } - - @Override - protected XmlConverter getXmlResource() { - return (XmlConverter) super.getXmlResource(); - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getXmlResource().setClassName(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - protected void initialize(XmlConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = calculateConverterClass(); - } - - public void update() { - super.update(); - setConverterClass_(calculateConverterClass()); - } - - protected String calculateConverterClass() { - return getXmlResource().getClassName(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - validateConverterClass(messages); - } -//TODO validate converter class - protected void validateConverterClass(List<IMessage> messages) { -// if (!getResourceConverter().implementsConverter()) { -// messages.add( -// DefaultEclipseLinkJpaValidationMessages.buildMessage( -// IMessage.HIGH_SEVERITY, -// EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, -// new String[] {this.converterClass}, -// this, -// getConverterClassTextRange() -// ) -// ); -// } - } - -// public TextRange getConverterClassTextRange() { -// return getResourceConverter().getClassNameTextRange(); -// } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomizer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomizer.java deleted file mode 100644 index 24be842238..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmCustomizer.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizer; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; - -public class EclipseLinkOrmCustomizer extends AbstractXmlContextNode - implements Customizer -{ - protected XmlCustomizerHolder resource; - - protected String specifiedCustomizerClass; - - protected String defaultCustomizerClass; - - public EclipseLinkOrmCustomizer(OrmTypeMapping parent) { - super(parent); - } - - public String getCustomizerClass() { - return this.specifiedCustomizerClass == null ? this.defaultCustomizerClass : this.specifiedCustomizerClass; - } - - public String getDefaultCustomizerClass() { - return this.defaultCustomizerClass; - } - - protected void setDefaultCustomizerClass(String newDefaultCustomizerClass) { - String oldDefaultCustomizerClass = this.defaultCustomizerClass; - this.defaultCustomizerClass = newDefaultCustomizerClass; - firePropertyChanged(DEFAULT_CUSTOMIZER_CLASS_PROPERTY, oldDefaultCustomizerClass, newDefaultCustomizerClass); - } - - public String getSpecifiedCustomizerClass() { - return this.specifiedCustomizerClass; - } - - public void setSpecifiedCustomizerClass(String newCustomizerClass) { - String oldCustomizerClass = this.specifiedCustomizerClass; - this.specifiedCustomizerClass = newCustomizerClass; - if (oldCustomizerClass != newCustomizerClass) { - if (this.getResourceCustomizer() != null) { - this.getResourceCustomizer().setCustomizerClassName(newCustomizerClass); - if (this.getResourceCustomizer().isAllFeaturesUnset()) { - removeResourceCustomizer(); - } - } - else if (newCustomizerClass != null) { - addResourceCustomizer(); - getResourceCustomizer().setCustomizerClassName(newCustomizerClass); - } - } - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - protected void setSpecifiedCustomizerClass_(String newCustomizerClass) { - String oldCustomizerClass = this.specifiedCustomizerClass; - this.specifiedCustomizerClass = newCustomizerClass; - firePropertyChanged(SPECIFIED_CUSTOMIZER_CLASS_PROPERTY, oldCustomizerClass, newCustomizerClass); - } - - protected XmlCustomizer getResourceCustomizer() { - return this.resource.getCustomizer(); - } - - protected void addResourceCustomizer() { - this.resource.setCustomizer(EclipseLinkOrmFactory.eINSTANCE.createXmlCustomizer()); - } - - protected void removeResourceCustomizer() { - this.resource.setCustomizer(null); - } - - // **************** initialize/update ************************************** - - protected void initialize(XmlCustomizerHolder resource, Customizer javaCustomizer) { - this.resource = resource; - this.defaultCustomizerClass = (javaCustomizer == null) ? null : javaCustomizer.getCustomizerClass(); - this.specifiedCustomizerClass = specifiedCustomizerClass(getResourceCustomizer()); - } - - protected void update(XmlCustomizerHolder resource, Customizer javaCustomizer) { - this.resource = resource; - setDefaultCustomizerClass((javaCustomizer == null) ? null : javaCustomizer.getCustomizerClass()); - setSpecifiedCustomizerClass_(specifiedCustomizerClass(getResourceCustomizer())); - } - - protected String specifiedCustomizerClass(XmlCustomizer resource) { - return (resource == null) ? null : resource.getCustomizerClassName(); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - XmlCustomizer resource = getResourceCustomizer(); - return resource == null ? null : resource.getCustomizerClassNameTextRange(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddable.java deleted file mode 100644 index 22811ef27b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddable.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEmbeddable; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface EclipseLinkOrmEmbeddable extends EclipseLinkEmbeddable, OrmEmbeddable -{ - ConverterHolder getConverterHolder(); -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableImpl.java deleted file mode 100644 index c2d4b941c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEmbeddableImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmEmbeddable; -import org.eclipse.jpt.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEmbeddable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmEmbeddableImpl extends GenericOrmEmbeddable - implements EclipseLinkOrmEmbeddable -{ - protected final EclipseLinkOrmCustomizer customizer; - - protected final EclipseLinkOrmChangeTracking changeTracking; - - protected final EclipseLinkOrmConverterHolder converterHolder; - - public EclipseLinkOrmEmbeddableImpl(OrmPersistentType parent) { - super(parent); - this.customizer = new EclipseLinkOrmCustomizer(this); - this.changeTracking = new EclipseLinkOrmChangeTracking(this); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - - - // **************** resource-context interaction *************************** - - @Override - public XmlEmbeddable addToResourceModel(XmlEntityMappings entityMappings) { - XmlEmbeddable embeddable = EclipseLinkOrmFactory.eINSTANCE.createXmlEmbeddable(); - getPersistentType().initialize(embeddable); - entityMappings.getEmbeddables().add(embeddable); - return embeddable; - } - - @Override - public void initialize(XmlEmbeddable embeddable) { - super.initialize(embeddable); - this.customizer.initialize((XmlCustomizerHolder) embeddable, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) embeddable, getJavaChangeTracking()); - this.converterHolder.initialize((XmlConvertersHolder) embeddable); - } - - @Override - public void update(XmlEmbeddable embeddable) { - super.update(embeddable); - this.customizer.update((XmlCustomizerHolder) embeddable, getJavaCustomizer()); - this.changeTracking.update((XmlChangeTrackingHolder) embeddable, getJavaChangeTracking()); - this.converterHolder.update((XmlConvertersHolder) embeddable); - } - - @Override - protected EclipseLinkJavaEmbeddable getJavaEmbeddableForDefaults() { - return (EclipseLinkJavaEmbeddable) super.getJavaEmbeddableForDefaults(); - } - - - protected Customizer getJavaCustomizer() { - EclipseLinkJavaEmbeddable javaEmbeddable = getJavaEmbeddableForDefaults(); - return (javaEmbeddable == null) ? null : javaEmbeddable.getCustomizer(); - } - - protected ChangeTracking getJavaChangeTracking() { - EclipseLinkJavaEmbeddable javaEmbeddable = getJavaEmbeddableForDefaults(); - return (javaEmbeddable == null) ? null : javaEmbeddable.getChangeTracking(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.customizer.validate(messages); - this.changeTracking.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntity.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntity.java deleted file mode 100644 index 43fafde3e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntity.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmEntity; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEntity; - -public interface EclipseLinkOrmEntity extends EclipseLinkEntity, OrmEntity -{ - ConverterHolder getConverterHolder(); -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityImpl.java deleted file mode 100644 index eda9adc885..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmEntityImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; -import org.eclipse.jpt.core.resource.orm.XmlEntity; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmEntityImpl extends GenericOrmEntity - implements EclipseLinkOrmEntity -{ - protected final EclipseLinkOrmReadOnly readOnly; - - protected final EclipseLinkOrmCustomizer customizer; - - protected final EclipseLinkOrmChangeTracking changeTracking; - - protected final EclipseLinkOrmCaching caching; - - protected final EclipseLinkOrmConverterHolder converterHolder; - - - public EclipseLinkOrmEntityImpl(OrmPersistentType parent) { - super(parent); - this.readOnly = new EclipseLinkOrmReadOnly(this); - this.customizer = new EclipseLinkOrmCustomizer(this); - this.changeTracking = new EclipseLinkOrmChangeTracking(this); - this.caching = new EclipseLinkOrmCaching(this); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); - } - - public Caching getCaching() { - return this.caching; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public EclipseLinkOrmReadOnly getReadOnly() { - return this.readOnly; - } - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - // **************** resource-context interaction *************************** - - @Override - public XmlEntity addToResourceModel(XmlEntityMappings entityMappings) { - XmlEntity entity = EclipseLinkOrmFactory.eINSTANCE.createXmlEntity(); - getPersistentType().initialize(entity); - entityMappings.getEntities().add(entity); - return entity; - } - - @Override - public void initialize(XmlEntity entity) { - super.initialize(entity); - this.readOnly.initialize((XmlReadOnly) entity, getJavaReadOnly()); - this.customizer.initialize((XmlCustomizerHolder) entity, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) entity, getJavaChangeTracking()); - this.caching.initialize((XmlCacheHolder) entity, getJavaCaching()); - this.converterHolder.initialize((XmlConvertersHolder) entity); - } - - @Override - public void update(XmlEntity entity) { - super.update(entity); - this.readOnly.update((XmlReadOnly) entity, getJavaReadOnly()); - this.customizer.update((XmlCustomizerHolder) entity, getJavaCustomizer()); - this.changeTracking.update((XmlChangeTrackingHolder) entity, getJavaChangeTracking()); - this.caching.update((XmlCacheHolder) entity, getJavaCaching()); - this.converterHolder.update((XmlConvertersHolder) entity); - } - - @Override - protected EclipseLinkJavaEntity getJavaEntityForDefaults() { - return (EclipseLinkJavaEntity) super.getJavaEntityForDefaults(); - } - - protected ReadOnly getJavaReadOnly() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getReadOnly(); - } - - protected Customizer getJavaCustomizer() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getCustomizer(); - } - - protected ChangeTracking getJavaChangeTracking() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getChangeTracking(); - } - - protected JavaCaching getJavaCaching() { - EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults(); - return (javaEntity == null) ? null : javaEntity.getCaching(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.readOnly.validate(messages); - this.customizer.validate(messages); - this.changeTracking.validate(messages); - this.caching.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmExpiryTimeOfDay.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmExpiryTimeOfDay.java deleted file mode 100644 index 3a48bf9122..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmExpiryTimeOfDay.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTimeOfDay; - -public class EclipseLinkOrmExpiryTimeOfDay extends AbstractXmlContextNode - implements ExpiryTimeOfDay -{ - - protected Integer hour; - protected Integer minute; - protected Integer second; - protected Integer millisecond; - - protected XmlTimeOfDay resourceTimeOfDay; - - public EclipseLinkOrmExpiryTimeOfDay(Caching parent) { - super(parent); - } - - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - this.resourceTimeOfDay.setHour(newHour); - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - protected void setHour_(Integer newHour) { - Integer oldHour = this.hour; - this.hour = newHour; - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - this.resourceTimeOfDay.setMinute(newMinute); - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - protected void setMinute_(Integer newMinute) { - Integer oldMinute = this.minute; - this.minute = newMinute; - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - this.resourceTimeOfDay.setSecond(newSecond); - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - protected void setSecond_(Integer newSecond) { - Integer oldSecond = this.second; - this.second = newSecond; - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - this.resourceTimeOfDay.setMillisecond(newMillisecond); - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - protected void setMillisecond_(Integer newMillisecond) { - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - public TextRange getValidationTextRange() { - return this.resourceTimeOfDay.getValidationTextRange(); - } - - public void initialize(XmlTimeOfDay resource) { - this.resourceTimeOfDay = resource; - this.hour = hour(); - this.minute = minute(); - this.second = second(); - this.millisecond = millisecond(); - } - - public void update(XmlTimeOfDay resource) { - this.resourceTimeOfDay = resource; - this.setHour_(hour()); - this.setMinute_(minute()); - this.setSecond_(second()); - this.setMillisecond_(millisecond()); - } - - protected Integer hour() { - return this.resourceTimeOfDay.getHour(); - } - - protected Integer minute() { - return this.resourceTimeOfDay.getMinute(); - } - - protected Integer second() { - return this.resourceTimeOfDay.getSecond(); - } - - protected Integer millisecond() { - return this.resourceTimeOfDay.getMillisecond(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMapping.java deleted file mode 100644 index 54d4aae114..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmIdMapping.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmIdMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmIdMapping extends GenericOrmIdMapping - implements EclipseLinkIdMapping -{ - protected EclipseLinkOrmMutable mutable; - - - public EclipseLinkOrmIdMapping(OrmPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkOrmMutable(this); - } - - - public Mutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkOrmConvert(this, (XmlId) this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String specifiedConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlId) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlId addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlId id = EclipseLinkOrmFactory.eINSTANCE.createXmlIdImpl(); - getPersistentAttribute().initialize(id); - typeMapping.getAttributes().getIds().add(id); - return id; - } - - @Override - public void initialize(XmlAttributeMapping xmlAttributeMapping) { - super.initialize(xmlAttributeMapping); - this.mutable.initialize((XmlMutable) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmJoinFetch.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmJoinFetch.java deleted file mode 100644 index 59c4b1eca0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmJoinFetch.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; - -public class EclipseLinkOrmJoinFetch extends AbstractXmlContextNode - implements JoinFetch -{ - protected XmlJoinFetch resource; - - protected JoinFetchType joinFetchValue; - - - public EclipseLinkOrmJoinFetch(OrmAttributeMapping parent) { - super(parent); - } - - - public JoinFetchType getValue() { - return this.joinFetchValue; - } - - public void setValue(JoinFetchType newJoinFetchValue) { - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - this.resource.setJoinFetch(JoinFetchType.toOrmResourceModel(newJoinFetchValue)); - firePropertyChanged(VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - protected void setValue_(JoinFetchType newJoinFetchValue) { - JoinFetchType oldJoinFetchValue = this.joinFetchValue; - this.joinFetchValue = newJoinFetchValue; - firePropertyChanged(VALUE_PROPERTY, oldJoinFetchValue, newJoinFetchValue); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlJoinFetch xmlJoinFetch) { - this.resource = xmlJoinFetch; - this.joinFetchValue = JoinFetchType.fromOrmResourceModel(this.resource.getJoinFetch()); - } - - protected void update() { - setValue_(JoinFetchType.fromOrmResourceModel(this.resource.getJoinFetch())); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getJoinFetchTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMapping.java deleted file mode 100644 index 9c805dabfc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToManyMapping.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmManyToManyMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmManyToManyMapping - extends GenericOrmManyToManyMapping - implements EclipseLinkRelationshipMapping -{ - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmManyToManyMapping(OrmPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlManyToMany addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlManyToMany manyToMany = EclipseLinkOrmFactory.eINSTANCE.createXmlManyToManyImpl(); - getPersistentAttribute().initialize(manyToMany); - typeMapping.getAttributes().getManyToManys().add(manyToMany); - return manyToMany; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - private owned, join fetch validation - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMapping.java deleted file mode 100644 index fe53115d43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmManyToOneMapping.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmManyToOneMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmManyToOneMapping extends GenericOrmManyToOneMapping - implements EclipseLinkRelationshipMapping -{ - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmManyToOneMapping(OrmPersistentAttribute parent) { - super(parent); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlManyToOne addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlManyToOne manyToOne = EclipseLinkOrmFactory.eINSTANCE.createXmlManyToOneImpl(); - getPersistentAttribute().initialize(manyToOne); - typeMapping.getAttributes().getManyToOnes().add(manyToOne); - return manyToOne; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - private owned, join fetch validation - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclass.java deleted file mode 100644 index 09950fc8e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclass.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMappedSuperclass; - -public interface EclipseLinkOrmMappedSuperclass extends EclipseLinkMappedSuperclass, OrmMappedSuperclass -{ - ConverterHolder getConverterHolder(); -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassImpl.java deleted file mode 100644 index 2c8d9bde71..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMappedSuperclassImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmMappedSuperclass; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.java.JavaCaching; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmMappedSuperclassImpl extends GenericOrmMappedSuperclass - implements EclipseLinkOrmMappedSuperclass -{ - protected final EclipseLinkOrmReadOnly readOnly; - - protected final EclipseLinkOrmCustomizer customizer; - - protected final EclipseLinkOrmChangeTracking changeTracking; - - protected final EclipseLinkOrmCaching caching; - - protected final EclipseLinkOrmConverterHolder converterHolder; - - - public EclipseLinkOrmMappedSuperclassImpl(OrmPersistentType parent) { - super(parent); - this.readOnly = new EclipseLinkOrmReadOnly(this); - this.customizer = new EclipseLinkOrmCustomizer(this); - this.changeTracking = new EclipseLinkOrmChangeTracking(this); - this.caching = new EclipseLinkOrmCaching(this); - this.converterHolder = new EclipseLinkOrmConverterHolder(this); -} - - public Caching getCaching() { - return this.caching; - } - - public Customizer getCustomizer() { - return this.customizer; - } - - public ChangeTracking getChangeTracking() { - return this.changeTracking; - } - - public EclipseLinkOrmReadOnly getReadOnly() { - return this.readOnly; - } - - public ConverterHolder getConverterHolder() { - return this.converterHolder; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlMappedSuperclass addToResourceModel(XmlEntityMappings entityMappings) { - XmlMappedSuperclass mappedSuperclass = EclipseLinkOrmFactory.eINSTANCE.createXmlMappedSuperclass(); - getPersistentType().initialize(mappedSuperclass); - entityMappings.getMappedSuperclasses().add(mappedSuperclass); - return mappedSuperclass; - } - - @Override - public void initialize(XmlMappedSuperclass mappedSuperclass) { - super.initialize(mappedSuperclass); - this.readOnly.initialize((XmlReadOnly) mappedSuperclass, getJavaReadOnly()); - this.customizer.initialize((XmlCustomizerHolder) mappedSuperclass, getJavaCustomizer()); - this.changeTracking.initialize((XmlChangeTrackingHolder) mappedSuperclass, getJavaChangeTracking()); - this.caching.initialize((XmlCacheHolder) mappedSuperclass, getJavaCaching()); - this.converterHolder.initialize((XmlConvertersHolder) mappedSuperclass); - } - - @Override - public void update(XmlMappedSuperclass mappedSuperclass) { - super.update(mappedSuperclass); - this.readOnly.update((XmlReadOnly) mappedSuperclass, getJavaReadOnly()); - this.customizer.update((XmlCustomizerHolder) mappedSuperclass, getJavaCustomizer()); - this.changeTracking.update((XmlChangeTrackingHolder) mappedSuperclass, getJavaChangeTracking()); - this.caching.update((XmlCacheHolder) mappedSuperclass, getJavaCaching()); - this.converterHolder.update((XmlConvertersHolder) mappedSuperclass); - } - - @Override - protected EclipseLinkJavaMappedSuperclass getJavaMappedSuperclassForDefaults() { - return (EclipseLinkJavaMappedSuperclass) super.getJavaMappedSuperclassForDefaults(); - } - - protected ReadOnly getJavaReadOnly() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getReadOnly(); - } - - protected Customizer getJavaCustomizer() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getCustomizer(); - } - - protected ChangeTracking getJavaChangeTracking() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getChangeTracking(); - } - - protected JavaCaching getJavaCaching() { - EclipseLinkJavaMappedSuperclass javaMappedSuperclass = getJavaMappedSuperclassForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getCaching(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - this.readOnly.validate(messages); - this.customizer.validate(messages); - this.changeTracking.validate(messages); - this.caching.validate(messages); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMutable.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMutable.java deleted file mode 100644 index c585d9863c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmMutable.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; - -public class EclipseLinkOrmMutable extends AbstractXmlContextNode - implements Mutable -{ - protected XmlMutable resource; - - protected boolean defaultMutable; - - protected Boolean specifiedMutable; - - - public EclipseLinkOrmMutable(OrmAttributeMapping parent) { - super(parent); - } - - @Override - public EclipseLinkPersistenceUnit getPersistenceUnit() { - return (EclipseLinkPersistenceUnit) super.getPersistenceUnit(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return (OrmAttributeMapping) getParent(); - } - - public boolean isMutable() { - return (this.specifiedMutable != null) ? this.specifiedMutable.booleanValue() : this.defaultMutable; - } - - public boolean isDefaultMutable() { - return this.defaultMutable; - } - - protected void setDefaultMutable(boolean newDefaultMutable) { - boolean oldDefaultMutable = this.defaultMutable; - this.defaultMutable = newDefaultMutable; - firePropertyChanged(DEFAULT_MUTABLE_PROPERTY, oldDefaultMutable, newDefaultMutable); - } - - public Boolean getSpecifiedMutable() { - return this.specifiedMutable; - } - - public void setSpecifiedMutable(Boolean newSpecifiedMutable) { - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - this.resource.setMutable(newSpecifiedMutable); - firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - protected void setSpecifiedMutable_(Boolean newSpecifiedMutable) { - Boolean oldSpecifiedMutable = this.specifiedMutable; - this.specifiedMutable = newSpecifiedMutable; - firePropertyChanged(SPECIFIED_MUTABLE_PROPERTY, oldSpecifiedMutable, newSpecifiedMutable); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlMutable resource) { - this.resource = resource; - this.defaultMutable = calculateDefaultMutable(); - this.specifiedMutable = resource.getMutable(); - } - - protected void update() { - setDefaultMutable(calculateDefaultMutable()); - setSpecifiedMutable_(this.resource.getMutable()); - } - - protected boolean calculateDefaultMutable() { - OrmAttributeMapping attributeMapping = getAttributeMapping(); - JavaPersistentAttribute javaAttribute = attributeMapping.getJavaPersistentAttribute(); - if (javaAttribute == null) { - return false; - } - JavaResourcePersistentAttribute javaResourceAttribute = javaAttribute.getResourcePersistentAttribute(); - if (javaResourceAttribute.typeIsDateOrCalendar()) { - Boolean persistenceUnitDefaultMutable = getPersistenceUnit().getOptions().getTemporalMutable(); - return persistenceUnitDefaultMutable == null ? false : persistenceUnitDefaultMutable.booleanValue(); - } - return javaResourceAttribute.typeIsSerializable(); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getMutableTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java deleted file mode 100644 index 4bf7b0ddc4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmObjectTypeConverter.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmObjectTypeConverter extends EclipseLinkOrmConverter - implements ObjectTypeConverter -{ - private String dataType; - - private String objectType; - - private final List<EclipseLinkOrmConversionValue> conversionValues; - - private String defaultObjectValue; - - - public EclipseLinkOrmObjectTypeConverter(XmlContextNode parent, XmlObjectTypeConverter xmlResource) { - super(parent, xmlResource); - this.conversionValues = new ArrayList<EclipseLinkOrmConversionValue>(); - } - - - public String getType() { - return EclipseLinkConverter.OBJECT_TYPE_CONVERTER; - } - - @Override - protected XmlObjectTypeConverter getXmlResource() { - return (XmlObjectTypeConverter) super.getXmlResource(); - } - - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getXmlResource().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getXmlResource().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** conversion values ************************************** - - public ListIterator<EclipseLinkOrmConversionValue> conversionValues() { - return new CloneListIterator<EclipseLinkOrmConversionValue>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public EclipseLinkOrmConversionValue addConversionValue(int index) { - XmlConversionValue resourceConversionValue = EclipseLinkOrmFactory.eINSTANCE.createXmlConversionValueImpl(); - EclipseLinkOrmConversionValue contextConversionValue = buildConversionValue(resourceConversionValue); - this.conversionValues.add(index, contextConversionValue); - getXmlResource().getConversionValues().add(index, resourceConversionValue); - fireItemAdded(CONVERSION_VALUES_LIST, index, contextConversionValue); - return contextConversionValue; - } - - public EclipseLinkOrmConversionValue addConversionValue() { - return this.addConversionValue(this.conversionValues.size()); - } - - protected void addConversionValue(int index, EclipseLinkOrmConversionValue conversionValue) { - addItemToList(index, conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - protected void addConversionValue(EclipseLinkOrmConversionValue conversionValue) { - this.addConversionValue(this.conversionValues.size(), conversionValue); - } - - public void removeConversionValue(int index) { - EclipseLinkOrmConversionValue removedJoinColumn = this.conversionValues.remove(index); - getXmlResource().getConversionValues().remove(index); - fireItemRemoved(CONVERSION_VALUES_LIST, index, removedJoinColumn); - } - - public void removeConversionValue(ConversionValue conversionValue) { - this.removeConversionValue(this.conversionValues.indexOf(conversionValue)); - } - - protected void removeConversionValue_(ConversionValue conversionValue) { - removeItemFromList(conversionValue, this.conversionValues, CONVERSION_VALUES_LIST); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - CollectionTools.move(this.conversionValues, targetIndex, sourceIndex); - getXmlResource().getConversionValues().move(targetIndex, sourceIndex); - fireItemMoved(CONVERSION_VALUES_LIST, targetIndex, sourceIndex); - } - - public ListIterator<String> dataValues() { - return new TransformationListIterator<EclipseLinkOrmConversionValue, String>(conversionValues()) { - @Override - protected String transform(EclipseLinkOrmConversionValue next) { - return next.getDataValue(); - } - }; - } - - - // **************** default object value *********************************** - - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - getXmlResource().setDefaultObjectValue(newDefaultObjectValue); - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - protected void setDefaultObjectValue_(String newDefaultObjectValue) { - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - - // **************** resource interaction *********************************** - - protected void initialize(XmlObjectTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = this.calculateDataType(); - this.objectType = this.calculateObjectType(); - this.defaultObjectValue = this.calculateDefaultObjectValue(); - this.initializeConversionValues(); - } - - protected void initializeConversionValues() { - for (XmlConversionValue resourceConversionValue : getXmlResource().getConversionValues()) { - this.conversionValues.add(buildConversionValue(resourceConversionValue)); - } - } - - public void update() { - super.update(); - setDataType_(calculateDataType()); - setObjectType_(calculateObjectType()); - setDefaultObjectValue_(calculateDefaultObjectValue()); - updateConversionValues(); - } - - protected void updateConversionValues( ) { - ListIterator<EclipseLinkOrmConversionValue> contextConversionValues = conversionValues(); - ListIterator<XmlConversionValue> resourceConversionValues = - new CloneListIterator<XmlConversionValue>(getXmlResource().getConversionValues());//prevent ConcurrentModificiationException - - while (contextConversionValues.hasNext()) { - EclipseLinkOrmConversionValue conversionValues = contextConversionValues.next(); - if (resourceConversionValues.hasNext()) { - conversionValues.update(resourceConversionValues.next()); - } - else { - removeConversionValue_(conversionValues); - } - } - - while (resourceConversionValues.hasNext()) { - addConversionValue(buildConversionValue(resourceConversionValues.next())); - } - } - - protected EclipseLinkOrmConversionValue buildConversionValue(XmlConversionValue resourceConversionValue) { - EclipseLinkOrmConversionValue conversionValue = new EclipseLinkOrmConversionValue(this); - conversionValue.initialize(resourceConversionValue); - return conversionValue; - } - - protected String calculateDataType() { - return getXmlResource().getDataType(); - } - - protected String calculateObjectType() { - return getXmlResource().getObjectType(); - } - - protected String calculateDefaultObjectValue() { - return getXmlResource().getDefaultObjectValue(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - for (Iterator<EclipseLinkOrmConversionValue> stream = conversionValues(); stream.hasNext();) { - stream.next().validate(messages); - } - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMapping.java deleted file mode 100644 index 7d1fb25f4a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyMapping.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.MappingKeys; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToManyMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPrivateOwned; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmOneToManyMapping extends GenericOrmOneToManyMapping - implements EclipseLinkOneToManyMapping -{ - protected EclipseLinkOrmPrivateOwned privateOwned; - - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmOneToManyMapping(OrmPersistentAttribute parent) { - super(parent); - this.privateOwned = new EclipseLinkOrmPrivateOwned(this); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - // ********** NonOwningMapping implementation ********** - @Override - public boolean mappedByIsValid(AttributeMapping mappedByMapping) { - return super.mappedByIsValid(mappedByMapping) || (mappedByMapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - } - - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlOneToMany addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlOneToMany oneToMany = EclipseLinkOrmFactory.eINSTANCE.createXmlOneToManyImpl(); - getPersistentAttribute().initialize(oneToMany); - typeMapping.getAttributes().getOneToManys().add(oneToMany); - return oneToMany; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.privateOwned.initialize((XmlPrivateOwned) this.resourceAttributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - private owned, join fetch validation - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMapping.java deleted file mode 100644 index b5aa086121..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToOneMapping.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToOneMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetch; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPrivateOwned; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmOneToOneMapping extends GenericOrmOneToOneMapping - implements EclipseLinkOneToOneMapping -{ - protected EclipseLinkOrmPrivateOwned privateOwned; - - protected EclipseLinkOrmJoinFetch joinFetch; - - - public EclipseLinkOrmOneToOneMapping(OrmPersistentAttribute parent) { - super(parent); - this.privateOwned = new EclipseLinkOrmPrivateOwned(this); - this.joinFetch = new EclipseLinkOrmJoinFetch(this); - } - - - public PrivateOwned getPrivateOwned() { - return this.privateOwned; - } - - public JoinFetch getJoinFetch() { - return this.joinFetch; - } - - - // **************** resource-context interaction *************************** - - @Override - public XmlOneToOne addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlOneToOne oneToOne = EclipseLinkOrmFactory.eINSTANCE.createXmlOneToOneImpl(); - getPersistentAttribute().initialize(oneToOne); - typeMapping.getAttributes().getOneToOnes().add(oneToOne); - return oneToOne; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.privateOwned.initialize((XmlPrivateOwned) this.resourceAttributeMapping); - this.joinFetch.initialize((XmlJoinFetch) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.privateOwned.update(); - this.joinFetch.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - private owned, join fetch validation - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentType.java deleted file mode 100644 index f02d132bd3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentType.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.PersistentTypeContext; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmPersistentType; -import org.eclipse.jpt.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; - -public class EclipseLinkOrmPersistentType extends GenericOrmPersistentType -{ - - public EclipseLinkOrmPersistentType(PersistentTypeContext parent, String mappingKey) { - super(parent, mappingKey); - } - - @Override - protected Attributes createAttributesResource() { - return EclipseLinkOrmFactory.eINSTANCE.createAttributes(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPrivateOwned.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPrivateOwned.java deleted file mode 100644 index 75365e2100..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmPrivateOwned.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlPrivateOwned; - -public class EclipseLinkOrmPrivateOwned extends AbstractXmlContextNode - implements PrivateOwned -{ - protected XmlPrivateOwned resource; - - protected boolean privateOwned; - - - public EclipseLinkOrmPrivateOwned(OrmAttributeMapping parent) { - super(parent); - } - - - public boolean isPrivateOwned() { - return this.privateOwned; - } - - public void setPrivateOwned(boolean newPrivateOwned) { - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - this.resource.setPrivateOwned(newPrivateOwned); - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - protected void setPrivateOwned_(boolean newPrivateOwned) { - boolean oldPrivateOwned = this.privateOwned; - this.privateOwned = newPrivateOwned; - firePropertyChanged(PRIVATE_OWNED_PROPERTY, oldPrivateOwned, newPrivateOwned); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlPrivateOwned xmlPrivateOwned) { - this.resource = xmlPrivateOwned; - this.privateOwned = this.resource.isPrivateOwned(); - } - - protected void update() { - setPrivateOwned_(this.resource.isPrivateOwned()); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getPrivateOwnedTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmReadOnly.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmReadOnly.java deleted file mode 100644 index 2c40ecabe5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmReadOnly.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly; - -public class EclipseLinkOrmReadOnly extends AbstractXmlContextNode - implements ReadOnly -{ - protected XmlReadOnly resource; - - protected boolean defaultReadOnly; - - protected Boolean specifiedReadOnly; - - - public EclipseLinkOrmReadOnly(OrmTypeMapping parent) { - super(parent); - } - - - public boolean isReadOnly() { - return (this.specifiedReadOnly == null) ? this.defaultReadOnly : this.specifiedReadOnly.booleanValue(); - } - - public boolean isDefaultReadOnly() { - return this.defaultReadOnly; - } - - public void setDefaultReadOnly(boolean newValue) { - boolean oldValue = this.defaultReadOnly; - this.defaultReadOnly = newValue; - firePropertyChanged(DEFAULT_READ_ONLY_PROPERTY, oldValue, newValue); - } - - public Boolean getSpecifiedReadOnly() { - return this.specifiedReadOnly; - } - - public void setSpecifiedReadOnly(Boolean newSpecifiedReadOnly) { - Boolean oldSpecifiedReadOnly = this.specifiedReadOnly; - this.specifiedReadOnly = newSpecifiedReadOnly; - this.resource.setReadOnly(newSpecifiedReadOnly); - firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldSpecifiedReadOnly, newSpecifiedReadOnly); - } - - - // **************** initialize/update ************************************** - - protected void initialize(XmlReadOnly resource, ReadOnly javaReadOnly) { - this.resource = resource; - this.defaultReadOnly = (javaReadOnly == null) ? false : javaReadOnly.isReadOnly(); - this.specifiedReadOnly = resource.getReadOnly(); - } - - protected void update(XmlReadOnly resource, ReadOnly javaReadOnly) { - this.resource = resource; - setDefaultReadOnly((javaReadOnly == null) ? false : javaReadOnly.isReadOnly()); - setSpecifiedReadOnly(resource.getReadOnly()); - } - - - // **************** validation ************************************** - - public TextRange getValidationTextRange() { - return this.resource.getReadOnlyTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java deleted file mode 100644 index c1cda517ff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmStructConverter.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmStructConverter extends EclipseLinkOrmConverter - implements StructConverter -{ - private String converterClass; - - - public EclipseLinkOrmStructConverter(XmlContextNode parent, XmlStructConverter xmlResource) { - super(parent, xmlResource); - } - - - public String getType() { - return EclipseLinkConverter.STRUCT_CONVERTER; - } - - @Override - protected XmlStructConverter getXmlResource() { - return (XmlStructConverter) super.getXmlResource(); - } - - - // **************** converter class **************************************** - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - getXmlResource().setConverter(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - protected void setConverterClass_(String newConverterClass) { - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - - // **************** resource interaction *********************************** - - protected void initialize(XmlStructConverter xmlResource) { - super.initialize(xmlResource); - this.converterClass = calculateConverterClass(); - } - - public void update() { - super.update(); - setConverterClass_(calculateConverterClass()); - } - - protected String calculateConverterClass() { - return getXmlResource().getConverter(); - } - - - // **************** validation ********************************************* - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - validateConverterClass(messages); - } - -//TODO validate converter class - protected void validateConverterClass(List<IMessage> messages) { -// if (!getResourceConverter().implementsConverter()) { -// messages.add( -// DefaultEclipseLinkJpaValidationMessages.buildMessage( -// IMessage.HIGH_SEVERITY, -// EclipseLinkJpaValidationMessages.CONVERTER_CLASS_IMPLEMENTS_CONVERTER, -// new String[] {this.converterClass}, -// this, -// getConverterClassTextRange() -// ) -// ); -// } - } - -// public TextRange getConverterClassTextRange() { -// return getResourceConverter().getClassNameTextRange(); -// } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java deleted file mode 100644 index 721650ac72..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmTypeConverter.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.XmlContextNode; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -public class EclipseLinkOrmTypeConverter extends EclipseLinkOrmConverter - implements TypeConverter -{ - private String dataType; - - private String objectType; - - - public EclipseLinkOrmTypeConverter(XmlContextNode parent, XmlTypeConverter xmlResource) { - super(parent, xmlResource); - } - - - public String getType() { - return EclipseLinkConverter.TYPE_CONVERTER; - } - - @Override - protected XmlTypeConverter getXmlResource() { - return (XmlTypeConverter) super.getXmlResource(); - } - - - // **************** data type ********************************************** - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - getXmlResource().setDataType(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - protected void setDataType_(String newDataType) { - String oldDataType = this.dataType; - this.dataType = newDataType; - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - - // **************** object type ******************************************** - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - getXmlResource().setObjectType(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - protected void setObjectType_(String newObjectType) { - String oldObjectType = this.objectType; - this.objectType = newObjectType; - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - - // **************** resource interaction *********************************** - - protected void initialize(XmlTypeConverter xmlResource) { - super.initialize(xmlResource); - this.dataType = calculateDataType(); - this.objectType = calculateObjectType(); - } - - public void update() { - super.update(); - setDataType_(calculateDataType()); - setObjectType_(calculateObjectType()); - } - - protected String calculateDataType() { - return getXmlResource().getDataType(); - } - - protected String calculateObjectType() { - return getXmlResource().getObjectType(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMapping.java deleted file mode 100644 index 103ad77c76..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmVersionMapping.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.core.context.orm.OrmConverter; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.GenericOrmVersionMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlMutable; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class EclipseLinkOrmVersionMapping extends GenericOrmVersionMapping - implements EclipseLinkVersionMapping -{ - protected EclipseLinkOrmMutable mutable; - - - public EclipseLinkOrmVersionMapping(OrmPersistentAttribute parent) { - super(parent); - this.mutable = new EclipseLinkOrmMutable(this); - } - - - public Mutable getMutable() { - return this.mutable; - } - - @Override - protected OrmConverter buildSpecifiedConverter(String converterType) { - OrmConverter ormConverter = super.buildSpecifiedConverter(converterType); - if (ormConverter != null) { - return ormConverter; - } - if (converterType == Convert.ECLIPSE_LINK_CONVERTER) { - return new EclipseLinkOrmConvert(this, (XmlVersion) this.resourceAttributeMapping); - } - return null; - } - - @Override - protected String specifiedConverterType() { - //check @Convert first, this is the order that EclipseLink searches - if (((XmlVersion) this.resourceAttributeMapping).getConvert() != null) { - return Convert.ECLIPSE_LINK_CONVERTER; - } - return super.specifiedConverterType(); - } - - // **************** resource-context interaction *************************** - - @Override - public XmlVersion addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlVersion version = EclipseLinkOrmFactory.eINSTANCE.createXmlVersionImpl(); - getPersistentAttribute().initialize(version); - typeMapping.getAttributes().getVersions().add(version); - return version; - } - - @Override - public void initialize(XmlAttributeMapping attributeMapping) { - super.initialize(attributeMapping); - this.mutable.initialize((XmlMutable) this.resourceAttributeMapping); - } - - @Override - public void update() { - super.update(); - this.mutable.update(); - } - - - // **************** validation ************************************** - - @Override - public void validate(List<IMessage> messages) { - super.validate(messages); - // TODO - mutable validation - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXml.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXml.java deleted file mode 100644 index f10d1fdcf4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkOrmXml.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.core.internal.context.orm.OrmXmlImpl; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmResource; - -public class EclipseLinkOrmXml extends OrmXmlImpl -{ - public EclipseLinkOrmXml(MappingFileRef parent, EclipseLinkOrmResource ormResource) { - super(parent, ormResource); - } - - @Override - protected XmlEntityMappings buildEntityMappingsResource() { - return EclipseLinkOrmFactory.eINSTANCE.createXmlEntityMappings(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlBasic.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlBasic.java deleted file mode 100644 index b8212e8131..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlBasic.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlBasic; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasic; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlBasic extends VirtualXmlBasic implements XmlBasic -{ - - public EclipseLinkVirtualXmlBasic(OrmTypeMapping ormTypeMapping, JavaBasicMapping javaBasicMapping) { - super(ormTypeMapping, javaBasicMapping); - } - - public Boolean getMutable() { - if (isOrmMetadataComplete()) { - return Boolean.valueOf(((EclipseLinkBasicMapping) this.javaAttributeMapping).getMutable().isDefaultMutable()); - } - return Boolean.valueOf(((EclipseLinkBasicMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - public void setMutable(@SuppressWarnings("unused") Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getConvert() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - return ((Convert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - public void setConvert(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getMutableTextRange() { - return null; - } - - public TextRange getConvertTextRange() { - return null; - } - - public XmlConverter getConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkVirtualXmlConverter(this.ormTypeMapping, (CustomConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setConverter(@SuppressWarnings("unused") XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlObjectTypeConverter getObjectTypeConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlObjectTypeConverter(this.ormTypeMapping, (ObjectTypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setObjectTypeConverter(@SuppressWarnings("unused") XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlStructConverter getStructConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkVirtualXmlStructConverter(this.ormTypeMapping, (StructConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setStructConverter(@SuppressWarnings("unused") XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlTypeConverter getTypeConverter() { - if (isOrmMetadataComplete()) { - return null; - } - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlTypeConverter(this.ormTypeMapping, (TypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setTypeConverter(@SuppressWarnings("unused") XmlTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConversionValue.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConversionValue.java deleted file mode 100644 index 38675d53fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConversionValue.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlConversionValue extends AbstractJpaEObject implements XmlConversionValue -{ - protected OrmTypeMapping ormTypeMapping; - - protected ConversionValue javaConversionValue; - - public EclipseLinkVirtualXmlConversionValue(OrmTypeMapping ormTypeMapping, ConversionValue javaConversionValue) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConversionValue = javaConversionValue; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getDataValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConversionValue.getDataValue(); - } - - public void setDataValue(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getObjectValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConversionValue.getObjectValue(); - } - - public void setObjectValue(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getDataValueTextRange() { - return null; - } - - public TextRange getObjectValueTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java deleted file mode 100644 index d0a0f047af..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlConverter.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlConverter extends AbstractJpaEObject implements XmlConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected CustomConverter javaConverter; - - public EclipseLinkVirtualXmlConverter(OrmTypeMapping ormTypeMapping, CustomConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getClassName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getConverterClass(); - } - - public void setClassName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlId.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlId.java deleted file mode 100644 index e79810c929..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlId.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaIdMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlId; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlId; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlId extends VirtualXmlId implements XmlId -{ - - public EclipseLinkVirtualXmlId(OrmTypeMapping ormTypeMapping, JavaIdMapping javaIdMapping) { - super(ormTypeMapping, javaIdMapping); - } - - public Boolean getMutable() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - return Boolean.valueOf(((EclipseLinkIdMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - public void setMutable(@SuppressWarnings("unused") Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getConvert() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - return ((Convert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - public void setConvert(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlConverter getConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkVirtualXmlConverter(this.ormTypeMapping, (CustomConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setConverter(@SuppressWarnings("unused") XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlObjectTypeConverter getObjectTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlObjectTypeConverter(this.ormTypeMapping, (ObjectTypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setObjectTypeConverter(@SuppressWarnings("unused") XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlStructConverter getStructConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkVirtualXmlStructConverter(this.ormTypeMapping, (StructConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setStructConverter(@SuppressWarnings("unused") XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlTypeConverter getTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlTypeConverter(this.ormTypeMapping, (TypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setTypeConverter(@SuppressWarnings("unused") XmlTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - - public TextRange getMutableTextRange() { - return null; - } - - public TextRange getConvertTextRange() { - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToMany.java deleted file mode 100644 index db318f3bcf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToMany.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToMany; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToMany; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlManyToMany extends VirtualXmlManyToMany implements XmlManyToMany -{ - - public EclipseLinkVirtualXmlManyToMany(OrmTypeMapping ormTypeMapping, JavaManyToManyMapping javaManyToManyMapping) { - super(ormTypeMapping, javaManyToManyMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaManyToManyMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToOne.java deleted file mode 100644 index ea91a20723..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlManyToOne.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlManyToOne; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlManyToOne; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlManyToOne extends VirtualXmlManyToOne implements XmlManyToOne -{ - - public EclipseLinkVirtualXmlManyToOne(OrmTypeMapping ormTypeMapping, JavaManyToOneMapping javaManyToOneMapping) { - super(ormTypeMapping, javaManyToOneMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaManyToOneMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java deleted file mode 100644 index 902c4599c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlObjectTypeConverter.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmPackage; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.utility.internal.CollectionTools; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlObjectTypeConverter extends AbstractJpaEObject implements XmlObjectTypeConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected ObjectTypeConverter javaConverter; - - public EclipseLinkVirtualXmlObjectTypeConverter(OrmTypeMapping ormTypeMapping, ObjectTypeConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getDataType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDataType(); - } - - public void setDataType(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getObjectType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getObjectType(); - } - - public void setObjectType(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getDefaultObjectValue() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDefaultObjectValue(); - } - - public void setDefaultObjectValue(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public EList<XmlConversionValue> getConversionValues() { - EList<XmlConversionValue> conversionValues = new EObjectContainmentEList<XmlConversionValue>(XmlConversionValue.class, this, EclipseLinkOrmPackage.XML_OBJECT_TYPE_CONVERTER__CONVERSION_VALUES); - if (isOrmMetadataComplete()) { - return conversionValues; - } - for (ConversionValue javaConversionValue : CollectionTools.iterable(this.javaConverter.conversionValues())) { - XmlConversionValue xmlConversionValue = new EclipseLinkVirtualXmlConversionValue(this.ormTypeMapping, javaConversionValue); - conversionValues.add(xmlConversionValue); - } - return conversionValues; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToMany.java deleted file mode 100644 index de32d62548..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToMany.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToMany; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToMany; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlOneToMany extends VirtualXmlOneToMany implements XmlOneToMany -{ - - public EclipseLinkVirtualXmlOneToMany(OrmTypeMapping ormTypeMapping, JavaOneToManyMapping javaOneToManyMapping) { - super(ormTypeMapping, javaOneToManyMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaOneToManyMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public boolean isPrivateOwned() { - if (isOrmMetadataComplete()) { - return false; - } - return ((EclipseLinkJavaOneToManyMappingImpl) this.javaAttributeMapping).getPrivateOwned().isPrivateOwned(); - } - - public void setPrivateOwned(@SuppressWarnings("unused") boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } - - public TextRange getPrivateOwnedTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToOne.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToOne.java deleted file mode 100644 index 016e602b15..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlOneToOne.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlOneToOne; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingImpl; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlJoinFetchType; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlOneToOne; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlOneToOne extends VirtualXmlOneToOne implements XmlOneToOne -{ - - public EclipseLinkVirtualXmlOneToOne(OrmTypeMapping ormTypeMapping, JavaOneToOneMapping javaOneToOneMapping) { - super(ormTypeMapping, javaOneToOneMapping); - } - - public XmlJoinFetchType getJoinFetch() { - if (isOrmMetadataComplete()) { - return JoinFetchType.toOrmResourceModel(JoinFetch.DEFAULT_VALUE); - } - return JoinFetchType.toOrmResourceModel(((EclipseLinkJavaOneToOneMappingImpl) this.javaAttributeMapping).getJoinFetch().getValue()); - } - - public void setJoinFetch(@SuppressWarnings("unused") XmlJoinFetchType value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public boolean isPrivateOwned() { - if (isOrmMetadataComplete()) { - return false; - } - return ((EclipseLinkJavaOneToOneMappingImpl) this.javaAttributeMapping).getPrivateOwned().isPrivateOwned(); - } - - public void setPrivateOwned(@SuppressWarnings("unused") boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getJoinFetchTextRange() { - return null; - } - - public TextRange getPrivateOwnedTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java deleted file mode 100644 index 037bb746c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlStructConverter.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlStructConverter extends AbstractJpaEObject implements XmlStructConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected StructConverter javaConverter; - - public EclipseLinkVirtualXmlStructConverter(OrmTypeMapping ormTypeMapping, StructConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getConverter() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getConverterClass(); - } - - public void setConverter(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java deleted file mode 100644 index f7ec01a1a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlTypeConverter.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.common.AbstractJpaEObject; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlTypeConverter extends AbstractJpaEObject implements XmlTypeConverter -{ - protected OrmTypeMapping ormTypeMapping; - - protected TypeConverter javaConverter; - - public EclipseLinkVirtualXmlTypeConverter(OrmTypeMapping ormTypeMapping, TypeConverter javaConverter) { - super(); - this.ormTypeMapping = ormTypeMapping; - this.javaConverter = javaConverter; - } - - protected boolean isOrmMetadataComplete() { - return this.ormTypeMapping.isMetadataComplete(); - } - - public String getName() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getName(); - } - - public void setName(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getDataType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getDataType(); - } - - public void setDataType(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getObjectType() { - if (isOrmMetadataComplete()) { - return null; - } - return this.javaConverter.getObjectType(); - } - - public void setObjectType(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlVersion.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlVersion.java deleted file mode 100644 index 02532e6aec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/EclipseLinkVirtualXmlVersion.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlVersion; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlStructConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTypeConverter; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlVersion; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class EclipseLinkVirtualXmlVersion extends VirtualXmlVersion implements XmlVersion -{ - - public EclipseLinkVirtualXmlVersion(OrmTypeMapping ormTypeMapping, JavaVersionMapping javaVersionMapping) { - super(ormTypeMapping, javaVersionMapping); - } - - public Boolean getMutable() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - return Boolean.valueOf(((EclipseLinkVersionMapping) this.javaAttributeMapping).getMutable().isMutable()); - } - - public void setMutable(@SuppressWarnings("unused") Boolean value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public String getConvert() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - return ((Convert) this.javaAttributeMapping.getConverter()).getConverterName(); - } - return null; - } - - public void setConvert(@SuppressWarnings("unused") String value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public TextRange getMutableTextRange() { - return null; - } - - public TextRange getConvertTextRange() { - return null; - } - - public XmlConverter getConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) { - return new EclipseLinkVirtualXmlConverter(this.ormTypeMapping, (CustomConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setConverter(@SuppressWarnings("unused") XmlConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlObjectTypeConverter getObjectTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlObjectTypeConverter(this.ormTypeMapping, (ObjectTypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setObjectTypeConverter(@SuppressWarnings("unused") XmlObjectTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlStructConverter getStructConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) { - return new EclipseLinkVirtualXmlStructConverter(this.ormTypeMapping, (StructConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setStructConverter(@SuppressWarnings("unused") XmlStructConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } - - public XmlTypeConverter getTypeConverter() { - //don't need isOrmMetadataComplete() check because there is no default Id mapping - if (this.javaAttributeMapping.getConverter().getType() == Convert.ECLIPSE_LINK_CONVERTER) { - EclipseLinkConverter converter = ((Convert) this.javaAttributeMapping.getConverter()).getConverter(); - if (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) { - return new EclipseLinkVirtualXmlTypeConverter(this.ormTypeMapping, (TypeConverter) ((Convert) this.javaAttributeMapping.getConverter()).getConverter()); - } - } - return null; - } - - public void setTypeConverter(@SuppressWarnings("unused") XmlTypeConverter value) { - throw new UnsupportedOperationException("cannot set values on a virtual mapping"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMapping.java deleted file mode 100644 index 3d7a588765..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMapping.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; - -public class OrmBasicCollectionMapping extends AbstractOrmAttributeMapping<XmlBasicCollection> implements BasicCollectionMapping -{ - - public OrmBasicCollectionMapping(OrmPersistentAttribute parent) { - super(parent); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlBasicCollection addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlBasicCollection basicCollection = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicCollectionImpl(); - getPersistentAttribute().initialize(basicCollection); - ((Attributes) typeMapping.getAttributes()).getBasicCollections().add(basicCollection); - return basicCollection; - } - - public void removeFromResourceModel(AbstractXmlTypeMapping typeMapping) { - ((Attributes) typeMapping.getAttributes()).getBasicCollections().remove(this.resourceAttributeMapping); - } - - public int getXmlSequence() { - return 23; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMappingProvider.java deleted file mode 100644 index 69f3f638cb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicCollectionMappingProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicCollectionMapping; - -public class OrmBasicCollectionMappingProvider - implements OrmAttributeMappingProvider -{ - - // singleton - private static final OrmBasicCollectionMappingProvider INSTANCE = new OrmBasicCollectionMappingProvider(); - - /** - * Return the singleton. - */ - public static OrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmBasicCollectionMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildOrmBasicCollectionMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildVirtualXmlBasicCollection(ormTypeMapping, (JavaBasicCollectionMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMapping.java deleted file mode 100644 index 6294f48e81..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMapping.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; - -public class OrmBasicMapMapping extends AbstractOrmAttributeMapping<XmlBasicMap> implements BasicMapMapping -{ - - public OrmBasicMapMapping(OrmPersistentAttribute parent) { - super(parent); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public XmlBasicMap addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlBasicMap basicMap = EclipseLinkOrmFactory.eINSTANCE.createXmlBasicMapImpl(); - getPersistentAttribute().initialize(basicMap); - ((Attributes) typeMapping.getAttributes()).getBasicMaps().add(basicMap); - return basicMap; - } - - public void removeFromResourceModel(AbstractXmlTypeMapping typeMapping) { - ((Attributes) typeMapping.getAttributes()).getBasicMaps().remove(this.resourceAttributeMapping); - } - - - public int getXmlSequence() { - return 27; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMappingProvider.java deleted file mode 100644 index 087f5c9cfc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmBasicMapMappingProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicMapMapping; - -public class OrmBasicMapMappingProvider - implements OrmAttributeMappingProvider -{ - - // singleton - private static final OrmBasicMapMappingProvider INSTANCE = new OrmBasicMapMappingProvider(); - - /** - * Return the singleton. - */ - public static OrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmBasicMapMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildOrmBasicMapMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildVirtualXmlBasicMap(ormTypeMapping, (JavaBasicMapMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMapping.java deleted file mode 100644 index 9c37b0bed5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMapping.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.core.resource.orm.AbstractXmlTypeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.TransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.Attributes; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -public class OrmTransformationMapping extends AbstractOrmAttributeMapping<XmlTransformation> implements TransformationMapping -{ - - public OrmTransformationMapping(OrmPersistentAttribute parent) { - super(parent); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlTransformation addToResourceModel(AbstractXmlTypeMapping typeMapping) { - XmlTransformation transformation = EclipseLinkOrmFactory.eINSTANCE.createXmlTransformationImpl(); - getPersistentAttribute().initialize(transformation); - ((Attributes) typeMapping.getAttributes()).getTransformations().add(transformation); - return transformation; - } - - public void removeFromResourceModel(AbstractXmlTypeMapping typeMapping) { - ((Attributes) typeMapping.getAttributes()).getTransformations().remove(this.resourceAttributeMapping); - } - - - public int getXmlSequence() { - return 85; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMappingProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMappingProvider.java deleted file mode 100644 index f156c2ca37..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmTransformationMappingProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.JpaFactory; -import org.eclipse.jpt.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.core.context.orm.OrmAttributeMappingProvider; -import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaTransformationMapping; - -public class OrmTransformationMappingProvider - implements OrmAttributeMappingProvider -{ - - // singleton - private static final OrmTransformationMappingProvider INSTANCE = new OrmTransformationMappingProvider(); - - /** - * Return the singleton. - */ - public static OrmAttributeMappingProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmTransformationMappingProvider() { - super(); - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public OrmAttributeMapping buildMapping(OrmPersistentAttribute parent, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildOrmTransformationMapping(parent); - } - - public XmlAttributeMapping buildVirtualResourceMapping(OrmTypeMapping ormTypeMapping, JavaAttributeMapping javaAttributeMapping, JpaFactory factory) { - return ((EclipseLinkJpaFactory) factory).buildVirtualXmlTransformation(ormTypeMapping, (JavaTransformationMapping) javaAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicCollection.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicCollection.java deleted file mode 100644 index 65eded5257..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicCollection.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicCollectionMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicCollection; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlBasicCollection extends VirtualXmlAttributeMapping<JavaBasicCollectionMapping> implements XmlBasicCollection -{ - - public VirtualXmlBasicCollection(OrmTypeMapping ormTypeMapping, JavaBasicCollectionMapping javaBasicCollectionMapping) { - super(ormTypeMapping, javaBasicCollectionMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicMap.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicMap.java deleted file mode 100644 index 34abe15de7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlBasicMap.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaBasicMapMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlBasicMap; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlBasicMap extends VirtualXmlAttributeMapping<JavaBasicMapMapping> implements XmlBasicMap -{ - - public VirtualXmlBasicMap(OrmTypeMapping ormTypeMapping, JavaBasicMapMapping javaBasicMapMappingg) { - super(ormTypeMapping, javaBasicMapMappingg); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlTransformation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlTransformation.java deleted file mode 100644 index db4ae6ecb0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/VirtualXmlTransformation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.orm; - -import org.eclipse.jpt.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.VirtualXmlAttributeMapping; -import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaTransformationMapping; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlTransformation; - -/** - * VirtualBasic is an implementation of Basic used when there is - * no tag in the orm.xml and an underlying javaBasicMapping exists. - */ -public class VirtualXmlTransformation extends VirtualXmlAttributeMapping<JavaTransformationMapping> implements XmlTransformation -{ - - public VirtualXmlTransformation(OrmTypeMapping ormTypeMapping, JavaTransformationMapping javaTransformationMapping) { - super(ormTypeMapping, javaTransformationMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkImpliedMappingFileRef.java deleted file mode 100644 index 93566046e8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkImpliedMappingFileRef.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.GenericMappingFileRef; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; - -/** - * Currently, this class is only used for implied eclipselink mapping files - */ -public class EclipseLinkImpliedMappingFileRef extends GenericMappingFileRef -{ - public EclipseLinkImpliedMappingFileRef(PersistenceUnit parent) { - super(parent, null); - } - - - @Override - protected void initializeFileName() { - fileName = JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH; - } - - @Override - protected void updateFileName() { - setFileName_(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH); - } -} 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 deleted file mode 100644 index 42bf7f5e2d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java +++ /dev/null @@ -1,341 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; -import org.eclipse.jpt.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.core.context.persistence.Persistence; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit; -import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.Caching; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.EclipseLinkConnection; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.EclipseLinkCustomization; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.general.EclipseLinkGeneralProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.general.GeneralProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.EclipseLinkLogging; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.EclipseLinkOptions; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.options.Options; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.EclipseLinkSchemaGeneration; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration; -import org.eclipse.jpt.eclipselink.core.internal.resource.orm.EclipseLinkOrmResourceModelProvider; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmResource; -import org.eclipse.jpt.utility.internal.CollectionTools; -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.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * EclipseLinkPersistenceUnit - */ -public class EclipseLinkPersistenceUnit extends AbstractPersistenceUnit -{ - protected MappingFileRef impliedEclipseLinkMappingFileRef; - - private GeneralProperties generalProperties; - private Connection connection; - private Customization customization; - private Caching caching; - private Logging logging; - private Options options; - private SchemaGeneration schemaGeneration; - - private final ListValueModel<Property> propertiesAdapter; - private final ListValueModel<Property> propertyListAdapter; - - /* global converter definitions, defined elsewhere in model */ - protected final List<EclipseLinkConverter> converters = new ArrayList<EclipseLinkConverter>(); - - - public EclipseLinkPersistenceUnit(Persistence parent, XmlPersistenceUnit persistenceUnit) { - super(parent); - this.propertiesAdapter = this.buildPropertiesAdapter(); - this.propertyListAdapter = this.buildPropertyListAdapter(this.propertiesAdapter); - this.initialize(persistenceUnit); - } - - @Override - protected void initializeProperties(XmlPersistenceUnit xpu) { - super.initializeProperties(xpu); - this.generalProperties = new EclipseLinkGeneralProperties(this, this.propertyListAdapter); - this.connection = new EclipseLinkConnection(this, this.propertyListAdapter); - this.customization = new EclipseLinkCustomization(this, this.propertyListAdapter); - this.caching = new EclipseLinkCaching(this, this.propertyListAdapter); - this.logging = new EclipseLinkLogging(this, this.propertyListAdapter); - this.options = new EclipseLinkOptions(this, this.propertyListAdapter); - this.schemaGeneration = new EclipseLinkSchemaGeneration(this, this.propertyListAdapter); - } - // ********** internal methods ********** - - private ListValueModel<Property> buildPropertyListAdapter(ListValueModel<Property> propertiesAdapter) { - return new ItemPropertyListValueModelAdapter<Property>(propertiesAdapter, Property.VALUE_PROPERTY); - } - - private ListValueModel<Property> buildPropertiesAdapter() { - return new ListAspectAdapter<PersistenceUnit, Property>(new SimplePropertyValueModel<PersistenceUnit>(this), PersistenceUnit.PROPERTIES_LIST) { - @Override - protected ListIterator<Property> listIterator_() { - return this.subject.properties(); - } - - @Override - protected int size_() { - return this.subject.propertiesSize(); - } - }; - } - - @Override - protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) { - super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNames.add(CONVERTERS_LIST); - } - - - // **************** mapping file refs ************************************** - - @Override - public ListIterator<MappingFileRef> mappingFileRefs() { - if (impliedEclipseLinkMappingFileRef == null) { - return super.mappingFileRefs(); - } - return new ReadOnlyCompositeListIterator<MappingFileRef>( - super.mappingFileRefs(), impliedEclipseLinkMappingFileRef); - } - - @Override - public int mappingFileRefsSize() { - if (impliedEclipseLinkMappingFileRef == null) { - return super.mappingFileRefsSize(); - } - return 1 + super.mappingFileRefsSize(); - } - - - // **************** implied eclipselink mapping file ref ******************* - - /** - * String constant associated with changes to the implied eclipselink mapping file ref - */ - public final static String IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY = "impliedEclipseLinkMappingFileRef"; //$NON-NLS-1$ - - - public MappingFileRef getImpliedEclipseLinkMappingFileRef() { - return impliedEclipseLinkMappingFileRef; - } - - protected MappingFileRef setImpliedEclipseLinkMappingFileRef() { - if (impliedEclipseLinkMappingFileRef != null) { - throw new IllegalStateException("The implied eclipselink mapping file ref is already set."); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = new EclipseLinkImpliedMappingFileRef(this); - impliedEclipseLinkMappingFileRef = mappingFileRef; - firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef); - return mappingFileRef; - } - - protected void unsetImpliedEclipseLinkMappingFileRef() { - if (impliedEclipseLinkMappingFileRef == null) { - throw new IllegalStateException("The implied eclipselink mapping file ref is already unset."); //$NON-NLS-1$ - } - MappingFileRef mappingFileRef = impliedEclipseLinkMappingFileRef; - impliedEclipseLinkMappingFileRef.dispose(); - impliedEclipseLinkMappingFileRef = null; - firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null); - } - - - // **************** properties ********************************************* - - public GeneralProperties getGeneralProperties() { - return this.generalProperties; - } - - public Connection getConnection() { - return this.connection; - } - - public Customization getCustomization() { - return this.customization; - } - - public Caching getCaching() { - return this.caching; - } - - public Logging getLogging() { - return this.logging; - } - - public Options getOptions() { - return this.options; - } - - public SchemaGeneration getSchemaGeneration() { - return this.schemaGeneration; - } - - - public ListValueModel<Property> getPropertiesAdapter() { - return this.propertiesAdapter; - } - - public ListValueModel<Property> getPropertyListAdapter() { - return this.propertyListAdapter; - } - - - // **************** converters ********************************************* - - /** - * Identifier for changes to the list of global converter definitions. - * Note that there are no granular changes to this list. There is only - * notification that the entire list has changed. - */ - public static final String CONVERTERS_LIST = "converters"; //$NON-NLS-1$ - - /** - * Add the converter definition (defined elsewhere) to the list of converters - * defined within this persistence unit. - * Note that this should only be called during the process of updating the - * local converter definition. - * No change notification accompanies this action specifically. - */ - public void addConverter(EclipseLinkConverter converter) { - this.converters.add(converter); - } - - /** - * Return an iterator on all converters defined within this persistence unit, - * included duplicately named converters definitions. - */ - public ListIterator<EclipseLinkConverter> allConverters() { - return new CloneListIterator<EclipseLinkConverter>(this.converters); - } - - /** - * Return an array of the names of the converters defined in the persistence - * unit, with duplicates removed. - */ - public String[] uniqueConverterNames() { - HashSet<String> names = CollectionTools.set(this.allNonNullConverterNames()); - return names.toArray(new String[names.size()]); - } - - protected Iterator<String> allNonNullConverterNames() { - return new FilteringIterator<String, String>(this.allConverterNames()) { - @Override - protected boolean accept(String converterName) { - return converterName != null; - } - }; - } - - protected Iterator<String> allConverterNames() { - return new TransformationIterator<EclipseLinkConverter, String>(this.allConverters()) { - @Override - protected String transform(EclipseLinkConverter converter) { - return converter.getName(); - } - }; - } - - - // **************** updating *********************************************** - - @Override - public void update(XmlPersistenceUnit persistenceUnit) { - this.converters.clear(); - super.update(persistenceUnit); - convertersUpdated(); - } - - @Override - protected void initializeMappingFileRefs(XmlPersistenceUnit xpu) { - super.initializeMappingFileRefs(xpu); - - // use implied mapping file if - // a) properties does not exclude it - // b) it isn't otherwise specified - // c) the file actually exists - if (! impliedEclipseLinkMappingFileIsExcluded() - && ! impliedEclipseLinkMappingFileIsSpecified() - && impliedEclipseLinkMappingFileExists()) { - - impliedEclipseLinkMappingFileRef = new EclipseLinkImpliedMappingFileRef(this); - } - } - - @Override - protected void updateMappingFileRefs(XmlPersistenceUnit persistenceUnit) { - super.updateMappingFileRefs(persistenceUnit); - - // use implied mapping file if - // a) properties does not exclude it - // b) it isn't otherwise specified - // c) the file actually exists - if (! impliedEclipseLinkMappingFileIsExcluded() - && ! impliedEclipseLinkMappingFileIsSpecified() - && impliedEclipseLinkMappingFileExists()) { - - if (impliedEclipseLinkMappingFileRef == null) { - setImpliedEclipseLinkMappingFileRef(); - } - getImpliedEclipseLinkMappingFileRef().update(null); - } - else if (impliedEclipseLinkMappingFileRef != null) { - unsetImpliedEclipseLinkMappingFileRef(); - } - } - - protected boolean impliedEclipseLinkMappingFileIsExcluded() { - return getGeneralProperties().getExcludeEclipselinkOrm() == Boolean.TRUE; - } - - protected boolean impliedEclipseLinkMappingFileIsSpecified() { - String impliedMappingFile = JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH; - for (Iterator<MappingFileRef> stream = specifiedMappingFileRefs(); stream.hasNext(); ) { - if (impliedMappingFile.equals(stream.next().getFileName())) { - return true; - } - } - return false; - } - - protected boolean impliedEclipseLinkMappingFileExists() { - EclipseLinkOrmResourceModelProvider modelProvider = - EclipseLinkOrmResourceModelProvider.getDefaultModelProvider(getJpaProject().getProject()); - EclipseLinkOrmResource resource = modelProvider.getResource(); - return resource != null && resource.exists(); - } - - // This is called after the persistence unit has been updated to ensure - // we catch all added converters - protected void convertersUpdated() { - fireListChanged(CONVERTERS_LIST); - } -}
\ 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/EclipseLinkPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java deleted file mode 100644 index f760941f26..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java +++ /dev/null @@ -1,469 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -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 - * - * Listens to the propertyListAdapter - */ -public abstract class EclipseLinkPersistenceUnitProperties extends AbstractModel - implements PersistenceUnitProperties -{ - 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<Property> propertyListAdapter) { - super(); - this.initialize(parent, propertyListAdapter); - } - - protected void initialize( - PersistenceUnit parent, - ListValueModel<Property> propertyListAdapter) { - this.persistenceUnit = parent; - - this.propertyListListener = new PersistenceUnitPropertyListListener(this); - propertyListAdapter.addListChangeListener(ListValueModel.LIST_VALUES, this.propertyListListener); - - this.initializePropertyNames(); - this.initializeProperties(); - } - - protected void initializePropertyNames() { - this.propertyNames = new HashMap<String, String>(); - this.addPropertyNames(this.propertyNames); - } - - /** - * Initializes properties with values from the persistence unit. - */ - protected abstract void initializeProperties(); - - // ********** behavior ********** - public PersistenceUnit getPersistenceUnit() { - return this.persistenceUnit; - } - - public JpaProject getJpaProject() { - return this.persistenceUnit.getJpaProject(); - } - - public PersistenceUnitPropertyListListener propertyListListener() { - return this.propertyListListener; - } - - private Map<String, String> propertyNames() { - return this.propertyNames; - } - - /** - * Adds property names key/value pairs, used by the methods: itemIsProperty - * and propertyIdFor. - * - * key = EclipseLink property key; value = property id - */ - protected abstract void addPropertyNames(Map<String, String> propertyNames); - - /** - * Method used for identifying the given property. - */ - public boolean itemIsProperty(Property item) { - if (item == null) { - throw new IllegalArgumentException("Property is null"); - } - return this.propertyNames().keySet().contains(item.getName()); - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - public String propertyIdFor(Property property) { - String propertyId = this.propertyNames().get(property.getName()); - if (propertyId == null) { - throw new IllegalArgumentException("Illegal property: " + property.toString()); - } - return propertyId; - } - - protected String eclipseLinkKeyFor(String propertyId) { - for (String eclipseLinkKey : this.propertyNames().keySet()) { - if (this.propertyNames().get(eclipseLinkKey).equals(propertyId)) { - return eclipseLinkKey; - } - } - throw new IllegalArgumentException("Illegal property: " + propertyId); - } - - // ****** get/set String convenience methods ******* - /** - * Returns the String value of the given Property from the PersistenceXml. - */ - protected String getStringValue(String elKey) { - return this.getStringValue(elKey, null); - } - - protected String getStringValue(String key, String keySuffix) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - // TOREVIEW - handle incorrect String in persistence.xml - return this.getPersistenceUnit().getProperty(elKey).getValue(); - } - return null; - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - - * EclipseLink Key - * @param newValue - * value to be associated with the key - */ - protected void putStringValue(String key, String newValue) { - this.putStringValue(key, null, newValue, false); - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putStringValue(String key, String newValue, boolean allowDuplicate) { - this.putStringValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putStringValue(String key, String keySuffix, String newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, newValue, allowDuplicate); - } - } - - // ****** Integer convenience methods ******* - /** - * Returns the Integer value of the given Property from the PersistenceXml. - */ - protected Integer getIntegerValue(String elKey) { - return this.getIntegerValue(elKey, null); - } - - protected Integer getIntegerValue(String key, String keySuffix) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - String eclipseLinkValue = this.getPersistenceUnit().getProperty(elKey).getValue(); - // TOREVIEW - handle incorrect eclipseLinkValue String in - // persistence.xml - return getIntegerValueOf(eclipseLinkValue); - } - return null; - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - - * EclipseLink Key - * @param newValue - * value to be associated with the key - */ - protected void putIntegerValue(String key, Integer newValue) { - this.putIntegerValue(key, null, newValue, false); - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putIntegerValue(String key, Integer newValue, boolean allowDuplicate) { - this.putIntegerValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putIntegerValue(String key, String keySuffix, Integer newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, newValue.toString(), allowDuplicate); - } - } - - // ****** Boolean convenience methods ******* - /** - * Returns the Boolean value of the given Property from the PersistenceXml. - */ - protected Boolean getBooleanValue(String elKey) { - return this.getBooleanValue(elKey, null); - } - - /** - * Returns the Boolean value of the given Property from the PersistenceXml. - */ - protected Boolean getBooleanValue(String key, String keySuffix) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - String eclipseLinkValue = this.getPersistenceUnit().getProperty(elKey).getValue(); - // TOREVIEW - handle incorrect eclipseLinkValue String in - // persistence.xml - return getBooleanValueOf(eclipseLinkValue); - } - return null; - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - */ - protected void putBooleanValue(String key, Boolean newValue) { - this.putBooleanValue(key, null, newValue, false); - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putBooleanValue(String key, Boolean newValue, boolean allowDuplicate) { - this.putBooleanValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * EclipseLink Key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putBooleanValue(String key, String keySuffix, Boolean newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, newValue.toString(), allowDuplicate); - } - } - - // ****** Enum convenience methods ******* - /** - * Returns the Enum value of the given Property from the PersistenceXml. - */ - protected <T extends Enum<T>> T getEnumValue(String elKey, T[] enumValues) { - return getEnumValue(elKey, null, enumValues); - } - - protected <T extends Enum<T>> T getEnumValue(String key, String keySuffix, T[] enumValues) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (this.getPersistenceUnit().containsProperty(elKey)) { - String elStringValue = this.getPersistenceUnit().getProperty(elKey).getValue(); - // TOREVIEW - handle incorrect eclipseLinkValue String in persistence.xml - return getEnumValueOf(elStringValue, enumValues); - } - return null; - } - - /** - * Put the given Enum value into the PersistenceXml. - * - * @param key - - * EclipseLink Key - */ - protected <T extends Enum<T>> void putEnumValue(String key, T newValue) { - this.putEnumValue(key, null, newValue, false); - } - - protected <T extends Enum<T>> void putEnumValue(String key, T newValue, boolean allowDuplicate) { - this.putEnumValue(key, null, newValue, allowDuplicate); - } - - protected <T extends Enum<T>> void putEnumValue(String key, String keySuffix, T newValue, boolean allowDuplicate) { - String elKey = (keySuffix == null) ? key : key + keySuffix; - if (newValue == null) { - this.getPersistenceUnit().removeProperty(elKey); - } - else { - this.getPersistenceUnit().putProperty(elKey, getEclipseLinkStringValueOf(newValue), allowDuplicate); - } - } - - // ******** Convenience methods ******** - /** - * Put into persistenceUnit properties. - * - * @param key - - * property name - * @param value - - * property value - */ - protected void putProperty(String key, Object value) { - putProperty(key, value, false); - } - - @SuppressWarnings("unchecked") - protected void putProperty(String key, Object value, boolean allowDuplicates) { - String elKey = this.eclipseLinkKeyFor(key); - if (value == null) - this.removeEclipseLinkProperty(elKey); - else if (value.getClass().isEnum()) - this.putEnumValue(elKey, (Enum) value, allowDuplicates); - else - this.putEclipseLinkProperty(elKey, value, allowDuplicates); - } - - private void putEclipseLinkProperty(String key, Object value, boolean allowDuplicates) { - this.getPersistenceUnit().putProperty(key, value.toString(), allowDuplicates); - } - - /** - * Removes a property with the given EclipseLink key. - * - * @param elKey - - * EclipseLink key - */ - private void removeEclipseLinkProperty(String elKey) { - this.getPersistenceUnit().removeProperty(elKey); - } - - /** - * Removes a persistenceUnit property. - * - * @param key - - * property name - * @param value - - * property value - */ - protected void removeProperty(String key, String value) { - String elKey = this.eclipseLinkKeyFor(key); - - this.getPersistenceUnit().removeProperty(elKey, value); - } - - protected Set<Property> getPropertiesSetWithPrefix(String keyPrefix) { - return CollectionTools.set(this.getPersistenceUnit().propertiesWithPrefix(keyPrefix)); - } - - /** - * Extracts the entityName of the specified property name. If the property name - * has no suffix, return an empty string. - */ - protected String getEntityName(Property property) { - return getEntityName(property.getName()); - } - - /** - * Extracts the entityName of the specified string. If the string - * has no suffix, return an empty string. - */ - protected String getEntityName(String propertyName) { - int index = propertyName.lastIndexOf('.'); - if (index == -1) { - return ""; - } - return propertyName.substring(index + 1); - } - - // ****** Static methods ******* - /** - * Returns the EclipseLink string value for the given property value. - */ - public static String getEclipseLinkStringValueOf(Object value) { - - if (value.getClass().isEnum()) { - return (String) ClassTools.staticFieldValue(value.getClass(), value.toString().toUpperCase()); - } - return value.toString(); - } - - /** - * Returns the enum constant of the specified enum type with the specified - * EclipseLink value string. - */ - public static <T extends Enum<T>> T getEnumValueOf(String elStringValue, T[] enumValues) { - for (T enumValue : enumValues) { - if (getEclipseLinkStringValueOf(enumValue).equals(elStringValue)) { - return enumValue; - } - } - return null; - } - - public static Boolean getBooleanValueOf(String elStringValue) { - if (elStringValue == null) { - return null; - } - return Boolean.valueOf(elStringValue); - } - - public static Integer getIntegerValueOf(String elStringValue) { - if (elStringValue == null) { - return null; - } - return Integer.valueOf(elStringValue); - } -} 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 deleted file mode 100644 index 14078bc7a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitProperties.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.utility.model.Model; -import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; - -/** - * PersistenceUnitProperties - */ -public interface PersistenceUnitProperties extends Model, PropertyChangeListener -{ - /** - * Method used for identifying the given property. - */ - boolean itemIsProperty(Property item); - - /** - * Returns the property name used for change notification of the given property. - */ - String propertyIdFor(Property property); - - /** - * Return the PersistenceUnit of this Properties. - */ - PersistenceUnit getPersistenceUnit(); - - /** - * Return the JPA project the PersistenceUnit belongs to. - */ - JpaProject getJpaProject(); -}
\ 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 6e744c4dc3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/PersistenceUnitPropertyListListener.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence; - -import java.util.Iterator; -import org.eclipse.jpt.core.context.persistence.Property; -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(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(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 Property set(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<Property> stream = this.items(e); stream.hasNext();) { - this.add(stream.next(), e.getSource()); - } - } - - public void itemsRemoved(ListChangeEvent e) { - for (Iterator<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<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<Property> items(ListChangeEvent event) { - return (Iterator<Property>) event.items(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheProperties.java deleted file mode 100644 index c06dec92e8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheProperties.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching; - -import java.io.Serializable; -import org.eclipse.jpt.utility.internal.StringTools; - -/** - * CacheProperties - */ -public class CacheProperties implements Cloneable, Serializable -{ - private String entityName; - - // ********** EclipseLink properties ********** - private CacheType type; - private Integer size; - private Boolean isShared; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public CacheProperties(String entityName) { - this.entityName = entityName; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - CacheProperties cache = (CacheProperties) o; - return ( - (this.type == null ? - cache.type == null : this.type.equals(cache.type)) && - (this.isShared == null ? - cache.isShared == null : this.isShared.equals(cache.isShared)) && - (this.size == null ? - cache.size == null : this.size.equals(cache.size))); - } - - @Override - public synchronized CacheProperties clone() { - try { - return (CacheProperties)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return (this.type == null) && - (this.size == null) && - (this.isShared == null); - } - - // ********** getter/setter ********** - public String getEntityName() { - return entityName; - } - - public CacheType getType() { - return this.type; - } - - public void setType(CacheType cacheType) { - this.type = cacheType; - } - - public Integer getSize() { - return this.size; - } - - public void setSize(Integer cacheSize) { - this.size = cacheSize; - } - - public Boolean isShared() { - return this.isShared; - } - - public void setShared(Boolean isShared) { - this.isShared = isShared; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append(" ("); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - - public void toString(StringBuilder sb) { - sb.append("type: "); - sb.append(this.type); - sb.append(", size: "); - sb.append(this.size); - sb.append(", isShared: "); - sb.append(this.isShared); - sb.append(", entityName: "); - sb.append(this.entityName); - } -}
\ 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/caching/CacheType.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheType.java deleted file mode 100644 index 0c66da4968..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/CacheType.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching; - -/** - * CacheType - */ -public enum CacheType { - soft_weak, - hard_weak, - weak, - soft, - full, - none; - - // EclipseLink value string - public static final String FULL = "Full"; - public static final String HARD_WEAK = "HardWeak"; - public static final String NONE = "NONE"; - public static final String SOFT = "Soft"; - public static final String SOFT_WEAK = "SoftWeak"; - public static final String WEAK = "Weak"; -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java deleted file mode 100644 index 1c4cac45ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/Caching.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching; - -import java.util.ListIterator; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Caching - */ -public interface Caching extends PersistenceUnitProperties -{ - CacheType getDefaultCacheTypeDefault(); - CacheType getCacheTypeDefault(); - void setCacheTypeDefault(CacheType cacheTypeDefault); - static final String CACHE_TYPE_DEFAULT_PROPERTY = "cacheTypeDefaultProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_TYPE_DEFAULT = "eclipselink.cache.type.default"; - static final CacheType DEFAULT_CACHE_TYPE_DEFAULT = CacheType.soft_weak; - - Integer getDefaultCacheSizeDefault(); - Integer getCacheSizeDefault(); - void setCacheSizeDefault(Integer cacheSizeDefault); - static final String CACHE_SIZE_DEFAULT_PROPERTY = "cacheSizeDefaultProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_SIZE_DEFAULT = "eclipselink.cache.size.default"; - static final Integer DEFAULT_CACHE_SIZE_DEFAULT = Integer.valueOf(100); - - Boolean getDefaultSharedCacheDefault(); - Boolean getSharedCacheDefault(); - void setSharedCacheDefault(Boolean sharedCacheDefault); - static final String SHARED_CACHE_DEFAULT_PROPERTY = "sharedCacheDefaultProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_SHARED_DEFAULT = "eclipselink.cache.shared.default"; - static final Boolean DEFAULT_SHARED_CACHE_DEFAULT = Boolean.TRUE; - - - CacheType getDefaultCacheType(); - CacheType getCacheType(String entityName); - void setCacheType(CacheType cacheType, String entityName); - static final String CACHE_TYPE_PROPERTY = "cacheTypeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_TYPE = "eclipselink.cache.type."; - static final CacheType DEFAULT_CACHE_TYPE = CacheType.soft_weak; - - Integer getDefaultCacheSize(); - Integer getCacheSize(String entityName); - void setCacheSize(Integer cacheSize, String entityName); - static final String CACHE_SIZE_PROPERTY = "cacheSizeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_SIZE = "eclipselink.cache.size."; - static final Integer DEFAULT_CACHE_SIZE = Integer.valueOf(100); - - Boolean getDefaultSharedCache(); - Boolean getSharedCache(String entityName); - void setSharedCache(Boolean sharedCache, String entityName); - static final String SHARED_CACHE_PROPERTY = "sharedCacheProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SHARED_CACHE = "eclipselink.cache.shared."; - static final Boolean DEFAULT_SHARED_CACHE = Boolean.TRUE; - - - ListIterator<String> entities(); - int entitiesSize(); - boolean entityExists(String entity); - String addEntity(String entity); - void removeEntity(String entity); - String ENTITIES_LIST_PROPERTY = "entitiesListProperty"; - -} 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 deleted file mode 100644 index 1252760ab1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java +++ /dev/null @@ -1,492 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching; - -import java.util.HashMap; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -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. - */ -public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties - implements Caching -{ - // ********** EclipseLink properties ********** - private CacheType cacheTypeDefault; - private Integer cacheSizeDefault; - private Boolean sharedCacheDefault; - - // key = Entity name ; value = Cache properties - private Map<String, CacheProperties> entitiesCacheProperties; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public EclipseLinkCaching(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.entitiesCacheProperties = - new HashMap<String, CacheProperties>(); - this.cacheTypeDefault = - this.getEnumValue(ECLIPSELINK_CACHE_TYPE_DEFAULT, CacheType.values()); - this.cacheSizeDefault = - this.getIntegerValue(ECLIPSELINK_CACHE_SIZE_DEFAULT); - this.sharedCacheDefault = - this.getBooleanValue(ECLIPSELINK_CACHE_SHARED_DEFAULT); - - Set<Property> cacheTypeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_TYPE); - Set<Property> cacheSizeProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_CACHE_SIZE); - Set<Property> sharedCacheProperties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_SHARED_CACHE); - - this.initializeEntitiesCacheType(cacheTypeProperties); - this.initializeEntitiesCacheSize(cacheSizeProperties); - this.initializeEntitiesSharedCache(sharedCacheProperties); - } - - private void initializeEntitiesCacheType(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - CacheType cacheType = getEnumValueOf(property.getValue(), CacheType.values()); - this.setCacheType_(cacheType, entityName); - } - } - - private void initializeEntitiesCacheSize(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - this.setCacheSize_(property, entityName); - } - } - - private void initializeEntitiesSharedCache(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - this.setSharedCache_(property, entityName); - } - } - - // ********** behavior ********** - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key; - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_CACHE_TYPE_DEFAULT, - CACHE_TYPE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_SIZE_DEFAULT, - CACHE_SIZE_DEFAULT_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_SHARED_DEFAULT, - SHARED_CACHE_DEFAULT_PROPERTY); - - // Don't need to initialize propertyNames for: - // cacheType, sharedCache, cacheSize - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(Property item) { - boolean isProperty = super.itemIsProperty(item); - - if ( ! isProperty && item.getName() != null) { - if (item.getName().startsWith(ECLIPSELINK_CACHE_TYPE) || - item.getName().startsWith(ECLIPSELINK_CACHE_SIZE) || - item.getName().startsWith(ECLIPSELINK_SHARED_CACHE)) { - return true; - } - } - return isProperty; - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - @Override - public String propertyIdFor(Property property) { - try { - return super.propertyIdFor(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_CACHE_TYPE)) { - return CACHE_TYPE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_CACHE_SIZE)) { - return CACHE_SIZE_PROPERTY; - } - else if (property.getName().startsWith(ECLIPSELINK_SHARED_CACHE)) { - return SHARED_CACHE_PROPERTY; - } - } - 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 { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - // ********** CacheType ********** - public CacheType getCacheType(String entityName) { - CacheProperties cache = this.cachePropertiesOf(entityName); - return (cache == null) ? null : cache.getType(); - } - - public void setCacheType(CacheType newCacheType, String entityName) { - CacheProperties old = this.setCacheType_(newCacheType, entityName); - this.putEnumValue(ECLIPSELINK_CACHE_TYPE, entityName, newCacheType, false); - this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, this.cachePropertiesOf(entityName)); - } - - private void cacheTypeChanged(PropertyChangeEvent event) { - Property property = (Property) event.getNewValue(); - // property == null when removed - String entityName = (property == null) ? this.getEntityName((Property) event.getOldValue()) : this.getEntityName(property); - CacheProperties old = this.setCacheType_(property, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName)); - } - - public CacheType getDefaultCacheType() { - return (this.cacheTypeDefault == null) ? DEFAULT_CACHE_TYPE : this.cacheTypeDefault; - } - - // ********** CacheSize ********** - public Integer getCacheSize(String entityName) { - CacheProperties cache = this.cachePropertiesOf(entityName); - return (cache == null) ? null : cache.getSize(); - } - - public void setCacheSize(Integer newCacheSize, String entityName) { - CacheProperties old = this.setCacheSize_(newCacheSize, entityName); - this.putIntegerValue(ECLIPSELINK_CACHE_SIZE + entityName, newCacheSize); - this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, this.cachePropertiesOf(entityName)); - } - - private void cacheSizeChanged(PropertyChangeEvent event) { - Property property = (Property) event.getNewValue(); - // property == null when removed - String entityName = (property == null) ? this.getEntityName((Property) event.getOldValue()) : this.getEntityName(property); - CacheProperties old = this.setCacheSize_(property, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName)); - } - - public Integer getDefaultCacheSize() { - return (this.cacheSizeDefault == null) ? DEFAULT_CACHE_SIZE : this.cacheSizeDefault; - } - - // ********** SharedCache ********** - public Boolean getSharedCache(String entityName) { - CacheProperties cache = this.cachePropertiesOf(entityName); - return (cache == null) ? null : cache.isShared(); - } - - public void setSharedCache(Boolean newSharedCache, String entityName) { - CacheProperties old = this.setSharedCache_(newSharedCache, entityName); - this.putBooleanValue(ECLIPSELINK_SHARED_CACHE, entityName, newSharedCache, false); - this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, this.cachePropertiesOf(entityName)); - } - - private void sharedCacheChanged(PropertyChangeEvent event) { - String entityName; - Property newProperty = (Property) event.getNewValue(); - // property == null when removed - entityName = (newProperty == null) ? - this.getEntityName((Property) event.getOldValue()) : this.getEntityName(newProperty); - CacheProperties old = this.setSharedCache_(newProperty, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.cachePropertiesOf(entityName)); - } - - public Boolean getDefaultSharedCache() { - return (this.sharedCacheDefault == null) ? DEFAULT_SHARED_CACHE : this.sharedCacheDefault; - } - - // ********** CacheTypeDefault ********** - public CacheType getCacheTypeDefault() { - return this.cacheTypeDefault; - } - - public void setCacheTypeDefault(CacheType newCacheTypeDefault) { - CacheType old = this.cacheTypeDefault; - this.cacheTypeDefault = newCacheTypeDefault; - this.putProperty(CACHE_TYPE_DEFAULT_PROPERTY, newCacheTypeDefault); - this.firePropertyChanged(CACHE_TYPE_DEFAULT_PROPERTY, old, newCacheTypeDefault); - } - - private void cacheTypeDefaultChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - CacheType old = this.cacheTypeDefault; - this.cacheTypeDefault = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public CacheType getDefaultCacheTypeDefault() { - return DEFAULT_CACHE_TYPE_DEFAULT; - } - - // ********** CacheSizeDefault ********** - public Integer getCacheSizeDefault() { - return this.cacheSizeDefault; - } - - public void setCacheSizeDefault(Integer newCacheSizeDefault) { - Integer old = this.cacheSizeDefault; - this.cacheSizeDefault = newCacheSizeDefault; - this.putProperty(CACHE_SIZE_DEFAULT_PROPERTY, newCacheSizeDefault); - this.firePropertyChanged(CACHE_SIZE_DEFAULT_PROPERTY, old, newCacheSizeDefault); - } - - private void cacheSizeDefaultChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - Integer old = this.cacheSizeDefault; - this.cacheSizeDefault = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultCacheSizeDefault() { - return DEFAULT_CACHE_SIZE_DEFAULT; - } - - // ********** SharedCacheDefault ********** - public Boolean getSharedCacheDefault() { - return this.sharedCacheDefault; - } - - public void setSharedCacheDefault(Boolean newSharedCacheDefault) { - Boolean old = this.sharedCacheDefault; - this.sharedCacheDefault = newSharedCacheDefault; - this.putProperty(SHARED_CACHE_DEFAULT_PROPERTY, newSharedCacheDefault); - this.firePropertyChanged(SHARED_CACHE_DEFAULT_PROPERTY, old, newSharedCacheDefault); - } - - private void sharedCacheDefaultChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.sharedCacheDefault; - this.sharedCacheDefault = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultSharedCacheDefault() { - return DEFAULT_SHARED_CACHE_DEFAULT; - } - - // ****** CacheProperties ******* - /** - * Convenience method to update the CacheType in entitiesCache map. Returns - * the old value of CacheProperties - */ - private CacheProperties setCacheType_(Property newProperty, String entityName) { - String stringValue = (newProperty == null) ? null : newProperty.getValue(); - CacheType newValue = getEnumValueOf(stringValue, CacheType.values()); - return this.setCacheType_(newValue, entityName); - } - - private CacheProperties setCacheType_(CacheType newValue, String entityName) { - CacheProperties properties = this.cachePropertiesOf(entityName); - CacheProperties old = properties.clone(); - properties.setType(newValue); - this.putEntityCacheProperties(entityName, properties); - return old; - } - - /** - * Convenience method to update the CacheSize in entitiesCache map. Returns - * the old value of CacheProperties - */ - private CacheProperties setCacheSize_(Property newProperty, String entityName) { - String stringValue = (newProperty == null) ? null : newProperty.getValue(); - Integer newValue = getIntegerValueOf(stringValue); - return this.setCacheSize_(newValue, entityName); - } - - private CacheProperties setCacheSize_(Integer newValue, String entityName) { - CacheProperties properties = this.cachePropertiesOf(entityName); - CacheProperties old = properties.clone(); - properties.setSize(newValue); - this.putEntityCacheProperties(entityName, properties); - return old; - } - - /** - * Convenience method to update the SharedCache in entitiesCacheProperties map. - * Returns the old value of CacheProperties - */ - private CacheProperties setSharedCache_(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); - } - - private CacheProperties setSharedCache_(Boolean newValue, String entityName) { - CacheProperties properties = this.cachePropertiesOf(entityName); - CacheProperties old = properties.clone(); - properties.setShared(newValue); - this.putEntityCacheProperties(entityName, properties); - return old; - } - - /** - * Returns the CacheProperties of the Entity with the given name. - */ - private CacheProperties cachePropertiesOf(String entityName) { - CacheProperties properties = this.entitiesCacheProperties.get(entityName); - if (properties == null) { - properties = new CacheProperties(entityName); - } - return properties; - } - - /** - * Set all CacheProperties to default. - */ - private void clearCacheProperties(String entityName) { - this.setCacheType(null, entityName); - this.setCacheSize(null, entityName); - this.setSharedCache(null, entityName); - } - - // ****** convenience methods ******* - - /** - * Put the given Entity CacheProperties in this entitiesCacheProperties map. - * @param entityName - Entity name. The entity may be a new or an existing entity. - * @param properties - Entity CacheProperties - */ - private void putEntityCacheProperties(String entityName, CacheProperties properties) { - this.addOrReplacePropertiesForEntity(entityName, properties); - } - - // ****** entities list ******* - - public ListIterator<String> entities() { - return CollectionTools.list(this.entitiesCacheProperties.keySet()).listIterator(); - } - - public int entitiesSize() { - return this.entitiesCacheProperties.size(); - } - - /* - * Verifies if this entitiesCacheProperties map contains the given Entity. - */ - public boolean entityExists(String entity) { - return this.entitiesCacheProperties.containsKey(entity); - } - - public String addEntity(String entity) { - if (entityExists(entity)) { - throw new IllegalStateException("Entity " + entity + " already exist."); - } - return this.addOrReplacePropertiesForEntity(entity, new CacheProperties(entity)); - } - - /** - * Adds or replaces the given Entity CacheProperties in this - * entitiesCacheProperties map. - * If the specified Entity exists and the given CacheProperties is empty - * (i.e. all properties are null) the mapping will be removed from the map. - * - * @param entity - Entity name - * @param properties - Entity CacheProperties - * @return Entity name added - */ - private String addOrReplacePropertiesForEntity(String entity, CacheProperties properties) { - if (this.entityExists(entity)) { - this.replaceEntity_(entity, properties); - return null; - } - this.entitiesCacheProperties.put(entity, properties); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - return entity; - } - - /** - * Replaces the given Entity CacheProperties in this - * entitiesCacheProperties map. - * If the given Entity CacheProperties is empty (i.e. all properties are null) the - * mapping will be removed from the map. - * @param entity - Entity name - * @param properties - Entity CacheProperties - * @return Entity name replaced - */ - private CacheProperties replaceEntity_(String entity, CacheProperties properties) { - CacheProperties old = this.entitiesCacheProperties.get(entity); - if (properties.isEmpty()) { - this.entitiesCacheProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } - else { - this.entitiesCacheProperties.put(entity, properties); - } - return old; - } - - public void removeEntity(String entity) { - if ( ! this.entityExists(entity)) { - return; - } - this.clearCacheProperties(entity); - this.entitiesCacheProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/BatchWriting.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/BatchWriting.java deleted file mode 100644 index 5494a1a31f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/BatchWriting.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection; - -/** - * BatchWriting - */ -public enum BatchWriting { - none, - jdbc, - buffered, - oracle_jdbc; - - // EclipseLink value string - static final String NONE = "None"; - static final String JDBC = "JDBC"; - static final String BUFFERED = "Buffered"; - static final String ORACLE_JDBC = "Oracle-JDBC"; -} 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 deleted file mode 100644 index d53e6028f2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/Connection.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Connection - */ -public interface Connection extends PersistenceUnitProperties -{ - PersistenceUnitTransactionType getDefaultTransactionType(); - PersistenceUnitTransactionType getTransactionType(); - void setTransactionType(PersistenceUnitTransactionType newTransactionType); - // PersistenceUnit property - static final String TRANSACTION_TYPE_PROPERTY = "transactionTypeProperty"; - 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 = "jtaDataSourceProperty"; - static final String DEFAULT_JTA_DATA_SOURCE = ""; - - String getDefaultNonJtaDataSource(); - String getNonJtaDataSource(); - void setNonJtaDataSource(String newNonJtaDataSource); - // PersistenceUnit property - static final String NON_JTA_DATA_SOURCE_PROPERTY = "nonJtaDataSourceProperty"; - static final String DEFAULT_NON_JTA_DATA_SOURCE = ""; - - Boolean getDefaultNativeSql(); - Boolean getNativeSql(); - void setNativeSql(Boolean newNativeSql); - static final String NATIVE_SQL_PROPERTY = "nativeSqlProperty"; - // EclipseLink key string - static final String ECLIPSELINK_NATIVE_SQL = "eclipselink.jdbc.native-sql"; - static final Boolean DEFAULT_NATIVE_SQL = Boolean.FALSE; - - BatchWriting getDefaultBatchWriting(); - BatchWriting getBatchWriting(); - void setBatchWriting(BatchWriting newBatchWriting); - static final String BATCH_WRITING_PROPERTY = "batchWritingProperty"; - // EclipseLink key string - static final String ECLIPSELINK_BATCH_WRITING = "eclipselink.jdbc.batch-writing"; - static final BatchWriting DEFAULT_BATCH_WRITING = BatchWriting.none; - - Boolean getDefaultCacheStatements(); - Boolean getCacheStatements(); - void setCacheStatements(Boolean newCacheStatements); - static final String CACHE_STATEMENTS_PROPERTY = "cacheStatementsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_STATEMENTS = "eclipselink.jdbc.cache-statements"; - static final Boolean DEFAULT_CACHE_STATEMENTS = Boolean.FALSE; - - Integer getDefaultCacheStatementsSize(); - Integer getCacheStatementsSize(); - void setCacheStatementsSize(Integer newCacheStatementsSize); - static final String CACHE_STATEMENTS_SIZE_PROPERTY = "cacheStatementsSizeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CACHE_STATEMENTS_SIZE = "eclipselink.jdbc.cache-statements.size"; - static final Integer DEFAULT_CACHE_STATEMENTS_SIZE = 50; - - String getDefaultDriver(); - String getDriver(); - void setDriver(String newDriver); - static final String DRIVER_PROPERTY = "driverProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DRIVER = "eclipselink.jdbc.driver"; - static final String DEFAULT_DRIVER = ""; - - String getDefaultUrl(); - String getUrl(); - void setUrl(String newUrl); - static final String URL_PROPERTY = "urlProperty"; - // EclipseLink key string - static final String ECLIPSELINK_URL = "eclipselink.jdbc.url"; - static final String DEFAULT_URL = ""; - - String getDefaultUser(); - String getUser(); - void setUser(String newUser); - static final String USER_PROPERTY = "userProperty"; - // EclipseLink key string - static final String ECLIPSELINK_USER = "eclipselink.jdbc.user"; - static final String DEFAULT_USER = ""; - - String getDefaultPassword(); - String getPassword(); - void setPassword(String newPassword); - static final String PASSWORD_PROPERTY = "passwordProperty"; - // EclipseLink key string - static final String ECLIPSELINK_PASSWORD = "eclipselink.jdbc.password"; - static final String DEFAULT_PASSWORD = ""; - - Boolean getDefaultBindParameters(); - Boolean getBindParameters(); - void setBindParameters(Boolean newBindParameters); - static final String BIND_PARAMETERS_PROPERTY = "bindParametersProperty"; - // EclipseLink key string - static final String ECLIPSELINK_BIND_PARAMETERS = "eclipselink.jdbc.bind-parameters"; - static final Boolean DEFAULT_BIND_PARAMETERS = Boolean.TRUE; - - Boolean getDefaultReadConnectionsShared(); - Boolean getReadConnectionsShared(); - void setReadConnectionsShared(Boolean newReadConnectionsShared); - static final String READ_CONNECTIONS_SHARED_PROPERTY = "readConnectionsSharedProperty"; - // EclipseLink key string - static final String ECLIPSELINK_READ_CONNECTIONS_SHARED = "eclipselink.jdbc.read-connections.shared"; - static final Boolean DEFAULT_READ_CONNECTIONS_SHARED = Boolean.FALSE; - - Integer getDefaultReadConnectionsMin(); - Integer getReadConnectionsMin(); - void setReadConnectionsMin(Integer newReadConnectionsMin); - static final String READ_CONNECTIONS_MIN_PROPERTY = "readConnectionsMinProperty"; - // EclipseLink key string - static final String ECLIPSELINK_READ_CONNECTIONS_MIN = "eclipselink.jdbc.read-connections.min"; - static final Integer DEFAULT_READ_CONNECTIONS_MIN = 2; - - Integer getDefaultReadConnectionsMax(); - Integer getReadConnectionsMax(); - void setReadConnectionsMax(Integer newReadConnectionsMax); - static final String READ_CONNECTIONS_MAX_PROPERTY = "readConnectionsMaxProperty"; - // EclipseLink key string - static final String ECLIPSELINK_READ_CONNECTIONS_MAX = "eclipselink.jdbc.read-connections.max"; - static final Integer DEFAULT_READ_CONNECTIONS_MAX = 2; - - Integer getDefaultWriteConnectionsMin(); - Integer getWriteConnectionsMin(); - void setWriteConnectionsMin(Integer newWriteConnectionsMin); - static final String WRITE_CONNECTIONS_MIN_PROPERTY = "writeConnectionsMinProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WRITE_CONNECTIONS_MIN = "eclipselink.jdbc.write-connections.min"; - static final Integer DEFAULT_WRITE_CONNECTIONS_MIN = 5; - - Integer getDefaultWriteConnectionsMax(); - Integer getWriteConnectionsMax(); - void setWriteConnectionsMax(Integer newWriteConnectionsMax); - static final String WRITE_CONNECTIONS_MAX_PROPERTY = "writeConnectionsMaxProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WRITE_CONNECTIONS_MAX = "eclipselink.jdbc.write-connections.max"; - static final Integer DEFAULT_WRITE_CONNECTIONS_MAX = 10; -} 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 deleted file mode 100644 index e7c686e209..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java +++ /dev/null @@ -1,655 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.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.core.context.persistence.Property; -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 - */ -public class EclipseLinkConnection extends EclipseLinkPersistenceUnitProperties - implements Connection -{ - // ********** PersistenceUnit properties ********** - private PersistenceUnitTransactionType transactionType; - private String jtaDataSource; - private String nonJtaDataSource; - - // ********** EclipseLink properties ********** - private BatchWriting batchWriting; - private Boolean nativeSql; - private Boolean cacheStatements; - private Integer cacheStatementsSize; - private String driver; - private String url; - private String user; - private String password; - private Boolean bindParameters; - private Boolean readConnectionsShared; - private Integer readConnectionsMin; - private Integer readConnectionsMax; - private Integer writeConnectionsMin; - private Integer writeConnectionsMax; - - - // ********** constructors ********** - public EclipseLinkConnection(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @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 = - this.getBooleanValue(ECLIPSELINK_NATIVE_SQL); - this.cacheStatements = - this.getBooleanValue(ECLIPSELINK_CACHE_STATEMENTS); - this.cacheStatementsSize = - this.getIntegerValue(ECLIPSELINK_CACHE_STATEMENTS_SIZE); - this.driver = - this.getStringValue(ECLIPSELINK_DRIVER); - this.url = - this.getStringValue(ECLIPSELINK_URL); - this.user = - this.getStringValue(ECLIPSELINK_USER); - this.password = - this.getStringValue(ECLIPSELINK_PASSWORD); - this.bindParameters = - this.getBooleanValue(ECLIPSELINK_BIND_PARAMETERS); - this.readConnectionsShared = - this.getBooleanValue(ECLIPSELINK_READ_CONNECTIONS_SHARED); - this.readConnectionsMin = - this.getIntegerValue(ECLIPSELINK_READ_CONNECTIONS_MIN); - this.readConnectionsMax = - this.getIntegerValue(ECLIPSELINK_READ_CONNECTIONS_MAX); - this.writeConnectionsMin = - this.getIntegerValue(ECLIPSELINK_WRITE_CONNECTIONS_MIN); - this.writeConnectionsMax = - this.getIntegerValue(ECLIPSELINK_WRITE_CONNECTIONS_MAX); - - } - - /** - * Initialize and add listeners to the persistence unit. - */ - @Override - protected void initialize(PersistenceUnit parent, ListValueModel<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 ********** - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_NATIVE_SQL, - NATIVE_SQL_PROPERTY); - propertyNames.put( - ECLIPSELINK_BATCH_WRITING, - BATCH_WRITING_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_STATEMENTS, - CACHE_STATEMENTS_PROPERTY); - propertyNames.put( - ECLIPSELINK_CACHE_STATEMENTS_SIZE, - CACHE_STATEMENTS_SIZE_PROPERTY); - propertyNames.put( - ECLIPSELINK_DRIVER, - DRIVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_URL, - URL_PROPERTY); - propertyNames.put( - ECLIPSELINK_USER, - USER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PASSWORD, - PASSWORD_PROPERTY); - propertyNames.put( - ECLIPSELINK_BIND_PARAMETERS, - BIND_PARAMETERS_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_SHARED, - READ_CONNECTIONS_SHARED_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_MIN, - READ_CONNECTIONS_MIN_PROPERTY); - propertyNames.put( - ECLIPSELINK_READ_CONNECTIONS_MAX, - READ_CONNECTIONS_MAX_PROPERTY); - propertyNames.put( - ECLIPSELINK_WRITE_CONNECTIONS_MIN, - WRITE_CONNECTIONS_MIN_PROPERTY); - propertyNames.put( - ECLIPSELINK_WRITE_CONNECTIONS_MAX, - 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; - } - - public void setNativeSql(Boolean newNativeSql) { - Boolean old = this.nativeSql; - this.nativeSql = newNativeSql; - this.putProperty(NATIVE_SQL_PROPERTY, newNativeSql); - this.firePropertyChanged(NATIVE_SQL_PROPERTY, old, newNativeSql); - } - - private void nativeSqlChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.nativeSql; - this.nativeSql = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultNativeSql() { - return DEFAULT_NATIVE_SQL; - } - - // ********** BatchWriting ********** - - public BatchWriting getBatchWriting() { - return this.batchWriting; - } - - public void setBatchWriting(BatchWriting newBatchWriting) { - BatchWriting old = this.batchWriting; - this.batchWriting = newBatchWriting; - this.putProperty(BATCH_WRITING_PROPERTY, newBatchWriting); - this.firePropertyChanged(BATCH_WRITING_PROPERTY, old, newBatchWriting); - } - - private void batchWritingChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - BatchWriting newValue = getEnumValueOf(stringValue, BatchWriting.values()); - BatchWriting old = this.batchWriting; - this.batchWriting = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public BatchWriting getDefaultBatchWriting() { - return DEFAULT_BATCH_WRITING; - } - - // ********** CacheStatements ********** - public Boolean getCacheStatements() { - return this.cacheStatements; - } - - public void setCacheStatements(Boolean newCacheStatements) { - Boolean old = this.cacheStatements; - this.cacheStatements = newCacheStatements; - this.putProperty(CACHE_STATEMENTS_PROPERTY, newCacheStatements); - this.firePropertyChanged(CACHE_STATEMENTS_PROPERTY, old, newCacheStatements); - } - - private void cacheStatementsChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.cacheStatements; - this.cacheStatements = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultCacheStatements() { - return DEFAULT_CACHE_STATEMENTS; - } - - // ********** CacheStatementsSize ********** - public Integer getCacheStatementsSize() { - return this.cacheStatementsSize; - } - - public void setCacheStatementsSize(Integer newCacheStatementsSize) { - Integer old = this.cacheStatementsSize; - this.cacheStatementsSize = newCacheStatementsSize; - this.putProperty(CACHE_STATEMENTS_SIZE_PROPERTY, newCacheStatementsSize); - this.firePropertyChanged(CACHE_STATEMENTS_SIZE_PROPERTY, old, newCacheStatementsSize); - } - - private void cacheStatementsSizeChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.cacheStatementsSize; - this.cacheStatementsSize = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultCacheStatementsSize() { - return DEFAULT_CACHE_STATEMENTS_SIZE; - } - - // ********** Driver ********** - public String getDriver() { - return this.driver; - } - - public void setDriver(String newDriver) { - String old = this.driver; - this.driver = newDriver; - this.putProperty(DRIVER_PROPERTY, newDriver); - this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver); - } - - private void driverChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.driver; - this.driver = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultDriver() { - return DEFAULT_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return this.url; - } - - public void setUrl(String newUrl) { - String old = this.url; - this.url = newUrl; - this.putProperty(URL_PROPERTY, newUrl); - this.firePropertyChanged(URL_PROPERTY, old, newUrl); - } - - private void urlChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.url; - this.url = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultUrl() { - return DEFAULT_URL; - } - - // ********** User ********** - public String getUser() { - return this.user; - } - - public void setUser(String newUser) { - String old = this.user; - this.user = newUser; - this.putProperty(USER_PROPERTY, newUser); - this.firePropertyChanged(USER_PROPERTY, old, newUser); - } - - private void userChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.user; - this.user = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultUser() { - return DEFAULT_USER; - } - - // ********** Password ********** - public String getPassword() { - return this.password; - } - - public void setPassword(String newPassword) { - String old = this.password; - this.password = newPassword; - this.putProperty(PASSWORD_PROPERTY, newPassword); - this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword); - } - - private void passwordChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.password; - this.password = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultPassword() { - return DEFAULT_PASSWORD; - } - - // ********** BindParameters ********** - public Boolean getBindParameters() { - return this.bindParameters; - } - - public void setBindParameters(Boolean newBindParameters) { - Boolean old = this.bindParameters; - this.bindParameters = newBindParameters; - this.putProperty(BIND_PARAMETERS_PROPERTY, newBindParameters); - this.firePropertyChanged(BIND_PARAMETERS_PROPERTY, old, newBindParameters); - } - - private void bindParametersChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.bindParameters; - this.bindParameters = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultBindParameters() { - return DEFAULT_BIND_PARAMETERS; - } - - // ********** ReadConnectionsShared ********** - public Boolean getReadConnectionsShared() { - return this.readConnectionsShared; - } - - public void setReadConnectionsShared(Boolean newReadConnectionsShared) { - Boolean old = this.readConnectionsShared; - this.readConnectionsShared = newReadConnectionsShared; - this.putProperty(READ_CONNECTIONS_SHARED_PROPERTY, newReadConnectionsShared); - this.firePropertyChanged(READ_CONNECTIONS_SHARED_PROPERTY, old, newReadConnectionsShared); - } - - private void readConnectionsSharedChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.readConnectionsShared; - this.readConnectionsShared = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultReadConnectionsShared() { - return DEFAULT_READ_CONNECTIONS_SHARED; - } - - // ********** ReadConnectionsMin ********** - public Integer getReadConnectionsMin() { - return this.readConnectionsMin; - } - - public void setReadConnectionsMin(Integer newReadConnectionsMin) { - Integer old = this.readConnectionsMin; - this.readConnectionsMin = newReadConnectionsMin; - this.putProperty(READ_CONNECTIONS_MIN_PROPERTY, newReadConnectionsMin); - this.firePropertyChanged(READ_CONNECTIONS_MIN_PROPERTY, old, newReadConnectionsMin); - } - - private void readConnectionsMinChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMin; - this.readConnectionsMin = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultReadConnectionsMin() { - return DEFAULT_READ_CONNECTIONS_MIN; - } - - // ********** ReadConnectionsMax ********** - public Integer getReadConnectionsMax() { - return this.readConnectionsMax; - } - - public void setReadConnectionsMax(Integer newReadConnectionsMax) { - Integer old = this.readConnectionsMax; - this.readConnectionsMax = newReadConnectionsMax; - this.putProperty(READ_CONNECTIONS_MAX_PROPERTY, newReadConnectionsMax); - this.firePropertyChanged(READ_CONNECTIONS_MAX_PROPERTY, old, newReadConnectionsMax); - } - - private void readConnectionsMaxChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.readConnectionsMax; - this.readConnectionsMax = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultReadConnectionsMax() { - return DEFAULT_READ_CONNECTIONS_MAX; - } - - // ********** WriteConnectionsMin ********** - public Integer getWriteConnectionsMin() { - return this.writeConnectionsMin; - } - - public void setWriteConnectionsMin(Integer newWriteConnectionsMin) { - Integer old = this.writeConnectionsMin; - this.writeConnectionsMin = newWriteConnectionsMin; - this.putProperty(WRITE_CONNECTIONS_MIN_PROPERTY, newWriteConnectionsMin); - this.firePropertyChanged(WRITE_CONNECTIONS_MIN_PROPERTY, old, newWriteConnectionsMin); - } - - private void writeConnectionsMinChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMin; - this.writeConnectionsMin = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultWriteConnectionsMin() { - return DEFAULT_WRITE_CONNECTIONS_MIN; - } - - // ********** WriteConnectionsMax ********** - public Integer getWriteConnectionsMax() { - return this.writeConnectionsMax; - } - - public void setWriteConnectionsMax(Integer newWriteConnectionsMax) { - Integer old = this.writeConnectionsMax; - this.writeConnectionsMax = newWriteConnectionsMax; - this.putProperty(WRITE_CONNECTIONS_MAX_PROPERTY, newWriteConnectionsMax); - this.firePropertyChanged(WRITE_CONNECTIONS_MAX_PROPERTY, old, newWriteConnectionsMax); - } - - private void writeConnectionsMaxChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.writeConnectionsMax; - this.writeConnectionsMax = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Integer getDefaultWriteConnectionsMax() { - return DEFAULT_WRITE_CONNECTIONS_MAX; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java deleted file mode 100644 index 238f411d7f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Customization.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization; - -import java.util.ListIterator; -import org.eclipse.jpt.core.context.persistence.ClassRef; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Customization - */ -public interface Customization extends PersistenceUnitProperties -{ - Boolean getDefaultThrowExceptions(); - Boolean getThrowExceptions(); - void setThrowExceptions(Boolean newThrowExceptions); - static final String THROW_EXCEPTIONS_PROPERTY = "throwExceptionsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_THROW_EXCEPTIONS = "eclipselink.orm.throw.exceptions"; - static final Boolean DEFAULT_THROW_EXCEPTIONS = Boolean.TRUE; - - Weaving getDefaultWeaving(); - Weaving getWeaving(); - void setWeaving(Weaving newWeaving); - static final String WEAVING_PROPERTY = "weavingProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING = "eclipselink.weaving"; - static final Weaving DEFAULT_WEAVING = Weaving.true_; - - Boolean getDefaultWeavingLazy(); - Boolean getWeavingLazy(); - void setWeavingLazy(Boolean newWeavingLazy); - static final String WEAVING_LAZY_PROPERTY = "weavingLazyProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_LAZY = "eclipselink.weaving.lazy"; - static final Boolean DEFAULT_WEAVING_LAZY = Boolean.TRUE; - - Boolean getDefaultWeavingChangeTracking(); - Boolean getWeavingChangeTracking(); - void setWeavingChangeTracking(Boolean newWeavingChangeTracking); - static final String WEAVING_CHANGE_TRACKING_PROPERTY = "weavingChangeTrackingProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_CHANGE_TRACKING = "eclipselink.weaving.changetracking"; - static final Boolean DEFAULT_WEAVING_CHANGE_TRACKING = Boolean.TRUE; - - Boolean getDefaultWeavingFetchGroups(); - Boolean getWeavingFetchGroups(); - void setWeavingFetchGroups(Boolean newWeavingFetchGroups); - static final String WEAVING_FETCH_GROUPS_PROPERTY = "weavingFetchGroupsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_FETCH_GROUPS = "eclipselink.weaving.fetchgroups"; - static final Boolean DEFAULT_WEAVING_FETCH_GROUPS = Boolean.TRUE; - - Boolean getDefaultWeavingInternal(); - Boolean getWeavingInternal(); - void setWeavingInternal(Boolean newWeavingInternal); - static final String WEAVING_INTERNAL_PROPERTY = "weavingInternalProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_INTERNAL = "eclipselink.weaving.internal"; - static final Boolean DEFAULT_WEAVING_INTERNAL = Boolean.TRUE; - - Boolean getDefaultWeavingEager(); - Boolean getWeavingEager(); - void setWeavingEager(Boolean newWeavingEager); - static final String WEAVING_EAGER_PROPERTY = "weavingEagerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_WEAVING_EAGER = "eclipselink.weaving.eager"; - static final Boolean DEFAULT_WEAVING_EAGER = Boolean.FALSE; - - String getDefaultDescriptorCustomizer(); - String getDescriptorCustomizer(String entityName); - void setDescriptorCustomizer(String newDescriptorCustomizer, String entityName); - static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = "descriptorCustomizerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DESCRIPTOR_CUSTOMIZER = "eclipselink.descriptor.customizer."; - static final String DEFAULT_DESCRIPTOR_CUSTOMIZER = null; // no default - - ListIterator<ClassRef> sessionCustomizers(); - int sessionCustomizersSize(); - boolean sessionCustomizerExists(String sessionCustomizerClassName); - ClassRef addSessionCustomizer(String newSessionCustomizerClassName); - void removeSessionCustomizer(ClassRef classRef); - static final String SESSION_CUSTOMIZER_LIST_PROPERTY = "sessionCustomizerListProperty"; - static final String SESSION_CUSTOMIZER_PROPERTY = "sessionCustomizerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_CUSTOMIZER = "eclipselink.session.customizer"; - - ListIterator<String> entities(); - int entitiesSize(); - boolean entityExists(String entity); - String addEntity(String entity); - void removeEntity(String entity); - static final String ENTITIES_LIST_PROPERTY = "entitiesListProperty"; - - String getDefaultProfiler(); - String getProfiler(); - void setProfiler(String newProfiler); - void setProfiler(Profiler newProfiler); - static final String PROFILER_PROPERTY = "profilerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_PROFILER = "eclipselink.profiler"; - static final String DEFAULT_PROFILER = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(Profiler.no_profiler); - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/CustomizerProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/CustomizerProperties.java deleted file mode 100644 index def82d949d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/CustomizerProperties.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization; - -import java.io.Serializable; -import org.eclipse.jpt.utility.internal.StringTools; - -/** - * CustomizerProperties - */ -public class CustomizerProperties implements Cloneable, Serializable -{ - private String entityName; - - // ********** EclipseLink properties ********** - private String className; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public CustomizerProperties(String entityName) { - this.entityName = entityName; - } - - // ********** behaviors ********** - @Override - public boolean equals(Object o) { - if(o == null) { - return false; - } - CustomizerProperties customizer = (CustomizerProperties) o; - return ( - (this.className == null ? - customizer.className == null : this.className.equals(customizer.className))); - } - - @Override - public synchronized CustomizerProperties clone() { - try { - return (CustomizerProperties)super.clone(); - } - catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean isEmpty() { - return this.className == null; - } - - // ********** getter/setter ********** - public String getEntityName() { - return this.entityName; - } - - public String getClassName() { - return this.className; - } - - public void setClassName(String newClassName) { - this.className = newClassName; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append(" ("); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - - public void toString(StringBuilder sb) { - sb.append(" class: "); - sb.append(this.className); - sb.append(", entityName: "); - sb.append(this.entityName); - } -}
\ 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/customization/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java deleted file mode 100644 index 6a7ca4c363..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java +++ /dev/null @@ -1,696 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.context.persistence.ClassRef; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -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 - */ -public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperties - implements Customization -{ - // ********** EclipseLink properties ********** - private Boolean throwExceptions; - private Weaving weaving; - private Boolean weavingLazy; - private Boolean weavingChangeTracking; - private Boolean weavingFetchGroups; - private Boolean weavingInternal; - private Boolean weavingEager; - private ArrayList<ClassRef> sessionCustomizers; - private String profiler; // storing EclipseLinkStringValue since value can be Profiler or custom class - - // key = Entity name ; value = Customizer properties - private Map<String, CustomizerProperties> entitiesCustomizerProperties; - - private static final long serialVersionUID = 1L; - - // ********** constructors ********** - public EclipseLinkCustomization(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.entitiesCustomizerProperties = - new HashMap<String, CustomizerProperties>(); - - this.throwExceptions = - this.getBooleanValue(ECLIPSELINK_THROW_EXCEPTIONS); - this.weaving = - this.getEnumValue(ECLIPSELINK_WEAVING, Weaving.values()); - this.weavingLazy = - this.getBooleanValue(ECLIPSELINK_WEAVING_LAZY); - this.weavingChangeTracking = - this.getBooleanValue(ECLIPSELINK_WEAVING_CHANGE_TRACKING); - this.weavingFetchGroups = - this.getBooleanValue(ECLIPSELINK_WEAVING_FETCH_GROUPS); - this.weavingInternal = - this.getBooleanValue(ECLIPSELINK_WEAVING_INTERNAL); - this.weavingEager = - this.getBooleanValue(ECLIPSELINK_WEAVING_EAGER); - this.initializeSessionCustomizersFromPersistenceUnit(); - - Set<Property> properties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER); - this.initializeEntitiesCustomizerClass(properties); - - this.profiler = this.getProfilerProtertyValue(); - } - - private void initializeSessionCustomizersFromPersistenceUnit() { - Set<Property> properties = - this.getPropertiesSetWithPrefix(ECLIPSELINK_SESSION_CUSTOMIZER); - - this.sessionCustomizers = new ArrayList<ClassRef>(properties.size()); - this.initializeSessionCustomizersWith(properties); - } - - private void initializeSessionCustomizersWith(Set<Property> properties) { - for (Property property : properties) { - String className = property.getValue(); - try { - IType sessionCustomizerClass = this.getJpaProject().getJavaProject().findType(className); - if(sessionCustomizerClass == null) { - throw new RuntimeException("could not find: \"" + className + "\" in project's classpath"); - } - ClassRef classRef = - this.getJpaProject().getJpaPlatform().getJpaFactory().buildClassRef( - this.getPersistenceUnit(), sessionCustomizerClass.getFullyQualifiedName()); - this.sessionCustomizers.add(classRef); - } - catch (Exception e) { - JptEclipseLinkCorePlugin.log(e); - } - } - } - - private void initializeEntitiesCustomizerClass(Set<Property> properties) { - for (Property property : properties) { - String entityName = this.getEntityName(property); - this.setCustomizerClass_(property, entityName); - } - } - - /** - * Gets the Profiler property from the persistence unit. - */ - private String getProfilerProtertyValue() { - - Profiler standardProfiler = this.getEnumValue(ECLIPSELINK_PROFILER, Profiler.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_PROFILER)) { - return null; // no property found - } - else if(standardProfiler == null) { - return this.getStringValue(ECLIPSELINK_PROFILER); // custom profiler - } - else { - return getEclipseLinkStringValueOf(standardProfiler); // a Profiler - } - } - - // ********** behavior ********** - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_THROW_EXCEPTIONS, - THROW_EXCEPTIONS_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING, - WEAVING_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_LAZY, - WEAVING_LAZY_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_CHANGE_TRACKING, - WEAVING_CHANGE_TRACKING_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_FETCH_GROUPS, - WEAVING_FETCH_GROUPS_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_INTERNAL, - WEAVING_INTERNAL_PROPERTY); - propertyNames.put( - ECLIPSELINK_WEAVING_EAGER, - WEAVING_EAGER_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_CUSTOMIZER, - SESSION_CUSTOMIZER_PROPERTY); - propertyNames.put( - ECLIPSELINK_PROFILER, - PROFILER_PROPERTY); - - // Don't need to initialize propertyNames for: - // descriptorCustomizerProperty - } - - /** - * Method used for identifying the given property. - */ - @Override - public boolean itemIsProperty(Property item) { - boolean isProperty = super.itemIsProperty(item); - - if ( ! isProperty && item.getName() != null) { - if (item.getName().startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - return true; - } - } - return isProperty; - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - @Override - public String propertyIdFor(Property property) { - try { - return super.propertyIdFor(property); - } - catch (IllegalArgumentException e) { - if (property.getName().startsWith(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER)) { - return DESCRIPTOR_CUSTOMIZER_PROPERTY; - } - } - throw new IllegalArgumentException("Illegal property: " + property.toString()); - } - - 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(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 { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - - // ********** ThrowExceptions ********** - public Boolean getThrowExceptions() { - return this.throwExceptions; - } - - public void setThrowExceptions(Boolean newThrowExceptions) { - Boolean old = this.throwExceptions; - this.throwExceptions = newThrowExceptions; - this.putProperty(THROW_EXCEPTIONS_PROPERTY, newThrowExceptions); - this.firePropertyChanged(THROW_EXCEPTIONS_PROPERTY, old, newThrowExceptions); - } - - private void throwExceptionsChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.throwExceptions; - this.throwExceptions = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultThrowExceptions() { - return DEFAULT_THROW_EXCEPTIONS; - } - - // ********** WeavingLazy ********** - public Boolean getWeavingLazy() { - return this.weavingLazy; - } - - public void setWeavingLazy(Boolean newWeavingLazy) { - Boolean old = this.weavingLazy; - this.weavingLazy = newWeavingLazy; - this.putProperty(WEAVING_LAZY_PROPERTY, newWeavingLazy); - this.firePropertyChanged(WEAVING_LAZY_PROPERTY, old, newWeavingLazy); - } - - private void weavingLazyChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingLazy; - this.weavingLazy = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultWeavingLazy() { - return DEFAULT_WEAVING_LAZY; - } - - // ********** WeavingChangeTracking ********** - public Boolean getWeavingChangeTracking() { - return this.weavingChangeTracking; - } - - public void setWeavingChangeTracking(Boolean newWeavingChangeTracking) { - Boolean old = this.weavingChangeTracking; - this.weavingChangeTracking = newWeavingChangeTracking; - this.putProperty(WEAVING_CHANGE_TRACKING_PROPERTY, newWeavingChangeTracking); - this.firePropertyChanged(WEAVING_CHANGE_TRACKING_PROPERTY, old, newWeavingChangeTracking); - } - - private void weavingChangeTrackingChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingChangeTracking; - this.weavingChangeTracking = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultWeavingChangeTracking() { - return DEFAULT_WEAVING_CHANGE_TRACKING; - } - - // ********** WeavingFetchGroups ********** - public Boolean getWeavingFetchGroups() { - return this.weavingFetchGroups; - } - - public void setWeavingFetchGroups(Boolean newWeavingFetchGroups) { - Boolean old = this.weavingFetchGroups; - this.weavingFetchGroups = newWeavingFetchGroups; - this.putProperty(WEAVING_FETCH_GROUPS_PROPERTY, newWeavingFetchGroups); - this.firePropertyChanged(WEAVING_FETCH_GROUPS_PROPERTY, old, newWeavingFetchGroups); - } - - private void weavingFetchGroupsChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingFetchGroups; - this.weavingFetchGroups = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultWeavingFetchGroups() { - return DEFAULT_WEAVING_FETCH_GROUPS; - } - - // ********** WeavingInternal ********** - public Boolean getWeavingInternal() { - return this.weavingInternal; - } - - public void setWeavingInternal(Boolean newWeavingInternal) { - Boolean old = this.weavingInternal; - this.weavingInternal = newWeavingInternal; - this.putProperty(WEAVING_INTERNAL_PROPERTY, newWeavingInternal); - this.firePropertyChanged(WEAVING_INTERNAL_PROPERTY, old, newWeavingInternal); - } - - private void weavingInternalChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingInternal; - this.weavingInternal = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultWeavingInternal() { - return DEFAULT_WEAVING_INTERNAL; - } - - // ********** WeavingEager ********** - public Boolean getWeavingEager() { - return this.weavingEager; - } - - public void setWeavingEager(Boolean newWeavingEager) { - Boolean old = this.weavingEager; - this.weavingEager = newWeavingEager; - this.putProperty(WEAVING_EAGER_PROPERTY, newWeavingEager); - this.firePropertyChanged(WEAVING_EAGER_PROPERTY, old, newWeavingEager); - } - - private void weavingEagerChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.weavingEager; - this.weavingEager = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultWeavingEager() { - return DEFAULT_WEAVING_EAGER; - } - - // ********** SessionCustomizers ********** - public ListIterator<ClassRef> sessionCustomizers(){ - return new CloneListIterator<ClassRef>(this.sessionCustomizers); - } - - public int sessionCustomizersSize(){ - return this.sessionCustomizers.size(); - } - - public boolean sessionCustomizerExists(String sessionCustomizerClassName) { - - for (ClassRef sessionCustomizer : this.sessionCustomizers) { - if(sessionCustomizer.getClassName().equals(sessionCustomizerClassName)) { - return true; - } - } - return false; - } - - public ClassRef addSessionCustomizer(String newSessionCustomizerClassName){ - - if( ! this.sessionCustomizerExists(newSessionCustomizerClassName)) { - ClassRef classRef = - this.getJpaProject().getJpaPlatform().getJpaFactory().buildClassRef( - this.getPersistenceUnit(), newSessionCustomizerClassName); - this.sessionCustomizers.add(classRef); - this.putProperty(SESSION_CUSTOMIZER_PROPERTY, classRef.getClassName(), true); - this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY); - return classRef; - } - return null; - } - - public void removeSessionCustomizer(ClassRef classRef){ - - if(this.removeSessionCustomizer(classRef.getClassName()) != null) { - this.removeProperty(SESSION_CUSTOMIZER_PROPERTY, classRef.getClassName()); - this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY); - } - } - - private ClassRef removeSessionCustomizer(String sessionCustomizerClassName){ - - for ( ListIterator<ClassRef> i = this.sessionCustomizers(); i.hasNext();) { - ClassRef classRef = i.next(); - if(classRef.getClassName().equals(sessionCustomizerClassName)) { - this.sessionCustomizers.remove(classRef); - return classRef; - } - } - return null; - } - - private void sessionCustomizersChanged(PropertyChangeEvent event) { - - this.initializeSessionCustomizersFromPersistenceUnit(); - this.fireListChanged(SESSION_CUSTOMIZER_LIST_PROPERTY); - } - - // ********** Weaving ********** - - public Weaving getWeaving() { - return this.weaving; - } - - public void setWeaving(Weaving newWeaving) { - Weaving old = this.weaving; - this.weaving = newWeaving; - this.putProperty(WEAVING_PROPERTY, newWeaving); - this.firePropertyChanged(WEAVING_PROPERTY, old, newWeaving); - } - - private void weavingChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Weaving newValue = getEnumValueOf(stringValue, Weaving.values()); - Weaving old = this.weaving; - this.weaving = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Weaving getDefaultWeaving() { - return DEFAULT_WEAVING; - } - - // ********** DescriptorCustomizer ********** - - public String getDescriptorCustomizer(String entityName) { - CustomizerProperties customizer = this.customizerPropertiesOf(entityName); - return (customizer == null) ? null : customizer.getClassName(); - } - - public void setDescriptorCustomizer(String newDescriptorCustomizer, String entityName) { - CustomizerProperties old = this.setCustomizerClass_(newDescriptorCustomizer, entityName); - this.putStringValue(ECLIPSELINK_DESCRIPTOR_CUSTOMIZER, entityName, newDescriptorCustomizer, false); - this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, this.customizerPropertiesOf(entityName)); - } - - private void descriptorCustomizerChanged(PropertyChangeEvent event) { - String entityName; - Property newProperty = (Property) event.getNewValue(); - // property == null when removed - entityName = (newProperty == null) ? - this.getEntityName((Property) event.getOldValue()) : this.getEntityName(newProperty); - CustomizerProperties old = this.setCustomizerClass_(newProperty, entityName); - this.firePropertyChanged(event.getAspectName(), old, this.customizerPropertiesOf(entityName)); - } - - public String getDefaultDescriptorCustomizer() { - return DEFAULT_DESCRIPTOR_CUSTOMIZER; - } - - - // ****** CustomizerProperties ******* - - /** - * Convenience method to update the CustomizerClass in entitiesCustomizerProperties map. - * Returns the old value of CustomizerProperties - */ - private CustomizerProperties setCustomizerClass_(Property newProperty, String entityName) { - String newValue = (newProperty == null) ? null : newProperty.getValue(); - return this.setCustomizerClass_(newValue, entityName); - } - - private CustomizerProperties setCustomizerClass_(String newValue, String entityName) { - CustomizerProperties properties = this.customizerPropertiesOf(entityName); - CustomizerProperties old = properties.clone(); - properties.setClassName(newValue); - this.putEntityCustomizerProperties(entityName, properties); - return old; - } - - /** - * Returns the CustomizerProperties of the Entity with the given name. - */ - private CustomizerProperties customizerPropertiesOf(String entityName) { - CustomizerProperties properties = this.entitiesCustomizerProperties.get(entityName); - if (properties == null) { - properties = new CustomizerProperties(entityName); - } - return properties; - } - - /** - * Set all CustomizerProperties to default. - */ - private void clearCustomizerProperties(String entityName) { - this.setDescriptorCustomizer(null, entityName); - } - - // ****** convenience methods ******* - /** - * Put the given Entity CustomizerProperties in this entitiesCustomizerProperties map. - * @param entityName - Entity name. The entity may be a new or an existing entity. - * @param properties - Entity CustomizerProperties - */ - private void putEntityCustomizerProperties(String entityName, CustomizerProperties properties) { - this.addOrReplacePropertiesForEntity(entityName, properties); - } - - - - // ****** entities list ******* - - public ListIterator<String> entities() { - return CollectionTools.list(this.entitiesCustomizerProperties.keySet()).listIterator(); - } - - public int entitiesSize() { - return this.entitiesCustomizerProperties.size(); - } - - /* - * Verifies if this entitiesCacheProperties map contains the given Entity. - */ - public boolean entityExists(String entity) { - return this.entitiesCustomizerProperties.containsKey(entity); - } - - public String addEntity(String entity) { - if (entityExists(entity)) { - throw new IllegalStateException("Entity " + entity + " already exist."); - } - return this.addOrReplacePropertiesForEntity(entity, new CustomizerProperties(entity)); - } - - /** - * Adds or Replaces the given Entity CustomizerProperties in - * this entitiesCustomizerProperties map. - * If the specified Entity exists and the given CustomizerProperties is empty - * (i.e. all properties are null) the mapping will be removed from the map. - * @param entity - Entity name - * @param properties - Entity CustomizerProperties - * @return - */ - private String addOrReplacePropertiesForEntity(String entity, CustomizerProperties properties) { - if (entityExists(entity)) { - this.replaceEntity_(entity, properties); - return null; - } - this.entitiesCustomizerProperties.put(entity, properties); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - return entity; - } - - /** - * Replaces the given Entity CustomizerProperties in this - * entitiesCustomizerProperties map. - * If the Entity CustomizerProperties is empty (i.e. all properties is null) the - * mapping will be removed from the map. - * @param entity - Entity name - * @param properties - Entity CustomizerProperties - * @return - */ - private CustomizerProperties replaceEntity_(String entity, CustomizerProperties properties) { - CustomizerProperties old = this.entitiesCustomizerProperties.get(entity); - if (properties.isEmpty()) { - this.entitiesCustomizerProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } - else { - this.entitiesCustomizerProperties.put(entity, properties); - } - return old; - } - - public void removeEntity(String entity) { - if ( ! entityExists(entity)) { - return; - } - this.clearCustomizerProperties(entity); - this.entitiesCustomizerProperties.remove(entity); - this.fireListChanged(ENTITIES_LIST_PROPERTY); - } - - // ********** Profiler ********** - /** - * Returns Profiler or custom profiler class. - * - * @return EclipseLink string value for Profiler enum or custom profiler class - */ - public String getProfiler() { - return this.profiler; - } - - /** - * Sets EclipseLink profiler. - * - * @param newProfiler - Profiler - */ - public void setProfiler(Profiler newProfiler) { - if( newProfiler == null) { - this.setProfiler_((String) null); - return; - } - this.setProfiler_(getEclipseLinkStringValueOf(newProfiler)); - } - - /** - * Sets EclipseLink profiler or custom profiler. - * - * @param newProfiler - - * Can be a EclipseLink profiler literal or - * a fully qualified class name of a custom profiler. - */ - public void setProfiler(String newProfiler) { - if( newProfiler == null) { - this.setProfiler_((String) null); - return; - } - Profiler profiler = Profiler.getProfilerFor(newProfiler); - if(profiler == null) { // custom profiler class - this.setProfiler_(newProfiler); - } - else { - this.setProfiler(profiler); - } - } - - private void setProfiler_(String newProfiler) { - String old = this.profiler; - this.profiler = newProfiler; - this.putProperty(PROFILER_PROPERTY, newProfiler); - this.firePropertyChanged(PROFILER_PROPERTY, old, newProfiler); - } - - private void profilerChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.profiler; - this.profiler = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultProfiler() { - return DEFAULT_PROFILER; - } - -}
\ 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/customization/Profiler.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Profiler.java deleted file mode 100644 index b3d82956c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Profiler.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization; - -/** - * Profiler - */ -public enum Profiler { - performance_profiler, - query_monitor, - no_profiler; - - // EclipseLink value string - public static final String PERFORMANCE_PROFILER = "PerformanceProfiler"; - public static final String QUERY_MONITOR = "QueryMonitor"; - public static final String NO_PROFILER = "NoProfiler"; - - /** - * Return the Profiler value corresponding to the given literal. - */ - public static Profiler getProfilerFor(String literal) { - - for( Profiler profiler : Profiler.values()) { - if(profiler.toString().equals(literal)) { - return profiler; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Weaving.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Weaving.java deleted file mode 100644 index 0ecfedfdd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/Weaving.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization; - -/** - * Weaving - */ -public enum Weaving { - true_, - false_, - static_; - - // EclipseLink value string - public static final String TRUE_ = "true"; - public static final String FALSE_ = "false"; - public static final String STATIC_ = "static"; -} 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 deleted file mode 100644 index 836fc91c1d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.general; - -import java.util.Map; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -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 - */ -public class EclipseLinkGeneralProperties extends EclipseLinkPersistenceUnitProperties - implements GeneralProperties -{ - // ********** EclipseLink properties ********** - private Boolean excludeEclipselinkOrm; - - // ********** constructors ********** - public EclipseLinkGeneralProperties(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - - this.excludeEclipselinkOrm = - this.getBooleanValue(ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM); - } - - - // ********** behavior ********** - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM, - 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() { - return this.excludeEclipselinkOrm; - } - - public void setExcludeEclipselinkOrm(Boolean newExcludeEclipselinkOrm) { - Boolean old = this.excludeEclipselinkOrm; - this.excludeEclipselinkOrm = newExcludeEclipselinkOrm; - this.putProperty(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, newExcludeEclipselinkOrm); - this.firePropertyChanged(EXCLUDE_ECLIPSELINK_ORM_PROPERTY, old, newExcludeEclipselinkOrm); - } - - private void excludeEclipselinkOrmChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.excludeEclipselinkOrm; - this.excludeEclipselinkOrm = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultExcludeEclipselinkOrm() { - return DEFAULT_EXCLUDE_ECLIPSELINK_ORM; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/GeneralProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/GeneralProperties.java deleted file mode 100644 index 6092ac03fc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/general/GeneralProperties.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.general; - -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * GeneralProperties - */ -public interface GeneralProperties extends PersistenceUnitProperties -{ - - Boolean getDefaultExcludeEclipselinkOrm(); - Boolean getExcludeEclipselinkOrm(); - void setExcludeEclipselinkOrm(Boolean newExcludeEclipselinkOrm); - static final String EXCLUDE_ECLIPSELINK_ORM_PROPERTY = "excludeEclipselinkOrmProperty"; - // EclipseLink key string - static final String ECLIPSELINK_EXCLUDE_ECLIPSELINK_ORM = "eclipselink.exclude-eclipselink-orm"; - static final Boolean DEFAULT_EXCLUDE_ECLIPSELINK_ORM = Boolean.FALSE; - -} 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 deleted file mode 100644 index 1f50d82e9c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java +++ /dev/null @@ -1,349 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging; - -import java.util.Map; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -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 - */ -public class EclipseLinkLogging extends EclipseLinkPersistenceUnitProperties - implements Logging -{ - // ********** EclipseLink properties ********** - private LoggingLevel level; - private Boolean timestamp; - private Boolean thread; - private Boolean session; - private Boolean exceptions; - private String logFileLocation; - private String logger; // storing EclipseLinkStringValue since value can be Logger or custom class - - // ********** constructors ********** - public EclipseLinkLogging(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.level = - this.getEnumValue(ECLIPSELINK_LEVEL, LoggingLevel.values()); - this.timestamp = - this.getBooleanValue(ECLIPSELINK_TIMESTAMP); - this.thread = - this.getBooleanValue(ECLIPSELINK_THREAD); - this.session = - this.getBooleanValue(ECLIPSELINK_SESSION); - this.exceptions = - this.getBooleanValue(ECLIPSELINK_EXCEPTIONS); - this.logFileLocation = - this.getStringValue(ECLIPSELINK_LOG_FILE_LOCATION); - - this.logger = this.getLoggerProtertyValue(); - } - - /** - * Gets the Logger property from the persistence unit. - */ - private String getLoggerProtertyValue() { - - Logger standardLogger = this.getEnumValue(ECLIPSELINK_LOGGER, Logger.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_LOGGER)) { - return null; // no property found - } - else if(standardLogger == null) { - return this.getStringValue(ECLIPSELINK_LOGGER); // custom logger - } - else { - return getEclipseLinkStringValueOf(standardLogger); // a Logger - } - } - - // ********** behavior ********** - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_LEVEL, - LEVEL_PROPERTY); - propertyNames.put( - ECLIPSELINK_TIMESTAMP, - TIMESTAMP_PROPERTY); - propertyNames.put( - ECLIPSELINK_THREAD, - THREAD_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION, - SESSION_PROPERTY); - propertyNames.put( - ECLIPSELINK_EXCEPTIONS, - EXCEPTIONS_PROPERTY); - propertyNames.put( - ECLIPSELINK_LOG_FILE_LOCATION, - LOG_FILE_LOCATION_PROPERTY); - propertyNames.put( - ECLIPSELINK_LOGGER, - 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); - } - return; - } - - // ********** LoggingLevel ********** - - public LoggingLevel getLevel() { - return this.level; - } - - public void setLevel(LoggingLevel newLevel) { - LoggingLevel old = this.level; - this.level = newLevel; - this.putProperty(LEVEL_PROPERTY, newLevel); - this.firePropertyChanged(LEVEL_PROPERTY, old, newLevel); - } - - private void levelChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - LoggingLevel newValue = getEnumValueOf(stringValue, LoggingLevel.values()); - LoggingLevel old = this.level; - this.level = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public LoggingLevel getDefaultLevel() { - return DEFAULT_LEVEL; - } - - // ********** Timestamp ********** - public Boolean getTimestamp() { - return this.timestamp; - } - - public void setTimestamp(Boolean newTimestamp) { - Boolean old = this.timestamp; - this.timestamp = newTimestamp; - this.putProperty(TIMESTAMP_PROPERTY, newTimestamp); - this.firePropertyChanged(TIMESTAMP_PROPERTY, old, newTimestamp); - } - - private void timestampChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.timestamp; - this.timestamp = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultTimestamp() { - return DEFAULT_TIMESTAMP; - } - - // ********** Thread ********** - public Boolean getThread() { - return this.thread; - } - - public void setThread(Boolean newThread) { - Boolean old = this.thread; - this.thread = newThread; - this.putProperty(THREAD_PROPERTY, newThread); - this.firePropertyChanged(THREAD_PROPERTY, old, newThread); - } - - private void threadChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.thread; - this.thread = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultThread() { - return DEFAULT_THREAD; - } - - // ********** Session ********** - public Boolean getSession() { - return this.session; - } - - public void setSession(Boolean newSession) { - Boolean old = this.session; - this.session = newSession; - this.putProperty(SESSION_PROPERTY, newSession); - this.firePropertyChanged(SESSION_PROPERTY, old, newSession); - } - - private void sessionChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.session; - this.session = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultSession() { - return DEFAULT_SESSION; - } - - // ********** Exceptions ********** - public Boolean getExceptions() { - return this.exceptions; - } - - public void setExceptions(Boolean newExceptions) { - Boolean old = this.exceptions; - this.exceptions = newExceptions; - this.putProperty(EXCEPTIONS_PROPERTY, newExceptions); - this.firePropertyChanged(EXCEPTIONS_PROPERTY, old, newExceptions); - } - - private void exceptionsChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.exceptions; - this.exceptions = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultExceptions() { - return DEFAULT_EXCEPTIONS; - } - - // ********** logFileLocation ********** - public String getLogFileLocation() { - return this.logFileLocation; - } - - public void setLogFileLocation(String newLogFileLocation) { - String old = this.logFileLocation; - this.logFileLocation = newLogFileLocation; - this.putProperty(LOG_FILE_LOCATION_PROPERTY, newLogFileLocation); - this.firePropertyChanged(LOG_FILE_LOCATION_PROPERTY, old, newLogFileLocation); - } - - private void logFileLocationChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.logFileLocation; - this.logFileLocation = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultLogFileLocation() { - return DEFAULT_LOG_FILE_LOCATION; - } - - // ********** Logger ********** - /** - * Returns Logger or custom logger class. - * - * @return EclipseLink string value for Logger enum or custom logger class - */ - public String getLogger() { - return this.logger; - } - - /** - * Sets EclipseLink logger. - * - * @param newLogger - Logger - */ - public void setLogger(Logger newLogger) { - if( newLogger == null) { - this.setLogger_((String) null); - return; - } - this.setLogger_(getEclipseLinkStringValueOf(newLogger)); - } - - /** - * Sets EclipseLink logger or custom logger. - * - * @param newLogger - - * Can be a EclipseLink logger literal or - * a fully qualified class name of a custom logger. - */ - public void setLogger(String newLogger) { - if( newLogger == null) { - this.setLogger_((String) null); - return; - } - Logger logger = Logger.getLoggerFor(newLogger); - if(logger == null) { // custom Logger class - this.setLogger_(newLogger); - } - else { - this.setLogger(logger); - } - } - - private void setLogger_(String newLogger) { - String old = this.logger; - this.logger = newLogger; - this.putProperty(LOGGER_PROPERTY, newLogger); - this.firePropertyChanged(LOGGER_PROPERTY, old, newLogger); - } - - private void loggerChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.logger; - this.logger = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultLogger() { - return DEFAULT_LOGGER; - } - -}
\ 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/logging/Logger.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logger.java deleted file mode 100644 index 30aabea987..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logger.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging; - -/** - * Logger - */ -public enum Logger { - default_logger, - java_logger, - server_logger; - - // EclipseLink value string - public static final String DEFAULT_LOGGER = "DefaultLogger"; - public static final String JAVA_LOGGER = "JavaLogger"; - public static final String SERVER_LOGGER = "ServerLogger"; - - /** - * Return the Logger value corresponding to the given literal. - */ - public static Logger getLoggerFor(String literal) { - - for( Logger logger : Logger.values()) { - if(logger.toString().equals(literal)) { - return logger; - } - } - return null; - } -}
\ 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/logging/Logging.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logging.java deleted file mode 100644 index 25590109ae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/Logging.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging; - -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Logging - */ -public interface Logging extends PersistenceUnitProperties -{ - LoggingLevel getDefaultLevel(); - LoggingLevel getLevel(); - void setLevel(LoggingLevel level); - static final String LEVEL_PROPERTY = "levelProperty"; - // EclipseLink key string - static final String ECLIPSELINK_LEVEL = "eclipselink.logging.level"; - static final LoggingLevel DEFAULT_LEVEL = LoggingLevel.info; - - Boolean getDefaultTimestamp(); - Boolean getTimestamp(); - void setTimestamp(Boolean timestamp); - static final String TIMESTAMP_PROPERTY = "timestampProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TIMESTAMP = "eclipselink.logging.timestamp"; - static final Boolean DEFAULT_TIMESTAMP = Boolean.TRUE; - - Boolean getDefaultThread(); - Boolean getThread(); - void setThread(Boolean thread); - static final String THREAD_PROPERTY = "threadProperty"; - // EclipseLink key string - static final String ECLIPSELINK_THREAD = "eclipselink.logging.thread"; - static final Boolean DEFAULT_THREAD = Boolean.TRUE; - - Boolean getDefaultSession(); - Boolean getSession(); - void setSession(Boolean session); - static final String SESSION_PROPERTY = "sessionProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION = "eclipselink.logging.session"; - static final Boolean DEFAULT_SESSION = Boolean.TRUE; - - Boolean getDefaultExceptions(); - Boolean getExceptions(); - void setExceptions(Boolean exceptions); - static final String EXCEPTIONS_PROPERTY = "exceptionsProperty"; - // EclipseLink key string - static final String ECLIPSELINK_EXCEPTIONS = "eclipselink.logging.exceptions"; - static final Boolean DEFAULT_EXCEPTIONS = Boolean.FALSE; - - String getDefaultLogFileLocation(); - String getLogFileLocation(); - void setLogFileLocation(String newLogFileLocation); - static final String LOG_FILE_LOCATION_PROPERTY = "logFileLocationProperty"; - // EclipseLink key string - static final String ECLIPSELINK_LOG_FILE_LOCATION = "eclipselink.logging.file"; - static final String DEFAULT_LOG_FILE_LOCATION = null; // No Default - - String getDefaultLogger(); - String getLogger(); - void setLogger(String newLogger); - void setLogger(Logger newLogger); - static final String LOGGER_PROPERTY = "loggerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_LOGGER = "eclipselink.logging.logger"; - static final String DEFAULT_LOGGER = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(Logger.default_logger); - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java deleted file mode 100644 index 156404464c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/logging/LoggingLevel.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging; - -/** - * LoggingLevel - */ -public enum LoggingLevel { - off, - severe, - warning, - info, - config, - fine, - finer, - finest; - - // EclipseLink value string - public static final String OFF = "OFF"; - public static final String SEVERE = "SEVERE"; - public static final String WARNING = "WARNING"; - public static final String INFO = "INFO"; - public static final String CONFIG = "CONFIG"; - public static final String FINE = "FINE"; - public static final String FINER = "FINER"; - public static final String FINEST = "FINEST"; -} 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 deleted file mode 100644 index 658c0447bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java +++ /dev/null @@ -1,393 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.options; - -import java.util.Map; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -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 - */ -public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties - implements Options -{ - // ********** EclipseLink properties ********** - private String sessionName; - private String sessionsXml; - private Boolean includeDescriptorQueries; - private String targetDatabase; // storing EclipseLinkStringValue since value can be TargetDatabase or custom class - private String targetServer; // storing EclipseLinkStringValue since value can be TargetServer or custom class - private String eventListener; - private Boolean temporalMutable; - - - // ********** constructors ********** - public EclipseLinkOptions(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.sessionName = - this.getStringValue(ECLIPSELINK_SESSION_NAME); - this.sessionsXml = - this.getStringValue(ECLIPSELINK_SESSIONS_XML); - this.includeDescriptorQueries = - this.getBooleanValue(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES); - this.targetDatabase = this.getTargetDatabaseFromPersistenceXml(); - this.targetServer = this.getTargetServerFromPersistenceXml(); - this.eventListener = - this.getStringValue(ECLIPSELINK_SESSION_EVENT_LISTENER); - this.temporalMutable = - this.getBooleanValue(ECLIPSELINK_TEMPORAL_MUTABLE); - } - - protected String getTargetDatabaseFromPersistenceXml() { - - TargetDatabase standardTargetDatabase = this.getEnumValue(ECLIPSELINK_TARGET_DATABASE, TargetDatabase.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_TARGET_DATABASE)) { - return(null); - } - else if(standardTargetDatabase == null) { - return(this.getStringValue(ECLIPSELINK_TARGET_DATABASE)); // custom targetDatabase - } - else { - return(getEclipseLinkStringValueOf(standardTargetDatabase)); - } - } - - protected String getTargetServerFromPersistenceXml() { - - TargetServer standardTargetServer = this.getEnumValue(ECLIPSELINK_TARGET_SERVER, TargetServer.values()); - if( ! this.getPersistenceUnit().containsProperty(ECLIPSELINK_TARGET_SERVER)) { - return(null); - } - else if(standardTargetServer == null) { - return(this.getStringValue(ECLIPSELINK_TARGET_SERVER)); // custom targetServer - } - else { - return(getEclipseLinkStringValueOf(standardTargetServer)); - } - } - - // ********** behavior ********** - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_SESSION_NAME, - SESSION_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSIONS_XML, - SESSIONS_XML_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES, - SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_DATABASE, - TARGET_DATABASE_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_SERVER, - TARGET_SERVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_EVENT_LISTENER, - SESSION_EVENT_LISTENER_PROPERTY); - propertyNames.put( - ECLIPSELINK_TEMPORAL_MUTABLE, - 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); - } - return; - } - - // ********** SessionName ********** - public String getSessionName() { - return this.sessionName; - } - - public void setSessionName(String newSessionName) { - String old = this.sessionName; - this.sessionName = newSessionName; - this.putProperty(SESSION_NAME_PROPERTY, newSessionName); - this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newSessionName); - } - - private void sessionNameChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.sessionName; - this.sessionName = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultSessionName() { - return DEFAULT_SESSION_NAME; - } - - // ********** 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); - } - - private void sessionsXmlChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.sessionsXml; - this.sessionsXml = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultSessionsXml() { - return DEFAULT_SESSIONS_XML; - } - - // ********** IncludeDescriptorQueries ********** - public Boolean getIncludeDescriptorQueries() { - return this.includeDescriptorQueries; - } - - public void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries) { - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newIncludeDescriptorQueries; - this.putProperty(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, newIncludeDescriptorQueries); - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newIncludeDescriptorQueries); - } - - private void includeDescriptorQueriesChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultIncludeDescriptorQueries() { - return DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES; - } - - // ********** TargetDatabase ********** - /** - * Returns TargetDatabase or custom targetDatabase class. - * - * @return EclipseLink string value for TargetDatabase enum or custom targetDatabase class - */ - public String getTargetDatabase() { - return this.targetDatabase; - } - - /** - * Sets EclipseLink targetDatabase. - * - * @param newTargetDatabase - TargetDatabase - */ - public void setTargetDatabase(TargetDatabase newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - this.setTargetDatabase_(getEclipseLinkStringValueOf(newTargetDatabase)); - } - - /** - * Sets EclipseLink targetDatabase or custom targetDatabase. - * - * @param newTargetDatabase - - * Can be a EclipseLink TargetDatabase literal or - * a fully qualified class name of a custom targetDatabase. - */ - public void setTargetDatabase(String newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - TargetDatabase customTargetDatabase = TargetDatabase.getTargetDatabaseFor(newTargetDatabase); - if(customTargetDatabase == null) { // custom TargetDatabase class - this.setTargetDatabase_(newTargetDatabase); - } - else { - this.setTargetDatabase(customTargetDatabase); - } - } - - private void setTargetDatabase_(String newTargetDatabase) { - String old = this.targetDatabase; - this.targetDatabase = newTargetDatabase; - this.putProperty(TARGET_DATABASE_PROPERTY, newTargetDatabase); - this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newTargetDatabase); - } - - private void targetDatabaseChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.targetDatabase; - this.targetDatabase = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultTargetDatabase() { - return DEFAULT_TARGET_DATABASE; - } - - // ********** TargetServer ********** - /** - * Returns TargetServer or custom targetServer class. - * - * @return EclipseLink string value for TargetServer enum or custom targetServer class - */ - public String getTargetServer() { - return this.targetServer; - } - - /** - * Sets EclipseLink targetServer. - * - * @param newTargetServer - TargetServer - */ - public void setTargetServer(TargetServer newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - this.setTargetServer_(getEclipseLinkStringValueOf(newTargetServer)); - } - - /** - * Sets EclipseLink targetServer or custom targetServer. - * - * @param newTargetServer - - * Can be a EclipseLink TargetServer literal or - * a fully qualified class name of a custom targetServer. - */ - public void setTargetServer(String newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - TargetServer customTargetServer = TargetServer.getTargetServerFor(newTargetServer); - if(customTargetServer == null) { // custom TargetServer class - this.setTargetServer_(newTargetServer); - } - else { - this.setTargetServer(customTargetServer); - } - } - - private void setTargetServer_(String newTargetServer) { - String old = this.targetServer; - this.targetServer = newTargetServer; - this.putProperty(TARGET_SERVER_PROPERTY, newTargetServer); - this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newTargetServer); - } - - private void targetServerChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.targetServer; - this.targetServer = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultTargetServer() { - return DEFAULT_TARGET_SERVER; - } - - // ********** EventListener ********** - public String getEventListener() { - return this.eventListener; - } - - public void setEventListener(String newEventListener) { - String old = this.eventListener; - this.eventListener = newEventListener; - this.putProperty(SESSION_EVENT_LISTENER_PROPERTY, newEventListener); - this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newEventListener); - } - - private void eventListenerChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.eventListener; - this.eventListener = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultEventListener() { - return DEFAULT_SESSION_EVENT_LISTENER; - } - - // ********** TemporalMutable ********** - - public Boolean getTemporalMutable() { - return this.temporalMutable; - } - - public void setTemporalMutable(Boolean newTemporalMutable) { - Boolean old = this.temporalMutable; - this.temporalMutable = newTemporalMutable; - this.putProperty(TEMPORAL_MUTABLE_PROPERTY, newTemporalMutable); - this.firePropertyChanged(TEMPORAL_MUTABLE_PROPERTY, old, newTemporalMutable); - } - - private void temporalMutableChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.temporalMutable; - this.temporalMutable = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultTemporalMutable() { - return DEFAULT_TEMPORAL_MUTABLE; - } - -}
\ 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/options/Options.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/Options.java deleted file mode 100644 index 4c39623c52..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/Options.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.options; - -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * Session Options - */ -public interface Options extends PersistenceUnitProperties -{ - String getDefaultSessionName(); - String getSessionName(); - void setSessionName(String newSessionName); - static final String SESSION_NAME_PROPERTY = "sessionNameProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_NAME = "eclipselink.session-name"; - static final String DEFAULT_SESSION_NAME = ""; // no default - - String getDefaultSessionsXml(); - String getSessionsXml(); - void setSessionsXml(String newSessionsXml); - static final String SESSIONS_XML_PROPERTY = "sessionsXmlProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSIONS_XML = "eclipselink.sessions-xml"; - static final String DEFAULT_SESSIONS_XML = ""; // no default - - Boolean getDefaultIncludeDescriptorQueries(); - Boolean getIncludeDescriptorQueries(); - void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries); - static final String SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY = "includeDescriptorQueriesProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES = "eclipselink.session.include.descriptor.queries"; - static final Boolean DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES = Boolean.TRUE; - - String getDefaultTargetDatabase(); - String getTargetDatabase(); - void setTargetDatabase(String newTargetDatabase); - void setTargetDatabase(TargetDatabase newTargetDatabase); - static final String TARGET_DATABASE_PROPERTY = "targetDatabaseProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TARGET_DATABASE = "eclipselink.target-database"; - static final String DEFAULT_TARGET_DATABASE = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(TargetDatabase.auto); - - String getDefaultTargetServer(); - String getTargetServer(); - void setTargetServer(String newTargetServer); - void setTargetServer(TargetServer newTargetServer); - static final String TARGET_SERVER_PROPERTY = "targetServerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TARGET_SERVER = "eclipselink.target-server"; - static final String DEFAULT_TARGET_SERVER = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(TargetServer.none); - - String getDefaultEventListener(); - String getEventListener(); - void setEventListener(String newEventListener); - static final String SESSION_EVENT_LISTENER_PROPERTY = "eventListenerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_EVENT_LISTENER = "eclipselink.session-event-listener"; - static final String DEFAULT_SESSION_EVENT_LISTENER = null; // no default - - - Boolean getDefaultTemporalMutable(); - Boolean getTemporalMutable(); - void setTemporalMutable(Boolean temporalMutable); - static final String TEMPORAL_MUTABLE_PROPERTY = "temporalMutableProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TEMPORAL_MUTABLE = "eclipselink.temporal.mutable"; - static final Boolean DEFAULT_TEMPORAL_MUTABLE = Boolean.FALSE; - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetDatabase.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetDatabase.java deleted file mode 100644 index 9b7c64ee73..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetDatabase.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.options; - -/** - * TargetDatabase - */ -public enum TargetDatabase { - attunity, - auto, - cloudscape, - database, - db2, - db2mainframe, - dbase, - derby, - hsql, - informix, - javadb, - mysql, - oracle, - oracle11, - oracle10, - oracle9, - oracle8, - pointbase, - postgresql, - sqlanywhere, - sqlserver, - sybase, - timesten; - - // EclipseLink value string - static final String ATTUNITY = "Attunity"; - static final String AUTO = "Auto"; - static final String CLOUDSCAPE = "Cloudscape"; - static final String DATABASE = "Database"; - static final String DB2 = "DB2"; - static final String DB2MAINFRAME = "DB2Mainframe"; - static final String DBASE = "DBase"; - static final String DERBY = "Derby"; - static final String HSQL = "HSQL"; - static final String INFORMIX = "Informix"; - static final String JAVADB = "JavaDB"; - static final String MYSQL = "MySQL"; - static final String ORACLE = "Oracle"; - static final String ORACLE11 = "Oracle11"; - static final String ORACLE10 = "Oracle10g"; - static final String ORACLE9 = "Oracle9i"; - static final String ORACLE8 = "Oracle8i"; - static final String POINTBASE = "PointBase"; - static final String POSTGRESQL = "PostgreSQL"; - static final String SQLANYWHERE = "SQLAnywhere"; - static final String SQLSERVER = "SQLServer"; - static final String SYBASE = "Sybase"; - static final String TIMESTEN = "TimesTen"; - - /** - * Return the TargetDatabase value corresponding to the given literal. - */ - public static TargetDatabase getTargetDatabaseFor(String literal) { - - for( TargetDatabase targetDatabase : TargetDatabase.values()) { - if(targetDatabase.toString().equals(literal)) { - return targetDatabase; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetServer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetServer.java deleted file mode 100644 index e0ea2a033d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/options/TargetServer.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.options; - -/** - * TargetServer - */ -public enum TargetServer { - none, - oc4j, - sunas9, - websphere, - websphere_6_1, - weblogic, - weblogic_9, - weblogic_10, - jboss; - - // EclipseLink value string - static final String NONE = "None"; - static final String OC4J = "OC4J"; - static final String SUNAS9 = "SunAS9"; - static final String WEBSPHERE = "WebSphere"; - static final String WEBSPHERE_6_1 = "WebSphere_6_1"; - static final String WEBLOGIC = "WebLogic"; - static final String WEBLOGIC_9 = "WebLogic_9"; - static final String WEBLOGIC_10 = "WebLogic_10"; - static final String JBOSS = "JBoss"; - - /** - * Return the TargetServer value corresponding to the given literal. - */ - public static TargetServer getTargetServerFor(String literal) { - - for( TargetServer targetServer : TargetServer.values()) { - if(targetServer.toString().equals(literal)) { - return targetServer; - } - } - return null; - } -}
\ 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/schema/generation/DdlGenerationType.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/DdlGenerationType.java deleted file mode 100644 index 6abdfc3f83..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/DdlGenerationType.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation; - -/** - * DdlGenerationType - */ -public enum DdlGenerationType { - none, - create_tables, - drop_and_create_tables; - - // EclipseLink value string - public static final String NONE = "none"; - public static final String CREATE_TABLES = "create-tables"; - public static final String DROP_AND_CREATE_TABLES = "drop-and-create-tables"; -}
\ 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/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 deleted file mode 100644 index 4817223992..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation; - -import java.util.Map; -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -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 - * properties. - */ -public class EclipseLinkSchemaGeneration - extends EclipseLinkPersistenceUnitProperties implements SchemaGeneration -{ - // ********** EclipseLink properties ********** - - private OutputMode outputMode; - private DdlGenerationType ddlGenerationType; - private String createFileName; - private String dropFileName; - private String applicationLocation; - - // ********** constructors/initialization ********** - - public EclipseLinkSchemaGeneration(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.outputMode = - this.getEnumValue(ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, OutputMode.values()); - this.ddlGenerationType = - this.getEnumValue(ECLIPSELINK_DDL_GENERATION_TYPE, DdlGenerationType.values()); - this.createFileName = - this.getStringValue(ECLIPSELINK_CREATE_FILE_NAME); - this.dropFileName = - this.getStringValue(ECLIPSELINK_DROP_FILE_NAME); - this.applicationLocation = - this.getStringValue(ECLIPSELINK_APPLICATION_LOCATION); - } - - /** - * Adds property names key/value pairs, where: key = EclipseLink property - * key; value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, - OUTPUT_MODE_PROPERTY); - propertyNames.put( - ECLIPSELINK_DDL_GENERATION_TYPE, - DDL_GENERATION_TYPE_PROPERTY); - propertyNames.put( - ECLIPSELINK_CREATE_FILE_NAME, - CREATE_FILE_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_DROP_FILE_NAME, - DROP_FILE_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_APPLICATION_LOCATION, - APPLICATION_LOCATION_PROPERTY); - } - - // ********** behavior ********** - public void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - - if (aspectName.equals(OUTPUT_MODE_PROPERTY)) { - this.outputModeChanged(event); - } - else if (aspectName.equals(DDL_GENERATION_TYPE_PROPERTY)) { - this.ddlGenerationTypeChanged(event); - } - else if (aspectName.equals(CREATE_FILE_NAME_PROPERTY)) { - this.createFileNameChanged(event); - } - else if (aspectName.equals(DROP_FILE_NAME_PROPERTY)) { - this.dropFileNameChanged(event); - } - else if (aspectName.equals(APPLICATION_LOCATION_PROPERTY)) { - this.applicationLocationChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - // ********** DdlGenerationType ********** - public DdlGenerationType getDdlGenerationType() { - return this.ddlGenerationType; - } - - public void setDdlGenerationType(DdlGenerationType newDdlGenType) { - DdlGenerationType old = this.ddlGenerationType; - this.ddlGenerationType = newDdlGenType; - this.putProperty(DDL_GENERATION_TYPE_PROPERTY, newDdlGenType); - this.firePropertyChanged(DDL_GENERATION_TYPE_PROPERTY, old, newDdlGenType); - } - - private void ddlGenerationTypeChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - DdlGenerationType newValue = getEnumValueOf(stringValue, DdlGenerationType.values()); - DdlGenerationType old = this.ddlGenerationType; - this.ddlGenerationType = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public DdlGenerationType getDefaultDdlGenerationType() { - return DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE; - } - - // ********** OutputMode ********** - public OutputMode getOutputMode() { - return this.outputMode; - } - - public void setOutputMode(OutputMode newOutputMode) { - OutputMode old = this.outputMode; - this.outputMode = newOutputMode; - this.putProperty(OUTPUT_MODE_PROPERTY, newOutputMode); - this.firePropertyChanged(OUTPUT_MODE_PROPERTY, old, newOutputMode); - } - - private void outputModeChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - OutputMode newValue = getEnumValueOf(stringValue, OutputMode.values()); - OutputMode old = this.outputMode; - this.outputMode = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public OutputMode getDefaultOutputMode() { - return DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE; - } - - // ********** CreateFileName ********** - public String getCreateFileName() { - return this.createFileName; - } - - public void setCreateFileName(String newCreateFileName) { - String old = this.createFileName; - this.createFileName = newCreateFileName; - this.putProperty(CREATE_FILE_NAME_PROPERTY, newCreateFileName); - this.firePropertyChanged(CREATE_FILE_NAME_PROPERTY, old, newCreateFileName); - } - - private void createFileNameChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.createFileName; - this.createFileName = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultCreateFileName() { - return DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME; - } - - // ********** dropFileName ********** - public String getDropFileName() { - return this.dropFileName; - } - - public void setDropFileName(String newDropFileName) { - String old = this.dropFileName; - this.dropFileName = newDropFileName; - this.putProperty(DROP_FILE_NAME_PROPERTY, newDropFileName); - this.firePropertyChanged(DROP_FILE_NAME_PROPERTY, old, newDropFileName); - } - - private void dropFileNameChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.dropFileName; - this.dropFileName = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultDropFileName() { - return DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME; - } - - // ********** applicationLocation ********** - public String getApplicationLocation() { - return this.applicationLocation; - } - - public void setApplicationLocation(String newApplicationLocation) { - String old = this.applicationLocation; - this.applicationLocation = newApplicationLocation; - this.putProperty(APPLICATION_LOCATION_PROPERTY, newApplicationLocation); - this.firePropertyChanged(APPLICATION_LOCATION_PROPERTY, old, newApplicationLocation); - } - - private void applicationLocationChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.applicationLocation; - this.applicationLocation = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultApplicationLocation() { - return DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/OutputMode.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/OutputMode.java deleted file mode 100644 index a8617da839..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/OutputMode.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation; - -/** - * OutputMode - */ -public enum OutputMode { - both, - sql_script, - database; - - // EclipseLink value string - public static final String BOTH = "both"; - public static final String DATABASE = "database"; - public static final String SQL_SCRIPT = "sql-script"; -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/SchemaGeneration.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/SchemaGeneration.java deleted file mode 100644 index ef0766a746..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/schema/generation/SchemaGeneration.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation; - -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.PersistenceUnitProperties; - -/** - * SchemaGeneration - */ -public interface SchemaGeneration extends PersistenceUnitProperties -{ - DdlGenerationType getDefaultDdlGenerationType(); - DdlGenerationType getDdlGenerationType(); - void setDdlGenerationType(DdlGenerationType ddlGenerationType); - static final String DDL_GENERATION_TYPE_PROPERTY = "ddlGenerationTypeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DDL_GENERATION_TYPE = "eclipselink.ddl-generation"; - static final DdlGenerationType DEFAULT_SCHEMA_GENERATION_DDL_GENERATION_TYPE = DdlGenerationType.none; - - OutputMode getDefaultOutputMode(); - OutputMode getOutputMode(); - void setOutputMode(OutputMode outputMode); // put - static final String OUTPUT_MODE_PROPERTY = "outputModeProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE = "eclipselink.ddl-generation.output-mode"; - static final OutputMode DEFAULT_SCHEMA_GENERATION_OUTPUT_MODE = null; // No Default - - String getDefaultCreateFileName(); - String getCreateFileName(); - void setCreateFileName(String createFileName); - static final String CREATE_FILE_NAME_PROPERTY = "createFileNameProperty"; - // EclipseLink key string - static final String ECLIPSELINK_CREATE_FILE_NAME = "eclipselink.create-ddl-jdbc-file-name"; - static final String DEFAULT_SCHEMA_GENERATION_CREATE_FILE_NAME = "createDDL.jdbc"; - - String getDefaultDropFileName(); - String getDropFileName(); - void setDropFileName(String dropFileName); - static final String DROP_FILE_NAME_PROPERTY = "dropFileNameProperty"; - // EclipseLink key string - static final String ECLIPSELINK_DROP_FILE_NAME = "eclipselink.drop-ddl-jdbc-file-name"; - static final String DEFAULT_SCHEMA_GENERATION_DROP_FILE_NAME = "dropDDL.jdbc"; - - String getDefaultApplicationLocation(); - String getApplicationLocation(); - void setApplicationLocation(String applicationLocation); - static final String APPLICATION_LOCATION_PROPERTY = "applicationLocationProperty"; - // EclipseLink key string - static final String ECLIPSELINK_APPLICATION_LOCATION = "eclipselink.application-location"; - static final String DEFAULT_SCHEMA_GENERATION_APPLICATION_LOCATION = "."; - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java deleted file mode 100644 index 3d61e00c66..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java +++ /dev/null @@ -1,494 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.ddlgen; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.ILaunchesListener2; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jpt.core.JpaPlatform; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.internal.JptCoreMessages; -import org.eclipse.jpt.db.ConnectionProfile; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization.Customization; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.Logging; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.LoggingLevel; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.DdlGenerationType; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.OutputMode; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.schema.generation.SchemaGeneration; -import org.eclipse.wst.validation.ValidationFramework; - -/** - * EclipseLinkDLLGenerator launches the EclipseLink DDL generator in a separate VM. - * For this it will create a Java Configuration named "EclipseLink" - * in the target workspace (note: the configuration will be overridden at each run). - * It will than launch the configuration created with the login information from - * the current Dali project, and passes it to EclipseLink. - * - * Pre-req: - * org.eclipse.jpt.eclipselink.core.ddlgen.jar in ECLIPSE_HOME/plugins - */ -public class EclipseLinkDDLGenerator -{ - static public String ECLIPSELINK_DDL_GEN_JAR_VERSION = "1.0.100"; //$NON-NLS-1$ - static public String LAUNCH_CONFIG_NAME = "EclipseLink"; //$NON-NLS-1$ - static public String DDL_GEN_PACKAGE_NAME = "org.eclipse.jpt.eclipselink.core.ddlgen"; //$NON-NLS-1$ - static public String ECLIPSELINK_DDL_GEN_CLASS = DDL_GEN_PACKAGE_NAME + ".Main"; //$NON-NLS-1$ - static public String ECLIPSELINK_DDL_GEN_JAR = DDL_GEN_PACKAGE_NAME + "_"; //$NON-NLS-1$ - static public String PROPERTIES_FILE_NAME = "login.properties"; //$NON-NLS-1$ - static public String ECLIPSE_HOME = "ECLIPSE_HOME"; //$NON-NLS-1$ - static public String PLUGINS_DIR = "plugins"; //$NON-NLS-1$ - private IVMInstall jre; - private ILaunchConfigurationWorkingCopy launchConfig; - private ILaunch launch; - - private String puName; - private JpaProject jpaProject; - private String projectLocation; - private boolean isDebug = false; - - // ********** constructors ********** - - public static void generate(String puName, JpaProject project, String projectLocation, IProgressMonitor monitor) { - if (puName == null || puName.length() == 0 || project == null) { - throw new NullPointerException(); - } - new EclipseLinkDDLGenerator(puName, project, projectLocation, monitor).generate(); - } - - private EclipseLinkDDLGenerator(String puName, JpaProject jpaProject, String projectLocation, IProgressMonitor monitor) { - super(); - this.puName = puName; - this.jpaProject = jpaProject; - this.projectLocation = projectLocation; - this.initialize(); - } - - // ********** Queries ********** - - protected JpaPlatform getPlatform() { - return this.jpaProject.getJpaPlatform(); - } - - protected ILaunch getLaunch() { - return this.launch; - } - - protected ILaunchManager getLaunchManager() { - return DebugPlugin.getDefault().getLaunchManager(); - } - - private IVMInstall getProjectJRE() throws CoreException { - - return JavaRuntime.getVMInstall(this.jpaProject.getJavaProject()); - } - - // ********** behavior ********** - - protected void initialize() { - try { - this.jre = this.getProjectJRE(); - if(this.jre == null) { - String message = "Could not identify the VM."; - throw new RuntimeException(message); - } - this.launchConfig = this.buildLaunchConfiguration(); - } - catch (CoreException e) { - throw new RuntimeException(e); - } - } - - protected void generate() { - this.preGenerate(); - String propertiesFile = this.projectLocation + "/" + PROPERTIES_FILE_NAME; - try { - this.initializeLaunchConfiguration(this.projectLocation, propertiesFile); - - this.saveLoginProperties(this.projectLocation, propertiesFile); - - this.launch = this.saveAndLaunchConfig(); - this.addLaunchListener(); - } - catch (CoreException e) { - throw new RuntimeException(e); - } - } - - private void initializeLaunchConfiguration(String projectLocation, String propertiesFile) throws CoreException { - - this.specifyJRE(this.jre.getName(), this.jre.getVMInstallType().getId()); - - this.specifyProject(this.jpaProject.getProject().getName()); - this.specifyMainType(ECLIPSELINK_DDL_GEN_CLASS); - - this.specifyProgramArguments(this.puName, propertiesFile); - this.specifyWorkingDir(projectLocation); - - this.specifyClasspathProperties(this.jpaProject, this.buildJdbcJarPath(), this.buildBootstrapJarPath()); - } - - private void addLaunchListener() { - - this.getLaunchManager().addLaunchListener(this.buildLaunchListener()); - } - - protected void preGenerate() { - ConnectionProfile cp = this.jpaProject.getConnectionProfile(); - if (cp != null) { - cp.disconnect(); - } - } - - protected void postGenerate() { - try { - if(! this.isDebug) { - this.removeLaunchConfiguration(LAUNCH_CONFIG_NAME); - } - } - catch ( CoreException e) { - throw new RuntimeException(e); - } - ConnectionProfile cp = this.jpaProject.getConnectionProfile(); - if (cp != null) { - cp.connect(); - } - - this.validateProject(); - } - - protected void validateProject() { - IProject project = this.jpaProject.getProject(); - ValidateJob job = new ValidateJob(project); - job.setRule(project); - job.schedule(); - } - - private IPath buildJdbcJarPath() { - return new Path(this.getJpaProjectConnectionDriverJarList()); - } - - private String getJpaProjectConnectionDriverJarList() { - ConnectionProfile cp = this.jpaProject.getConnectionProfile(); - return (cp == null) ? "" : cp.getDriverJarList(); //$NON-NLS-1$ - } - - private IPath buildBootstrapJarPath() { - - IPath path = JavaCore.getClasspathVariable(ECLIPSE_HOME).append(PLUGINS_DIR); - File eclipseHome = path.toFile(); - - List<File> result = new ArrayList<File>(); - this.findFile(ECLIPSELINK_DDL_GEN_JAR, eclipseHome, result); - - File ddlGenJarFile = result.get(0); - try { - String ddlGenJarPath = ddlGenJarFile.getCanonicalPath(); - return new Path(ddlGenJarPath); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - private void findFile(String fileName, File directory, List<? super File> list) { - for (File file : directory.listFiles()) { - if (file.getName().startsWith(fileName)) { - list.add(file); - } - if (file.isDirectory()) { - findFile(fileName, file, list); - } - } - } - - private ILaunchesListener2 buildLaunchListener() { - return new ILaunchesListener2() { - - public void launchesTerminated(ILaunch[] launches) { - for (int i = 0; i < launches.length; i++) { - ILaunch launch = launches[i]; - if (launch.equals(EclipseLinkDDLGenerator.this.getLaunch())) { - - EclipseLinkDDLGenerator.this.postGenerate(); - return; - } - } - } - - public void launchesAdded(ILaunch[] launches) { - // not interested to this event - } - - public void launchesChanged(ILaunch[] launches) { - // not interested to this event - } - - public void launchesRemoved(ILaunch[] launches) { - // not interested to this event - } - }; - } - - // ********** launch configuration ********** - - private void specifyJRE(String jreName, String vmId) { - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, jreName); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, vmId); - } - - private void specifyProject(String projectName) { - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName); - } - - private void specifyMainType(String mainType) { - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainType); - } - - private void specifyProgramArguments(String puName, String propertiesPath) { - - StringBuffer programArguments = new StringBuffer(); - programArguments.append(this.buildPuNameArgument(puName)); - programArguments.append(this.buildPropertiesPathArgument(propertiesPath)); - programArguments.append(this.buildDebugArgument()); - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - private void specifyClasspathProperties(JpaProject project, IPath jdbcJar, IPath bootstrapJar) throws CoreException { - // DDL_GEN jar - IRuntimeClasspathEntry bootstrapEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(bootstrapJar); - bootstrapEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); - // Default Project classpath - IRuntimeClasspathEntry defaultEntry = JavaRuntime.newDefaultProjectClasspathEntry(project.getJavaProject()); - defaultEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); - // JDBC jar - IRuntimeClasspathEntry jdbcEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(jdbcJar); - jdbcEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); - // System Library - IPath systemLibsPath = new Path(JavaRuntime.JRE_CONTAINER); - IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(systemLibsPath, IRuntimeClasspathEntry.STANDARD_CLASSES); - - List<String> classpath = new ArrayList<String>(); - classpath.add(bootstrapEntry.getMemento()); - classpath.add(defaultEntry.getMemento()); - classpath.add(jdbcEntry.getMemento()); - classpath.add(systemLibsEntry.getMemento()); - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false); - } - - private void specifyWorkingDir(String projectLocation) { - - File workingDir = new Path(projectLocation).toFile(); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDir.getAbsolutePath()); - } - - private ILaunch saveAndLaunchConfig() throws CoreException { - ILaunchConfiguration configuration = this.launchConfig.doSave(); - - return configuration.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor()); - } - - private ILaunchConfigurationWorkingCopy buildLaunchConfiguration() throws CoreException { - ILaunchConfigurationWorkingCopy launchConfig = null; - this.removeLaunchConfiguration( LAUNCH_CONFIG_NAME); - - ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); - - launchConfig = type.newInstance(null, LAUNCH_CONFIG_NAME); - return launchConfig; - } - - private void removeLaunchConfiguration(String launchConfigurationName) throws CoreException { - - ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); - - ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(type); - for (int i = 0; i < configurations.length; i++) { - ILaunchConfiguration configuration = configurations[i]; - if (configuration.getName().equals(launchConfigurationName)) { - configuration.delete(); - break; - } - } - } - - // ********** EclipseLink properties ********** - - private void buildProjectLocationProperty(Properties properties, String location) { - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_APPLICATION_LOCATION, - location); - } - - private void buildDDLModeProperties(Properties properties) { - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_DDL_GENERATION_TYPE, - DdlGenerationType.DROP_AND_CREATE_TABLES); - this.putProperty(properties, - SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE, - OutputMode.DATABASE); - } - - private void buildConnectionProperties(Properties properties) { - ConnectionProfile cp = this.jpaProject.getConnectionProfile(); - - this.putProperty(properties, - Connection.ECLIPSELINK_BIND_PARAMETERS, - "false"); - this.putProperty(properties, - Connection.ECLIPSELINK_DRIVER, - (cp == null) ? "" : cp.getDriverClassName()); - this.putProperty(properties, - Connection.ECLIPSELINK_URL, - (cp == null) ? "" : cp.getURL()); - this.putProperty(properties, - Connection.ECLIPSELINK_USER, - (cp == null) ? "" : cp.getUserName()); - this.putProperty(properties, - Connection.ECLIPSELINK_PASSWORD, - (cp == null) ? "" : cp.getUserPassword()); - } - - private void buildConnectionPoolingProperties(Properties properties) { - this.putProperty(properties, - Connection.ECLIPSELINK_READ_CONNECTIONS_SHARED, - "true"); - } - - private void buildLoggingProperties(Properties properties) { - this.putProperty(properties, - Logging.ECLIPSELINK_LEVEL, - LoggingLevel.FINE); - this.putProperty(properties, - Logging.ECLIPSELINK_TIMESTAMP, - "false"); - this.putProperty(properties, - Logging.ECLIPSELINK_THREAD, - "false"); - this.putProperty(properties, - Logging.ECLIPSELINK_SESSION, - "false"); - this.putProperty(properties, - Logging.ECLIPSELINK_EXCEPTIONS, - "true"); - } - - private void buildCustomizationProperties(Properties properties) { - this.putProperty(properties, - Customization.ECLIPSELINK_THROW_EXCEPTIONS, - "true"); - } - - private void putProperty(Properties properties, String key, String value) { - properties.put(key, (value == null) ? "" : value); - } - - private void saveLoginProperties(String projectLocation, String propertiesFile) { - Properties elProperties = new Properties(); - - this.buildConnectionProperties(elProperties); - - this.buildConnectionPoolingProperties(elProperties); - - this.buildLoggingProperties(elProperties); - - this.buildCustomizationProperties(elProperties); - - this.buildDDLModeProperties(elProperties); - - this.buildProjectLocationProperty(elProperties, projectLocation); - try { - File file = new File(propertiesFile); - file.createNewFile(); - FileOutputStream stream = new FileOutputStream(file); - elProperties.store(stream, null); - stream.close(); - } - catch (Exception e) { - String message = "Error saving: " + propertiesFile; - throw new RuntimeException(message, e); - } - } - - // ********** Main arguments ********** - - private String buildPuNameArgument(String puName) { - return " -pu \"" + puName + "\""; - } - - private String buildPropertiesPathArgument(String propertiesFile) { - return " -p \"" + propertiesFile + "\""; - } - - private String buildDebugArgument() { - return (this.isDebug) ? " -debug" : ""; - } - - - /** - * Performs validation after tables have been generated - */ - private class ValidateJob extends Job - { - private IProject project; - - - public ValidateJob(IProject project) { - super(JptCoreMessages.VALIDATE_JOB); - this.project = project; - } - - - @Override - protected IStatus run(IProgressMonitor monitor) { - IStatus status = Status.OK_STATUS; - try { - ValidationFramework.getDefault().validate( - new IProject[] {this.project}, true, false, monitor); - } - catch (CoreException ce) { - status = Status.CANCEL_STATUS; - } - return status; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java deleted file mode 100644 index cd886ee95d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.operations; - -import java.util.Iterator; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaPlatform; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; - -public class EclipseLinkOrmFileCreationDataModelProvider extends OrmFileCreationDataModelProvider -{ - /** - * required default constructor - */ - public EclipseLinkOrmFileCreationDataModelProvider() { - super(); - } - - - @Override - public IDataModelOperation getDefaultOperation() { - return new EclipseLinkOrmFileCreationOperation(getDataModel()); - } - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(FILE_PATH)) { - return new Path(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH).toPortableString(); - } - return super.getDefaultProperty(propertyName); - } - - @Override - protected Iterator<IProject> jpaIProjects() { - return new FilteringIterator<IProject, IProject>(CollectionTools.iterator(ProjectUtilities.getAllProjects())) { - @Override - protected boolean accept(IProject project) { - try { - if (FacetedProjectFramework.hasProjectFacet(project, JptCorePlugin.FACET_ID)) { - JpaProject jpaProject = JptCorePlugin.getJpaProject(project); - return jpaProject != null && jpaProject.getJpaPlatform().getId().equals(EclipseLinkJpaPlatform.ID); - } - return false; - } - catch (CoreException ce) { - return false; - } - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java deleted file mode 100644 index 313a52e930..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.operations; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.Path; -import org.eclipse.jpt.core.internal.operations.OrmFileCreationOperation; -import org.eclipse.jpt.core.resource.orm.AccessType; -import org.eclipse.jpt.core.resource.orm.OrmFactory; -import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults; -import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata; -import org.eclipse.jpt.eclipselink.core.internal.resource.orm.EclipseLinkOrmResourceModelProvider; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmResource; -import org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntityMappings; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class EclipseLinkOrmFileCreationOperation extends OrmFileCreationOperation -{ - public EclipseLinkOrmFileCreationOperation(IDataModel dataModel) { - super(dataModel); - } - - - @Override - protected void createMappingFile(IFolder folder) { - String filePath = getDataModel().getStringProperty(FILE_PATH); - IFile file = folder.getFile(new Path(filePath)); - final EclipseLinkOrmResourceModelProvider modelProvider = - EclipseLinkOrmResourceModelProvider.getModelProvider(file); - - modelProvider.modify(new Runnable() { - public void run() { - EclipseLinkOrmResource ormResource = modelProvider.getResource(); - - XmlEntityMappings entityMappings = EclipseLinkOrmFactory.eINSTANCE.createXmlEntityMappings(); - entityMappings.setVersion("1.0"); //$NON-NLS-1$ - ormResource.getContents().add(entityMappings); - - AccessType defaultAccess = (AccessType) getDataModel().getProperty(DEFAULT_ACCESS); - if (defaultAccess != null) { - XmlPersistenceUnitMetadata puMetadata = OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata(); - entityMappings.setPersistenceUnitMetadata(puMetadata); - XmlPersistenceUnitDefaults puDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults(); - puMetadata.setPersistenceUnitDefaults(puDefaults); - puDefaults.setAccess(defaultAccess); - } - } - }); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionImpl.java deleted file mode 100644 index 7c1b219557..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicCollectionImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicCollectionAnnotation; - - -public class BasicCollectionImpl extends AbstractResourceAnnotation<Attribute> implements BasicCollectionAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - protected BasicCollectionImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void update(CompilationUnit astRoot) { - } - - public static class BasicCollectionAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final BasicCollectionAnnotationDefinition INSTANCE = new BasicCollectionAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static BasicCollectionAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private BasicCollectionAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new BasicCollectionImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapImpl.java deleted file mode 100644 index 3fd7d631ea..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/BasicMapImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.BasicMapAnnotation; - - -public class BasicMapImpl extends AbstractResourceAnnotation<Attribute> implements BasicMapAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - protected BasicMapImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void update(CompilationUnit astRoot) { - } - - public static class BasicMapAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final BasicMapAnnotationDefinition INSTANCE = new BasicMapAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static BasicMapAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private BasicMapAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new BasicMapImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheImpl.java deleted file mode 100644 index 9347356538..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CacheImpl.java +++ /dev/null @@ -1,423 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.core.utility.jdt.Type; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheType; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation; - - -public class CacheImpl extends AbstractResourceAnnotation<Type> implements CacheAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> typeAdapter; - private final AnnotationElementAdapter<Integer> sizeAdapter; - private final AnnotationElementAdapter<Boolean> sharedAdapter; - private final AnnotationElementAdapter<Integer> expiryAdapter; - private final AnnotationElementAdapter<Boolean> alwaysRefreshAdapter; - private final AnnotationElementAdapter<Boolean> refreshOnlyIfNewerAdapter; - private final AnnotationElementAdapter<Boolean> disableHitsAdapter; - private final AnnotationElementAdapter<String> coordinationTypeAdapter; - private final MemberAnnotationAdapter expiryTimeOfDayAdapter; - - private static final DeclarationAnnotationElementAdapter<String> TYPE_ADAPTER = buildTypeAdapter(); - private static final DeclarationAnnotationElementAdapter<Integer> SIZE_ADAPTER = buildSizeAdapter(); - private static final DeclarationAnnotationElementAdapter<Boolean> SHARED_ADAPTER = buildSharedAdapter(); - private static final DeclarationAnnotationElementAdapter<Integer> EXPIRY_ADAPTER = buildExpiryAdapter(); - private static final DeclarationAnnotationElementAdapter<Boolean> ALWAYS_REFRESH_ADAPTER = buildAlwaysRefreshAdapter(); - private static final DeclarationAnnotationElementAdapter<Boolean> REFRESH_ONLY_IF_NEWER_ADAPTER = buildRefreshOnlyIfNewerAdapter(); - private static final DeclarationAnnotationElementAdapter<Boolean> DISABLE_HITS_ADAPTER = buildDisableHitsAdapter(); - private static final DeclarationAnnotationElementAdapter<String> COORDINATION_TYPE_ADAPTER = buildCoordinationTypeAdapter(); - private static final NestedDeclarationAnnotationAdapter EXPIRY_TIME_OF_DAY_ADAPTER = buildExpiryTimeOfDayAnnotationAdapter(); - - - private CacheType type; - private Integer size; - private Boolean shared; - private Integer expiry; - private TimeOfDayAnnotation expiryTimeOfDay; - private Boolean alwaysRefresh; - private Boolean refreshOnlyIfNewer; - private Boolean disableHits; - private CacheCoordinationType coordinationType; - - protected CacheImpl(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.typeAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, TYPE_ADAPTER); - this.sizeAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(type, SIZE_ADAPTER); - this.sharedAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(type, SHARED_ADAPTER); - this.expiryAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(type, EXPIRY_ADAPTER); - this.alwaysRefreshAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(type, ALWAYS_REFRESH_ADAPTER); - this.refreshOnlyIfNewerAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(type, REFRESH_ONLY_IF_NEWER_ADAPTER); - this.disableHitsAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(type, DISABLE_HITS_ADAPTER); - this.coordinationTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, COORDINATION_TYPE_ADAPTER); - this.expiryTimeOfDayAdapter = new MemberAnnotationAdapter(type, EXPIRY_TIME_OF_DAY_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** CacheAnnotation implementation **************** - - public CacheType getType() { - return this.type; - } - - public void setType(CacheType newType) { - if (attributeValueHasNotChanged(this.type, newType)) { - return; - } - CacheType oldType = this.type; - this.type = newType; - this.typeAdapter.setValue(CacheType.toJavaAnnotationValue(newType)); - firePropertyChanged(TYPE_PROPERTY, oldType, newType); - } - - public Integer getSize() { - return this.size; - } - - public void setSize(Integer newSize) { - if (attributeValueHasNotChanged(this.size, newSize)) { - return; - } - Integer oldSize = this.size; - this.size = newSize; - this.sizeAdapter.setValue(newSize); - firePropertyChanged(SIZE_PROPERTY, oldSize, newSize); - } - - public Boolean getShared() { - return this.shared; - } - - public void setShared(Boolean newShared) { - if (attributeValueHasNotChanged(this.shared, newShared)) { - return; - } - Boolean oldShared = this.shared; - this.shared = newShared; - this.sharedAdapter.setValue(newShared); - firePropertyChanged(SHARED_PROPERTY, oldShared, newShared); - } - - public Integer getExpiry() { - return this.expiry; - } - - public void setExpiry(Integer newExpiry) { - if (attributeValueHasNotChanged(this.expiry, newExpiry)) { - return; - } - Integer oldExpiry = this.expiry; - this.expiry = newExpiry; - this.expiryAdapter.setValue(newExpiry); - firePropertyChanged(EXPIRY_PROPERTY, oldExpiry, newExpiry); - } - - public TimeOfDayAnnotation getExpiryTimeOfDay() { - return this.expiryTimeOfDay; - } - - public TimeOfDayAnnotation addExpiryTimeOfDay() { - if (this.expiryTimeOfDay != null) { - throw new IllegalStateException("ExpiryTimeOfDay element already exists"); //$NON-NLS-1$ - } - this.expiryTimeOfDay = createTimeOfDayAnnotation(); - this.expiryTimeOfDayAdapter.newMarkerAnnotation(); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, null, this.expiryTimeOfDay); - return this.expiryTimeOfDay; - } - - public void removeExpiryTimeOfDay() { - if (this.expiryTimeOfDay == null) { - throw new IllegalStateException("No expiryTimeOfDay element exists"); //$NON-NLS-1$ - } - this.expiryTimeOfDay = null; - this.expiryTimeOfDayAdapter.removeAnnotation(); - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, this.expiryTimeOfDay, null); - } - - protected void setExpiryTimeOfDay(TimeOfDayAnnotation newExpiryTimeOfDay) { - TimeOfDayAnnotation oldExpiryTimeOfDay = this.expiryTimeOfDay; - this.expiryTimeOfDay = newExpiryTimeOfDay; - firePropertyChanged(EXPIRY_TIME_OF_DAY_PROPERTY, oldExpiryTimeOfDay, newExpiryTimeOfDay); - } - - public Boolean getAlwaysRefresh() { - return this.alwaysRefresh; - } - - public void setAlwaysRefresh(Boolean newAlwaysRefresh) { - if (attributeValueHasNotChanged(this.alwaysRefresh, newAlwaysRefresh)) { - return; - } - Boolean oldAlwaysRefresh = this.alwaysRefresh; - this.alwaysRefresh = newAlwaysRefresh; - this.alwaysRefreshAdapter.setValue(newAlwaysRefresh); - firePropertyChanged(ALWAYS_REFRESH_PROPERTY, oldAlwaysRefresh, newAlwaysRefresh); - } - - public Boolean getRefreshOnlyIfNewer() { - return this.refreshOnlyIfNewer; - } - - public void setRefreshOnlyIfNewer(Boolean newRefreshOnlyIfNewer) { - if (attributeValueHasNotChanged(this.refreshOnlyIfNewer, newRefreshOnlyIfNewer)) { - return; - } - Boolean oldRefreshOnlyIfNewer = this.refreshOnlyIfNewer; - this.refreshOnlyIfNewer = newRefreshOnlyIfNewer; - this.refreshOnlyIfNewerAdapter.setValue(newRefreshOnlyIfNewer); - firePropertyChanged(REFRESH_ONLY_IF_NEWER_PROPERTY, oldRefreshOnlyIfNewer, newRefreshOnlyIfNewer); - } - - public Boolean getDisableHits() { - return this.disableHits; - } - - public void setDisableHits(Boolean newDisableHits) { - if (attributeValueHasNotChanged(this.disableHits, newDisableHits)) { - return; - } - Boolean oldDisableHits = this.disableHits; - this.disableHits = newDisableHits; - this.disableHitsAdapter.setValue(newDisableHits); - firePropertyChanged(DISABLE_HITS_PROPERTY, oldDisableHits, newDisableHits); - } - - public CacheCoordinationType getCoordinationType() { - return this.coordinationType; - } - - public void setCoordinationType(CacheCoordinationType newCoordinationType) { - if (attributeValueHasNotChanged(this.coordinationType, newCoordinationType)) { - return; - } - CacheCoordinationType oldCoordinationType = this.coordinationType; - this.coordinationType = newCoordinationType; - this.coordinationTypeAdapter.setValue(CacheCoordinationType.toJavaAnnotationValue(newCoordinationType)); - firePropertyChanged(TYPE_PROPERTY, oldCoordinationType, newCoordinationType); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(TYPE_ADAPTER, astRoot); - } - - public TextRange getSizeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SIZE_ADAPTER, astRoot); - } - - public TextRange getSharedTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SHARED_ADAPTER, astRoot); - } - - public TextRange getExpiryTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(EXPIRY_ADAPTER, astRoot); - } - - public TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot) { - return null;//TODO return this.getElementTextRange(EXPIRY_TIME_OF_DAY_ADAPTER, astRoot); - } - - public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(ALWAYS_REFRESH_ADAPTER, astRoot); - } - - public TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(REFRESH_ONLY_IF_NEWER_ADAPTER, astRoot); - } - - public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(DISABLE_HITS_ADAPTER, astRoot); - } - - public TextRange getCoordinationTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(COORDINATION_TYPE_ADAPTER, astRoot); - } - - public void initialize(CompilationUnit astRoot) { - this.type = this.type(astRoot); - this.size = this.size(astRoot); - this.shared = this.shared(astRoot); - this.expiry = this.expiry(astRoot); - this.initializeExpiryTimeOfDay(astRoot); - this.alwaysRefresh = this.alwaysRefresh(astRoot); - this.refreshOnlyIfNewer = this.refreshOnlyIfNewer(astRoot); - this.disableHits = this.disableHits(astRoot); - this.coordinationType = this.coordinationType(astRoot); - } - - protected void initializeExpiryTimeOfDay(CompilationUnit astRoot) { - if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) != null) { - this.expiryTimeOfDay = createTimeOfDayAnnotation(); - this.expiryTimeOfDay.initialize(astRoot); - } - } - - public void update(CompilationUnit astRoot) { - this.setType(this.type(astRoot)); - this.setSize(this.size(astRoot)); - this.setShared(this.shared(astRoot)); - this.setExpiry(this.expiry(astRoot)); - this.updateExpiryTimeOfDay(astRoot); - this.setAlwaysRefresh(this.alwaysRefresh(astRoot)); - this.setRefreshOnlyIfNewer(this.refreshOnlyIfNewer(astRoot)); - this.setDisableHits(this.disableHits(astRoot)); - this.setCoordinationType(this.coordinationType(astRoot)); - } - - protected void updateExpiryTimeOfDay(CompilationUnit astRoot) { - if (this.expiryTimeOfDayAdapter.getAnnotation(astRoot) == null) { - this.setExpiryTimeOfDay(null); - } - else { - if (getExpiryTimeOfDay() != null) { - getExpiryTimeOfDay().update(astRoot); - } - else { - TimeOfDayAnnotation expiryTimeOfDay = createTimeOfDayAnnotation(); - expiryTimeOfDay.initialize(astRoot); - setExpiryTimeOfDay(expiryTimeOfDay); - } - } - } - - protected CacheType type(CompilationUnit astRoot) { - return CacheType.fromJavaAnnotationValue(this.typeAdapter.getValue(astRoot)); - } - - protected Integer size(CompilationUnit astRoot) { - return this.sizeAdapter.getValue(astRoot); - } - - protected Boolean shared(CompilationUnit astRoot) { - return this.sharedAdapter.getValue(astRoot); - } - - protected Integer expiry(CompilationUnit astRoot) { - return this.expiryAdapter.getValue(astRoot); - } - - protected TimeOfDayAnnotation createTimeOfDayAnnotation() { - return new TimeOfDayImpl(this, getMember(), EXPIRY_TIME_OF_DAY_ADAPTER); - } - - protected Boolean alwaysRefresh(CompilationUnit astRoot) { - return this.alwaysRefreshAdapter.getValue(astRoot); - } - - protected Boolean refreshOnlyIfNewer(CompilationUnit astRoot) { - return this.refreshOnlyIfNewerAdapter.getValue(astRoot); - } - - protected Boolean disableHits(CompilationUnit astRoot) { - return this.disableHitsAdapter.getValue(astRoot); - } - - protected CacheCoordinationType coordinationType(CompilationUnit astRoot) { - return CacheCoordinationType.fromJavaAnnotationValue(this.coordinationTypeAdapter.getValue(astRoot)); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildTypeAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__TYPE); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildSizeAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__SIZE, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildSharedAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__SHARED, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildExpiryAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__EXPIRY, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildAlwaysRefreshAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__ALWAYS_REFRESH, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildRefreshOnlyIfNewerAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__REFRESH_ONLY_IF_NEWER, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Boolean> buildDisableHitsAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__DISABLE_HITS, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildCoordinationTypeAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__COORDINATION_TYPE); - } - - private static NestedDeclarationAnnotationAdapter buildExpiryTimeOfDayAnnotationAdapter() { - return new NestedDeclarationAnnotationAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CACHE__EXPIRY_TIME_OF_DAY, EclipseLinkJPA.TIME_OF_DAY); - } - - public static class CacheAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final CacheAnnotationDefinition INSTANCE = new CacheAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static CacheAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private CacheAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new CacheImpl((JavaResourcePersistentType) parent, (Type) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return new NullCacheAnnotation((JavaResourcePersistentType) parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingImpl.java deleted file mode 100644 index 8a17d8eed4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ChangeTrackingImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.core.utility.jdt.Type; -import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ChangeTrackingType; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; - - -public class ChangeTrackingImpl extends AbstractResourceAnnotation<Type> implements ChangeTrackingAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> valueAdapter; - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - - - private ChangeTrackingType value; - - protected ChangeTrackingImpl(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** CacheAnnotation implementation **************** - - public ChangeTrackingType getValue() { - return this.value; - } - - public void setValue(ChangeTrackingType newValue) { - if (attributeValueHasNotChanged(this.value, newValue)) { - return; - } - ChangeTrackingType oldValue = this.value; - this.value = newValue; - this.valueAdapter.setValue(ChangeTrackingType.toJavaAnnotationValue(newValue)); - firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - - public void initialize(CompilationUnit astRoot) { - this.value = this.value(astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setValue(this.value(astRoot)); - } - - protected ChangeTrackingType value(CompilationUnit astRoot) { - return ChangeTrackingType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CHANGE_TRACKING__VALUE, false); - } - - public static class ChangeTrackingAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final ChangeTrackingAnnotationDefinition INSTANCE = new ChangeTrackingAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static ChangeTrackingAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ChangeTrackingAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new ChangeTrackingImpl((JavaResourcePersistentType) parent, (Type) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConversionValueImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConversionValueImpl.java deleted file mode 100644 index fb09fb8f15..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConversionValueImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.NestableConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; - - -public class ConversionValueImpl extends AbstractResourceAnnotation<Member> implements ConversionValueAnnotation, NestableConversionValue -{ - // hold this so we can get the 'dataValue' text range - private final DeclarationAnnotationElementAdapter<String> dataValueDeclarationAdapter; - // hold this so we can get the 'objectValue' text range - private final DeclarationAnnotationElementAdapter<String> objectValueDeclarationAdapter; - - private final AnnotationElementAdapter<String> dataValueAdapter; - private final AnnotationElementAdapter<String> objectValueAdapter; - - - private String dataValue; - private String objectValue; - - public ConversionValueImpl(ObjectTypeConverterAnnotation parent, Member member, IndexedDeclarationAnnotationAdapter idaa) { - super(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa)); - this.dataValueDeclarationAdapter = this.dataValueAdapter(idaa); - this.dataValueAdapter = this.buildAdapter(this.dataValueDeclarationAdapter); - this.objectValueDeclarationAdapter = this.objectValueAdapter(idaa); - this.objectValueAdapter = this.buildAdapter(this.objectValueDeclarationAdapter); - } - - // ********** initialization ********** - protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new ShortCircuitAnnotationElementAdapter<String>(getMember(), daea); - } - - protected DeclarationAnnotationElementAdapter<String> dataValueAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, EclipseLinkJPA.CONVERSION_VALUE__DATA_VALUE, false); - } - - protected DeclarationAnnotationElementAdapter<String> objectValueAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, EclipseLinkJPA.CONVERSION_VALUE__OBJECT_VALUE, false); - } - - public void initialize(CompilationUnit astRoot) { - this.dataValue = this.dataValue(astRoot); - this.objectValue = this.objectValue(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public IndexedAnnotationAdapter getAnnotationAdapter() { - return (IndexedAnnotationAdapter) super.getAnnotationAdapter(); - } - - //*************** ConversionValue implementation **************** - public String getDataValue() { - return this.dataValue; - } - - public void setDataValue(String newDataValue) { - if (attributeValueHasNotChanged(this.dataValue, newDataValue)) { - return; - } - String oldDataValue = this.dataValue; - this.dataValue = newDataValue; - this.dataValueAdapter.setValue(newDataValue); - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, newDataValue); - } - - public String getObjectValue() { - return this.objectValue; - } - - public void setObjectValue(String newObjectValue) { - if (attributeValueHasNotChanged(this.objectValue, newObjectValue)) { - return; - } - String oldObjectValue = this.objectValue; - this.objectValue = newObjectValue; - this.objectValueAdapter.setValue(newObjectValue); - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, newObjectValue); - } - - public TextRange getDataValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.dataValueDeclarationAdapter, astRoot); - } - - public TextRange getObjectValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.objectValueDeclarationAdapter, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setDataValue(this.dataValue(astRoot)); - this.setObjectValue(this.objectValue(astRoot)); - } - - protected String dataValue(CompilationUnit astRoot) { - return this.dataValueAdapter.getValue(astRoot); - } - - protected String objectValue(CompilationUnit astRoot) { - return this.objectValueAdapter.getValue(astRoot); - } - - //************ NestableAnnotation implementation - public void moveAnnotation(int newIndex) { - getAnnotationAdapter().moveAnnotation(newIndex); - } - - public void initializeFrom(NestableAnnotation oldAnnotation) { - ConversionValueAnnotation oldConversionValue = (ConversionValueAnnotation) oldAnnotation; - setDataValue(oldConversionValue.getDataValue()); - setObjectValue(oldConversionValue.getObjectValue()); - } - - // ********** static methods ********** - - static ConversionValueImpl createConversionValue(ObjectTypeConverterAnnotation parent, Member member, DeclarationAnnotationAdapter daa, int index) { - return new ConversionValueImpl(parent, member, buildConversionValueAnnotationAdapter(daa, index)); - } - - private static IndexedDeclarationAnnotationAdapter buildConversionValueAnnotationAdapter(DeclarationAnnotationAdapter daa, int index) { - return new NestedIndexedDeclarationAnnotationAdapter(daa, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES, index, EclipseLinkJPA.CONVERSION_VALUE, false); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertImpl.java deleted file mode 100644 index 0d146c8486..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConvertImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.ConvertAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; - - -public class ConvertImpl extends AbstractResourceAnnotation<Attribute> implements ConvertAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> valueAdapter; - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - - - private String value; - - protected ConvertImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.value(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** Convert implementation **************** - public String getValue() { - return this.value; - } - - public void setValue(String newValue) { - if (attributeValueHasNotChanged(this.value, newValue)) { - return; - } - String oldValue = this.value; - this.value = newValue; - this.valueAdapter.setValue(newValue); - firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setValue(this.value(astRoot)); - } - - protected String value(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERT__VALUE, false, StringExpressionConverter.instance()); - } - - - public static class ConvertAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final ConvertAnnotationDefinition INSTANCE = new ConvertAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static ConvertAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ConvertAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new ConvertImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterImpl.java deleted file mode 100644 index b16e7e65b4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ConverterImpl.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.ConverterAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; - - -public class ConverterImpl extends AbstractResourceAnnotation<Member> implements ConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> nameAdapter; - private final AnnotationElementAdapter<String> converterClassAdapter; - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); - private static final DeclarationAnnotationElementAdapter<String> CONVERTER_CLASS_ADAPTER = buildConverterClassAdapter(); - - - private String name; - private String converterClass; - private boolean implementsConverter; - - protected ConverterImpl(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, NAME_ADAPTER); - this.converterClassAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, CONVERTER_CLASS_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.name(astRoot); - this.converterClass = this.converterClass(astRoot); - this.implementsConverter = this.implementsConverter(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** CustomConverter implementation **************** - public String getName() { - return this.name; - } - - public void setName(String newName) { - if (attributeValueHasNotChanged(this.name, newName)) { - return; - } - String oldName = this.name; - this.name = newName; - this.nameAdapter.setValue(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - public String getConverterClass() { - return this.converterClass; - } - - public void setConverterClass(String newConverterClass) { - if (attributeValueHasNotChanged(this.converterClass, newConverterClass)) { - return; - } - String oldConverterClass = this.converterClass; - this.converterClass = newConverterClass; - this.converterClassAdapter.setValue(newConverterClass); - firePropertyChanged(CONVERTER_CLASS_PROPERTY, oldConverterClass, newConverterClass); - } - - public boolean implementsConverter() { - return this.implementsConverter; - } - - protected void setImplementsConverter(boolean newImplementsConverter) { - boolean oldImplementsConverter = this.implementsConverter; - this.implementsConverter = newImplementsConverter; - firePropertyChanged(IMPLEMENTS_CONVERTER_PROPERTY, oldImplementsConverter, newImplementsConverter); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - public TextRange getConverterClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(CONVERTER_CLASS_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setName(this.name(astRoot)); - this.setConverterClass(this.converterClass(astRoot)); - this.setImplementsConverter(this.implementsConverter(astRoot)); - } - - protected String name(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - protected String converterClass(CompilationUnit astRoot) { - return this.converterClassAdapter.getValue(astRoot); - } - - private boolean implementsConverter(CompilationUnit astRoot) { - if (this.converterClass == null) { - return false; - } - return JDTTools.findTypeInHierarchy(this.converterClassAdapter.getExpression(astRoot), ECLIPSELINK_CONVERTER_CLASS_NAME) != null; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERTER__NAME, false, StringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildConverterClassAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CONVERTER__CONVERTER_CLASS, false, SimpleTypeStringExpressionConverter.instance()); - } - - public static class ConverterAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final ConverterAnnotationDefinition INSTANCE = new ConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static ConverterAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new ConverterImpl(parent, member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerImpl.java deleted file mode 100644 index 20b89f0c89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/CustomizerImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.core.utility.jdt.Type; -import org.eclipse.jpt.eclipselink.core.resource.java.CustomizerAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; - - -public class CustomizerImpl extends AbstractResourceAnnotation<Type> implements CustomizerAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> valueAdapter; - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - - - private String value; - private boolean implementsDescriptorCustomizer; - - protected CustomizerImpl(JavaResourcePersistentMember parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.value(astRoot); - this.implementsDescriptorCustomizer = this.implementsDescriptorCustomizer(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** Customizer implementation **************** - - public String getValue() { - return this.value; - } - - public void setValue(String newValue) { - if (attributeValueHasNotChanged(this.value, newValue)) { - return; - } - String oldValue = this.value; - this.value = newValue; - this.valueAdapter.setValue(newValue); - firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - public boolean implementsDescriptorCustomizer() { - return this.implementsDescriptorCustomizer; - } - - protected void setImplementsDescriptorCustomizer(boolean newImplementsDescriptorCustomizer) { - boolean oldImplementsDescriptorCustomizer = this.implementsDescriptorCustomizer; - this.implementsDescriptorCustomizer = newImplementsDescriptorCustomizer; - firePropertyChanged(IMPLEMENTS_DESCRIPTOR_CUSTOMIZER_PROPERTY, oldImplementsDescriptorCustomizer, newImplementsDescriptorCustomizer); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setValue(this.value(astRoot)); - this.setImplementsDescriptorCustomizer(this.implementsDescriptorCustomizer(astRoot)); - } - - protected String value(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - private boolean implementsDescriptorCustomizer(CompilationUnit astRoot) { - if (this.value == null) { - return false; - } - return JDTTools.findTypeInHierarchy(this.valueAdapter.getExpression(astRoot), ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME) != null; - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.CUSTOMIZER__VALUE, false, SimpleTypeStringExpressionConverter.instance()); - } - - public static class CustomizerAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final CustomizerAnnotationDefinition INSTANCE = new CustomizerAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static CustomizerAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private CustomizerAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new CustomizerImpl(parent, (Type) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingImpl.java deleted file mode 100644 index 546e54b400..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ExistenceCheckingImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.core.utility.jdt.Type; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceType; - - -public class ExistenceCheckingImpl extends AbstractResourceAnnotation<Type> implements ExistenceCheckingAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> valueAdapter; - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - - - private ExistenceType value; - - protected ExistenceCheckingImpl(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** CacheAnnotation implementation **************** - - public ExistenceType getValue() { - return this.value; - } - - public void setValue(ExistenceType newValue) { - if (attributeValueHasNotChanged(this.value, newValue)) { - return; - } - ExistenceType oldValue = this.value; - this.value = newValue; - this.valueAdapter.setValue(ExistenceType.toJavaAnnotationValue(newValue)); - firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - - public void initialize(CompilationUnit astRoot) { - this.value = this.value(astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setValue(this.value(astRoot)); - } - - protected ExistenceType value(CompilationUnit astRoot) { - return ExistenceType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.EXISTENCE_CHECKING__VALUE, false); - } - - public static class ExistenceCheckingAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final ExistenceCheckingAnnotationDefinition INSTANCE = new ExistenceCheckingAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static ExistenceCheckingAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ExistenceCheckingAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new ExistenceCheckingImpl((JavaResourcePersistentType) parent, (Type) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchImpl.java deleted file mode 100644 index eb1f2d5f79..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/JoinFetchImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType; - - -public class JoinFetchImpl extends AbstractResourceAnnotation<Attribute> implements JoinFetchAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> valueAdapter; - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - - - private JoinFetchType value; - - protected JoinFetchImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** CacheAnnotation implementation **************** - - public JoinFetchType getValue() { - return this.value; - } - - public void setValue(JoinFetchType newValue) { - if (attributeValueHasNotChanged(this.value, newValue)) { - return; - } - JoinFetchType oldValue = this.value; - this.value = newValue; - this.valueAdapter.setValue(JoinFetchType.toJavaAnnotationValue(newValue)); - firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - - public void initialize(CompilationUnit astRoot) { - this.value = this.value(astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setValue(this.value(astRoot)); - } - - protected JoinFetchType value(CompilationUnit astRoot) { - return JoinFetchType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.JOIN_FETCH_VALUE, false); - } - - public static class JoinFetchAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final JoinFetchAnnotationDefinition INSTANCE = new JoinFetchAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static JoinFetchAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JoinFetchAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new JoinFetchImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return new NullJoinFetchAnnotation((JavaResourcePersistentAttribute) parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableImpl.java deleted file mode 100644 index 1759c4944b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/MutableImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.MutableAnnotation; - - -public class MutableImpl extends AbstractResourceAnnotation<Attribute> implements MutableAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<Boolean> valueAdapter; - - private static final DeclarationAnnotationElementAdapter<Boolean> VALUE_ADAPTER = buildValueAdapter(); - - - private Boolean value; - - protected MutableImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(attribute, VALUE_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.value(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** Mutable implementation **************** - public Boolean getValue() { - return this.value; - } - - public void setValue(Boolean newValue) { - if (attributeValueHasNotChanged(this.value, newValue)) { - return; - } - Boolean oldValue = this.value; - this.value = newValue; - this.valueAdapter.setValue(newValue); - firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setValue(this.value(astRoot)); - } - - protected Boolean value(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<Boolean> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.MUTABLE__VALUE, false, BooleanExpressionConverter.instance()); - } - - - public static class MutableAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final MutableAnnotationDefinition INSTANCE = new MutableAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static MutableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MutableAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new MutableImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullCacheAnnotation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullCacheAnnotation.java deleted file mode 100644 index fb68500af7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullCacheAnnotation.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.resource.java.CacheType; -import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation; - -public class NullCacheAnnotation extends AbstractJavaResourceNode implements CacheAnnotation, Annotation -{ - protected NullCacheAnnotation(JavaResourcePersistentType parent) { - super(parent); - } - - @Override - public JavaResourcePersistentType getParent() { - return (JavaResourcePersistentType) super.getParent(); - } - - public String getAnnotationName() { - return CacheAnnotation.ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //null, nothing to initialize - } - - public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) { - return null; - } - - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - protected CacheAnnotation createCacheResource() { - return (CacheAnnotation) getParent().addSupportingAnnotation(getAnnotationName()); - } - - public CacheType getType() { - return null; - } - - public void setType(CacheType type) { - if (type != null) { - createCacheResource().setType(type); - } - } - - public Integer getSize() { - return null; - } - - public void setSize(Integer size) { - if (size != null) { - createCacheResource().setSize(size); - } - } - - public Boolean getShared() { - return null; - } - - public void setShared(Boolean shared) { - if (shared != null) { - createCacheResource().setShared(shared); - } - } - - public Integer getExpiry() { - return null; - } - - public void setExpiry(Integer expiry) { - if (expiry != null) { - createCacheResource().setExpiry(expiry); - } - } - - public TimeOfDayAnnotation getExpiryTimeOfDay() { - return null; - } - - public TimeOfDayAnnotation addExpiryTimeOfDay() { - return createCacheResource().addExpiryTimeOfDay(); - } - - public void removeExpiryTimeOfDay() { - - } - - public Boolean getAlwaysRefresh() { - return null; - } - - public void setAlwaysRefresh(Boolean alwaysRefresh) { - if (alwaysRefresh != null) { - createCacheResource().setAlwaysRefresh(alwaysRefresh); - } - } - - public Boolean getRefreshOnlyIfNewer() { - return null; - } - - public void setRefreshOnlyIfNewer(Boolean refreshOnlyIfNewer) { - if (refreshOnlyIfNewer != null) { - createCacheResource().setRefreshOnlyIfNewer(refreshOnlyIfNewer); - } - } - - public Boolean getDisableHits() { - return null; - } - - public void setDisableHits(Boolean disableHits) { - if (disableHits != null) { - createCacheResource().setDisableHits(disableHits); - } - } - - public CacheCoordinationType getCoordinationType() { - return null; - } - - public void setCoordinationType(CacheCoordinationType coordinationType) { - if (coordinationType != null) { - createCacheResource().setCoordinationType(coordinationType); - } - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getSizeTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getSharedTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getExpiryTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getExpiryTimeOfDayTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getAlwaysRefreshTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getRefreshOnlyIfNewerTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getDisablesHitsTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getCoordinationTypeTextRange(CompilationUnit astRoot) { - return null; - } - - public void update(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullJoinFetchAnnotation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullJoinFetchAnnotation.java deleted file mode 100644 index 53da2c52df..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullJoinFetchAnnotation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.java.ExistenceCheckingAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.JoinFetchType; - -public class NullJoinFetchAnnotation extends AbstractJavaResourceNode implements JoinFetchAnnotation, Annotation -{ - protected NullJoinFetchAnnotation(JavaResourcePersistentAttribute parent) { - super(parent); - } - - @Override - public JavaResourcePersistentType getParent() { - return (JavaResourcePersistentType) super.getParent(); - } - - public String getAnnotationName() { - return ExistenceCheckingAnnotation.ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //null, nothing to initialize - } - - public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) { - return null; - } - - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - protected JoinFetchAnnotation createJoinFetchAnnotation() { - return (JoinFetchAnnotation) getParent().addSupportingAnnotation(getAnnotationName()); - } - - public JoinFetchType getValue() { - return null; - } - - public void setValue(JoinFetchType value) { - if (value != null) { - createJoinFetchAnnotation().setValue(value); - } - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - - public void update(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformation.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformation.java deleted file mode 100644 index cd04bf925d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullTransformation.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.BasicAnnotation; -import org.eclipse.jpt.core.resource.java.FetchType; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation; - - -public class NullTransformation extends AbstractJavaResourceNode implements BasicAnnotation, Annotation -{ - protected NullTransformation(JavaResourcePersistentMember parent) { - super(parent); - } - - public void initialize(CompilationUnit astRoot) { - //null, nothing to initialize - } - - public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) { - return null; - } - - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - public String getAnnotationName() { - return TransformationAnnotation.ANNOTATION_NAME; - } - - @Override - public JavaResourcePersistentMember getParent() { - return (JavaResourcePersistentMember) super.getParent(); - } - - protected TransformationAnnotation createTransformationResource() { - getParent().setMappingAnnotation(getAnnotationName()); - return (TransformationAnnotation) getParent().getMappingAnnotation(); - } - - public FetchType getFetch() { - return null; - } - - public void setFetch(FetchType fetch) { - if (fetch != null) { - createTransformationResource().setFetch(fetch); - } - } - - public Boolean getOptional() { - return null; - } - - public void setOptional(Boolean optional) { - if (optional != null) { - createTransformationResource().setOptional(optional); - } - } - - public void update(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumn.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumn.java deleted file mode 100644 index 4b88b4cb4b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/NullWriteTransformerColumn.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.NullBaseColumn; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation; - - -public class NullWriteTransformerColumn extends NullBaseColumn implements ColumnAnnotation, Annotation -{ - public NullWriteTransformerColumn(WriteTransformerAnnotation parent) { - super(parent); - } - - @Override - public WriteTransformerAnnotation getParent() { - return (WriteTransformerAnnotation) super.getParent(); - } - - public String getAnnotationName() { - return ColumnAnnotation.ANNOTATION_NAME; - } - - @Override - protected ColumnAnnotation createResourceColumn() { - return getParent().addColumn(); - } - - public Integer getLength() { - return null; - } - - public void setLength(Integer length) { - if (length != null) { - createResourceColumn().setLength(length); - } - } - - public Integer getScale() { - return null; - } - - public void setScale(Integer scale) { - if (scale != null) { - createResourceColumn().setScale(scale); - } - } - - public Integer getPrecision() { - return null; - } - - public void setPrecision(Integer precision) { - if (precision != null) { - createResourceColumn().setPrecision(precision); - } - } - - public TextRange getScaleTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getLengthTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getPrecisionTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterImpl.java deleted file mode 100644 index a149ae9fa1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ObjectTypeConverterImpl.java +++ /dev/null @@ -1,392 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.resource.java.ContainerAnnotationTools; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.TypeStringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.core.resource.java.ContainerAnnotation; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.ConversionValueAnnotation; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.NestableConversionValue; -import org.eclipse.jpt.eclipselink.core.resource.java.ObjectTypeConverterAnnotation; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; - - -public class ObjectTypeConverterImpl extends AbstractResourceAnnotation<Member> implements ObjectTypeConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> nameAdapter; - private final AnnotationElementAdapter<String> dataTypeAdapter; - private final AnnotationElementAdapter<String> objectTypeAdapter; - private final AnnotationElementAdapter<String> defaultObjectValueAdapter; - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); - private static final DeclarationAnnotationElementAdapter<String> DATA_TYPE_ADAPTER = buildDataTypeAdapter(); - private static final DeclarationAnnotationElementAdapter<String> OBJECT_TYPE_ADAPTER = buildObjectTypeAdapter(); - private static final DeclarationAnnotationElementAdapter<String> DEFAULT_OBJECT_VALUE_ADAPTER = buildDefaultObjectValueAdapter(); - - - private String name; - private String dataType; - private String objectType; - private String defaultObjectValue; - - protected final List<NestableConversionValue> conversionValues; - private final ConversionValuesContainerAnnotation conversionValuesContainerAnnotation; - - protected ObjectTypeConverterImpl(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, NAME_ADAPTER); - this.dataTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, DATA_TYPE_ADAPTER); - this.objectTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, OBJECT_TYPE_ADAPTER); - this.defaultObjectValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, DEFAULT_OBJECT_VALUE_ADAPTER); - this.conversionValues = new ArrayList<NestableConversionValue>(); - this.conversionValuesContainerAnnotation = new ConversionValuesContainerAnnotation(); - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.name(astRoot); - this.dataType = this.dataType(astRoot); - this.objectType = this.objectType(astRoot); - this.defaultObjectValue = this.defaultObjectValue(astRoot); - ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.conversionValuesContainerAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** ObjectTypeConverter implementation **************** - public String getName() { - return this.name; - } - - public void setName(String newName) { - if (attributeValueHasNotChanged(this.name, newName)) { - return; - } - String oldName = this.name; - this.name = newName; - this.nameAdapter.setValue(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - if (attributeValueHasNotChanged(this.dataType, newDataType)) { - return; - } - String oldDataType = this.dataType; - this.dataType = newDataType; - this.dataTypeAdapter.setValue(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - if (attributeValueHasNotChanged(this.objectType, newObjectType)) { - return; - } - String oldObjectType = this.objectType; - this.objectType = newObjectType; - this.objectTypeAdapter.setValue(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - public String getDefaultObjectValue() { - return this.defaultObjectValue; - } - - public void setDefaultObjectValue(String newDefaultObjectValue) { - if (attributeValueHasNotChanged(this.defaultObjectValue, newDefaultObjectValue)) { - return; - } - String oldDefaultObjectValue = this.defaultObjectValue; - this.defaultObjectValue = newDefaultObjectValue; - this.defaultObjectValueAdapter.setValue(newDefaultObjectValue); - firePropertyChanged(DEFAULT_OBJECT_VALUE_PROPERTY, oldDefaultObjectValue, newDefaultObjectValue); - } - - public ListIterator<ConversionValueAnnotation> conversionValues() { - return new CloneListIterator<ConversionValueAnnotation>(this.conversionValues); - } - - public int conversionValuesSize() { - return this.conversionValues.size(); - } - - public NestableConversionValue conversionValueAt(int index) { - return this.conversionValues.get(index); - } - - public int indexOfConversionValue(ConversionValueAnnotation conversionValue) { - return this.conversionValues.indexOf(conversionValue); - } - - public NestableConversionValue addConversionValue(int index) { - NestableConversionValue conversionValue = (NestableConversionValue) ContainerAnnotationTools.addNestedAnnotation(index, this.conversionValuesContainerAnnotation); - fireItemAdded(AssociationOverrideAnnotation.JOIN_COLUMNS_LIST, index, conversionValue); - return conversionValue; - } - - protected void addConversionValue(int index, NestableConversionValue conversionValue) { - addItemToList(index, conversionValue, this.conversionValues, AssociationOverrideAnnotation.JOIN_COLUMNS_LIST); - } - - public void removeConversionValue(int index) { - NestableConversionValue conversionValue = this.conversionValues.get(index); - removeConversionValue(conversionValue); - conversionValue.removeAnnotation(); - ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.conversionValuesContainerAnnotation); - } - - protected void removeConversionValue(NestableConversionValue conversionValue) { - removeItemFromList(conversionValue, this.conversionValues, AssociationOverrideAnnotation.JOIN_COLUMNS_LIST); - } - - public void moveConversionValue(int targetIndex, int sourceIndex) { - moveConversionValueInternal(targetIndex, sourceIndex); - ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.conversionValuesContainerAnnotation); - fireItemMoved(AssociationOverrideAnnotation.JOIN_COLUMNS_LIST, targetIndex, sourceIndex); - } - - protected void moveConversionValueInternal(int targetIndex, int sourceIndex) { - CollectionTools.move(this.conversionValues, targetIndex, sourceIndex); - } - - protected NestableConversionValue createConversionValue(int index) { - return ConversionValueImpl.createConversionValue(this, getMember(), getDeclarationAnnotationAdapter(), index); - } - - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - public TextRange getDataTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(DATA_TYPE_ADAPTER, astRoot); - } - - public TextRange getObjectTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(OBJECT_TYPE_ADAPTER, astRoot); - } - - public TextRange getDefaultObjectValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(DEFAULT_OBJECT_VALUE_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setName(this.name(astRoot)); - this.setDataType(this.dataType(astRoot)); - this.setObjectType(this.objectType(astRoot)); - this.setDefaultObjectValue(this.defaultObjectValue(astRoot)); - ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.conversionValuesContainerAnnotation); - } - - protected String name(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - protected String dataType(CompilationUnit astRoot) { - return this.dataTypeAdapter.getValue(astRoot); - } - - protected String objectType(CompilationUnit astRoot) { - return this.objectTypeAdapter.getValue(astRoot); - } - - protected String defaultObjectValue(CompilationUnit astRoot) { - return this.defaultObjectValueAdapter.getValue(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__NAME, false, StringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildDataTypeAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DATE_TYPE, false, TypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildObjectTypeAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__OBJECT_TYPE, false, TypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildDefaultObjectValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE, false, StringExpressionConverter.instance()); - } - - public static class ObjectTypeConverterAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final ObjectTypeConverterAnnotationDefinition INSTANCE = new ObjectTypeConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static ObjectTypeConverterAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ObjectTypeConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new ObjectTypeConverterImpl(parent, member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - private class ConversionValuesContainerAnnotation extends AbstractJavaResourceNode - implements ContainerAnnotation<NestableConversionValue> - { - public ConversionValuesContainerAnnotation() { - super(ObjectTypeConverterImpl.this); - } - - public void initialize(CompilationUnit astRoot) { - //nothing to initialize - } - - public NestableConversionValue addInternal(int index) { - NestableConversionValue conversionValue = ObjectTypeConverterImpl.this.createConversionValue(index); - ObjectTypeConverterImpl.this.conversionValues.add(index, conversionValue); - return conversionValue; - } - - public NestableConversionValue add(int index) { - NestableConversionValue conversionValue = ObjectTypeConverterImpl.this.createConversionValue(index); - ObjectTypeConverterImpl.this.addConversionValue(index, conversionValue); - return conversionValue; - } - - public int indexOf(NestableConversionValue conversionValue) { - return ObjectTypeConverterImpl.this.indexOfConversionValue(conversionValue); - } - - public void move(int targetIndex, int sourceIndex) { - ObjectTypeConverterImpl.this.moveConversionValue(targetIndex, sourceIndex); - } - - public void moveInternal(int targetIndex, int sourceIndex) { - ObjectTypeConverterImpl.this.moveConversionValueInternal(targetIndex, sourceIndex); - } - - public NestableConversionValue nestedAnnotationAt(int index) { - return ObjectTypeConverterImpl.this.conversionValueAt(index); - } - - public ListIterator<NestableConversionValue> nestedAnnotations() { - return new CloneListIterator<NestableConversionValue>(ObjectTypeConverterImpl.this.conversionValues); - } - - public int nestedAnnotationsSize() { - return conversionValuesSize(); - } - - public void remove(int index) { - this.remove(nestedAnnotationAt(index)); - } - - public void remove(NestableConversionValue conversionValue) { - ObjectTypeConverterImpl.this.removeConversionValue(conversionValue); - } - - public String getAnnotationName() { - return ObjectTypeConverterImpl.this.getAnnotationName(); - } - - public String getNestableAnnotationName() { - return EclipseLinkJPA.CONVERSION_VALUE; - } - - public NestableConversionValue nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) { - for (NestableConversionValue conversionValue : CollectionTools.iterable(nestedAnnotations())) { - if (jdtAnnotation == conversionValue.getJdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) { - return conversionValue; - } - } - return null; - } - - public org.eclipse.jdt.core.dom.Annotation getJdtAnnotation(CompilationUnit astRoot) { - return ObjectTypeConverterImpl.this.getJdtAnnotation(astRoot); - } - - public void newAnnotation() { - ObjectTypeConverterImpl.this.newAnnotation(); - } - - public void removeAnnotation() { - ObjectTypeConverterImpl.this.removeAnnotation(); - } - - public void update(CompilationUnit astRoot) { - ObjectTypeConverterImpl.this.update(astRoot); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return ObjectTypeConverterImpl.this.getTextRange(astRoot); - } - - public String getElementName() { - return EclipseLinkJPA.OBJECT_TYPE_CONVERTER__CONVERSION_VALUES; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getAnnotationName()); - } - - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedImpl.java deleted file mode 100644 index 2ecaeb2c56..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/PrivateOwnedImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.PrivateOwnedAnnotation; - - -public class PrivateOwnedImpl extends AbstractResourceAnnotation<Attribute> implements PrivateOwnedAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - protected PrivateOwnedImpl(JavaResourceNode parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - //nothing to initialize - } - - public void update(CompilationUnit astRoot) { - //nothing to update - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - public static class PrivateOwnedAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final PrivateOwnedAnnotationDefinition INSTANCE = new PrivateOwnedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private PrivateOwnedAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new PrivateOwnedImpl(parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyImpl.java deleted file mode 100644 index 7a6057ced3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadOnlyImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.core.utility.jdt.Type; -import org.eclipse.jpt.eclipselink.core.resource.java.ReadOnlyAnnotation; - - -public class ReadOnlyImpl extends AbstractResourceAnnotation<Type> implements ReadOnlyAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - protected ReadOnlyImpl(JavaResourceNode parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - //nothing to initialize - } - - public void update(CompilationUnit astRoot) { - //nothing to update - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - public static class ReadOnlyAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final ReadOnlyAnnotationDefinition INSTANCE = new ReadOnlyAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ReadOnlyAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new ReadOnlyImpl(parent, (Type) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerImpl.java deleted file mode 100644 index 20a66c1ebf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/ReadTransformerImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.ReadTransformerAnnotation; - - -public class ReadTransformerImpl extends AbstractResourceAnnotation<Attribute> implements ReadTransformerAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> transformerClassAdapter; - private final AnnotationElementAdapter<String> methodAdapter; - - private static final DeclarationAnnotationElementAdapter<String> TRANSFORMER_CLASS_ADAPTER = buildTransformerClassAdapter(); - private static final DeclarationAnnotationElementAdapter<String> METHOD_ADAPTER = buildMethodAdapter(); - - - private String transformerClass; - private String method; - - protected ReadTransformerImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.transformerClassAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, TRANSFORMER_CLASS_ADAPTER); - this.methodAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, METHOD_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.transformerClass = this.transformerClass(astRoot); - this.method = this.method(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** ReadTransformer implementation **************** - public String getTransformerClass() { - return this.transformerClass; - } - - public void setTransformerClass(String newTransformerClass) { - if (attributeValueHasNotChanged(this.transformerClass, newTransformerClass)) { - return; - } - String oldTransformerClass = this.transformerClass; - this.transformerClass = newTransformerClass; - this.transformerClassAdapter.setValue(newTransformerClass); - firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, oldTransformerClass, newTransformerClass); - } - - public String getMethod() { - return this.method; - } - - public void setMethod(String newMethod) { - if (attributeValueHasNotChanged(this.method, newMethod)) { - return; - } - String oldMethod = this.method; - this.method = newMethod; - this.methodAdapter.setValue(newMethod); - firePropertyChanged(METHOD_PROPERTY, oldMethod, newMethod); - } - - public TextRange getTransformerClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(TRANSFORMER_CLASS_ADAPTER, astRoot); - } - - public TextRange getMethodTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(METHOD_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setTransformerClass(this.transformerClass(astRoot)); - this.setMethod(this.method(astRoot)); - } - - protected String transformerClass(CompilationUnit astRoot) { - return this.transformerClassAdapter.getValue(astRoot); - } - - protected String method(CompilationUnit astRoot) { - return this.methodAdapter.getValue(astRoot); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<String> buildTransformerClassAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.READ_TRANSFORMER__TRANSFORMER_CLASS, false, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildMethodAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.READ_TRANSFORMER__METHOD, false); - } - - public static class ReadTransformerAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final ReadTransformerAnnotationDefinition INSTANCE = new ReadTransformerAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static ReadTransformerAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ReadTransformerAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new ReadTransformerImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterImpl.java deleted file mode 100644 index 3f08cdcf6b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/StructConverterImpl.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.StructConverterAnnotation; - - -public class StructConverterImpl extends AbstractResourceAnnotation<Member> implements StructConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> nameAdapter; - private final AnnotationElementAdapter<String> converterAdapter; - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); - private static final DeclarationAnnotationElementAdapter<String> CONVERTER_ADAPTER = buildConverterAdapter(); - - - private String name; - private String converter; - - protected StructConverterImpl(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, NAME_ADAPTER); - this.converterAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, CONVERTER_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.name(astRoot); - this.converter = this.converter(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** CustomConverter implementation **************** - public String getName() { - return this.name; - } - - public void setName(String newName) { - if (attributeValueHasNotChanged(this.name, newName)) { - return; - } - String oldName = this.name; - this.name = newName; - this.nameAdapter.setValue(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - public String getConverter() { - return this.converter; - } - - public void setConverter(String newConverter) { - if (attributeValueHasNotChanged(this.converter, newConverter)) { - return; - } - String oldConverter = this.converter; - this.converter = newConverter; - this.converterAdapter.setValue(newConverter); - firePropertyChanged(CONVERTER_PROPERTY, oldConverter, newConverter); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - public TextRange getConverterTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(CONVERTER_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setName(this.name(astRoot)); - this.setConverter(this.converter(astRoot)); - } - - protected String name(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - protected String converter(CompilationUnit astRoot) { - return this.converterAdapter.getValue(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.STRUCT_CONVERTER__NAME, false, StringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildConverterAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.STRUCT_CONVERTER__CONVERTER, false, StringExpressionConverter.instance()); - } - - public static class StructConverterAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final StructConverterAnnotationDefinition INSTANCE = new StructConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static StructConverterAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private StructConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new StructConverterImpl(parent, member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TimeOfDayImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TimeOfDayImpl.java deleted file mode 100644 index 080e85d7b8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TimeOfDayImpl.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.NumberIntegerExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Type; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.TimeOfDayAnnotation; - - -public class TimeOfDayImpl extends AbstractResourceAnnotation<Type> implements TimeOfDayAnnotation -{ - private final AnnotationElementAdapter<Integer> hourAdapter; - private final AnnotationElementAdapter<Integer> minuteAdapter; - private final AnnotationElementAdapter<Integer> secondAdapter; - private final AnnotationElementAdapter<Integer> millisecondAdapter; - - private final DeclarationAnnotationElementAdapter<Integer> hourDeclarationAdapter; - private final DeclarationAnnotationElementAdapter<Integer> minuteDeclarationAdapter; - private final DeclarationAnnotationElementAdapter<Integer> secondDeclarationAdapter; - private final DeclarationAnnotationElementAdapter<Integer> millisecondDeclarationAdapter; - - - private Integer hour; - private Integer minute; - private Integer second; - private Integer millisecond; - - protected TimeOfDayImpl(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa) { - super(parent, type, daa); - this.hourDeclarationAdapter = buildHourAdapter(daa); - this.hourAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(type, this.hourDeclarationAdapter); - this.minuteDeclarationAdapter = buildMinuteAdapter(daa); - this.minuteAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(type, this.minuteDeclarationAdapter); - this.secondDeclarationAdapter = buildSecondAdapter(daa); - this.secondAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(type, this.secondDeclarationAdapter); - this.millisecondDeclarationAdapter = buildMillisecondAdapter(daa); - this.millisecondAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(type, this.millisecondDeclarationAdapter); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** TimeOfDayAnnotation implementation **************** - - public Integer getHour() { - return this.hour; - } - - public void setHour(Integer newHour) { - if (attributeValueHasNotChanged(this.hour, newHour)) { - return; - } - Integer oldHour = this.hour; - this.hour = newHour; - this.hourAdapter.setValue(newHour); - firePropertyChanged(HOUR_PROPERTY, oldHour, newHour); - } - - public Integer getMinute() { - return this.minute; - } - - public void setMinute(Integer newMinute) { - if (attributeValueHasNotChanged(this.minute, newMinute)) { - return; - } - Integer oldMinute = this.minute; - this.minute = newMinute; - this.minuteAdapter.setValue(newMinute); - firePropertyChanged(MINUTE_PROPERTY, oldMinute, newMinute); - } - - public Integer getSecond() { - return this.second; - } - - public void setSecond(Integer newSecond) { - if (attributeValueHasNotChanged(this.second, newSecond)) { - return; - } - Integer oldSecond = this.second; - this.second = newSecond; - this.secondAdapter.setValue(newSecond); - firePropertyChanged(SECOND_PROPERTY, oldSecond, newSecond); - } - - public Integer getMillisecond() { - return this.millisecond; - } - - public void setMillisecond(Integer newMillisecond) { - if (attributeValueHasNotChanged(this.millisecond, newMillisecond)) { - return; - } - Integer oldMillisecond = this.millisecond; - this.millisecond = newMillisecond; - this.millisecondAdapter.setValue(newMillisecond); - firePropertyChanged(MILLISECOND_PROPERTY, oldMillisecond, newMillisecond); - } - - public TextRange getHourTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.hourDeclarationAdapter, astRoot); - } - - public TextRange getMinuteTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.minuteDeclarationAdapter, astRoot); - } - - public TextRange getSecondTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.secondDeclarationAdapter, astRoot); - } - - public TextRange getMillisecondTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.millisecondDeclarationAdapter, astRoot); - } - - public void initialize(CompilationUnit astRoot) { - this.hour = this.hour(astRoot); - this.minute = this.minute(astRoot); - this.second = this.second(astRoot); - this.millisecond = this.millisecond(astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setHour(this.hour(astRoot)); - this.setMinute(this.minute(astRoot)); - this.setSecond(this.second(astRoot)); - this.setMillisecond(this.millisecond(astRoot)); - } - - protected Integer hour(CompilationUnit astRoot) { - return this.hourAdapter.getValue(astRoot); - } - - protected Integer minute(CompilationUnit astRoot) { - return this.minuteAdapter.getValue(astRoot); - } - - protected Integer second(CompilationUnit astRoot) { - return this.secondAdapter.getValue(astRoot); - } - - protected Integer millisecond(CompilationUnit astRoot) { - return this.millisecondAdapter.getValue(astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<Integer> buildHourAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLinkJPA.TIME_OF_DAY__HOUR, false, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildMinuteAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLinkJPA.TIME_OF_DAY__MINUTE, false, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildSecondAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLinkJPA.TIME_OF_DAY__SECOND, false, NumberIntegerExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<Integer> buildMillisecondAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, EclipseLinkJPA.TIME_OF_DAY__MILLISECOND, false, NumberIntegerExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationImpl.java deleted file mode 100644 index b5b4f85571..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TransformationImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.FetchType; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.TransformationAnnotation; - - -public class TransformationImpl extends AbstractResourceAnnotation<Attribute> implements TransformationAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<Boolean> optionalAdapter; - - private final AnnotationElementAdapter<String> fetchAdapter; - - private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter(); - - private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter(); - - private Boolean optional; - - private FetchType fetch; - - protected TransformationImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.optionalAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(attribute, OPTIONAL_ADAPTER); - this.fetchAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.optional = this.optional(astRoot); - this.fetch = this.fetch(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** Transformation implementation **************** - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean newOptional) { - if (attributeValueHasNotChanged(this.optional, newOptional)) { - return; - } - Boolean oldOptional = this.optional; - this.optional = newOptional; - this.optionalAdapter.setValue(newOptional); - firePropertyChanged(OPTIONAL_PROPERTY, oldOptional, newOptional); - } - - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType newFetch) { - if (attributeValueHasNotChanged(this.fetch, newFetch)) { - return; - } - FetchType oldFetch = this.fetch; - this.fetch = newFetch; - this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(newFetch)); - firePropertyChanged(FETCH_PROPERTY, oldFetch, newFetch); - } - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FETCH_ADAPTER, astRoot); - } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setOptional(this.optional(astRoot)); - this.setFetch(this.fetch(astRoot)); - } - - protected FetchType fetch(CompilationUnit astRoot) { - return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot)); - } - - protected Boolean optional(CompilationUnit astRoot) { - return this.optionalAdapter.getValue(astRoot); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TRANSFORMATION__OPTIONAL, false, BooleanExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TRANSFORMATION__FETCH, false); - } - - public static class TransformationAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final TransformationAnnotationDefinition INSTANCE = new TransformationAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static TransformationAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private TransformationAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new TransformationImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return new NullTransformation(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterImpl.java deleted file mode 100644 index 5431b88800..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/TypeConverterImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.core.internal.utility.jdt.TypeStringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.TypeConverterAnnotation; - - -public class TypeConverterImpl extends AbstractResourceAnnotation<Member> implements TypeConverterAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> nameAdapter; - private final AnnotationElementAdapter<String> dataTypeAdapter; - private final AnnotationElementAdapter<String> objectTypeAdapter; - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); - private static final DeclarationAnnotationElementAdapter<String> DATA_TYPE_ADAPTER = buildDataTypeAdapter(); - private static final DeclarationAnnotationElementAdapter<String> OBJECT_TYPE_ADAPTER = buildObjectTypeAdapter(); - - - private String name; - private String dataType; - private String objectType; - - protected TypeConverterImpl(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, NAME_ADAPTER); - this.dataTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, DATA_TYPE_ADAPTER); - this.objectTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, OBJECT_TYPE_ADAPTER); - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.name(astRoot); - this.dataType = this.dataType(astRoot); - this.objectType = this.objectType(astRoot); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** TypeConverter implementation **************** - public String getName() { - return this.name; - } - - public void setName(String newName) { - if (attributeValueHasNotChanged(this.name, newName)) { - return; - } - String oldName = this.name; - this.name = newName; - this.nameAdapter.setValue(newName); - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - public String getDataType() { - return this.dataType; - } - - public void setDataType(String newDataType) { - if (attributeValueHasNotChanged(this.dataType, newDataType)) { - return; - } - String oldDataType = this.dataType; - this.dataType = newDataType; - this.dataTypeAdapter.setValue(newDataType); - firePropertyChanged(DATA_TYPE_PROPERTY, oldDataType, newDataType); - } - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String newObjectType) { - if (attributeValueHasNotChanged(this.objectType, newObjectType)) { - return; - } - String oldObjectType = this.objectType; - this.objectType = newObjectType; - this.objectTypeAdapter.setValue(newObjectType); - firePropertyChanged(OBJECT_TYPE_PROPERTY, oldObjectType, newObjectType); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - public TextRange getDataTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(DATA_TYPE_ADAPTER, astRoot); - } - - public TextRange getObjectTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(OBJECT_TYPE_ADAPTER, astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setName(this.name(astRoot)); - this.setDataType(this.dataType(astRoot)); - this.setObjectType(this.objectType(astRoot)); - } - - protected String name(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - protected String dataType(CompilationUnit astRoot) { - return this.dataTypeAdapter.getValue(astRoot); - } - - protected String objectType(CompilationUnit astRoot) { - return this.objectTypeAdapter.getValue(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TYPE_CONVERTER__NAME, false, StringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildDataTypeAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TYPE_CONVERTER__DATE_TYPE, false, TypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildObjectTypeAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.TYPE_CONVERTER__OBJECT_TYPE, false, TypeStringExpressionConverter.instance()); - } - - public static class TypeConverterAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final TypeConverterAnnotationDefinition INSTANCE = new TypeConverterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static TypeConverterAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private TypeConverterAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new TypeConverterImpl(parent, member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerImpl.java deleted file mode 100644 index d841323cf8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/java/WriteTransformerImpl.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.resource.java.AbstractResourceAnnotation; -import org.eclipse.jpt.core.internal.resource.java.ColumnImpl; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.core.resource.java.Annotation; -import org.eclipse.jpt.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Attribute; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; -import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkJPA; -import org.eclipse.jpt.eclipselink.core.resource.java.WriteTransformerAnnotation; - - -public class WriteTransformerImpl extends AbstractResourceAnnotation<Attribute> implements WriteTransformerAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final AnnotationElementAdapter<String> transformerClassAdapter; - private final AnnotationElementAdapter<String> methodAdapter; - private final MemberAnnotationAdapter columnAdapter; - - private static final DeclarationAnnotationElementAdapter<String> TRANSFORMER_CLASS_ADAPTER = buildTransformerClassAdapter(); - private static final DeclarationAnnotationElementAdapter<String> METHOD_ADAPTER = buildMethodAdapter(); - - private String transformerClass; - private String method; - private ColumnImpl column; - - - protected WriteTransformerImpl(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.transformerClassAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, TRANSFORMER_CLASS_ADAPTER); - this.methodAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, METHOD_ADAPTER); - this.columnAdapter = new MemberAnnotationAdapter(getMember(), buildColumnAnnotationAdapter(getDeclarationAnnotationAdapter())); - } - - public void initialize(CompilationUnit astRoot) { - this.transformerClass = this.transformerClass(astRoot); - this.method = this.method(astRoot); - if (this.columnAdapter.getAnnotation(astRoot) != null) { - this.column = createColumn(this, getMember(), getDeclarationAnnotationAdapter()); - this.column.initialize(astRoot); - } - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - //*************** WriteTransformer implementation **************** - public String getTransformerClass() { - return this.transformerClass; - } - - public void setTransformerClass(String newTransformerClass) { - if (attributeValueHasNotChanged(this.transformerClass, newTransformerClass)) { - return; - } - String oldTransformerClass = this.transformerClass; - this.transformerClass = newTransformerClass; - this.transformerClassAdapter.setValue(newTransformerClass); - firePropertyChanged(TRANSFORMER_CLASS_PROPERTY, oldTransformerClass, newTransformerClass); - } - - public String getMethod() { - return this.method; - } - - public void setMethod(String newMethod) { - if (attributeValueHasNotChanged(this.method, newMethod)) { - return; - } - String oldMethod = this.method; - this.method = newMethod; - this.methodAdapter.setValue(newMethod); - firePropertyChanged(METHOD_PROPERTY, oldMethod, newMethod); - } - - public ColumnAnnotation getNonNullColumn() { - return (getColumn() != null) ? getColumn() : new NullWriteTransformerColumn(this); - } - - public ColumnAnnotation getColumn() { - return this.column; - } - - public ColumnAnnotation addColumn() { - ColumnImpl column = createColumn(this, getMember(), getDeclarationAnnotationAdapter()); - column.newAnnotation(); - setColumn(column); - return column; - } - - public void removeColumn() { - this.column.removeAnnotation(); - setColumn(null); - } - - protected void setColumn(ColumnImpl newColumn) { - ColumnImpl oldColumn = this.column; - this.column = newColumn; - firePropertyChanged(WriteTransformerAnnotation.COLUMN_PROPERTY, oldColumn, newColumn); - } - - - public TextRange getTransformerClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(TRANSFORMER_CLASS_ADAPTER, astRoot); - } - - public TextRange getMethodTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(METHOD_ADAPTER, astRoot); - } - - public TextRange getColumnTextRange(CompilationUnit astRoot) { - if (this.column != null) { - return this.column.getTextRange(astRoot); - } - return getTextRange(astRoot); - } - - public void update(CompilationUnit astRoot) { - this.setTransformerClass(this.transformerClass(astRoot)); - this.setMethod(this.method(astRoot)); - if (this.columnAdapter.getAnnotation(astRoot) == null) { - this.setColumn(null); - } - else { - if (getColumn() != null) { - getColumn().update(astRoot); - } - else { - ColumnImpl column = createColumn(this, getMember(), getDeclarationAnnotationAdapter()); - column.initialize(astRoot); - this.setColumn(column); - } - } - } - - protected String transformerClass(CompilationUnit astRoot) { - return this.transformerClassAdapter.getValue(astRoot); - } - - protected String method(CompilationUnit astRoot) { - return this.methodAdapter.getValue(astRoot); - } - - // ********** static methods ********** - private static DeclarationAnnotationElementAdapter<String> buildTransformerClassAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.WRITE_TRANSFORMER__TRANSFORMER_CLASS, false, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildMethodAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, EclipseLinkJPA.WRITE_TRANSFORMER__METHOD, false); - } - - private static DeclarationAnnotationAdapter buildColumnAnnotationAdapter(DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) { - return new NestedDeclarationAnnotationAdapter(writeTransformerAnnotationAdapter, EclipseLinkJPA.WRITE_TRANSFORMER__COLUMN, JPA.COLUMN, false); - } - - private static ColumnImpl createColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter writeTransformerAnnotationAdapter) { - return new ColumnImpl(parent, member, buildColumnAnnotationAdapter(writeTransformerAnnotationAdapter)); - } - - public static class WriteTransformerAnnotationDefinition implements AnnotationDefinition - { - // singleton - private static final WriteTransformerAnnotationDefinition INSTANCE = new WriteTransformerAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static WriteTransformerAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private WriteTransformerAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) { - return new WriteTransformerImpl((JavaResourcePersistentAttribute) parent, (Attribute) member); - } - - public Annotation buildNullAnnotation(JavaResourcePersistentMember parent, Member member) { - return null; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmResourceModelProvider.java deleted file mode 100644 index 94cd0f7e8f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmResourceModelProvider.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.jpt.core.JptCorePlugin; -import org.eclipse.jpt.core.internal.resource.JpaResourceModelProviderManager; -import org.eclipse.jpt.core.resource.AbstractResourceModelProvider; -import org.eclipse.jpt.core.resource.common.JpaXmlResource; -import org.eclipse.jpt.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkConstants; -import org.eclipse.jpt.eclipselink.core.internal.JptEclipseLinkCorePlugin; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmResource; - -public class EclipseLinkOrmResourceModelProvider - extends AbstractResourceModelProvider<EclipseLinkOrmResource> -{ - /** - * (Convenience method) Returns an EclipseLink ORM resource model provider for - * the given file. - */ - public static EclipseLinkOrmResourceModelProvider getModelProvider(IFile file) { - return getModelProvider_(file.getProject(), file.getFullPath().toString()); - } - - /** - * (Convenience method) Returns an EclipseLink ORM resource model provider for - * the given project in the specified deploy location - */ - public static EclipseLinkOrmResourceModelProvider getModelProvider(IProject project, String deployLocation) { - return getModelProvider_(project, JptCorePlugin.getDeploymentURI(project, deployLocation)); - - } - - /** - * (Convenience method) Returns an EclipseLink ORM resource model provider for - * the given project in the default deploy location - */ - public static EclipseLinkOrmResourceModelProvider getDefaultModelProvider(IProject project) { - return getModelProvider(project, JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH); - } - - private static EclipseLinkOrmResourceModelProvider getModelProvider_(IProject project, String location) { - return (EclipseLinkOrmResourceModelProvider) JpaResourceModelProviderManager.instance().getModelProvider( - project, - new Path(location), - JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE); - } - - - public EclipseLinkOrmResourceModelProvider(IProject project) { - this(project, new Path(JptEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_FILE_PATH)); - } - - public EclipseLinkOrmResourceModelProvider(IProject project, IPath filePath) { - super(project, filePath); - } - - - @Override - protected String getContentTypeDescriber() { - return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE; - } - - @Override - protected void populateRoot(JpaXmlResource resource) { - XmlEntityMappings entityMappings = EclipseLinkOrmFactory.eINSTANCE.createXmlEntityMappings(); - entityMappings.setVersion(EclipseLinkConstants.VERSION_1_0_TEXT); - getResourceContents(resource).add(entityMappings); - } - - @Override - protected EclipseLinkOrmResource ensureCorrectType(Resource resource) throws ClassCastException { - return (EclipseLinkOrmResource) resource; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmResourceModelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmResourceModelProviderFactory.java deleted file mode 100644 index 9e29beb5f4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/EclipseLinkOrmResourceModelProviderFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.core.resource.JpaResourceModelProvider; -import org.eclipse.jpt.core.resource.JpaResourceModelProviderFactory; - -public class EclipseLinkOrmResourceModelProviderFactory - implements JpaResourceModelProviderFactory -{ - public JpaResourceModelProvider create(IProject project, IPath filePath) { - return new EclipseLinkOrmResourceModelProvider(project, filePath); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/BasicCollectionTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/BasicCollectionTranslator.java deleted file mode 100644 index b18deca31a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/BasicCollectionTranslator.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class BasicCollectionTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - public BasicCollectionTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlBasicCollectionImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator() - }; - } - - protected Translator createNameTranslator() { - return new Translator(NAME, ORM_PKG.getXmlAttributeMapping_Name(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/BasicMapTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/BasicMapTranslator.java deleted file mode 100644 index 3c244c1c84..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/BasicMapTranslator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.BasicTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class BasicMapTranslator extends BasicTranslator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - public BasicMapTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlBasicMapImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator() - }; - } - - @Override - protected Translator createNameTranslator() { - return new Translator(NAME, ORM_PKG.getXmlAttributeMapping_Name(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/CacheTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/CacheTranslator.java deleted file mode 100644 index 5e058f1962..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/CacheTranslator.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class CacheTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public CacheTranslator() { - super(CACHE, ECLIPSELINK_ORM_PKG.getXmlCacheHolder_Cache()); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createExpiryTranslator(), - createExpiryTimeOfDayTranslator(), - createSizeTranslator(), - createSharedTranslator(), - createTypeTranslator(), - createAlwaysRefreshTranslator(), - createRefreshOnlyIfNewerTranslator(), - createDisableHitsTranslator(), - createCoordinationTypeTranslator(), - }; - } - - protected Translator createExpiryTranslator() { - return new Translator(CACHE__EXPIRY, ECLIPSELINK_ORM_PKG.getXmlCache_Expiry()); - } - - protected Translator createExpiryTimeOfDayTranslator() { - return new ExpiryTimeOfDayTranslator(); - } - - protected Translator createSizeTranslator() { - return new Translator(CACHE__SIZE, ECLIPSELINK_ORM_PKG.getXmlCache_Size(), DOM_ATTRIBUTE); - } - - protected Translator createSharedTranslator() { - return new Translator(CACHE__SHARED, ECLIPSELINK_ORM_PKG.getXmlCache_Shared(), DOM_ATTRIBUTE); - } - - protected Translator createTypeTranslator() { - return new Translator(CACHE__TYPE, ECLIPSELINK_ORM_PKG.getXmlCache_Type(), DOM_ATTRIBUTE); - } - - protected Translator createAlwaysRefreshTranslator() { - return new Translator(CACHE__ALWAYS_REFRESH, ECLIPSELINK_ORM_PKG.getXmlCache_AlwaysRefresh(), DOM_ATTRIBUTE); - } - - protected Translator createRefreshOnlyIfNewerTranslator() { - return new Translator(CACHE__REFRESH_ONLY_IF_NEWER, ECLIPSELINK_ORM_PKG.getXmlCache_RefreshOnlyIfNewer(), DOM_ATTRIBUTE); - } - - protected Translator createDisableHitsTranslator() { - return new Translator(CACHE__DISABLE_HITS, ECLIPSELINK_ORM_PKG.getXmlCache_DisableHits(), DOM_ATTRIBUTE); - } - - protected Translator createCoordinationTypeTranslator() { - return new Translator(CACHE__COORDINATION_TYPE, ECLIPSELINK_ORM_PKG.getXmlCache_CoordinationType(), DOM_ATTRIBUTE); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ConversionValueTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ConversionValueTranslator.java deleted file mode 100644 index 45f04b91ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ConversionValueTranslator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class ConversionValueTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public ConversionValueTranslator() { - super(CONVERSION_VALUE, ECLIPSELINK_ORM_PKG.getXmlObjectTypeConverter_ConversionValues(), END_TAG_NO_INDENT); - } - - @Override - public EObject createEMFObject(@SuppressWarnings("unused") String nodeName, @SuppressWarnings("unused") String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConversionValueImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createDataValueTranslator(), - createObjectValueTranslator(), - }; - } - - protected Translator createDataValueTranslator() { - return new Translator(CONVERSION_VALUE__DATA_VALUE, ECLIPSELINK_ORM_PKG.getXmlConversionValue_DataValue(), DOM_ATTRIBUTE); - } - - protected Translator createObjectValueTranslator() { - return new Translator(CONVERSION_VALUE__OBJECT_VALUE, ECLIPSELINK_ORM_PKG.getXmlConversionValue_ObjectValue(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ConverterTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ConverterTranslator.java deleted file mode 100644 index 024478cb13..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ConverterTranslator.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class ConverterTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public ConverterTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature, END_TAG_NO_INDENT); - } - - @Override - public EObject createEMFObject(@SuppressWarnings("unused") String nodeName, @SuppressWarnings("unused") String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlConverterImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createClassTranslator(), - }; - } - - protected Translator createNameTranslator() { - return new Translator(CONVERTER__NAME, ECLIPSELINK_ORM_PKG.getXmlNamedConverter_Name(), DOM_ATTRIBUTE); - } - - protected Translator createClassTranslator() { - return new Translator(CONVERTER__CLASS, ECLIPSELINK_ORM_PKG.getXmlConverter_ClassName(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/CustomizerTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/CustomizerTranslator.java deleted file mode 100644 index e3eca6372f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/CustomizerTranslator.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class CustomizerTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public CustomizerTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature, END_TAG_NO_INDENT); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createClassTranslator() - }; - } - - protected Translator createClassTranslator() { - return new Translator(CLASS, ECLIPSELINK_ORM_PKG.getXmlCustomizer_CustomizerClassName(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkAttributesTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkAttributesTranslator.java deleted file mode 100644 index 2f61bd9b85..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkAttributesTranslator.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.AttributesTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkAttributesTranslator extends AttributesTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkAttributesTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createAttributes(); - - } - @Override - protected Translator[] createChildren() { - return new Translator[] { - createIdTranslator(), - createEmbeddedIdTranslator(), - createBasicTranslator(), - createBasicCollectionTranslator(), - createBasicMapTranslator(), - createVersionTranslator(), - createManyToOneTranslator(), - createOneToManyTranslator(), - createOneToOneTranslator(), - createManyToManyTranslator(), - createEmbeddedTranslator(), - createTransformationTranslator(), - createTransientTranslator() - }; - } - - @Override - protected Translator createIdTranslator() { - return new EclipseLinkIdTranslator(ID, ORM_PKG.getAttributes_Ids()); - } - -// protected Translator createEmbeddedIdTranslator() { -// return new EmbeddedIdTranslator(EMBEDDED_ID, ORM_PKG.getAttributes_EmbeddedIds()); -// } - - @Override - protected Translator createBasicTranslator() { - return new EclipseLinkBasicTranslator(BASIC, ORM_PKG.getAttributes_Basics()); - } - - @Override - protected Translator createVersionTranslator() { - return new EclipseLinkVersionTranslator(VERSION, ORM_PKG.getAttributes_Versions()); - } - - @Override - protected Translator createManyToOneTranslator() { - return new EclipseLinkManyToOneTranslator(MANY_TO_ONE, ORM_PKG.getAttributes_ManyToOnes()); - } - - @Override - protected Translator createOneToOneTranslator() { - return new EclipseLinkOneToOneTranslator(ONE_TO_ONE, ORM_PKG.getAttributes_OneToOnes()); - } - - @Override - protected Translator createOneToManyTranslator() { - return new EclipseLinkOneToManyTranslator(ONE_TO_MANY, ORM_PKG.getAttributes_OneToManys()); - } - - @Override - protected Translator createManyToManyTranslator() { - return new EclipseLinkManyToManyTranslator(MANY_TO_MANY, ORM_PKG.getAttributes_ManyToManys()); - } - -// protected Translator createEmbeddedTranslator() { -// return new EmbeddedTranslator(EMBEDDED, ORM_PKG.getAttributes_Embeddeds()); -// } -// -// protected Translator createTransientTranslator() { -// return new TransientTranslator(TRANSIENT, ORM_PKG.getAttributes_Transients()); -// } - - - protected Translator createBasicCollectionTranslator() { - return new BasicCollectionTranslator(BASIC_COLLECTION, ECLIPSELINK_ORM_PKG.getAttributes_BasicCollections()); - } - - protected Translator createBasicMapTranslator() { - return new BasicMapTranslator(BASIC_MAP, ECLIPSELINK_ORM_PKG.getAttributes_BasicMaps()); - } - - protected Translator createTransformationTranslator() { - return new TransformationTranslator(TRANSFORMATION, ECLIPSELINK_ORM_PKG.getAttributes_Transformations()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkBasicTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkBasicTranslator.java deleted file mode 100644 index 3f20b681af..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkBasicTranslator.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.BasicTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkBasicTranslator extends BasicTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkBasicTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlBasicImpl(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createFetchTranslator(), - createOptionalTranslator(), - createMutableTranslator(), - createColumnTranslator(), - createLobTranslator(), - createTemporalTranslator(), - createEnumeratedTranslator(), - createConvertTranslator(), - createConverterTranslator(), - createTypeConverterTranslator(), - createObjectTypeConverterTranslator(), - createStructConverterTranslator(), - - }; - } - - protected Translator createMutableTranslator() { - return new Translator(MUTABLE, ECLIPSELINK_ORM_PKG.getXmlMutable_Mutable(), DOM_ATTRIBUTE); - } - - protected Translator createConvertTranslator() { - return new Translator(CONVERT, ECLIPSELINK_ORM_PKG.getXmlConvertibleMapping_Convert()); - } - - protected Translator createConverterTranslator() { - return new ConverterTranslator(CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_Converter()); - } - - protected Translator createTypeConverterTranslator() { - return new TypeConverterTranslator(TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_TypeConverter()); - } - - protected Translator createObjectTypeConverterTranslator() { - return new ObjectTypeConverterTranslator(OBJECT_TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_ObjectTypeConverter()); - } - - protected Translator createStructConverterTranslator() { - return new StructConverterTranslator(STRUCT_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_StructConverter()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkChangeTrackingTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkChangeTrackingTranslator.java deleted file mode 100644 index 12a70b1060..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkChangeTrackingTranslator.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkChangeTrackingTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public EclipseLinkChangeTrackingTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) { - super(domNameAndPath, aFeature, style); - } - - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createTypeTranslator() - }; - } - - protected Translator createTypeTranslator() { - return new Translator(TYPE, ECLIPSELINK_ORM_PKG.getXmlChangeTracking_Type(), Translator.DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEmbeddableTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEmbeddableTranslator.java deleted file mode 100644 index 4c11deb5ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEmbeddableTranslator.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.EmbeddableTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkEmbeddableTranslator extends EmbeddableTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkEmbeddableTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlEmbeddable(); - } - - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createClassTranslator(), - createAccessTranslator(), - createMetadataCompleteTranslator(), - createDescriptionTranslator(), - createCustomizerTranslator(), - createChangeTrackingTranslator(), - createConverterTranslator(), - createTypeConverterTranslator(), - createObjectTypeConverterTranslator(), - createStructConverterTranslator(), - createAttributesTranslator() - }; - } - - protected Translator createCustomizerTranslator() { - return new CustomizerTranslator(CUSTOMIZER, ECLIPSELINK_ORM_PKG.getXmlCustomizerHolder_Customizer()); - } - - protected Translator createChangeTrackingTranslator() { - return new EclipseLinkChangeTrackingTranslator(CHANGE_TRACKING, ECLIPSELINK_ORM_PKG.getXmlChangeTrackingHolder_ChangeTracking(), END_TAG_NO_INDENT); - } - - protected Translator createConverterTranslator() { - return new ConverterTranslator(CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_Converters()); - } - - protected Translator createTypeConverterTranslator() { - return new TypeConverterTranslator(TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_TypeConverters()); - } - - protected Translator createObjectTypeConverterTranslator() { - return new ObjectTypeConverterTranslator(OBJECT_TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_ObjectTypeConverters()); - } - - protected Translator createStructConverterTranslator() { - return new StructConverterTranslator(STRUCT_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_StructConverters()); - } - - @Override - protected Translator createAttributesTranslator() { - return new EclipseLinkAttributesTranslator(ATTRIBUTES, ORM_PKG.getAbstractXmlTypeMapping_Attributes()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEntityMappingsTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEntityMappingsTranslator.java deleted file mode 100644 index d24606e6d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEntityMappingsTranslator.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.jpt.core.internal.resource.orm.translators.EntityMappingsTranslator; -import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkEntityMappingsTranslator extends EntityMappingsTranslator - implements EclipseLinkOrmXmlMapper -{ - public static EclipseLinkEntityMappingsTranslator INSTANCE = new EclipseLinkEntityMappingsTranslator(); - - - public EclipseLinkEntityMappingsTranslator() { - super(ENTITY_MAPPINGS, ECLIPSELINK_ORM_PKG.getXmlEntityMappings()); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createVersionTranslator(), - createNamespaceTranslator(), - createSchemaNamespaceTranslator(), - createSchemaLocationTranslator(), - createDescriptionTranslator(), - createPersistenceUnitMetadataTranslator(), - createPackageTranslator(), - createSchemaTranslator(), - createCatalogTranslator(), - createAccessTranslator(), - createConverterTranslator(), - createTypeConverterTranslator(), - createObjectTypeConverterTranslator(), - createStructConverterTranslator(), - createSequenceGeneratorTranslator(), - createTableGeneratorTranslator(), - createNamedQueryTranslator(), - createNamedNativeQueryTranslator(), - createSqlResultSetMappingTranslator(), - createMappedSuperclassTranslator(), - createEntityTranslator(), - createEmbeddableTranslator() - }; - } - - @Override - protected Translator createNamespaceTranslator() { - return new ConstantAttributeTranslator(XML_NS, ECLIPSELINK_ORM_NS_URL); - } - - @Override - protected Translator createSchemaLocationTranslator() { - return new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, ECLIPSELINK_ORM_NS_URL + ' ' + ECLIPSELINK_ORM_SCHEMA_LOC_1_0); - } - - @Override - protected Translator createEmbeddableTranslator() { - return new EclipseLinkEmbeddableTranslator(EMBEDDABLE, ORM_PKG.getXmlEntityMappings_Embeddables()); - } - - @Override - protected Translator createEntityTranslator() { - return new EclipseLinkEntityTranslator(ENTITY, ORM_PKG.getXmlEntityMappings_Entities()); - } - - @Override - protected Translator createMappedSuperclassTranslator() { - return new EclipseLinkMappedSuperclassTranslator(MAPPED_SUPERCLASS, ORM_PKG.getXmlEntityMappings_MappedSuperclasses()); - } - - - protected Translator createConverterTranslator() { - return new ConverterTranslator(CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_Converters()); - } - - protected Translator createTypeConverterTranslator() { - return new TypeConverterTranslator(TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_TypeConverters()); - } - - protected Translator createObjectTypeConverterTranslator() { - return new ObjectTypeConverterTranslator(OBJECT_TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_ObjectTypeConverters()); - } - - protected Translator createStructConverterTranslator() { - return new StructConverterTranslator(STRUCT_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_StructConverters()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEntityTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEntityTranslator.java deleted file mode 100644 index 14aed038a3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkEntityTranslator.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.EntityTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkEntityTranslator extends EntityTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkEntityTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlEntity(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createClassTranslator(), - createAccessTranslator(), - createMetadataCompleteTranslator(), - createReadOnlyTranslator(), - createExistenceCheckingTranslator(), - createDescriptionTranslator(), - createCustomizerTranslator(), - createChangeTrackingTranslator(), - createTableTranslator(), - createSecondaryTableTranslator(), - createPrimaryKeyJoinColumnTranslator(), - createIdClassTranslator(), - createInheritanceTranslator(), - createDiscriminatorValueTranslator(), - createDiscriminatorColumnTranslator(), - createCacheTranslator(), - createConverterTranslator(), - createTypeConverterTranslator(), - createObjectTypeConverterTranslator(), - createStructConverterTranslator(), - createSequenceGeneratorTranslator(), - createTableGeneratorTranslator(), - createNamedQueryTranslator(), - createNamedNativeQueryTranslator(), - createSqlResultSetMappingTranslator(), - createExcludeDefaultListenersTranslator(), - createExcludeSuperclassListenersTranslator(), - createEntityListenersTranslator(), - createPrePersistTranslator(), - createPostPersistTranslator(), - createPreRemoveTranslator(), - createPostRemoveTranslator(), - createPreUpdateTranslator(), - createPostUpdateTranslator(), - createPostLoadTranslator(), - createAttributeOverrideTranslator(), - createAssociationOverrideTranslator(), - createAttributesTranslator() - }; - } - - protected Translator createReadOnlyTranslator() { - return new Translator(READ_ONLY, ECLIPSELINK_ORM_PKG.getXmlReadOnly_ReadOnly(), DOM_ATTRIBUTE); - } - - protected Translator createExistenceCheckingTranslator() { - return new Translator(EXISTENCE_CHECKING, ECLIPSELINK_ORM_PKG.getXmlCacheHolder_ExistenceChecking(), DOM_ATTRIBUTE); - } - - protected Translator createCustomizerTranslator() { - return new CustomizerTranslator(CUSTOMIZER, ECLIPSELINK_ORM_PKG.getXmlCustomizerHolder_Customizer()); - } - - protected Translator createChangeTrackingTranslator() { - return new EclipseLinkChangeTrackingTranslator(CHANGE_TRACKING, ECLIPSELINK_ORM_PKG.getXmlChangeTrackingHolder_ChangeTracking(), END_TAG_NO_INDENT); - } - - protected Translator createCacheTranslator() { - return new CacheTranslator(); - } - - protected Translator createConverterTranslator() { - return new ConverterTranslator(CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_Converters()); - } - - protected Translator createTypeConverterTranslator() { - return new TypeConverterTranslator(TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_TypeConverters()); - } - - protected Translator createObjectTypeConverterTranslator() { - return new ObjectTypeConverterTranslator(OBJECT_TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_ObjectTypeConverters()); - } - - protected Translator createStructConverterTranslator() { - return new StructConverterTranslator(STRUCT_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_StructConverters()); - } - - @Override - protected Translator createAttributesTranslator() { - return new EclipseLinkAttributesTranslator(ATTRIBUTES, ORM_PKG.getAbstractXmlTypeMapping_Attributes()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkIdTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkIdTranslator.java deleted file mode 100644 index d43d3d2e2f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkIdTranslator.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.IdTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkIdTranslator extends IdTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkIdTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlIdImpl(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createMutableTranslator(), - createColumnTranslator(), - createGeneratedValueTranslator(), - createTemporalTranslator(), - createConvertTranslator(), - createConverterTranslator(), - createTypeConverterTranslator(), - createObjectTypeConverterTranslator(), - createStructConverterTranslator(), - createTableGeneratorTranslator(), - createSequenceGeneratorTranslator() - }; - } - - protected Translator createMutableTranslator() { - return new Translator(MUTABLE, ECLIPSELINK_ORM_PKG.getXmlMutable_Mutable(), DOM_ATTRIBUTE); - } - - protected Translator createConvertTranslator() { - return new Translator(CONVERT, ECLIPSELINK_ORM_PKG.getXmlConvertibleMapping_Convert()); - } - - protected Translator createConverterTranslator() { - return new ConverterTranslator(CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_Converter()); - } - - protected Translator createTypeConverterTranslator() { - return new TypeConverterTranslator(TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_TypeConverter()); - } - - protected Translator createObjectTypeConverterTranslator() { - return new ObjectTypeConverterTranslator(OBJECT_TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_ObjectTypeConverter()); - } - - protected Translator createStructConverterTranslator() { - return new StructConverterTranslator(STRUCT_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_StructConverter()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkManyToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkManyToManyTranslator.java deleted file mode 100644 index 382f18123d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkManyToManyTranslator.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.ManyToManyTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkManyToManyTranslator extends ManyToManyTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkManyToManyTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlManyToManyImpl(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createTargetEntityTranslator(), - createFetchTranslator(), - createMappedByTranslator(), - createOrderByTranslator(), - createMapKeyTranslator(), - createJoinTableTranslator(), - createCascadeTranslator(), - createJoinFetchTranslator() - }; - } - - protected Translator createJoinFetchTranslator() { - return new Translator(JOIN_FETCH, ECLIPSELINK_ORM_PKG.getXmlJoinFetch_JoinFetch()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkManyToOneTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkManyToOneTranslator.java deleted file mode 100644 index 02e173d926..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkManyToOneTranslator.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.ManyToOneTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkManyToOneTranslator extends ManyToOneTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkManyToOneTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlManyToOneImpl(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createTargetEntityTranslator(), - createFetchTranslator(), - createOptionalTranslator(), - createJoinColumnTranslator(), - createJoinTableTranslator(), - createCascadeTranslator(), - createJoinFetchTranslator() - }; - } - - protected Translator createJoinFetchTranslator() { - return new Translator(JOIN_FETCH, ECLIPSELINK_ORM_PKG.getXmlJoinFetch_JoinFetch()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkMappedSuperclassTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkMappedSuperclassTranslator.java deleted file mode 100644 index 0046eb0ffb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkMappedSuperclassTranslator.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.MappedSuperclassTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkMappedSuperclassTranslator extends MappedSuperclassTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkMappedSuperclassTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlMappedSuperclass(); - } - - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createClassTranslator(), - createAccessTranslator(), - createMetadataCompleteTranslator(), - createReadOnlyTranslator(), - createExistenceCheckingTranslator(), - createDescriptionTranslator(), - createCustomizerTranslator(), - createChangeTrackingTranslator(), - createIdClassTranslator(), - createCacheTranslator(), - createConverterTranslator(), - createTypeConverterTranslator(), - createObjectTypeConverterTranslator(), - createStructConverterTranslator(), - createExcludeDefaultListenersTranslator(), - createExcludeSuperclassListenersTranslator(), - createEntityListenersTranslator(), - createPrePersistTranslator(), - createPostPersistTranslator(), - createPreRemoveTranslator(), - createPostRemoveTranslator(), - createPreUpdateTranslator(), - createPostUpdateTranslator(), - createPostLoadTranslator(), - createAttributesTranslator() - }; - } - - protected Translator createReadOnlyTranslator() { - return new Translator(READ_ONLY, ECLIPSELINK_ORM_PKG.getXmlReadOnly_ReadOnly(), DOM_ATTRIBUTE); - } - - protected Translator createExistenceCheckingTranslator() { - return new Translator(EXISTENCE_CHECKING, ECLIPSELINK_ORM_PKG.getXmlCacheHolder_ExistenceChecking(), DOM_ATTRIBUTE); - } - - protected Translator createCustomizerTranslator() { - return new CustomizerTranslator(CUSTOMIZER, ECLIPSELINK_ORM_PKG.getXmlCustomizerHolder_Customizer()); - } - - protected Translator createChangeTrackingTranslator() { - return new EclipseLinkChangeTrackingTranslator(CHANGE_TRACKING, ECLIPSELINK_ORM_PKG.getXmlChangeTrackingHolder_ChangeTracking(), END_TAG_NO_INDENT); - } - - protected Translator createCacheTranslator() { - return new CacheTranslator(); - } - - protected Translator createConverterTranslator() { - return new ConverterTranslator(CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_Converters()); - } - - protected Translator createTypeConverterTranslator() { - return new TypeConverterTranslator(TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_TypeConverters()); - } - - protected Translator createObjectTypeConverterTranslator() { - return new ObjectTypeConverterTranslator(OBJECT_TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_ObjectTypeConverters()); - } - - protected Translator createStructConverterTranslator() { - return new StructConverterTranslator(STRUCT_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConvertersHolder_StructConverters()); - } - - @Override - protected Translator createAttributesTranslator() { - return new EclipseLinkAttributesTranslator(ATTRIBUTES, ORM_PKG.getAbstractXmlTypeMapping_Attributes()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOneToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOneToManyTranslator.java deleted file mode 100644 index e15fcdf481..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOneToManyTranslator.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.common.translators.EmptyTagBooleanTranslator; -import org.eclipse.jpt.core.internal.resource.orm.translators.OneToManyTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkOneToManyTranslator extends OneToManyTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkOneToManyTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlOneToManyImpl(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createTargetEntityTranslator(), - createFetchTranslator(), - createMappedByTranslator(), - createOrderByTranslator(), - createMapKeyTranslator(), - createJoinTableTranslator(), - createJoinColumnTranslator(), - createCascadeTranslator(), - createPrivateOwnedTranslator(), - createJoinFetchTranslator() - }; - } - - protected Translator createPrivateOwnedTranslator() { - return new EmptyTagBooleanTranslator(PRIVATE_OWNED, ECLIPSELINK_ORM_PKG.getXmlPrivateOwned_PrivateOwned()); - } - - protected Translator createJoinFetchTranslator() { - return new Translator(JOIN_FETCH, ECLIPSELINK_ORM_PKG.getXmlJoinFetch_JoinFetch()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOneToOneTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOneToOneTranslator.java deleted file mode 100644 index f355f0fc7d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOneToOneTranslator.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.common.translators.EmptyTagBooleanTranslator; -import org.eclipse.jpt.core.internal.resource.orm.translators.OneToOneTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkOneToOneTranslator extends OneToOneTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkOneToOneTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlOneToOneImpl(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createTargetEntityTranslator(), - createFetchTranslator(), - createOptionalTranslator(), - createMappedByTranslator(), - createPrimaryKeyJoinColumnTranslator(), - createJoinColumnTranslator(), - createJoinTableTranslator(), - createCascadeTranslator(), - createPrivateOwnedTranslator(), - createJoinFetchTranslator() - }; - } - - protected Translator createPrivateOwnedTranslator() { - return new EmptyTagBooleanTranslator(PRIVATE_OWNED, ECLIPSELINK_ORM_PKG.getXmlPrivateOwned_PrivateOwned()); - } - - protected Translator createJoinFetchTranslator() { - return new Translator(JOIN_FETCH, ECLIPSELINK_ORM_PKG.getXmlJoinFetch_JoinFetch()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOrmXmlMapper.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOrmXmlMapper.java deleted file mode 100644 index c80fdc1792..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkOrmXmlMapper.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.jpt.core.internal.resource.orm.translators.OrmXmlMapper; -import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkConstants; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmPackage; - -public interface EclipseLinkOrmXmlMapper - extends OrmXmlMapper, EclipseLinkConstants -{ - EclipseLinkOrmPackage ECLIPSELINK_ORM_PKG = EclipseLinkOrmPackage.eINSTANCE; - - String BASIC_COLLECTION = "basic-collection"; //$NON-NLS-1$ - - String BASIC_MAP = "basic-map"; //$NON-NLS-1$ - - String CACHE = "cache"; //$NON-NLS-1$ - String CACHE__EXPIRY = "expiry"; //$NON-NLS-1$ - String CACHE__SIZE = "size"; //$NON-NLS-1$ - String CACHE__SHARED = "shared"; //$NON-NLS-1$ - String CACHE__TYPE = "type"; //$NON-NLS-1$ - String CACHE__ALWAYS_REFRESH = "always-refresh"; //$NON-NLS-1$ - String CACHE__REFRESH_ONLY_IF_NEWER = "refresh-only-if-newer"; //$NON-NLS-1$ - String CACHE__DISABLE_HITS = "disable-hits"; //$NON-NLS-1$ - String CACHE__COORDINATION_TYPE = "coordination-type"; //$NON-NLS-1$ - - String CHANGE_TRACKING = "change-tracking"; //$NON-NLS-1$ - - String CONVERSION_VALUE = "conversion-value"; //$NON-NLS-1$ - String CONVERSION_VALUE__DATA_VALUE = "data-value"; //$NON-NLS-1$ - String CONVERSION_VALUE__OBJECT_VALUE = "object-value"; //$NON-NLS-1$ - - String CONVERT = "convert"; //$NON-NLS-1$ - - String CONVERTER = "converter"; //$NON-NLS-1$ - String CONVERTER__CLASS = "class"; //$NON-NLS-1$ - String CONVERTER__NAME = "name"; //$NON-NLS-1$ - - String CUSTOMIZER = "customizer"; //$NON-NLS-1$ - - String EXISTENCE_CHECKING = "existence-checking"; //$NON-NLS-1$ - - String EXPIRY_TIME_OF_DAY = "expiry-time-of-day"; //$NON-NLS-1$ - String EXPIRY_TIME_OF_DAY__HOUR = "hour"; //$NON-NLS-1$ - String EXPIRY_TIME_OF_DAY__MINUTE = "minute"; //$NON-NLS-1$ - String EXPIRY_TIME_OF_DAY__SECOND = "second"; //$NON-NLS-1$ - String EXPIRY_TIME_OF_DAY__MILLISECOND = "millisecond"; //$NON-NLS-1$ - - String JOIN_FETCH = "join-fetch"; //$NON-NLS-1$ - - String MUTABLE = "mutable"; //$NON-NLS-1$ - - String OBJECT_TYPE_CONVERTER = "object-type-converter"; //$NON-NLS-1$ - String OBJECT_TYPE_CONVERTER__NAME = "name"; //$NON-NLS-1$ - String OBJECT_TYPE_CONVERTER__DATA_TYPE = "data-type"; //$NON-NLS-1$ - String OBJECT_TYPE_CONVERTER__OBJECT_TYPE = "object-type"; //$NON-NLS-1$ - String OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE = "default-object-value"; //$NON-NLS-1$ - - String PRIVATE_OWNED = "private-owned"; //$NON-NLS-1$ - - String READ_ONLY = "read-only"; //$NON-NLS-1$ - - String STRUCT_CONVERTER = "struct-converter"; //$NON-NLS-1$ - String STRUCT_CONVERTER__NAME = "name"; //$NON-NLS-1$ - String STRUCT_CONVERTER__CONVERTER = "converter"; //$NON-NLS-1$ - - String TRANSFORMATION = "transformation"; //$NON-NLS-1$ - - String TYPE = "type"; //$NON-NLS-1$ - - String TYPE_CONVERTER = "type-converter"; //$NON-NLS-1$ - String TYPE_CONVERTER__NAME = "name"; //$NON-NLS-1$ - String TYPE_CONVERTER__DATA_TYPE = "data-type"; //$NON-NLS-1$ - String TYPE_CONVERTER__OBJECT_TYPE = "object-type"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkVersionTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkVersionTranslator.java deleted file mode 100644 index b11028e897..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/EclipseLinkVersionTranslator.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.VersionTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class EclipseLinkVersionTranslator extends VersionTranslator - implements EclipseLinkOrmXmlMapper -{ - public EclipseLinkVersionTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlVersionImpl(); - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createMutableTranslator(), - createColumnTranslator(), - createTemporalTranslator(), - createConvertTranslator(), - createConverterTranslator(), - createTypeConverterTranslator(), - createObjectTypeConverterTranslator(), - createStructConverterTranslator(), - }; - } - - protected Translator createMutableTranslator() { - return new Translator(MUTABLE, ECLIPSELINK_ORM_PKG.getXmlMutable_Mutable(), DOM_ATTRIBUTE); - } - - protected Translator createConvertTranslator() { - return new Translator(CONVERT, ECLIPSELINK_ORM_PKG.getXmlConvertibleMapping_Convert()); - } - - protected Translator createConverterTranslator() { - return new ConverterTranslator(CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_Converter()); - } - - protected Translator createTypeConverterTranslator() { - return new TypeConverterTranslator(TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_TypeConverter()); - } - - protected Translator createObjectTypeConverterTranslator() { - return new ObjectTypeConverterTranslator(OBJECT_TYPE_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_ObjectTypeConverter()); - } - - protected Translator createStructConverterTranslator() { - return new StructConverterTranslator(STRUCT_CONVERTER, ECLIPSELINK_ORM_PKG.getXmlConverterHolder_StructConverter()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ExpiryTimeOfDayTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ExpiryTimeOfDayTranslator.java deleted file mode 100644 index 726abe3ef0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ExpiryTimeOfDayTranslator.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class ExpiryTimeOfDayTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public ExpiryTimeOfDayTranslator() { - super(EXPIRY_TIME_OF_DAY, ECLIPSELINK_ORM_PKG.getXmlCache_ExpiryTimeOfDay()); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createHourTranslator(), - createMinuteTranslator(), - createSecondTranslator(), - createMillisecondTranslator(), - }; - } - protected Translator createHourTranslator() { - return new Translator(EXPIRY_TIME_OF_DAY__HOUR, ECLIPSELINK_ORM_PKG.getXmlTimeOfDay_Hour(), DOM_ATTRIBUTE); - } - - protected Translator createMinuteTranslator() { - return new Translator(EXPIRY_TIME_OF_DAY__MINUTE, ECLIPSELINK_ORM_PKG.getXmlTimeOfDay_Minute(), DOM_ATTRIBUTE); - } - - protected Translator createSecondTranslator() { - return new Translator(EXPIRY_TIME_OF_DAY__SECOND, ECLIPSELINK_ORM_PKG.getXmlTimeOfDay_Second(), DOM_ATTRIBUTE); - } - - protected Translator createMillisecondTranslator() { - return new Translator(EXPIRY_TIME_OF_DAY__MILLISECOND, ECLIPSELINK_ORM_PKG.getXmlTimeOfDay_Millisecond(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ObjectTypeConverterTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ObjectTypeConverterTranslator.java deleted file mode 100644 index f85f67809a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/ObjectTypeConverterTranslator.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class ObjectTypeConverterTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public ObjectTypeConverterTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(@SuppressWarnings("unused") String nodeName, @SuppressWarnings("unused") String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlObjectTypeConverterImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createConversionValueTranslator(), - createDefaultObjectValueTranslator(), - createNameTranslator(), - createDataTypeTranslator(), - createObjectTypeTranslator(), - }; - } - - protected Translator createConversionValueTranslator() { - return new ConversionValueTranslator(); - } - - protected Translator createDefaultObjectValueTranslator() { - return new Translator(OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE, ECLIPSELINK_ORM_PKG.getXmlObjectTypeConverter_DefaultObjectValue()); - } - - protected Translator createNameTranslator() { - return new Translator(OBJECT_TYPE_CONVERTER__NAME, ECLIPSELINK_ORM_PKG.getXmlNamedConverter_Name(), DOM_ATTRIBUTE); - } - - protected Translator createDataTypeTranslator() { - return new Translator(OBJECT_TYPE_CONVERTER__DATA_TYPE, ECLIPSELINK_ORM_PKG.getXmlObjectTypeConverter_DataType(), DOM_ATTRIBUTE); - } - - protected Translator createObjectTypeTranslator() { - return new Translator(OBJECT_TYPE_CONVERTER__OBJECT_TYPE, ECLIPSELINK_ORM_PKG.getXmlObjectTypeConverter_ObjectType(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/StructConverterTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/StructConverterTranslator.java deleted file mode 100644 index 50eba69001..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/StructConverterTranslator.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class StructConverterTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public StructConverterTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature, END_TAG_NO_INDENT); - } - - @Override - public EObject createEMFObject(@SuppressWarnings("unused") String nodeName, @SuppressWarnings("unused") String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlStructConverterImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createConverterTranslator(), - }; - } - - protected Translator createNameTranslator() { - return new Translator(STRUCT_CONVERTER__NAME, ECLIPSELINK_ORM_PKG.getXmlNamedConverter_Name(), DOM_ATTRIBUTE); - } - - protected Translator createConverterTranslator() { - return new Translator(STRUCT_CONVERTER__CONVERTER, ECLIPSELINK_ORM_PKG.getXmlStructConverter_Converter(), DOM_ATTRIBUTE); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/TransformationTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/TransformationTranslator.java deleted file mode 100644 index b3a0623561..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/TransformationTranslator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.core.internal.resource.orm.translators.BasicTranslator; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class TransformationTranslator extends BasicTranslator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - public TransformationTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature); - } - - @Override - public EObject createEMFObject(String nodeName, String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTransformationImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - @Override - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator() - }; - } - - @Override - protected Translator createNameTranslator() { - return new Translator(NAME, ORM_PKG.getXmlAttributeMapping_Name(), DOM_ATTRIBUTE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/TypeConverterTranslator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/TypeConverterTranslator.java deleted file mode 100644 index 2601c2aa5a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/resource/orm/translators/TypeConverterTranslator.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.eclipselink.core.internal.resource.orm.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class TypeConverterTranslator extends Translator - implements EclipseLinkOrmXmlMapper -{ - private Translator[] children; - - - public TypeConverterTranslator(String domNameAndPath, EStructuralFeature aFeature) { - super(domNameAndPath, aFeature, END_TAG_NO_INDENT); - } - - @Override - public EObject createEMFObject(@SuppressWarnings("unused") String nodeName, @SuppressWarnings("unused") String readAheadName) { - return EclipseLinkOrmFactory.eINSTANCE.createXmlTypeConverterImpl(); - } - - @Override - protected Translator[] getChildren() { - if (this.children == null) { - this.children = createChildren(); - } - return this.children; - } - - protected Translator[] createChildren() { - return new Translator[] { - createNameTranslator(), - createDataTypeTranslator(), - createObjectTypeTranslator(), - }; - } - - protected Translator createNameTranslator() { - return new Translator(TYPE_CONVERTER__NAME, ECLIPSELINK_ORM_PKG.getXmlNamedConverter_Name(), DOM_ATTRIBUTE); - } - - protected Translator createDataTypeTranslator() { - return new Translator(TYPE_CONVERTER__DATA_TYPE, ECLIPSELINK_ORM_PKG.getXmlTypeConverter_DataType(), DOM_ATTRIBUTE); - } - - protected Translator createObjectTypeTranslator() { - return new Translator(TYPE_CONVERTER__OBJECT_TYPE, ECLIPSELINK_ORM_PKG.getXmlTypeConverter_ObjectType(), DOM_ATTRIBUTE); - } -} |