Added Configurable parameter for the Connection Manager scheme and Container profile.
[controller.git] / opendaylight / connectionmanager / implementation / src / main / java / org / opendaylight / controller / connectionmanager / scheme / SingleControllerScheme.java
1 package org.opendaylight.controller.connectionmanager.scheme;
2
3 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
4 import org.opendaylight.controller.connectionmanager.ConnectionMgmtScheme;
5 import org.opendaylight.controller.sal.core.Node;
6
7 class SingleControllerScheme extends AbstractScheme {
8
9     private static AbstractScheme myScheme= null;
10
11     protected SingleControllerScheme(IClusterGlobalServices clusterServices) {
12         super(clusterServices, ConnectionMgmtScheme.SINGLE_CONTROLLER);
13     }
14
15     public static AbstractScheme getScheme(IClusterGlobalServices clusterServices) {
16         if (myScheme == null) {
17             myScheme = new SingleControllerScheme(clusterServices);
18         }
19         return myScheme;
20     }
21
22     @SuppressWarnings("deprecation")
23     @Override
24     public boolean isConnectionAllowedInternal(Node node) {
25         if (nodeConnections == null) return true;
26         // Lets make it simple. The Cluster Coordinator is the master
27         if (clusterServices.amICoordinator()) return true;
28         return false;
29     }
30 }