BUG-272: fix sal-binding-broker
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / codegen / RuntimeCodeGenerator.java
index 9f7e05cbbf4ec1f81721c38c05f9e9cdf6aa68d2..9b7b8e28c90657aedc2f53c8c17d1697a0cd6e62 100644 (file)
@@ -1,81 +1,91 @@
+/*
+ * 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
+ */
 package org.opendaylight.controller.sal.binding.codegen;
 
-import org.opendaylight.controller.sal.binding.spi.DelegateProxy;
-import org.opendaylight.controller.sal.binding.spi.RpcRouter;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
 import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
 
 public interface RuntimeCodeGenerator {
 
     /**
      * Returns an instance of provided RpcService type which delegates all calls
      * to the delegate.
-     * 
+     *
      * <p>
      * Returned instance:
      * <ul>
      * <li>implements provided subclass of RpcService type and
-     * {@link DelegateProxy} interface.
+     * {@link org.opendaylight.controller.sal.binding.spi.DelegateProxy} interface.
      * <li>
      * <p>
      * delegates all invocations of methods, which are defined in RpcService
      * subtype to delegate which is defined by
-     * {@link DelegateProxy#setDelegate(Object)}.
+     * {@link org.opendaylight.controller.sal.binding.spi.DelegateProxy#setDelegate(Object)}.
      * <p>
      * If delegate is not defined (<code>getDelegate() == null</code>)
      * implementation throws {@link IllegalStateException}
-     * <li>{@link DelegateProxy#getDelegate()} - returns the delegate to which
+     * <li>{@link org.opendaylight.controller.sal.binding.spi.DelegateProxy#getDelegate()} - returns the delegate to which
      * all calls are delegated.
-     * <li>{@link DelegateProxy#setDelegate(Object)} - sets the delegate for
+     * <li>{@link org.opendaylight.controller.sal.binding.spi.DelegateProxy#setDelegate(Object)} - sets the delegate for
      * particular instance
-     * 
+     *
      * </ul>
-     * 
+     *
      * @param serviceType
      *            - Subclass of RpcService for which direct proxy is to be
      *            generated.
      * @return Instance of RpcService of provided serviceType which implements
-     *         and {@link DelegateProxy}
+     *         and {@link org.opendaylight.controller.sal.binding.spi.DelegateProxy}
      * @throws IllegalArgumentException
-     * 
+     *
      */
     <T extends RpcService> T getDirectProxyFor(Class<T> serviceType) throws IllegalArgumentException;
 
     /**
      * Returns an instance of provided RpcService type which routes all calls to
      * other instances selected on particular input field.
-     * 
+     *
      * <p>
      * Returned instance:
-     * <ul><li>Implements:
-     *     <ul><li>{@link DelegateProxy}
-     *         <li>{@link RpcRouter}
-     *     </ul>
-     *     <li>
-     *     routes all invocations of methods, which are defined in RpcService
-     *     subtype based on method arguments and routing information defined in the
-     *     RpcRoutingTables for this instance
-     *     {@link RpcRouter#getRoutingTable(Class)}.
-     *     <ul>
-     *     <li>
-     *     Implementation uses
-     *     {@link RpcRouter#getService(Class, InstanceIdentifier)} method to
-     *     retrieve particular instance to which call will be routed.
-     *    <li>
-     *    Instance of {@link InstanceIdentifier} is determined by first argument of
-     *    method and is retrieved via method which is annotated with
-     *    {@link RoutingContext}. Class representing Routing Context Identifier is
-     *    retrieved by {@link RoutingContext}.
-     *    <li>If first argument is not defined / {@link RoutingContext} annotation
-     *    is not present on any field invocation will be delegated to default
-     *    service {@link RpcRouter#getDefaultService()}.
+     * <ul>
+     * <li>Implements:
+     * <ul>
+     * <li>{@link org.opendaylight.controller.sal.binding.spi.DelegateProxy}
+     * <li>{@link RpcRouter}
+     * </ul>
+     * <li>
+     * routes all invocations of methods, which are defined in RpcService
+     * subtype based on method arguments and routing information defined in the
+     * RpcRoutingTables for this instance
+     * {@link RpcRouter#getRoutingTable(Class)}.
+     * <ul>
+     * <li>
+     * Implementation uses
+     * {@link RpcRouter#getService(Class, org.opendaylight.yangtools.yang.binding.InstanceIdentifier)} method to
+     * retrieve particular instance to which call will be routed.
+     * <li>
+     * Instance of {@link org.opendaylight.yangtools.yang.binding.InstanceIdentifier} is determined by first argument of
+     * method and is retrieved via method which is annotated with
+     * {@link org.opendaylight.yangtools.yang.binding.annotations.RoutingContext}.
+     * Class representing Routing Context Identifier is retrieved by a
+     * {@link org.opendaylight.yangtools.yang.binding.annotations.RoutingContext}.
+     * <li>If first argument is not defined / {@link org.opendaylight.yangtools.yang.binding.annotations.RoutingContext} annotation
+     * is not present on any field invocation will be delegated to default
+     * service {@link RpcRouter#getDefaultService()}.
      * </ul>
-     * 
+     *
      * @param serviceType
      *            - Subclass of RpcService for which Router is to be generated.
      * @return Instance of RpcService of provided serviceType which implements
-     *         also {@link RpcRouter}<T> and {@link DelegateProxy}
+     *         also {@link RpcRouter}<T> and {@link org.opendaylight.controller.sal.binding.spi.DelegateProxy}
      */
-    <T extends RpcService> T getRouterFor(Class<T> serviceType) throws IllegalArgumentException;
+    <T extends RpcService> RpcRouter<T> getRouterFor(Class<T> serviceType,String name) throws IllegalArgumentException;
+
+    NotificationInvokerFactory getInvokerFactory();
 }