Modifier | Constructor and Description |
---|---|
protected |
MetacatClient()
Constructor to create a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
delete(java.lang.String docid)
Delete an XML document in the repository.
|
java.lang.String |
getAccessControl(java.lang.String docid)
get the access control info for a given document id.
|
java.util.Vector |
getAllDocids(java.lang.String scope)
return a list of all docids that match a given scope.
|
java.lang.String |
getEncoding()
Returns the character encoding used used when communicating with Metacat.
|
java.lang.String |
getLastDocid(java.lang.String scope)
Return the highest document id for a given scope.
|
java.lang.String |
getloggedinuserinfo()
Method used to log in to a metacat server.
|
static MetacatClient |
getMetacatClient(javax.servlet.http.HttpServletRequest request)
JSP API: This is a convenience method to reduce the amount of code in a Metacat Client
JSP.
|
int |
getNewestDocRevision(java.lang.String docId)
The method will return the latest revision in metacat server
for a given document id.
|
java.lang.String |
getSessionId()
Get the session identifier for this session.
|
java.lang.String |
insert(java.lang.String docid,
java.io.Reader xmlDocument,
java.io.Reader schema)
Insert an XML document into the repository.
|
java.lang.String |
isAuthorized(java.lang.String resourceLsid,
java.lang.String permission,
java.lang.String sessionId)
Method used to log in to a metacat server.
|
boolean |
isRegistered(java.lang.String docid)
return true of the given docid is registered, false if not
|
java.lang.String |
login(java.lang.String username,
java.lang.String password)
Method used to log in to a metacat server.
|
java.lang.String |
logout()
Method used to log out a metacat server.
|
static void |
main(java.lang.String[] args) |
java.io.Reader |
query(java.io.Reader xmlQuery)
Query the metacat document store with the given metacat-compatible
query document and default qformat xml, and return the result set as a Reader.
|
java.io.Reader |
query(java.io.Reader xmlQuery,
java.lang.String qformat)
Query the metacat document store with the given metacat-compatible
query document and qformat, and return the result set as a Reader.
|
java.io.InputStream |
read(java.lang.String docid)
Read an XML document from the metacat server session, accessed by docid,
and returned as a Reader.
|
java.io.InputStream |
readInlineData(java.lang.String inlinedataid)
Read inline data from the metacat server session, accessed by
inlinedataid and returned as a Reader.
|
java.io.InputStream |
sendParameters(java.util.Properties prop)
Send a request to Metacat.
|
java.io.InputStream |
sendParametersInverted(java.util.Properties prop)
Send a request to Metacat.
|
java.lang.String |
setAccess(java.lang.String docid,
java.lang.String accessBlock)
Set access for a given doc id.
|
java.lang.String |
setAccess(java.lang.String docid,
java.lang.String principal,
java.lang.String permission,
java.lang.String permType,
java.lang.String permOrder)
set the access on an XML document in the repository.
|
void |
setEncoding(java.lang.String encoding)
Returns the character encoding used used when communicating with Metacat.
|
void |
setMetacatUrl(java.lang.String metacatUrl)
When the MetacatFactory creates an instance it needs to set the
MetacatUrl to which connections should be made.
|
void |
setSessionId(java.lang.String sessionId)
Set the session identifier for this session.
|
java.lang.String |
update(java.lang.String docid,
java.io.Reader xmlDocument,
java.io.Reader schema)
Update an XML document in the repository.
|
java.lang.String |
upload(java.lang.String docid,
java.io.File file)
Upload a data document into the repository.
|
java.lang.String |
upload(java.lang.String docid,
java.lang.String filename,
java.io.InputStream fileData,
int size)
Upload a data document into the repository.
|
java.lang.String |
validateSession(java.lang.String sessionId)
Method used to log in to a metacat server.
|
protected MetacatClient()
public static void main(java.lang.String[] args)
public java.lang.String login(java.lang.String username, java.lang.String password) throws MetacatAuthException, MetacatInaccessibleException
login
in interface Metacat
username
- the username of the user, like an LDAP DNpassword
- the password for that user for authenticationMetacatAuthException
- when the username/password could
not be authenticatedMetacatInaccessibleException
public java.lang.String getloggedinuserinfo() throws MetacatInaccessibleException
getloggedinuserinfo
in interface Metacat
username
- the username of the user, like an LDAP DNpassword
- the password for that user for authenticationMetacatAuthException
- when the username/password could
not be authenticatedMetacatInaccessibleException
public java.lang.String logout() throws MetacatInaccessibleException, MetacatException
logout
in interface Metacat
MetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
public java.lang.String validateSession(java.lang.String sessionId) throws MetacatAuthException, MetacatInaccessibleException
username
- the username of the user, like an LDAP DNpassword
- the password for that user for authenticationMetacatAuthException
- when the username/password could
not be authenticatedMetacatInaccessibleException
public java.lang.String isAuthorized(java.lang.String resourceLsid, java.lang.String permission, java.lang.String sessionId) throws MetacatAuthException, MetacatInaccessibleException
username
- the username of the user, like an LDAP DNpassword
- the password for that user for authenticationMetacatAuthException
- when the username/password could
not be authenticatedMetacatInaccessibleException
public java.io.InputStream read(java.lang.String docid) throws InsufficientKarmaException, MetacatInaccessibleException, MetacatException, DocumentNotFoundException
read
in interface Metacat
docid
- the identifier of the document to be readInsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorDocumentNotFoundException
public java.io.InputStream readInlineData(java.lang.String inlinedataid) throws InsufficientKarmaException, MetacatInaccessibleException, MetacatException
readInlineData
in interface Metacat
inlinedataid
- the identifier of the data to be readInsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorpublic java.io.Reader query(java.io.Reader xmlQuery) throws MetacatInaccessibleException, java.io.IOException
query
in interface Metacat
xmlQuery
- a Reader for accessing the XML version of the queryMetacatInaccessibleException
java.io.IOException
public java.io.Reader query(java.io.Reader xmlQuery, java.lang.String qformat) throws MetacatInaccessibleException, java.io.IOException
query
in interface Metacat
xmlQuery
- a Reader for accessing the XML version of the queryqformat
- the format of return doc. It can be xml, knb, lter and etal.MetacatInaccessibleException
java.io.IOException
public java.lang.String insert(java.lang.String docid, java.io.Reader xmlDocument, java.io.Reader schema) throws InsufficientKarmaException, MetacatException, java.io.IOException, MetacatInaccessibleException
insert
in interface Metacat
docid
- the docid to insert the documentxmlDocument
- a Reader for accessing the XML document to be insertedschema
- a Reader for accessing the DTD or XML Schema for
the documentInsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorjava.io.IOException
- when there is an error reading the xml documentpublic java.lang.String update(java.lang.String docid, java.io.Reader xmlDocument, java.io.Reader schema) throws InsufficientKarmaException, MetacatException, java.io.IOException, MetacatInaccessibleException
update
in interface Metacat
docid
- the docid to updatexmlDocument
- a Reader for accessing the XML text to be updatedschema
- a Reader for accessing the DTD or XML Schema for
the documentInsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorjava.io.IOException
- when there is an error reading the xml documentpublic java.lang.String upload(java.lang.String docid, java.io.File file) throws InsufficientKarmaException, MetacatException, java.io.IOException, MetacatInaccessibleException
upload
in interface Metacat
docid
- the identifier to be used for the documentfile
- the File to be uploadeddocument
- a InputStream containing the data to be uploadedInsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorjava.io.IOException
- when there is an error reading the xml documentpublic java.lang.String upload(java.lang.String docid, java.lang.String filename, java.io.InputStream fileData, int size) throws InsufficientKarmaException, MetacatException, java.io.IOException, MetacatInaccessibleException
upload
in interface Metacat
docid
- the identifier to be used for the documentfilename
- the name to be used in the MIME description of the uploaded filedocument
- a InputStream containing the data to be uploadedInsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorjava.io.IOException
- when there is an error reading the xml documentpublic java.lang.String delete(java.lang.String docid) throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException
delete
in interface Metacat
docid
- the docid to deleteInsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorpublic java.lang.String getAccessControl(java.lang.String docid) throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException
getAccessControl
in interface Metacat
_docid
- the docid of the document for which the access should be applied.InsufficientKarmaException
MetacatException
MetacatInaccessibleException
public java.lang.String setAccess(java.lang.String docid, java.lang.String principal, java.lang.String permission, java.lang.String permType, java.lang.String permOrder) throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException
setAccess
in interface Metacat
_docid
- the docid of the document for which the access should be applied._principal
- the document's principal_permission
- the access permission to be applied to the docid
{e.g. read,write,all}_permType
- the permission type to be applied to the document
{e.g. allow or deny}_permOrder
- the order that the document's permissions should be
processed {e.g. denyFirst or allowFirst}InsufficientKarmaException
- when the user has insufficent rights
for the operationMetacatInaccessibleException
- when the metacat server can not be
reached or does not respondMetacatException
- when the metacat server generates another errorpublic java.lang.String setAccess(java.lang.String docid, java.lang.String accessBlock) throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException
setAccess
in interface Metacat
docid
- the doc id for the doc we want to updateaccessBlock
- the xml access block. This is the same structure as that
returned by the getdocumentinfo action in metacat.InsufficientKarmaException
MetacatException
MetacatInaccessibleException
public void setMetacatUrl(java.lang.String metacatUrl)
setMetacatUrl
in interface Metacat
metacatUrl
- the URL for the metacat serverpublic java.lang.String getSessionId()
getSessionId
in interface Metacat
public void setSessionId(java.lang.String sessionId)
setSessionId
in interface Metacat
String
- the sessionId from a previously established sessionpublic int getNewestDocRevision(java.lang.String docId) throws MetacatException
getNewestDocRevision
in interface Metacat
docId
- String the given docid you want to use. the docid it self
can have or haven't revision numberMetacatException
public java.lang.String getLastDocid(java.lang.String scope) throws MetacatException
getLastDocid
in interface Metacat
scope
- String the scope to use for looking up the latest idMetacatException
- when an error occurspublic java.util.Vector getAllDocids(java.lang.String scope) throws MetacatException
getAllDocids
in interface Metacat
scope
- String the scope to use to limit the docid queryMetacatException
- when an error occurspublic boolean isRegistered(java.lang.String docid) throws MetacatException
isRegistered
in interface Metacat
scope
- String the scope to use to limit the docid queryMetacatException
- when an error occurspublic java.io.InputStream sendParameters(java.util.Properties prop) throws java.lang.Exception
args
- Properties of the parameters to be sent to Metacat, where,
key = param key
value = param valuejava.lang.Exception
- thrownpublic java.io.InputStream sendParametersInverted(java.util.Properties prop) throws java.lang.Exception
args
- Properties of the parameters to be sent to Metacat, where,
key = param value
value = param namejava.lang.Exception
- thrownpublic static MetacatClient getMetacatClient(javax.servlet.http.HttpServletRequest request) throws MetacatInaccessibleException
request
- Since this is intended to be used by a JSP, it is passed the
available "request" variable (the HttpServletRequest).MetacatInaccessibleException
- Received by MetacatFactory.public java.lang.String getEncoding()
Metacat
getEncoding
in interface Metacat
public void setEncoding(java.lang.String encoding)
Metacat
setEncoding
in interface Metacat
encoding
- The encoding (i.e. "UTF-8")Copyright © 2020 Regents of the University of California. All Rights Reserved.