Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-08-30 09:54:15 +0000
committerEike Stepper2012-08-30 09:54:15 +0000
commit1c6bf4ef2a299dace8d5a4398105cd1c971989e7 (patch)
tree0923c97d0277c86dbed41ee6b3e81e1eb44b859f /plugins
parentde323f8af59db71747b09f2b3c431a3ab7f21ba5 (diff)
downloadcdo-1c6bf4ef2a299dace8d5a4398105cd1c971989e7.tar.gz
cdo-1c6bf4ef2a299dace8d5a4398105cd1c971989e7.tar.xz
cdo-1c6bf4ef2a299dace8d5a4398105cd1c971989e7.zip
Recognize tool updates and trigger full builds/validations
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/Activator.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Activator.java225
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/BuildState.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/VersionBuilder.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionValidator.java8
7 files changed, 256 insertions, 153 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/Activator.java b/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/Activator.java
index f2b8612de9..dc27d9e279 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/Activator.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/Activator.java
@@ -26,6 +26,8 @@ public class Activator extends Plugin
private static Activator plugin;
+ private String version;
+
public Activator()
{
}
@@ -35,15 +37,22 @@ public class Activator extends Plugin
{
super.start(context);
plugin = this;
+ version = getBundle().getVersion().toString();
}
@Override
public void stop(BundleContext context) throws Exception
{
+ version = null;
plugin = null;
super.stop(context);
}
+ public static String getVersion()
+ {
+ return plugin.version;
+ }
+
public static void log(String message)
{
plugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
diff --git a/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java b/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
index 8b36491a16..ffc27c3bc0 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version.digest/src/org/eclipse/emf/cdo/releng/version/digest/DigestValidator.java
@@ -63,6 +63,12 @@ public class DigestValidator extends VersionValidator
}
@Override
+ public String getVersion()
+ {
+ return Activator.getVersion();
+ }
+
+ @Override
public void updateBuildState(IBuildState buildState, IRelease release, IProject project, IResourceDelta delta,
IModel componentModel, IProgressMonitor monitor) throws Exception
{
@@ -74,7 +80,7 @@ public class DigestValidator extends VersionValidator
long timeStamp = releaseDigest.getTimeStamp();
if (timeStamp != buildState.getValidatorTimeStamp())
{
- // Trigger full build if the release digest to use is different from the one used for the last build
+ // Trigger full validation if the release digest to use is different from the one used for the last build
delta = null;
// Avoid triggering full builds after this (full) build
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Activator.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Activator.java
index 40b54878de..5f5cf27d5c 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Activator.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/Activator.java
@@ -27,12 +27,12 @@ import org.osgi.framework.BundleContext;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -51,9 +51,9 @@ public class Activator extends Plugin
private static IResourceChangeListener postBuildListener;
- private IgnoredReleases ignoredReleases;
+ private static IgnoredReleases ignoredReleases;
- private Map<String, BuildState> buildStates;
+ private static BuildStates buildStates;
public Activator()
{
@@ -67,11 +67,11 @@ public class Activator extends Plugin
try
{
- File stateFile = getStateFile(IGNORED_RELEASES);
- if (stateFile.exists())
- {
- loadIgnoredReleases();
- }
+ ignoredReleases = load(IGNORED_RELEASES);
+ }
+ catch (Throwable t)
+ {
+ //$FALL-THROUGH$
}
finally
{
@@ -83,18 +83,23 @@ public class Activator extends Plugin
try
{
+ buildStates = load(BUILD_STATES);
+ }
+ catch (Throwable t)
+ {
+ //$FALL-THROUGH$
+ }
+ finally
+ {
File stateFile = getStateFile(BUILD_STATES);
if (stateFile.exists())
{
- loadBuildStates();
stateFile.delete(); // Future indication for possible workspace crash
}
- }
- finally
- {
+
if (buildStates == null)
{
- buildStates = new HashMap<String, BuildState>();
+ buildStates = new BuildStates();
}
}
}
@@ -110,127 +115,50 @@ public class Activator extends Plugin
if (!buildStates.isEmpty())
{
- saveBuildStates();
- buildStates = null;
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (Iterator<Entry<String, BuildState>> it = buildStates.entrySet().iterator(); it.hasNext();)
+ {
+ Entry<String, BuildState> entry = it.next();
+ String projectName = entry.getKey();
+ IProject project = root.getProject(projectName);
+ if (!project.exists())
+ {
+ it.remove();
+ }
+ else
+ {
+ BuildState buildState = entry.getValue();
+ buildState.serializeValidatorState();
+ }
+ }
+
+ save(BUILD_STATES, buildStates);
}
+ ignoredReleases = null;
+ buildStates = null;
plugin = null;
super.stop(context);
}
- private File getStateFile(String name)
- {
- File stateFolder = Platform.getStateLocation(getBundle()).toFile();
- return new File(stateFolder, name);
- }
-
- private void loadIgnoredReleases()
- {
- ObjectInputStream stream = null;
-
- try
- {
- File stateFile = getStateFile(IGNORED_RELEASES);
- stream = new ObjectInputStream(new FileInputStream(stateFile));
- ignoredReleases = (IgnoredReleases)stream.readObject();
- }
- catch (Exception ex)
- {
- log(ex);
- }
- finally
- {
- VersionUtil.close(stream);
- }
- }
-
- private void saveIgnoredReleases()
- {
- ObjectOutputStream stream = null;
-
- try
- {
- File stateFile = getStateFile(IGNORED_RELEASES);
- stream = new ObjectOutputStream(new FileOutputStream(stateFile));
- stream.writeObject(ignoredReleases);
- }
- catch (Exception ex)
- {
- log(ex);
- }
- finally
- {
- VersionUtil.close(stream);
- }
- }
-
- private void loadBuildStates()
- {
- ObjectInputStream stream = null;
-
- try
- {
- File stateFile = getStateFile(BUILD_STATES);
- stream = new ObjectInputStream(new FileInputStream(stateFile));
-
- @SuppressWarnings("unchecked")
- Map<String, BuildState> object = (Map<String, BuildState>)stream.readObject();
- buildStates = object;
- }
- catch (Exception ex)
- {
- log(ex);
- }
- finally
- {
- VersionUtil.close(stream);
- }
- }
-
- private void saveBuildStates()
+ public static void setPostBuildListener(IResourceChangeListener postBuildListener)
{
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- for (Iterator<Entry<String, BuildState>> it = buildStates.entrySet().iterator(); it.hasNext();)
- {
- Entry<String, BuildState> entry = it.next();
- IProject project = root.getProject(entry.getKey());
- if (!project.exists())
- {
- it.remove();
- }
- }
-
- ObjectOutputStream stream = null;
-
- try
- {
- File stateFile = getStateFile(BUILD_STATES);
- stream = new ObjectOutputStream(new FileOutputStream(stateFile));
- stream.writeObject(buildStates);
- }
- catch (Exception ex)
- {
- log(ex);
- }
- finally
- {
- VersionUtil.close(stream);
- }
+ Activator.postBuildListener = postBuildListener;
}
public static Set<String> getIgnoredReleases()
{
- return plugin.ignoredReleases;
+ return ignoredReleases;
}
public static BuildState getBuildState(IProject project)
{
String name = project.getName();
- BuildState buildState = plugin.buildStates.get(name);
+ BuildState buildState = buildStates.get(name);
if (buildState == null)
{
buildState = new BuildState();
- plugin.buildStates.put(name, buildState);
+ buildStates.put(name, buildState);
}
return buildState;
@@ -239,7 +167,7 @@ public class Activator extends Plugin
public static void clearBuildState(IProject project)
{
String name = project.getName();
- plugin.buildStates.remove(name);
+ buildStates.remove(name);
}
public static void log(String message)
@@ -276,9 +204,49 @@ public class Activator extends Plugin
return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
}
- public static void setPostBuildListener(IResourceChangeListener postBuildListener)
+ private static File getStateFile(String name)
{
- Activator.postBuildListener = postBuildListener;
+ File stateFolder = Platform.getStateLocation(plugin.getBundle()).toFile();
+ return new File(stateFolder, name);
+ }
+
+ private static <T> T load(String fileName) throws IOException, ClassNotFoundException
+ {
+ ObjectInputStream stream = null;
+
+ try
+ {
+ File stateFile = getStateFile(fileName);
+ stream = new ObjectInputStream(new FileInputStream(stateFile));
+
+ @SuppressWarnings("unchecked")
+ T object = (T)stream.readObject();
+ return object;
+ }
+ finally
+ {
+ VersionUtil.close(stream);
+ }
+ }
+
+ private static void save(String fileName, Object object)
+ {
+ ObjectOutputStream stream = null;
+
+ try
+ {
+ File file = getStateFile(fileName);
+ stream = new ObjectOutputStream(new FileOutputStream(file));
+ stream.writeObject(object);
+ }
+ catch (Throwable ex)
+ {
+ log(ex);
+ }
+ finally
+ {
+ VersionUtil.close(stream);
+ }
}
/**
@@ -297,7 +265,7 @@ public class Activator extends Plugin
{
if (super.add(releasePath))
{
- plugin.saveIgnoredReleases();
+ save();
return true;
}
@@ -309,11 +277,28 @@ public class Activator extends Plugin
{
if (super.remove(releasePath))
{
- plugin.saveIgnoredReleases();
+ save();
return true;
}
return false;
}
+
+ private void save()
+ {
+ Activator.save(IGNORED_RELEASES, ignoredReleases);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class BuildStates extends HashMap<String, BuildState>
+ {
+ private static final long serialVersionUID = 2L;
+
+ public BuildStates()
+ {
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/BuildState.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/BuildState.java
index fe4002381c..9f895343c8 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/BuildState.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/BuildState.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.releng.internal.version;
import org.eclipse.emf.cdo.releng.version.IBuildState;
+import org.eclipse.emf.cdo.releng.version.VersionUtil;
import java.io.Serializable;
import java.util.HashMap;
@@ -24,6 +25,8 @@ public class BuildState implements IBuildState, Serializable
{
private static final long serialVersionUID = 1L;
+ private Map<String, String> arguments;
+
private byte[] releaseSpecDigest;
private long propertiesTimeStamp;
@@ -38,14 +41,28 @@ public class BuildState implements IBuildState, Serializable
private long validatorTimeStamp;
- private Serializable validatorState;
+ private String validatorClass;
- private Map<String, String> arguments;
+ private String validatorVersion;
+
+ private byte[] validatorBytes;
+
+ private transient Serializable validatorState;
BuildState()
{
}
+ public Map<String, String> getArguments()
+ {
+ return arguments == null ? new HashMap<String, String>() : arguments;
+ }
+
+ public void setArguments(Map<String, String> arguments)
+ {
+ this.arguments = arguments;
+ }
+
public byte[] getReleaseSpecDigest()
{
return releaseSpecDigest;
@@ -106,6 +123,26 @@ public class BuildState implements IBuildState, Serializable
this.validatorTimeStamp = validatorTimeStamp;
}
+ public String getValidatorClass()
+ {
+ return validatorClass;
+ }
+
+ public void setValidatorClass(String validatorClass)
+ {
+ this.validatorClass = validatorClass;
+ }
+
+ public String getValidatorVersion()
+ {
+ return validatorVersion;
+ }
+
+ public void setValidatorVersion(String validatorVersion)
+ {
+ this.validatorVersion = validatorVersion;
+ }
+
public boolean isChangedSinceRelease()
{
return changedSinceRelease;
@@ -118,21 +155,28 @@ public class BuildState implements IBuildState, Serializable
public Serializable getValidatorState()
{
+ if (validatorState == null)
+ {
+ if (validatorBytes != null)
+ {
+ validatorState = VersionUtil.deserialize(validatorBytes);
+ }
+ }
+
return validatorState;
}
public void setValidatorState(Serializable validatorState)
{
this.validatorState = validatorState;
+ validatorBytes = null;
}
- public Map<String, String> getArguments()
- {
- return arguments == null ? new HashMap<String, String>() : arguments;
- }
-
- public void setArguments(Map<String, String> arguments)
+ void serializeValidatorState()
{
- this.arguments = arguments;
+ if (validatorBytes == null && validatorState != null)
+ {
+ validatorBytes = VersionUtil.serialize(validatorState);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/VersionBuilder.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/VersionBuilder.java
index 967cc1d90c..72647bb90f 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/VersionBuilder.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/internal/version/VersionBuilder.java
@@ -155,6 +155,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
references = new HashSet<IElement>();
elementReferences.put(child, references);
}
+
references.add(element);
}
}
@@ -184,8 +185,15 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
@Override
protected final IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException
{
- arguments = new VersionBuilderArguments(args);
List<IProject> buildDpependencies = new ArrayList<IProject>();
+ build(kind, args, monitor, buildDpependencies);
+ return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ }
+
+ private void build(int kind, Map<String, String> args, IProgressMonitor monitor, List<IProject> buildDpependencies)
+ throws CoreException
+ {
+ arguments = new VersionBuilderArguments(args);
VersionValidator validator = null;
IProject project = getProject();
@@ -209,12 +217,13 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
}
BuildState buildState = Activator.getBuildState(project);
+ byte[] releaseSpecDigest = buildState.getReleaseSpecDigest();
+
VersionBuilderArguments oldVersionBuilderArguments = new VersionBuilderArguments(buildState.getArguments());
buildState.setArguments(arguments);
- byte[] releaseSpecDigest = buildState.getReleaseSpecDigest();
- final boolean fullBuild = releaseSpecDigest == null || kind == FULL_BUILD || kind == CLEAN_BUILD
- || !oldVersionBuilderArguments.equals(arguments);
- IResourceDelta delta = fullBuild ? null : getDelta(project);
+
+ IResourceDelta delta = releaseSpecDigest == null || kind == FULL_BUILD || kind == CLEAN_BUILD
+ || !oldVersionBuilderArguments.equals(arguments) ? null : getDelta(project);
monitor.beginTask("", 1);
monitor.subTask("Checking version validity of " + project.getName());
@@ -222,6 +231,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
try
{
IModel componentModel = VersionUtil.getComponentModel(project);
+
/*
* Determine release data to validate against
*/
@@ -231,12 +241,12 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
{
String msg = "Path to release spec file is not configured";
Markers.addMarker(projectDescription, msg, IMarker.SEVERITY_ERROR, "(" + VersionUtil.BUILDER_ID + ")");
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
if (Activator.getIgnoredReleases().contains(releasePathArg))
{
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
IPath releasePath = new Path(releasePathArg);
@@ -276,7 +286,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
marker.setAttribute(Markers.PROBLEM_TYPE, Markers.RELEASE_PATH_PROBLEM);
}
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
/*
@@ -386,7 +396,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
if (hasAPIToolsMarker((IPluginModelBase)componentModel))
{
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
}
else
@@ -410,7 +420,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
{
if (checkMalformedVersions(componentModel))
{
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
}
}
@@ -427,7 +437,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
System.out.println("Project has not been released: " + project.getName());
}
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
Markers.deleteAllMarkers(componentModelFile, Markers.VERSION_NATURE_PROBLEM);
@@ -484,7 +494,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
if (element.getType() == IElement.Type.PLUGIN)
{
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
}
@@ -492,7 +502,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
{
addVersionMarker(componentModelFile, "Version has been decreased after release " + releaseVersion,
releaseVersion);
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
if (element.getType() == IElement.Type.FEATURE)
@@ -509,7 +519,7 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
if (!problems.isEmpty())
{
createMarkers(componentModelFile, problems, ComponentReferenceType.UNRESOLVED);
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
ComponentReferenceType change = checkFeatureContentChanges(element, releaseElement, problems);
@@ -529,19 +539,19 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
createMarkers(componentModelFile, problems, change);
}
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
if (!elementVersion.equals(releaseVersion))
{
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
}
}
if (microVersionProperlyIncreased)
{
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
}
/*
@@ -576,9 +586,20 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
marker.setAttribute(Markers.PROBLEM_TYPE, Markers.VALIDATOR_CLASS_PROBLEM);
}
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
+ return;
+ }
+
+ String validatorVersion = validator.getVersion();
+ if (!VersionUtil.equals(validatorClassName, buildState.getValidatorClass())
+ || !VersionUtil.equals(validatorVersion, buildState.getValidatorVersion()))
+ {
+ buildState.setValidatorState(null);
+ delta = null;
}
+ buildState.setValidatorClass(validatorClassName);
+ buildState.setValidatorVersion(validatorVersion);
+
/*
* Do the validation
*/
@@ -614,8 +635,6 @@ public class VersionBuilder extends IncrementalProjectBuilder implements IElemen
release = null;
monitor.done();
}
-
- return buildDpependencies.toArray(new IProject[buildDpependencies.size()]);
}
private void createMarkers(IFile componentModelFile, List<Problem> problems, ComponentReferenceType change)
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java
index 02dfd2239d..6e89913e49 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionUtil.java
@@ -38,6 +38,8 @@ import org.eclipse.pde.core.plugin.PluginRegistry;
import org.osgi.framework.Version;
import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.CharArrayWriter;
import java.io.Closeable;
import java.io.File;
@@ -45,8 +47,11 @@ import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Reader;
+import java.io.Serializable;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
@@ -80,6 +85,39 @@ public final class VersionUtil
return o1.equals(o2);
}
+ public static byte[] serialize(Serializable object)
+ {
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ ObjectOutputStream stream = new ObjectOutputStream(baos);
+ stream.writeObject(object);
+ stream.flush();
+
+ return baos.toByteArray();
+ }
+ catch (Exception ex)
+ {
+ Activator.log(ex);
+ return null;
+ }
+ }
+
+ public static Serializable deserialize(byte[] bytes)
+ {
+ try
+ {
+ ObjectInputStream stream = new ObjectInputStream(new ByteArrayInputStream(bytes));
+ return (Serializable)stream.readObject();
+ }
+ catch (Exception ex)
+ {
+ Activator.log(ex);
+ return null;
+ }
+ }
+
public static Version normalize(Version version)
{
return new Version(version.getMajor(), version.getMinor(), version.getMicro());
diff --git a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionValidator.java b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionValidator.java
index 871927f35f..30ae45f58e 100644
--- a/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionValidator.java
+++ b/plugins/org.eclipse.emf.cdo.releng.version/src/org/eclipse/emf/cdo/releng/version/VersionValidator.java
@@ -20,12 +20,14 @@ import org.eclipse.pde.core.IModel;
*/
public abstract class VersionValidator
{
+ public abstract String getVersion();
+
+ public abstract void updateBuildState(IBuildState buildState, IRelease release, IProject project,
+ IResourceDelta delta, IModel componentModel, IProgressMonitor monitor) throws Exception;
+
public void abort(IBuildState buildState, IProject project, Exception exception, IProgressMonitor monitor)
throws Exception
{
buildState.setValidatorState(null);
}
-
- public abstract void updateBuildState(IBuildState buildState, IRelease release, IProject project,
- IResourceDelta delta, IModel componentModel, IProgressMonitor monitor) throws Exception;
}

Back to the top