input
stringlengths
10
828
output
stringlengths
5
107
private void prepare config params au config params new array list plugin proxy get au config descrs defining keys new array list edit keys new array list for iterator iterator au config params iterator iterator has next config param descr descr config param descr iterator next if descr is definitional defining keys add descr get key else edit keys add descr get key
establish look up the defining and editable keys for this au
public boolean do command xml utils xml utils get xml utils get sender s comment element element xml utils get element get request root ap e comment string comment xml utils get text element return it as a comment in the response document element xml utils create element get response root ap e comment xml utils add text element comment return true
populate the response body return the senders comment text
public boolean do command throws xml exception element info element info element get xml utils create element get response root ap e info render daemon version uptime disk space and build details render config xml info element render uptime xml info element render disk xml info element render build xml info element return true
populate response with cache and daemon details
protected string get command return request cmd
get the command name
public boolean do command throws ioexception return true
command body never executed
private void do titles element root sorted set title set collection titles iterator iterator titles get remote api find all titles if titles is empty return title set new tree set iterator titles iterator while iterator has next title set add string iterator next iterator title set iterator while iterator has next xml utils add text get xml utils create element root ap e publication string iterator next
lookup all configurable titles
protected element get request root return request doc null null request doc get document element
get the root element of the request document
private list get edit keys if edit keys null prepare config params return edit keys
get editable keys
private void do class name element root boolean valid element element get xml utils create element root ap e classname if valid xml utils add text element get parameter ap e classname
indicate that the user supplied classname is valid
protected string get request version element root request doc get document element return root null xml utils get attribute root com xml versionname
get the version of the xml syntax employed by this request document
protected collection get no edit keys if no edit keys null collection no get title config get un editable keys no edit keys new array list for iterator iterator no iterator iterator has next no edit keys add iterator next return no edit keys
get the list of defining keys that cannot be edited
public document get response document return response doc
get the response document dom rendition
protected element get response root return response doc null null response doc get document element
get the root element of the response document
private list get au config params if au config params null prepare config params return au config params
get the au configuration
protected boolean plugin loaded string key if get lockss daemon get plugin manager ensure plugin loaded key log warning failed to find plugin key return false return true
is the plugin for this key loaded
protected au proxy get au proxy string auid try return get remote api find au proxy auid catch exception exception return null
get an au proxy for this auid
protected void add response status option string name string value if response status options null response status options new hash map response status options put name value
add a response specific status option
public void redirect string target throws ioexception response send redirect target
send an http redirect
protected string get response detail message return response detail
get response specific detail information
protected au proxy get inactive au proxy string auid try return get remote api find inactive au proxy auid catch exception execption return null
get an inactive au proxy for this auid
protected void set response detail message string text response detail text
set response specific detail information
protected au proxy get any au proxy string auid au proxy au proxy if au proxy get au proxy auid null au proxy get inactive au proxy auid return au proxy
get an au proxy either active or inactive for this auid
public string get string string name return string session get attribute name
fetch a value
protected string get response version element root response doc get document element return root null xml utils get attribute root com xml versionname
get the version of the xml syntax used to create the reponse document
public output stream writer get writer throws ioexception response set buffer size 16 1024 return new output stream writer response get output stream utf 8
set up an output stream for the servlet response
public void flush throws ioexception response flush buffer
flush the response ouput buffer
protected plugin proxy get plugin proxy string pid try return get remote api find plugin proxy pid catch exception e return null
get a plugin proxy for this auid
protected string get text string name return parse utils get text xml utils get request root name
get text associated with a named element in the client request document
public string get request url string url request get request uri string arguments request get query string if arguments null url url arguments return url to string
return the request url
public string get server name return inet utils get interface name request get server name
get the server interface name this request came in on
protected string get server name return server name
get the server the current command is addressed to
public void set status boolean success set status success get response status message
add a final status block to the response document
public string get space in use return in use
get the space used by this repository
public string get available space return free
get space available to this repository
public void put object name object value verify name name keys add name values add value
put a named parameter into the list names and values cannot be null
public object get object name int index keys index of name if index 1 return null verify size return values get index
fetch the first occurance of a named parameter from the list
public object get key int index verify size return keys get index
fetch a key by index
public void send response writer writer throws ioexception xml exception xml utils serialize response doc writer writer flush
send a text rendition of the response document to the client
public object get value int index verify size return values get index
fetch a value by index
public int size verify size return keys size
fetch the size of the list
private void verify size if keys size values size throw new illegal state exception key list size keys size is not equal to value list size values size
verify list lengths are in synch
public node list get list element element string name return super get element list element name
return a list of named elements in our namespace
private void verify name object name if name null throw new illegal argument exception key name cannot be null
verify that name is non null
protected void generate setup xml configuration configuration generate setup xml configuration null
generate response xml for command setup data plugin au keys
public void record lockss daemon daemon list alerts for iterator iter alerts iterator iter has next record daemon alert iter next
record a list of similar alerts override to provide smarter behavior
public boolean is groupable return false
return true if this action can advantageously group similar alerts
public long get max pend time return 0
return the maximum time an alert should remain pending before it it
public void set filters list alert filter filters this filters filters
sets the filters
public alert set attribute string attr int val attributes put attr new integer val return this
set a attribute to an int value
public string get recipients alert alert if recipients null return recipients return alert get string alert attr email to
return the recipients
public alert set attribute string attr long val attributes put attr new long val return this
set a attribute to a long value
public void record lockss daemon daemon alert alert send daemon alert alert get mail body
create and send a message
public alert set attribute string attr boolean val if val attributes remove attr else attributes put attr boolean true return this
set a attribute to a boolean value
public void record lockss daemon daemon list alerts if log is debug2 log debug2 recording alerts size actions log debug3 alerts to string if alerts null alerts is empty return alert first alert alert alerts get 0 configuration config current config get current config if config get boolean param enabled default enabled string buffer sb new string buffer for iterator iter alerts iterator iter has next alert alert alert iter next sb append alert get mail body if iter has next sb append n n send daemon first alert multiple sb to string
create and send a single message for a list of alerts
public boolean has attribute string attr return attributes contains key attr
return true if the attribtue is present
public object get attribute string attr return attributes get attr
return the attribute value as an object
public long get max pend time return constants day
return the maximum time an alert should remain pending before its
public string get string string attr return string attributes get attr
return the attribute value as a string
public int get int string attr integer n integer attributes get attr if n null return n int value throw new runtime exception
return the attribute value as an int
public long get long string attr long n long attributes get attr if n null return n long value throw new runtime exception
return the attribute value as a long
public boolean get bool string attr try boolean n boolean attributes get attr if n null return n boolean value return false catch class cast exception e return false
return the attribute value as a boolean
public string get name return get string attr name
return the value of the name attribute
public date get date return new date get long attr date
return the value of the date attribute
public boolean is similar to alert other return equal attrs attr name other get bool attr is content equal attrs attr auid other true
multiple similar alerts may be combined into a single report
public void raise alert alert alert string text alert set attribute alert attr text text raise alert alert
p convenience method to set the text of an alert and raise it
public string get severity string try int sev get int attr severity if sev severity trace return trace if sev severity info return info if sev severity warning return warning if sev severity error return error if sev severity critical return critical return unknown catch runtime exception e return unknown
return the name of the alert severity
public void set max int max this max max trim max
change the maximum number of elements kept on the list
public boolean is running return icp running
p determines whether the icp thread is running in tis main
public void request stop icp running false
p requests that this thread stop
protected boolean something bad happened return something happened
p determines if a relatively serious error condition has
public int get current port return port
p retrieves the current icp port number
public boolean is icp server allowed return is icp server allowed current config get current config
p determines whether an icp server is allowed to run
protected int get port from config configuration the config return the config get int param icp port the config get int param platform icp port bad port
p determines the port on which the icp server should be
protected boolean is icp server allowed configuration the config the icp server is allowed to run unless the platform says it is not return the config get boolean param platform icp enabled true
p determines whether an icp server is allowed to run based on
protected boolean should icp server start return should icp server start current config get current config
p determines whether the icp server should start now
public icp message make hit short src rtt response throws icp exception throw new unsupported operation exception not implemented error
p not supported throws an
public icp message make hit obj byte payload object throws icp exception throw unsupported
p not supported throws an
public icp message make hit obj short src rtt response byte payload object throws icp exception throw unsupported
p not supported throws an
protected boolean should icp server start configuration the config return is icp server allowed the config the config get boolean param icp enabled the config get boolean param platform icp enabled false get port from config the config 0
p determines whether the icp server should start now
public icp message make miss throws icp exception throw unsupported
p not supported throws an
public icp message make miss short src rtt response throws icp exception throw unsupported
p not supported throws an
public icp message make miss no fetch short src rtt response throws icp exception throw new unsupported operation exception not implemented error
p not supported throws an
protected void start socket start socket current config get current config
p starts the icp socket
public void set audit proxy boolean flg audit proxy flg set from cache only flg
if set to true will act like an audit proxy
public string to long string return super to string
p returns a detailed string representation of this message
public string to string string buffer sb new string buffer sb append sb append get class get name sb append opcode sb append get opcode sb append payload url sb append get payload url sb append return sb to string
p returns a brief string representation of this message
public void set audit index boolean flg audit index flg
if set to true audit proxy will generate a manifest index just like
public void start service super start service reset config run set config unconditionally to set defaults in subclasses if start start proxy
start the proxy
public void stop service stop proxy super stop service
stop the plugin manager
public void set from cache only boolean flg never proxy flg
if set to true content will be served only from the cache requests
public static class generation private config file cf private configuration config private int generation public generation config file cf configuration config int generation this cf cf this config config this generation generation public configuration get config return config public int get generation return generation public string get url return cf get file url public config file get config file return cf
represents a single generation version of the contents of a
public string get non empty string key string val get key if string util is null string val val null return val
return the config value associated with code key code returning
public list get list string key list prop list null try object o props get key if o null if o instanceof list prop list list o else prop list string util break at string o 0 true else prop list collections empty list catch class cast exception ex the client requested a list of something that wasn t actually a list throw an exception throw new illegal argument exception key does not hold a list value key return prop list
return a list of values for the given key
public void remove string key if is sealed throw new illegal state exception can t modify sealed configuration props remove key
remove the value associated with code key code
public boolean is repair request http request request enumeration lockss flags enum request get field values constants x lockss if lockss flags enum null while lockss flags enum has more elements string val string lockss flags enum next element if constants x lockss repair equals ignore case val return true return false
determine whether the request is from another lockss cache asking for
public boolean is host down string host synchronized hosts down return hosts down contains key host
check whether the host is known to have been down recently
private boolean add tdb au for plugin tdb au au add au to list for plugins string plugin id au get plugin id collection tdb au id auids plugin id tdb au ids map get plugin id if auids null auids new hash set tdb au id plugin id tdb au ids map put plugin id auids if auids add au get id return false increment the total au count tdb au count return true
register the au with this tdb for its plugin
public void set host down string host boolean is in cache synchronized hosts down if is in cache hosts ever down contains host if log is debug2 log debug2 set host down host hosts down put host hosts ever down add host
remember that the host is down
public void set recently accessed url string url if param url cache enabled url cache null synchronized url cache url cache put url
mark the url as having been accessed recently
private boolean remove tdb au for plugin tdb au au if can t add au to title we need to undo the au registration and re throw the exception we just caught string plugin id au get plugin id collection tdb au id c plugin id tdb au ids map get plugin id if c remove au get id if c is empty plugin id tdb au ids map remove c tdb au count return true return false
unregister the au with this tdb for its plugin