/*- * ============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.sirius.manager.agent.servers.monitoring; 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.eclipse.emf.common.util.EList; import org.json.JSONObject; import java.util.Date; import java.util.Date; import org.openecomp.ncomp.sirius.manager.server.LoggerInfo; import org.openecomp.ncomp.sirius.manager.server.ServerFactory; import org.openecomp.ncomp.sirius.manager.agent.monitoring.impl.SiriusManagerAgentServerImpl; public class AgentSiriusManagerAgentServer extends SiriusManagerAgentServerImpl implements ISiriusPlugin { public static final Logger logger = Logger.getLogger(AgentSiriusManagerAgentServer.class); AgentSiriusManagerAgentServerProvider controller; ISiriusServer server; public AgentSiriusManagerAgentServer(ISiriusServer server) { this.server = server; this.controller = new AgentSiriusManagerAgentServerProvider(server,this); } public void logs(org.json.JSONObject cx, EList logs) { long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "logs", ApiRequestStatus.START, duration_,cx,logs); Date now_ = new Date(); try { controller.logs(cx,logs); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "logs", ApiRequestStatus.ERROR, duration_,cx,logs); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "logs", ApiRequestStatus.OKAY, duration_,cx,logs); } public void metrics(org.json.JSONObject cx, EList metrics) { long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "metrics", ApiRequestStatus.START, duration_,cx,metrics); Date now_ = new Date(); try { controller.metrics(cx,metrics); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "metrics", ApiRequestStatus.ERROR, duration_,cx,metrics); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "metrics", ApiRequestStatus.OKAY, duration_,cx,metrics); } public void properties(org.json.JSONObject cx, EList l) { long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "properties", ApiRequestStatus.START, duration_,cx,l); Date now_ = new Date(); try { controller.properties(cx,l); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "properties", ApiRequestStatus.ERROR, duration_,cx,l); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "properties", ApiRequestStatus.OKAY, duration_,cx,l); } public void uploadInfo(org.json.JSONObject cx, EList info) { long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "uploadInfo", ApiRequestStatus.START, duration_,cx,info); Date now_ = new Date(); try { controller.uploadInfo(cx,info); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "uploadInfo", ApiRequestStatus.ERROR, duration_,cx,info); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "uploadInfo", ApiRequestStatus.OKAY, duration_,cx,info); } public EList getValues(org.json.JSONObject cx, java.lang.String path, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) { EList res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "getValues", ApiRequestStatus.START, duration_,cx,path,start,end,option,relativeInterval); Date now_ = new Date(); try { res = controller.getValues(cx,path,start,end,option,relativeInterval); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getValues", ApiRequestStatus.ERROR, duration_,cx,path,start,end,option,relativeInterval); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getValues", ApiRequestStatus.OKAY, duration_,cx,path,start,end,option,relativeInterval); return res; } public EList getValuesAll(org.json.JSONObject cx, java.lang.String path, EList metrics, java.lang.Long start, java.lang.Long end, org.openecomp.ncomp.core.metrics.MetricValueOption option, boolean relativeInterval) { EList res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "getValuesAll", ApiRequestStatus.START, duration_,cx,path,metrics,start,end,option,relativeInterval); Date now_ = new Date(); try { res = controller.getValuesAll(cx,path,metrics,start,end,option,relativeInterval); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getValuesAll", ApiRequestStatus.ERROR, duration_,cx,path,metrics,start,end,option,relativeInterval); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getValuesAll", ApiRequestStatus.OKAY, duration_,cx,path,metrics,start,end,option,relativeInterval); return res; } public EList getMessages(org.json.JSONObject cx, java.lang.String path, java.lang.Long start, java.lang.Long end) { EList res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "getMessages", ApiRequestStatus.START, duration_,cx,path,start,end); Date now_ = new Date(); try { res = controller.getMessages(cx,path,start,end); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getMessages", ApiRequestStatus.ERROR, duration_,cx,path,start,end); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getMessages", ApiRequestStatus.OKAY, duration_,cx,path,start,end); return res; } public org.openecomp.ncomp.sirius.manager.server.LoggerInfo getRequestLogger(java.lang.String userName, java.lang.String action, java.lang.String resourcePath, org.json.JSONObject context) { org.openecomp.ncomp.sirius.manager.server.LoggerInfo res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "getRequestLogger", ApiRequestStatus.START, duration_,userName,action,resourcePath,context); Date now_ = new Date(); try { res = controller.getRequestLogger(userName,action,resourcePath,context); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getRequestLogger", ApiRequestStatus.ERROR, duration_,userName,action,resourcePath,context); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getRequestLogger", ApiRequestStatus.OKAY, duration_,userName,action,resourcePath,context); return res; } public EList evaluate(java.lang.String path, org.openecomp.ncomp.core.function.Function function) { EList res = null; long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "evaluate", ApiRequestStatus.START, duration_,path,function); Date now_ = new Date(); try { res = controller.evaluate(path,function); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "evaluate", ApiRequestStatus.ERROR, duration_,path,function); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "evaluate", ApiRequestStatus.OKAY, duration_,path,function); return res; } public void update(java.lang.String path, org.openecomp.ncomp.core.function.Function function) { long duration_ = 0; if (server != null) server.getServer().recordApi(null, this, "update", ApiRequestStatus.START, duration_,path,function); Date now_ = new Date(); try { controller.update(path,function); } catch (Exception e) { duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "update", ApiRequestStatus.ERROR, duration_,path,function); System.err.println("ERROR: " + e); throw e; } duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "update", ApiRequestStatus.OKAY, duration_,path,function); } @Override public void start() { controller.start(); } public static void ecoreSetup() { AgentSiriusManagerAgentServerProvider.ecoreSetup(); } }