input
stringlengths
10
828
output
stringlengths
5
107
public boolean leave logger info node this key has left the network this alive false boolean res false if this equals this predecessor this equals this successor res true else pafuture wait for this predecessor set successor this successor pafuture wait for this successor set predecessor this predecessor gives all entries to successor res action response message pafuture get future value this send to this successor new add entries message this entries get entries has succeeded if res paactive object terminate active object true return res
leaves the overlay by informing neighbors that it want to leave the
public chord node find successor key id return this find successor id 0
lookups a successor of given key
public chord node closest preceding node key id if logger is debug enabled logger debug this key get value closest preceding node id get value for int i key nb bits 1 i 0 i finger finger finger table get finger i try key finger key finger get node get key if finger key is between this key id return finger get node catch exception e wait next stabilization return this get stub
lookups in the finger table the closest node which manages the key given
public void update if logger is debug enabled logger debug node this key is performing stabilize algorithm this stabilize this fix fingers this check predecessor
launch a new stabilization step in order to ensure that lookups execute
public void stabilize if logger is debug enabled logger debug node this key is stabilizing try chord node node chord node pafuture get future value this successor get predecessor if node null key key node get key if key is between this key this successor get key this successor node pafuture wait for this successor notify predecessor this get stub catch exception e the successor is dead wait for check predecessor
verifies the successor and tells the successor about this node
public void fix fingers logger debug node this key is fixing fingers this finger index to fix if this finger index to fix key nb bits this finger index to fix 0 finger finger this finger table get finger this finger index to fix chord node successor found chord node pafuture get future value this find successor new key finger get start index finger set node successor found
refreshes an entry of the finger table each time it is called
public void check predecessor logger debug node this key is checking predecessor if this predecessor null paactive object ping active object this predecessor this predecessor null
checks if predecessor is always alive or not
private void update successors for fault tolerance chord node successor this for int index 0 index tolerant failures index successor successor get successor this successors for tolerant failures index successor
update successors list for fault tolerance
public boolean put entry string entry chord node node this find successor entry get key if logger is info enabled logger info entry get key entry get value has been added on node node get key return action response message pafuture get future value this send to node new add entry message entry has succeeded
puts a new
public boolean remove key key return action response message pafuture get future value this send to this find successor key new remove entry message key has succeeded
removes a data by using the specified key
public boolean add entry entry string entry this entries get entries put entry get key entry return true
adds an entry
public boolean add entries map key entry string entries this entries get entries put all entries return true
adds all the given entries
public int get nb entries return this entries get entries size
returns the number of entries that the peer is managing
public boolean remove entry key key return this entries get entries remove key null
removes an entry identified by a specified
public asynchronous response message receive asynchronous message msg return msg handle this
receives a message
public chord node get predecessor return this predecessor
returns the predecessor of this peer
public chord node get successor return this successor
returns the successor of this peer
public finger table get finger table return this finger table
returns the finger table associated to this peer
public chord node get stub return chord node paactive object get stub on this
returns the remote instance of the current object
public boolean set predecessor chord node predecessor this predecessor predecessor return true
sets the predecessor
public boolean set successor chord node successor this successor successor return true
sets the successor
public void set finger table finger table finger table this finger table finger table
sets the finger table
public boolean is aware return true
used in order to check is peer is alive
public void test connection throws exception downloader get page target host
method to test if the connection to the data source is working properly
public void set text string p text this text p text
sets the text for this trigger
private ipath get state location or null try return get state location catch illegal state exception e this occurs if data none is explicitly specified so ignore this silently is this ok see bug 85071 return null
for internal workbench use only
private void create dynamic xpath content assist adapter new content proposal adapter x path history combo new combo content adapter new simple content proposal provider empty proposal array null new char adapter set proposal acceptance style content proposal adapter proposal insert adapter set filter style content proposal adapter filter none
xpath content assist
public prectangle1 get media box return media box
gets the media box boundary defined by this page tree
public prectangle1 create cartesian intersection prectangle1 src2 return null
returns a new prectangle object representing the intersection of this
public prectangle1 get crop box return crop box
gets the crop box boundary defined by this page tree
private void normalize coordinates float x1 float y1 float x2 float y2 math abs y2 y1 get smallest x if x1 x2 get largest y if y1 y2
normalizes the given coordinates so that the rectangle is created with
public void set url url url throws pdfexception pdfsecurity exception ioexception input stream in null try make a connection urlconnection url connection url open connection create a stream on the url connection in url connection get input stream string path or url url to string set input stream in path or url finally if in null in close
load a pdf file from the given url and initiates the documents catalog
public pdimension get page dimension int page number float user rotation page page catalog get page tree get page page number this pdimension pd new pdimension 0 0 catalog get page tree release page page this return pd
gets the page dimension of the indicated page number using the specified
public pdimension get page dimension int page number float user rotation float user zoom catalog get page tree get page page number this return new pdimension 0 0
gets the page dimension of the indicated page number using the specified
public reference get object reference hashtable dictionary entries string key if dictionary entries null return null object o dictionary entries get key if o null return null reference current ref null while o null o instanceof reference current ref reference o o get object current ref return current ref
gets the pdf object specified by the code key code in the dictionary
protected long append incremental update output stream out long document length throws ioexception return incremental updater append incremental update this out document length
if icepdf pro then use append an incremental update of any edits
override public view on create input view m input view keyboard view get layout inflater inflate r layout input null m input view set on keyboard action listener this m input view set keyboard m rus keyboard return m input view
called by the framework when your view for creating input needs to
override public void on finish input super on finish input clear current composing text and candidates m composing set length 0 update candidates we only hide the candidates window when finishing input on a particular editor to avoid popping the underlying application up and down if the user is entering text into the bottom of its window set candidates view shown false m cur keyboard m rus keyboard if m input view null m input view closing
this is called when the user is done editing a field
private void update shift key state editor info attr log i ruskey upd sh state0 if attr null m input view null m rus keyboard m input view get keyboard m eng keyboard m input view get keyboard int caps 0 log i ruskey upd sh state editor info ei get current input editor info if ei null ei input type editor info type null caps get current input connection get cursor caps mode attr input type m input view set shifted m caps lock caps 0 log i ruskey caps caps
helper to update the shift state of our keyboard based on the initial
public void load input stream input stream throws ioexception properties new properties properties load input stream
loads a properties file from the given input stream
public void set credentials string user name string password this user name user name this password password credentials new username password credentials user name password
sets the credentials for the service
public string get value string key if properties null load defaults return properties get property key
retrieves the value associated with the given key
public void set value string key string value if properties null properties new properties properties set property key value
sets the property with the given key to the given value
public void add entry bloglines subscription entry if subscription list null subscription list new array list bloglines subscription subscription list add entry
adds an entry
public input stream ping raw string feed url throws ioexception get method method create get method bloglines url ping url feed url int http response code client execute method method bloglines exception exception bloglines exception check for exception http response code if exception null throw exception return method get response body as stream
pings bloglines with the given feed url to indicate the contents have
public void ping string feed url throws ioexception input stream input stream ping raw feed url if input stream null input stream close
pings bloglines with the given feed url to indicate the contents have
public void set credentials string user name string password this login user name this password password credentials new username password credentials user name password
sets the credentials for the service
public input stream get nr unread messages raw throws ioexception get method method create get method bloglines url rpc update user user name ver 1 int http response code client execute method method bloglines exception exception bloglines exception check for exception http response code if exception null throw exception return method get response body as stream
gets the number of unread messages for the user and returns
public int get nr unread messages throws ioexception input stream input stream get nr unread messages raw if input stream null string tokenizer tokenizer new string tokenizer ioutil convert input stream to string input stream if tokenizer has more tokens input stream close return integer parse int tokenizer next token return 1
gets the number of unread messages for the user
public input stream get subscriptions raw throws ioexception client get state set credentials bloglines auth scope credentials get method method create get method bloglines url rpc listsubs method set do authentication true int http response code client execute method method bloglines exception exception bloglines exception check for exception http response code if exception null throw exception return method get response body as stream
gets the subscriptions of the user
protected get method create get method string url string user agent properties configuration get instance get value configuration keys drest user agent string version properties configuration get instance get value configuration keys drest user agent version get method method new get method url method set request header user agent user agent version return method
creates a get method with the correct user agent set
protected post method create post method string url string user agent properties configuration get instance get value configuration keys drest user agent string version properties configuration get instance get value configuration keys drest user agent version post method method new post method url method set request header user agent user agent version return method
creates a post method with the correct user agent set
public bloglines subscription get subscriptions throws ioexception saxexception input stream input stream get subscriptions raw if input stream null return null bloglines subscription subscription bloglines xml parser parse subscriptions input stream input stream close return subscription
gets the subscriptions of the user
public input stream get items raw long id boolean mark as read date since throws ioexception string url string bloglines url rpc getitems s id n mark as read 1 0 if since null url string d since get time 1000 get method method create get method url string method set do authentication true int http response code client execute method method bloglines exception exception bloglines exception check for exception http response code if exception null throw exception return method get response body as stream
gets the items for the subscription with the given id
public bloglines entry list get items long id boolean mark as read date since throws ioexception saxexception input stream input stream get items raw id mark as read since if input stream null return null bloglines entry list list bloglines xml parser parse item input stream input stream close return list
gets the items for subscription with the given id
public int get nr comments if nr comments 0 if comment list null return comment list size return nr comments
returns the number of comments on this video
protected string get characters boolean clear characters string result character buffer to string if clear characters character buffer null return result
retrieves the collected character data and optionally clear
public boolean can handle uri resource try string suffix resource get scheme specific part substring resource get scheme specific part last index of suffix separator 1 to lower case string scheme resource get scheme return image types contains suffix scheme types contains scheme catch exception e if log is info enabled log info uri handlingerror e get message return false
tests whether the image factory can handle a particular resource uri
protected void set up throws urisyntax exception configuration exception context application context get context dispatcher context obtain request dispatcher request new image request string dir system get property jmage output dir images log debug junit jmage output dir dir output dir new file dir if output dir is directory output dir mkdirs log info initialized junit mapper with resourcedir context get property resourcedir log info initialized junit mapper with jmage output dir output dir get absolute path this fill request
set up a test case
public void fill request throws urisyntax exception this set image uri this set filter chain uri this set properties this set encoding format
fill image request with params
public void set image uri throws urisyntax exception request set image uri new uri file sample june vase jpg
sets the image uri
public void set filter chain uri throws urisyntax exception request set filter chain uri new uri new uri chain org jmage filter no op filter
sets the filter chain uri
public void set properties properties props request get filter chain properties assert props null filter properties should not be null request set filter chain properties props
sets the properties
public void test filter throws jmage exception ioexception long before system current time millis dispatcher dispatch request log debug processed image in seconds system current time millis before 1000f this write results request
run the test by giving the image request to the application contexts dispatcher
public void write results image request request throws ioexception string file name null file name this get class get name string value of request hash code file name request get encoding format file file new file output dir file name file output stream fos new file output stream file fos write request get encoded fos flush fos close assert true did not write results to disk file is file file exists log info wrote imagerequest request test results to file file get absolute path
write the results to disk
protected void tear down throws exception super tear down context release request dispatcher dispatcher output dir null
tear down the test
public void set properties properties props new properties props set property adjust 125 request set filter chain properties props
sets the properties
public void test filter throws jmage exception ioexception boolean failed false try dispatcher dispatch request this write results request catch throwable t failed true assert true failed
run the test by giving the image request to the application contexts dispatcher
public void set properties properties props new properties props set property color 0000000 request set filter chain properties props
sets the properties
public void set properties properties props new properties props set property color 0 request set filter chain properties props
sets the properties
public void set properties properties props new properties props set property adjust 25 request set filter chain properties props
sets the properties
public void set properties properties props new properties props set property color dd99 dd request set filter chain properties props
sets the properties
public void set properties properties props new properties props set property color xx00a0 request set filter chain properties props
sets the properties
public void set properties properties props new properties props set property image uri file banner eap 256 gif request set filter chain properties props
sets the properties
public void configure application context context this application context context this servlet context servlet context this application context get servlet context
configures the image factory with application context
public object create from image request request throws jmage exception object resource obj null if request get image uri null throw new resource exception resource error iterator it resource factories iterator while it has next resource factory factory resource factory it next if factory can handle request get image uri configure per request params factory configure request properties request get filter chain properties resource obj factory create from request get image uri remove per request params factory remove request properties request get filter chain properties break if resource obj null throw new resource exception resourcefactory error return resource obj
creates a resource object to use from a given uri
public object create from uri resource uri throws jmage exception object resource obj null if resource uri null throw new resource exception resource error iterator it resource factories iterator while it has next resource factory factory resource factory it next if factory can handle resource uri resource obj factory create from resource uri break if resource obj null throw new resource exception resourcefactory error return resource obj
creates a resource object to use from a given uri
public boolean can handle uri resource try string suffix resource get path substring resource get path last index of suffix separator 1 to lower case string scheme resource get scheme return image types contains suffix scheme types contains scheme catch exception e if log is info enabled log info uri handlingerror e get message return false
tests whether the image factory can handle a particular resource uri
public object create from uri resource throws resource exception string scheme resource get scheme to lower case if file equals scheme file file new file resource planar image image this get file file if log is info enabled log info file resource retrieved file get name return image if http equals scheme url url null try url resource to url catch malformed urlexception e throw new resource exception e get message planar image image this get url url if log is info enabled log info url resource retrieved url to string return image throw new resource exception scheme error scheme
create an object resource from a resource uri
protected planar image get current dir file file file planar image image null if file is absolute file current new file file image file new file current file get path if image file is file image file exists try image jai create fileload image file get absolute path if log is debug enabled log debug file loaded image file get absolute path catch exception e if log is enabled for priority error log error file loaderror e return image
get the file from the current application directory
public void configure application context context do nothing
configure simple filter chain factory
protected planar image get absolute file file file planar image image null if file is absolute file exists try image jai create fileload file get absolute path if log is debug enabled log debug file loaded file get absolute path catch exception e if log is enabled for priority error log error file loaderror e return image
get the absolute file from the file system
public void configure application context context application context context
configure filter chain manager
public void handle image request request throws jmage exception request set image this filter request
filters an image request with an existing filterchain
protected planar image do filter filter chain chains planar image image throws filter exception iterate over all filterchains and pipe the image through them for int i 0 i chains length i image chains i filter image return image
filters an image through an existing filter chain
protected byte array output stream read from url url url throws ioexception urlconnection connection url open connection this is to make sure that the servlet filter does not intercept any internal resource manager requests connection set do output true connection set request property interceptor mapper jmage internal true connection connect throw ioexception if 400 found in here string response header connection get header field null assert response header null http header error if response header index of http 400 1 throw new ioexception url loaderror url cause response header input stream is connection get input stream return stream convert is
read an image from a url using http
protected planar image filter image request image request throws filter chain exception filter exception filter chain chains this create image request return this do filter chains image request get image
convenience method combining filter creation and image filtering
public void dispatch image request image request throws jmage exception if image request get image null image request get image uri null resource manager resource manager context obtain resource manager resource manager handle image request context release resource manager resource manager if image request get filter chain uri null prevent recursion and side effects image request get filter chain properties clear filter chain manager filter chain manager context obtain filter chain manager filter chain manager handle image request context release filter chain manager filter chain manager
dispatch an image request for internal purposes
public void add filter configurable image filter filter properties filter properties throws filter exception filter initialize filter properties this filters add filter
add a filter to the filter chains end
public void dispatch image request request throws jmage exception request dispatcher dispatcher context obtain request dispatcher dispatcher configure context request set encoded dispatcher create from request context release request dispatcher dispatcher
wrapper method for proxy cache
public boolean can handle image request request return gif equals request get encoding format to lower case
test whether the image encoder can handle the format
public void add filter configurable image filter filter properties filter properties int position throws filter exception index out of bounds exception filter initialize filter properties this filters add position filter
add a filter to the filter chain at the given position
public void initialize image request request throws codec exception if log is debug enabled log debug gif init
initialize the image encoder for a particular encodingformat in the image request
public void add filter image filter filter int position throws index out of bounds exception this filters add position filter
add a filter to the filter chain at the given position
public boolean can handle image request request encoding format request get encoding format to lower case return encoding formats contains key encoding format
test whether the image encoder can handle the format
public void initialize image request request throws codec exception this encoding format string encoding formats get request get encoding format to lower case if this encoding format null string message init error encoding format if log is enabled for priority error log error message throw new codec exception message else if bmp equals encoding format this encode param new bmpencode param bmpencode param encode param set version 4 bmpencode param encode param set top down false if log is debug enabled log debug init success encoding format
initialize the image encoder for a particular encodingformat using properties
public void add filter image filter filter this filters add filter
add a filter to the filter chain at the end
protected input stream get current dir file file file input stream input stream null file current new file current dir file xml file new file current file get path if xml file is file xml file exists try input stream new file input stream file if log is debug enabled log debug file loaded xml file get absolute path catch exception e if log is debug enabled log debug file loaderror e return input stream
get the file from the current application directory
public void handle image request request throws jmage exception iterator it image encoders iterator assert image encoders size 0 missing encoders byte encoded null while it has next image encoder encoder image encoder it next if encoder can handle request try encoder initialize request encoded encoder create from request break catch codec exception e throw new jmage exception e get message if encoded null string message encoder error request get encoding format if log is enabled for priority error log error message throw new jmage exception message request set encoded encoded
encodes a jai planar image into a specific format
public boolean can handle image request request boolean rval false iterator it image encoders iterator assert image encoders size 0 missing encoders while it has next image encoder encoder image encoder it next rval rval encoder can handle request return rval
test whether the image encoder can handle the format