diff options
author | Carsten Lund <lund@research.att.com> | 2017-05-02 02:10:36 +0000 |
---|---|---|
committer | Carsten Lund <lund@research.att.com> | 2017-05-02 02:10:36 +0000 |
commit | 0ab600d544b56a5f36fe378b72b33cce506f71fe (patch) | |
tree | a29a5d60ee0dfea68b35381962c8d4d3c98e6dcf | |
parent | 6ea507ecb55c3361ed56e8c59999cd16104a433e (diff) |
[DCAE-15] Changes related to version 1.1 (2)
Change-Id: I2f25a20cfb561188ad5838a75c6e3ff837b73886
Signed-off-by: Carsten Lund <lund@research.att.com>
13 files changed, 81 insertions, 16 deletions
diff --git a/ncomp-sirius-manager-camunda/pom.xml b/ncomp-sirius-manager-camunda/pom.xml index a910012..639b180 100644 --- a/ncomp-sirius-manager-camunda/pom.xml +++ b/ncomp-sirius-manager-camunda/pom.xml @@ -185,7 +185,7 @@ <url>${openecomp.nexus.snapshots}</url> </snapshotRepository> <site> - <id>dcae-javadoc</id> + <id>ecomp-site</id> <url>${site.url}</url> </site> </distributionManagement> diff --git a/ncomp-sirius-manager-model/META-INF/MANIFEST.MF b/ncomp-sirius-manager-model/META-INF/MANIFEST.MF index 27c85cf..3ff7289 100644 --- a/ncomp-sirius-manager-model/META-INF/MANIFEST.MF +++ b/ncomp-sirius-manager-model/META-INF/MANIFEST.MF @@ -30,7 +30,5 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.xtext.xbase.lib, org.eclipse.emf.ecore.xcore.lib, - ncomp-core-model;visibility:=reexport, - ncomp-sirius-manager-model;visibility:=reexport, org.eclipse.xtext;bundle-version="2.7.3" Bundle-ActivationPolicy: lazy diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiTreeUtil.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiTreeUtil.java index 4f568b1..e774d55 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiTreeUtil.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiTreeUtil.java @@ -116,9 +116,11 @@ public class GuiTreeUtil { GuiTreeNode n = (GuiTreeNode) o; l = n.getChildren(); } - for (GuiTreeNode n : l) { - if (name.equals(n.getNodeName())) - return find(n,path,i+1,create); + if ( l != null) { + for (GuiTreeNode n : l) { + if (name.equals(n.getNodeName())) + return find(n,path,i+1,create); + } } if (create) { GuiTreeNode n1 = f.createGuiTreeNode(); diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/AbstractClient.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/AbstractClient.java index 782c32b..1f596d3 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/AbstractClient.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/AbstractClient.java @@ -132,14 +132,21 @@ public abstract class AbstractClient { // } public void create(String resourcePath, String json) { - create(resourcePath, new JSONObject(json)); + String clientVersion = getClientVersion(); + JSONObject json1 = new JSONObject(json); + ManagementServer.translateJson(json1, clientVersion); + create(resourcePath, json1); } public void create(String resourcePath, JSONObject json) { + String clientVersion = getClientVersion(); + ManagementServer.translateJson(json, clientVersion); httpJsonTransaction(resourcePath, "POST", null, json, null); } public void update(String resourcePath, JSONObject json) { + String clientVersion = getClientVersion(); + ManagementServer.translateJson(json, clientVersion); httpJsonTransaction(resourcePath, "PUT", null, json, null); } @@ -148,14 +155,20 @@ public abstract class AbstractClient { } public JSONObject method(String resourcePath, String method, JSONObject json) { + String clientVersion = getClientVersion(); + ManagementServer.translateJson(json, clientVersion); return httpJsonTransaction(resourcePath, method, null, json, null); } public byte[] methodAsBinary(String resourcePath, String method, JSONObject json) { + String clientVersion = getClientVersion(); + ManagementServer.translateJson(json, clientVersion); return httpBinaryTransaction(resourcePath, method, null, json, null); } public String methodAsString(String resourcePath, String method, JSONObject json) { + String clientVersion = getClientVersion(); + ManagementServer.translateJson(json, clientVersion); return httpStringTransaction(resourcePath, method, null, json, null); } diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java index de5a80f..59dfeb3 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java @@ -74,6 +74,25 @@ public class JavaHttpClient extends AbstractClient { return s; } + public static String decryptEmbeddedPassword(String s) { + if (s == null) return s; + int i1 = s.indexOf("rsa:::"); + int i2 = s.indexOf("rsa:::rsa:"); + int i3 = s.indexOf(":::rsa"); + int i4 = i1 + 6; + if (i2 < i1) { + i1 = i2; + i4 = i1 + 10; + } + if (i1 == -1) return s; + String pw = CryptoUtils.decryptPrivate(CryptoUtils.getKey("config/server.private"), s.substring(i4,i3)); + + if (s.startsWith("rsa:")) { + s = CryptoUtils.decryptPrivate(CryptoUtils.getKey("config/server.private"), s.substring(4)); + } + return decryptEmbeddedPassword(s.substring(0,i1) + pw + s.substring(i3+6)); + } + public byte[] httpBinaryTransaction(String path, String method, HashMap<String, String> headers, JSONObject body, Long timeout) { @@ -95,6 +114,7 @@ public class JavaHttpClient extends AbstractClient { } HttpURLConnection uc = null; InputStream is = null; + OutputStream os = null; boolean recordRequest = ecomplogger.isTargetSelf(); try { URL u = new URL(url); @@ -131,9 +151,10 @@ public class JavaHttpClient extends AbstractClient { uc.setRequestProperty("Content-Length", Integer.toString(rawbody.length)); uc.setFixedLengthStreamingMode(rawbody.length); uc.setDoOutput(true); - OutputStream os = uc.getOutputStream(); + os = uc.getOutputStream(); os.write(rawbody); os.close(); + os = null; if (debug) System.err.println("HTTP REQUEST boby: " + body); } @@ -182,6 +203,12 @@ public class JavaHttpClient extends AbstractClient { } catch (IOException e) { } } + if (os != null) { + try { + os.close(); + } catch (IOException e) { + } + } if (uc != null) { uc.disconnect(); } diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/Jetty8Server.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/Jetty8Server.java index 5566162..45e3c68 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/Jetty8Server.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/Jetty8Server.java @@ -360,6 +360,8 @@ public class Jetty8Server { try { s1 = B64Code.decode(a[1], StringUtil.__ISO_8859_1); } catch (UnsupportedEncodingException e) { + logger.warn("Authorization failed: Bad header:" + e); + return null; } int i = s1.indexOf(":"); if (i == -1) { diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java index 3fc8140..a2aa2d9 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java @@ -88,6 +88,7 @@ import org.openecomp.ncomp.sirius.manager.properties.PropertyManager; import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer; import org.openecomp.ncomp.sirius.manager.server.LoggerInfo; import org.openecomp.ncomp.sirius.manager.server.ServerFactory; +import org.openecomp.ncomp.sirius.manager.server.ServerPackage; import org.openecomp.ncomp.sirius.manager.server.VersionConfiguration; import org.openecomp.ncomp.utils.PropertyUtil; import org.openecomp.ncomp.utils.SortUtil; @@ -142,6 +143,7 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge if (version != null) return; System.err.println("VVVVVV setupVersionHandler: " + directory); try { + ServerPackage.eINSTANCE.toString(); v = (VersionConfiguration) loadObjectFromDirectory(ServerFactory.eINSTANCE, "VersionConfiguration", directory, false, null); } catch (IOException e1) { e1.printStackTrace(); @@ -2266,6 +2268,11 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge } } } + + public static JSONObject translateJson(JSONObject json, String outVersion) { + if (versionHandler == null) return json; + return versionHandler.translateJsonObject(json,version,outVersion); + } public static JSONObject params2json(EOperation operation, Object[] params, String outVersion) { if (params.length != operation.getEParameters().size()) { diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ModuleReporter.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ModuleReporter.java index f68a7e6..5895e65 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ModuleReporter.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ModuleReporter.java @@ -21,6 +21,7 @@ package org.openecomp.ncomp.sirius.manager;
+import java.io.IOException; import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -108,7 +109,7 @@ public class ModuleReporter implements Runnable { }
}
private String version() {
- InputStream inputStream;
+ InputStream inputStream = null;
if (jarName == null && file == null && command == null) {
if (parent == null || parent.props == null)
return "unable to determine version for " + name + " no parent information";
@@ -132,11 +133,19 @@ public class ModuleReporter implements Runnable { props = new Properties();
try {
props.load(inputStream);
- inputStream.close();
} catch (Exception e) {
logger.warn("No build info for module: " + name);
ManagementServerUtils.printStackTrace(e);
return "unable to determine version for " + name;
+ } + finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } }
return StringUtil.expandUsingProperties(version, props, "$");
}
diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/SimpleVersionHandler.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/SimpleVersionHandler.java index 705aaa5..2cea86e 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/SimpleVersionHandler.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/SimpleVersionHandler.java @@ -36,6 +36,9 @@ public class SimpleVersionHandler implements IVersionConverterHandler { if (toCurrent == null) { throw new RuntimeException("Unable to translate between versions: " + version1 + " -> " + version2); } + if (v == null) { + throw new RuntimeException("Unable to translate between versions no version info: " + version1 + " -> " + version2); + } for (VersionTranslationStep step : v.getSteps()) { if (step instanceof AttributeTranslationStep) { AttributeTranslationStep s = (AttributeTranslationStep) step; diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/logs/LogMessageStore.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/logs/LogMessageStore.java index 2d1c10d..0a1fe7e 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/logs/LogMessageStore.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/logs/LogMessageStore.java @@ -33,12 +33,16 @@ import org.eclipse.emf.common.util.EList; import org.openecomp.ncomp.core.logs.LogMessage;
import org.openecomp.ncomp.utils.SortUtil;
import org.openecomp.ncomp.utils.journaling.JournalingDateObject;
+import org.openecomp.ncomp.utils.journaling.JournalingObject;
import org.openecomp.ncomp.utils.journaling.JournalingList;
import org.openecomp.ncomp.webservice.utils.DateUtils;
public class LogMessageStore {
JournalingDateObject<JournalingList<Message>> logs;
+ static { + JournalingObject.addClassToWhiteList("org.openecomp.ncomp.sirius.manager.logs.Message"); + } public LogMessageStore(String dir, String path) {
logs = new JournalingDateObject<JournalingList<Message>>(dir, JournalingList.class);
}
diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/metrics/MetricStore.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/metrics/MetricStore.java index 3fd1b37..ab30048 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/metrics/MetricStore.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/metrics/MetricStore.java @@ -41,12 +41,16 @@ import org.openecomp.ncomp.sirius.manager.*; import org.openecomp.ncomp.utils.SortUtil; import org.openecomp.ncomp.utils.journaling.JournalingDateObject; import org.openecomp.ncomp.utils.journaling.JournalingHashMap; +import org.openecomp.ncomp.utils.journaling.JournalingObject;
import org.openecomp.ncomp.webservice.utils.DateUtils; import static org.openecomp.ncomp.sirius.manager.ManagementServerUtils.printStackTrace; public class MetricStore implements IMetricStore { public static final Logger logger = Logger.getLogger(MetricStore.class); + static { + JournalingObject.addClassToWhiteList("org.openecomp.ncomp.core.types.metrics.*"); + } JournalingDateObject<JournalingHashMap<MetricDailyMeasurement>> metrics; private EObject o; private MetricManager manager; diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/properties/MD5Checksum.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/properties/MD5Checksum.java index 43ee90b..f70f1ba 100644 --- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/properties/MD5Checksum.java +++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/properties/MD5Checksum.java @@ -50,7 +50,8 @@ public class MD5Checksum { } finally {
if (fis != null)
fis.close();
- }
+ } + if (complete == null) return random();
return bytes2hex(complete.digest());
} catch (Exception e) {
return random();
@@ -4,11 +4,6 @@ <artifactId>ncomp-sirius-manager</artifactId> <packaging>pom</packaging> - <properties> - <site.path>content/sites/site/org/openecomp/ncomp/sirius/manager/${project.artifactId}/${project.version}</site.path> - </properties> - - <modules> <module>ncomp-sirius-manager-base</module> <module>ncomp-sirius-manager-drools</module> |