Class: T2Server::Administrator

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from XML::Methods

#get_uris_from_doc, #xml_children, #xml_document, #xml_first_child, #xml_input_fragment, #xml_keypair_cred_fragment, #xml_mkdir_fragment, #xml_node_attribute, #xml_node_content, #xml_node_name, #xml_password_cred_fragment, #xml_permissions_fragment, #xml_trust_fragment, #xml_upload_fragment, #xpath_attr, #xpath_compile, #xpath_find, #xpath_first

Constructor Details

#initialize(server, credentials = nil) {|_self| ... } ⇒ Administrator

Returns a new instance of Administrator.

Yields:

  • (_self)

Yield Parameters:



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

#resourcesObject (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