Class: T2Server::Administrator
- Inherits:
-
Object
- Object
- T2Server::Administrator
- Includes:
- XML::Methods
- Defined in:
- lib/t2-server/admin.rb
Overview
This call provides access to the administrative interface of a Taverna Server instance.
To get an instance of this class use the Server#administrator method. Special permissions will most likely be required above and beyond those assigned to most Taverna Server users.
Defined Under Namespace
Classes: AdminResource
Constant Summary collapse
- ADMIN_ENDPOINT =
:stopdoc:
"admin"
Instance Attribute Summary collapse
-
#resources ⇒ Object
readonly
The resources held by this administrative interface.
Instance Method Summary collapse
-
#[](name) ⇒ Object
:call-seq: [name] -> AdminResource.
-
#get_resource_value(uri) ⇒ Object
:stopdoc:.
-
#initialize(server, credentials = nil) {|_self| ... } ⇒ Administrator
constructor
A new instance of Administrator.
- #set_resource_value(uri, val) ⇒ Object
Methods included from XML::Methods
#get_uris_from_doc, #xml_children, #xml_document, #xml_first_child, #xml_node_attribute, #xml_node_content, #xml_node_name, #xml_text_node, #xpath_attr, #xpath_compile, #xpath_find, #xpath_first
Constructor Details
#initialize(server, credentials = nil) {|_self| ... } ⇒ Administrator
Returns a new instance of Administrator.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/t2-server/admin.rb', line 55 def initialize(server, credentials = nil) @server = server @uri = Util.append_to_uri_path(server.uri, ADMIN_ENDPOINT) @credentials = credentials admin_description = xml_document(@server.read(@uri, "application/xml", @credentials)) @resources = get_resources(admin_description) yield(self) if block_given? end |
Instance Attribute Details
#resources ⇒ Object (readonly)
The resources held by this administrative interface. This is a Hash indexed by the name of the resource in lowercase.
50 51 52 |
# File 'lib/t2-server/admin.rb', line 50 def resources @resources end |
Instance Method Details
#[](name) ⇒ Object
:call-seq:
[name] -> AdminResource
Return the named AdminResource.
72 73 74 |
# File 'lib/t2-server/admin.rb', line 72 def [](name) @resources[name.downcase] end |
#get_resource_value(uri) ⇒ Object
:stopdoc:
77 78 79 |
# File 'lib/t2-server/admin.rb', line 77 def get_resource_value(uri) @server.read(uri, "text/plain", @credentials) end |
#set_resource_value(uri, val) ⇒ Object
81 82 83 |
# File 'lib/t2-server/admin.rb', line 81 def set_resource_value(uri, val) @server.update(uri, val.to_s, "text/plain", @credentials) end |