public class ClientViewHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DOWNLOAD_ACTION |
static java.lang.String |
PERMISSION_TYPE_ALLOW |
static java.lang.String |
PERMISSION_TYPE_DISALLOW |
Constructor and Description |
---|
ClientViewHelper(javax.servlet.http.HttpServletRequest request)
Creates a new instance of ClientViewHelper, using info in an HttpServletRequest
for initializing.
|
ClientViewHelper(java.lang.String host,
java.lang.String context,
ClientView bean)
Creates a new instance of ClientViewHelper, using parameter values
for initializing.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
clientRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Main web API method for handling various actions.
|
static ClientViewHelper |
clientViewHelperInstance(javax.servlet.http.HttpServletRequest request)
This is a convenience method to reduce the amount of code in a Metacat Client.
|
MetacatClient |
getMetacatClient() |
org.w3c.dom.Document |
getMetadataDoc() |
static org.w3c.dom.Node |
getNode(javax.xml.xpath.XPath xPath,
java.lang.String expression,
org.w3c.dom.Node root) |
static java.lang.String |
getNodeText(javax.xml.xpath.XPath xPath,
java.lang.String expression,
org.w3c.dom.Node root) |
static java.lang.String[] |
getNodeTextList(javax.xml.xpath.XPath xPath,
java.lang.String expression,
org.w3c.dom.Node root) |
static java.util.Stack |
getNodeTextStack(javax.xml.xpath.XPath xpathInstance,
java.lang.String xpathExpr,
org.w3c.dom.Node parentNode) |
java.util.TreeMap |
getSelectQueryMap()
Queries Metacat for document listings, and returns the results in a TreeMap,
where the key is the Doc Id, and the value is the Create Date.
|
static java.lang.String |
getStringFromInputStream(java.io.InputStream input) |
static java.lang.String |
getTextContent(javax.xml.xpath.XPath xPath,
org.w3c.dom.Node elementNode) |
java.util.HashMap<java.lang.String,java.lang.Object> |
handleClientRequest(com.oreilly.servlet.multipart.MultipartParser multipartParser)
Main method for handling various actions.
|
java.lang.String |
handleDocIdSelect() |
java.lang.String |
handleFileUpdate(com.oreilly.servlet.multipart.MultipartParser multipartParser) |
java.lang.String |
handlePackageUpload(ClientView clientViewBean,
com.oreilly.servlet.multipart.MultipartParser multipartParser)
Handles metadata file and data file uploads for inserting new
Metacat data packages.
|
static boolean |
isElementContentWhitespace(org.w3c.dom.Text textNode) |
boolean |
isLoggedIn()
A convenience method to be used by client code that requires
the user to be logged in.
|
java.lang.String |
makeRedirectUrl() |
java.lang.String |
nextVersion(java.lang.String lastDocId,
java.lang.String xPathQuery) |
static java.lang.String[] |
parseFileInfo(java.lang.String fileName) |
java.lang.String |
parseXml(java.lang.String elementName,
java.lang.String xml) |
org.w3c.dom.Document |
query(java.lang.String pathExpr,
java.lang.String pathValue,
java.lang.String returnFld)
Query metacat for documents that 'CONTAINS' the value at the specified XPath
expression.
|
void |
setLoggedIn(boolean isLoggedIn) |
void |
setLoggedIn(java.lang.String serverResponse)
After calling "login(ldapUserName, pwd)", call this with the username
and servers response message.
|
void |
setMetadataDoc(org.w3c.dom.Document doc) |
void |
setMetadataDoc(java.io.InputStream ioStream) |
void |
setMetadataDoc(java.lang.String docId) |
static void |
setTextContent(javax.xml.xpath.XPath xPath,
org.w3c.dom.Node elementNode,
java.lang.String content) |
void |
setUserName(java.lang.String userName) |
static java.lang.String |
toZipFileName(java.lang.String fileName) |
static void |
updateNodeText(org.w3c.dom.Node root,
javax.xml.xpath.XPath xPath,
java.lang.String expression,
java.lang.String text) |
public static final java.lang.String DOWNLOAD_ACTION
public static final java.lang.String PERMISSION_TYPE_ALLOW
public static final java.lang.String PERMISSION_TYPE_DISALLOW
public ClientViewHelper(javax.servlet.http.HttpServletRequest request) throws MetacatInaccessibleException
request
- HttpServletRequest, sent from the client browser.MetacatInaccessibleException
- Thrownpublic ClientViewHelper(java.lang.String host, java.lang.String context, ClientView bean) throws MetacatInaccessibleException
host
- The host with port (if needed), such as "localhost:8084".context
- The application root context.bean
- ClientView instance, with pre-populated values.MetacatInaccessibleException
- thrownpublic java.lang.String clientRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- HttpServletRequestresponse
- HttpServletResponsepublic java.util.HashMap<java.lang.String,java.lang.Object> handleClientRequest(com.oreilly.servlet.multipart.MultipartParser multipartParser)
multipartParser
- Only needed if the action is "Upload".public static ClientViewHelper clientViewHelperInstance(javax.servlet.http.HttpServletRequest request)
request
- Since this is intended to be used by an Http client, it is passed the
available "request" variable (the HttpServletRequest).MetacatInaccessibleException
- Received by MetacatFactory.public boolean isLoggedIn()
public void setLoggedIn(java.lang.String serverResponse)
userName
- User nameserverResponse
- XML login response sent from Metacat.public void setLoggedIn(boolean isLoggedIn)
public void setUserName(java.lang.String userName)
public java.lang.String parseXml(java.lang.String elementName, java.lang.String xml)
public java.lang.String handleDocIdSelect()
public java.lang.String handlePackageUpload(ClientView clientViewBean, com.oreilly.servlet.multipart.MultipartParser multipartParser) throws java.lang.Exception
request
- HTTP request.java.lang.Exception
public java.lang.String handleFileUpdate(com.oreilly.servlet.multipart.MultipartParser multipartParser) throws java.lang.Exception
java.lang.Exception
public java.util.TreeMap getSelectQueryMap()
public org.w3c.dom.Document query(java.lang.String pathExpr, java.lang.String pathValue, java.lang.String returnFld)
pathExpr
- String contianing an XPath expression.pathValue
- String containing a comparison value at the XPath expression.returnFld
- String containing an XPath expression to a field which will be returned
in addition to the standard info.public void setMetadataDoc(org.w3c.dom.Document doc)
public void setMetadataDoc(java.lang.String docId) throws java.lang.Exception
java.lang.Exception
public void setMetadataDoc(java.io.InputStream ioStream) throws java.io.IOException
java.io.IOException
public org.w3c.dom.Document getMetadataDoc()
public java.lang.String nextVersion(java.lang.String lastDocId, java.lang.String xPathQuery) throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionException
public MetacatClient getMetacatClient()
public static java.lang.String[] parseFileInfo(java.lang.String fileName)
public static void updateNodeText(org.w3c.dom.Node root, javax.xml.xpath.XPath xPath, java.lang.String expression, java.lang.String text)
public static org.w3c.dom.Node getNode(javax.xml.xpath.XPath xPath, java.lang.String expression, org.w3c.dom.Node root)
public static java.lang.String getNodeText(javax.xml.xpath.XPath xPath, java.lang.String expression, org.w3c.dom.Node root)
public static java.lang.String[] getNodeTextList(javax.xml.xpath.XPath xPath, java.lang.String expression, org.w3c.dom.Node root)
public static java.util.Stack getNodeTextStack(javax.xml.xpath.XPath xpathInstance, java.lang.String xpathExpr, org.w3c.dom.Node parentNode)
public static java.lang.String getStringFromInputStream(java.io.InputStream input)
public java.lang.String makeRedirectUrl()
public static java.lang.String toZipFileName(java.lang.String fileName)
public static void setTextContent(javax.xml.xpath.XPath xPath, org.w3c.dom.Node elementNode, java.lang.String content) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
public static java.lang.String getTextContent(javax.xml.xpath.XPath xPath, org.w3c.dom.Node elementNode) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
public static boolean isElementContentWhitespace(org.w3c.dom.Text textNode)
Copyright © 2020 Regents of the University of California. All Rights Reserved.