blob: f9e94839c979cc4ebcfc837996a84fb7e9ee5ae7 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2009 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.internal.context.orm;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.core.JpaFactory;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.core.context.orm.OrmTypeMappingProvider;
import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory;
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.XmlEntity;
/**
* EclipseLink ORM Entity provider
* Allow for EclipseLink extensions to Entity
*/
public class EclipseLinkOrmEntityProvider
implements OrmTypeMappingProvider
{
// singleton
private static final OrmTypeMappingProvider INSTANCE = new EclipseLinkOrmEntityProvider();
/**
* Return the singleton.
*/
public static OrmTypeMappingProvider instance() {
return INSTANCE;
}
/**
* Ensure single instance.
*/
private EclipseLinkOrmEntityProvider() {
super();
}
public IContentType getContentType() {
return JptEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
}
public XmlTypeMapping buildResourceMapping() {
return EclipseLinkOrmFactory.eINSTANCE.createXmlEntity();
}
public OrmTypeMapping buildMapping(OrmPersistentType parent, XmlTypeMapping resourceMapping, JpaFactory factory) {
return ((EclipseLinkJpaFactory) factory).buildEclipseLinkOrmEntity(parent, (XmlEntity) resourceMapping);
}
public String getKey() {
return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
}
}