BUG-731: move to new APIs
[bgpcep.git] / programming / impl-config / src / main / java / org / opendaylight / controller / config / yang / programming / impl / InstructionSchedulerImplModule.java
index bcd9ab5222d496e6ed4b42b0198278fd56478f27..8e28a06126ea2e8b1db81a0c20d467e70cc44504 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 /**
  * Generated file
 
  */
 package org.opendaylight.controller.config.yang.programming.impl;
 
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 import org.opendaylight.bgpcep.programming.impl.ProgrammingServiceImpl;
-import org.opendaylight.bgpcep.programming.spi.InstructionExecutor;
+import org.opendaylight.bgpcep.programming.spi.Instruction;
 import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
+import org.opendaylight.bgpcep.programming.spi.SchedulerException;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.ProgrammingService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.SubmitInstructionInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.submit.instruction.output.result.failure._case.Failure;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 
 /**
  *
@@ -38,16 +48,15 @@ org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSche
        }
 
        @Override
-       public void validate() {
-               super.validate();
+       protected void customValidation() {
                // Add custom validation for module attributes here.
        }
 
        @Override
        public java.lang.AutoCloseable createInstance() {
-               final ExecutorService exec = Executors.newSingleThreadExecutor();
+               final ListeningExecutorService exec = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
 
-               final ProgrammingServiceImpl inst = new ProgrammingServiceImpl(getNotificationServiceDependency(), exec, getTimerDependency());
+               final ProgrammingServiceImpl inst = new ProgrammingServiceImpl(getDataProviderDependency(), getNotificationServiceDependency(), exec, getTimerDependency());
 
                final RpcRegistration<ProgrammingService> reg = getRpcRegistryDependency().addRpcImplementation(ProgrammingService.class, inst);
 
@@ -66,8 +75,8 @@ org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSche
                        }
 
                        @Override
-                       public Failure submitInstruction(final SubmitInstructionInput input, final InstructionExecutor executor) {
-                               return inst.submitInstruction(input, executor);
+                       public ListenableFuture<Instruction> scheduleInstruction(final SubmitInstructionInput input) throws SchedulerException {
+                               return inst.scheduleInstruction(input);
                        }
                }