Simplify CommonService interface
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / dedicated / StatisticsGatheringService.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, 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
9 package org.opendaylight.openflowplugin.impl.statistics.services.dedicated;
10
11 import java.util.List;
12 import java.util.concurrent.Future;
13 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
14 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
15 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
16 import org.opendaylight.openflowplugin.impl.common.MultipartRequestInputFactory;
17 import org.opendaylight.openflowplugin.impl.services.AbstractMultipartService;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
21 import org.opendaylight.yangtools.yang.common.RpcResult;
22
23 /**
24  * Created by Martin Bobak <mbobak@cisco.com> on 4.4.2015.
25  */
26 public class StatisticsGatheringService extends AbstractMultipartService<MultipartType> {
27     public StatisticsGatheringService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
28         super(requestContextStack, deviceContext);
29     }
30
31     public Future<RpcResult<List<MultipartReply>>> getStatisticsOfType(final MultipartType type) {
32         return handleServiceCall(type);
33     }
34
35     @Override
36     protected OfHeader buildRequest(final Xid xid, final MultipartType input) {
37         return MultipartRequestInputFactory.makeMultipartRequestInput(xid.getValue(), getVersion(), input);
38     }
39 }