2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yang.md.sal.remote.rpc;
10 import org.opendaylight.controller.sal.connector.remoterpc.*;
11 import org.opendaylight.controller.sal.core.api.Broker;
12 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
13 import org.osgi.framework.BundleContext;
18 public final class ZeroMQServerModule
19 extends org.opendaylight.controller.config.yang.md.sal.remote.rpc.AbstractZeroMQServerModule {
21 private static final Integer ZEROMQ_ROUTER_PORT = 5554;
22 private BundleContext bundleContext;
24 public ZeroMQServerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
25 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
26 super(identifier, dependencyResolver);
29 public ZeroMQServerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
30 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
31 ZeroMQServerModule oldModule, java.lang.AutoCloseable oldInstance) {
33 super(identifier, dependencyResolver, oldModule, oldInstance);
37 protected void customValidation() {
38 // Add custom validation for module attributes here.
42 public java.lang.AutoCloseable createInstance() {
44 Broker broker = getDomBrokerDependency();
46 final int port = getPort() != null ? getPort() : ZEROMQ_ROUTER_PORT;
48 ServerImpl serverImpl = new ServerImpl(port);
50 ClientImpl clientImpl = new ClientImpl();
52 RoutingTableProvider provider = new RoutingTableProvider(bundleContext);//,serverImpl);
54 RemoteRpcProvider facade = new RemoteRpcProvider(serverImpl, clientImpl);
55 facade.setRoutingTableProvider(provider);
56 facade.setContext(bundleContext);
57 facade.setRpcProvisionRegistry((RpcProvisionRegistry) broker);
59 broker.registerProvider(facade, bundleContext);
63 public void setBundleContext(BundleContext bundleContext) {
64 this.bundleContext = bundleContext;