input
stringlengths
10
828
output
stringlengths
5
107
private void verify list if metadata null throw new illegal state exception metadata has not been established use populate
verify the list was set up via code populate code
public void decode msg byte encoded bytes throws ioexception this decode msg new byte array input stream encoded bytes
build out this message from a byte array
public boolean are decreasing string first string second return are consecutive first second are volumes increasing first second
years are decreasing if not strictly consecutive and not increasing
protected void add to page object component new cell for next page section table new row table new cell align center valign top table add component
add a rendering component to the display
protected page get page return page
fetch the the current page
private void set input default behavior document document if reset inputs to default get status document try string value parse utils get status option api document get document element ap option preserve if com true equals value reset inputs to default false catch xml exception exception throw new render base render exception error parsing response document exception
set preserve user data behavior based on the status and options
private void set page status iterator iterator response list get iterator document document response list get status message document string message status line null reset inputs to default true if document null message get status message document if string util is null string message add status text null message set input default behavior document while iterator has next save each error response document document iterator next message get status message document if string util is null string message add status text get server name document message if reset inputs to default set input default behavior document
set up page status text if any is available
protected int get next number return descending next number next number
generate the next number as an int and update the next number variable
private string format line string server string text string line if string util is null string server line add server name server return line b text b
format error and informational text essentially omit the
protected void add detail text string text add detail text null text
add new html text to the page detailed information display
public void start service super start service id mgr get daemon get identity manager if enabled start get daemon get status service register status accessor comm stats new status
start the comm manager
public void stop service todo checkpoint here get daemon get status service unregister status accessor comm stats stop super stop service
stop the comm manager
public float get highest percent agreement hint return hint value highest percent agreement hint
return highest agreement peer has seen from us
public float get percent agreement hint return hint value percent agreement hint
return agreement peer has most recently seen from us
protected void add detail text string server string text if string util is null string detail line detail line format line server text return detail line br format line server text return
add new html text to the page detailed information display
protected void add status text string text add status text null text
add new html text to the page status error line
public boolean is vote complete return m vote complete
in vote messages determine whether more vote blocks are available
protected void post unmarshal lockss app lockss context if highest percent agreement percent agreement highest percent agreement percent agreement
the highest percent agreement may need to be initialized to the
protected void add status text string server string text if string util is null string status line status line format line server text return status line br format line server text return
add new html text to the page status error line
public string get last vote block url return m last vote block url
in vote request messages return the url of the last vote block received
public collection get partners return new array list partners key set
return a snapshot of the partner set
public void multicast packet received from peer identity id remove partner id last multicast received put id now long
inform the partner list that a multicast packet was received
protected string fill string value char pad character int field length string buffer result int pad count result new string buffer pad count field length value length for int i 0 i pad count i result append pad character result append value return result to string
prepend a pad character to a text field
public boolean is partner peer identity id return partners contains key id
return true if the id is currently on the partner list
public void add partner peer identity id double probability log debug2 add partner id probability if probabilistic choice choose probability add partner id
possibly add a partner to the list
public void remove partner peer identity id if is partner id log debug removing partner id partners remove id last partner remove time time base now ms
remove a partner from the list
public void set repair data length long len m repair data len len
set the size of the repair data
protected string zero fill string value int field length return fill value 0 field length
zero fill a numeric string value
public long get repair data length return m repair data len
return the size of the repair data
interface socket factory lcap socket multicast new multicast socket queue rcv q ipaddr group int port throws ioexception lcap socket unicast new unicast socket queue rcv q int port throws ioexception lcap socket new send socket throws socket exception
socket factory interface is so test case can use mock sockets
public long get estimated encoded length return est encoded header length get vote blocks length get repair data length
return the extimated length of the encoded message
protected string blank fill string value int field length return fill value field length
blank fill a string value
protected void add script source reference string source file page add header script src new script source source file language java script type text javascript script
add a java script source file include to the page header
public void stop service status service stat svc get daemon get status service stat svc unregister status accessor get status accessor name scomm chans stat svc unregister status accessor get status accessor name scomm peers if is running stop super stop service
stop the stream comm manager
protected void add timed refresh string target add timed refresh 3 target
add a meta refresh to the current page reload in three seconds
protected void add timed refresh int seconds string target page add header meta http equiv refresh content seconds url page render base new href target
add a meta refresh to the current page
public string to string string buffer sb new string buffer sb append if is local identity sb append l sb append peer sb append get key sb append sb append system identity hash code this sb append return sb to string
to string results in a string describing the peer that is
public string get id string return get key
get id string returns a string describing the peer that is
public ipaddr get ipaddr if p addr instanceof peer address ip return peer address ip p addr get ipaddr return null
if this peer identity has an associated ip address return it
public boolean is local identity return false
return true iff this is a local peer identity
protected object post unmarshal resolve lockss app lockss context identity manager idm identity manager lockss context get manager by key lockss daemon identity manager try return idm find peer identity get key catch identity manager malformed identity key exception e the log error bad serialized peer id get key e return null
p automatically substitutes the right singleton identity after
public boolean is local identity return true
return true iff this is a local peer identity
public interface message handler callback used to inform clients that a message has been received param msg the received peer message see lcap stream comm register message handler public void handle message peer message msg
lcap stream comm
protected boolean use default value return reset inputs to default
set form field to default value
public int get protocol throws protocol exception return protocol
return the protocol under which to send the packet
public int get packet size return get packet data length
return the size of the possibly compressed packet
public int get data size throws protocol exception return get data length header length
return the size of the uncompressed data
public peer identity get peer identity return m pid
return the peer identity
public ipaddr get address return m address
return the address of the identity
public int get reputation return m reputation
return the current value of this identitys reputation
public boolean is equal lcap identity id string id key id m id key return id key equals m id key
return true if two identity are found to be the same
public boolean is trusted network return param use v3 over ssl param ssl client auth
return true iff all connections are authenticated i ie i we only
public string to string return m id key
return the identity of the identity
protected string default value string parameter string default value if use default value return get text parameter return default value
select a default parameter value if appropriate preserve previously
public string to host return m id key
return the name of the host as a string
public void remember valid originator lcap message msg m orig packets
increment the originator packet counter
public void remember valid forward lcap message msg m forw packets
increment the forwarded packet counter
public void remember duplicate lcap message msg m dupl packets
increment the duplicate packet counter
public peer identity get sender return sender id
return the peer identity of the message sender or null if not a
public void set retry max int retry max this retry max retry max
set the max number of retries
public int get retry max return retry max
get the max number of retries
public void set retry interval long retry interval this retry interval retry interval
set the interval number of retries
public long get retry interval return retry interval
get the targer retry interval
protected boolean verify hash byte hash value byte data try message digest digest message digest get instance sha digest update data byte hashed digest digest return arrays equals hash value hashed catch java security no such algorithm exception e return false
used by v1 lcap message and v3 lcap message to verify message level
public void set last retry long last retry this last retry last retry
set the last retry time
protected iterator sort iterator iterator tree set sorted new tree set while iterator has next object object iterator next if object null sorted add object return sorted iterator
sort a list
public long get last retry return last retry
get the last retry time
public void incr retry count this retry count
increment the messages retry count
public psm event get event return event
return the event against which incoming events are matched
public boolean is action return action null
return true if the reponse to the event is to perform an action
public string get new state return new state
return the new state iff a transition response
public psm action get action return action
return the action iff an action response
public psm state get initial state return initial state
return the initial state of the state machine
public psm state get state string name return psm state state map get name
find the state with the given name
public psm msg event with message lcap message msg psm msg event res psm msg event copy res set message msg return res
this is the normal way to create a message event holding an incoming
public long get user val return user val
an uninterpreted long value
public psm action get entry action return entry action
return the states entry action or null if none
protected long calculate timeout psm event trigger event psm interp interp return default timeout
default behavior is to return the value passed to the constructor
public psm response get response psm event event for int ix 0 ix responses length ix psm response resp responses ix if event isa resp get event return resp return null
find the first response that matches the event
public psm state succeed if is final throw new psm exception illegal state machine non final success state is succeed succeed return this
makes this state a success state
public void set checkpointer checkpointer ch checkpointer ch
set the checkpointer that will be called whenever the machine enters
public psm state fail if is final throw new psm exception illegal state machine non final failure state is succeed fail return this
makes this state a failure state
public boolean is succeed return is succeed succeed
returns true iff this is a success final state
public boolean is fail return is succeed fail
returns true iff this is a failure final state
public boolean is final state return cur state null cur state is final
return true if the machine is in a final state
protected link new definition string topic string tooltip string href javascript inline script inline html topic trim string image img src inline image border 0 title tooltip trim return new link href image
add an inline definition
public psm state get final state return is final state cur state null
return the final state iff it has been reached else null
private string new help link string url return scripted link help script help url
build the help link open a new window for the help display
private void handle wait psm wait event wait event long timeout wait event get timeout log debug2 wait timeout if timeout 0 set current state timeout timeout if event queue is empty is waiting true
if the wait event has a timeout value start a timer before waiting
public void send datagram packet pkt throws ioexception sock send pkt
send a packet
public void start ensure rcv thread
start the sockets receive thread
public void set threaded boolean val threaded val
if true warnings will be issued if events are signalled outside the
public void stop if rcv thread null log info stopping rcv thread rcv thread stop rcv thread rcv thread null
stop the sockets receive thread
private void receive packet throws ioexception byte buf new byte lockss received datagram max size datagram packet pkt new datagram packet buf lockss received datagram max size try sock receive pkt lockss received datagram dg new lockss received datagram pkt dg set receive socket this process received datagram dg catch interrupted ioexception e
receive one packet build a datagram packet call the lcap sockets
public iterator version iterator return versions iterator
return an iterator over the versions of this vote block
private string scripted link string script name string anchor text string url string script script script type text javascript r n r n document write a href javascript script name url anchor text a r n r n script r n noscript a href url anchor text a noscript r n return script
build an anchor using java script if available
public void enqueue start error handler err handler throws psm exception assert threaded start0 enqueue event psm events start err handler
enter the start state of the state machine performing any entry
private string new bread crumb html string buffer text render the full breadcrumb text bread crumb text plus page banner return new bread crumb html crumb path append text crumb text banner
generate a new bread crumb trail from per page definitions
public void enqueue event psm event event error handler err enqueue event event err null
process an event asynchronously generally one generated from outside
private void checkpoint psm state state string state name state get name if state name equals state bean get last resumable state name state bean set last resumable state name state name if checkpointer null checkpointer checkpoint state bean
update the state bean and call the checkpointer to checkpoint the