net.floodlightcontroller.restserver
Class RestApiServer

java.lang.Object
  extended by net.floodlightcontroller.restserver.RestApiServer
All Implemented Interfaces:
IFloodlightModule, IFloodlightService, IRestApiService

public class RestApiServer
extends java.lang.Object
implements IFloodlightModule, IRestApiService


Nested Class Summary
protected  class RestApiServer.RestApplication
           
 
Field Summary
protected  FloodlightModuleContext fmlContext
           
protected static org.slf4j.Logger logger
           
protected  java.lang.String restHost
           
protected  java.util.List<RestletRoutable> restlets
           
protected  int restPort
           
 
Constructor Summary
RestApiServer()
           
 
Method Summary
 void addRestletRoutable(RestletRoutable routable)
          Adds a REST API
 java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
          Get a list of Modules that this module depends on.
 java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
          Return the list of interfaces that this module implements.
 java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
          Instantiate (as needed) and return objects that implement each of the services exported by this module.
 void init(FloodlightModuleContext context)
          This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized.
 void run()
          Runs the REST API server
 void startUp(FloodlightModuleContext Context)
          This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.slf4j.Logger logger

restlets

protected java.util.List<RestletRoutable> restlets

fmlContext

protected FloodlightModuleContext fmlContext

restHost

protected java.lang.String restHost

restPort

protected int restPort
Constructor Detail

RestApiServer

public RestApiServer()
Method Detail

addRestletRoutable

public void addRestletRoutable(RestletRoutable routable)
Description copied from interface: IRestApiService
Adds a REST API

Specified by:
addRestletRoutable in interface IRestApiService

run

public void run()
Description copied from interface: IRestApiService
Runs the REST API server

Specified by:
run in interface IRestApiService

getModuleServices

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
Description copied from interface: IFloodlightModule
Return the list of interfaces that this module implements. All interfaces must inherit IFloodlightService

Specified by:
getModuleServices in interface IFloodlightModule
Returns:

getServiceImpls

public java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
Description copied from interface: IFloodlightModule
Instantiate (as needed) and return objects that implement each of the services exported by this module. The map returned maps the implemented service to the object. The object could be the same object or different objects for different exported services.

Specified by:
getServiceImpls in interface IFloodlightModule
Returns:
The map from service interface class to service implementation

getModuleDependencies

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
Description copied from interface: IFloodlightModule
Get a list of Modules that this module depends on. The module system will ensure that each these dependencies is resolved before the subsequent calls to init().

Specified by:
getModuleDependencies in interface IFloodlightModule
Returns:
The Collection of IFloodlightServices that this module depends on.

init

public void init(FloodlightModuleContext context)
          throws FloodlightModuleException
Description copied from interface: IFloodlightModule
This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized.

Specified by:
init in interface IFloodlightModule
Throws:
FloodlightModuleException

startUp

public void startUp(FloodlightModuleContext Context)
Description copied from interface: IFloodlightModule
This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads.

Specified by:
startUp in interface IFloodlightModule