RSXMLHelper
Date: 2013-03-24

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gcube.common.searchservice.searchlibrary.resultset.helpers
Class RSXMLHelper

    java.lang.Object
      org.gcube.common.searchservice.searchlibrary.resultset.helpers.RSXMLHelper

    public class RSXMLHelper

extends java.lang.Object

Helper class used by `ResultSet` to create and manipulate xml files / content

Author:
  UoA

Constructor Summary
`RSXMLHelper()`

Method Summary
`static org.w3c.dom.Document` | `addCustomProperty(org.w3c.dom.Document dom, PropertyElementBase prop)` Adds the provided property to the respective placeholder in the provided DOM representation of the head part
`static void` | `createHead(java.lang.String filename, java.lang.String next, java.lang.String[] properties, boolean dataFlow)` Creates an XML representation of a `ResultSet` head part and persists it to storage
`static void` | `createHead(java.lang.String filename, java.lang.String next, java.lang.String[] properties, boolean dataFlow, int access, boolean forward, java.util.Date date, java.lang.String pkey, java.lang.String encryptedkey, java.lang.String allprops)` Creates an XML representation of a `ResultSet` head part and persists it to storage
`static void` | `createHead(java.lang.String filename, java.lang.String next, java.lang.String properties, boolean dataFlow)` Creates an XML representation of a `ResultSet` head part and persists it to storage
`static java.lang.String` | `executeQueryOnDocument(org.w3c.dom.Document dom, java.lang.String xPath)` Evaluates the provided xPath and returns a serialization of the results
`static boolean` | `executeQueryOnResults(java.lang.String result, java.lang.String xPath)` Perofmors the provided xPath expression on the serialized xml string provided.
`static java.util.Vector<java.lang.Integer>` | `executeQueryOnResultsFile(java.lang.String filename, java.lang.String xPath)` evaluates the provided xPath expression against the content of the provided file and returns the indexes of the results that the evaluation returned results
`static int` | `getAccess(org.w3c.dom.Document dom)` Returns whether or not the RS is populated with results access
`static boolean` | `getDataFlow(org.w3c.dom.Document dom)` Returns whether or not the RS is populated with results on demand
`static org.w3c.dom.Document` | `getDocument(java.lang.String filename)` Retrieves the DOM object parsing the content of the provided file
`static java.lang.String` | `getEncKey(org.w3c.dom.Document dom)` Get the encryption key
`static java.util.Date` | `getExpireDate(org.w3c.dom.Document dom)` Returns whether or not the RS is populated with results forward
`static boolean` | `getForward(org.w3c.dom.Document dom)` Returns whether or not the RS is populated with results forward
`static java.lang.String` | `getLink(org.w3c.dom.Document dom, java.lang.String which)` Retrieves the previous or nect link the provided document has
`static java.util.Vector<java.lang.String>` | `getProperties(org.w3c.dom.Document dom, java.lang.String type)` Retrives the properties with the specified type from the DOM object representing a head part
`static java.lang.String` | `getPublicKey(org.w3c.dom.Document dom)` Get the public key
`static void` | `persistDocument(org.w3c.dom.Document dom, java.lang.String filename)` Persists the provided DOM object in a file wholse filename is provided
`static java.lang.String` | `retrieveCustomProperties(org.w3c.dom.Document dom)` Retrives the serialized version of the CustomPropertied that are contained in the Head part DOM object
`static org.w3c.dom.Document` | `setExpireDate(org.w3c.dom.Document dom, java.util.Date date)` Returns if the RS is populated with results forward
`static org.w3c.dom.Document` | `setForward(org.w3c.dom.Document dom, boolean forward)` Set forward only access to this RS
`static void` | `transform(java.lang.String xslt, java.lang.String source, java.lang.String target)` Performs a xslt transformation to the input file and dumpt the out put to a new file
`static void` | `transform(javax.xml.transform.Templates xslt, java.lang.String source, java.lang.String target)` Performs a xslt transformation to the input file and dumpt the out put to a new file
`static org.w3c.dom.Document` | `updateAccessCounter(org.w3c.dom.Document dom, int newaccess)` Adds the provided property to the respective place holder in the provided DOM representation of the head part
`static void` | `updateProperties(java.lang.String headName, java.lang.String serializedProps)` Overrides existing custom properties and updates them
`static void` | `updateProperties(java.lang.String headName, java.lang.String[] properties)` Overrides existing custom properties and updates them

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RSXMLHelper

    public RSXMLHelper()

Method Detail

