|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.sdsc.inca.Component edu.sdsc.inca.Client edu.sdsc.inca.DepotClient
public class DepotClient
This class allows access to the services provided by an Inca Depot. Along with defining an API that understands the Depot protocol, it defines a main method that allows access to an Depot via a telnet-style interface.
Field Summary | |
---|---|
static java.lang.String |
CRLF
|
static java.lang.String |
DEPOT_CLIENT_OPTS
|
protected static org.apache.log4j.Logger |
logger
|
static long |
MILLIS_IN_A_DAY
Asks the Depot for XML that summarizes the success/failure history over a given period to today for each series selected by an HQL WHERE clause expression. |
Fields inherited from class edu.sdsc.inca.Client |
---|
CLIENT_OPTS, reader, socket, writer |
Fields inherited from class edu.sdsc.inca.Component |
---|
authenticate, cert, certPath, COMPONENT_OPTS, hostname, key, keyPath, logFile, password, port, trusted, trustedPath |
Constructor Summary | |
---|---|
DepotClient()
|
Method Summary | |
---|---|
void |
deleteKbArticle(java.lang.String articleId)
Asks the Depot to delete a knowledge base article from the database |
void |
insertKbArticle(java.lang.String articleXml)
Asks the Depot to insert a knowledge base article in the database |
void |
insertReport(java.lang.String resource,
java.lang.String reportXml,
java.lang.String sysusage,
java.lang.String stderr,
java.lang.String context)
Asks the Depot to insert a new report into the database. |
static void |
main(java.lang.String[] args)
A simple main method for exercising the DepotClient. |
java.lang.String |
queryDatabase()
Asks the Depot for information about the classes in the database. |
java.lang.String[] |
queryDepotPeers()
Asks the Depot for a list of its peer Depots |
protected java.lang.String[] |
queryDialog(java.lang.String command,
java.lang.String data)
An internal method that handles the functionality common to several query methods. |
protected java.lang.String[] |
queryDialogWithNoSoTimeout(java.lang.String command,
java.lang.String data)
An internal method that handles the functionality common to several query methods. |
java.lang.String[] |
queryGuids()
Asks the Depot for all the suite guids in its database. |
java.lang.String[] |
queryHql(java.lang.String select)
Asks the Depot to run an HQL query; returns the result. |
java.lang.String |
queryInstance(java.lang.String nickname,
java.lang.String resource,
java.util.Date collected)
Asks the Depot for the ReportDetailsDocument for a specified instance. |
java.lang.String |
queryInstanceById(long instanceId,
long configId)
Asks the Depot for the ReportDetailsDocument for a specified instance. |
java.lang.String[] |
queryLatest(java.lang.String expr)
Asks the Depot for XML for the latest instance of each series selected by an HQL WHERE clause expression. |
java.lang.String[] |
queryPeriod(java.util.Date begin,
java.util.Date end,
java.lang.String expr)
Asks the Depot for XML for instances collected over a given period of time for each series selected by an HQL WHERE clause expression. |
java.lang.String[] |
queryPeriod(int numDays,
java.lang.String expr)
Asks the Depot for XML for instances collected over a given period of time for each series selected by an HQL WHERE clause expression. |
java.lang.String[] |
queryStatusHistory(java.lang.String period,
java.util.Date begin,
java.util.Date end,
java.lang.String expr)
Asks the Depot for XML that summarizes the success/failure history over a given period for each series selected by an HQL WHERE clause expression. |
java.lang.String[] |
queryStatusHistory(java.lang.String period,
int numDays,
java.lang.String expr)
|
void |
resendReport(java.lang.String resource,
java.lang.String reportXml,
java.lang.String sysusage,
java.lang.String stderr,
java.lang.String context)
Asks the Depot to insert a report that may predate existing reports into the database. |
void |
setConfiguration(java.util.Properties config)
A convenience function for setting multiple configuration properties at once. |
java.lang.String |
updateSuite(java.lang.String suiteXml)
Asks the Depot to add XML for a suite to its database, replacing any existing XML for the same suite. |
Methods inherited from class edu.sdsc.inca.Client |
---|
close, commandGetLog, commandLogConfig, commandPermit, commandPing, commandRevoke, commandRevokeAll, connect, dialog, getDn, getTempPath, isConnected, read, setServer, setTempPath, telnetDialog, write |
Methods inherited from class edu.sdsc.inca.Component |
---|
addTrustedCert, configComponent, createSocket, getAuthenticate, getCertificate, getCertificatePath, getConfiguration, getDn, getHostname, getKey, getKeyPath, getLogFile, getPassword, getPort, getTrustedCertificates, getTrustedPath, getUri, openResourceStream, readCredentials, readVersion, setAuthenticate, setCertificatePath, setHostname, setKeyPath, setLogFile, setPassword, setPort, setTrustedPath |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CRLF
public static final java.lang.String DEPOT_CLIENT_OPTS
protected static final org.apache.log4j.Logger logger
public static long MILLIS_IN_A_DAY
Constructor Detail |
---|
public DepotClient()
Method Detail |
---|
public void setConfiguration(java.util.Properties config) throws ConfigurationException
setConfiguration
in class Client
config
- contains client configuration values
ConfigurationException
- on a faulty configuration property valuepublic void insertReport(java.lang.String resource, java.lang.String reportXml, java.lang.String sysusage, java.lang.String stderr, java.lang.String context) throws java.io.IOException, ProtocolException
resource
- the name of the resource that generated the reportreportXml
- the XML for the report itself (see report schema)sysusage
- system usage informationstderr
- optional stderr output from the reportercontext
- execution context for the reporter
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String queryDatabase() throws java.io.IOException, ProtocolException
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String queryInstance(java.lang.String nickname, java.lang.String resource, java.util.Date collected) throws java.io.IOException, ProtocolException, org.apache.xmlbeans.XmlException
nickname
- resource
- collected
-
java.io.IOException
- on read/write error
ProtocolException
- on an invalid message
org.apache.xmlbeans.XmlException
- if the Depot response cannot be parsedpublic java.lang.String queryInstanceById(long instanceId, long configId) throws java.io.IOException, ProtocolException, org.apache.xmlbeans.XmlException
instanceId
- the id of the instance to retrieveconfigId
- the id of the related series config to retrieve
java.io.IOException
- on read/write error
ProtocolException
- on an invalid message
org.apache.xmlbeans.XmlException
- if the Depot response cannot be parsedpublic java.lang.String[] queryGuids() throws java.io.IOException, ProtocolException
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String[] queryHql(java.lang.String select) throws java.io.IOException, ProtocolException
select
- the HQL select query
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String[] queryLatest(java.lang.String expr) throws java.io.IOException, ProtocolException
expr
- an HQL WHERE clause expression specifying the desired series
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String[] queryPeriod(int numDays, java.lang.String expr) throws java.io.IOException, ProtocolException
numDays
- the number of days of history to retrieve from todayexpr
- an HQL WHERE clause expression specifying the desired series
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String[] queryPeriod(java.util.Date begin, java.util.Date end, java.lang.String expr) throws java.io.IOException, ProtocolException
begin
- series instances collected before this time are ignoredend
- series instances collected after this time are ignoredexpr
- an HQL WHERE clause expression specifying the desired series
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String[] queryStatusHistory(java.lang.String period, int numDays, java.lang.String expr) throws java.io.IOException, ProtocolException
java.io.IOException
ProtocolException
public java.lang.String[] queryStatusHistory(java.lang.String period, java.util.Date begin, java.util.Date end, java.lang.String expr) throws java.io.IOException, ProtocolException
period
- the summarizing period; may be one of the literals "DAY",
"WEEK", "MONTH", or "QUARTER" or a number of minutesbegin
- series instances collected before this time are ignoredend
- series instances collected after this time are ignoredexpr
- an HQL WHERE clause expression specifying the desired series
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic void resendReport(java.lang.String resource, java.lang.String reportXml, java.lang.String sysusage, java.lang.String stderr, java.lang.String context) throws java.io.IOException, ProtocolException
resource
- the name of the resource that generated the reportreportXml
- the XML for the report itself (see report schema)sysusage
- system usage informationstderr
- optional stderr output from the reportercontext
- execution context for the reporter
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic java.lang.String updateSuite(java.lang.String suiteXml) throws java.io.IOException, ProtocolException
suiteXml
- XML representing the suite to be saved
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic void insertKbArticle(java.lang.String articleXml) throws java.io.IOException, ProtocolException
articleXml
-
java.io.IOException
ProtocolException
public void deleteKbArticle(java.lang.String articleId) throws java.io.IOException, ProtocolException
articleId
-
java.io.IOException
ProtocolException
public java.lang.String[] queryDepotPeers() throws java.io.IOException, ProtocolException
java.io.IOException
ProtocolException
protected java.lang.String[] queryDialog(java.lang.String command, java.lang.String data) throws java.io.IOException, ProtocolException
command
- the command to send the Depotdata
- the data to accompany the command
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messageprotected java.lang.String[] queryDialogWithNoSoTimeout(java.lang.String command, java.lang.String data) throws java.io.IOException, ProtocolException
command
- the command to send the Depotdata
- the data to accompany the command
java.io.IOException
- on read/write error
ProtocolException
- on an invalid messagepublic static void main(java.lang.String[] args)
usage:java inca.DepotClient
-a|--auth boolean Authenticated (secure) connection? -c|--cert path Path to the authentication certificate -D|--depot str Depot specification; host:port -h|--help null Print help/usage -i|--init path Path to properties file -k|--key path Path to the authentication key -P|--password str Specify how to obtain encryption password -t|--trusted path Path to authentication trusted certificate dir -V|--version null Display program version
args
- command line arguments, as above.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |