::: content
[;
{.source}]{.comments}
{.source}[; NOSA HEADER START
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; The contents of this file are subject to the terms of the NASA Open
{.source}]{.comments}
{.source}[; Source Agreement (NOSA), Version 1.3 only (the "Agreement"). You may
{.source}]{.comments}
{.source}[; not use this file except in compliance with the Agreement.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; You can obtain a copy of the agreement at
{.source}]{.comments}
{.source}[; docs/NASA_Open_Source_Agreement_1.3.txt
{.source}]{.comments}
{.source}[; or
{.source}]{.comments}
{.source}[; https://sscweb.gsfc.nasa.gov/WebServices/NASA_Open_Source_Agreement_1.3.txt.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; See the Agreement for the specific language governing permissions
{.source}]{.comments}
{.source}[; and limitations under the Agreement.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; When distributing Covered Code, include this NOSA HEADER in each
{.source}]{.comments}
{.source}[; file and include the Agreement file at
{.source}]{.comments}
{.source}[; docs/NASA_Open_Source_Agreement_1.3.txt. If applicable, add the
{.source}]{.comments}
{.source}[; following below this NOSA HEADER, with the fields enclosed by
{.source}]{.comments}
{.source}[; brackets "[]" replaced with your own identifying information:
{.source}]{.comments}
{.source}[; Portions Copyright [yyyy] [name of copyright owner]
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; NOSA HEADER END
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; Copyright (c) 2014-2024 United States Government as represented by the
{.source}]{.comments}
{.source}[; National Aeronautics and Space Administration. No copyright is claimed
{.source}]{.comments}
{.source}[; in the United States under Title 17, U.S.Code. All Other Rights Reserved.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[;+
{.source}]{.comments}
{.source}[; This class is an IDL representation of the FileDescription
{.source}]{.comments}
{.source}[; element from the
{.source}]{.comments}
{.source}[; <a href="https://sscweb.gsfc.nasa.gov/">File Situation Center</a>
{.source}]{.comments}
{.source}[; (SSC) XML schema.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @copyright Copyright (c) 2014-2024 United States Government as
{.source}]{.comments}
{.source}[; represented by the National Aeronautics and Space Administration.
{.source}]{.comments}
{.source}[; No copyright is claimed in the United States under Title 17,
{.source}]{.comments}
{.source}[; U.S.Code. All Other Rights Reserved.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @author B. Harris
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[;+
{.source}]{.comments}
{.source}[; Creates an SpdfSscFileDescription object.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; If access to the Internet is through an HTTP proxy, the caller
{.source}]{.comments}
{.source}[; should ensure that the HTTP_PROXY environment is correctly set
{.source}]{.comments}
{.source}[; before this method is called. The HTTP_PROXY value should be of
{.source}]{.comments}
{.source}[; the form
{.source}]{.comments}
{.source}[; http://username:password@hostname:port/.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @param name {in} {type=string}
{.source}]{.comments}
{.source}[; file name.
{.source}]{.comments}
{.source}[; @param mimeType {in} {type=string}
{.source}]{.comments}
{.source}[; file's MIME type.
{.source}]{.comments}
{.source}[; @param length {in} {type=int}
{.source}]{.comments}
{.source}[; file's size in bytes.
{.source}]{.comments}
{.source}[; @param lastModified {in} {type=julday}
{.source}]{.comments}
{.source}[; time of last modification to file.
{.source}]{.comments}
{.source}[; @returns reference to an SpdfSscFileDescription object.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::init:source}function SpdfSscFileDescription::init, $ name, mimeType, length, lastModified compile_opt idl2 self.name = name self.mimeType = mimeType self.length = length self.lastModified = lastModified http_proxy = getenv('HTTP_PROXY') if strlen(http_proxy) gt 0 then begin proxyComponents = parse_url(http_proxy) self.proxy_hostname = proxyComponents.host self.proxy_password = proxyComponents.password self.proxy_port = proxyComponents.port self.proxy_username = proxyComponents.username if strlen(self.proxy_username) gt 0 then begin self.proxy_authentication = 3 endif endif return, self end
{.source}[;+
{.source}]{.comments}
{.source}[; Performs cleanup operations when this object is destroyed.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::cleanup:source}pro SpdfSscFileDescription::cleanup compile_opt idl2 end
{.source}[;+
{.source}]{.comments}
{.source}[; Gets the name of the file.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @returns name of the file.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::getName:source}function SpdfSscFileDescription::getName compile_opt idl2 return, self.name end
{.source}[;+
{.source}]{.comments}
{.source}[; Gets the MIME type of the file.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @returns MIME type of the file.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::getMimeType:source}function SpdfSscFileDescription::getMimeType compile_opt idl2 return, self.mimeType end
{.source}[;+
{.source}]{.comments}
{.source}[; Gets the length of the file.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @returns length of the file.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::getLength:source}function SpdfSscFileDescription::getLength compile_opt idl2 return, self.length end
{.source}[;+
{.source}]{.comments}
{.source}[; Gets the last modified time.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @returns last modified time.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::getLastModified:source}function SpdfSscFileDescription::getLastModified compile_opt idl2 return, self.lastModified end
{.source}[;+
{.source}]{.comments}
{.source}[; Prints a textual representation of this object.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::print:source}pro SpdfSscFileDescription::print compile_opt idl2 print, ' ', self.name, ': ', self.mimeType end
{.source}[;+
{.source}]{.comments}
{.source}[; Retrieves this file from a remote HTTP or FTP server and writes
{.source}]{.comments}
{.source}[; it to disk, a memory buffer, or an array of strings. The returned
{.source}]{.comments}
{.source}[; data is written to disk in the location specified by the FILENAME
{.source}]{.comments}
{.source}[; keyword. If the filename is not specified, the local name will be
{.source}]{.comments}
{.source}[; the same as this file's name in the current working directory.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @keyword buffer {in} {optional} {type=boolean} {default=false}
{.source}]{.comments}
{.source}[; if this keyword is set, the return value is a buffer
{.source}]{.comments}
{.source}[; and the FILENAME keyword is ignored.
{.source}]{.comments}
{.source}[; @keyword filename {in} {optional} {type=string}
{.source}]{.comments}
{.source}[; set this keyword equal to a string that holds the file
{.source}]{.comments}
{.source}[; name and path where the retrieved file is locally stored.
{.source}]{.comments}
{.source}[; If FILENAME specifies a full path, the file is stored in
{.source}]{.comments}
{.source}[; the specified path. If FILENAME specifies a relative
{.source}]{.comments}
{.source}[; path, the path is relative to IDL's current working
{.source}]{.comments}
{.source}[; directory. If FILENAME is not present the file is
{.source}]{.comments}
{.source}[; stored in the current working directory under the name
{.source}]{.comments}
{.source}[; the basename of filename. If FILENAME is the same
{.source}]{.comments}
{.source}[; between calls, the last file received is overwritten.
{.source}]{.comments}
{.source}[; @keyword string_array {in} {optional} {type=boolean} {default=false}
{.source}]{.comments}
{.source}[; set this keyword to treat the return value as an array
{.source}]{.comments}
{.source}[; of strings. If this keyword is set, the FILENAME and
{.source}]{.comments}
{.source}[; BUFFER keywords are ignored.
{.source}]{.comments}
{.source}[; @keyword callback_function {in} {optional} {type=string}
{.source}]{.comments}
{.source}[; this keyword value is the name of the IDL function that
{.source}]{.comments}
{.source}[; is to be called during this retrieval operation. The
{.source}]{.comments}
{.source}[; callbacks provide feedback to the user about the ongoing
{.source}]{.comments}
{.source}[; operation, as well as provide a method to cancel an
{.source}]{.comments}
{.source}[; ongoing operation. If this keyword is not set, no
{.source}]{.comments}
{.source}[; callback to the caller is made. For information on
{.source}]{.comments}
{.source}[; creating a callback function, see "Using Callbacks with
{.source}]{.comments}
{.source}[; the IDLnetURL Object" in the IDL documentation.
{.source}]{.comments}
{.source}[; @keyword callback_data {in} {optional} {type=reference}
{.source}]{.comments}
{.source}[; this keyword value contains data that is passed to the
{.source}]{.comments}
{.source}[; caller when a callback is made. The data contained in
{.source}]{.comments}
{.source}[; this variable is defined and set by the caller. The
{.source}]{.comments}
{.source}[; variable is passed, unmodified, directly to the caller
{.source}]{.comments}
{.source}[; as a parameter in the callback function. If this keyword
{.source}]{.comments}
{.source}[; is not set, the corresponding callback parameter's value
{.source}]{.comments}
{.source}[; is undefined.
{.source}]{.comments}
{.source}[; @keyword sslVerifyPeer {in} {optional} {type=int} {default=1}
{.source}]{.comments}
{.source}[; Specifies whether the authenticity of the peer's SSL
{.source}]{.comments}
{.source}[; certificate should be verified. When 0, the connection
{.source}]{.comments}
{.source}[; succeeds regardless of what the peer SSL certificate
{.source}]{.comments}
{.source}[; contains.
{.source}]{.comments}
{.source}[; @returns one of the following: A string containing the full path
{.source}]{.comments}
{.source}[; of the file retrieved from the remote HTTP or FTP server,
{.source}]{.comments}
{.source}[; A byte vector, if the BUFFER keyword is set, An array of
{.source}]{.comments}
{.source}[; strings, if the STRING_ARRAY keyword is set, A null
{.source}]{.comments}
{.source}[; string, if no data were returned by the method.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription::getFile:source}function SpdfSscFileDescription::getFile, $ buffer = buffer, filename = filename, $ string_array = string_array, $ callback_function = callback_function, $ callback_data = callback_data, $ sslVerifyPeer = sslVerifyPeer compile_opt idl2 if n_elements(filename) eq 0 then begin urlComponents = parse_url(self.name) filename = file_basename(urlComponents.path) endif if n_elements(sslVerifyPeer) eq 0 then begin sslVerifyPeer = 1 endif fileUrl = $ obj_new('IDLnetUrl', $ proxy_authentication = self.proxy_authentication, $ proxy_hostname = self.proxy_hostname, $ proxy_port = self.proxy_port, $ proxy_username = self.proxy_username, $ proxy_password = self.proxy_password, $ ssl_verify_peer = sslVerifyPeer) if keyword_set(callback_function) then begin fileUrl -> setProperty, callback_function = callback_function endif if keyword_set(callback_data) then begin fileUrl -> setProperty, callback_data = callback_data endif result = fileUrl->get(buffer = buffer, filename = filename, $ string_array = string_array, url = self.name) obj_destroy, fileUrl return, result end
{.source}[;+
{.source}]{.comments}
{.source}[; Defines the SpdfSscFileDescription class.
{.source}]{.comments}
{.source}[;
{.source}]{.comments}
{.source}[; @field name file name.
{.source}]{.comments}
{.source}[; @field mimeType file's MIME type.
{.source}]{.comments}
{.source}[; @field length file size in bytes.
{.source}]{.comments}
{.source}[; @field lastModified julday of the last time the file was modified.
{.source}]{.comments}
{.source}[; @field proxy_authentication IDLnetURL PROXY_AUTHENTICATION property
{.source}]{.comments}
{.source}[; value.
{.source}]{.comments}
{.source}[; @field proxy_hostname IDLnetURL PROXY_HOSTNAME property value.
{.source}]{.comments}
{.source}[; @field proxy_password IDLnetURL PROXY_PASSWORD property value.
{.source}]{.comments}
{.source}[; @field proxy_port IDLnetURL PROXY_PORT property value.
{.source}]{.comments}
{.source}[; @field proxy_username IDLnetURL PROXY_USERNAME property value.
{.source}]{.comments}
{.source}[;-
{.source}]{.comments}
{.source}[]{#SpdfSscFileDescription__define:source}pro SpdfSscFileDescription__define compile_opt idl2 struct = { SpdfSscFileDescription, $ name:'', $ mimetype:'', $ length:0LL, $ lastModified:0D, $ proxy_authentication:0, $ proxy_hostname:'', $ proxy_password:'', $ proxy_port:'', $ proxy_username:'' $ } end
{.source}
:::