net.floodlightcontroller.core.module
Class FloodlightModuleContext

java.lang.Object
  extended by net.floodlightcontroller.core.module.FloodlightModuleContext
All Implemented Interfaces:
IFloodlightModuleContext

public class FloodlightModuleContext
extends java.lang.Object
implements IFloodlightModuleContext

The service registry for an IFloodlightProvider.

Author:
alexreimers

Field Summary
protected  java.util.Map<java.lang.Class<? extends IFloodlightModule>,java.util.Map<java.lang.String,java.lang.String>> configParams
           
protected  java.util.Collection<IFloodlightModule> moduleSet
           
protected  java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> serviceMap
           
 
Constructor Summary
FloodlightModuleContext()
          Creates the ModuleContext for use with this IFloodlightProvider.
 
Method Summary
 void addConfigParam(IFloodlightModule mod, java.lang.String key, java.lang.String value)
          Adds a configuration parameter for a module
 void addModules(java.util.Collection<IFloodlightModule> modSet)
           
 void addService(java.lang.Class<? extends IFloodlightService> clazz, IFloodlightService service)
          Adds a IFloodlightModule for this Context.
 java.util.Collection<IFloodlightModule> getAllModules()
          Returns all loaded modules
 java.util.Collection<java.lang.Class<? extends IFloodlightService>> getAllServices()
          Returns all loaded services
 java.util.Map<java.lang.String,java.lang.String> getConfigParams(java.lang.Class<? extends IFloodlightModule> clazz)
          Gets module specific configuration parameters.
 java.util.Map<java.lang.String,java.lang.String> getConfigParams(IFloodlightModule module)
          Gets module specific configuration parameters.
<T extends IFloodlightService>
T
getServiceImpl(java.lang.Class<T> service)
          Retrieves a casted version of a module from the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceMap

protected java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> serviceMap

configParams

protected java.util.Map<java.lang.Class<? extends IFloodlightModule>,java.util.Map<java.lang.String,java.lang.String>> configParams

moduleSet

protected java.util.Collection<IFloodlightModule> moduleSet
Constructor Detail

FloodlightModuleContext

public FloodlightModuleContext()
Creates the ModuleContext for use with this IFloodlightProvider. This will be used as a module registry for all IFloodlightModule(s).

Method Detail

addService

public void addService(java.lang.Class<? extends IFloodlightService> clazz,
                       IFloodlightService service)
Adds a IFloodlightModule for this Context.

Parameters:
clazz - the service class
service - The IFloodlightService to add to the registry

getServiceImpl

public <T extends IFloodlightService> T getServiceImpl(java.lang.Class<T> service)
Description copied from interface: IFloodlightModuleContext
Retrieves a casted version of a module from the registry.

Specified by:
getServiceImpl in interface IFloodlightModuleContext
Returns:
The IFloodlightService

getAllServices

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getAllServices()
Description copied from interface: IFloodlightModuleContext
Returns all loaded services

Specified by:
getAllServices in interface IFloodlightModuleContext
Returns:
A collection of service classes that have been loaded

getAllModules

public java.util.Collection<IFloodlightModule> getAllModules()
Description copied from interface: IFloodlightModuleContext
Returns all loaded modules

Specified by:
getAllModules in interface IFloodlightModuleContext
Returns:
All Floodlight modules that are going to be loaded

addModules

public void addModules(java.util.Collection<IFloodlightModule> modSet)

getConfigParams

public java.util.Map<java.lang.String,java.lang.String> getConfigParams(IFloodlightModule module)
Description copied from interface: IFloodlightModuleContext
Gets module specific configuration parameters.

Specified by:
getConfigParams in interface IFloodlightModuleContext
Parameters:
module - The module to get the configuration parameters for
Returns:
A key, value map of the configuration options

getConfigParams

public java.util.Map<java.lang.String,java.lang.String> getConfigParams(java.lang.Class<? extends IFloodlightModule> clazz)
Description copied from interface: IFloodlightModuleContext
Gets module specific configuration parameters.

Specified by:
getConfigParams in interface IFloodlightModuleContext
Parameters:
clazz - The class of the module to get configuration parameters for
Returns:
A key, value map of the configuration options

addConfigParam

public void addConfigParam(IFloodlightModule mod,
                           java.lang.String key,
                           java.lang.String value)
Adds a configuration parameter for a module

Parameters:
mod - The fully qualified module name to add the parameter to
key - The configuration parameter key
value - The configuration parameter value