X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fsal%2Fsal-core-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2Fapi%2FBroker.java;h=f26ed901a569f9c585b9b18be456acbb055de257;hp=9b3b47f8b17e8f312cb77b0688973b0d702e129a;hb=2df4e10d93273215c40fe9ce38b0ba6e268e67b3;hpb=ca85a6f3a39b406ab122fe985ee010a41489f658 diff --git a/opendaylight/sal/yang-prototype/sal/sal-core-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java b/opendaylight/sal/yang-prototype/sal/sal-core-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java index 9b3b47f8b1..f26ed901a5 100644 --- a/opendaylight/sal/yang-prototype/sal/sal-core-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java +++ b/opendaylight/sal/yang-prototype/sal/sal-core-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java @@ -1,238 +1,238 @@ -/* - * 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.core.api; - -import java.util.concurrent.Future; - -import org.opendaylight.controller.sal.core.api.data.DataBrokerService; -import org.opendaylight.controller.sal.core.api.data.DataProviderService; -import org.opendaylight.controller.sal.core.api.notify.NotificationProviderService; -import org.opendaylight.controller.sal.core.api.notify.NotificationService; -import org.opendaylight.controller.yang.common.QName; -import org.opendaylight.controller.yang.common.RpcResult; -import org.opendaylight.controller.yang.data.api.CompositeNode; - - -/** - * Core component 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. - * - * - *
- * During the registration, the broker obtains the initial functionality - * from consumer, using the {@link Consumer#getConsumerFunctionality()}, and - * register that functionality into system and concrete infrastructure - * services. - * - *
- * 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(Consumer cons);
-
- /**
- * Registers the {@link Provider}, which will use the SAL layer.
- *
- *
- * During the registration, the broker obtains the initial functionality - * from consumer, using the {@link Provider#getProviderFunctionality()}, and - * register that functionality into system and concrete infrastructure - * services. - * - *
- * Note that consumer could register additional functionality at later point - * by using service and functionality specific APIs (e.g. - * {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)} - * - *
- * 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 Provider#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(Provider prov);
-
- /**
- * {@link Consumer} specific access to the SAL functionality.
- *
- *
- * ConsumerSession is {@link Consumer}-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 {
-
- /**
- * Sends an RPC to other components registered to the broker.
- *
- * @see RpcImplementation
- * @param rpc
- * Name of RPC
- * @param input
- * Input data to the RPC
- * @return Result of the RPC call
- */
- Future
- * The close operation unregisters a consumer and remove all registered
- * functionality of the consumer from the system.
- *
- */
- void close();
- }
-
- /**
- * {@link Provider} specific access to the SAL functionality.
- *
- *
- * ProviderSession is {@link Provider}-specific access to the SAL
- * functionality and infrastructure services, which also allows for exposing
- * the provider's functionality to the other {@link Consumer}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 Provider}s.
- *
- */
- public interface ProviderSession extends ConsumerSession {
- /**
- * Registers an implementation of the rpc.
- *
- *
- * The registered rpc functionality will be available to all other
- * consumers and providers registered to the broker, which are aware of
- * the {@link QName} assigned to the rpc.
- *
- *
- * There is no assumption that rpc type is in the set returned by
- * invoking {@link RpcImplementation#getSupportedRpcs()}. This allows
- * for dynamic rpc implementations.
- *
- * @param rpcType
- * Name of Rpc
- * @param implementation
- * Provider's Implementation of the RPC functionality
- * @throws IllegalArgumentException
- * If the name of RPC is invalid
- */
- void addRpcImplementation(QName rpcType,
- RpcImplementation implementation)
- throws IllegalArgumentException;
-
- /**
- * Unregisters an Rpc implementation
- *
- * @param rpcType
- * Name of Rpc
- * @param implementation
- * Registered Implementation of the Rpc functionality
- * @throws IllegalArgumentException
- */
- void removeRpcImplementation(QName rpcType,
- RpcImplementation implementation)
- throws IllegalArgumentException;
-
- /**
- * Closes a session between provider and SAL.
- *
- *
- * The close operation unregisters a provider and remove all registered
- * functionality of the provider from the system.
- */
- @Override
- public void close();
-
- @Override
- boolean isClosed();
- }
-}
+/*
+ * 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.core.api;
+
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.core.api.data.DataProviderService;
+import org.opendaylight.controller.sal.core.api.notify.NotificationProviderService;
+import org.opendaylight.controller.sal.core.api.notify.NotificationService;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+
+
+/**
+ * Core component 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.
+ *
+ *
+ *
+ * During the registration, the broker obtains the initial functionality
+ * from consumer, using the {@link Consumer#getConsumerFunctionality()}, and
+ * register that functionality into system and concrete infrastructure
+ * services.
+ *
+ *
+ * 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
+ * During the registration, the broker obtains the initial functionality
+ * from consumer, using the {@link Provider#getProviderFunctionality()}, and
+ * register that functionality into system and concrete infrastructure
+ * services.
+ *
+ *
+ * Note that consumer could register additional functionality at later point
+ * by using service and functionality specific APIs (e.g.
+ * {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)}
+ *
+ *
+ * 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 Provider#onSessionInitiated(ProviderSession)}.
+ *
+ *
+ * @param prov
+ * Provider to be registered.
+ * @return a session unique to the provider registration.
+ * @throws IllegalArgumentException
+ * If the provider is
+ * ConsumerSession is {@link Consumer}-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 {
+
+ /**
+ * Sends an RPC to other components registered to the broker.
+ *
+ * @see RpcImplementation
+ * @param rpc
+ * Name of RPC
+ * @param input
+ * Input data to the RPC
+ * @return Result of the RPC call
+ */
+ Future
+ * The close operation unregisters a consumer and remove all registered
+ * functionality of the consumer from the system.
+ *
+ */
+ void close();
+ }
+
+ /**
+ * {@link Provider} specific access to the SAL functionality.
+ *
+ *
+ * ProviderSession is {@link Provider}-specific access to the SAL
+ * functionality and infrastructure services, which also allows for exposing
+ * the provider's functionality to the other {@link Consumer}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 Provider}s.
+ *
+ */
+ public interface ProviderSession extends ConsumerSession {
+ /**
+ * Registers an implementation of the rpc.
+ *
+ *
+ * The registered rpc functionality will be available to all other
+ * consumers and providers registered to the broker, which are aware of
+ * the {@link QName} assigned to the rpc.
+ *
+ *
+ * There is no assumption that rpc type is in the set returned by
+ * invoking {@link RpcImplementation#getSupportedRpcs()}. This allows
+ * for dynamic rpc implementations.
+ *
+ * @param rpcType
+ * Name of Rpc
+ * @param implementation
+ * Provider's Implementation of the RPC functionality
+ * @throws IllegalArgumentException
+ * If the name of RPC is invalid
+ */
+ void addRpcImplementation(QName rpcType,
+ RpcImplementation implementation)
+ throws IllegalArgumentException;
+
+ /**
+ * Unregisters an Rpc implementation
+ *
+ * @param rpcType
+ * Name of Rpc
+ * @param implementation
+ * Registered Implementation of the Rpc functionality
+ * @throws IllegalArgumentException
+ */
+ void removeRpcImplementation(QName rpcType,
+ RpcImplementation implementation)
+ throws IllegalArgumentException;
+
+ /**
+ * Closes a session between provider and SAL.
+ *
+ *
+ * The close operation unregisters a provider and remove all registered
+ * functionality of the provider from the system.
+ */
+ @Override
+ public void close();
+
+ @Override
+ boolean isClosed();
+ }
+}
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 ConsumerSession}
+ * and {@link ProviderSession}
+ *
+ *
+ *
+ */
+public interface Broker {
+
+ /**
+ * Registers the {@link Consumer}, which will use the SAL layer.
+ *
+ * null
.
+ * @throws IllegalStateException
+ * If the consumer is already registered.
+ */
+ ConsumerSession registerConsumer(Consumer cons);
+
+ /**
+ * Registers the {@link Provider}, which will use the SAL layer.
+ *
+ * null
.
+ * @throws IllegalStateException
+ * If the consumer is already registered.
+ */
+ ProviderSession registerProvider(Provider prov);
+
+ /**
+ * {@link Consumer} specific access to the SAL functionality.
+ *
+ *