### createHead

    public static void createHead(java.lang.String filename,
                                  java.lang.String next,
                                  java.lang.String[] properties,
                                  boolean dataFlow)
                           throws java.lang.Exception

  Creates an XML representation of a `ResultSet` head part and persists it to storage

  Parameters:
    `filename` - The name of the file that must be created to store the created head part
    `next` - The name of the file that will hold the next header in the chain
    `properties` - The properties the head should have
    `dataFlow` - Whether or not the RS supports on demand production or results
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### createHead

    public static void createHead(java.lang.String filename,
                                  java.lang.String next,
                                  java.lang.String[] properties,
                                  boolean dataFlow,
                                  int access,
                                  boolean forward,
                                  java.util.Date date,
                                  java.lang.String pkey,
                                  java.lang.String encryptedkey,
                                  java.lang.String allprops)
                           throws java.lang.Exception

  Creates an XML representation of a `ResultSet` head part and persists it to storage

  Parameters:
    `filename` - The name of the file that must be created to store the created head part
    `next` - The name of the file that will hold the next header in the chain
    `properties` - The properties the head should have
    `dataFlow` - Whether or not the RS supports on demand production or results
    `access` - access leasing
    `forward` - is forward only property enabled?
    `date` - time leasing
    `pkey` - private key
    `encryptedkey` - encrypted key
    `allprops` - all properties in a string
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occurred

### createHead

    public static void createHead(java.lang.String filename,
                                  java.lang.String next,
                                  java.lang.String properties,
                                  boolean dataFlow)
                           throws java.lang.Exception

  Creates an XML representation of a `ResultSet` head part and persists it to storage

  Parameters:
    `filename` - The name of the file that must be created to store the created head part
    `next` - The name of the file that will hold the next header in the chain
    `properties` - The serialized properties the head should have
    `dataFlow` - Whether or not the RS supports on demand production or results
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### updateProperties

    public static void updateProperties(java.lang.String headName,
                                        java.lang.String[] properties)
                                 throws java.lang.Exception

  Overrides existing custom properties and updates them

  Parameters:
    `headName` - the name of the head file
    `properties` - the properties
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### updateProperties

    public static void updateProperties(java.lang.String headName,
                                        java.lang.String serializedProps)
                                 throws java.lang.Exception

  Overrides existing custom properties and updates them

  Parameters:
    `headName` - the name of the head file
    `serializedProps` - the serialized properties
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### persistDocument

    public static void persistDocument(org.w3c.dom.Document dom,
                                       java.lang.String filename)
                                throws java.lang.Exception

  Persists the provided DOM object in a file wholse filename is provided

  Parameters:
    `dom` - The DOM object to persist
    `filename` - The filename to place the serialization in
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### getDocument

    public static org.w3c.dom.Document getDocument(java.lang.String filename)
                                            throws java.lang.Exception

  Retrieves the DOM object parsing the content of the provided file

  Parameters:
    `filename` - The file name to parse
  Returns:
    The created DOM object
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### addCustomProperty

    public static org.w3c.dom.Document addCustomProperty(org.w3c.dom.Document dom,
                                                         PropertyElementBase prop)
                                                  throws java.lang.Exception

  Adds the provided property to the respective placeholder in the provided DOM representation of the head part

  Parameters:
    `dom` - The DOM object representing the head part
    `prop` - The property to add
  Returns:
    The updated DOM object
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### updateAccessCounter

    public static org.w3c.dom.Document updateAccessCounter(org.w3c.dom.Document dom,
                                                           int newaccess)
                                                    throws java.lang.Exception

  Adds the provided property to the respective place holder in the provided DOM representation of the head part

  Parameters:
    `dom` - The DOM object representing the head part
    `newaccess` - The property to add
  Returns:
    The updated DOM object
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occurred

### getProperties

    public static java.util.Vector<java.lang.String> getProperties(org.w3c.dom.Document dom,
                                                                   java.lang.String type)
                                                            throws java.lang.Exception

  Retrives the properties with the specified type from the DOM object representing a head part

  Parameters:
    `dom` - The DOM object containing the Head content
    `type` - The type of properties to retrieve
  Returns:
    The retrieved properties
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### getLink

    public static java.lang.String getLink(org.w3c.dom.Document dom,
                                           java.lang.String which)
                                    throws java.lang.Exception

  Retrieves the previous or nect link the provided document has

  Parameters:
    `dom` - The document to retrieve the document from
    `which` - `RSConstants.nextLink` or `RSConstants.previousLink`
  Returns:
    The value of the requested link
  Throws:
    `java.lang.Exception` - The link value could not be retrieved

### getDataFlow

    public static boolean getDataFlow(org.w3c.dom.Document dom)
                               throws java.lang.Exception

  Returns whether or not the RS is populated with results on demand

  Parameters:
    `dom` - The document to retrieve the document from
  Returns:
    `true` if the results are proiduced on demand,`false` otherwise
  Throws:
    `java.lang.Exception` - The link value could not be retrieved

