MetaSeeker (gCube Share Updates Portlet 1.7.0-3.7.0 API)
Description: my description
Date: 2015-05-19

org.gcube.portlets.user.shareupdates.server.metaseeker

## Class MetaSeeker

- java.lang.Object
- - org.gcube.portlets.user.shareupdates.server.metaseeker.MetaSeeker

-     public class MetaSeeker
      extends Object

  Version:
    1.0 Nov 2012 This class parses the meta elements in the head of an html page and constructs a hashmap with the content attr value associated to the attr name e.g. ex. #getContent("description") returns 'my description'
  Author:
    Massimiliano Assante ISTI-CNR

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Hashtable<String,String[]>` | `BASE_TYPES`
    `static String[]` | `REQUIRED_META`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetaSeeker()` Create an open graph representation for generating your own Open Graph object
    `MetaSeeker(URLConnection connection, URL httpURL)` Fetch the metas representation from a web site

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Hashtable<String,ArrayList<MetaElement>>` | `exposeTable()` Obtain the underlying HashTable
    `String` | `getBaseType()` Get the basic type of the Open graph page as per the specification
    `String` | `getContent(String property)` Get a value of a given Open Graph property
    `String` | `getOriginalUrl()` Get the original URL the Open Graph page was obtained from
    `MetaElement[]` | `getProperties()` Get all the defined properties of the Open Graph object
    `MetaElement[]` | `getProperties(String property)` Get all the defined properties of the Open Graph object
    `boolean` | `hasChanged()` Test if the object has been modified by setters/deleters.
    `boolean` | `isFromWeb()` Test if the Open Graph object was initially a representation of a web page
    `void` | `removeProperty(String property)` Removed a defined property
    `void` | `setProperty(String property, String content)` Set the meta property to a specific value

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

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

- - ### Field Detail

    - #### REQUIRED_META

          public static final String[] REQUIRED_META

    - #### BASE_TYPES

          public static final Hashtable<String,String[]> BASE_TYPES

  - ### Constructor Detail

    - #### MetaSeeker

          public MetaSeeker()

      Create an open graph representation for generating your own Open Graph object

    - #### MetaSeeker

          public MetaSeeker(URLConnection connection,
                    URL httpURL)
                     throws IOException,
                            Exception

      Fetch the metas representation from a web site
      Parameters:
        `url` - The address to the web page to fetch the meta
      Throws:
        `IOException` - If a network error occurs, the HTML parser will throw an IO Exception
        `Exception`

  - ### Method Detail

    - #### getBaseType

          public String getBaseType()

      Get the basic type of the Open graph page as per the specification
      Returns:
        Base type as defined by specification, null otherwise

    - #### getContent

          public String getContent(String property)

      Get a value of a given Open Graph property
      Parameters:
        `property` - The Open graph property key
      Returns:
        Returns the value of the first property defined, null otherwise

    - #### getProperties

          public MetaElement[] getProperties()

      Get all the defined properties of the Open Graph object
      Returns:
        An array of all currently defined properties

    - #### getProperties

          public MetaElement[] getProperties(String property)

      Get all the defined properties of the Open Graph object
      Parameters:
        `property` - The property to focus on
      Returns:
        An array of all currently defined properties

    - #### getOriginalUrl

          public String getOriginalUrl()

      Get the original URL the Open Graph page was obtained from
      Returns:
        The address to the Open Graph object page

    - #### setProperty

          public void setProperty(String property,
                         String content)

      Set the meta property to a specific value
      Parameters:
        `property` - The meta where XXXX is the property you wish to set
        `content` - The value or contents of the property to be set

    - #### removeProperty

          public void removeProperty(String property)

      Removed a defined property
      Parameters:
        `property` - The og:XXXX where XXXX is the property you wish to remove

    - #### exposeTable

          public Hashtable<String,ArrayList<MetaElement>> exposeTable()

      Obtain the underlying HashTable
      Returns:
        The underlying structure as a Hashtable

    - #### isFromWeb

          public boolean isFromWeb()

      Test if the Open Graph object was initially a representation of a web page
      Returns:
        True if the object is from a web page, false otherwise

    - #### hasChanged

          public boolean hasChanged()

      Test if the object has been modified by setters/deleters. This is only relevant if this object initially represented a web page
      Returns:
        True True if the object has been modified, false otherwise

Copyright © 2015. All Rights Reserved.