blob: e7e48bd11f524e6d2c2c51e7936af045aeb700bd [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2013 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0, which accompanies this distribution
* and is available at https://www.eclipse.org/legal/epl-2.0/.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.extension.resource;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.GenericJpaPlatformVersion;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.persistence.jpa.jpql.parser.DefaultJPQLGrammar;
/**
* All the state in the JPA platform should be "static" (i.e. unchanging once
* it is initialized).
*/
@SuppressWarnings("nls")
public class TestJpaPlatformFactory
implements JpaPlatformFactory
{
/**
* zero-argument constructor
*/
public TestJpaPlatformFactory() {
super();
}
public JpaPlatform buildJpaPlatform(JpaPlatform.Config config) {
return new GenericJpaPlatform(
config,
buildJpaVersion(),
new TestJpaFactory(),
new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
TestJpaPlatformProvider.instance(),
buildJpaPlatformVariation(),
DefaultJPQLGrammar.instance());
}
private JpaPlatform.Version buildJpaVersion() {
return new GenericJpaPlatformVersion(JpaProject.FACET_VERSION_STRING) {
@Override
public String getVersion() {
return "BOOOYAH!";
}
};
}
protected JpaPlatformVariation buildJpaPlatformVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
return Supported.MAYBE;
}
public boolean isJoinTableOverridable() {
return false;
}
public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) {
return GENERIC_SUPPORTED_ACCESS_TYPES;
}
};
}
}