Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jaxb
diff options
context:
space:
mode:
authorpfullbright2010-09-28 16:31:32 -0400
committerpfullbright2010-09-28 16:31:32 -0400
commitd735ff30d68aa292fe7a2333da50bd7198327e9d (patch)
tree93d94b224a3ad24065ddee7812c71fca30da3078 /jaxb
parent5eaa331fbbe4156ba053851288c95780f923aebd (diff)
downloadwebtools.dali-d735ff30d68aa292fe7a2333da50bd7198327e9d.tar.gz
webtools.dali-d735ff30d68aa292fe7a2333da50bd7198327e9d.tar.xz
webtools.dali-d735ff30d68aa292fe7a2333da50bd7198327e9d.zip
jaxb core initial impl
Diffstat (limited to 'jaxb')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath13
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/.project28
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties18
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties21
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml138
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd221
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java40
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java53
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java180
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java85
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java21
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java52
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java31
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/Generic_2_2_JaxbPlatformDefinitionFactory.java25
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfig.java24
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java37
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java36
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java109
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java69
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java18
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java254
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java25
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java25
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java30
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java41
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java33
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java45
30 files changed, 1716 insertions, 0 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath
new file mode 100644
index 0000000000..5ee7c76127
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="property_files"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/wst/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/jst/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore
new file mode 100644
index 0000000000..31362a7d19
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore
@@ -0,0 +1,6 @@
+bin
+@dot
+temp.folder
+build.xml
+javaCompiler...args
+javaCompiler...args.*
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.project
new file mode 100644
index 0000000000..54ea9292fc
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jpt.jaxb.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..554baf91aa
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Mon Sep 13 23:43:46 EDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..0717f4a8f0
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.jpt.jaxb.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.resources;bundle-version="[3.6.100,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.jpt.core;bundle-version="[2.4.0,3.0.0)",
+ org.eclipse.jpt.utility;bundle-version="[1.6.0,2.0.0)",
+ org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
+ org.eclipse.jst.j2ee;bundle-version="[1.1.402,2.0.0)",
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
+ org.eclipse.wst.validation;bundle-version="[1.2.200,2.0.0)",
+ org.eclipse.wst.xml.core;bundle-version="[1.1.600,2.0.0)"
+Export-Package: org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jaxb.core.internal.facet,
+ org.eclipse.jpt.jaxb.core.internal.jaxb22,
+ org.eclipse.jpt.jaxb.core.internal.platform,
+ org.eclipse.jpt.jaxb.core.platform
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties
new file mode 100644
index 0000000000..52755addc4
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2010 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
+###############################################################################
+javacSource=1.5
+javacTarget=1.5
+source.. = src/,\
+ property_files/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
new file mode 100644
index 0000000000..c1aad90eb2
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2006, 2010 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
+###############################################################################
+
+pluginName = Dali Java Persistence Tools - JAXB Core
+providerName = Eclipse Web Tools Platform
+
+JAXB_PLATFORMS = JAXB Platforms
+
+GENERIC_PLATFORM_GROUP_LABEL = Generic JAXB
+GENERIC_2_2_PLATFORM_LABEL = Generic JAXB 2.2
+
+JAXB_FACET_LABEL = JAXB
+JAXB_FACET_DESCRIPTION = Adds support for data binding using the Java Architecture for XML Binding (JAXB).
+JAXB_TEMPLATE_LABEL = JAXB Project
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
new file mode 100644
index 0000000000..4723f1681a
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2010 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
+ -->
+
+<plugin>
+
+ <!-- ***** extension points ***** -->
+
+ <extension-point
+ id="jaxbPlatforms"
+ name="%JAXB_PLATFORMS"
+ schema="schema/jaxbPlatforms.exsd"/>
+
+
+ <!-- ***** extensions ***** -->
+
+ <extension
+ point="org.eclipse.jpt.jaxb.core.jaxbPlatforms">
+
+ <jaxbPlatformGroup
+ id="generic"
+ label="%GENERIC_PLATFORM_GROUP_LABEL"/>
+
+ <jaxbPlatform
+ id="generic_2_2"
+ label="%GENERIC_2_2_PLATFORM_LABEL"
+ factoryClass="org.eclipse.jpt.jaxb.core.internal.jaxb22.Generic_2_2_JaxbPlatformDefinitionFactory"
+ group="generic"
+ jaxbFacetVersion="2.2"
+ default="false"/>
+
+ </extension>
+
+
+ <extension
+ point="org.eclipse.jst.common.project.facet.core.libraryProviders">
+
+ <provider
+ id="jaxb-no-op-library-provider"
+ extends="jpt-no-op-library-provider">
+ <enablement>
+ <with variable="requestingProjectFacet">
+ <test
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jpt.jaxb" forcePluginActivation="true"/>
+ </with>
+ </enablement>
+ </provider>
+
+ <provider
+ id="jaxb-user-library-provider"
+ extends="temp-wtp-user-library-provider">
+ <enablement>
+ <with variable="requestingProjectFacet">
+ <test property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jpt.jaxb" forcePluginActivation="true"/>
+ </with>
+ </enablement>
+ <action type="INSTALL">
+ <config class="org.eclipse.jpt.jaxb.core.internal.libprov.JaxbUserLibraryProviderInstallOperationConfig"/>
+ <operation class="org.eclipse.jpt.core.internal.libprov.TempWtpUserLibraryProviderInstallOperation"/>
+ </action>
+ </provider>
+
+ <provider
+ id="jaxb-osgi-bundles-library-provider"
+ extends="temp-wtp-osgi-bundles-library-provider"
+ abstract="true">
+ <enablement>
+ <with variable="requestingProjectFacet">
+ <test property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jpt.jaxb" forcePluginActivation="true"/>
+ </with>
+ </enablement>
+ <action type="INSTALL">
+ <config class="org.eclipse.jpt.jaxb.core.internal.libprov.JaxbOsgiBundlesLibraryProviderInstallOperationConfig"/>
+ <operation class="org.eclipse.jst.j2ee.internal.common.classpath.WtpOsgiBundlesLibraryProviderInstallOperation"/>
+ </action>
+ </provider>
+
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.runtimes">
+
+ <supported>
+ <facet id="jpt.jaxb"/>
+ <runtime-component any="true"/>
+ </supported>
+
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.facets">
+
+ <project-facet id="jpt.jaxb">
+ <label>%JAXB_FACET_LABEL</label>
+ <description>%JAXB_FACET_DESCRIPTION</description>
+ </project-facet>
+
+ <project-facet-version facet="jpt.jaxb" version="2.2">
+ <constraint>
+ <requires facet="java" version="[5.0"/>
+ </constraint>
+ </project-facet-version>
+
+ <template id="jpt.jaxb.template">
+ <label>%JAXB_TEMPLATE_LABEL</label>
+ <fixed facet="jpt.jaxb"/>
+ <fixed facet="java"/>
+ </template>
+
+ <action facet="jpt.jaxb" type="install" id="jpt.jaxb.install">
+ <config-factory class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfigFactory"/>
+ <delegate class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDelegate"/>
+ </action>
+
+ <!--
+ The uninstall action is only used to enable facet uninstallation
+ through the facet UI. The delegate currently has no functionality.
+ -->
+ <action facet="jpt.jaxb" type="uninstall" id="jpt.jaxb.uninstall">
+ <delegate class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetUninstallDelegate"/>
+ </action>
+
+ </extension>
+
+</plugin>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd b/jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd
new file mode 100644
index 0000000000..f8ca5c651d
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd
@@ -0,0 +1,221 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jpt.jaxb.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.jpt.jaxb.core" id="jaxbPlatforms" name="JAXB Platforms"/>
+ </appinfo>
+ <documentation>
+ This is used for defining JAXB platforms and JAXB platform versions.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="jaxbPlatformGroup"/>
+ <element ref="jaxbPlatform"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="jaxbPlatformGroup">
+ <annotation>
+ <documentation>
+ Declares a JAXB platform group. Acts as a sort of &quot;super&quot; platform. Most useful for enabling functionality for a set of platforms without having to enable the functionality for each platform separately.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique identifier for a JAXB platform group.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+ A translatable string representation of the JAXB platform group.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="jaxbPlatform">
+ <annotation>
+ <documentation>
+ Declares a JAXB platform. One JAXB platform will be selected per JAXB-faceted project. See &lt;samp&gt;org.eclipse.jpt.jaxb.core.JpaPlatform&lt;/samp&gt; for more information on JPA platforms. Also see the org.eclipse.jpt.ui.jpaPlatforms extension point.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+ A translatable string representation of the platform.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="factoryClass" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements &lt;samp&gt;org.eclipse.jpt.jaxb.core.JpaPlatformDefinitionFactory&lt;/samp&gt;.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jpt.jaxb.core.JpaPlatformDefinitionFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="group" type="string">
+ <annotation>
+ <documentation>
+ Declares which JAXB platform group this platform belongs to. If none is specified, this platform will be assumed to belong to its own group with the same id.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="jaxbFacetVersion" type="string">
+ <annotation>
+ <documentation>
+ Declares the JAXB facet version for which this platform may be used. If no facet version is specified, this platform is available for all JAXB facet versions.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="default" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ Declares whether this platform should be used as a default JAXB platform for new JAXB project content. Note that if a workspace contains more than one default platform for a JAXB facet version, one of them will be chosen at random. By default, a platform is not a default platform.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ JPT 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;br&gt;
+&lt;p&gt;
+The following example is the included generic JAXB 2.2 platform and its platform group
+&lt;p&gt;
+&lt;pre&gt;
+&lt;extension point=&quot;org.eclipse.jpt.jaxb.core.jaxbPlatforms&quot;&gt;
+
+ &lt;jaxbPlatformGroup
+ id=&quot;generic&quot;
+ label=&quot;%GENERIC_PLATFORM_GROUP_LABEL&quot;/&gt;
+
+ &lt;jaxbPlatform
+ id=&quot;generic_2_2&quot;
+ label=&quot;%GENERIC_2_2_PLATFORM_LABEL&quot;
+ factoryClass=&quot;org.eclipse.jpt.jaxb.core.internal.jaxb22.Generic_2_2_JaxbPlatformDefinitionFactory&quot;
+ group=&quot;generic&quot;
+ jaxbFacetVersion=&quot;2.2&quot;
+ default=&quot;false&quot;/&gt;
+
+ &lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ &lt;br&gt;
+Provisional API: This interface is part of an interim API that is still
+under development and expected to change significantly before reaching
+stability. It is available at this early stage to solicit feedback from
+pioneering adopters on the understanding that any code that uses this API
+will almost certainly be broken (repeatedly) as the API evolves.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ &lt;br&gt;
+&lt;p&gt;The org.eclipse.jpt.jaxb.core plug-in provides the following jaxb platforms:
+&lt;ul&gt;
+&lt;li&gt;generic_2_2&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/p&gt;
+&lt;p&gt;and the following jaxb platform groups:
+&lt;ul&gt;
+&lt;li&gt;generic&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2010 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
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java
new file mode 100644
index 0000000000..fff4357695
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core;
+
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription;
+
+/**
+ * Constants pertaining to the Generic JAXB platforms and their group.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public class GenericJaxbPlatform {
+
+ public static final JaxbPlatformGroupDescription GROUP
+ = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatformGroup("generic"); //$NON-NLS-1$
+
+ public static final JaxbPlatformDescription VERSION_2_2
+ = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform("generic_2_2"); //$NON-NLS-1$
+
+
+ /**
+ * Not for instantiation
+ */
+ private GenericJaxbPlatform() {}
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java
new file mode 100644
index 0000000000..36c72bcc90
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public class JaxbFacet {
+
+ public static final String ID = "jpt.jaxb"; //$NON-NLS-1$
+
+ public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID);
+
+ public static final IProjectFacetVersion VERSION_2_2 = FACET.getVersion("2.2"); //$NON-NLS-1$
+
+
+ public static boolean isInstalled(final IProject project) {
+ try {
+ return FacetedProjectFramework.hasProjectFacet(project, ID);
+ }
+ catch (CoreException e) {
+ JptJaxbCorePlugin.log(e);
+ return false;
+ }
+ }
+
+
+ /**
+ * Not for instantiation
+ */
+ private JaxbFacet() {}
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
new file mode 100644
index 0000000000..51d5444694
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.jaxb.core.internal.platform.JaxbPlatformManagerImpl;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformManager;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * The Dali JAXB core plug-in lifecycle implementation.
+ * A number of globally-available constants and methods.
+ * <p>
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public class JptJaxbCorePlugin
+ extends Plugin {
+
+ /**
+ * The plug-in identifier of Dali JAXB core
+ * (value <code>"org.eclipse.jpt.jaxb.core"</code>).
+ */
+ public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.core"; //$NON-NLS-1$
+ public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
+
+ /**
+ * The key for storing a JAXB project's platform ID in the Eclipse project's preferences.
+ */
+ private static final String JAXB_PLATFORM_PREF_KEY = PLUGIN_ID_ + "jaxbPlatform"; //$NON-NLS-1$
+
+ /**
+ * The key for storing the default JAXB platform ID for JAXB 2.2 in the workspace preferences.
+ */
+ public static final String DEFAULT_JAXB_PLATFORM_2_2_PREF_KEY =
+ "defaultJaxbPlatform_" + JaxbFacet.VERSION_2_2.getVersionString(); //$NON-NLS-1$
+
+
+ // **************** singleton *********************************************
+
+ private static JptJaxbCorePlugin INSTANCE;
+
+ /**
+ * Return the singleton plug-in
+ */
+ public static JptJaxbCorePlugin instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Set the {@link JaxbPlatformDescription} associated with the specified Eclipse project.
+ */
+ public static void setJaxbPlatform(IProject project, JaxbPlatformDescription platform) {
+ JptCorePlugin.setProjectPreference(project, JAXB_PLATFORM_PREF_KEY, platform.getId());
+ }
+
+ /**
+ * Set the default {@link JaxbPlatformDescription} for new JAXB projects with the given
+ * JAXB facet version.
+ */
+ public static void setDefaultJaxbPlatform(IProjectFacetVersion jaxbFacetVersion, JaxbPlatformDescription platform) {
+ String preferenceKey = null;
+ if (JaxbFacet.VERSION_2_2.equals(jaxbFacetVersion)) {
+ preferenceKey = DEFAULT_JAXB_PLATFORM_2_2_PREF_KEY;
+ }
+ else {
+ throw new IllegalArgumentException("Illegal JAXB facet version: " + jaxbFacetVersion); //$NON-NLS-1$
+ }
+ JptCorePlugin.setWorkspacePreference(preferenceKey, platform.getId());
+ }
+
+ /**
+ * Return the default {@link JaxbPlatformDescription} for new JAXB projects with the given
+ * JAXB facet version.
+ */
+ public static JaxbPlatformDescription getDefaultPlatform(IProjectFacetVersion jaxbFacetVersion) {
+
+ JaxbPlatformDescription defaultPlatform =
+ getDefaultPlatform(
+ jaxbFacetVersion,
+ JptCorePlugin.getWorkspacePreferences(),
+ JptCorePlugin.getDefaultPreferences());
+ if (defaultPlatform == null) {
+ // if the platform ID stored in the workspace prefs is invalid (i.e. null), look in the default prefs
+ defaultPlatform = getDefaultPlatform(jaxbFacetVersion, JptCorePlugin.getDefaultPreferences());
+ }
+ return defaultPlatform;
+ }
+
+ private static JaxbPlatformDescription getDefaultPlatform(
+ IProjectFacetVersion jaxbFacetVersion, Preferences ... nodes) {
+
+ JaxbPlatformDescription defaultDefaultPlatform;
+ String preferenceKey;
+ if (jaxbFacetVersion.equals(JaxbFacet.VERSION_2_2)) {
+ defaultDefaultPlatform = GenericJaxbPlatform.VERSION_2_2;
+ preferenceKey = DEFAULT_JAXB_PLATFORM_2_2_PREF_KEY;
+ }
+ else {
+ throw new IllegalArgumentException("Illegal JAXB facet version: " + jaxbFacetVersion); //$NON-NLS-1$
+ }
+ return getDefaultPlatform(jaxbFacetVersion, preferenceKey, defaultDefaultPlatform, nodes);
+ }
+
+ private static JaxbPlatformDescription getDefaultPlatform(
+ IProjectFacetVersion jaxbFacetVersion, String preferenceKey,
+ JaxbPlatformDescription defaultDefault, Preferences ... nodes) {
+
+ String defaultDefaultId = (defaultDefault == null) ? null : defaultDefault.getId();
+ String defaultPlatformId = Platform.getPreferencesService().get(preferenceKey, defaultDefaultId, nodes);
+ JaxbPlatformDescription defaultPlatform = getJaxbPlatformManager().getJaxbPlatform(defaultPlatformId);
+ if (defaultPlatform != null && defaultPlatform.supportsJaxbFacetVersion(jaxbFacetVersion)) {
+ return defaultPlatform;
+ }
+ else if (defaultDefault != null && defaultDefault.supportsJaxbFacetVersion(jaxbFacetVersion)) {
+ return defaultDefault;
+ }
+ return null;
+ }
+
+ public static JaxbPlatformManager getJaxbPlatformManager() {
+ return JaxbPlatformManagerImpl.instance();
+ }
+
+
+ /**
+ * Log the specified status.
+ */
+ public static void log(IStatus status) {
+ INSTANCE.getLog().log(status);
+ }
+
+ /**
+ * Log the specified message.
+ */
+ public static void log(String msg) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
+ }
+
+ /**
+ * Log the specified exception or error.
+ */
+ public static void log(Throwable throwable) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
+ }
+
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ // TODO Auto-generated method stub
+ super.start(context);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ // TODO Auto-generated method stub
+ super.stop(context);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java
new file mode 100644
index 0000000000..2f82f62b9e
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.facet;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
+import org.eclipse.wst.common.project.facet.core.ActionConfig;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class JaxbFacetInstallConfig
+ extends ActionConfig {
+
+ private PropertyChangeSupport changeSupport;
+
+ public static final String FACETED_PROJECT_WORKING_COPY_PROPERTY = "facetedProjectWorkingCopy";
+
+ public static final String PROJECT_FACET_VERSION_PROPERTY = "projectFacetVersion";
+
+ public static final String PLATFORM_PROPERTY = "platform";
+ private JaxbPlatformDescription platform;
+
+ public static final String LIBRARY_INSTALL_DELEGATE_PROPERTY = "libraryInstallDelegate";
+ private LibraryInstallDelegate libraryInstallDelegate;
+
+
+
+ public JaxbFacetInstallConfig() {
+ super();
+ this.changeSupport = new PropertyChangeSupport(this);
+ }
+
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ this.changeSupport.addPropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ this.changeSupport.removePropertyChangeListener(listener);
+ }
+
+ @Override
+ public void setFacetedProjectWorkingCopy(IFacetedProjectWorkingCopy fpjwc) {
+ IFacetedProjectWorkingCopy oldFpjwc = getFacetedProjectWorkingCopy();
+ super.setFacetedProjectWorkingCopy(fpjwc);
+ this.changeSupport.firePropertyChange(FACETED_PROJECT_WORKING_COPY_PROPERTY, oldFpjwc, fpjwc);
+ }
+
+ @Override
+ public void setProjectFacetVersion(IProjectFacetVersion fv) {
+ IProjectFacetVersion oldFv = getProjectFacetVersion();
+ super.setProjectFacetVersion(fv);
+ this.changeSupport.firePropertyChange(PROJECT_FACET_VERSION_PROPERTY, oldFv, fv);
+ }
+
+ public JaxbPlatformDescription getPlatform() {
+ return this.platform;
+ }
+
+ public void setPlatform(JaxbPlatformDescription platform) {
+ JaxbPlatformDescription oldPlatform = this.platform;
+ this.platform = platform;
+ this.changeSupport.firePropertyChange(PLATFORM_PROPERTY, oldPlatform, platform);
+ }
+
+ public LibraryInstallDelegate getLibraryInstallDelegate() {
+ return this.libraryInstallDelegate;
+ }
+
+ public void setLibraryInstallDelegate(LibraryInstallDelegate libraryInstallDelegate) {
+ LibraryInstallDelegate oldLibraryInstallDelegate = this.libraryInstallDelegate;
+ this.libraryInstallDelegate = libraryInstallDelegate;
+ this.changeSupport.firePropertyChange(
+ LIBRARY_INSTALL_DELEGATE_PROPERTY, oldLibraryInstallDelegate, libraryInstallDelegate);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java
new file mode 100644
index 0000000000..b52d7b2311
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.facet;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+public class JaxbFacetInstallConfigFactory
+ implements IActionConfigFactory {
+
+ public Object create() throws CoreException {
+ return new JaxbFacetInstallConfig();
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java
new file mode 100644
index 0000000000..0fa6e8a733
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+
+public class JaxbFacetInstallDelegate
+ implements IDelegate {
+
+ public final void execute(
+ IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+
+ this.execute_(project, fv, config, monitor);
+ }
+
+ protected void execute_(
+ IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+
+ SubMonitor subMonitor = SubMonitor.convert(monitor, 7);
+
+ JaxbFacetInstallConfig jaxbConfig = (JaxbFacetInstallConfig) config;
+
+ // project settings
+ JaxbPlatformDescription platform = jaxbConfig.getPlatform();
+ JptJaxbCorePlugin.setJaxbPlatform(project, platform);
+ subMonitor.worked(1);
+
+ // defaults settings
+ JptJaxbCorePlugin.setDefaultJaxbPlatform(fv, platform);
+ subMonitor.worked(1);
+
+ //Delegate to LibraryInstallDelegate to configure the project classpath
+ jaxbConfig.getLibraryInstallDelegate().execute(subMonitor.newChild(1));
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java
new file mode 100644
index 0000000000..1c24b1dfd8
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+
+public class JaxbFacetUninstallDelegate
+ implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+
+ // There is nothing to do here. Everything is taken care of by the
+ // JaxbModelManager *whenever* the facet is removed (even via meta-file
+ // editing and CVS updating), but this delegate needs to be here because
+ // it is required by the facet extension point action element, and that
+ // is required by the facet UI to allow uninstallation of this facet.
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/Generic_2_2_JaxbPlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/Generic_2_2_JaxbPlatformDefinitionFactory.java
new file mode 100644
index 0000000000..43e285680a
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/Generic_2_2_JaxbPlatformDefinitionFactory.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.jaxb22;
+
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory;
+
+
+public class Generic_2_2_JaxbPlatformDefinitionFactory
+ implements JaxbPlatformDefinitionFactory {
+
+ public JaxbPlatformDefinition buildJaxbPlatformDefinition() {
+
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfig.java
new file mode 100644
index 0000000000..5f204707c7
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfig.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.libprov;
+
+import org.eclipse.jpt.core.internal.libprov.JptLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+
+
+public interface JaxbLibraryProviderInstallOperationConfig
+ extends JptLibraryProviderInstallOperationConfig {
+
+ public static final String PROP_JAXB_PLATFORM = "JAXB_PLATFORM"; //$NON-NLS-1$
+
+ JaxbPlatformDescription getJaxbPlatform();
+
+ void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform);
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java
new file mode 100644
index 0000000000..dcea2feb29
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.libprov;
+
+import org.eclipse.jpt.core.internal.libprov.JptOsgiBundlesLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+
+
+public class JaxbOsgiBundlesLibraryProviderInstallOperationConfig
+ extends JptOsgiBundlesLibraryProviderInstallOperationConfig
+ implements JaxbLibraryProviderInstallOperationConfig {
+
+ private JaxbPlatformDescription jaxbPlatform;
+
+
+ public JaxbOsgiBundlesLibraryProviderInstallOperationConfig() {
+ super();
+ }
+
+
+ public JaxbPlatformDescription getJaxbPlatform() {
+ return this.jaxbPlatform;
+ }
+
+ public void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) {
+ JaxbPlatformDescription old = this.jaxbPlatform;
+ this.jaxbPlatform = jaxbPlatform;
+ notifyListeners(PROP_JAXB_PLATFORM, old, jaxbPlatform);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java
new file mode 100644
index 0000000000..fda81b6cfa
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.libprov;
+
+import org.eclipse.jpt.core.internal.libprov.JptUserLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+
+public class JaxbUserLibraryProviderInstallOperationConfig
+ extends JptUserLibraryProviderInstallOperationConfig
+ implements JaxbLibraryProviderInstallOperationConfig {
+
+ private JaxbPlatformDescription jaxbPlatform;
+
+
+ public JaxbUserLibraryProviderInstallOperationConfig() {
+ super();
+ }
+
+
+ public JaxbPlatformDescription getJaxbPlatform() {
+ return this.jaxbPlatform;
+ }
+
+ public void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) {
+ JaxbPlatformDescription old = this.jaxbPlatform;
+ this.jaxbPlatform = jaxbPlatform;
+ notifyListeners(PROP_JAXB_PLATFORM, old, jaxbPlatform);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java
new file mode 100644
index 0000000000..e7aff788f7
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.platform;
+
+import org.eclipse.jpt.core.internal.XPointUtil;
+import org.eclipse.jpt.jaxb.core.JaxbFacet;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class JaxbPlatformDescriptionImpl
+ implements JaxbPlatformDescription {
+
+ private String id;
+ private String pluginId;
+ private String label;
+ private String factoryClassName;
+ private IProjectFacetVersion jaxbFacetVersion;
+ private boolean default_ = false;
+ private JaxbPlatformGroupDescriptionImpl 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 getJaxbFacetVersion() {
+ return this.jaxbFacetVersion;
+ }
+
+ void setJaxbFacetVersion(IProjectFacetVersion jaxbFacetVersion) {
+ if (! jaxbFacetVersion.getProjectFacet().equals(JaxbFacet.FACET)) {
+ throw new IllegalArgumentException(jaxbFacetVersion.toString());
+ }
+ this.jaxbFacetVersion = jaxbFacetVersion;
+ }
+
+ public boolean supportsJaxbFacetVersion(IProjectFacetVersion jaxbFacetVersion) {
+ if (! jaxbFacetVersion.getProjectFacet().equals(JaxbFacet.FACET)) {
+ throw new IllegalArgumentException(jaxbFacetVersion.toString());
+ }
+ return (this.jaxbFacetVersion != null) ? this.jaxbFacetVersion.equals(jaxbFacetVersion) : true;
+ }
+
+ public boolean isDefault() {
+ return this.default_;
+ }
+
+ void setDefault(boolean default_) {
+ this.default_ = default_;
+ }
+
+ public JaxbPlatformGroupDescription getGroup() {
+ return this.group;
+ }
+
+ void setGroup(JaxbPlatformGroupDescriptionImpl group) {
+ this.group = group;
+ }
+
+ public JaxbPlatformDefinition buildJaxbPlatformDefinition() {
+ JaxbPlatformDefinitionFactory factory = (JaxbPlatformDefinitionFactory) XPointUtil.instantiate(
+ this.pluginId, JaxbPlatformManagerImpl.QUALIFIED_EXTENSION_POINT_ID,
+ this.factoryClassName, JaxbPlatformDefinitionFactory.class);
+ return factory.buildJaxbPlatformDefinition();
+ }
+
+ @Override
+ public String toString() {
+ return this.label;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java
new file mode 100644
index 0000000000..c0597772ad
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.platform;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterables.SuperIterableWrapper;
+
+
+public class JaxbPlatformGroupDescriptionImpl
+ implements JaxbPlatformGroupDescription {
+
+ private String id;
+ private String pluginId;
+ private String label;
+ private Map<String, JaxbPlatformDescriptionImpl> platforms;
+
+
+ JaxbPlatformGroupDescriptionImpl() {
+ this.platforms = new HashMap<String, JaxbPlatformDescriptionImpl>();
+ }
+
+ 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;
+ }
+
+ void addPlatform(JaxbPlatformDescriptionImpl platform) {
+ this.platforms.put(platform.getId(), platform);
+ }
+
+ public Iterable<JaxbPlatformDescription> getPlatforms() {
+ return new SuperIterableWrapper<JaxbPlatformDescription>(CollectionTools.collection(this.platforms.values()));
+ }
+
+ @Override
+ public String toString() {
+ return this.label;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java
new file mode 100644
index 0000000000..229b0d6b8e
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.platform;
+
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatform;
+
+public class JaxbPlatformImpl
+ implements JaxbPlatform {
+
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java
new file mode 100644
index 0000000000..4b645f3437
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java
@@ -0,0 +1,254 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.internal.platform;
+
+import static org.eclipse.jpt.core.internal.XPointUtil.*;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.core.internal.XPointUtil.XPointException;
+import org.eclipse.jpt.jaxb.core.JaxbFacet;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformManager;
+import org.eclipse.jpt.utility.internal.KeyedSet;
+import org.eclipse.jpt.utility.internal.iterables.SuperIterableWrapper;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+
+public class JaxbPlatformManagerImpl
+ implements JaxbPlatformManager {
+
+ static final String EXTENSION_POINT_ID = "jaxbPlatforms"; //$NON-NLS-1$
+ static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
+ static final String PLATFORM_GROUP_ELEMENT = "jaxbPlatformGroup"; //$NON-NLS-1$
+ static final String PLATFORM_ELEMENT = "jaxbPlatform"; //$NON-NLS-1$
+ static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+ static final String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$
+ static final String FACTORY_CLASS_ATTRIBUTE = "factoryClass"; //$NON-NLS-1$
+ static final String JAXB_FACET_VERSION_ATTRIBUTE = "jaxbFacetVersion"; //$NON-NLS-1$
+ static final String DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$
+ static final String GROUP_ELEMENT = "group"; //$NON-NLS-1$
+
+
+ private static final JaxbPlatformManagerImpl INSTANCE = new JaxbPlatformManagerImpl();
+
+
+ public static JaxbPlatformManagerImpl instance() {
+ return INSTANCE;
+ }
+
+
+ private KeyedSet<String, JaxbPlatformGroupDescriptionImpl> platformGroupDescriptions;
+ private KeyedSet<String, JaxbPlatformDescriptionImpl> platformDescriptions;
+
+
+ // ********** constructor/initialization **********
+
+ private JaxbPlatformManagerImpl() {
+ super();
+ this.platformGroupDescriptions = new KeyedSet<String, JaxbPlatformGroupDescriptionImpl>();
+ this.platformDescriptions = new KeyedSet<String, JaxbPlatformDescriptionImpl>();
+ readExtensions();
+ }
+
+
+ private void readExtensions() {
+ final IExtensionRegistry registry = Platform.getExtensionRegistry();
+
+ final IExtensionPoint xpoint
+ = registry.getExtensionPoint(JptJaxbCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID);
+
+ if (xpoint == null) {
+ throw new IllegalStateException();
+ }
+
+ List<IConfigurationElement> platformGroupConfigs = new ArrayList<IConfigurationElement>();
+ List<IConfigurationElement> platformConfigs = new ArrayList<IConfigurationElement>();
+
+ for (IExtension extension : xpoint.getExtensions()) {
+ for (IConfigurationElement element : extension.getConfigurationElements()) {
+ if (element.getName().equals(PLATFORM_GROUP_ELEMENT)) {
+ platformGroupConfigs.add(element);
+ }
+ else if (element.getName().equals(PLATFORM_ELEMENT)) {
+ platformConfigs.add(element);
+ }
+ }
+ }
+
+ for (IConfigurationElement element : platformGroupConfigs) {
+ readPlatformGroupExtension(element);
+ }
+
+ for (IConfigurationElement element : platformConfigs) {
+ readPlatformExtension(element);
+ }
+ }
+
+ private void readPlatformGroupExtension(IConfigurationElement element) {
+ try {
+ final JaxbPlatformGroupDescriptionImpl desc = new JaxbPlatformGroupDescriptionImpl();
+
+ // plug-in id
+ desc.setPluginId(element.getContributor().getName());
+
+ // id
+ desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
+
+ if (this.platformGroupDescriptions.containsKey(desc.getId())) {
+ logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, desc.getId());
+ throw new XPointException();
+ }
+
+ // label
+ desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
+
+ this.platformGroupDescriptions.addItem(desc.getId(), desc);
+ }
+ catch (XPointException e) {
+ // Ignore and continue. The problem has already been reported to the user
+ // in the log.
+ }
+ }
+
+ private void readPlatformExtension(IConfigurationElement element) {
+ try {
+ final JaxbPlatformDescriptionImpl desc = new JaxbPlatformDescriptionImpl();
+
+ // plug-in id
+ desc.setPluginId(element.getContributor().getName());
+
+ // id
+ desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
+
+ if (this.platformDescriptions.containsKey(desc.getId())) {
+ logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, desc.getId());
+ throw new XPointException();
+ }
+
+ // label
+ desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
+
+ // factory class
+ desc.setFactoryClassName(findRequiredAttribute(element, FACTORY_CLASS_ATTRIBUTE));
+
+ // JAXB facet version
+ String jaxbFacetVersionString = element.getAttribute(JAXB_FACET_VERSION_ATTRIBUTE);
+ if (jaxbFacetVersionString != null) {
+ IProjectFacetVersion jpaFacetVersion = JaxbFacet.FACET.getVersion(jaxbFacetVersionString);
+ if (jpaFacetVersion != null) {
+ desc.setJaxbFacetVersion(jpaFacetVersion);
+ }
+ else {
+ logInvalidValue(element, JAXB_FACET_VERSION_ATTRIBUTE, jaxbFacetVersionString);
+ throw new XPointException();
+ }
+ }
+
+ // default
+ String defaultString = element.getAttribute(DEFAULT_ATTRIBUTE);
+ if (defaultString != null) {
+ if (defaultString.equals("true")) {
+ desc.setDefault(true);
+ }
+ else if (defaultString.equals("false")) {
+ desc.setDefault(false);
+ }
+ else {
+ logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString);
+ throw new XPointException();
+ }
+ }
+
+ // group
+ String groupId = element.getAttribute(GROUP_ELEMENT);
+ if (groupId != null) {
+ JaxbPlatformGroupDescriptionImpl group = this.platformGroupDescriptions.getItem(groupId);
+ if (group != null) {
+ desc.setGroup(group);
+ group.addPlatform(desc);
+ }
+ else {
+ logInvalidValue(element, GROUP_ELEMENT, groupId);
+ throw new XPointException();
+ }
+ }
+ else {
+ JaxbPlatformGroupDescriptionImpl group = new JaxbPlatformGroupDescriptionImpl();
+ group.setPluginId(desc.getPluginId());
+ group.setId(desc.getId());
+ group.setLabel(desc.getLabel());
+ group.addPlatform(desc);
+
+ if (this.platformGroupDescriptions.containsKey(group.getId())) {
+ logInvalidValue(element, GROUP_ELEMENT, groupId);
+ throw new XPointException();
+ }
+
+ this.platformGroupDescriptions.addItem(group.getId(), group);
+ }
+
+ this.platformDescriptions.addItem(desc.getId(), desc);
+ }
+ catch (XPointException e) {
+ // Ignore and continue. The problem has already been reported to the user
+ // in the log.
+ }
+ }
+
+
+ // ********** public methods **********
+
+ public Iterable<JaxbPlatformGroupDescription> getJaxbPlatformGroups() {
+ return new SuperIterableWrapper<JaxbPlatformGroupDescription>(this.platformGroupDescriptions.getItemSet());
+ }
+
+ public JaxbPlatformGroupDescription getJaxbPlatformGroup(String groupId) {
+ return this.platformGroupDescriptions.getItem(groupId);
+ }
+
+ public Iterable<JaxbPlatformDescription> getJaxbPlatforms() {
+ return new SuperIterableWrapper<JaxbPlatformDescription>(this.platformDescriptions.getItemSet());
+ }
+
+ public JaxbPlatformDescription getJaxbPlatform(String platformId) {
+ return this.platformDescriptions.getItem(platformId);
+ }
+
+ public JaxbPlatformDescription getDefaultJaxbPlatform(IProjectFacetVersion jaxbFacetVersion) {
+ if (! jaxbFacetVersion.getProjectFacet().equals(JaxbFacet.FACET)) {
+ throw new IllegalArgumentException(jaxbFacetVersion.toString());
+ }
+ for (JaxbPlatformDescription platform : getJaxbPlatforms()) {
+ if (platform.isDefault() && platform.supportsJaxbFacetVersion(jaxbFacetVersion)) {
+ return platform;
+ }
+ }
+ return null;
+ }
+
+ public JaxbPlatformDefinition buildJaxbPlatformDefinition(IProject project) {
+ String jaxbPlatformId = JptCorePlugin.getJpaPlatformId(project);
+ JaxbPlatformDescriptionImpl platformDesc = this.platformDescriptions.getItem(jaxbPlatformId);
+ if (platformDesc == null) {
+ throw new IllegalArgumentException("Project does not have a recognized JAXB platform.");
+ }
+ return platformDesc.buildJaxbPlatformDefinition();
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java
new file mode 100644
index 0000000000..684cfbe32c
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.platform;
+
+/**
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JaxbPlatform {
+
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java
new file mode 100644
index 0000000000..a6a72eb330
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.platform;
+
+/**
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JaxbPlatformDefinition {
+
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java
new file mode 100644
index 0000000000..c27161a036
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.platform;
+
+/**
+ * This interface is to be implemented by a JAXB vendor to build a
+ * {@link JaxbPlatformDefinition}.
+ * <p>
+ * See the <code>org.eclipse.jpt.jaxb.core.jaxbPlatforms</code> extension point.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JaxbPlatformDefinitionFactory {
+
+ JaxbPlatformDefinition buildJaxbPlatformDefinition();
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java
new file mode 100644
index 0000000000..93fc5e47c5
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.platform;
+
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * Contains metadata that describes a JAXB platform. Not intended to be implemented by clients.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JaxbPlatformDescription {
+
+ public String getId();
+
+ public String getPluginId();
+
+ public String getLabel();
+
+ public String getFactoryClassName();
+
+ public boolean supportsJaxbFacetVersion(IProjectFacetVersion jpaFacetVersion);
+
+ public boolean isDefault();
+
+ public JaxbPlatformGroupDescription getGroup();
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java
new file mode 100644
index 0000000000..607c120a51
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.platform;
+
+/**
+ * Contains metadata that describes a JAXB platform group. Not intended to be implemented by clients.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JaxbPlatformGroupDescription {
+
+ public String getId();
+
+ public String getPluginId();
+
+ public String getLabel();
+
+ public Iterable<JaxbPlatformDescription> getPlatforms();
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java
new file mode 100644
index 0000000000..1dca3072c4
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jaxb.core.platform;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * Entry point to the "jaxbPlatforms" extension point
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface JaxbPlatformManager {
+
+ Iterable<JaxbPlatformGroupDescription> getJaxbPlatformGroups();
+
+ JaxbPlatformGroupDescription getJaxbPlatformGroup(String groupId);
+
+ Iterable<JaxbPlatformDescription> getJaxbPlatforms();
+
+ JaxbPlatformDescription getJaxbPlatform(String platformId);
+
+ /**
+ * Returns the first JAXB platform registered as a default platform and which supports the given
+ * JAXB facet version.
+ * Returns null if there are no such registered platforms.
+ */
+ JaxbPlatformDescription getDefaultJaxbPlatform(IProjectFacetVersion jaxbFacetVersion);
+
+ JaxbPlatformDefinition buildJaxbPlatformDefinition(IProject project);
+}

Back to the top