Skip to main content
summaryrefslogtreecommitdiffstats
blob: bd55860c25efadc8fa4cbb0c72c99c22543ed748 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************************************
 * 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;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jpt.core.internal.platform.base.BaseJpaFactory;

/**
 * Use IJpaFactory to create any core (e.g. IJpaProject), resource 
 * (e.g. PersistenceResource), or context (e.g. IAttributeMapping) model objects.  
 * @see BaseJpaFactory
 */
public interface IJpaFactory 
{
	/**
	 * Construct an IJpaProject for the specified config, to be
	 * added to the specified JPA project. Return null if unable to create
	 * the JPA file (e.g. the content type is unrecognized).
	 */
	IJpaProject createJpaProject(IJpaProject.Config config) throws CoreException;
	
	IJpaDataSource createJpaDataSource(IJpaProject jpaProject, String connectionProfileName);
	
	/**
	 * Construct a JPA file for the specified file and with the specified resource
	 * model, to be added to the specified JPA project.
	 * This should be non-null iff (if and only if) {@link #hasRelevantContent(IFile)}
	 * returns true.
	 */
	IJpaFile createJpaFile(IJpaProject jpaProject, IFile file, IResourceModel resourceModel);
	
	/**
	 * Return true if a resource model will be provided for the given file
	 */
	boolean hasRelevantContent(IFile file);
	
	/**
	 * Build a resource model to be associated with the given file.
	 * This should be non-null iff (if and only if) {@link #hasRelevantContent(IFile)}
	 * returns true. 
	 */
	IResourceModel buildResourceModel(IJpaProject jpaProject, IFile file);
	
	/**
	 * Build a (updated) context model to be associated with the given JPA project.
	 * The context model will be built once, but updated many times.
	 * @see update(IJpaProject, IContextModel, IProgressMonitor)
	 */
	IContextModel buildContextModel(IJpaProject jpaProject);
}

Back to the top