diff options
author | tle | 2008-02-03 21:15:48 +0000 |
---|---|---|
committer | tle | 2008-02-03 21:15:48 +0000 |
commit | 8d7d4d9efa1777c368a4b809d49bc15cfca1808b (patch) | |
tree | 7ebd3542ce39e8a680e576ac579721039ffaf409 /jpa | |
parent | 7f7b20a5d66bf69e88734ead5036e4d6664aa381 (diff) | |
download | webtools.dali-8d7d4d9efa1777c368a4b809d49bc15cfca1808b.tar.gz webtools.dali-8d7d4d9efa1777c368a4b809d49bc15cfca1808b.tar.xz webtools.dali-8d7d4d9efa1777c368a4b809d49bc15cfca1808b.zip |
Resolved merge conflicts between Head and jpt_2_0_exp.
Diffstat (limited to 'jpa')
17 files changed, 47 insertions, 794 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmResource.java deleted file mode 100644 index 85e0f02b0a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmResource.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.content.orm; - -import org.eclipse.core.resources.IFile; -import org.eclipse.wst.common.internal.emf.resource.TranslatorResource; - - -public interface OrmResource extends TranslatorResource -{ - /** - * Return the root object - */ - EntityMappingsInternal getEntityMappings(); - - /** - * Return the platform file associated with this resource - */ - IFile getFile(); -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmArtifactEdit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmArtifactEdit.java deleted file mode 100644 index c41fdcec5a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmArtifactEdit.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.eclipse.jpt.core.internal.content.orm.resource; - -import java.io.IOException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.content.orm.OrmResource; -import org.eclipse.wst.common.componentcore.ArtifactEdit; - -public class OrmArtifactEdit extends ArtifactEdit -{ - /** - * @param aProject - * @return an orm artifact for the project aProject. - * Opened only for read access (no write) - */ - public static OrmArtifactEdit getArtifactEditForRead(IProject aProject) { - OrmArtifactEdit artifactEdit = null; - try { - artifactEdit = new OrmArtifactEdit(aProject, true); - } - catch (IllegalArgumentException iae) { - // suppress illegal argument exception - JptCorePlugin.log(iae); - } - return artifactEdit; - } - - /** - * @param aProject - * @return an orm artifact for the project aProject. - * Opened for both write and read access - */ - public static OrmArtifactEdit getArtifactEditForWrite(IProject aProject) { - OrmArtifactEdit artifactEdit = null; - try { - artifactEdit = new OrmArtifactEdit(aProject, false); - } - catch (IllegalArgumentException iae) { - // suppress illegal argument exception - JptCorePlugin.log(iae); - } - return artifactEdit; - } - - - public OrmArtifactEdit(IProject aProject, boolean toAccessAsReadOnly) - throws IllegalArgumentException { - super(aProject, toAccessAsReadOnly); - } - - - /** - * @return an orm resource for the given file - */ - public OrmResource getOrmResource(IFile file) { - // This *seems* to do the same basic thing as below, but circumvents the - // URI munging that ArtifactEditModel does (see bug 209093) - try { - OrmResource resource = - (OrmResource) getArtifactEditModel().createResource(URI.createPlatformResourceURI(file.getFullPath().toString())); - if (! resource.isLoaded()) { - resource.load(getArtifactEditModel().getResourceSet().getLoadOptions()); - } - return resource; - } - catch (ClassCastException cce) { - return null; - } - catch (IOException ioe) { - JptCorePlugin.log(ioe); - return null; - } - } - - /** - * @param fileURI - this must be in a deployment relevant form - * (e.g "META-INF/orm.xml" instead of "src/META-INF/orm.xml") - * @return an orm resource for the given deployment file URI - */ - public OrmResource getOrmResource(String fileURI) { - try { - return (OrmResource) getArtifactEditModel().getResource(URI.createURI(fileURI)); - } - catch (ClassCastException cce) { - return null; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmResourceFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmResourceFactory.java deleted file mode 100644 index 3cde563841..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmResourceFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.jpt.core.internal.content.orm.resource; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.wst.common.internal.emf.resource.Renderer; -import org.eclipse.wst.common.internal.emf.resource.RendererFactory; -import org.eclipse.wst.common.internal.emf.resource.TranslatorResource; -import org.eclipse.wst.common.internal.emf.resource.TranslatorResourceFactory; - -public class OrmResourceFactory extends TranslatorResourceFactory -{ - public OrmResourceFactory() { - this(RendererFactory.getDefaultRendererFactory()); - } - - public OrmResourceFactory(RendererFactory aRendererFactory, boolean listeningForUpdates) { - super(aRendererFactory, listeningForUpdates); - } - - public OrmResourceFactory(RendererFactory aRendererFactory) { - super(aRendererFactory); - } - - - /** - * @see TranslatorResourceFactory#createResource(URI, Renderer) - */ - protected TranslatorResource createResource(URI uri, Renderer renderer) { - return new OrmResourceImpl(uri, renderer); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmResourceImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmResourceImpl.java deleted file mode 100644 index 3e84f7c62f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmResourceImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.content.orm.resource; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.URIConverter; -import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase; -import org.eclipse.jem.util.plugin.JEMUtilPlugin; -import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal; -import org.eclipse.jpt.core.internal.content.orm.OrmResource; -import org.eclipse.wst.common.internal.emf.resource.Renderer; -import org.eclipse.wst.common.internal.emf.resource.Translator; -import org.eclipse.wst.common.internal.emf.resource.TranslatorResource; -import org.eclipse.wst.common.internal.emf.resource.TranslatorResourceImpl; - -public class OrmResourceImpl extends TranslatorResourceImpl - implements OrmResource -{ - private Translator rootTranslator; - - public OrmResourceImpl(Renderer aRenderer) { - super(aRenderer); - } - - public OrmResourceImpl(URI uri, Renderer aRenderer) { - super(uri, aRenderer); - } - - /** - * @see TranslatorResourceImpl#getDefaultPublicId() - */ - protected String getDefaultPublicId() { - return null; - // only applicable for DTD-based files - } - - /** - * @see TranslatorResourceImpl#getDefaultSystemId() - */ - protected String getDefaultSystemId() { - return null; - // only applicable for DTD-based files - } - - /** - * @see TranslatorResourceImpl#getDefaultVersionId() - */ - protected int getDefaultVersionID() { - return 10; - // this seems to be the default version of the spec for this doc - // and the id 10 maps to the version 1.0 - } - - /** - * @see TranslatorResource#getDoctype() - */ - public String getDoctype() { - return null; - // only applicable for DTD-based files - } - - /** - * @see TranslatorResource#getRootTranslator() - */ - public Translator getRootTranslator() { - if (this.rootTranslator == null) { - this.rootTranslator = buildRootTranslator(); - } - return this.rootTranslator; - } - - protected Translator buildRootTranslator() { - return new EntityMappingsTranslator(); - } - - /** - * @see OrmResource#getEntityMappings() - */ - public EntityMappingsInternal getEntityMappings() { - return (EntityMappingsInternal) getRootObject(); - } - - public IFile getFile() { - IFile file = null; - file = getFile(getURI()); - if (file == null) { - if (getResourceSet() != null) { - URIConverter converter = getResourceSet().getURIConverter(); - URI convertedUri = converter.normalize(getURI()); - if (! getURI().equals(convertedUri)) { - file = getFile(convertedUri); - } - } - } - return file; - } - - /** - * Return the IFile for the <code>uri</code> within the Workspace. This URI is assumed to be - * absolute in the following format: platform:/resource/.... - */ - private IFile getFile(URI uri) { - if (WorkbenchResourceHelperBase.isPlatformResourceURI(uri)) { - String fileString = URI.decode(uri.path()); - fileString = fileString.substring(JEMUtilPlugin.PLATFORM_RESOURCE.length() + 1); - return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileString)); - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceArtifactEdit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceArtifactEdit.java deleted file mode 100644 index 38140cb550..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceArtifactEdit.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.jpt.core.internal.content.persistence.resource; - -import java.io.IOException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.wst.common.componentcore.ArtifactEdit; - -public class PersistenceArtifactEdit extends ArtifactEdit -{ - /** - * @param aProject - * @return a persistence artifact for project aProject. - * Opened only for read access (no write) - */ - public static PersistenceArtifactEdit getArtifactEditForRead(IProject aProject) { - PersistenceArtifactEdit artifactEdit = null; - try { - artifactEdit = new PersistenceArtifactEdit(aProject, true); - } - catch (IllegalArgumentException iae) { - // suppress illegal argument exception - JptCorePlugin.log(iae); - } - return artifactEdit; - } - - /** - * @param aProject - * @return a persistence artifact for the project aProject. - * Opened for both write and read access - */ - public static PersistenceArtifactEdit getArtifactEditForWrite(IProject aProject) { - PersistenceArtifactEdit artifactEdit = null; - try { - artifactEdit = new PersistenceArtifactEdit(aProject, false); - } - catch (IllegalArgumentException iae) { - // suppress illegal argument exception - JptCorePlugin.log(iae); - } - return artifactEdit; - } - - - public PersistenceArtifactEdit(IProject aProject, boolean toAccessAsReadOnly) - throws IllegalArgumentException { - super(aProject, toAccessAsReadOnly); - } - - - /** - * @return a persistence resource for the given file - */ - public PersistenceResource getPersistenceResource(IFile file) { - // This *seems* to do the same basic thing as below, but circumvents the - // URI munging that ArtifactEditModel does (see bug 209093) - try { - PersistenceResource resource = - (PersistenceResource) getArtifactEditModel().createResource(URI.createPlatformResourceURI(file.getFullPath().toString())); - if (! resource.isLoaded()) { - resource.load(getArtifactEditModel().getResourceSet().getLoadOptions()); - } - return resource; - } - catch (ClassCastException cce) { - return null; - } - catch (IOException ioe) { - JptCorePlugin.log(ioe); - return null; - } - } - - /** - * @param fileURI - this must be in a deployment relevant form - * (e.g "META-INF/persistence.xml" instead of "src/META-INF/persistence.xml") - * @return a persistence resource for the given deployment file URI - */ - public PersistenceResource getPersistenceResource(String fileURI) { - try { - return (PersistenceResource) getArtifactEditModel().getResource(URI.createURI(fileURI)); - } - catch (ClassCastException cce) { - return null; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceResourceFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceResourceFactory.java deleted file mode 100644 index d999172406..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceResourceFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.content.persistence.resource; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.wst.common.internal.emf.resource.Renderer; -import org.eclipse.wst.common.internal.emf.resource.RendererFactory; -import org.eclipse.wst.common.internal.emf.resource.TranslatorResource; -import org.eclipse.wst.common.internal.emf.resource.TranslatorResourceFactory; - -public class PersistenceResourceFactory extends TranslatorResourceFactory -{ - public PersistenceResourceFactory() { - this(RendererFactory.getDefaultRendererFactory()); - } - - public PersistenceResourceFactory(RendererFactory aRendererFactory, boolean listeningForUpdates) { - super(aRendererFactory, listeningForUpdates); - } - - public PersistenceResourceFactory(RendererFactory aRendererFactory) { - super(aRendererFactory); - } - - - /** - * @see TranslatorResourceFactory#createResource(URI, Renderer) - */ - protected TranslatorResource createResource(URI uri, Renderer renderer) { - return new PersistenceResource(uri, renderer); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/DefaultsContextWrapper.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/DefaultsContextWrapper.java deleted file mode 100644 index c38867fa16..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/DefaultsContextWrapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.jpt.core.internal.platform; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.IPersistentType; - -public class DefaultsContextWrapper implements DefaultsContext -{ - private DefaultsContext wrappedDefaultsContext; - - public DefaultsContextWrapper(DefaultsContext wrappedDefaultsContext) { - this.wrappedDefaultsContext = wrappedDefaultsContext; - } - public CompilationUnit astRoot() { - return this.wrappedDefaultsContext.astRoot(); - } - - public Object getDefault(String key) { - return this.wrappedDefaultsContext.getDefault(key); - } - - public IPersistentType persistentType(String fullyQualifiedTypeName) { - return this.wrappedDefaultsContext.persistentType(fullyQualifiedTypeName); - } - - protected DefaultsContext getWrappedDefaultsContext() { - return this.wrappedDefaultsContext; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlJoinColumnContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlJoinColumnContext.java deleted file mode 100644 index 34c32c6ffe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlJoinColumnContext.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.internal.platform; - -import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping; -import org.eclipse.jpt.core.internal.mappings.IJoinColumn; - -public class XmlJoinColumnContext extends JoinColumnContext -{ - public XmlJoinColumnContext(ParentContext parentContext, IJoinColumn column) { - super(parentContext, column); - } - - @Override - public ParentContext getParentContext() { - return (ParentContext) super.getParentContext(); - } - - protected String buildDefaultName() { - if (getColumn().isVirtual()) { - if (!((XmlTypeMapping) getColumn().getOwner().getTypeMapping()).isXmlMetadataComplete()) { - IJoinColumn javaJoinColumn = javaJoinColumn(getColumn().getOwner().indexOf(getColumn())); - if (javaJoinColumn != null) { - return javaJoinColumn.getName(); - } - } - } - return super.buildDefaultName(); - } - - @Override - protected String buildDefaultReferencedColumnName() { - if (getColumn().isVirtual()) { - if (!((XmlTypeMapping) getColumn().getOwner().getTypeMapping()).isXmlMetadataComplete()) { - IJoinColumn javaJoinColumn = javaJoinColumn(getColumn().getOwner().indexOf(getColumn())); - if (javaJoinColumn != null) { - return javaJoinColumn.getReferencedColumnName(); - } - } - } - return super.buildDefaultReferencedColumnName(); - } - - - public interface ParentContext extends IContext { - /** - * Return the JavaJoinColumn that corresponds to the the joinColumn - * at the given index. Return null if it does not exist - */ - IJoinColumn javaJoinColumn(int index); - } - - private IJoinColumn javaJoinColumn(int index) { - return getParentContext().javaJoinColumn(index); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlJoinTableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlJoinTableContext.java deleted file mode 100644 index 0b5d570430..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlJoinTableContext.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.internal.platform; - -import java.util.List; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jpt.core.internal.IJpaPlatform; -import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal; -import org.eclipse.jpt.core.internal.mappings.IJoinColumn; -import org.eclipse.jpt.core.internal.mappings.IJoinTable; -import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class XmlJoinTableContext extends JoinTableContext { - - public XmlJoinTableContext(ParentContext parentContext, IJoinTable table) { - super(parentContext, table); - } - - protected JoinColumnContext buildJoinColumnContext(IJoinColumn joinColumn) { - return new XmlJoinColumnContext(buildJoinColumnParentContext(), joinColumn); - } - - protected JoinColumnContext buildInverseJoinColumnContext(IJoinColumn joinColumn) { - return new XmlJoinColumnContext(buildInverseJoinColumnParentContext(), joinColumn); - } - - protected XmlJoinColumnContext.ParentContext buildJoinColumnParentContext() { - return new XmlJoinColumnContext.ParentContext() { - public void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor) { - XmlJoinTableContext.this.refreshDefaults(defaults, monitor); - } - - public IJpaPlatform getPlatform() { - return XmlJoinTableContext.this.getPlatform(); - } - - public IContext getParentContext() { - return XmlJoinTableContext.this.getParentContext(); - } - - public void addToMessages(List<IMessage> messages) { - XmlJoinTableContext.this.addToMessages(messages); - } - - public IJoinColumn javaJoinColumn(int index) { - //if the mapping is specified in the xml, then nothing specified in java should be used - if (relationshipMapping().isVirtual()) { - return javaRelationshipMapping().getJoinTable().getJoinColumns().get(index); - } - return null; - } - }; - } - - protected XmlJoinColumnContext.ParentContext buildInverseJoinColumnParentContext() { - return new XmlJoinColumnContext.ParentContext() { - public void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor) { - XmlJoinTableContext.this.refreshDefaults(defaults, monitor); - } - - public IJpaPlatform getPlatform() { - return XmlJoinTableContext.this.getPlatform(); - } - - public IContext getParentContext() { - return XmlJoinTableContext.this.getParentContext(); - } - - public void addToMessages(List<IMessage> messages) { - XmlJoinTableContext.this.addToMessages(messages); - } - - public IJoinColumn javaJoinColumn(int index) { - //if the mapping is specified in the xml, then nothing specified in java should be used - if (relationshipMapping().isVirtual()) { - return javaRelationshipMapping().getJoinTable().getInverseJoinColumns().get(index); - } - return null; - } - }; - } - - protected String joinTableDefaultName(DefaultsContext defaultsContext) { - XmlMultiRelationshipMappingInternal xmlMultiRelationshipMapping = relationshipMapping(); - if (xmlMultiRelationshipMapping.isVirtual()) { - if (!xmlMultiRelationshipMapping.typeMapping().isXmlMetadataComplete()) { - IMultiRelationshipMapping javaRelationshipMapping = javaRelationshipMapping(); - if (javaRelationshipMapping != null) { - return javaRelationshipMapping.getJoinTable().getName(); - } - } - } - return super.joinTableDefaultName(defaultsContext); - } - - @Override - protected XmlMultiRelationshipMappingInternal relationshipMapping() { - return (XmlMultiRelationshipMappingInternal) super.relationshipMapping(); - } - - private IMultiRelationshipMapping javaRelationshipMapping() { - return getParentContext().javaRelationshipMapping(); - } - - @Override - public ParentContext getParentContext() { - return (ParentContext) super.getParentContext(); - } - - public interface ParentContext extends IContext { - /** - * Return the JavaAttributeOverride that corresponds to the xml attribute override - * with the given name. Return null if it does not exist - */ - IMultiRelationshipMapping javaRelationshipMapping(); - } - - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlPrimaryKeyJoinColumnContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlPrimaryKeyJoinColumnContext.java deleted file mode 100644 index b8a8f669cf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlPrimaryKeyJoinColumnContext.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.internal.platform; - -import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping; -import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn; - -public class XmlPrimaryKeyJoinColumnContext extends PrimaryKeyJoinColumnContext -{ - public XmlPrimaryKeyJoinColumnContext(ParentContext parentContext, IPrimaryKeyJoinColumn column) { - super(parentContext, column); - } - - @Override - public ParentContext getParentContext() { - return (ParentContext) super.getParentContext(); - } - - protected String buildDefaultName() { - if (getColumn().isVirtual()) { - if (!((XmlTypeMapping) getColumn().getOwner().getTypeMapping()).isXmlMetadataComplete()) { - IPrimaryKeyJoinColumn javaJoinColumn = javaPrimaryKeyJoinColumn(getColumn().getOwner().indexOf(getColumn())); - if (javaJoinColumn != null) { - return javaJoinColumn.getName(); - } - } - } - return super.buildDefaultName(); - } - - @Override - protected String buildDefaultReferencedColumnName() { - if (getColumn().isVirtual()) { - if (!((XmlTypeMapping) getColumn().getOwner().getTypeMapping()).isXmlMetadataComplete()) { - IPrimaryKeyJoinColumn javaJoinColumn = javaPrimaryKeyJoinColumn(getColumn().getOwner().indexOf(getColumn())); - if (javaJoinColumn != null) { - return javaJoinColumn.getReferencedColumnName(); - } - } - } - return super.buildDefaultReferencedColumnName(); - } - - - public interface ParentContext extends IContext { - /** - * Return the JavaJoinColumn that corresponds to the the joinColumn - * at the given index. Return null if it does not exist - */ - IPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn(int index); - } - - private IPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn(int index) { - return getParentContext().javaPrimaryKeyJoinColumn(index); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSecondaryTableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSecondaryTableContext.java deleted file mode 100644 index d3d0efd265..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSecondaryTableContext.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.core.internal.platform; - -import java.util.List; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jpt.core.internal.IJpaPlatform; -import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.mappings.ISecondaryTable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class XmlSecondaryTableContext extends SecondaryTableContext -{ - public XmlSecondaryTableContext(ParentContext parentContext, ISecondaryTable secondaryTable) { - super(parentContext, secondaryTable); - } - - @Override - protected PrimaryKeyJoinColumnContext buildPrimaryKeyJoinColumnContext(IPrimaryKeyJoinColumn pkJoinColumn) { - return new XmlPrimaryKeyJoinColumnContext(buildJoinColumnParentContext(), pkJoinColumn); - } - - protected XmlPrimaryKeyJoinColumnContext.ParentContext buildJoinColumnParentContext() { - return new XmlPrimaryKeyJoinColumnContext.ParentContext() { - public void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor) { - XmlSecondaryTableContext.this.refreshDefaults(defaults, monitor); - } - - public IJpaPlatform getPlatform() { - return XmlSecondaryTableContext.this.getPlatform(); - } - - public IContext getParentContext() { - return XmlSecondaryTableContext.this.getParentContext(); - } - - public void addToMessages(List<IMessage> messages) { - XmlSecondaryTableContext.this.addToMessages(messages); - } - - public IPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn(int index) { - if (getSecondaryTable().isVirtual()) { - return javaSecondaryTable(index).getSpecifiedPrimaryKeyJoinColumns().get(index); - } - return null; - } - }; - } - - @Override - public ParentContext getParentContext() { - return (ParentContext) super.getParentContext(); - } - - private ISecondaryTable javaSecondaryTable(int index) { - return getParentContext().javaSecondaryTable(index); - } - - public interface ParentContext extends IContext { - /** - * Return the JavaSecondaryTable at the given index. Return null if it does not exist - */ - ISecondaryTable javaSecondaryTable(int index); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java index 7a93a8f5c4..6a161341dc 100644 --- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java +++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java @@ -113,14 +113,12 @@ public abstract class ConnectionProfile extends DTPWrapper implements Comparable public abstract String getUserName(); public abstract String getUserPassword(); - + /** * protected, use defaultSchema() : Schema instead */ protected abstract String getDefaultSchemaName(); - public abstract String getDefaultSchema(); - public abstract String getInstanceId(); public abstract String getProviderId(); diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java index d7337660a8..637290d231 100644 --- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java +++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java @@ -271,7 +271,7 @@ public final class DTPConnectionProfileWrapper extends ConnectionProfile { } @Override - protected String getDefaultSchemaName() { + public String getDefaultSchemaName() { if( this.getDatabase().getVendor().equalsIgnoreCase( POSTGRESQL_VENDOR)) { return PUBLIC_SCHEMA; } diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedPropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedPropertyValueModel.java index 17cc1bb2aa..b918cd931c 100644 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedPropertyValueModel.java +++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedPropertyValueModel.java @@ -39,6 +39,7 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener; */ public class BufferedPropertyValueModel extends PropertyValueModelWrapper + implements WritablePropertyValueModel { /** @@ -152,6 +153,10 @@ public class BufferedPropertyValueModel // ********** behavior ********** + protected WritablePropertyValueModel valueHolder() { + return (WritablePropertyValueModel) this.valueHolder; + } + /** * If we do not yet have a "buffered" value, simply propagate the * change notification with the buffered model as the source. @@ -200,7 +205,7 @@ public class BufferedPropertyValueModel // set the accepting flag so we ignore any events // fired by the wrapped value holder this.accepting = true; - this.valueHolder.setValue(this.bufferedValue); + this.valueHolder().setValue(this.bufferedValue); this.bufferedValue = UNASSIGNED; // clear the flag once the "accept" is complete this.accepting = false; diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectPropertyValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectPropertyValueModelAdapter.java index c87224a182..91932211fa 100644 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectPropertyValueModelAdapter.java +++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectPropertyValueModelAdapter.java @@ -30,6 +30,7 @@ import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent; */ public abstract class ValueAspectPropertyValueModelAdapter extends PropertyValueModelWrapper + implements WritablePropertyValueModel { /** Cache the value so we can disengage. */ protected Object value; @@ -64,7 +65,7 @@ public abstract class ValueAspectPropertyValueModelAdapter // ********** PropertyValueModel implementation ********** public void setValue(Object value) { - this.valueHolder.setValue(value); + this.valueHolder().setValue(value); } @@ -80,6 +81,10 @@ public abstract class ValueAspectPropertyValueModelAdapter // ********** behavior ********** + protected WritablePropertyValueModel valueHolder() { + return (WritablePropertyValueModel) this.valueHolder; + } + /** * Start listening to the value holder and the value. */ diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java index c23fcfa94b..5196fec18e 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java @@ -295,17 +295,4 @@ public class FilteringIteratorTests extends TestCase { assertTrue("NoSuchElementException not thrown", exCaught); } - public void testInvalidFilteringIterator() { - boolean exCaught = false; - try { - // missing method override - Iterator<String> iterator = new FilteringIterator<String>(this.buildNestedIterator()); - String s = iterator.next(); - fail("invalid string: " + s); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedPropertyValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedPropertyValueModelTests.java index d3c76e81a5..797175e775 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedPropertyValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedPropertyValueModelTests.java @@ -11,32 +11,34 @@ package org.eclipse.jpt.utility.tests.internal.model.value; import java.util.Date; +import junit.framework.TestCase; + import org.eclipse.jpt.utility.internal.model.AbstractModel; import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent; import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener; -import org.eclipse.jpt.utility.internal.model.value.BufferedPropertyValueModel; +import org.eclipse.jpt.utility.internal.model.value.BufferedWritablePropertyValueModel; import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel; import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.utility.internal.model.value.ValueModel; -import org.eclipse.jpt.utility.tests.internal.TestTools; +import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel; -import junit.framework.TestCase; +import org.eclipse.jpt.utility.tests.internal.TestTools; public class BufferedPropertyValueModelTests extends TestCase { private Employee employee; - private PropertyValueModel employeeHolder; + private WritablePropertyValueModel<Employee> employeeHolder; PropertyChangeEvent employeeEvent; - private PropertyValueModel idAdapter; - private PropertyValueModel nameAdapter; - private PropertyValueModel hireDateAdapter; + private WritablePropertyValueModel<Integer> idAdapter; + private WritablePropertyValueModel<String> nameAdapter; + private WritablePropertyValueModel<Date> hireDateAdapter; PropertyChangeEvent adapterEvent; - private BufferedPropertyValueModel.Trigger trigger; - private PropertyValueModel bufferedIDHolder; - private PropertyValueModel bufferedNameHolder; - private PropertyValueModel bufferedHireDateHolder; + private BufferedWritablePropertyValueModel.Trigger trigger; + private WritablePropertyValueModel<Integer> bufferedIDHolder; + private WritablePropertyValueModel<String> bufferedNameHolder; + private WritablePropertyValueModel<Date> bufferedHireDateHolder; PropertyChangeEvent bufferedEvent; public BufferedPropertyValueModelTests(String name) { @@ -48,55 +50,55 @@ public class BufferedPropertyValueModelTests extends TestCase { super.setUp(); this.employee = new Employee(17, "Freddy", new Date()); - this.employeeHolder = new SimplePropertyValueModel(this.employee); + this.employeeHolder = new SimplePropertyValueModel<Employee>(this.employee); - this.trigger = new BufferedPropertyValueModel.Trigger(); + this.trigger = new BufferedWritablePropertyValueModel.Trigger(); this.idAdapter = this.buildIDAdapter(this.employeeHolder); - this.bufferedIDHolder = new BufferedPropertyValueModel(this.idAdapter, this.trigger); + this.bufferedIDHolder = new BufferedWritablePropertyValueModel<Integer>(this.idAdapter, this.trigger); this.nameAdapter = this.buildNameAdapter(this.employeeHolder); - this.bufferedNameHolder = new BufferedPropertyValueModel(this.nameAdapter, this.trigger); + this.bufferedNameHolder = new BufferedWritablePropertyValueModel<String>(this.nameAdapter, this.trigger); this.hireDateAdapter = this.buildHireDateAdapter(this.employeeHolder); - this.bufferedHireDateHolder = new BufferedPropertyValueModel(this.hireDateAdapter, this.trigger); + this.bufferedHireDateHolder = new BufferedWritablePropertyValueModel<Date>(this.hireDateAdapter, this.trigger); } - private PropertyValueModel buildIDAdapter(ValueModel eHolder) { - return new PropertyAspectAdapter(eHolder, Employee.ID_PROPERTY) { + private WritablePropertyValueModel<Integer> buildIDAdapter(PropertyValueModel<Employee> eHolder) { + return new PropertyAspectAdapter<Employee, Integer>(eHolder, Employee.ID_PROPERTY) { @Override - protected Object buildValue_() { + protected Integer buildValue_() { return new Integer(((Employee) this.subject).getID()); } @Override - protected void setValue_(Object value) { - ((Employee) this.subject).setID(((Integer) value).intValue()); + protected void setValue_(Integer value) { + ((Employee) this.subject).setID(value.intValue()); } }; } - private PropertyValueModel buildNameAdapter(ValueModel eHolder) { - return new PropertyAspectAdapter(eHolder, Employee.NAME_PROPERTY) { + private WritablePropertyValueModel<String> buildNameAdapter(PropertyValueModel<Employee> eHolder) { + return new PropertyAspectAdapter<Employee, String>(eHolder, Employee.NAME_PROPERTY) { @Override - protected Object buildValue_() { + protected String buildValue_() { return ((Employee) this.subject).getName(); } @Override - protected void setValue_(Object value) { - ((Employee) this.subject).setName((String) value); + protected void setValue_(String value) { + ((Employee) this.subject).setName(value); } }; } - private PropertyValueModel buildHireDateAdapter(ValueModel eHolder) { - return new PropertyAspectAdapter(eHolder, Employee.HIRE_DATE_PROPERTY) { + private WritablePropertyValueModel<Date> buildHireDateAdapter(PropertyValueModel<Employee> eHolder) { + return new PropertyAspectAdapter<Employee, Date>(eHolder, Employee.HIRE_DATE_PROPERTY) { @Override - protected Object buildValue_() { + protected Date buildValue_() { return ((Employee) this.subject).getHireDate(); } @Override - protected void setValue_(Object value) { - ((Employee) this.subject).setHireDate((Date) value); + protected void setValue_(Date value) { + ((Employee) this.subject).setHireDate(value); } }; } |