### getAccess

    public static int getAccess(org.w3c.dom.Document dom)
                         throws java.lang.Exception

  Returns whether or not the RS is populated with results access

  Parameters:
    `dom` - The document to retrieve the document from
  Returns:
    `int` access window
  Throws:
    `java.lang.Exception` - The link value could not be retrieved

### retrieveCustomProperties

    public static java.lang.String retrieveCustomProperties(org.w3c.dom.Document dom)
                                                     throws java.lang.Exception

  Retrives the serialized version of the CustomPropertied that are contained in the Head part DOM object

  Parameters:
    `dom` - The DOM object containing the head part
  Returns:
    The serialized properties
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### executeQueryOnDocument

    public static java.lang.String executeQueryOnDocument(org.w3c.dom.Document dom,
                                                          java.lang.String xPath)
                                                   throws java.lang.Exception

  Evaluates the provided xPath and returns a serialization of the results

  Parameters:
    `dom` - The document to use
    `xPath` - The xPath to be evaluated
  Returns:
    the retrieved serialization
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### executeQueryOnResults

    public static boolean executeQueryOnResults(java.lang.String result,
                                                java.lang.String xPath)
                                         throws java.lang.Exception

  Perofmors the provided xPath expression on the serialized xml string provided.

  Parameters:
    `result` - The xml serialization to evaluate the expression against
    `xPath` - The expression to be avaluated
  Returns:
    `true` if the evaluation returned result, `false` otherwise
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### executeQueryOnResultsFile

    public static java.util.Vector<java.lang.Integer> executeQueryOnResultsFile(java.lang.String filename,
                                                                                java.lang.String xPath)
                                                                         throws java.lang.Exception

  evaluates the provided xPath expression against the content of the provided file and returns the indexes of the results that the evaluation returned results

  Parameters:
    `filename` - The file whose results must be iterated over
    `xPath` - The xpath expression
  Returns:
    The indexes of the records that produced output during evaluation
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error occured

### transform

    public static void transform(java.lang.String xslt,
                                 java.lang.String source,
                                 java.lang.String target)
                          throws java.lang.Exception

  Performs a xslt transformation to the input file and dumpt the out put to a new file

  Parameters:
    `xslt` - The XSLT transformation to apply
    `source` - The source file to transform
    `target` - The target file to place the output
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error has occured

### transform

    public static void transform(javax.xml.transform.Templates xslt,
                                 java.lang.String source,
                                 java.lang.String target)
                          throws java.lang.Exception

  Performs a xslt transformation to the input file and dumpt the out put to a new file

  Parameters:
    `xslt` - The XSLT transformation to apply
    `source` - The source file to transform
    `target` - The target file to place the output
  Throws:
    `java.lang.Exception` - An unrecoverable for the operation error has occured

### getForward

    public static boolean getForward(org.w3c.dom.Document dom)
                              throws java.lang.Exception

  Returns whether or not the RS is populated with results forward

  Parameters:
    `dom` - The document to retrieve the document from
  Returns:
    `boolean` boolean window
  Throws:
    `java.lang.Exception` - The value could not be retrieved

### setForward

    public static org.w3c.dom.Document setForward(org.w3c.dom.Document dom,
                                                  boolean forward)
                                           throws java.lang.Exception

  Set forward only access to this RS

  Parameters:
    `dom` - the dom of the header
    `forward` - the flag to set for forward
  Returns:
    The header in a Document
  Throws:
    `java.lang.Exception` - Something went wrong

### getExpireDate

    public static java.util.Date getExpireDate(org.w3c.dom.Document dom)
                                        throws java.lang.Exception

  Returns whether or not the RS is populated with results forward

  Parameters:
    `dom` - The document to retrieve the document from
  Returns:
    `boolean` boolean window
  Throws:
    `java.lang.Exception` - The value could not be retrieved

### setExpireDate

    public static org.w3c.dom.Document setExpireDate(org.w3c.dom.Document dom,
                                                     java.util.Date date)
                                              throws java.lang.Exception

  Returns if the RS is populated with results forward

  Parameters:
    `dom` - The document to retrieve the document from
    `date` - the expire date
  Returns:
    the header in a document
  Throws:
    `java.lang.Exception` - The value could not be retrieved

### getEncKey

    public static java.lang.String getEncKey(org.w3c.dom.Document dom)
                                      throws java.lang.Exception

  Get the encryption key

  Parameters:
    `dom` - The document to retrieve the document from
  Returns:
    the encrypted key
  Throws:
    `java.lang.Exception` - An error occurred

### getPublicKey

    public static java.lang.String getPublicKey(org.w3c.dom.Document dom)
                                         throws java.lang.Exception

  Get the public key

  Parameters:
    `dom` - The document to retrieve the document from
  Returns:
    the key
  Throws:
    `java.lang.Exception` - An error occurred

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD