diff options
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org')
21 files changed, 1233 insertions, 0 deletions
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); +} |