diff --git a/main/plugins/org.talend.updates.runtime/META-INF/MANIFEST.MF b/main/plugins/org.talend.updates.runtime/META-INF/MANIFEST.MF index 0d9ee720fb..32939183fc 100644 --- a/main/plugins/org.talend.updates.runtime/META-INF/MANIFEST.MF +++ b/main/plugins/org.talend.updates.runtime/META-INF/MANIFEST.MF @@ -2,8 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Updates Runtime Bundle-SymbolicName: org.talend.updates.runtime;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.talend.updates.runtime.UpdatesRuntimePlugin +Bundle-Version: 5.6.0.SNAP_20140917_1931 Bundle-Vendor: .Talend SA. Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/Constants.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/Constants.java new file mode 100644 index 0000000000..7f78a7cd82 --- /dev/null +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/Constants.java @@ -0,0 +1,9 @@ +package org.talend.updates.runtime; + + +public class Constants { + + // The plug-in ID + public static final String PLUGIN_ID = "org.talend.updates.runtime"; //$NON-NLS-1$ + +} diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/UpdatesRuntimePlugin.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/UpdatesRuntimePlugin.java deleted file mode 100644 index 0aa0b7f511..0000000000 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/UpdatesRuntimePlugin.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.talend.updates.runtime; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class UpdatesRuntimePlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.talend.updates.runtime"; //$NON-NLS-1$ - - // The shared instance - private static UpdatesRuntimePlugin plugin; - - /** - * The constructor - */ - public UpdatesRuntimePlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static UpdatesRuntimePlugin getDefault() { - return plugin; - } - -} diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesFactory.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesFactory.java index 9acaec295f..e274cb4086 100644 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesFactory.java +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesFactory.java @@ -73,11 +73,11 @@ public class ExtraFeaturesUpdatesFactory { } } - public void afterUpdate() throws Exception { + public void afterCompleteInstall() throws Exception { AbstractExtraUpdatesFactory[] updatesFactories = updatesFactoryReader.getUpdatesFactories(); if (updatesFactories != null) { for (AbstractExtraUpdatesFactory factory : updatesFactories) { - factory.afterUpdate(); + factory.afterCompleteInstall(); } } } diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesReader.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesReader.java index 15f5028d1c..a76e06e883 100644 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesReader.java +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/ExtraFeaturesUpdatesReader.java @@ -21,7 +21,7 @@ import org.apache.log4j.Logger; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.SafeRunner; import org.talend.core.utils.RegistryReader; -import org.talend.updates.runtime.UpdatesRuntimePlugin; +import org.talend.updates.runtime.Constants; import org.talend.updates.runtime.engine.factory.AbstractExtraUpdatesFactory; /** @@ -37,7 +37,7 @@ public class ExtraFeaturesUpdatesReader extends RegistryReader { private AbstractExtraUpdatesFactory[] factories; public ExtraFeaturesUpdatesReader() { - super(UpdatesRuntimePlugin.PLUGIN_ID, "extraUpdatesFactory"); //$NON-NLS-1$ + super(Constants.PLUGIN_ID, "extraUpdatesFactory"); //$NON-NLS-1$ init(); } diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/factory/AbstractExtraUpdatesFactory.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/factory/AbstractExtraUpdatesFactory.java index 5f6b66780b..e49c81189d 100644 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/factory/AbstractExtraUpdatesFactory.java +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/engine/factory/AbstractExtraUpdatesFactory.java @@ -67,9 +67,10 @@ public abstract class AbstractExtraUpdatesFactory { } /** - * after update studio, will do this. + * This is called once all the different features of different types have all been installed. This is only called if + * there is at least one feature successfully installed, even if this current feature failed to be installed. */ - public void afterUpdate() throws Exception { + public void afterCompleteInstall() throws Exception { // nothing to do } } diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/i18n/Messages.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/i18n/Messages.java index b63422c698..c38a58885f 100644 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/i18n/Messages.java +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/i18n/Messages.java @@ -19,7 +19,7 @@ import org.eclipse.core.runtime.Status; import org.osgi.framework.Bundle; import org.osgi.framework.FrameworkUtil; import org.talend.commons.i18n.MessagesCore; -import org.talend.updates.runtime.UpdatesRuntimePlugin; +import org.talend.updates.runtime.Constants; /** * created by sgandon on 5 mars 2013 Detailled comment @@ -39,7 +39,7 @@ public class Messages extends MessagesCore { * @see MessagesCore#getString(String, ResourceBundle) */ public static String getString(String key) { - return getString(key, UpdatesRuntimePlugin.PLUGIN_ID, resourceBundle); + return getString(key, Constants.PLUGIN_ID, resourceBundle); } /** @@ -51,7 +51,7 @@ public class Messages extends MessagesCore { * @see MessagesCore#getString(String, ResourceBundle, Object[]) */ public static String getString(String key, Object... args) { - return MessagesCore.getString(key, UpdatesRuntimePlugin.PLUGIN_ID, resourceBundle, args); + return MessagesCore.getString(key, Constants.PLUGIN_ID, resourceBundle, args); } /** diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/ExtraFeature.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/ExtraFeature.java index 3d01b7808c..a3721cbe15 100644 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/ExtraFeature.java +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/ExtraFeature.java @@ -34,6 +34,16 @@ public interface ExtraFeature { */ public boolean isInstalled(IProgressMonitor progress) throws Exception; + /** + * Check that the feature has an udpate with a version higher than the one already installed. If that is the case + * then a new instance of ExtraFeature is created, it returns null otherwhise. + * + * @param progress + * + * @return a new feature is an upate is available or null + */ + public ExtraFeature createFeatureIfUpdates(IProgressMonitor progress) throws Exception; + /** * Getter for name. * diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/TalendWebServiceUpdateExtraFeature.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/TalendWebServiceUpdateExtraFeature.java index 826ef7fb3a..13367167d1 100644 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/TalendWebServiceUpdateExtraFeature.java +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/model/TalendWebServiceUpdateExtraFeature.java @@ -249,4 +249,15 @@ public class TalendWebServiceUpdateExtraFeature implements ExtraFeature { return mustBeInstalled; } + /* + * (non-Javadoc) + * + * @see + * org.talend.updates.runtime.model.ExtraFeature#createFeatureIfUpdates(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public ExtraFeature createFeatureIfUpdates(IProgressMonitor progress) throws Exception { + return null;// we do not handle udpates yet. + } + } diff --git a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/ui/UpdateStudioWizard.java b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/ui/UpdateStudioWizard.java index 18a51f189d..f85756efeb 100644 --- a/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/ui/UpdateStudioWizard.java +++ b/main/plugins/org.talend.updates.runtime/src/main/java/org/talend/updates/runtime/ui/UpdateStudioWizard.java @@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import org.osgi.service.prefs.BackingStoreException; import org.talend.commons.exception.ExceptionHandler; -import org.talend.updates.runtime.UpdatesRuntimePlugin; +import org.talend.updates.runtime.Constants; import org.talend.updates.runtime.engine.ExtraFeaturesUpdatesFactory; import org.talend.updates.runtime.engine.InstallNewFeatureJob; import org.talend.updates.runtime.i18n.Messages; @@ -56,7 +56,7 @@ public class UpdateStudioWizard extends Wizard { /** * preference node for the org.talend.updates plugin. */ - public static final String ORG_TALEND_UPDATES_PREF_NODE = UpdatesRuntimePlugin.PLUGIN_ID; + public static final String ORG_TALEND_UPDATES_PREF_NODE = Constants.PLUGIN_ID; UpdateWizardModel updateWizardModel;// model that hold all the parameters set in the wizard @@ -114,7 +114,7 @@ public class UpdateStudioWizard extends Wizard { if (hasAnySuccess) { ExtraFeaturesUpdatesFactory updatesFactory = new ExtraFeaturesUpdatesFactory(); try { - updatesFactory.afterUpdate(); + updatesFactory.afterCompleteInstall(); } catch (Exception e) { hasAnyFailure = true; } @@ -151,7 +151,7 @@ public class UpdateStudioWizard extends Wizard { try { updatesNode.flush(); } catch (BackingStoreException e) { - log.error("could not store the \"Do No Show this again\" pref of the Install Dialog", e); + log.error("could not store the \"Do No Show this again\" pref of the Install Dialog", e); //$NON-NLS-1$ } }