edu.ucsb.nceas.metacat
Class MetaCatUtil

java.lang.Object
  |
  +--edu.ucsb.nceas.metacat.MetaCatUtil

public class MetaCatUtil
extends java.lang.Object

A suite of utility classes for the metadata catalog server


Field Summary
static AbstractDatabase dbAdapter
           
 
Constructor Summary
MetaCatUtil()
           
 
Method Summary
static java.lang.Object createObject(java.lang.String className)
          Instantiate a class using the name of the class at runtime
static void debugMessage(java.lang.String msg, int debugLevel)
          Utility method to print debugging messages.
static java.net.URL fileToURL(java.io.File file)
          Utility method to convert a file handle into a URL
static java.lang.String getDocIdFromString(java.lang.String str)
          Utility method to get docid from a given string
static java.lang.String getDocIdWithoutRevFromInlineDataID(java.lang.String inlineDataID)
          Method to get docidwithrev from eml2 inline data id The eml inline data id would look like eml.200.2.3
static java.lang.String getDocIdWithRevFromOnlineURL(java.lang.String url)
          Get docid from online/url string
static java.lang.String getLocalReplicationServerName()
          Method to get the name of local replication server
static java.lang.String getOption(java.lang.String optionName)
          Utility method to get an option value from the properties file
 java.lang.String getOption(java.lang.String optionName, java.lang.String propFile)
          Utility method to get an option value from a properties file
static java.util.Vector getOptionList(java.lang.String optiontext)
           
static java.lang.String getRevisionStringFromString(java.lang.String str)
          Utility method to get version string from a given string
static int getVersionFromString(java.lang.String str)
          Utility method to get version number from a given string
static java.lang.String normalize(java.lang.String s)
          Normalizes the given string.
static java.util.Hashtable parseQuery(java.lang.String query)
          Utility method to parse the query part of a URL into parameters.
static java.lang.String replaceWhiteSpaceForURL(java.lang.String urlHasWhiteSpace)
          A method to replace whitespace in url
static java.util.Stack reviseStack(java.util.Stack stack)
          Revise stack change a stack to opposite order
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbAdapter

public static AbstractDatabase dbAdapter
Constructor Detail

MetaCatUtil

public MetaCatUtil()
Method Detail

createObject

public static java.lang.Object createObject(java.lang.String className)
                                     throws java.lang.Exception
Instantiate a class using the name of the class at runtime

Parameters:
className - the fully qualified name of the class to instantiate
java.lang.Exception

getOption

public static java.lang.String getOption(java.lang.String optionName)
Utility method to get an option value from the properties file

Parameters:
optionName - the name of the option requested

getOption

public java.lang.String getOption(java.lang.String optionName,
                                  java.lang.String propFile)
Utility method to get an option value from a properties file

Parameters:
optionName - the name of the option requested
propFile - the name of the file where to get the properties from

fileToURL

public static java.net.URL fileToURL(java.io.File file)
Utility method to convert a file handle into a URL


parseQuery

public static java.util.Hashtable parseQuery(java.lang.String query)
                                      throws java.net.MalformedURLException
Utility method to parse the query part of a URL into parameters. This method assumes the format of the query par tof the url is an ampersand separated list of name/value pairs, with equal signs separating the name from the value (e.g., name=tom&zip=99801 ). Returns a has of the name value pairs, hashed on name.

java.net.MalformedURLException

debugMessage

public static void debugMessage(java.lang.String msg,
                                int debugLevel)
Utility method to print debugging messages. User can set debug level for this message. The number is fewer, the message is more important


getOptionList

public static java.util.Vector getOptionList(java.lang.String optiontext)

normalize

public static java.lang.String normalize(java.lang.String s)
Normalizes the given string. Taken from configXML.java


getDocIdWithRevFromOnlineURL

public static java.lang.String getDocIdWithRevFromOnlineURL(java.lang.String url)
Get docid from online/url string


getDocIdFromString

public static java.lang.String getDocIdFromString(java.lang.String str)
Utility method to get docid from a given string


getVersionFromString

public static int getVersionFromString(java.lang.String str)
                                throws java.lang.NumberFormatException
Utility method to get version number from a given string

java.lang.NumberFormatException

getRevisionStringFromString

public static java.lang.String getRevisionStringFromString(java.lang.String str)
                                                    throws java.lang.NumberFormatException
Utility method to get version string from a given string

java.lang.NumberFormatException

getLocalReplicationServerName

public static java.lang.String getLocalReplicationServerName()
Method to get the name of local replication server


getDocIdWithoutRevFromInlineDataID

public static java.lang.String getDocIdWithoutRevFromInlineDataID(java.lang.String inlineDataID)
Method to get docidwithrev from eml2 inline data id The eml inline data id would look like eml.200.2.3


reviseStack

public static java.util.Stack reviseStack(java.util.Stack stack)
Revise stack change a stack to opposite order


replaceWhiteSpaceForURL

public static java.lang.String replaceWhiteSpaceForURL(java.lang.String urlHasWhiteSpace)
A method to replace whitespace in url



Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.