com.xmlserv.app.shared
Class Format

java.lang.Object
  |
  +--com.xmlserv.app.shared.Format

public class Format
extends java.lang.Object

Format abstraction. The list of formats defined together with the subdirectory structure used to manage the different formats of a file on disk are accessible through this class.
This differentiates between downloadable and non-downloadable formats as given in the corr. field downloadable in the table fielformats.


Inner Class Summary
static class Format.Detail
          Inner class representing detailed info on a format definition.
 
Constructor Summary
Format()
          Empty constructor needed for inner class references.
 
Method Summary
 java.util.Vector getAvailableFormatList(java.sql.Connection con, java.lang.String basepath, java.lang.String filename)
          Return a list of formats available for the given image.
 org.jdom.Element getAvailableFormatListElement(java.sql.Connection con, java.lang.String basepath, java.lang.String filename)
          Get List of formats for the given file, marking unavailable formats with an attribute 'unavailable'.
static Format.Detail getFormat(java.sql.Connection con, java.lang.String reqFormat)
           
static Format.Detail getFormatByExtension(java.sql.Connection con, java.lang.String extension, boolean uploadFormat)
           
static Format.Detail getFormatById(java.sql.Connection con, int id)
          Get a format definition by its ID.
static Format.Detail getFormatByName(java.sql.Connection con, java.lang.String name)
           
 java.util.Vector getFormatList(java.sql.Connection con, boolean downloadable)
          Get the list of available/supported formats.
 org.jdom.Element getFormatListElement(java.sql.Connection con, boolean downloadable)
          Get Format List as a JDOM Element
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Format

public Format()
Empty constructor needed for inner class references.
Method Detail

getFormatList

public java.util.Vector getFormatList(java.sql.Connection con,
                                      boolean downloadable)
                               throws java.sql.SQLException
Get the list of available/supported formats. This simply reads the list of formats from the DB table. Use getFormatDetail() for additional information on a single format.
Parameters:
con - The DB connection.
downloadable - true: List only downloadable, false: list all.

getAvailableFormatList

public java.util.Vector getAvailableFormatList(java.sql.Connection con,
                                               java.lang.String basepath,
                                               java.lang.String filename)
                                        throws java.sql.SQLException,
                                               java.io.IOException
Return a list of formats available for the given image. Note: This lists only formats marked as downloadable in the DB (attribute in table fileformats)
Parameters:
con - A Connection object.
basepath - The Basepath where the image directory structure starts.
filename - The filename for this image without extension.
Returns:
A Vector containing all Format IDs available for this file.

getFormatListElement

public org.jdom.Element getFormatListElement(java.sql.Connection con,
                                             boolean downloadable)
                                      throws XMLServException
Get Format List as a JDOM Element

getAvailableFormatListElement

public org.jdom.Element getAvailableFormatListElement(java.sql.Connection con,
                                                      java.lang.String basepath,
                                                      java.lang.String filename)
                                               throws XMLServException
Get List of formats for the given file, marking unavailable formats with an attribute 'unavailable'.

getFormatById

public static Format.Detail getFormatById(java.sql.Connection con,
                                          int id)
                                   throws XMLServException
Get a format definition by its ID.

getFormatByName

public static Format.Detail getFormatByName(java.sql.Connection con,
                                            java.lang.String name)
                                     throws XMLServException

getFormatByExtension

public static Format.Detail getFormatByExtension(java.sql.Connection con,
                                                 java.lang.String extension,
                                                 boolean uploadFormat)
                                          throws XMLServException

getFormat

public static Format.Detail getFormat(java.sql.Connection con,
                                      java.lang.String reqFormat)
                               throws XMLServException

main

public static void main(java.lang.String[] args)