/*- * ============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.ncomp.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.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.ncomp.servers.cdap.logging.CdapClusterOperationEnum; import org.openecomp.ncomp.cdap.impl.CdapClusterImpl; public class CdapCdapCluster extends CdapClusterImpl implements ISiriusPlugin { public static final Logger logger = Logger.getLogger(CdapCdapCluster.class); static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); public CdapCdapClusterProvider controller; ISiriusServer server; public CdapCdapCluster(ISiriusServer server) { this.server = server; this.controller = new CdapCdapClusterProvider(server,this); } public void poll() { long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "poll", ApiRequestStatus.START, duration_); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.poll); try { controller.poll(); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "poll", ApiRequestStatus.ERROR, duration_); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "poll", ApiRequestStatus.OKAY, duration_); } public java.lang.String createNamespace(java.lang.String namespace) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "createNamespace", ApiRequestStatus.START, duration_,namespace); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.createNamespace); try { res = controller.createNamespace(namespace); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createNamespace", ApiRequestStatus.ERROR, duration_,namespace); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createNamespace", ApiRequestStatus.OKAY, duration_,namespace); return res; } public java.lang.String deleteNamespace(java.lang.String namespace) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "deleteNamespace", ApiRequestStatus.START, duration_,namespace); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.deleteNamespace); try { res = controller.deleteNamespace(namespace); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteNamespace", ApiRequestStatus.ERROR, duration_,namespace); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteNamespace", ApiRequestStatus.OKAY, duration_,namespace); return res; } public java.lang.String deployApp(java.lang.String namespace, java.lang.String jarfile) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "deployApp", ApiRequestStatus.START, duration_,namespace,jarfile); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.deployApp); try { res = controller.deployApp(namespace,jarfile); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deployApp", ApiRequestStatus.ERROR, duration_,namespace,jarfile); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deployApp", ApiRequestStatus.OKAY, duration_,namespace,jarfile); return res; } public java.lang.String loadArtifact(java.lang.String namespace, java.lang.String artifactName, java.lang.String jarfile, java.lang.String version) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "loadArtifact", ApiRequestStatus.START, duration_,namespace,artifactName,jarfile,version); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.loadArtifact); try { res = controller.loadArtifact(namespace,artifactName,jarfile,version); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadArtifact", ApiRequestStatus.ERROR, duration_,namespace,artifactName,jarfile,version); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadArtifact", ApiRequestStatus.OKAY, duration_,namespace,artifactName,jarfile,version); return res; } public java.lang.String deleteArtifact(java.lang.String namespace, java.lang.String artifactName, java.lang.String artifactVersion) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "deleteArtifact", ApiRequestStatus.START, duration_,namespace,artifactName,artifactVersion); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.deleteArtifact); try { res = controller.deleteArtifact(namespace,artifactName,artifactVersion); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteArtifact", ApiRequestStatus.ERROR, duration_,namespace,artifactName,artifactVersion); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteArtifact", ApiRequestStatus.OKAY, duration_,namespace,artifactName,artifactVersion); return res; } public java.lang.String startFlow(java.lang.String namespace, java.lang.String appName, java.lang.String flowId, java.lang.String extraArgs) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "startFlow", ApiRequestStatus.START, duration_,namespace,appName,flowId,extraArgs); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.startFlow); try { res = controller.startFlow(namespace,appName,flowId,extraArgs); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startFlow", ApiRequestStatus.ERROR, duration_,namespace,appName,flowId,extraArgs); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startFlow", ApiRequestStatus.OKAY, duration_,namespace,appName,flowId,extraArgs); return res; } public java.lang.String startWorker(java.lang.String namespace, java.lang.String appName, java.lang.String workerId, java.lang.String extraArgs) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "startWorker", ApiRequestStatus.START, duration_,namespace,appName,workerId,extraArgs); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.startWorker); try { res = controller.startWorker(namespace,appName,workerId,extraArgs); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startWorker", ApiRequestStatus.ERROR, duration_,namespace,appName,workerId,extraArgs); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startWorker", ApiRequestStatus.OKAY, duration_,namespace,appName,workerId,extraArgs); return res; } public java.lang.String startService(java.lang.String namespace, java.lang.String appName, java.lang.String serviceId, java.lang.String extraArgs) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "startService", ApiRequestStatus.START, duration_,namespace,appName,serviceId,extraArgs); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.startService); try { res = controller.startService(namespace,appName,serviceId,extraArgs); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startService", ApiRequestStatus.ERROR, duration_,namespace,appName,serviceId,extraArgs); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startService", ApiRequestStatus.OKAY, duration_,namespace,appName,serviceId,extraArgs); return res; } public java.lang.String startApp(java.lang.String namespace, java.lang.String appName) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "startApp", ApiRequestStatus.START, duration_,namespace,appName); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.startApp); try { res = controller.startApp(namespace,appName); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startApp", ApiRequestStatus.ERROR, duration_,namespace,appName); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startApp", ApiRequestStatus.OKAY, duration_,namespace,appName); return res; } public java.lang.String stopApp(java.lang.String namespace, java.lang.String appName) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "stopApp", ApiRequestStatus.START, duration_,namespace,appName); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.stopApp); try { res = controller.stopApp(namespace,appName); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopApp", ApiRequestStatus.ERROR, duration_,namespace,appName); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopApp", ApiRequestStatus.OKAY, duration_,namespace,appName); return res; } public java.lang.String deleteApp(java.lang.String namespace, java.lang.String appName) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "deleteApp", ApiRequestStatus.START, duration_,namespace,appName); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.deleteApp); try { res = controller.deleteApp(namespace,appName); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteApp", ApiRequestStatus.ERROR, duration_,namespace,appName); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteApp", ApiRequestStatus.OKAY, duration_,namespace,appName); return res; } public java.lang.String loadPreferencesApp(java.lang.String namespace, java.lang.String prefsFile, java.lang.String appId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "loadPreferencesApp", ApiRequestStatus.START, duration_,namespace,prefsFile,appId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.loadPreferencesApp); try { res = controller.loadPreferencesApp(namespace,prefsFile,appId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadPreferencesApp", ApiRequestStatus.ERROR, duration_,namespace,prefsFile,appId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadPreferencesApp", ApiRequestStatus.OKAY, duration_,namespace,prefsFile,appId); return res; } public java.lang.String loadPreferencesFlow(java.lang.String namespace, java.lang.String prefsFile, java.lang.String appId, java.lang.String flowId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "loadPreferencesFlow", ApiRequestStatus.START, duration_,namespace,prefsFile,appId,flowId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.loadPreferencesFlow); try { res = controller.loadPreferencesFlow(namespace,prefsFile,appId,flowId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadPreferencesFlow", ApiRequestStatus.ERROR, duration_,namespace,prefsFile,appId,flowId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadPreferencesFlow", ApiRequestStatus.OKAY, duration_,namespace,prefsFile,appId,flowId); return res; } public java.lang.String loadPreferencesNameSpace(java.lang.String namespace, java.lang.String prefsFile) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "loadPreferencesNameSpace", ApiRequestStatus.START, duration_,namespace,prefsFile); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.loadPreferencesNameSpace); try { res = controller.loadPreferencesNameSpace(namespace,prefsFile); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadPreferencesNameSpace", ApiRequestStatus.ERROR, duration_,namespace,prefsFile); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "loadPreferencesNameSpace", ApiRequestStatus.OKAY, duration_,namespace,prefsFile); return res; } public java.lang.String setPreferencesApp(java.lang.String namespace, java.lang.String prefsString, java.lang.String appId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setPreferencesApp", ApiRequestStatus.START, duration_,namespace,prefsString,appId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setPreferencesApp); try { res = controller.setPreferencesApp(namespace,prefsString,appId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesApp", ApiRequestStatus.ERROR, duration_,namespace,prefsString,appId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesApp", ApiRequestStatus.OKAY, duration_,namespace,prefsString,appId); return res; } public java.lang.String setPreferencesFlow(java.lang.String namespace, java.lang.String prefsString, java.lang.String appId, java.lang.String flowId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setPreferencesFlow", ApiRequestStatus.START, duration_,namespace,prefsString,appId,flowId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setPreferencesFlow); try { res = controller.setPreferencesFlow(namespace,prefsString,appId,flowId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesFlow", ApiRequestStatus.ERROR, duration_,namespace,prefsString,appId,flowId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesFlow", ApiRequestStatus.OKAY, duration_,namespace,prefsString,appId,flowId); return res; } public java.lang.String setPreferencesWorker(java.lang.String namespace, java.lang.String prefsString, java.lang.String appId, java.lang.String workerId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setPreferencesWorker", ApiRequestStatus.START, duration_,namespace,prefsString,appId,workerId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setPreferencesWorker); try { res = controller.setPreferencesWorker(namespace,prefsString,appId,workerId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesWorker", ApiRequestStatus.ERROR, duration_,namespace,prefsString,appId,workerId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesWorker", ApiRequestStatus.OKAY, duration_,namespace,prefsString,appId,workerId); return res; } public java.lang.String setPreferencesService(java.lang.String namespace, java.lang.String prefsString, java.lang.String appId, java.lang.String serviceId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setPreferencesService", ApiRequestStatus.START, duration_,namespace,prefsString,appId,serviceId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setPreferencesService); try { res = controller.setPreferencesService(namespace,prefsString,appId,serviceId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesService", ApiRequestStatus.ERROR, duration_,namespace,prefsString,appId,serviceId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesService", ApiRequestStatus.OKAY, duration_,namespace,prefsString,appId,serviceId); return res; } public java.lang.String setPreferencesNameSpace(java.lang.String namespace, java.lang.String prefsString) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setPreferencesNameSpace", ApiRequestStatus.START, duration_,namespace,prefsString); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setPreferencesNameSpace); try { res = controller.setPreferencesNameSpace(namespace,prefsString); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesNameSpace", ApiRequestStatus.ERROR, duration_,namespace,prefsString); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setPreferencesNameSpace", ApiRequestStatus.OKAY, duration_,namespace,prefsString); return res; } public java.lang.String setFlowRunTimeArgs(java.lang.String namespace, java.lang.String appId, java.lang.String flowId, java.lang.String args) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setFlowRunTimeArgs", ApiRequestStatus.START, duration_,namespace,appId,flowId,args); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setFlowRunTimeArgs); try { res = controller.setFlowRunTimeArgs(namespace,appId,flowId,args); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setFlowRunTimeArgs", ApiRequestStatus.ERROR, duration_,namespace,appId,flowId,args); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setFlowRunTimeArgs", ApiRequestStatus.OKAY, duration_,namespace,appId,flowId,args); return res; } public java.lang.String setFlowletInstances(java.lang.String namespace, java.lang.String appId, java.lang.String flowId, java.lang.String flowletId, int nInstances) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setFlowletInstances", ApiRequestStatus.START, duration_,namespace,appId,flowId,flowletId,nInstances); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setFlowletInstances); try { res = controller.setFlowletInstances(namespace,appId,flowId,flowletId,nInstances); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setFlowletInstances", ApiRequestStatus.ERROR, duration_,namespace,appId,flowId,flowletId,nInstances); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setFlowletInstances", ApiRequestStatus.OKAY, duration_,namespace,appId,flowId,flowletId,nInstances); return res; } public java.lang.String stopFlow(java.lang.String namespace, java.lang.String appId, java.lang.String flowId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "stopFlow", ApiRequestStatus.START, duration_,namespace,appId,flowId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.stopFlow); try { res = controller.stopFlow(namespace,appId,flowId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopFlow", ApiRequestStatus.ERROR, duration_,namespace,appId,flowId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopFlow", ApiRequestStatus.OKAY, duration_,namespace,appId,flowId); return res; } public java.lang.String stopWorker(java.lang.String namespace, java.lang.String appId, java.lang.String workerId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "stopWorker", ApiRequestStatus.START, duration_,namespace,appId,workerId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.stopWorker); try { res = controller.stopWorker(namespace,appId,workerId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopWorker", ApiRequestStatus.ERROR, duration_,namespace,appId,workerId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopWorker", ApiRequestStatus.OKAY, duration_,namespace,appId,workerId); return res; } public java.lang.String stopService(java.lang.String namespace, java.lang.String appId, java.lang.String serviceId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "stopService", ApiRequestStatus.START, duration_,namespace,appId,serviceId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.stopService); try { res = controller.stopService(namespace,appId,serviceId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopService", ApiRequestStatus.ERROR, duration_,namespace,appId,serviceId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopService", ApiRequestStatus.OKAY, duration_,namespace,appId,serviceId); return res; } public java.lang.String truncateDataSet(java.lang.String namespace, java.lang.String datasetName) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "truncateDataSet", ApiRequestStatus.START, duration_,namespace,datasetName); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.truncateDataSet); try { res = controller.truncateDataSet(namespace,datasetName); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "truncateDataSet", ApiRequestStatus.ERROR, duration_,namespace,datasetName); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "truncateDataSet", ApiRequestStatus.OKAY, duration_,namespace,datasetName); return res; } public java.lang.String deleteDataset(java.lang.String namespace, java.lang.String datasetName) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "deleteDataset", ApiRequestStatus.START, duration_,namespace,datasetName); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.deleteDataset); try { res = controller.deleteDataset(namespace,datasetName); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteDataset", ApiRequestStatus.ERROR, duration_,namespace,datasetName); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteDataset", ApiRequestStatus.OKAY, duration_,namespace,datasetName); return res; } public java.lang.String createStream(java.lang.String namespace, java.lang.String newStreamId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "createStream", ApiRequestStatus.START, duration_,namespace,newStreamId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.createStream); try { res = controller.createStream(namespace,newStreamId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createStream", ApiRequestStatus.ERROR, duration_,namespace,newStreamId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createStream", ApiRequestStatus.OKAY, duration_,namespace,newStreamId); return res; } public java.lang.String deleteStream(java.lang.String namespace, java.lang.String streamId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "deleteStream", ApiRequestStatus.START, duration_,namespace,streamId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.deleteStream); try { res = controller.deleteStream(namespace,streamId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteStream", ApiRequestStatus.ERROR, duration_,namespace,streamId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "deleteStream", ApiRequestStatus.OKAY, duration_,namespace,streamId); return res; } public EList getStreamEvents(java.lang.String namespace, java.lang.String streamId, java.lang.String startTime, java.lang.String endTime, int limit) { EList res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "getStreamEvents", ApiRequestStatus.START, duration_,namespace,streamId,startTime,endTime,limit); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.getStreamEvents); try { res = controller.getStreamEvents(namespace,streamId,startTime,endTime,limit); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getStreamEvents", ApiRequestStatus.ERROR, duration_,namespace,streamId,startTime,endTime,limit); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getStreamEvents", ApiRequestStatus.OKAY, duration_,namespace,streamId,startTime,endTime,limit); return res; } public EList getStreamStats(java.lang.String namespace, java.lang.String streamId, java.lang.String startTime, java.lang.String endTime, int limit) { EList res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "getStreamStats", ApiRequestStatus.START, duration_,namespace,streamId,startTime,endTime,limit); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.getStreamStats); try { res = controller.getStreamStats(namespace,streamId,startTime,endTime,limit); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getStreamStats", ApiRequestStatus.ERROR, duration_,namespace,streamId,startTime,endTime,limit); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getStreamStats", ApiRequestStatus.OKAY, duration_,namespace,streamId,startTime,endTime,limit); return res; } public java.lang.String sendEventToStream(java.lang.String namespace, java.lang.String streamId, java.lang.String event) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "sendEventToStream", ApiRequestStatus.START, duration_,namespace,streamId,event); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.sendEventToStream); try { res = controller.sendEventToStream(namespace,streamId,event); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "sendEventToStream", ApiRequestStatus.ERROR, duration_,namespace,streamId,event); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "sendEventToStream", ApiRequestStatus.OKAY, duration_,namespace,streamId,event); return res; } public java.lang.String trucateStream(java.lang.String namespace, java.lang.String streamId) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "trucateStream", ApiRequestStatus.START, duration_,namespace,streamId); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.trucateStream); try { res = controller.trucateStream(namespace,streamId); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "trucateStream", ApiRequestStatus.ERROR, duration_,namespace,streamId); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "trucateStream", ApiRequestStatus.OKAY, duration_,namespace,streamId); return res; } public java.lang.String setStreamProperties(java.lang.String namespace, java.lang.String streamId, java.lang.String propsFile) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setStreamProperties", ApiRequestStatus.START, duration_,namespace,streamId,propsFile); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setStreamProperties); try { res = controller.setStreamProperties(namespace,streamId,propsFile); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setStreamProperties", ApiRequestStatus.ERROR, duration_,namespace,streamId,propsFile); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setStreamProperties", ApiRequestStatus.OKAY, duration_,namespace,streamId,propsFile); return res; } public java.lang.String restartApp(java.lang.String namespace, java.lang.String appId, java.lang.String progTypes) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "restartApp", ApiRequestStatus.START, duration_,namespace,appId,progTypes); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.restartApp); try { res = controller.restartApp(namespace,appId,progTypes); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "restartApp", ApiRequestStatus.ERROR, duration_,namespace,appId,progTypes); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "restartApp", ApiRequestStatus.OKAY, duration_,namespace,appId,progTypes); return res; } public java.lang.String createApp(java.lang.String namespace, java.lang.String appId, java.lang.String artifactName, java.lang.String artifactVersion, java.lang.String scope) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "createApp", ApiRequestStatus.START, duration_,namespace,appId,artifactName,artifactVersion,scope); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.createApp); try { res = controller.createApp(namespace,appId,artifactName,artifactVersion,scope); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createApp", ApiRequestStatus.ERROR, duration_,namespace,appId,artifactName,artifactVersion,scope); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createApp", ApiRequestStatus.OKAY, duration_,namespace,appId,artifactName,artifactVersion,scope); return res; } public java.lang.String createAppWithConfig(java.lang.String namespace, java.lang.String appId, java.lang.String artifactName, java.lang.String artifactVersion, java.lang.String scope, java.lang.String appConfig) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "createAppWithConfig", ApiRequestStatus.START, duration_,namespace,appId,artifactName,artifactVersion,scope,appConfig); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.createAppWithConfig); try { res = controller.createAppWithConfig(namespace,appId,artifactName,artifactVersion,scope,appConfig); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createAppWithConfig", ApiRequestStatus.ERROR, duration_,namespace,appId,artifactName,artifactVersion,scope,appConfig); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "createAppWithConfig", ApiRequestStatus.OKAY, duration_,namespace,appId,artifactName,artifactVersion,scope,appConfig); return res; } public java.lang.String setDatasetProperties(java.lang.String namespace, java.lang.String datasetName, java.lang.String datasetProperties) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setDatasetProperties", ApiRequestStatus.START, duration_,namespace,datasetName,datasetProperties); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setDatasetProperties); try { res = controller.setDatasetProperties(namespace,datasetName,datasetProperties); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setDatasetProperties", ApiRequestStatus.ERROR, duration_,namespace,datasetName,datasetProperties); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setDatasetProperties", ApiRequestStatus.OKAY, duration_,namespace,datasetName,datasetProperties); return res; } public java.lang.String setStreamTTL(java.lang.String namespace, java.lang.String streamName, int ttlSeconds) { java.lang.String res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "setStreamTTL", ApiRequestStatus.START, duration_,namespace,streamName,ttlSeconds); Date now_ = new Date(); ecomplogger.recordMetricEventStart(); ecomplogger.setOperation(CdapClusterOperationEnum.setStreamTTL); try { res = controller.setStreamTTL(namespace,streamName,ttlSeconds); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setStreamTTL", ApiRequestStatus.ERROR, duration_,namespace,streamName,ttlSeconds); System.err.println("ERROR: " + e); throw e; } ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "setStreamTTL", ApiRequestStatus.OKAY, duration_,namespace,streamName,ttlSeconds); return res; } @Override public void start() { controller.start(); } public static void ecoreSetup() { CdapCdapClusterProvider.ecoreSetup(); } public CdapCdapClusterProvider getSomfProvider() { return controller; } }