class Syskit::RobyApp::REST_API

Extension to Roby's REST API

It is mounted on the /syskit namespace by default, i.e. access it with /api/syskit/…

Constants

PROCESS_SERVER_TYPES

Public Instance Methods

deployment_manager() click to toggle source

The {DeploymentManager} object that manages the deployments on behalf of the API

# File lib/syskit/roby_app/rest_api.rb, line 30
def deployment_manager
    @contexts ||=
        (roby_storage['syskit.deployment_manager'] ||= RESTDeploymentManager.new(syskit_conf))
end
find_type_from_process_server(process_server_config) click to toggle source

Returns a string that describes the process server type

@return [String,nil] the description, or nil if the given

process server should not be exposed by the REST API
# File lib/syskit/roby_app/rest_api.rb, line 78
def find_type_from_process_server(process_server_config)
    PROCESS_SERVER_TYPES[process_server_config.client.class]
end
make_basic_deployed_task_info_hash(info) click to toggle source

@api private

Transforms orogen's deployed task information object into the hash that is to be returned by the API

# File lib/syskit/roby_app/rest_api.rb, line 39
def make_basic_deployed_task_info_hash(info)
    info_hash = info.to_h
    if /^orogen_default_/.match?(info.task_name)
        info_hash[:default_deployment] = true
    end
    if info.task_model_name == 'logger::Logger' && (info.task_name == info.deployment_name + "_Logger")
        info_hash[:default_logger] = true
    end
    info_hash
end
make_configured_deployment_info(d) click to toggle source
# File lib/syskit/roby_app/rest_api.rb, line 50
def make_configured_deployment_info(d)
    type = find_type_from_process_server(
        syskit_conf.process_server_config_for(d.process_server_name))
    return if !type

    tasks = d.each_orogen_deployed_task_context_model.map do |deployed_task|
        Hash['task_name' => deployed_task.name,
             'task_model_name' => deployed_task.task_model.name]
    end

    Hash[id: d.object_id,
         created: deployment_manager.created_here?(d),
         deployment_name: d.process_name,
         tasks: tasks,
         on: d.process_server_name,
         mappings: d.name_mappings,
         type: type]
end
syskit_conf() click to toggle source
# File lib/syskit/roby_app/rest_api.rb, line 25
def syskit_conf
    Syskit.conf
end