Decompose RPC implementation classes
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / sal / SetConfigImpl.java
similarity index 67%
rename from openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/NodeConfigServiceImpl.java
rename to openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SetConfigImpl.java
index 890c80d2a7a9bbfefe467d4ead691299519c58cb..dfd22f4458d6319fb812ecc66627dfd1108f2120 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfig;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag;
@@ -20,26 +20,24 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-public final class NodeConfigServiceImpl extends AbstractSimpleService<SetConfigInput, SetConfigOutput>
-                                         implements NodeConfigService {
-    public NodeConfigServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+public final class SetConfigImpl extends AbstractSimpleService<SetConfigInput, SetConfigOutput> implements SetConfig {
+    public SetConfigImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
         super(requestContextStack, deviceContext, SetConfigOutput.class);
     }
 
     @Override
-    public ListenableFuture<RpcResult<SetConfigOutput>> setConfig(final SetConfigInput input) {
+    public ListenableFuture<RpcResult<SetConfigOutput>> invoke(final SetConfigInput input) {
         return handleServiceCall(input);
     }
 
     @Override
     protected OfHeader buildRequest(final Xid xid, final SetConfigInput input) {
-        SetConfigInputBuilder builder = new SetConfigInputBuilder();
-        SwitchConfigFlag flag = SwitchConfigFlag.valueOf(input.getFlag());
-
-        builder.setXid(xid.getValue());
-        builder.setFlags(flag);
-        builder.setMissSendLen(input.getMissSearchLength());
-        builder.setVersion(getVersion());
-        return builder.build();
+        return new SetConfigInputBuilder()
+            .setXid(xid.getValue())
+            // FIXME: this conversion relies on Binding's Java names -- i.e. different from SwitchConfigFlag.forName()!
+            .setFlags(SwitchConfigFlag.valueOf(input.getFlag()))
+            .setMissSendLen(input.getMissSearchLength())
+            .setVersion(getVersion())
+            .build();
     }
 }