diff options
Diffstat (limited to 'dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main')
43 files changed, 4856 insertions, 0 deletions
diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/cdap/adaptor/tools/Generator.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/cdap/adaptor/tools/Generator.java new file mode 100644 index 0000000..0174c12 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/cdap/adaptor/tools/Generator.java @@ -0,0 +1,107 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +package org.openecomp.dcae.controller.service.cdap.adaptor.tools;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.openecomp.dcae.controller.service.cdap.CdapFactory;
+import org.openecomp.dcae.controller.service.cdapmanager.CdapmanagerFactory;
+import org.openecomp.utils.YamlToJava;
+import org.openecomp.ncomp.gwt.siriusportal.model.ModelFactory;
+import org.openecomp.ncomp.sirius.manager.controllermodel.ControllerModel;
+import org.openecomp.ncomp.sirius.manager.controllermodel.ControllermodelFactory;
+import org.openecomp.ncomp.sirius.manager.generator.ControllerGenerator;
+import org.openecomp.ncomp.sirius.manager.server.ServerPackage;
+
+
+public class Generator {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ @SuppressWarnings("unused")
+ ServerPackage f = ServerPackage.eINSTANCE;
+ genService();
+ genManager();
+ }
+
+
+ public static void genManager() {
+ EObject o = CdapmanagerFactory.eINSTANCE.createCdapManager();
+ EPackage p = o.eClass().getEPackage();
+ String dir = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix();
+ dir = "src/main/sirius-gen/" + dir.replace('.', '/');
+ ControllerModel m = ControllermodelFactory.eINSTANCE.createControllerModel();
+ m.setTemplateDirectory("../../dcae-org.openecomp.ncomp.sirius.manager/ncomp-sirius-manager-generator/src/main/templates");
+ m.setPrefix("Dcae");
+ m.setPluginName(p.getNsURI());
+ m.setName("ControllerServiceCdapManager");
+ m.setTitle("ControllerServiceCdapManager");
+ ControllerGenerator g = new ControllerGenerator(o, m);
+ g.setEnableIRequestHandler(false);
+ g.setEnableISiriusPlugin(false);
+ g.addFactory("org.openecomp.ncomp.servers.cdap.CdapCdapFactory");
+ g.addFactory(CdapFactory.eINSTANCE);
+ EObject gui = ModelFactory.eINSTANCE.createGuiClientApi();
+ g.addObject("gui", gui, m);
+ g.generate(dir);
+ g.generateScripts("src/main/server-gen/bin", "controller-service-Cdap-manager");
+ String pName = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix() +".logging";
+// YamlToJava.convert("src/main/resources/DockerAdaptor.yaml", dir + "/logging", pName);
+ YamlToJava.convert("src/main/sirius-gen/CdapManager.yaml", dir + "/logging", pName);
+ String pName1 = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix() +".gui.logging";
+ YamlToJava.convert("src/main/sirius-gen/GuiClientApi.yaml", dir + "/gui/logging", pName1);
+ }
+
+ public static void genService() {
+ @SuppressWarnings("unused")
+ ServerPackage f = ServerPackage.eINSTANCE;
+ EObject o = CdapFactory.eINSTANCE.createCdapService();
+ EPackage p = o.eClass().getEPackage();
+ String dir = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix();
+ dir= "src/main/sirius-gen/" + dir.replace('.', '/');
+ ControllerModel m = ControllermodelFactory.eINSTANCE.createControllerModel();
+ m.setTemplateDirectory("../../dcae-org.openecomp.ncomp.sirius.manager/ncomp-sirius-manager-generator/src/main/templates");
+ m.setPrefix("Dcae");
+ m.setPluginName(p.getNsURI());
+ m.setName("CdapService");
+ m.setTitle("CdapService");
+ ControllerGenerator g = new ControllerGenerator(o,m);
+ g.setEnableIRequestHandler(false);
+ g.setEnableISiriusPlugin(true);
+// EObject gui = ModelFactory.eINSTANCE.createGuiClientApi();
+// g.addObject("gui",gui,m);
+ //EObject e = adaptorFactory.eINSTANCE.createVpnEnterprise();
+ //g.addApi("e",e,m);
+ //g.addFactory("org.openecomp.ncomp.sirius.servers.openstack.OsOpenstackFactory");
+ //g.enableDrools();
+ g.generate(dir);
+ g.generateScripts("src/main/server-gen/bin","controller-service-cdap-adaptor");
+ String pName = p.getNsURI().replaceAll(p.getNsPrefix()+'$',"") + "servers." + p.getNsPrefix() +".logging";
+// YamlToJava.convert("src/main/resources/DcaeServiceCdapHost.yaml", dir + "/logging", pName);
+ YamlToJava.convert("src/main/sirius-gen/CdapService.yaml", dir + "/logging", pName);
+ }
+
+
+}
diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceProvider.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceProvider.java new file mode 100644 index 0000000..8e802e1 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceProvider.java @@ -0,0 +1,593 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +package org.openecomp.dcae.controller.service.servers.cdap; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.json.JSONObject; + +import org.openecomp.dcae.controller.core.server.DcaeBasicServer; +import org.openecomp.dcae.controller.core.service.HealthTestResponse; +import org.openecomp.dcae.controller.core.service.HealthTestStatus; +import org.openecomp.dcae.controller.core.service.ServiceFactory; +import org.openecomp.dcae.controller.core.stream.DcaeStream; +import org.openecomp.dcae.controller.core.stream.DmaapStream; +import org.openecomp.dcae.controller.service.cdap.CdapApplication; +import org.openecomp.dcae.controller.service.cdap.CdapArtifact; +import org.openecomp.dcae.controller.service.cdap.CdapFactory; +import org.openecomp.dcae.controller.service.cdap.CdapInternalApplicationConfiguration; +import org.openecomp.dcae.controller.service.cdap.CdapService; +import org.openecomp.dcae.controller.service.cdap.CdapServiceInstance; +import org.openecomp.dcae.controller.service.cdap.cluster.servers.manager.DcaeCdapClusterManagerConsole; +import org.openecomp.dcae.controller.service.cdap.cluster.servers.service.DcaeCdapClusterService; +import org.openecomp.dcae.controller.service.cdap.cluster.servers.service.DcaeCdapClusterServiceProvider; +import org.openecomp.dcae.controller.service.cdap.cluster.service.CdapClusterServiceInstance; +import org.openecomp.ncomp.cdap.CdapEntityWithPreferences; +import org.openecomp.ncomp.cdap.CdapKeyPair; +import org.openecomp.ncomp.cdap.CdapNamespace; +import org.openecomp.ncomp.core.DeploymentStatus; +import org.openecomp.ncomp.core.NamedEntity; +import org.openecomp.ncomp.sirius.manager.AbstractClient; +import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.manager.JavaHttpClient; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.manager.ManagementServerUtils; +import org.openecomp.ncomp.sirius.manager.Subject; +import org.openecomp.ncomp.sirius.manager.metrics.MetricStore; +import org.openecomp.ncomp.utils.StringUtil; + +public class DcaeCdapServiceProvider extends BasicAdaptorProvider { + private static final Logger logger = Logger.getLogger(DcaeCdapServiceProvider.class); + CdapService o; + + public DcaeCdapServiceProvider(ISiriusServer controller, CdapService o) { + super(controller, o); + this.o = o; + } + + public void deploy(String instanceName, String containerPath) { + CdapServiceInstance i = findInstance(instanceName); + if (containerPath != null) { + Subject s = controller.getServer().find(containerPath); + if (s == null || s.o == null) { + throw new RuntimeException("Unable to find container object: " + containerPath); + } + if (!(s.o instanceof CdapClusterServiceInstance)) + throw new RuntimeException("Unable to deploy to this container: " + s.o); + i.setClusterService((CdapClusterServiceInstance) s.o); + } + i.setCdapName(cdapName(i)); + DcaeCdapClusterManagerConsole console = consoleCluster(i); + // console.loadArtifact(i.getCdapNamespace().getName(), i.getName(), + // i.getJarFile()); + try { + console.createNamespace(i.getCdapName()); + } catch (Exception e1) { + logger.warn("reusing existing namespace"); + } + try { + for (CdapArtifact a : i.getArtifacts()) { + if (a.getVersion() != null) + console.loadArtifact(i.getCdapName(), a.getName(), a.getJarFile(), a.getVersion()); + console.deployApp(i.getCdapName(), a.getJarFile()); + } + for (CdapApplication a : i.getApps()) { +// System.err.println("CDAP: start app 1"); + console.loadArtifact(i.getCdapName(), a.getArtifactName(), a.getJarFile(), a.getVersion()); +// System.err.println("CDAP: start app 2"); + if (a.getAppConfigFileContent() == null) + console.createApp(i.getCdapName(), a.getName(), a.getArtifactName(), a.getVersion(), "user"); + else + console.createAppWithConfig(i.getCdapName(), a.getName(), a.getArtifactName(), a.getVersion(), "user", + a.getAppConfigFileContent()); +// System.err.println("CDAP: start app 3"); + } + } catch (Exception e) { + logger.warn("unable to start CDAP app: " + ManagementServer.object2ref(i)); + e.printStackTrace(); + throw new RuntimeException("Unable to start CDAP app: " + ManagementServer.object2ref(i) + " " + e); + } + o.pushManagerConfiguration(instanceName); + } + + public void undeploy(String instanceName) { + CdapServiceInstance i = findInstance(instanceName); + DcaeCdapClusterManagerConsole console = consoleCluster(i); + if (i.getCdapName() == null) { + i.setCdapName(cdapName(i)); + } + for (String f : i.getFlowNames()) { + String[] a = f.split("\\."); + if (a.length != 2) + throw new RuntimeException("Bad flow name: " + f); + try { + console.stopFlow(i.getCdapName(), a[0], a[1]); + } catch (Exception e) { + e.printStackTrace(); + } + } + for (String a : i.getAppNames()) { + try { + console.stopApp(i.getCdapName(), a); + } catch (Exception e) { + e.printStackTrace(); + } + } + for (CdapArtifact a : i.getArtifacts()) { + try { +// console.stopApp(i.getCdapName(), a.getName()); + console.deleteApp(i.getCdapName(), a.getName()); + if (a.getVersion() != null) { + console.deleteArtifact(i.getCdapName(), a.getName(), a.getVersion()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + for (CdapApplication a : i.getApps()) { + try { + console.stopApp(i.getCdapName(), a.getName()); + console.deleteApp(i.getCdapName(), a.getName()); + console.deleteArtifact(i.getCdapName(), a.getArtifactName(), a.getVersion()); + } catch (Exception e) { + e.printStackTrace(); + } + } +// console.deleteNamespace(i.getCdapName()); + } + + public void pushManagerConfiguration(String instanceName) { + CdapServiceInstance i = findInstance(instanceName); + o.updateInstanceConfiguration(instanceName); + DcaeCdapClusterManagerConsole console = consoleCluster(i); + for (CdapArtifact a : i.getArtifacts()) { + try { + console.stopApp(i.getCdapName(), a.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + } + for (CdapApplication a : i.getApps()) { + try { + console.stopApp(i.getCdapName(), a.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + } + for (String f : i.getFlowNames()) { + String[] a = f.split("\\."); + if (a.length != 2) + throw new RuntimeException("Bad flow name: " + f); + try { + console.stopFlow(i.getCdapName(), a[0], a[1]); + } catch (Exception e) { + e.printStackTrace(); + } + } + for (String w : i.getWorkerNames()) { + String[] a = w.split("\\."); + if (a.length != 2) + throw new RuntimeException("Bad worker name: " + w); + try { + console.stopWorker(i.getCdapName(), a[0], a[1]); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + for (String s : i.getServiceNames()) { + String[] a = s.split("\\."); + if (a.length != 2) + throw new RuntimeException("Bad service name: " + s); + try { + console.stopService(i.getCdapName(), a[0], a[1]); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + console.setPreferencesNameSpace(i.getCdapName(), list2string(i.getCdapConfiguration().getPreferences())); + for (CdapEntityWithPreferences w : i.getCdapConfiguration().getWorkers()) { + if (w.getPreferences().size() == 0) + continue; + String[] a = w.getName().split("\\.");if (a.length != 2) + throw new RuntimeException("Bad worker name: " + w.getName()); + console.setPreferencesWorker(i.getCdapName(), list2string(w.getPreferences()),a[0],a[1]); + } + for (CdapEntityWithPreferences s : i.getCdapConfiguration().getServices()) { + if (s.getPreferences().size() == 0) + continue; + String[] a = s.getName().split("\\.");if (a.length != 2) + throw new RuntimeException("Bad service name: " + s.getName()); + console.setPreferencesService(i.getCdapName(), list2string(s.getPreferences()),a[0],a[1]); + } + for (CdapEntityWithPreferences f : i.getCdapConfiguration().getFlows()) { + if (f.getPreferences().size() == 0) + continue; + String[] a = f.getName().split("\\.");if (a.length != 2) + throw new RuntimeException("Bad flow name: " + f.getName()); + console.setPreferencesFlow(i.getCdapName(), list2string(f.getPreferences()), a[0],a[1]); + } + for (CdapEntityWithPreferences a : i.getCdapConfiguration().getApps()) { + if (a.getPreferences().size() == 0) + continue; + console.setPreferencesApp(i.getCdapName(), list2string(a.getPreferences()), a.getName()); + } + // TODO what should we do. ?? + for (String f : i.getFlowNames()) { + String[] a = f.split("\\."); + if (a.length != 2) + throw new RuntimeException("Bad flow name: " + f); + console.startFlow(i.getCdapName(), a[0], a[1], null); + } + for (String w : i.getWorkerNames()) { + String[] a = w.split("\\."); + if (a.length != 2) + throw new RuntimeException("Bad worker name: " + w); + console.startWorker(i.getCdapName(), a[0], a[1], null); + } + for (String s : i.getServiceNames()) { + String[] a = s.split("\\."); + if (a.length != 2) + throw new RuntimeException("Bad service name: " + s); + console.startService(i.getCdapName(), a[0], a[1], null); + } + for (CdapArtifact a : i.getArtifacts()) { + try { + console.startApp(i.getCdapName(), a.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + } + for (CdapApplication a : i.getApps()) { + try { + console.startApp(i.getCdapName(), a.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + public void pollManagerConfiguration(String instanceName) { + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public EObject managerConfiguration(String instanceName) { + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public JSONObject managerOperation(String instanceName, String operation, JSONObject parameters) { + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void updateConfigurationFromPolicy(String instanceName) { + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public HealthTestResponse test(String instanceName) { + CdapServiceInstance i = findInstance(instanceName); + HealthTestResponse res = ServiceFactory.eINSTANCE.createHealthTestResponse(); + + // simple check. Verify that namespace exists in cluster. + + CdapClusterServiceInstance s = i.getClusterService(); + if (s.getStatus() != DeploymentStatus.DEPLOYED) { + res.setStatus(HealthTestStatus.YELLOW); + res.setMessageCode("Cluster not deployed"); + return res; + } + if (s.getCluster() == null) { + res.setStatus(HealthTestStatus.RED); + res.setMessageCode("No Cluster"); + return res; + } + if (i.getNamespace() == null) { + res.setStatus(HealthTestStatus.RED); + res.setMessageCode("No Namepace for instance"); + return res; + } + for (CdapNamespace n : s.getCluster().getNamespaces()) { + if (i.getNamespace().equals(n.getName())) { + res.setStatus(HealthTestStatus.GREEN); + return res; + } + } + res.setStatus(HealthTestStatus.YELLOW); + res.setMessageCode("Not deployed"); + return res; + } + + public void resume(String instanceName) { + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void suspend(String instanceName) { + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void runHealthTests() { + for (CdapServiceInstance i : o.getInstances()) { + HealthTestResponse h = null; + try { + h = o.test(i.getName()); + } catch (Exception e) { + h = ServiceFactory.eINSTANCE.createHealthTestResponse(); + h.setMessageCode("Unable to determine health: " + e); + h.setStatus(HealthTestStatus.RED); + } + i.setHealthTestStatus(h.getStatus()); + i.setHealthTestMessageCode(h.getMessageCode()); + MetricStore store = controller.getServer().metrics.getStore(i); + Date now = new Date(); + String path = "/lastHealthTest"; + store.addLongValue(path, now, now.getTime(), "DateMetricAttribute", false); + } + + } + + public void updateInstanceConfiguration(String instanceName) { + CdapServiceInstance i = findInstance(instanceName); + CdapInternalApplicationConfiguration a = CdapFactory.eINSTANCE.createCdapInternalApplicationConfiguration(); + for (DcaeStream in : i.getInputStreams()) { + if (in instanceof DmaapStream) { + updateConfigSimple(i, in, "namespace-prefs::dmaap.in." + in.getName() + ".${attrName}", a); + } + } + for (DcaeStream in : i.getOutputStreams()) { + if (in instanceof DmaapStream) { + updateConfigSimple(i, in, "namespace-prefs::dmaap.out." + in.getName() + ".${attrName}", a); + } + } + updateConfig(i, i, a); + i.setCdapConfiguration(a); + } + + private String cdapName(CdapServiceInstance i) { +// String n = "dcae:" + o.getName() + ":" + i.getName(); + // return n.replace("-", "X").replace(":", "Y"); + return i.getNamespace(); + // return "dcae"+ new Date().getTime(); + } + + private DcaeCdapClusterManagerConsole consoleCluster(CdapServiceInstance i) { + CdapClusterServiceInstance instance = i.getClusterService(); + // need to assign the leader + EList<DcaeBasicServer> l = instance.getServers(); + instance.setLeaderServer(l.get(l.size() - 1)); + DcaeCdapClusterService service = (DcaeCdapClusterService) instance.getService(); + DcaeCdapClusterServiceProvider provider = service.getSomfProvider(); + AbstractClient c = provider.getClient(instance); + return new DcaeCdapClusterManagerConsole(c); + } + + private String list2string(EList<CdapKeyPair> l) { + StringBuffer buf = new StringBuffer(); + boolean first = true; + for (CdapKeyPair p : l) { + if (p.getValue() == null) + continue; + if (!first) + buf.append(" "); + first = false; + // dmaap.XX.dmaapPassword + if (p.getName().startsWith("dmaap") && p.getName().endsWith("dmaapPassword")) { + String pw = p.getValue(); + if (! pw.startsWith("rsa:")) { +// System.err.println("ZZZZZ: unencrypted pw: " + ManagementServer.object2ref(p)); + } + try { + pw = JavaHttpClient.decryptPassword(pw); + } catch (Exception e) { +// System.err.println("ZZZZZ: badly encrypted password: " + ManagementServer.object2ref(p)); + pw = "badly encrypted password"; + } + buf.append(p.getName()).append("=").append(pw); + } + else { + String v = p.getValue(); + if (v.startsWith("rsa:")) { + try { + v = JavaHttpClient.decryptPassword(v); + } catch (Exception e) { + v = "badly encrypted password"; + } + } + buf.append(p.getName()).append("=").append(v); + } + } + return buf.toString(); + } + + protected CdapServiceInstance findInstance(String instanceName) { + for (CdapServiceInstance ii : o.getInstances()) { + if (ii.getName().equals(instanceName)) { + return ii; + } + } + throw new RuntimeException("Unable to find instance: " + instanceName); + } + + private void updateConfigSimple(EObject root, EObject i, String destination, CdapInternalApplicationConfiguration a) { + if (i == null) + return; + for (EAttribute attr : i.eClass().getEAllAttributes()) { + add(root, i, attr, destination, a); + } + } + + private void updateConfig(EObject root, EObject i, CdapInternalApplicationConfiguration appConfig) { + if (i == null) + return; + for (EAttribute attr : i.eClass().getEAllAttributes()) { + EAnnotation anno = attr.getEAnnotation("http://openecomp.org/cdap"); + if (anno == null) + continue; + String destination = anno.getDetails().get("destination"); +// System.err.println("AAAAA" + attr.getName() + " " + destination); + add(root, i, attr, destination, appConfig); + } + for (EReference ref : i.eClass().getEAllContainments()) { + if (ref.isMany()) { + @SuppressWarnings("unchecked") + EList<EObject> l = (EList<EObject>) i.eGet(ref); + for (EObject o : l) { + updateConfig(root, o, appConfig); + } + } else { + updateConfig(root, (EObject) i.eGet(ref), appConfig); + } + } +// System.err.println(ManagementServer.ecore2json(appConfig, 1000, null, true).toString(2)); + } + + private void add(EObject root, EObject i, EAttribute attr, String destination, CdapInternalApplicationConfiguration appConfig) { + // Make this more complex later + if (i instanceof NamedEntity) { + NamedEntity n = (NamedEntity) i; + if (n.getName() != null) + destination = destination.replace("${name}", n.getName()); + } + destination = destination.replace("${attrName}", attr.getName()); + String path1 = ManagementServer.object2ref(root); + String path2 = ManagementServer.object2ref(i); + String path = path2.replace("/", ".").substring(path1.length() + 1); + destination = destination.replace("${path}", path ); + String[] a = destination.split(":"); + if (a.length != 3) { + throw new RuntimeException("Bad CDAP destination annotation: " + destination); + } + if ("worker-prefs".equals(a[0])) { + add(root, appConfig.getWorkers(), a[1], a[2], i, attr); + } + if ("service-prefs".equals(a[0])) { + add(root, appConfig.getServices(), a[1], a[2], i, attr); + } + if ("flow-prefs".equals(a[0])) { + add(root, appConfig.getFlows(), a[1], a[2], i, attr); + } + if ("app-prefs".equals(a[0])) { + add(root, appConfig.getApps(), a[1], a[2], i, attr); + } + if ("namespace-prefs".equals(a[0])) { + add(root, appConfig.getPreferences(), a[2], i, attr); + } + } + + private org.openecomp.ncomp.cdap.CdapFactory f = org.openecomp.ncomp.cdap.CdapFactory.eINSTANCE; + + private void add(EObject root, EList<CdapEntityWithPreferences> l, String name, String cdapKey, EObject i, EAttribute attr) { + CdapEntityWithPreferences p = null; + for (CdapEntityWithPreferences p1 : l) { + if (p1.getName().equals(name)) { + p = p1; + break; + } + } + if (p == null) { + p = f.createCdapEntityWithPreferences(); + l.add(p); + p.setName(name); + } + add(root,p.getPreferences(), cdapKey, i, attr); + } + + private void add(EObject root, EList<CdapKeyPair> prefs, String cdapKey, EObject i, EAttribute attr) { + String value; + if (attr.isMany()) { + @SuppressWarnings("unchecked") + EList<Object> l = (EList<Object>) i.eGet(attr); + List<String> l2 = new ArrayList<String>(); + for (Object o : l) { + l2.add((String) ManagementServer.attr2jsonValue(0, o, attr.getEType())); + } + value = StringUtil.join(l2, ":"); + } + else + value = (String) ManagementServer.attr2jsonValue(0, i.eGet(attr), attr.getEType()); + CdapKeyPair pair = f.createCdapKeyPair(); + pair.setName(cdapKey); + pair.setValue(value); + prefs.add(pair); + } + + public void start() { + + Thread t = new Thread("cdap service: " + o.getName()) { + @Override + public void run() { + while (true) { + try { + if (!controller.getServer().isSlave) { + updateDeploymentStatus(); + } + Thread.sleep(60000); // sleep 60 seconds + } catch (Exception e) { + ManagementServerUtils.printStackTrace(e); + logger.fatal("vm service: " + o.getName() + " : " + e); + try { + Thread.sleep(30000); + } catch (InterruptedException e1) { + } + } + } + } + + }; + t.start(); + } + + public void updateDeploymentStatus() { +// System.out.println("CDAP updateDeploymentStatus 1: "); + for (CdapServiceInstance instance : o.getInstances()) { + // TODO Docker deployment status + instance.setStatus(DeploymentStatus.UNDEPLOYED); +// System.out.println("CDAP updateDeploymentStatus 2: " + instance.getName() + " " + instance.getNamespace()); + if (instance.getClusterService() == null) + continue; + for (CdapNamespace c : instance.getClusterService().getCluster().getNamespaces()) { +// System.out.println("CDAP updateDeploymentStatus 4: " + c.getName()); + if (instance.getNamespace() != null && instance.getNamespace().equals(c.getName())) { + instance.setStatus(DeploymentStatus.DEPLOYED); + } + } + } + } + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdap/gui/DcaeGuiClientApiProvider.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdap/gui/DcaeGuiClientApiProvider.java new file mode 100644 index 0000000..63e179c --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdap/gui/DcaeGuiClientApiProvider.java @@ -0,0 +1,78 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdap.gui; + + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + + + +import org.openecomp.ncomp.sirius.gui.tools.*; + + +import org.openecomp.ncomp.gwt.siriusportal.model.*; + + +import org.openecomp.ncomp.sirius.manager.Subject; + + +import org.openecomp.ncomp.sirius.manager.ManagementServer; + + +import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer; + + +import org.openecomp.ncomp.sirius.manager.BasicGuiClientApiProvider; + + +import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl; +import org.openecomp.ncomp.gwt.siriusportal.model.GuiClientApi; + + +public class DcaeGuiClientApiProvider extends BasicGuiClientApiProvider { + private static final Logger logger = Logger.getLogger(DcaeGuiClientApiProvider.class); + GuiClientApi o; + + public DcaeGuiClientApiProvider(ISiriusServer controller, GuiClientApi o) { + super(controller, o); + this.o = o; + } + + + + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerProvider.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerProvider.java new file mode 100644 index 0000000..22f56ee --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerProvider.java @@ -0,0 +1,99 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager; + + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + + + +import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider; + + +import org.openecomp.dcae.controller.service.cdapmanager.impl.CdapManagerImpl; +import org.openecomp.dcae.controller.service.cdapmanager.CdapManager; + + +public class DcaeCdapManagerProvider extends BasicAdaptorProvider { + private static final Logger logger = Logger.getLogger(DcaeCdapManagerProvider.class); + CdapManager o; + + public DcaeCdapManagerProvider(ISiriusServer controller, CdapManager o) { + super(controller, o); + this.o = o; + } + + public org.openecomp.dcae.controller.core.service.HealthTestResponse test() { + org.openecomp.dcae.controller.core.service.HealthTestResponse res = null; + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void suspend() { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void resume() { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public java.lang.String publicKey() { + java.lang.String res = null; + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void configurationChanged() { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + + + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiProvider.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiProvider.java new file mode 100644 index 0000000..89a06b3 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/java/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiProvider.java @@ -0,0 +1,78 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui; + + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + + + +import org.openecomp.ncomp.sirius.gui.tools.*; + + +import org.openecomp.ncomp.gwt.siriusportal.model.*; + + +import org.openecomp.ncomp.sirius.manager.Subject; + + +import org.openecomp.ncomp.sirius.manager.ManagementServer; + + +import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer; + + +import org.openecomp.ncomp.sirius.manager.BasicGuiClientApiProvider; + + +import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl; +import org.openecomp.ncomp.gwt.siriusportal.model.GuiClientApi; + + +public class DcaeGuiClientApiProvider extends BasicGuiClientApiProvider { + private static final Logger logger = Logger.getLogger(DcaeGuiClientApiProvider.class); + GuiClientApi o; + + public DcaeGuiClientApiProvider(ISiriusServer controller, GuiClientApi o) { + super(controller, o); + this.o = o; + } + + + + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server-gen/bin/controller-service-Cdap-manager-controller b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server-gen/bin/controller-service-Cdap-manager-controller new file mode 100644 index 0000000..58985bc --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server-gen/bin/controller-service-Cdap-manager-controller @@ -0,0 +1,138 @@ +#!/bin/bash + +# setup env if needed. java 6 required +## JAVA_HOME= + +############################## DO NOT EDIT BELOW ########################## + +SNAME="Dcae Controller" +PNAME=controller-service-Cdap-manager-controller +CLASS=org.openecomp.dcae.controller.service.servers.cdapmanager.DcaeCdapManagerServer + +############################## COMMON BELOW ########################## + +check_status () +{ + if [ -f "${_PIDFILE}" ]; then + _PID=`cat "${_PIDFILE}"` + check_status_of_pid $_PID + else + _STATUS="$SNAME (no pidfile) is NOT running" + _RUNNING=0 + fi +} + + +check_status_of_pid () +{ + if [ -n "$1" ] && kill -0 $1 2>/dev/null ; then + _STATUS="$SNAME (pid $1) is running" + _RUNNING=1 + else + _STATUS="$SNAME (pid $1) is NOT running" + _RUNNING=0 + fi +} + + +check_status_of_pid () +{ + if [ -n "$1" ] && kill -0 $1 2>/dev/null ; then + _STATUS="$SNAME (pid $1) is running" + _RUNNING=1 + else + _STATUS="$SNAME (pid $1) is NOT running" + _RUNNING=0 + fi +} + +remove_pid_file () +{ + if [ -f "${_PIDFILE}" ]; then + rm "${_PIDFILE}" + fi +} + + +_DIR=`dirname "$0"` +_DIR=`dirname "$_DIR"` + +_PIDFILE=$_DIR/PID + +CMD=$1 +shift + +check_status + +CP=$(find $_DIR/lib/*/* -name \*.jar 2>/dev/null | xargs -I X printf ":%s" X) + +JVMARGS=$(grep 'server.jvmargs' $_DIR/config/cdapmanager.properties | sed -e 's/.*=//') + +case $CMD in + status) + echo $_STATUS + exit 0 + ;; + console) + $GROOVY_HOME/bin/groovysh -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP + ;; + run) + $JAVA_HOME/bin/java -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@" + ;; + groovy) + $GROOVY_HOME/bin/groovy -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@" + ;; + start) + if [ "$_RUNNING" = "1" ]; then + echo $_STATUS + exit 0 + fi + mkdir -p $_DIR/logs + if [ -e $_DIR/logs/$PNAME.out.1 ]; then mv $_DIR/logs/$PNAME.out.1 $_DIR/logs/$PNAME.out.2; fi + if [ -e $_DIR/logs/$PNAME.err.1 ]; then mv $_DIR/logs/$PNAME.err.1 $_DIR/logs/$PNAME.err.2; fi + if [ -e $_DIR/logs/$PNAME.out ]; then mv $_DIR/logs/$PNAME.out $_DIR/logs/$PNAME.out.1; fi + if [ -e $_DIR/logs/$PNAME.err ]; then mv $_DIR/logs/$PNAME.err $_DIR/logs/$PNAME.err.1; fi + + nohup $JAVA_HOME/bin/java $JVMARGS -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@" $CLASS >> $_DIR/logs/$PNAME.out 2>> $_DIR/logs/$PNAME.err & + + _PID=$! + echo $_PID > $_PIDFILE + sleep 5 + check_status + echo $_STATUS + if [ "$_RUNNING" = "1" ]; then + exit 0 + else + echo "Failed to start - make sure the $SNAME is fully configured properly" + exit 1 + fi + ;; + stop) + if [ "$_RUNNING" = "0" ]; then + echo $_STATUS + remove_pid_file + exit 0 + fi + echo "Stopping $SNAME..." + _PID_TO_KILL=$_PID; + echo "$SNAME (pid=${_PID_TO_KILL}) is stopping..." + kill -TERM $_PID_TO_KILL + sleep 5 + check_status_of_pid $_PID_TO_KILL + if [ "$_RUNNING" = "1" ]; then + kill -TERM $_PID_TO_KILL + fi + while [ "$_RUNNING" = "1" ]; do + sleep 2 + check_status_of_pid $_PID_TO_KILL + done + remove_pid_file + echo "$SNAME has stopped." + exit 0 + ;; + *) + echo "$0 start|stop" + ;; +esac + + diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server-gen/bin/controller-service-cdap-adaptor-controller b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server-gen/bin/controller-service-cdap-adaptor-controller new file mode 100644 index 0000000..1aa26a7 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server-gen/bin/controller-service-cdap-adaptor-controller @@ -0,0 +1,138 @@ +#!/bin/bash + +# setup env if needed. java 6 required +## JAVA_HOME= + +############################## DO NOT EDIT BELOW ########################## + +SNAME="Dcae Controller" +PNAME=controller-service-cdap-adaptor-controller +CLASS=org.openecomp.dcae.controller.service.servers.cdap.DcaeCdapServiceServer + +############################## COMMON BELOW ########################## + +check_status () +{ + if [ -f "${_PIDFILE}" ]; then + _PID=`cat "${_PIDFILE}"` + check_status_of_pid $_PID + else + _STATUS="$SNAME (no pidfile) is NOT running" + _RUNNING=0 + fi +} + + +check_status_of_pid () +{ + if [ -n "$1" ] && kill -0 $1 2>/dev/null ; then + _STATUS="$SNAME (pid $1) is running" + _RUNNING=1 + else + _STATUS="$SNAME (pid $1) is NOT running" + _RUNNING=0 + fi +} + + +check_status_of_pid () +{ + if [ -n "$1" ] && kill -0 $1 2>/dev/null ; then + _STATUS="$SNAME (pid $1) is running" + _RUNNING=1 + else + _STATUS="$SNAME (pid $1) is NOT running" + _RUNNING=0 + fi +} + +remove_pid_file () +{ + if [ -f "${_PIDFILE}" ]; then + rm "${_PIDFILE}" + fi +} + + +_DIR=`dirname "$0"` +_DIR=`dirname "$_DIR"` + +_PIDFILE=$_DIR/PID + +CMD=$1 +shift + +check_status + +CP=$(find $_DIR/lib/*/* -name \*.jar 2>/dev/null | xargs -I X printf ":%s" X) + +JVMARGS=$(grep 'server.jvmargs' $_DIR/config/cdap.properties | sed -e 's/.*=//') + +case $CMD in + status) + echo $_STATUS + exit 0 + ;; + console) + $GROOVY_HOME/bin/groovysh -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP + ;; + run) + $JAVA_HOME/bin/java -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@" + ;; + groovy) + $GROOVY_HOME/bin/groovy -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@" + ;; + start) + if [ "$_RUNNING" = "1" ]; then + echo $_STATUS + exit 0 + fi + mkdir -p $_DIR/logs + if [ -e $_DIR/logs/$PNAME.out.1 ]; then mv $_DIR/logs/$PNAME.out.1 $_DIR/logs/$PNAME.out.2; fi + if [ -e $_DIR/logs/$PNAME.err.1 ]; then mv $_DIR/logs/$PNAME.err.1 $_DIR/logs/$PNAME.err.2; fi + if [ -e $_DIR/logs/$PNAME.out ]; then mv $_DIR/logs/$PNAME.out $_DIR/logs/$PNAME.out.1; fi + if [ -e $_DIR/logs/$PNAME.err ]; then mv $_DIR/logs/$PNAME.err $_DIR/logs/$PNAME.err.1; fi + + nohup $JAVA_HOME/bin/java $JVMARGS -cp $_DIR/config:$_DIR/lib:$_DIR/lib/\*:$CP "$@" $CLASS >> $_DIR/logs/$PNAME.out 2>> $_DIR/logs/$PNAME.err & + + _PID=$! + echo $_PID > $_PIDFILE + sleep 5 + check_status + echo $_STATUS + if [ "$_RUNNING" = "1" ]; then + exit 0 + else + echo "Failed to start - make sure the $SNAME is fully configured properly" + exit 1 + fi + ;; + stop) + if [ "$_RUNNING" = "0" ]; then + echo $_STATUS + remove_pid_file + exit 0 + fi + echo "Stopping $SNAME..." + _PID_TO_KILL=$_PID; + echo "$SNAME (pid=${_PID_TO_KILL}) is stopping..." + kill -TERM $_PID_TO_KILL + sleep 5 + check_status_of_pid $_PID_TO_KILL + if [ "$_RUNNING" = "1" ]; then + kill -TERM $_PID_TO_KILL + fi + while [ "$_RUNNING" = "1" ]; do + sleep 2 + check_status_of_pid $_PID_TO_KILL + done + remove_pid_file + echo "$SNAME has stopped." + exit 0 + ;; + *) + echo "$0 start|stop" + ;; +esac + + diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/adaptor.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/adaptor.properties new file mode 100644 index 0000000..4605389 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/adaptor.properties @@ -0,0 +1,7 @@ +server.dir = data/resources +metrics.dir = data/metrics +properties.dir = data/properties +server.port = PORT +server.user.console = CONSOLE_PW +server.user.gui = GUI_PW +server.user.client = CLIENT_PW diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/console.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/console.properties new file mode 100644 index 0000000..4b63607 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/console.properties @@ -0,0 +1,3 @@ +localhost.endpoint=http://localhost:PORT +localhost.user=console +localhost.password=CONSOLE_PW diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/gui.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/gui.properties new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/gui.properties diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/log4j.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/log4j.properties new file mode 100644 index 0000000..8b3b8f9 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/log4j.properties @@ -0,0 +1,24 @@ +#log4j.debug=0 +log4j.rootLogger=warn, file +log4j.logger.org.openecomp.ncomp=info, file +log4j.additivity.org.openecomp.ncomp=false +log4j.logger.org.openecomp.ncomp.datarouter=warn, file +log4j.additivity.org.openecomp.ncomp.datarouter=false +log4j.logger.org.apache.http.headers=debug, file +log4j.logger.org.apache.http.wire=debug, file + +## uploaded logger +log4j.logger.org.openecomp.ncomp.sirius.manager.uploaded=info, uploaded +log4j.additivity.org.openecomp.ncomp.sirius.manager.uploaded=false +## request logging +log4j.logger.org.openecomp.ncomp.sirius.manager.ManagementServer.requests=info, requests +log4j.additivity.org.openecomp.ncomp.sirius.manager.ManagementServer.requests=false + + +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=logs/BBBB.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d %5p [%t] %m %C:%L%n +log4j.appender.file.MaxFileSize=50MB +log4j.appender.file.MaxBackupIndex=5 + diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/makefile b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/makefile new file mode 100644 index 0000000..717823e --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/makefile @@ -0,0 +1,9 @@ + +restart: stop start + +start: + M2_HOME=/home/ncomp/.m2 bin/BBBB-controller start +stop: + bin/BBBB-controller stop +console: + bin/BBBB-controller console diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/pw.sh.sh b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/pw.sh.sh new file mode 100644 index 0000000..cd022ae --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/config/pw.sh.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +### used to generate random passwords + + +echo '#!/bin/bash' +echo "" + +echo 'cat \' + +for i in CONSOLE GUI CLIENT +do + echo ' |' sed s/${i}_PW/$(echo $i:$(date +%s) | sha256sum | base64 | head -c 20 ; echo)/ \\ +done +
\ No newline at end of file diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/scripts/console.groovy b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/scripts/console.groovy new file mode 100644 index 0000000..9bab61a --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/server/scripts/console.groovy @@ -0,0 +1,27 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +import org.openecomp.dcae.controller.service.servers.cdap.DcaeCdapServiceConsole +import org.openecomp.ncomp.sirius.manager.console.Utils + +adaptor = new DcaeCdapServiceConsole("console.properties","localhost") + +def p(x) { Utils.object2json(x).toString(2) } diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/CdapManager.yaml b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/CdapManager.yaml new file mode 100644 index 0000000..6ab6771 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/CdapManager.yaml @@ -0,0 +1,69 @@ +operations: + test: {} + suspend: {} + resume: {} + publicKey: {} + configurationChanged: {} + updateStreams: {} + REMOTE_test: + decription: Remote call test + REMOTE_suspend: + decription: Remote call suspend + REMOTE_resume: + decription: Remote call resume + REMOTE_publicKey: + decription: Remote call publicKey + REMOTE_configurationChanged: + decription: Remote call configurationChanged + REMOTE_updateStreams: + decription: Remote call updateStreams +messages: + dummy: {} + test: + errorCode: test-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + suspend: + errorCode: suspend-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + resume: + errorCode: resume-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + publicKey: + errorCode: publicKey-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + configurationChanged: + errorCode: configurationChanged-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + updateStreams: + errorCode: updateStreams-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + REMOTE_test: + errorCode: REMOTE-test-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_suspend: + errorCode: REMOTE-suspend-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_resume: + errorCode: REMOTE-resume-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_publicKey: + errorCode: REMOTE-publicKey-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_configurationChanged: + errorCode: REMOTE-configurationChanged-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_updateStreams: + errorCode: REMOTE-updateStreams-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/CdapService.yaml b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/CdapService.yaml new file mode 100644 index 0000000..1bb496e --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/CdapService.yaml @@ -0,0 +1,135 @@ +operations: + deploy: {} + undeploy: {} + test: {} + suspend: {} + resume: {} + pushManagerConfiguration: {} + pollManagerConfiguration: {} + managerConfiguration: {} + managerOperation: {} + updateConfigurationFromPolicy: {} + runHealthTests: {} + updateInstanceConfiguration: {} + REMOTE_deploy: + decription: Remote call deploy + REMOTE_undeploy: + decription: Remote call undeploy + REMOTE_test: + decription: Remote call test + REMOTE_suspend: + decription: Remote call suspend + REMOTE_resume: + decription: Remote call resume + REMOTE_pushManagerConfiguration: + decription: Remote call pushManagerConfiguration + REMOTE_pollManagerConfiguration: + decription: Remote call pollManagerConfiguration + REMOTE_managerConfiguration: + decription: Remote call managerConfiguration + REMOTE_managerOperation: + decription: Remote call managerOperation + REMOTE_updateConfigurationFromPolicy: + decription: Remote call updateConfigurationFromPolicy + REMOTE_runHealthTests: + decription: Remote call runHealthTests + REMOTE_updateInstanceConfiguration: + decription: Remote call updateInstanceConfiguration +messages: + dummy: {} + deploy: + errorCode: deploy-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + undeploy: + errorCode: undeploy-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + test: + errorCode: test-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + suspend: + errorCode: suspend-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + resume: + errorCode: resume-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + pushManagerConfiguration: + errorCode: pushManagerConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + pollManagerConfiguration: + errorCode: pollManagerConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + managerConfiguration: + errorCode: managerConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + managerOperation: + errorCode: managerOperation-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + updateConfigurationFromPolicy: + errorCode: updateConfigurationFromPolicy-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + runHealthTests: + errorCode: runHealthTests-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + updateInstanceConfiguration: + errorCode: updateInstanceConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + REMOTE_deploy: + errorCode: REMOTE-deploy-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_undeploy: + errorCode: REMOTE-undeploy-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_test: + errorCode: REMOTE-test-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_suspend: + errorCode: REMOTE-suspend-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_resume: + errorCode: REMOTE-resume-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_pushManagerConfiguration: + errorCode: REMOTE-pushManagerConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_pollManagerConfiguration: + errorCode: REMOTE-pollManagerConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_managerConfiguration: + errorCode: REMOTE-managerConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_managerOperation: + errorCode: REMOTE-managerOperation-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_updateConfigurationFromPolicy: + errorCode: REMOTE-updateConfigurationFromPolicy-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_runHealthTests: + errorCode: REMOTE-runHealthTests-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_updateInstanceConfiguration: + errorCode: REMOTE-updateInstanceConfiguration-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/GuiClientApi.yaml b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/GuiClientApi.yaml new file mode 100644 index 0000000..bf3d69d --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/GuiClientApi.yaml @@ -0,0 +1,69 @@ +operations: + getTree: {} + getObject: {} + getTimeSerie: {} + getTable: {} + getHtml: {} + getGraph: {} + REMOTE_getTree: + decription: Remote call getTree + REMOTE_getObject: + decription: Remote call getObject + REMOTE_getTimeSerie: + decription: Remote call getTimeSerie + REMOTE_getTable: + decription: Remote call getTable + REMOTE_getHtml: + decription: Remote call getHtml + REMOTE_getGraph: + decription: Remote call getGraph +messages: + dummy: {} + getTree: + errorCode: getTree-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + getObject: + errorCode: getObject-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + getTimeSerie: + errorCode: getTimeSerie-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + getTable: + errorCode: getTable-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + getHtml: + errorCode: getHtml-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + getGraph: + errorCode: getGraph-FAILED-5001W + messageFormat: '{0}' + description: Operation Failed with Exception + REMOTE_getTree: + errorCode: REMOTE-getTree-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_getObject: + errorCode: REMOTE-getObject-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_getTimeSerie: + errorCode: REMOTE-getTimeSerie-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_getTable: + errorCode: REMOTE-getTable-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_getHtml: + errorCode: REMOTE-getHtml-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception + REMOTE_getGraph: + errorCode: REMOTE-getGraph-FAILED-5001W + messageFormat: '{0}' + description: Remote Operation Failed with Exception diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapFactory.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapFactory.java new file mode 100644 index 0000000..ae21528 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapFactory.java @@ -0,0 +1,54 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdap; + +import org.eclipse.emf.ecore.EPackage; +import org.apache.log4j.Logger; + +import org.openecomp.ncomp.sirius.manager.ISiriusServer; + +import org.openecomp.dcae.controller.service.cdap.CdapService; +import org.openecomp.dcae.controller.service.cdap.CdapPackage; +import org.openecomp.dcae.controller.service.cdap.impl.CdapFactoryImpl; + + + + + +public class DcaeCdapFactory extends CdapFactoryImpl { + public static final Logger logger = Logger.getLogger(DcaeCdapFactory.class); + ISiriusServer server = null; + @Override + public EPackage getEPackage() { return CdapPackage.eINSTANCE; } + public DcaeCdapFactory(ISiriusServer server) { + this.server = server; + } + @Override + public CdapService createCdapService() { + return new DcaeCdapService(server); + } + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapService.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapService.java new file mode 100644 index 0000000..9d71a7e --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapService.java @@ -0,0 +1,408 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdap; + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; +import org.openecomp.ncomp.component.ApiRequestStatus; + +import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; + +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + +import java.util.Date; + +import org.openecomp.dcae.controller.service.servers.cdap.logging.CdapServiceOperationEnum; +import org.openecomp.dcae.controller.service.servers.cdap.logging.CdapServiceMessageEnum; + + + + +import org.openecomp.dcae.controller.service.cdap.impl.CdapServiceImpl; + + + +public class DcaeCdapService extends CdapServiceImpl implements ISiriusPlugin { + public static final Logger logger = Logger.getLogger(DcaeCdapService.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); + public DcaeCdapServiceProvider controller; + ISiriusServer server; + + public DcaeCdapService(ISiriusServer server) { + this.server = server; + this.controller = new DcaeCdapServiceProvider(server,this); + } + + public void updateInstanceConfiguration(java.lang.String instanceName) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "updateInstanceConfiguration", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.updateInstanceConfiguration); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.updateInstanceConfiguration(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "updateInstanceConfiguration", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.updateInstanceConfiguration, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "updateInstanceConfiguration", ApiRequestStatus.OKAY, duration_,instanceName); + + } + + public void deploy(java.lang.String instanceName, java.lang.String containerPath) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "deploy", ApiRequestStatus.START, duration_,instanceName,containerPath); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.deploy); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.deploy(instanceName,containerPath); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "deploy", ApiRequestStatus.ERROR, duration_,instanceName,containerPath); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.deploy, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "deploy", ApiRequestStatus.OKAY, duration_,instanceName,containerPath); + + } + + public void undeploy(java.lang.String instanceName) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "undeploy", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.undeploy); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.undeploy(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "undeploy", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.undeploy, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "undeploy", ApiRequestStatus.OKAY, duration_,instanceName); + + } + + public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) { + org.openecomp.dcae.controller.core.service.HealthTestResponse res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "test", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.test); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.test(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "test", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.test, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "test", ApiRequestStatus.OKAY, duration_,instanceName); + return res; + } + + public void suspend(java.lang.String instanceName) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.suspend); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.suspend(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.suspend, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.OKAY, duration_,instanceName); + + } + + public void resume(java.lang.String instanceName) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "resume", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.resume); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.resume(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "resume", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.resume, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "resume", ApiRequestStatus.OKAY, duration_,instanceName); + + } + + public void pushManagerConfiguration(java.lang.String instanceName) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "pushManagerConfiguration", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.pushManagerConfiguration); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.pushManagerConfiguration(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "pushManagerConfiguration", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.pushManagerConfiguration, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "pushManagerConfiguration", ApiRequestStatus.OKAY, duration_,instanceName); + + } + + public void pollManagerConfiguration(java.lang.String instanceName) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "pollManagerConfiguration", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.pollManagerConfiguration); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.pollManagerConfiguration(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "pollManagerConfiguration", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.pollManagerConfiguration, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "pollManagerConfiguration", ApiRequestStatus.OKAY, duration_,instanceName); + + } + + public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) { + org.eclipse.emf.ecore.EObject res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "managerConfiguration", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.managerConfiguration); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.managerConfiguration(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "managerConfiguration", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.managerConfiguration, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "managerConfiguration", ApiRequestStatus.OKAY, duration_,instanceName); + return res; + } + + public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) { + org.json.JSONObject res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "managerOperation", ApiRequestStatus.START, duration_,instanceName,operation,parameters); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.managerOperation); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.managerOperation(instanceName,operation,parameters); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "managerOperation", ApiRequestStatus.ERROR, duration_,instanceName,operation,parameters); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.managerOperation, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "managerOperation", ApiRequestStatus.OKAY, duration_,instanceName,operation,parameters); + return res; + } + + public void updateConfigurationFromPolicy(java.lang.String instanceName) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "updateConfigurationFromPolicy", ApiRequestStatus.START, duration_,instanceName); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.updateConfigurationFromPolicy); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.updateConfigurationFromPolicy(instanceName); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "updateConfigurationFromPolicy", ApiRequestStatus.ERROR, duration_,instanceName); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.updateConfigurationFromPolicy, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "updateConfigurationFromPolicy", ApiRequestStatus.OKAY, duration_,instanceName); + + } + + public void runHealthTests() { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "runHealthTests", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.runHealthTests); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.runHealthTests(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "runHealthTests", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapServiceMessageEnum.runHealthTests, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "runHealthTests", ApiRequestStatus.OKAY, duration_); + + } + + + + + + + @Override + public void start() { + controller.start(); + } + + public static void ecoreSetup() { + DcaeCdapServiceProvider.ecoreSetup(); + } + public DcaeCdapServiceProvider getSomfProvider() { + return controller; + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceClient.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceClient.java new file mode 100644 index 0000000..01afc0f --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceClient.java @@ -0,0 +1,276 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdap; + +import org.openecomp.ncomp.sirius.manager.AbstractClient; +import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient; +import org.openecomp.ncomp.sirius.manager.GenericHttpClient; + +import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +import org.openecomp.dcae.controller.service.cdap.impl.CdapServiceImpl; +import org.openecomp.dcae.controller.service.cdap.CdapPackage; +import org.openecomp.dcae.controller.service.servers.cdap.logging.CdapServiceOperationEnum; +import org.openecomp.dcae.controller.service.servers.cdap.logging.CdapServiceMessageEnum; + + + + + + +@SuppressWarnings("unchecked") +public class DcaeCdapServiceClient extends CdapServiceImpl { + public static final Logger logger = Logger.getLogger(DcaeCdapServiceClient.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); + public AbstractClient client; + + public DcaeCdapServiceClient(String file, String name) { + DcaeCdapService.ecoreSetup(); + client = new GenericHttpClient(file,name); + client.add("/resources", this); + } + + public DcaeCdapServiceClient(String file, String name1, String name2) { + HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2); + client = client1.all; // requests should be forwarded to all. + client.add("/resources", this); + } + + public DcaeCdapServiceClient(AbstractClient c) { + client = c; + client.add("/resources", this); + } + + + + @Override + public void updateInstanceConfiguration(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_updateInstanceConfiguration); + + try { + client.operationPath("/resources", c, "updateInstanceConfiguration", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_updateInstanceConfiguration, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@updateInstanceConfiguration: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void deploy(java.lang.String instanceName, java.lang.String containerPath) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_deploy); + + try { + client.operationPath("/resources", c, "deploy", null, instanceName,containerPath); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_deploy, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@deploy: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void undeploy(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_undeploy); + + try { + client.operationPath("/resources", c, "undeploy", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_undeploy, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@undeploy: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_test); + org.openecomp.dcae.controller.core.service.HealthTestResponse res; + try { + res = (org.openecomp.dcae.controller.core.service.HealthTestResponse) client.operationPath("/resources", c, "test", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_test, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@test: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public void suspend(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_suspend); + + try { + client.operationPath("/resources", c, "suspend", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_suspend, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@suspend: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void resume(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_resume); + + try { + client.operationPath("/resources", c, "resume", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_resume, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@resume: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void pushManagerConfiguration(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_pushManagerConfiguration); + + try { + client.operationPath("/resources", c, "pushManagerConfiguration", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_pushManagerConfiguration, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@pushManagerConfiguration: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void pollManagerConfiguration(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_pollManagerConfiguration); + + try { + client.operationPath("/resources", c, "pollManagerConfiguration", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_pollManagerConfiguration, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@pollManagerConfiguration: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_managerConfiguration); + org.eclipse.emf.ecore.EObject res; + try { + res = (org.eclipse.emf.ecore.EObject) client.operationPath("/resources", c, "managerConfiguration", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_managerConfiguration, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@managerConfiguration: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_managerOperation); + org.json.JSONObject res; + try { + res = (org.json.JSONObject) client.operationPath("/resources", c, "managerOperation", null, instanceName,operation,parameters); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_managerOperation, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@managerOperation: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public void updateConfigurationFromPolicy(java.lang.String instanceName) { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_updateConfigurationFromPolicy); + + try { + client.operationPath("/resources", c, "updateConfigurationFromPolicy", null, instanceName); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_updateConfigurationFromPolicy, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@updateConfigurationFromPolicy: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void runHealthTests() { + EClass c = CdapPackage.eINSTANCE.getCdapService(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapServiceOperationEnum.REMOTE_runHealthTests); + + try { + client.operationPath("/resources", c, "runHealthTests", null); + } + catch (Exception e) { + ecomplogger.warn(CdapServiceMessageEnum.REMOTE_runHealthTests, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@runHealthTests: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceConsole.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceConsole.java new file mode 100644 index 0000000..f6fe8f1 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceConsole.java @@ -0,0 +1,189 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit but extend this class as needed +package org.openecomp.dcae.controller.service.servers.cdap; + + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; + +import org.openecomp.ncomp.sirius.manager.console.Console; +import org.openecomp.ncomp.sirius.manager.AbstractClient; +import org.openecomp.ncomp.sirius.manager.ManagementServerError; + + + + +public class DcaeCdapServiceConsole extends Console { + public static final Logger logger = Logger.getLogger(DcaeCdapServiceConsole.class); + protected DcaeCdapServiceClient controller; + + + + + public DcaeCdapServiceConsole(String filename, String name) { + super(filename, name); + controller = new DcaeCdapServiceClient(filename,name); + client = controller.client; + + } + + public DcaeCdapServiceConsole(AbstractClient c) { + controller = new DcaeCdapServiceClient(c); + client = controller.client; + } + + + public void updateInstanceConfiguration(java.lang.String instanceName) { + + try { + controller.updateInstanceConfiguration(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void deploy(java.lang.String instanceName, java.lang.String containerPath) { + + try { + controller.deploy(instanceName,containerPath); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void undeploy(java.lang.String instanceName) { + + try { + controller.undeploy(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) { + org.openecomp.dcae.controller.core.service.HealthTestResponse res = null; + try { + res = controller.test(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public void suspend(java.lang.String instanceName) { + + try { + controller.suspend(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void resume(java.lang.String instanceName) { + + try { + controller.resume(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void pushManagerConfiguration(java.lang.String instanceName) { + + try { + controller.pushManagerConfiguration(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void pollManagerConfiguration(java.lang.String instanceName) { + + try { + controller.pollManagerConfiguration(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) { + org.eclipse.emf.ecore.EObject res = null; + try { + res = controller.managerConfiguration(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) { + org.json.JSONObject res = null; + try { + res = controller.managerOperation(instanceName,operation,parameters); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public void updateConfigurationFromPolicy(java.lang.String instanceName) { + + try { + controller.updateConfigurationFromPolicy(instanceName); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void runHealthTests() { + + try { + controller.runHealthTests(); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceProviderTemplate.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceProviderTemplate.java new file mode 100644 index 0000000..ca9ca68 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceProviderTemplate.java @@ -0,0 +1,137 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdap; + + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + + + +import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider; + + +import org.openecomp.dcae.controller.service.cdap.impl.CdapServiceImpl; +import org.openecomp.dcae.controller.service.cdap.CdapService; + + +public class DcaeCdapServiceProviderTemplate extends BasicAdaptorProvider { + private static final Logger logger = Logger.getLogger(DcaeCdapServiceProviderTemplate.class); + CdapService o; + + public DcaeCdapServiceProviderTemplate(ISiriusServer controller, CdapService o) { + super(controller, o); + this.o = o; + } + + public void updateInstanceConfiguration(java.lang.String instanceName) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void deploy(java.lang.String instanceName, java.lang.String containerPath) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void undeploy(java.lang.String instanceName) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public org.openecomp.dcae.controller.core.service.HealthTestResponse test(java.lang.String instanceName) { + org.openecomp.dcae.controller.core.service.HealthTestResponse res = null; + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void suspend(java.lang.String instanceName) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void resume(java.lang.String instanceName) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void pushManagerConfiguration(java.lang.String instanceName) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void pollManagerConfiguration(java.lang.String instanceName) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public org.eclipse.emf.ecore.EObject managerConfiguration(java.lang.String instanceName) { + org.eclipse.emf.ecore.EObject res = null; + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public org.json.JSONObject managerOperation(java.lang.String instanceName, java.lang.String operation, org.json.JSONObject parameters) { + org.json.JSONObject res = null; + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void updateConfigurationFromPolicy(java.lang.String instanceName) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void runHealthTests() { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + + + + + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceServer.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceServer.java new file mode 100644 index 0000000..78b58cd --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/DcaeCdapServiceServer.java @@ -0,0 +1,98 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit but extend this class as needed +package org.openecomp.dcae.controller.service.servers.cdap; + +import static org.openecomp.ncomp.utils.PropertyUtil.getPropertiesFromClasspath; + +import java.io.IOException; +import java.util.Properties; +import java.util.TimeZone; + +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EFactory; + +import org.openecomp.entity.EcompComponent; +import org.openecomp.entity.EcompSubComponent; +import org.openecomp.entity.EcompSubComponentInstance; +import org.openecomp.ncomp.sirius.manager.Jetty8Server; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; + +import org.openecomp.dcae.controller.service.cdap.CdapService; + + + + + + +public class DcaeCdapServiceServer implements ISiriusServer { + public static final Logger logger = Logger.getLogger(DcaeCdapServiceServer.class); + String serverPath; + ManagementServer server; + DcaeCdapService controller; + String directory = "data"; +// LocationControllerApi api ; + Jetty8Server webServer; + DcaeCdapFactory f = new DcaeCdapFactory(this); + + + + public DcaeCdapServiceServer(String filename) throws IOException { + logger.warn("controller restarting"); + DcaeCdapService.ecoreSetup(); + props = getPropertiesFromClasspath(filename); + serverPath = (String) props.get("server.dir"); + server = new ManagementServer(f, "CdapService", serverPath, filename); + server.addFactory(f); + + server.addRuntimeFactories(this); + server.start(); + } + public void runWebserver() throws IOException { + controller = (DcaeCdapService) server.find("/").o; + webServer = new Jetty8Server("cdap.properties"); + webServer.add("/resources",server); + + + + + + logger.info("Joining webserver"); + webServer.join(); + } + static Properties props = null; + public static void main(String []args) throws IOException { + // ALWAYS USE GMT. + TimeZone.setDefault(TimeZone.getTimeZone("GMT")); + + DcaeCdapServiceServer s = new DcaeCdapServiceServer("cdap.properties"); + s.runWebserver(); + } + public CdapService getController() { + return controller; + } + public ManagementServer getServer() { + return server; + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapService.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapService.properties new file mode 100644 index 0000000..364ae3b --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapService.properties @@ -0,0 +1,150 @@ + +dummy=\ + null|\ + null|\ + null|\ + null + +deploy=\ + deploy-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +undeploy=\ + undeploy-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +test=\ + test-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +suspend=\ + suspend-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +resume=\ + resume-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +pushManagerConfiguration=\ + pushManagerConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +pollManagerConfiguration=\ + pollManagerConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +managerConfiguration=\ + managerConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +managerOperation=\ + managerOperation-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +updateConfigurationFromPolicy=\ + updateConfigurationFromPolicy-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +runHealthTests=\ + runHealthTests-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +updateInstanceConfiguration=\ + updateInstanceConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +REMOTE_deploy=\ + REMOTE-deploy-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_undeploy=\ + REMOTE-undeploy-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_test=\ + REMOTE-test-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_suspend=\ + REMOTE-suspend-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_resume=\ + REMOTE-resume-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_pushManagerConfiguration=\ + REMOTE-pushManagerConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_pollManagerConfiguration=\ + REMOTE-pollManagerConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_managerConfiguration=\ + REMOTE-managerConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_managerOperation=\ + REMOTE-managerOperation-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_updateConfigurationFromPolicy=\ + REMOTE-updateConfigurationFromPolicy-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_runHealthTests=\ + REMOTE-runHealthTests-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_updateInstanceConfiguration=\ + REMOTE-updateInstanceConfiguration-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapServiceMessageEnum.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapServiceMessageEnum.java new file mode 100644 index 0000000..15e7393 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapServiceMessageEnum.java @@ -0,0 +1,59 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdap.logging; + +import com.att.eelf.i18n.EELFResourceManager; +import org.openecomp.logger.EcompMessageEnum; + +public enum CdapServiceMessageEnum implements EcompMessageEnum { + + dummy, + deploy, + undeploy, + test, + suspend, + resume, + pushManagerConfiguration, + pollManagerConfiguration, + managerConfiguration, + managerOperation, + updateConfigurationFromPolicy, + runHealthTests, + updateInstanceConfiguration, + REMOTE_deploy, + REMOTE_undeploy, + REMOTE_test, + REMOTE_suspend, + REMOTE_resume, + REMOTE_pushManagerConfiguration, + REMOTE_pollManagerConfiguration, + REMOTE_managerConfiguration, + REMOTE_managerOperation, + REMOTE_updateConfigurationFromPolicy, + REMOTE_runHealthTests, + REMOTE_updateInstanceConfiguration; + + static { + EELFResourceManager.loadMessageBundle("org.openecomp.dcae.controller.service.servers.cdap.logging.CdapService"); + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapServiceOperationEnum.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapServiceOperationEnum.java new file mode 100644 index 0000000..d67c6be --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdap/logging/CdapServiceOperationEnum.java @@ -0,0 +1,53 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdap.logging; + +import org.openecomp.entity.EcompOperationEnum; + +public enum CdapServiceOperationEnum implements EcompOperationEnum { + + deploy, + undeploy, + test, + suspend, + resume, + pushManagerConfiguration, + pollManagerConfiguration, + managerConfiguration, + managerOperation, + updateConfigurationFromPolicy, + runHealthTests, + updateInstanceConfiguration, + REMOTE_deploy, + REMOTE_undeploy, + REMOTE_test, + REMOTE_suspend, + REMOTE_resume, + REMOTE_pushManagerConfiguration, + REMOTE_pollManagerConfiguration, + REMOTE_managerConfiguration, + REMOTE_managerOperation, + REMOTE_updateConfigurationFromPolicy, + REMOTE_runHealthTests, + REMOTE_updateInstanceConfiguration; +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManager.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManager.java new file mode 100644 index 0000000..dcddd85 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManager.java @@ -0,0 +1,241 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdapmanager; + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; +import org.openecomp.ncomp.component.ApiRequestStatus; + +import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; + +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + +import java.util.Date; + +import org.openecomp.dcae.controller.service.servers.cdapmanager.logging.CdapManagerOperationEnum; +import org.openecomp.dcae.controller.service.servers.cdapmanager.logging.CdapManagerMessageEnum; + + + + +import org.openecomp.dcae.controller.service.cdapmanager.impl.CdapManagerImpl; + + + +public class DcaeCdapManager extends CdapManagerImpl { + public static final Logger logger = Logger.getLogger(DcaeCdapManager.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); + public DcaeCdapManagerProvider controller; + ISiriusServer server; + + public DcaeCdapManager(ISiriusServer server) { + this.server = server; + this.controller = new DcaeCdapManagerProvider(server,this); + } + + public org.openecomp.dcae.controller.core.service.HealthTestResponse test() { + org.openecomp.dcae.controller.core.service.HealthTestResponse res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "test", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.test); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.test(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "test", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapManagerMessageEnum.test, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "test", ApiRequestStatus.OKAY, duration_); + return res; + } + + public void suspend() { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.suspend); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.suspend(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapManagerMessageEnum.suspend, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "suspend", ApiRequestStatus.OKAY, duration_); + + } + + public void resume() { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "resume", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.resume); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.resume(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "resume", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapManagerMessageEnum.resume, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "resume", ApiRequestStatus.OKAY, duration_); + + } + + public java.lang.String publicKey() { + java.lang.String res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "publicKey", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.publicKey); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.publicKey(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "publicKey", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapManagerMessageEnum.publicKey, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "publicKey", ApiRequestStatus.OKAY, duration_); + return res; + } + + public void configurationChanged() { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "configurationChanged", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.configurationChanged); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.configurationChanged(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "configurationChanged", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapManagerMessageEnum.configurationChanged, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "configurationChanged", ApiRequestStatus.OKAY, duration_); + + } + + public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "updateStreams", ApiRequestStatus.START, duration_,inputStreams,outputStreams); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.updateStreams); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + controller.updateStreams(inputStreams,outputStreams); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "updateStreams", ApiRequestStatus.ERROR, duration_,inputStreams,outputStreams); + System.err.println("ERROR: " + e); + ecomplogger.warn(CdapManagerMessageEnum.updateStreams, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "updateStreams", ApiRequestStatus.OKAY, duration_,inputStreams,outputStreams); + + } + + + + + + + public static void ecoreSetup() { + DcaeCdapManagerProvider.ecoreSetup(); + } + public DcaeCdapManagerProvider getSomfProvider() { + return controller; + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerClient.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerClient.java new file mode 100644 index 0000000..7c43951 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerClient.java @@ -0,0 +1,174 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdapmanager; + +import org.openecomp.ncomp.sirius.manager.AbstractClient; +import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient; +import org.openecomp.ncomp.sirius.manager.GenericHttpClient; + +import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +import org.openecomp.dcae.controller.service.cdapmanager.impl.CdapManagerImpl; +import org.openecomp.dcae.controller.service.cdapmanager.CdapmanagerPackage; +import org.openecomp.dcae.controller.service.servers.cdapmanager.logging.CdapManagerOperationEnum; +import org.openecomp.dcae.controller.service.servers.cdapmanager.logging.CdapManagerMessageEnum; + + + + + + +@SuppressWarnings("unchecked") +public class DcaeCdapManagerClient extends CdapManagerImpl { + public static final Logger logger = Logger.getLogger(DcaeCdapManagerClient.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); + public AbstractClient client; + + public DcaeCdapManagerClient(String file, String name) { + DcaeCdapManager.ecoreSetup(); + client = new GenericHttpClient(file,name); + client.add("/resources", this); + } + + public DcaeCdapManagerClient(String file, String name1, String name2) { + HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2); + client = client1.all; // requests should be forwarded to all. + client.add("/resources", this); + } + + public DcaeCdapManagerClient(AbstractClient c) { + client = c; + client.add("/resources", this); + } + + + + @Override + public org.openecomp.dcae.controller.core.service.HealthTestResponse test() { + EClass c = CdapmanagerPackage.eINSTANCE.getCdapManager(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.REMOTE_test); + org.openecomp.dcae.controller.core.service.HealthTestResponse res; + try { + res = (org.openecomp.dcae.controller.core.service.HealthTestResponse) client.operationPath("/resources", c, "test", null); + } + catch (Exception e) { + ecomplogger.warn(CdapManagerMessageEnum.REMOTE_test, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@test: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public void suspend() { + EClass c = CdapmanagerPackage.eINSTANCE.getCdapManager(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.REMOTE_suspend); + + try { + client.operationPath("/resources", c, "suspend", null); + } + catch (Exception e) { + ecomplogger.warn(CdapManagerMessageEnum.REMOTE_suspend, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@suspend: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void resume() { + EClass c = CdapmanagerPackage.eINSTANCE.getCdapManager(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.REMOTE_resume); + + try { + client.operationPath("/resources", c, "resume", null); + } + catch (Exception e) { + ecomplogger.warn(CdapManagerMessageEnum.REMOTE_resume, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@resume: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public java.lang.String publicKey() { + EClass c = CdapmanagerPackage.eINSTANCE.getCdapManager(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.REMOTE_publicKey); + java.lang.String res; + try { + res = (java.lang.String) client.operationPath("/resources", c, "publicKey", null); + } + catch (Exception e) { + ecomplogger.warn(CdapManagerMessageEnum.REMOTE_publicKey, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@publicKey: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public void configurationChanged() { + EClass c = CdapmanagerPackage.eINSTANCE.getCdapManager(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.REMOTE_configurationChanged); + + try { + client.operationPath("/resources", c, "configurationChanged", null); + } + catch (Exception e) { + ecomplogger.warn(CdapManagerMessageEnum.REMOTE_configurationChanged, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@configurationChanged: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + + @Override + public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) { + EClass c = CdapmanagerPackage.eINSTANCE.getCdapManager(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(CdapManagerOperationEnum.REMOTE_updateStreams); + + try { + client.operationPath("/resources", c, "updateStreams", null, inputStreams,outputStreams); + } + catch (Exception e) { + ecomplogger.warn(CdapManagerMessageEnum.REMOTE_updateStreams, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@updateStreams: " + e); + } + ecomplogger.recordMetricEventEnd(); + + } + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerConsole.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerConsole.java new file mode 100644 index 0000000..4378d95 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerConsole.java @@ -0,0 +1,127 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit but extend this class as needed +package org.openecomp.dcae.controller.service.servers.cdapmanager; + + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; + +import org.openecomp.ncomp.sirius.manager.console.Console; +import org.openecomp.ncomp.sirius.manager.AbstractClient; +import org.openecomp.ncomp.sirius.manager.ManagementServerError; + + + +import org.openecomp.dcae.controller.service.servers.cdapmanager.gui.DcaeGuiClientApiConsole; + + +public class DcaeCdapManagerConsole extends Console { + public static final Logger logger = Logger.getLogger(DcaeCdapManagerConsole.class); + protected DcaeCdapManagerClient controller; + + + DcaeGuiClientApiConsole gui; + + + public DcaeCdapManagerConsole(String filename, String name) { + super(filename, name); + controller = new DcaeCdapManagerClient(filename,name); + client = controller.client; + + gui = new DcaeGuiClientApiConsole(filename,name); + } + + public DcaeCdapManagerConsole(AbstractClient c) { + controller = new DcaeCdapManagerClient(c); + client = controller.client; + } + + + public org.openecomp.dcae.controller.core.service.HealthTestResponse test() { + org.openecomp.dcae.controller.core.service.HealthTestResponse res = null; + try { + res = controller.test(); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public void suspend() { + + try { + controller.suspend(); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void resume() { + + try { + controller.resume(); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public java.lang.String publicKey() { + java.lang.String res = null; + try { + res = controller.publicKey(); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public void configurationChanged() { + + try { + controller.configurationChanged(); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + + public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) { + + try { + controller.updateStreams(inputStreams,outputStreams); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + + } + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerProviderTemplate.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerProviderTemplate.java new file mode 100644 index 0000000..43f74c5 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerProviderTemplate.java @@ -0,0 +1,99 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager; + + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + + + +import org.openecomp.ncomp.sirius.manager.BasicAdaptorProvider; + + +import org.openecomp.dcae.controller.service.cdapmanager.impl.CdapManagerImpl; +import org.openecomp.dcae.controller.service.cdapmanager.CdapManager; + + +public class DcaeCdapManagerProviderTemplate extends BasicAdaptorProvider { + private static final Logger logger = Logger.getLogger(DcaeCdapManagerProviderTemplate.class); + CdapManager o; + + public DcaeCdapManagerProviderTemplate(ISiriusServer controller, CdapManager o) { + super(controller, o); + this.o = o; + } + + public org.openecomp.dcae.controller.core.service.HealthTestResponse test() { + org.openecomp.dcae.controller.core.service.HealthTestResponse res = null; + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void suspend() { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void resume() { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public java.lang.String publicKey() { + java.lang.String res = null; + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void configurationChanged() { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + public void updateStreams(EList<org.openecomp.dcae.controller.core.stream.DcaeStream> inputStreams, EList<org.openecomp.dcae.controller.core.stream.DcaeStream> outputStreams) { + + // TODO IMPLEMENT + throw new UnsupportedOperationException(); + } + + + + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerServer.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerServer.java new file mode 100644 index 0000000..cbe7dc6 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapManagerServer.java @@ -0,0 +1,115 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit but extend this class as needed +package org.openecomp.dcae.controller.service.servers.cdapmanager; + +import static org.openecomp.ncomp.utils.PropertyUtil.getPropertiesFromClasspath; + +import java.io.IOException; +import java.util.Properties; +import java.util.TimeZone; + +import org.apache.log4j.Logger; +import org.eclipse.emf.ecore.EFactory; + +import org.openecomp.entity.EcompComponent; +import org.openecomp.entity.EcompSubComponent; +import org.openecomp.entity.EcompSubComponentInstance; +import org.openecomp.ncomp.sirius.manager.Jetty8Server; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; + +import org.openecomp.dcae.controller.service.cdapmanager.CdapManager; + + +import org.openecomp.dcae.controller.service.servers.cdapmanager.gui.DcaeModelFactory; + + + + + +public class DcaeCdapManagerServer implements ISiriusServer { + public static final Logger logger = Logger.getLogger(DcaeCdapManagerServer.class); + String serverPath; + ManagementServer server; + DcaeCdapManager controller; + String directory = "data"; +// LocationControllerApi api ; + Jetty8Server webServer; + DcaeCdapmanagerFactory f = new DcaeCdapmanagerFactory(this); + + + String guiPath; + ManagementServer guiServer; + + + public DcaeCdapManagerServer(String filename) throws IOException { + logger.warn("controller restarting"); + DcaeCdapManager.ecoreSetup(); + props = getPropertiesFromClasspath(filename); + serverPath = (String) props.get("server.dir"); + server = new ManagementServer(f, "CdapManager", serverPath, filename); + server.addFactory(f); + + server.addFactory(new org.openecomp.ncomp.servers.cdap.CdapCdapFactory(this)); + + + server.addFactory(org.openecomp.dcae.controller.service.cdap.CdapFactory.eINSTANCE); + + + server.addRuntimeFactories(this); + server.start(); + } + public void runWebserver() throws IOException { + controller = (DcaeCdapManager) server.find("/").o; + webServer = new Jetty8Server("cdapmanager.properties"); + webServer.add("/resources",server); + + + + EFactory guiFactory = new DcaeModelFactory(this); + guiPath = serverPath + "/gui"; + guiServer = new ManagementServer(guiFactory, "GuiClientApi", guiPath, "gui.properties"); + guiServer.start(); + webServer.add("/gui",guiServer); + + + + logger.info("Joining webserver"); + webServer.join(); + } + static Properties props = null; + public static void main(String []args) throws IOException { + // ALWAYS USE GMT. + TimeZone.setDefault(TimeZone.getTimeZone("GMT")); + + DcaeCdapManagerServer s = new DcaeCdapManagerServer("cdapmanager.properties"); + s.runWebserver(); + } + public CdapManager getController() { + return controller; + } + public ManagementServer getServer() { + return server; + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapmanagerFactory.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapmanagerFactory.java new file mode 100644 index 0000000..3e2f416 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/DcaeCdapmanagerFactory.java @@ -0,0 +1,54 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdapmanager; + +import org.eclipse.emf.ecore.EPackage; +import org.apache.log4j.Logger; + +import org.openecomp.ncomp.sirius.manager.ISiriusServer; + +import org.openecomp.dcae.controller.service.cdapmanager.CdapManager; +import org.openecomp.dcae.controller.service.cdapmanager.CdapmanagerPackage; +import org.openecomp.dcae.controller.service.cdapmanager.impl.CdapmanagerFactoryImpl; + + + + + +public class DcaeCdapmanagerFactory extends CdapmanagerFactoryImpl { + public static final Logger logger = Logger.getLogger(DcaeCdapmanagerFactory.class); + ISiriusServer server = null; + @Override + public EPackage getEPackage() { return CdapmanagerPackage.eINSTANCE; } + public DcaeCdapmanagerFactory(ISiriusServer server) { + this.server = server; + } + @Override + public CdapManager createCdapManager() { + return new DcaeCdapManager(server); + } + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApi.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApi.java new file mode 100644 index 0000000..fc913e9 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApi.java @@ -0,0 +1,271 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui; + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; +import org.openecomp.ncomp.component.ApiRequestStatus; + +import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; + +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + +import java.util.Date; + +import org.openecomp.dcae.controller.service.servers.cdapmanager.gui.logging.GuiClientApiOperationEnum; +import org.openecomp.dcae.controller.service.servers.cdapmanager.gui.logging.GuiClientApiMessageEnum; + + + + + + + +import org.openecomp.ncomp.sirius.gui.tools.*; + + + + + +import org.openecomp.ncomp.gwt.siriusportal.model.*; + + + + + +import org.openecomp.ncomp.sirius.manager.Subject; + + + + + +import org.openecomp.ncomp.sirius.manager.ManagementServer; + + + + + +import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer; + + +import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl; + + + +public class DcaeGuiClientApi extends GuiClientApiImpl { + public static final Logger logger = Logger.getLogger(DcaeGuiClientApi.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); + public DcaeGuiClientApiProvider controller; + ISiriusServer server; + + public DcaeGuiClientApi(ISiriusServer server) { + this.server = server; + this.controller = new DcaeGuiClientApiProvider(server,this); + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTree getTree() { + org.openecomp.ncomp.gwt.siriusportal.model.GuiTree res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.getTree); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.getTree(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + ecomplogger.warn(GuiClientApiMessageEnum.getTree, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.OKAY, duration_); + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiObject getObject(java.lang.String path) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiObject res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.START, duration_,path); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.getObject); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.getObject(path); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.ERROR, duration_,path); + System.err.println("ERROR: " + e); + ecomplogger.warn(GuiClientApiMessageEnum.getObject, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.OKAY, duration_,path); + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie getTimeSerie(java.lang.String path, java.lang.String start, java.lang.String end, java.lang.String duration) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.START, duration_,path,start,end,duration); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.getTimeSerie); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.getTimeSerie(path,start,end,duration); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.ERROR, duration_,path,start,end,duration); + System.err.println("ERROR: " + e); + ecomplogger.warn(GuiClientApiMessageEnum.getTimeSerie, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.OKAY, duration_,path,start,end,duration); + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTable getTable(java.lang.String path, java.lang.String start, java.lang.String end) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiTable res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.START, duration_,path,start,end); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.getTable); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.getTable(path,start,end); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.ERROR, duration_,path,start,end); + System.err.println("ERROR: " + e); + ecomplogger.warn(GuiClientApiMessageEnum.getTable, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.OKAY, duration_,path,start,end); + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml getHtml(java.lang.String path, java.lang.String start, java.lang.String end) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.START, duration_,path,start,end); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.getHtml); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.getHtml(path,start,end); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.ERROR, duration_,path,start,end); + System.err.println("ERROR: " + e); + ecomplogger.warn(GuiClientApiMessageEnum.getHtml, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.OKAY, duration_,path,start,end); + return res; + } + + public org.openecomp.ncomp.sirius.manager.graph.GuiGraph getGraph(java.lang.String path, java.lang.String start, java.lang.String end) { + org.openecomp.ncomp.sirius.manager.graph.GuiGraph res = null; + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.START, duration_,path,start,end); + Date now_ = new Date(); + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.getGraph); + ecomplogger.setInstanceId(ManagementServer.object2ref(this)); + try { + res = controller.getGraph(path,start,end); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.ERROR, duration_,path,start,end); + System.err.println("ERROR: " + e); + ecomplogger.warn(GuiClientApiMessageEnum.getGraph, e.toString()); + throw e; + } + ecomplogger.recordMetricEventEnd(); + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.OKAY, duration_,path,start,end); + return res; + } + + + + + + + public static void ecoreSetup() { + DcaeGuiClientApiProvider.ecoreSetup(); + } + public DcaeGuiClientApiProvider getSomfProvider() { + return controller; + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiClient.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiClient.java new file mode 100644 index 0000000..3ced93a --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiClient.java @@ -0,0 +1,175 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui; + +import org.openecomp.ncomp.sirius.manager.AbstractClient; +import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient; +import org.openecomp.ncomp.sirius.manager.GenericHttpClient; + +import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl; +import org.openecomp.ncomp.gwt.siriusportal.model.ModelPackage; +import org.openecomp.dcae.controller.service.servers.cdapmanager.gui.logging.GuiClientApiOperationEnum; +import org.openecomp.dcae.controller.service.servers.cdapmanager.gui.logging.GuiClientApiMessageEnum; + + +import org.openecomp.dcae.controller.service.servers.cdapmanager.DcaeCdapManager; + + + + +@SuppressWarnings("unchecked") +public class DcaeGuiClientApiClient extends GuiClientApiImpl { + public static final Logger logger = Logger.getLogger(DcaeGuiClientApiClient.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); + public AbstractClient client; + + public DcaeGuiClientApiClient(String file, String name) { + DcaeCdapManager.ecoreSetup(); + client = new GenericHttpClient(file,name); + client.add("/gui", this); + } + + public DcaeGuiClientApiClient(String file, String name1, String name2) { + HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2); + client = client1.all; // requests should be forwarded to all. + client.add("/gui", this); + } + + public DcaeGuiClientApiClient(AbstractClient c) { + client = c; + client.add("/resources", this); + } + + + + @Override + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTree getTree() { + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.REMOTE_getTree); + org.openecomp.ncomp.gwt.siriusportal.model.GuiTree res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiTree) client.operationPath("/gui", c, "getTree", null); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_getTree, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@getTree: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public org.openecomp.ncomp.gwt.siriusportal.model.GuiObject getObject(java.lang.String path) { + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.REMOTE_getObject); + org.openecomp.ncomp.gwt.siriusportal.model.GuiObject res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiObject) client.operationPath("/gui", c, "getObject", null, path); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_getObject, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@getObject: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie getTimeSerie(java.lang.String path, java.lang.String start, java.lang.String end, java.lang.String duration) { + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.REMOTE_getTimeSerie); + org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie) client.operationPath("/gui", c, "getTimeSerie", null, path,start,end,duration); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_getTimeSerie, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@getTimeSerie: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTable getTable(java.lang.String path, java.lang.String start, java.lang.String end) { + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.REMOTE_getTable); + org.openecomp.ncomp.gwt.siriusportal.model.GuiTable res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiTable) client.operationPath("/gui", c, "getTable", null, path,start,end); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_getTable, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@getTable: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml getHtml(java.lang.String path, java.lang.String start, java.lang.String end) { + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.REMOTE_getHtml); + org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml) client.operationPath("/gui", c, "getHtml", null, path,start,end); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_getHtml, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@getHtml: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + + @Override + public org.openecomp.ncomp.sirius.manager.graph.GuiGraph getGraph(java.lang.String path, java.lang.String start, java.lang.String end) { + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo + ecomplogger.recordMetricEventStart(); + ecomplogger.setOperation(GuiClientApiOperationEnum.REMOTE_getGraph); + org.openecomp.ncomp.sirius.manager.graph.GuiGraph res; + try { + res = (org.openecomp.ncomp.sirius.manager.graph.GuiGraph) client.operationPath("/gui", c, "getGraph", null, path,start,end); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_getGraph, e.toString()); + throw new RuntimeException("remote call failed: " + client.getRemote() + "@getGraph: " + e); + } + ecomplogger.recordMetricEventEnd(); + return res; + } + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiConsole.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiConsole.java new file mode 100644 index 0000000..ea17b1d --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiConsole.java @@ -0,0 +1,123 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit but extend this class as needed +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui; + + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; + +import org.openecomp.ncomp.sirius.manager.console.Console; +import org.openecomp.ncomp.sirius.manager.AbstractClient; +import org.openecomp.ncomp.sirius.manager.ManagementServerError; + + + + +public class DcaeGuiClientApiConsole extends Console { + public static final Logger logger = Logger.getLogger(DcaeGuiClientApiConsole.class); + protected DcaeGuiClientApiClient controller; + + + + + public DcaeGuiClientApiConsole(String filename, String name) { + super(filename, name); + controller = new DcaeGuiClientApiClient(filename,name); + client = controller.client; + + } + + public DcaeGuiClientApiConsole(AbstractClient c) { + controller = new DcaeGuiClientApiClient(c); + client = controller.client; + } + + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTree getTree() { + org.openecomp.ncomp.gwt.siriusportal.model.GuiTree res = null; + try { + res = controller.getTree(); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiObject getObject(java.lang.String path) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiObject res = null; + try { + res = controller.getObject(path); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie getTimeSerie(java.lang.String path, java.lang.String start, java.lang.String end, java.lang.String duration) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie res = null; + try { + res = controller.getTimeSerie(path,start,end,duration); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiTable getTable(java.lang.String path, java.lang.String start, java.lang.String end) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiTable res = null; + try { + res = controller.getTable(path,start,end); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml getHtml(java.lang.String path, java.lang.String start, java.lang.String end) { + org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml res = null; + try { + res = controller.getHtml(path,start,end); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + + public org.openecomp.ncomp.sirius.manager.graph.GuiGraph getGraph(java.lang.String path, java.lang.String start, java.lang.String end) { + org.openecomp.ncomp.sirius.manager.graph.GuiGraph res = null; + try { + res = controller.getGraph(path,start,end); + } + catch (ManagementServerError e) { + System.err.println("ERROR: " + e.getJson().toString(2)); + } + return res; + } + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiProviderTemplate.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiProviderTemplate.java new file mode 100644 index 0000000..80da073 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeGuiClientApiProviderTemplate.java @@ -0,0 +1,78 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui; + + + + + +import java.io.InputStream; + +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; + + + +import org.openecomp.ncomp.sirius.gui.tools.*; + + +import org.openecomp.ncomp.gwt.siriusportal.model.*; + + +import org.openecomp.ncomp.sirius.manager.Subject; + + +import org.openecomp.ncomp.sirius.manager.ManagementServer; + + +import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer; + + +import org.openecomp.ncomp.sirius.manager.BasicGuiClientApiProvider; + + +import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl; +import org.openecomp.ncomp.gwt.siriusportal.model.GuiClientApi; + + +public class DcaeGuiClientApiProviderTemplate extends BasicGuiClientApiProvider { + private static final Logger logger = Logger.getLogger(DcaeGuiClientApiProviderTemplate.class); + GuiClientApi o; + + public DcaeGuiClientApiProviderTemplate(ISiriusServer controller, GuiClientApi o) { + super(controller, o); + this.o = o; + } + + + + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeModelFactory.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeModelFactory.java new file mode 100644 index 0000000..5b46e5e --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/DcaeModelFactory.java @@ -0,0 +1,54 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui; + +import org.eclipse.emf.ecore.EPackage; +import org.apache.log4j.Logger; + +import org.openecomp.ncomp.sirius.manager.ISiriusServer; + +import org.openecomp.ncomp.gwt.siriusportal.model.GuiClientApi; +import org.openecomp.ncomp.gwt.siriusportal.model.ModelPackage; +import org.openecomp.ncomp.gwt.siriusportal.model.impl.ModelFactoryImpl; + +import org.openecomp.dcae.controller.service.servers.cdapmanager.DcaeCdapManagerServer; + + + +public class DcaeModelFactory extends ModelFactoryImpl { + public static final Logger logger = Logger.getLogger(DcaeModelFactory.class); + ISiriusServer server = null; + @Override + public EPackage getEPackage() { return ModelPackage.eINSTANCE; } + public DcaeModelFactory(ISiriusServer server) { + this.server = server; + } + @Override + public GuiClientApi createGuiClientApi() { + return new DcaeGuiClientApi(server); + } + + + +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApi.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApi.properties new file mode 100644 index 0000000..8705ab8 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApi.properties @@ -0,0 +1,78 @@ + +dummy=\ + null|\ + null|\ + null|\ + null + +getTree=\ + getTree-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +getObject=\ + getObject-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +getTimeSerie=\ + getTimeSerie-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +getTable=\ + getTable-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +getHtml=\ + getHtml-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +getGraph=\ + getGraph-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +REMOTE_getTree=\ + REMOTE-getTree-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_getObject=\ + REMOTE-getObject-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_getTimeSerie=\ + REMOTE-getTimeSerie-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_getTable=\ + REMOTE-getTable-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_getHtml=\ + REMOTE-getHtml-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_getGraph=\ + REMOTE-getGraph-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApiMessageEnum.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApiMessageEnum.java new file mode 100644 index 0000000..bf9107c --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApiMessageEnum.java @@ -0,0 +1,47 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui.logging; + +import com.att.eelf.i18n.EELFResourceManager; +import org.openecomp.logger.EcompMessageEnum; + +public enum GuiClientApiMessageEnum implements EcompMessageEnum { + + dummy, + getTree, + getObject, + getTimeSerie, + getTable, + getHtml, + getGraph, + REMOTE_getTree, + REMOTE_getObject, + REMOTE_getTimeSerie, + REMOTE_getTable, + REMOTE_getHtml, + REMOTE_getGraph; + + static { + EELFResourceManager.loadMessageBundle("org.openecomp.dcae.controller.service.servers.cdapmanager.gui.logging.GuiClientApi"); + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApiOperationEnum.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApiOperationEnum.java new file mode 100644 index 0000000..ecfbf9e --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/gui/logging/GuiClientApiOperationEnum.java @@ -0,0 +1,41 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager.gui.logging; + +import org.openecomp.entity.EcompOperationEnum; + +public enum GuiClientApiOperationEnum implements EcompOperationEnum { + + getTree, + getObject, + getTimeSerie, + getTable, + getHtml, + getGraph, + REMOTE_getTree, + REMOTE_getObject, + REMOTE_getTimeSerie, + REMOTE_getTable, + REMOTE_getHtml, + REMOTE_getGraph; +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManager.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManager.properties new file mode 100644 index 0000000..ef19f9b --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManager.properties @@ -0,0 +1,78 @@ + +dummy=\ + null|\ + null|\ + null|\ + null + +test=\ + test-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +suspend=\ + suspend-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +resume=\ + resume-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +publicKey=\ + publicKey-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +configurationChanged=\ + configurationChanged-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +updateStreams=\ + updateStreams-FAILED-5001W|\ + {0}|\ + null|\ + Operation Failed with Exception + +REMOTE_test=\ + REMOTE-test-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_suspend=\ + REMOTE-suspend-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_resume=\ + REMOTE-resume-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_publicKey=\ + REMOTE-publicKey-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_configurationChanged=\ + REMOTE-configurationChanged-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception + +REMOTE_updateStreams=\ + REMOTE-updateStreams-FAILED-5001W|\ + {0}|\ + null|\ + Remote Operation Failed with Exception diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManagerMessageEnum.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManagerMessageEnum.java new file mode 100644 index 0000000..bfc7789 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManagerMessageEnum.java @@ -0,0 +1,47 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager.logging; + +import com.att.eelf.i18n.EELFResourceManager; +import org.openecomp.logger.EcompMessageEnum; + +public enum CdapManagerMessageEnum implements EcompMessageEnum { + + dummy, + test, + suspend, + resume, + publicKey, + configurationChanged, + updateStreams, + REMOTE_test, + REMOTE_suspend, + REMOTE_resume, + REMOTE_publicKey, + REMOTE_configurationChanged, + REMOTE_updateStreams; + + static { + EELFResourceManager.loadMessageBundle("org.openecomp.dcae.controller.service.servers.cdapmanager.logging.CdapManager"); + } +} diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManagerOperationEnum.java b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManagerOperationEnum.java new file mode 100644 index 0000000..4a0f398 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-adaptor/src/main/sirius-gen/org/openecomp/dcae/controller/service/servers/cdapmanager/logging/CdapManagerOperationEnum.java @@ -0,0 +1,41 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + + +package org.openecomp.dcae.controller.service.servers.cdapmanager.logging; + +import org.openecomp.entity.EcompOperationEnum; + +public enum CdapManagerOperationEnum implements EcompOperationEnum { + + test, + suspend, + resume, + publicKey, + configurationChanged, + updateStreams, + REMOTE_test, + REMOTE_suspend, + REMOTE_resume, + REMOTE_publicKey, + REMOTE_configurationChanged, + REMOTE_updateStreams; +} |