diff options
author | Andrew M Finkbeiner | 2014-01-11 21:29:39 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2014-03-04 19:41:53 +0000 |
commit | ba0f2545684bb05bdc98268996f19604269f21ba (patch) | |
tree | 8ae9918487bd5f77d9b7496808458e248e73d730 /plugins | |
parent | fa6c42fceede3b8432771b3f58e086e9477e443c (diff) | |
download | org.eclipse.osee-ba0f2545684bb05bdc98268996f19604269f21ba.tar.gz org.eclipse.osee-ba0f2545684bb05bdc98268996f19604269f21ba.tar.xz org.eclipse.osee-ba0f2545684bb05bdc98268996f19604269f21ba.zip |
refinement: Clean up checksum return type
Diffstat (limited to 'plugins')
12 files changed, 20 insertions, 195 deletions
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BundleInfo.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BundleInfo.java index 889e4f59b14..eeed594d9a0 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BundleInfo.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BundleInfo.java @@ -32,7 +32,7 @@ public class BundleInfo { private final File file; private final Manifest manifest; private final boolean systemLibrary; - private byte[] md5Digest; + private String md5Digest; public BundleInfo(URL systemLocation, String bundleServerBaseLocation, boolean systemLibrary) throws IOException { File tmpFile; @@ -148,21 +148,23 @@ public class BundleInfo { /** * @return the md5Digest */ - public byte[] getMd5Digest() { + public String getMd5Digest() { // Do lazy calculation of this since it can be costly // and does not get read for all bundle info's if (md5Digest == null) { try { InputStream in = systemLocation.openStream(); - md5Digest = ChecksumUtil.createChecksum(in, "MD5"); + md5Digest = ChecksumUtil.createChecksumAsString(in, "MD5"); in.close(); } catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("Always expect MD5 to be available", ex); } catch (IOException ex) { throw new IllegalStateException("Always expect local jar file to be available", ex); - } + } catch (Exception e) { + e.printStackTrace(); + } } return md5Digest; } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java index 869bafef211..4ea2e5b01d2 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java @@ -447,11 +447,8 @@ public abstract class TestScript implements ITimeout { return testPointTally.getTestPointTotal(); } - public void addScriptSummary(Xmlizable xml) { - sciprtResultRecord.addChildElement(xml); - if (xml instanceof XmlizableStream) { - sciprtResultRecord.addChildElement((XmlizableStream) xml); - } + public void addScriptSummary(XmlizableStream xml) { + sciprtResultRecord.addChildElement((XmlizableStream) xml); } /** diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleDescription.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleDescription.java index bc7c46121dd..5fc37de69e8 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleDescription.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleDescription.java @@ -30,7 +30,7 @@ public class BundleDescription implements Serializable { private final URL location; private final boolean systemLibrary; private final byte[] manifestData; - private final byte[] md5Digest; + private final String md5Digest; private transient Manifest manifest; /** @@ -44,7 +44,7 @@ public class BundleDescription implements Serializable { this.md5Digest = null; } - public BundleDescription(URL systemLocation, URL serverLocation, Manifest manifest, boolean systemLibrary, byte[] md5Digest) { + public BundleDescription(URL systemLocation, URL serverLocation, Manifest manifest, boolean systemLibrary, String md5Digest) { if (systemLocation == null) { throw new IllegalArgumentException("systemLocation must not be null"); } @@ -119,7 +119,7 @@ public class BundleDescription implements Serializable { /** * @return the md5Digest */ - public byte[] getMd5Digest() { + public String getMd5Digest() { return md5Digest; } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java index 7e998e322bd..11b7a084cff 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java @@ -15,8 +15,6 @@ import java.rmi.RemoteException; import org.eclipse.osee.framework.messaging.Message; import org.eclipse.osee.ote.core.cmd.Command; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; -import org.eclipse.osee.ote.core.framework.command.ITestServerCommand; import org.eclipse.osee.ote.core.model.IModelManagerRemote; /** diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/OteUtil.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/OteUtil.java index 4ce1502b615..c900d78f20d 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/OteUtil.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/OteUtil.java @@ -12,7 +12,7 @@ package org.eclipse.osee.ote.core.environment.interfaces; public class OteUtil { - public static String generateBundleVersionString(String bundleSpecificVersion, String symbolicName, String version, byte[] md5) { + public static String generateBundleVersionString(String bundleSpecificVersion, String symbolicName, String version, String md5) { StringBuilder sb = new StringBuilder(); if (bundleSpecificVersion != null) { sb.append(bundleSpecificVersion); @@ -22,9 +22,7 @@ public class OteUtil { sb.append("_"); sb.append(version); sb.append("_"); - for (byte b : md5) { - sb.append(String.format("%X", b)); - } + sb.append(md5); return sb.toString(); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java index 1a108cb9a56..5558993368e 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java @@ -20,6 +20,7 @@ public enum RunTestsKeys { executablePathsArray, executableArg1Array, executableArg2Array, - spare1; + spare1, + batchmode; } diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java index 40bc5b8d4ee..e4fe4218693 100644 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java +++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java @@ -19,5 +19,4 @@ import org.eclipse.osee.ote.core.framework.command.ITestContext; public interface IMessageTestContext extends ITestContext { void resetScriptLoader(Configuration configuration, String[] strings) throws Exception; - void resetScriptLoader(String[] array) throws Exception; } diff --git a/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF index 00e1a28a5fe..d10e38f84a1 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Import-Package: javax.ws.rs, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.jdk.core.util.network, org.eclipse.osee.framework.logging, - org.eclipse.osee.framework.plugin.core.server + org.eclipse.osee.framework.plugin.core.server, + org.eclipse.osee.ote.core Export-Package: org.eclipse.osee.ote.rest.client Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime, diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java index bf46779b7b7..fab6836fc38 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java @@ -7,10 +7,9 @@ import java.util.List; import javax.ws.rs.core.MediaType; -import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.jdk.core.util.network.PortUtil; +import org.eclipse.osee.ote.core.BundleInfo; import org.eclipse.osee.ote.rest.client.Progress; -import org.eclipse.osee.ote.rest.client.internal.jarserver.BundleInfo; import org.eclipse.osee.ote.rest.client.internal.jarserver.HeadlessClassServer; import org.eclipse.osee.ote.rest.model.OTEConfiguration; import org.eclipse.osee.ote.rest.model.OTEConfigurationIdentity; diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/BundleInfo.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/BundleInfo.java deleted file mode 100644 index 829f0cf9c5c..00000000000 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/BundleInfo.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * 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: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.rest.client.internal.jarserver; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.NoSuchAlgorithmException; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil; - -/** - * @author Robert A. Fisher - */ -public class BundleInfo { - private final String symbolicName; - private final String version; - private final URL systemLocation; - private final URL bundleServerLocation; - private final File file; - private final Manifest manifest; - private final boolean systemLibrary; - private String md5Digest; - - public BundleInfo(URL systemLocation, String bundleServerBaseLocation, boolean systemLibrary) throws IOException { - File tmpFile; - try { - tmpFile = new File(systemLocation.toURI()); - } catch (URISyntaxException ex) { - tmpFile = new File(systemLocation.getPath()); - } - this.file = tmpFile; - - JarFile jarFile = new JarFile(file); - this.manifest = jarFile.getManifest(); - this.symbolicName = generateBundleName(manifest); - this.version = manifest.getMainAttributes().getValue("Bundle-Version"); - - this.systemLocation = systemLocation; - this.bundleServerLocation = new URL(bundleServerBaseLocation + symbolicName); - this.systemLibrary = systemLibrary; - this.md5Digest = null; - } - - public BundleInfo(URL systemLocation) throws IOException { - File tmpFile; - try { - tmpFile = new File(systemLocation.toURI()); - } catch (URISyntaxException ex) { - tmpFile = new File(systemLocation.getPath()); - } - this.file = tmpFile; - - JarFile jarFile = new JarFile(file); - this.manifest = jarFile.getManifest(); - this.symbolicName = generateBundleName(manifest); - this.version = manifest.getMainAttributes().getValue("Bundle-Version"); - - this.systemLocation = systemLocation; - this.bundleServerLocation = systemLocation; - this.systemLibrary = true; - this.md5Digest = null; - } - - /** - * @return the name of the bundle - */ - public static String generateBundleName(Manifest jarManifest) { - String nameEntry = jarManifest.getMainAttributes().getValue("Bundle-SymbolicName"); - if(nameEntry == null){ - return "unknown"; - } - // Sometimes there's a semicolon then extra info - ignore this - int index = nameEntry.indexOf(';'); - if (index != -1) { - nameEntry = nameEntry.substring(0, index); - } - - return nameEntry; - } - - /** - * @return the symbolicName - */ - public String getSymbolicName() { - return symbolicName; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @return the location - */ - public URL getSystemLocation() { - return systemLocation; - } - - /** - * @return the bundleServerLocation - */ - public URL getServerBundleLocation() { - return bundleServerLocation; - } - - /** - * @return the file - */ - public File getFile() { - return file; - } - - /** - * @return the manifest - */ - public Manifest getManifest() { - return manifest; - } - - @Override - public String toString() { - return getSymbolicName() + ":" + getVersion(); - } - - /** - * @return the systemLibrary - */ - public boolean isSystemLibrary() { - return systemLibrary; - } - - /** - * @return the md5Digest - */ - public String getMd5Digest() { - // Do lazy calculation of this since it can be costly - // and does not get read for all bundle info's - if (md5Digest == null) { - try { - InputStream in = systemLocation.openStream(); - - md5Digest = ChecksumUtil.createChecksumAsString(in, "MD5"); - - in.close(); - } catch (NoSuchAlgorithmException ex) { - throw new IllegalStateException("Always expect MD5 to be available", ex); - } catch (IOException ex) { - throw new IllegalStateException("Always expect local jar file to be available", ex); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return md5Digest; - } -} diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/BundleResourceFinder.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/BundleResourceFinder.java index 716d76b9ca1..6be5f190df4 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/BundleResourceFinder.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/BundleResourceFinder.java @@ -6,6 +6,7 @@ import java.util.List; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.plugin.core.server.ResourceFinder; +import org.eclipse.osee.ote.core.BundleInfo; public class BundleResourceFinder extends ResourceFinder { diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/HeadlessClassServer.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/HeadlessClassServer.java index 05c68a43a86..c6abf5c90d6 100644 --- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/HeadlessClassServer.java +++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/jarserver/HeadlessClassServer.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.plugin.core.server.ClassServer; +import org.eclipse.osee.ote.core.BundleInfo; |