X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fsal%2Fsal-binding-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fapi%2FBindingAwareBroker.java;h=fa104882a372bf173a283406f506c7011385aa34;hp=24f5b25a190b2e4d8d4876ee5eb9e9a5bd794eab;hb=2df4e10d93273215c40fe9ce38b0ba6e268e67b3;hpb=ca85a6f3a39b406ab122fe985ee010a41489f658 diff --git a/opendaylight/sal/yang-prototype/sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java b/opendaylight/sal/yang-prototype/sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java index 24f5b25a19..fa104882a3 100644 --- a/opendaylight/sal/yang-prototype/sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java +++ b/opendaylight/sal/yang-prototype/sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java @@ -1,168 +1,174 @@ -/* - * 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.api; - -import org.opendaylight.controller.yang.binding.RpcService; - -/** - * Binding-aware core of the SAL layer responsible for wiring the SAL consumers. - * - * The responsibility of the broker is to maintain registration of SAL - * functionality {@link Consumer}s and {@link Provider}s, store provider and - * consumer specific context and functionality registration via - * {@link ConsumerSession} and provide access to infrastructure services, which - * removes direct dependencies between providers and consumers. - * - * The Binding-aware broker is also responsible for translation from Java - * classes modeling the functionality and data to binding-indpenedent form which - * is used in SAL Core. - * - * - *
- * Note that consumer could register additional functionality at later point - * by using service and functionality specific APIs. - * - *
- * The consumer is required to use returned session for all communication
- * with broker or one of the broker services. The session is announced to
- * the consumer by invoking
- * {@link Consumer#onSessionInitiated(ConsumerSession)}.
- *
- * @param cons
- * Consumer to be registered.
- * @return a session specific to consumer registration
- * @throws IllegalArgumentException
- * If the consumer is null
.
- * @throws IllegalStateException
- * If the consumer is already registered.
- */
- ConsumerSession registerConsumer(BindingAwareConsumer consumer);
-
- /**
- * Registers the {@link BindingAwareProvider}, which will use the SAL layer.
- *
- *
- * During the registration, the broker obtains the initial functionality - * from consumer, using the - * {@link BindingAwareProvider#getImplementations()}, and register that - * functionality into system and concrete infrastructure services. - * - *
- * Note that provider could register additional functionality at later point - * by using service and functionality specific APIs. - * - *
- * The consumer is required to use returned session for all
- * communication with broker or one of the broker services. The session is
- * announced to the consumer by invoking
- * {@link BindingAwareProvider#onSessionInitiated(ProviderSession)}.
- *
- *
- * @param prov
- * Provider to be registered.
- * @return a session unique to the provider registration.
- * @throws IllegalArgumentException
- * If the provider is null
.
- * @throws IllegalStateException
- * If the consumer is already registered.
- */
- ProviderSession registerProvider(BindingAwareProvider provider);
-
- /**
- * {@link BindingAwareConsumer} specific access to the SAL functionality.
- *
- *
- * ConsumerSession is {@link BindingAwareConsumer}-specific access to the - * SAL functionality and infrastructure services. - * - *
- * The session serves to store SAL context (e.g. registration of
- * functionality) for the consumer and provides access to the SAL
- * infrastructure services and other functionality provided by
- * {@link Provider}s.
- *
-
- *
- */
- public interface ConsumerSession {
-
- /**
- * Returns a session specific instance (implementation) of requested
- * binding-aware infrastructural service
- *
- * @param service
- * Broker service
- * @return Session specific implementation of service
- */
-
- * ProviderSession is {@link BindingAwareProvider}-specific access to the
- * SAL functionality and infrastructure services, which also allows for
- * exposing the provider's functionality to the other
- * {@link BindingAwareConsumer}s.
- *
- *
- * The session serves to store SAL context (e.g. registration of
- * functionality) for the providers and exposes access to the SAL
- * infrastructure services, dynamic functionality registration and any other
- * functionality provided by other {@link BindingAwareConsumer}s.
- *
- */
- public interface ProviderSession extends ConsumerSession {
-
- void addRpcImplementation(RpcService implementation);
-
- void removeRpcImplementation(RpcService implementation);
- }
-}
+/*
+ * 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.api;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.binding.api.data.DataConsumerService;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Binding-aware core of the SAL layer responsible for wiring the SAL consumers.
+ *
+ * The responsibility of the broker is to maintain registration of SAL
+ * functionality {@link Consumer}s and {@link Provider}s, store provider and
+ * consumer specific context and functionality registration via
+ * {@link ConsumerContext} and provide access to infrastructure services, which
+ * removes direct dependencies between providers and consumers.
+ *
+ * The Binding-aware broker is also responsible for translation from Java
+ * classes modeling the functionality and data to binding-indpenedent form which
+ * is used in SAL Core.
+ *
+ *
+ *
+ * Note that consumer could register additional functionality at later point
+ * by using service and functionality specific APIs.
+ *
+ *
+ * The consumer is required to use returned session for all communication
+ * with broker or one of the broker services. The session is announced to
+ * the consumer by invoking
+ * {@link Consumer#onSessionInitiated(ConsumerContext)}.
+ *
+ * @param cons
+ * Consumer to be registered.
+ * @return a session specific to consumer registration
+ * @throws IllegalArgumentException
+ * If the consumer is
+ * During the registration, the broker obtains the initial functionality
+ * from consumer, using the
+ * {@link BindingAwareProvider#getImplementations()}, and register that
+ * functionality into system and concrete infrastructure services.
+ *
+ *
+ * Note that provider could register additional functionality at later point
+ * by using service and functionality specific APIs.
+ *
+ *
+ * The consumer is required to use returned session for all
+ * communication with broker or one of the broker services. The session is
+ * announced to the consumer by invoking
+ * {@link BindingAwareProvider#onSessionInitiated(ProviderContext)}.
+ *
+ *
+ * @param prov
+ * Provider to be registered.
+ * @return a session unique to the provider registration.
+ * @throws IllegalArgumentException
+ * If the provider is
+ * ConsumerSession is {@link BindingAwareConsumer}-specific access to the
+ * SAL functionality and infrastructure services.
+ *
+ *
+ * The session serves to store SAL context (e.g. registration of
+ * functionality) for the consumer and provides access to the SAL
+ * infrastructure services and other functionality provided by
+ * {@link Provider}s.
+ *
+ *
+ *
+ */
+ public interface ConsumerContext {
+
+ /**
+ * Returns a session specific instance (implementation) of requested
+ * binding-aware infrastructural service
+ *
+ * @param service
+ * Broker service
+ * @return Session specific implementation of service
+ */
+
+ * ProviderSession is {@link BindingAwareProvider}-specific access to the
+ * SAL functionality and infrastructure services, which also allows for
+ * exposing the provider's functionality to the other
+ * {@link BindingAwareConsumer}s.
+ *
+ *
+ * The session serves to store SAL context (e.g. registration of
+ * functionality) for the providers and exposes access to the SAL
+ * infrastructure services, dynamic functionality registration and any other
+ * functionality provided by other {@link BindingAwareConsumer}s.
+ *
+ */
+ public interface ProviderContext extends ConsumerContext {
+
+ Infrastructure services
Some examples of infrastructure services:
+ *
+ *
+ *
+ *
+ * The services are exposed via session.
+ *
+ * Session-based access
+ *
+ * The providers and consumers needs to register in order to use the
+ * binding-independent SAL layer and to expose functionality via SAL layer.
+ *
+ * For more information about session-based access see {@link ConsumerContext}
+ * and {@link ProviderContext}
+ *
+ *
+ *
+ */
+public interface BindingAwareBroker {
+ /**
+ * Registers the {@link BindingAwareConsumer}, which will use the SAL layer.
+ *
+ * null
.
+ * @throws IllegalStateException
+ * If the consumer is already registered.
+ */
+ ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx);
+
+ /**
+ * Registers the {@link BindingAwareProvider}, which will use the SAL layer.
+ *
+ * null
.
+ * @throws IllegalStateException
+ * If the consumer is already registered.
+ */
+ ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx);
+
+ /**
+ * {@link BindingAwareConsumer} specific access to the SAL functionality.
+ *
+ *