|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.ucsb.nceas.metacat.MetaCatUtil
public class MetaCatUtil
A suite of utility classes for the metadata catalog server
| Field Summary | |
|---|---|
static AbstractDatabase |
dbAdapter
|
static java.util.Vector |
pathsForIndexing
|
| Constructor Summary | |
|---|---|
MetaCatUtil()
|
|
| Method Summary | |
|---|---|
static void |
addSkinConfig(java.lang.String skinName,
java.util.Properties skinProperties)
Adds the Properties and skin to the list of skin configurations. |
static boolean |
canInsertOrUpdate(java.lang.String username,
java.lang.String[] groups)
A method to check if the specified user can insert the document |
static void |
copyFile(java.lang.String sourceName,
java.lang.String destName)
Copy a file between two locations specified as strings. |
static java.lang.Object |
createObject(java.lang.String className)
Instantiate a class using the name of the class at runtime |
static java.net.URL |
fileToURL(java.io.File file)
Utility method to convert a file handle into a URL |
static java.lang.String |
getAccessionNumberFromEcogridIdentifier(java.lang.String identifier)
Eocgorid identifier will look like: ecogrid://knb/tao.1.1 The AccessionNumber tao.1.1 will be returned. |
static java.lang.String |
getDocIdFromAccessionNumber(java.lang.String accessionNumber)
This method will get docid from an AccessionNumber. |
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 |
getInlineDataIdWithoutRev(java.lang.String accessionNumber)
This method will get inline data id without the revision number. |
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 |
static java.util.Vector |
getOptionList(java.lang.String optiontext)
|
static int |
getRevisionFromAccessionNumber(java.lang.String accessionNumber)
This method will get revision from an AccessionNumber. |
static java.lang.String |
getRevisionStringFromString(java.lang.String str)
Utility method to get version string from a given string |
static java.util.Properties |
getSkinConfig(java.lang.String skinName)
Return the Properties for a given skin name. |
static java.lang.String |
getSmartDocId(java.lang.String str)
This method will call both getDocIdFromString and getDocIdFromAccessionNumber. |
static void |
getUserAccessControlLists()
A method to read administrators and moderators list from the metacat.properties |
static int |
getVersionFromString(java.lang.String str)
Utility method to get version number from a given string |
static boolean |
hasSkinConfig(java.lang.String skinName)
Returns true if Properties exist for a given skin name, false otherwise. |
static boolean |
isAdministrator(java.lang.String username,
java.lang.String[] groups)
A method to check if the specified user is part of the administrators list |
static boolean |
isAllowedSubmitter(java.lang.String username,
java.lang.String[] groups)
A method to check if the specified user is part of the moderators list |
static boolean |
isDeniedSubmitter(java.lang.String username,
java.lang.String[] groups)
A method to check if the specified user is part of the moderators list |
static boolean |
isModerator(java.lang.String username,
java.lang.String[] groups)
A method to check if the specified user is part of the moderators list |
static java.lang.String |
normalize(java.lang.String s)
Normalizes a string read from DB. |
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 |
static void |
setOption(java.lang.String optionName,
java.lang.String newValue)
Utility method to set an option value from the properties file |
static void |
writeDebugToDelimiteredFile(java.lang.String debugInfo,
boolean newLine)
Writes debug information into a file in delimitered format |
static void |
writeDebugToFile(java.lang.String debugInfo)
Writes debug information into a file. |
static java.lang.String |
writeTempFile(com.oreilly.servlet.multipart.FilePart filePart,
java.lang.String fileName)
Write the uploaded file to disk for temporary storage before moving it to its final Metacat location. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static AbstractDatabase dbAdapter
public static java.util.Vector pathsForIndexing
| Constructor Detail |
|---|
public MetaCatUtil()
| Method Detail |
|---|
public static java.lang.Object createObject(java.lang.String className)
throws java.lang.Exception
className - the fully qualified name of the class to instantiate
java.lang.Exceptionpublic static java.lang.String getOption(java.lang.String optionName)
optionName - the name of the option requested
public static void setOption(java.lang.String optionName,
java.lang.String newValue)
optionName - the name of the option requestedpublic static java.net.URL fileToURL(java.io.File file)
public static java.util.Hashtable parseQuery(java.lang.String query)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic static java.util.Vector getOptionList(java.lang.String optiontext)
public static java.lang.String normalize(java.lang.String s)
public static java.lang.String getDocIdWithRevFromOnlineURL(java.lang.String url)
public static java.lang.String getAccessionNumberFromEcogridIdentifier(java.lang.String identifier)
identifier - String
public static java.lang.String getDocIdFromString(java.lang.String str)
string, - the given string should be these two format: 1) str1.str2
in this case docid= str1.str2 2) str1.str2.str3, in this case
docid =str1.str2the - sperator char
public static int getVersionFromString(java.lang.String str)
throws java.lang.NumberFormatException
string, - the given string should be these two format: 1)
str1.str2(no version) version =-1; 2) str1.str2.str3, in this
case version = str3; 3) other, vresion =-2
java.lang.NumberFormatException
public static java.lang.String getRevisionStringFromString(java.lang.String str)
throws java.lang.NumberFormatException
string, - the given string should be these two format: 1)
str1.str2(no version) version=null; 2) str1.str2.str3, in
this case version = str3; 3) other, vresion =null;
java.lang.NumberFormatExceptionpublic static java.lang.String getDocIdFromAccessionNumber(java.lang.String accessionNumber)
public static java.lang.String getInlineDataIdWithoutRev(java.lang.String accessionNumber)
public static java.lang.String getSmartDocId(java.lang.String str)
public static int getRevisionFromAccessionNumber(java.lang.String accessionNumber)
throws java.lang.NumberFormatException
java.lang.NumberFormatExceptionpublic static java.lang.String getLocalReplicationServerName()
public static java.lang.String getDocIdWithoutRevFromInlineDataID(java.lang.String inlineDataID)
public static java.util.Stack reviseStack(java.util.Stack stack)
public static java.lang.String replaceWhiteSpaceForURL(java.lang.String urlHasWhiteSpace)
public static void getUserAccessControlLists()
public static boolean isAdministrator(java.lang.String username,
java.lang.String[] groups)
public static boolean isModerator(java.lang.String username,
java.lang.String[] groups)
public static boolean isAllowedSubmitter(java.lang.String username,
java.lang.String[] groups)
public static boolean isDeniedSubmitter(java.lang.String username,
java.lang.String[] groups)
public static boolean canInsertOrUpdate(java.lang.String username,
java.lang.String[] groups)
public static void writeDebugToFile(java.lang.String debugInfo)
public static void writeDebugToDelimiteredFile(java.lang.String debugInfo,
boolean newLine)
debugInfo - the debug informationnewLine - append the debug info to a line or not
public static java.lang.String writeTempFile(com.oreilly.servlet.multipart.FilePart filePart,
java.lang.String fileName)
filePart - the FilePart object containing the file form elementfileName - the name of the file to be written to disk
public static void copyFile(java.lang.String sourceName,
java.lang.String destName)
throws java.io.IOException
sourceName - the source file to read from diskdestName - the destination file on disk
java.io.IOException
public static void addSkinConfig(java.lang.String skinName,
java.util.Properties skinProperties)
skinName - String qformatskinProperties - Properties instancepublic static java.util.Properties getSkinConfig(java.lang.String skinName)
skinName - String qformat
public static boolean hasSkinConfig(java.lang.String skinName)
skinName - String qformat
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||