org.licas.service.resource.info

## Class InfoURL

- java.lang.Object
- - org.licas.service.resource.Resource
  - - org.licas.service.resource.info.InfoURL

- Direct Known Subclasses:
    InfoHtml

      public class InfoURL
      extends Resource

  This is used by the `InformationService` to store and parse a remote file location. The URL link to the file is stored, where the link contents are returned upon request. If the action is stored as `AiConst`.`LOADREMOTE` then the contents are dynamically retrieved upon request, but if the action is stored as `LOADCONTENTS` then the contents are stored once during initialisation and retrieved locally.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.net.URL` | `url` The URL address
    `protected FileObject` | `urlData` The url data

    - ### Fields inherited from class org.licas.service.resource.Resource

      `dataType, INFOANYTYPE, INFOBINARYTYPE, INFOHTMLTYPE, INFOSTREAMXMLTYPE, INFOSTRINGTYPE, INFOTEXTTYPE, INFOURLTYPE, INFOXMLTYPE, LISTCONTAINERTYPE, QUERYCONTAINERTYPE, RANDOMCONTAINERTYPE, uuid`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InfoURL(java.lang.String theDataType, org.licas_xml.abs.Element dataXml)` Create a new instance of InfoURL.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.licas_xml.abs.Element` | `getInfo(org.licas_xml.abs.Element infoDescr)` Get the currently loaded source information wrapped in an XML element.
    `java.lang.String` | `getURL()` Get the url address.
    `java.lang.Object` | `getValue(org.licas_xml.abs.Element infoDescr)` Get the value itself and not a wrapped description.
    `boolean` | `parseInfo(org.licas_xml.abs.Element dataXml)` Parse the data description in the document to create the data object.

    - ### Methods inherited from class org.licas.service.resource.Resource

      `createResource, dataFromResourceType, getDataType, getUUID, parseValueElem, resourceTypeForDataType, setUUID, setUUID`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### url

          protected java.net.URL url

      The URL address

    - #### urlData

          protected FileObject urlData

      The url data

  - ### Constructor Detail

    - #### InfoURL

          public InfoURL(java.lang.String theDataType,
                         org.licas_xml.abs.Element dataXml)
                  throws java.lang.Exception

      Create a new instance of InfoURL.
      Parameters:
        `theDataType` - the resource data type.
        `dataXml` - a description of the initialisation parameters. Can be null.
      Throws:
        `java.lang.Exception` - any error.

  - ### Method Detail

    - #### parseInfo

          public boolean parseInfo(org.licas_xml.abs.Element dataXml)
                            throws java.lang.Exception

      Parse the data description in the document to create the data object. This version should read a URL address and store that. It also only returns the URL address upon request.
      Specified by:
        `parseInfo` in class `Resource`
      Parameters:
        `dataXml` - this must include a `VALUE` element that stores a String-based URL path description. It can also contain an `AiConst`.`ACTION` element, which can be set to `LOADREMOTE` to ask the URI and not the actual contents to be stored.
      Returns:
        true if the file was successfully loaded, false otherwise.
      Throws:
        `java.lang.Exception` - any error.

    - #### getURL

          public java.lang.String getURL()

      Get the url address.
      Returns:
        the value of `url.toExternalForm()`.

    - #### getInfo

          public org.licas_xml.abs.Element getInfo(org.licas_xml.abs.Element infoDescr)
                                            throws java.lang.Exception

      Get the currently loaded source information wrapped in an XML element. This is the whole unparsed URL document.
      Specified by:
        `getInfo` in class `Resource`
      Parameters:
        `infoDescr` - a description of the info resource value that should be retrieved. Can be null, or it can include an `AiConst`.`ACTION` element, which can be set to `LOADREMOTE` to ask the URI and not the actual contents to be stored.
      Returns:
        the value of the resource info as an XML element. This format is consistent with adding a 'Data' element through an admin document. HTML description is coded, so probably need to use XmlHandler.removeStringSpec(...) after retrieving the XML 'Data' element's text content on the client side.
      Throws:
        `java.lang.Exception` - any error.

    - #### getValue

          public java.lang.Object getValue(org.licas_xml.abs.Element infoDescr)
                                    throws java.lang.Exception

      Get the value itself and not a wrapped description. This is the URL address as a string.
      Specified by:
        `getValue` in class `Resource`
      Parameters:
        `infoDescr` - a description of the info resource value that should be retrieved. Can be null, or it can include an `AiConst`.`ACTION` element, which can be set to `LOADREMOTE` to ask the URI and not the actual contents to be stored.
      Returns:
        the info value.
      Throws:
        `java.lang.Exception` - any error.