blob: 9b4f62447b9bf2156088cccd5394e24238ec9108 (
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
|
/*******************************************************************************
* Copyright (c) 2010, 2011 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.jpa.core.internal.platform;
import org.eclipse.jpt.common.core.internal.utility.XPointTools;
import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
public class JpaPlatformDescriptionImpl
implements JpaPlatformDescription {
private String id;
private String pluginId;
private String label;
private String factoryClassName;
private IProjectFacetVersion jpaFacetVersion;
private boolean default_ = false;
private JpaPlatformGroupDescriptionImpl group;
public String getId() {
return this.id;
}
void setId(String id) {
this.id = id;
}
public String getPluginId() {
return this.pluginId;
}
void setPluginId(String pluginId) {
this.pluginId = pluginId;
}
public String getLabel() {
return this.label;
}
void setLabel(String label) {
this.label = label;
}
public String getFactoryClassName() {
return this.factoryClassName;
}
void setFactoryClassName(String className) {
this.factoryClassName = className;
}
public IProjectFacetVersion getJpaFacetVersion() {
return this.jpaFacetVersion;
}
void setJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
throw new IllegalArgumentException(jpaFacetVersion.toString());
}
this.jpaFacetVersion = jpaFacetVersion;
}
public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
throw new IllegalArgumentException(jpaFacetVersion.toString());
}
return (this.jpaFacetVersion != null) ? this.jpaFacetVersion.equals(jpaFacetVersion) : true;
}
public boolean isDefault() {
return this.default_;
}
void setDefault(boolean default_) {
this.default_ = default_;
}
public JpaPlatformGroupDescription getGroup() {
return this.group;
}
void setGroup(JpaPlatformGroupDescriptionImpl group) {
this.group = group;
}
public JpaPlatform buildJpaPlatform() {
JpaPlatformFactory factory = (JpaPlatformFactory) XPointTools.instantiate(
this.pluginId, JpaPlatformManagerImpl.QUALIFIED_EXTENSION_POINT_ID,
this.factoryClassName, JpaPlatformFactory.class);
return factory.buildJpaPlatform(getId());
}
@Override
public String toString() {
return this.label;
}
}
|