The ESEServer class provides the ability to:

  • Introspect an GSF installation for its catalog
  • Get a task by URI
  • Get a task by name or pattern
  • Download files

Methods


Examples


Example 1

The full hierarchy of tasks can be introspected, starting with the ESECatalog. In this example we start the process of enumerating all services and tasks by using an ESEServer object to get the catalog. Services can be acquired by using the catalog object's methods. Similarly, tasks can be acquired from ESEService objects.

Server = ESE.GetServer('localhost', 9191)
Catalog = Server.GetCatalog()

Example 2

The ESEServer class has two convenience methods for finding tasks: FindTask() and GetTask(). If the URI of a task is not known then the task can be searched for using FindTask(). See Custom IDL Tasks on how to create the addition task. Copy the custom task to your IDL installation lib directory for it to be available on the server.

Server = ESE.GetServer('localhost', 9191)
Task = Server.FindTask('addition')

Regular expressions can also be used. In this example, all tasks with the substring 'catalog' in their name are found:

Server = ESE.GetServer('localhost', 9191)
Task = Server.FindTask('catalog', /REGEX)

Example 3

If the URI to a task is known, then GetTask() can be used to more directly specify and retrieve an ESETask object. Since there is a fixed root ("ese") and only one catalog (defaults to "services"), they are not specified.

Server = ESE.GetServer('localhost', 9191)
Task = Server.GetTask('IDL/querytask')

Properties


HOST (Get)

The name or IP address of the machine that is hosting GSF.

PORT (Get)

The port number that GSF is listening on.

ROOT (Get)

The root endpoint for all ESE requests. This value is always 'ese'.

URI (Get)

The URI up to and including the host, port, and root (for example, http://host:port/ese).

ESEServer::About


This method returns a hash that contains server information.

Example


Server = ESE.GetServer('localhost', 9191)
info = Server.About()

Syntax


Result = Obj.[ESEServer::]About()

Return Value


Returns a hash with key/value pairs containing server information. This method returns !null on error.

Arguments


None.

Keywords


None.

ESEServer::DownloadFile


This method downloads the resource specified by the given URL to the given file path. An array of URLs and matching files can be provided. The URLs must be valid and the file paths must be new files in writable directories.

Example


Note that the destination path must be updated to be valid.

Server = ESE.GetServer('localhost', 9191)
Server.DownloadFile,'http://localhost:9191/ese/jobs/<jobid>/<filename>', 'C:\Users\me\Desktop\<filename>'

Syntax


Obj.[ESEServer::]DownloadFile, URL, File

Return Value


None.

Arguments


URL

The URL of the file to download. GSF can only download files that exist underneath its workspace directory. This argument can be an array of URLs. In that case, the File argument should be an array of corresponding destination file paths.

File

The destination to download the file to. This argument can be an array of file paths.

Keywords


None.

ESEServer::FindTask


This method searches for the given task and returns an array of ESETask objects. If the REGEX keyword is specified, then matches are performed using the name as a regular expression. The search is case insensitive.

Example


Server = ESE.GetServer('localhost', 9191)
Task = Server.FindTask('catalog', /REGEX)

Syntax


Task = Obj.[ESEServer::]FindTask( Name [, /REGEX ] )

Return Value


Returns one or more ESETask objects. If more than one match is found then the return value is an array of ESETask objects. If there is a communications error with the server then an error is thrown.

Arguments


Name

The name of the task to search for. Matches are case-insensitive.

Keywords


REGEX

Set this keyword to perform matching using Name as a regular expression. Matches are case-insensitive.

ESEServer::GetCatalog


This method returns an object that represents the server's catalog. There is only one.

Example


Server = ESE.GetServer('localhost', 9191)
Catalog = Server.GetCatalog()

Syntax


Catalog = Obj.[ESEServer::]GetCatalog()

Return Value


This method returns an ESECatalog object.

Arguments


None.

Keywords


None.

ESEServer::GetTask


This method returns the ESETask object at the given relative URI, which must start with a service. The root and catalog are implied and must not be specified. Namely, the URI should be service/task.

Example


Server = ESE.GetServer('localhost', 9191)
Task = Server.GetTask( 'IDL/querytask')

Syntax


Task = Obj.[ESEServer::]GetTask( URI )

Return Value


Returns an ESETask object that represents the specified task. If the relative URI is invalid then !null is returned.

Arguments


URI

A partial URI that is relative to the server's catalog. The server's root and catalog (typically 'ese' and 'services') are implied. The relative URI must begin with a service that follows the catalog.

Keywords


None.

ESEServer::Ping


This method checks whether the server is alive, returning !true or !false.

Example


Server = ESE.GetServer('localhost', 9191)
isAlive = Server.Ping()

Syntax


Result = Obj.[ESEServer::]Ping()

Return Value


This method returns !true if the server is responsive; otherwise, it returns !false.

Arguments


None.

Keywords


None.

Version History


IDL 8.4.1 Introduced
IDL 8.5.2 Deprecated ESEServer::UploadFile

See Also


ESE, ESECatalog, ESETask