Forked from
DM / dm-docs
261 commits behind, 746 commits ahead of the upstream repository.
-
sveseli authored
add first functional daq web service with experiment controller, functionality to observe file system and invoke file transfers; add initial API and CLI classes for start/stop daq, upload data;
sveseli authoredadd first functional daq web service with experiment controller, functionality to observe file system and invoke file transfers; add initial API and CLI classes for start/stop daq, upload data;
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
daqWebServiceRouteMapper.py 1.14 KiB
#!/usr/bin/env python
#
# Route mapper for DM DAQ web service.
#
import sys
import os
import cherrypy
from dm.common.utility.loggingManager import LoggingManager
from dm.common.utility.configurationManager import ConfigurationManager
from dm.common.service.loginRouteDescriptor import LoginRouteDescriptor
from experimentRouteDescriptor import ExperimentRouteDescriptor
class DaqWebServiceRouteMapper:
@classmethod
def setupRoutes(cls):
""" Setup RESTFul routes. """
logger = LoggingManager.getInstance().getLogger(cls.__name__)
contextRoot = ConfigurationManager.getInstance().getContextRoot()
logger.debug('Using context root: %s' % contextRoot)
# Get routes.
routes = LoginRouteDescriptor.getRoutes()
routes += ExperimentRouteDescriptor.getRoutes()
# Add routes to dispatcher.
d = cherrypy.dispatch.RoutesDispatcher()
for route in routes:
logger.debug('Connecting route: %s' % route)
d.connect(route['name'], route['path'], action=route['action'], controller=route['controller'], conditions=dict(method=route['method']))
return d