Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / AbstractExperimenterMultipartService.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.services;
10
11 import java.util.concurrent.Future;
12 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
13 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
14 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.mp.message.service.rev151020.SendExperimenterMpRequestInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.mp.message.service.rev151020.SendExperimenterMpRequestOutput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
18 import org.opendaylight.yangtools.yang.common.RpcResult;
19
20 public abstract class AbstractExperimenterMultipartService<T extends OfHeader>
21         extends AbstractMultipartService<SendExperimenterMpRequestInput, T> {
22
23     private final ExtensionConverterProvider extensionConverterProvider;
24
25     protected AbstractExperimenterMultipartService(RequestContextStack requestContextStack, DeviceContext deviceContext,
26                                                    ExtensionConverterProvider extensionConverterProvider) {
27         super(requestContextStack, deviceContext);
28         this.extensionConverterProvider = extensionConverterProvider;
29     }
30
31     /**
32      * Get extension converter provider.
33      * @return extension converter provider
34      */
35     protected ExtensionConverterProvider getExtensionConverterProvider() {
36         return extensionConverterProvider;
37     }
38
39     /**
40      * Process experimenter input and result experimenter output.
41      * @param input experimenter input
42      * @return experimenter output
43      */
44     public abstract Future<RpcResult<SendExperimenterMpRequestOutput>>
45         handleAndReply(SendExperimenterMpRequestInput input);
46 }