Skip to main content
summaryrefslogtreecommitdiffstats
blob: 25d4cf0e8e27ac5c124605d95c3e29227bf0b89d (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*******************************************************************************
 * 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;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
import org.eclipse.jpt.core.internal.platform.IContext;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;

/**
 * This interface is to be implemented by a JPA vendor to provide extensions to 
 * the core JPA model.  The core JPA model will provide functinality for JPA
 * spec annotations in java and the orm.xml mapping file.  
 * The org.eclipse.jpt.core.genericPlatform extension supplies 
 * IJpaFileContentProvider for those file types.  As another vendor option you 
 * will have to supply those IJpaFileContentProviders as well or different ones 
 * as necessary.
 * 
 * See the org.eclipse.jpt.core.jpaPlatform extension point
 */
public interface IJpaPlatform
{
	/**
	 * Get the ID for this platform
	 */
	String getId();

	/**
	 * Set the ID for this platform
	 * 
	 * *************
	 * * IMPORTANT *  For INTERNAL use only!!
	 * *************
	 */
	void setId(String theId);

	/**
	 * Get the IJpaProject for this platform
	 */
	IJpaProject getProject();

	/**
	 * Set the IJpaProject on this platform
	 */
	void setProject(IJpaProject jpaProject);

	// ********** Persistence Unit ********************************************
	boolean containsPersistenceUnitNamed(String name);

	PersistenceUnit persistenceUnitNamed(String name);

	Iterator<PersistenceUnit> persistenceUnits();

	int persistenceUnitSize();

	// ********** Persistent Types ********************************************
	/**
	 * Return all persistent types for the persistence unit with the given name
	 */
	Iterator<IPersistentType> persistentTypes(String persistenceUnitName);

	// ************************************************************************
	/**
	 * Get the valid persistence XML files from the project
	 */
	Iterator<IJpaFile> validPersistenceXmlFiles();

	/**
	 * Return a collection of IJpaFileContentProviders.  These will be used to 
	 * determine which files will be read from an IProject based on contentType.
	 * These contentProviders should have unique contentTypes. 
	 * @return
	 */
	Collection<IJpaFileContentProvider> jpaFileContentProviders();

	/**
	 * Build a project context to be used when resynching the intra-model
	 * references and creating validation problems.
	 * The JPA model containment hierarchy is inappropriate to use as a context 
	 * for defaults because it is based on the IJpaProject containing files.  
	 * The defaults context for the jpa model is based on the persistence.xml 
	 * and the mapping files and classes it contains.
	 * 
	 * @see refreshDefaults(Object)
	 * @return
	 */
	IContext buildProjectContext();

	/**
	 * Build a type context to be used when resynching the intra-model
	 * references and creating validation problems.
	 * The JPA model containment hierarchy is inappropriate to use as a context 
	 * for defaults because it is based on the IJpaProject containing files.  
	 * The defaults context for the jpa model is based on the persistence.xml 
	 * and the mapping files and classes it contains.
	 * 
	 * @see refreshDefaults(Object)
	 * @return
	 */
	IContext buildJavaTypeContext(IContext parentContext, IJavaTypeMapping typeMapping);

	/**
	 * Build an attribute context to be used when resynching the intra-model
	 * references and creating validation problems.
	 * The JPA model containment hierarchy is inappropriate to use as a context 
	 * for defaults because it is based on the IJpaProject containing files.  
	 * The defaults context for the jpa model is based on the persistence.xml 
	 * and the mapping files and classes it contains.
	 * 
	 * @see refreshDefaults(Object)
	 * @return
	 */
	IContext buildJavaAttributeContext(IContext parentContext, IJavaAttributeMapping attributeMapping);

	/**
	 * Resynchronize intra-model connections given the context hierarchy the 
	 * IJpaPlatform built in buildContextHierarchy().
	 * This will be called each time an update to the jpa model occurs.  If an 
	 * update occurs while the resynch() job is in process, another resynch() 
	 * will be started upon completion.
	 * @param contextHierarchy
	 */
	void resynch(IContext contextHierarchy, IProgressMonitor monitor);

	/**
	 * Adds validation messages to the growing list of messages
	 */
	void addToMessages(List<IMessage> messages);
	/**
	 * Returns the IGeneratorRepository for the persistence unit of the
	 * given IPersistentType.  A NullGeneratorRepository should be returned
	 * if the IPersistentType is not part of a persistence unit
	 * @param persistentType
	 * @return
	 */
	//	IGeneratorRepository generatorRepository(IPersistentType persistentType);
}

Back to the top