Minimal refactor of renderer to prepare flexgrid
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / service / ServiceHandlerOperationsImpl.java
1 /*
2  * Copyright © 2018 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.transportpce.servicehandler.service;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.concurrent.ExecutionException;
12 import org.opendaylight.mdsal.binding.api.DataBroker;
13 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
14 import org.opendaylight.transportpce.pce.service.PathComputationService;
15 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
16 import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
17 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
18 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
20 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
22 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
23 import org.opendaylight.yangtools.yang.common.RpcResult;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 public class ServiceHandlerOperationsImpl implements ServiceHandlerOperations {
28
29     private static final Logger LOG = LoggerFactory.getLogger(ServiceHandlerOperationsImpl.class);
30
31     private ServicehandlerImpl serviceHandler;
32
33     public ServiceHandlerOperationsImpl(DataBroker databroker, PathComputationService pathComputationService,
34         RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
35         PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl) {
36         this.serviceHandler = new ServicehandlerImpl(databroker, pathComputationService, rendererServiceOperations,
37             notificationPublishService, pceListenerImpl, rendererListenerImpl);
38     }
39
40     @Override
41     public ServiceCreateOutput serviceCreate(ServiceCreateInput input) {
42         ListenableFuture<RpcResult<ServiceCreateOutput>> output = this.serviceHandler.serviceCreate(input);
43         ServiceCreateOutput outputresult = null;
44         try {
45             outputresult = output.get().getResult();
46         } catch (InterruptedException | ExecutionException e) {
47             LOG.error("Rpc service create failed", e);
48         }
49         return outputresult;
50     }
51
52     @Override
53     public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
54         return null;
55     }
56
57     public void init() {
58         LOG.info("init ServiceHandlerOperationsImpl...");
59     }
60
61     public void close() {
62         LOG.info("close ServiceHandlerOperationsImpl...");
63     }
64
65 }