deletes the given blob , taking special care that if we get a blob - not - found exception upon retrying the operation , we just swallow the error since what most probably happened is that the first operation succeeded on the server

private void safe delete ( cloud blob wrapper blob , self renewing lease lease ) throws storage exception { operation context operation context = get instrumented context ( ) ; try { blob delete ( operation context , lease ) ; } catch ( storage exception e ) { if ( ! native azure file system helper is file not found exception ( e ) ) { log error ( " encountered storage exception for delete on blob : { } " + " , exception details : { } error code : { } " , blob get uri ( ) , e get message ( ) , e get error code ( ) ) ; } / / on exception , check that if : / / 1 it ' s a blob not found exception and / / 2 it got there after one - or - more retries then / / we swallow the exception if ( e get error code ( ) ! = null & & " blob not found " equals ( e get error code ( ) ) & & operation context get request results ( ) size ( ) > 1 & & operation context get request results ( ) get ( 0 ) get exception ( ) ! = null ) { log debug ( " swallowing delete exception on retry : { } " , e get message ( ) ) ; return ; } else { throw e ; } } finally { if ( lease ! = null ) { lease free ( ) ; } } }


public list < integer > get namespace array ( ) { return namespace array ; }


find the fields constant that matches field id , or null if its not found

public static fields find by thrift id ( int field id ) { switch ( field id ) { case 1 : / / id return id ; default : return null ; } }


ensures all of the notification channels are created no harm in repeat calls call is safely ignored for api < 26

public static synchronized void create ( @ non null context context ) { if ( ! supported ( ) ) { return ; } notification manager notification manager = service util get notification manager ( context ) ; int old version = text secure preferences get notification channel version ( context ) ; if ( old version ! = version ) { on upgrade ( notification manager , old version , version ) ; text secure preferences set notification channel version ( context , version ) ; } on create ( context , notification manager ) ; async task serial executor execute ( ( ) - > { ensure custom channel consistency ( context ) ; } ) ; }


create a { @ link managed channel } for the given parameters

public static managed channel new client channel ( transport transport , socket address address , boolean tls , boolean testca , @ nullable string authority override , int flow control window , boolean direct executor ) { managed channel builder < ? > builder ; if ( transport = = transport ok http ) { builder = new ok http client channel ( address , tls , testca ) ; } else { try { builder = new netty client channel ( transport , address , tls , testca , flow control window ) ; } catch ( exception e ) { throw new runtime exception ( e ) ; } } if ( authority override ! = null ) { builder override authority ( authority override ) ; } if ( direct executor ) { builder direct executor ( ) ; } else { / / todo ( carl - mastrangelo ) : this should not be necessary i don ' t know where this should be / / put move it somewhere else , or remove it if no longer necessary / / see : https : / / github com / grpc / grpc - java / issues / 2119 builder executor ( get executor ( ) ) ; } return builder build ( ) ; }


public void class name test ( ) { / / todo : test class name }


to test class name in snake case to test class name in snake case

public void test classname test ( ) { client client = null ; / / client response = api test classname ( client ) ; / / todo : test validations }


the resource name in the deployment of the diagram image ( if any )


sets the node ' s value and adds it to the heap the node should not already be in the heap

public t add ( t node , float value ) { node value = value ; return add ( node ) ; }


this picks a large number of nodes at random in order to ensure coverage

private map < node , integer > pick nodes at random ( int num nodes , string excluded scope ) { map < node , integer > frequency = new hash map < node , integer > ( ) ; for ( node base dnd : data nodes ) { frequency put ( dnd , 0 ) ; } for ( int j = 0 ; j < num nodes ; j + + ) { node random = cluster choose random ( excluded scope ) ; frequency put ( random , frequency get ( random ) + 1 ) ; } return frequency ; }


private void initialize table ( ) { model = new checksum table model ( tool , checksums ) ; table = new ghidra table ( model ) ; table set selection mode ( list selection model single selection ) ; }


releases the depressed left mouse button , in the middle of the given element this is equivalent to : actions move to element ( on element ) release ( ) invoking this action without invoking { @ link # click and hold ( ) } first will result in undefined behaviour

public actions release ( web element target ) { if ( is building actions ( ) ) { action add action ( new button release action ( json mouse , ( locatable ) target ) ) ; } return move in ticks ( target , 0 , 0 ) tick ( default mouse create pointer up ( left as arg ( ) ) ) ; }


make sure shutdown now ( ) after shutdown ( ) has an effect

public void calls and shutdown and shutdown now ( ) { subtest calls and shutdown ( false , true ) ; }


public void write int ( int value ) { write ( ( short ) value ) ; write ( ( short ) ( value > > 16 ) ) ; }


returns a test instant advanced in time by the specified duration

public static test instant advance ( test instant instant , duration duration ) { return new test instant ( instant wall time ( ) plus ( duration ) , instant monotonic time ( ) plus ( duration ) ) ; }


subclasses can override this method to implement interruption of the future ' s computation the method is invoked automatically by a successful call to { @ link # cancel ( boolean ) cancel ( true ) } the default implementation does nothing


set the persistence provider ' s own package name , for exclusion from class transformation

void set persistence provider package name ( string persistence provider package name ) ;


removes the specified element from this set if it is present more formally , removes an element < tt > e < tt > such that < tt > ( o = = null & nbsp ; ? & nbsp ; e = = null & nbsp ; : & nbsp ; o equals ( e ) ) < tt > , if this set contains such an element returns < tt > true < tt > if this set contained the element ( or equivalently , if this set changed as a result of the call ) ( this set will not contain the element once the call returns )

public boolean remove ( object o ) { return map remove ( o ) = = present ; }


builds a cache which does not automatically load values when keys are requested unless a mapping function is provided note that multiple threads can concurrently load values for distinct keys consider { @ link # build ( cache loader ) } instead , if it is feasible to implement a { @ code cache loader } this method does not alter the state of this { @ code caffeine } instance , so it can be invoked again to create multiple independent caches

public < k1 extends k , v1 extends v > cache < k1 , v1 > build ( ) { require weight with weigher ( ) ; require non loading cache ( ) ; @ suppress warnings ( " unchecked " ) caffeine < k1 , v1 > self = ( caffeine < k1 , v1 > ) this ; return is bounded ( ) ? new bounded local cache bounded local manual cache < > ( self ) : new unbounded local cache unbounded local manual cache < > ( self ) ; }


public final annotation get annotation ( ) { return annotation strategy get annotation ( ) ; }


patch fake : to test \ & quot ; client \ & quot ; model to test \ & quot ; client \ & quot ; model

default mono < response entity < client > > test client model ( @ api param ( value = " client model " , required = true ) @ valid @ request body mono < client > body , @ api ignore final server web exchange exchange ) { return get delegate ( ) test client model ( body , exchange ) ; }


removes this codec ( i e all associated handlers ) from the pipeline

void upgrade from ( channel handler context ctx ) ;


sets new values to all fields of the tuple


determine whether this { @ code stop watch } is currently running

public boolean is running ( ) { return ( this current task name ! = null ) ; }


get the { @ link data source } with the { @ linkplain # get connection properties connection properties } applied


put a single entity if there is an error , add a timeline put error to the given response

private long put entities ( tree map < long , rolling write batch > entity updates , tree map < long , rolling write batch > index updates , timeline entity entity , timeline put response response ) { long put count = 0 ; list < entity identifier > related entities without start times = new array list < entity identifier > ( ) ; byte [ ] rev start time = null ; map < string , set < object > > primary filters = null ; try { list < timeline event > events = entity get events ( ) ; / / look up the start time for the entity long start time = get and set start time ( entity get entity id ( ) , entity get entity type ( ) , entity get start time ( ) , events ) ; if ( start time = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error no start time ) ; response add error ( error ) ; return put count ; } / / must have a domain if ( string utils is empty ( entity get domain id ( ) ) ) { timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error no domain ) ; response add error ( error ) ; return put count ; } rev start time = write reverse ordered long ( start time ) ; long rounded start time = entitydb compute current check millis ( start time ) ; rolling write batch rolling write batch = entity updates get ( rounded start time ) ; if ( rolling write batch = = null ) { db db = entitydb get d b for start time ( start time ) ; if ( db ! = null ) { write batch write batch = db create write batch ( ) ; rolling write batch = new rolling write batch ( db , write batch ) ; entity updates put ( rounded start time , rolling write batch ) ; } } if ( rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; return put count ; } write batch write batch = rolling write batch get write batch ( ) ; / / save off the get bytes conversion to avoid unnecessary cost byte [ ] entity id bytes = entity get entity id ( ) get bytes ( utf 8 ) ; byte [ ] entity type bytes = entity get entity type ( ) get bytes ( utf 8 ) ; byte [ ] domain id bytes = entity get domain id ( ) get bytes ( utf 8 ) ; / / write entity marker byte [ ] marker key = key builder new instance ( 3 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) get bytes for lookup ( ) ; write batch put ( marker key , empty bytes ) ; + + put count ; / / write domain id entry byte [ ] domainkey = key builder new instance ( 4 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( domain id column ) get bytes ( ) ; write batch put ( domainkey , domain id bytes ) ; + + put count ; / / write event entries if ( events ! = null ) { for ( timeline event event : events ) { byte [ ] revts = write reverse ordered long ( event get timestamp ( ) ) ; byte [ ] key = key builder new instance ( ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( events column ) add ( revts ) add ( event get event type ( ) get bytes ( utf 8 ) ) get bytes ( ) ; byte [ ] value = fst conf as byte array ( event get event info ( ) ) ; write batch put ( key , value ) ; + + put count ; } } / / write primary filter entries primary filters = entity get primary filters ( ) ; if ( primary filters ! = null ) { for ( entry < string , set < object > > primary filter : primary filters entry set ( ) ) { for ( object primary filter value : primary filter get value ( ) ) { byte [ ] key = key builder new instance ( 6 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( primary filters column ) add ( primary filter get key ( ) ) add ( fst conf as byte array ( primary filter value ) ) get bytes ( ) ; write batch put ( key , empty bytes ) ; + + put count ; } } } / / write other info entries map < string , object > other info = entity get other info ( ) ; if ( other info ! = null ) { for ( entry < string , object > info : other info entry set ( ) ) { byte [ ] key = key builder new instance ( 5 ) add ( entity type bytes , true ) add ( rev start time ) add ( entity id bytes , true ) add ( other info column ) add ( info get key ( ) ) get bytes ( ) ; byte [ ] value = fst conf as byte array ( info get value ( ) ) ; write batch put ( key , value ) ; + + put count ; } } / / write related entity entries map < string , set < string > > related entities = entity get related entities ( ) ; if ( related entities ! = null ) { for ( entry < string , set < string > > related entity list : related entities entry set ( ) ) { string related entity type = related entity list get key ( ) ; for ( string related entity id : related entity list get value ( ) ) { / / look up start time of related entity long related start time long = get start time long ( related entity id , related entity type ) ; / / delay writing the related entity if no start time is found if ( related start time long = = null ) { related entities without start times add ( new entity identifier ( related entity id , related entity type ) ) ; continue ; } byte [ ] related entity start time = write reverse ordered long ( related start time long ) ; long related rounded start time = entitydb compute current check millis ( related start time long ) ; rolling write batch related rolling write batch = entity updates get ( related rounded start time ) ; if ( related rolling write batch = = null ) { db db = entitydb get d b for start time ( related start time long ) ; if ( db ! = null ) { write batch related write batch = db create write batch ( ) ; related rolling write batch = new rolling write batch ( db , related write batch ) ; entity updates put ( related rounded start time , related rolling write batch ) ; } } if ( related rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; continue ; } / / this is the existing entity byte [ ] related domain id bytes = related rolling write batch get d b ( ) get ( create domain id key ( related entity id , related entity type , related entity start time ) ) ; / / the timeline data created by the server before 2 6 won ' t have / / the domain field we assume this timeline data is in the / / default timeline domain string domain id = null ; if ( related domain id bytes = = null ) { domain id = timeline data manager default domain id ; } else { domain id = new string ( related domain id bytes , utf 8 ) ; } if ( ! domain id equals ( entity get domain id ( ) ) ) { / / in this case the entity will be put , but the relation will be / / ignored timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error forbidden relation ) ; response add error ( error ) ; continue ; } / / write " forward " entry ( related entity - > entity ) byte [ ] key = create related entity key ( related entity id , related entity type , related entity start time , entity get entity id ( ) , entity get entity type ( ) ) ; write batch related write batch = related rolling write batch get write batch ( ) ; related write batch put ( key , empty bytes ) ; + + put count ; } } } / / write index entities rolling write batch index rolling write batch = index updates get ( rounded start time ) ; if ( index rolling write batch = = null ) { db db = indexdb get d b for start time ( start time ) ; if ( db ! = null ) { write batch index write batch = db create write batch ( ) ; index rolling write batch = new rolling write batch ( db , index write batch ) ; index updates put ( rounded start time , index rolling write batch ) ; } } if ( index rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; return put count ; } write batch index write batch = index rolling write batch get write batch ( ) ; put count + = write primary filter entries ( index write batch , primary filters , marker key , empty bytes ) ; } catch ( i o exception e ) { log error ( " error putting entity " + entity get entity id ( ) + " of type " + entity get entity type ( ) , e ) ; timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error io exception ) ; response add error ( error ) ; } for ( entity identifier related entity : related entities without start times ) { try { long related entity start and insert time = get and set start time ( related entity get id ( ) , related entity get type ( ) , read reverse ordered long ( rev start time , 0 ) , null ) ; if ( related entity start and insert time = = null ) { throw new i o exception ( " error setting start time for related entity " ) ; } long related start time long = related entity start and insert time ; long related rounded start time = entitydb compute current check millis ( related start time long ) ; rolling write batch related rolling write batch = entity updates get ( related rounded start time ) ; if ( related rolling write batch = = null ) { db db = entitydb get d b for start time ( related start time long ) ; if ( db ! = null ) { write batch related write batch = db create write batch ( ) ; related rolling write batch = new rolling write batch ( db , related write batch ) ; entity updates put ( related rounded start time , related rolling write batch ) ; } } if ( related rolling write batch = = null ) { / / if no start time is found , add an error and return timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error expired entity ) ; response add error ( error ) ; continue ; } write batch related write batch = related rolling write batch get write batch ( ) ; byte [ ] related entity start time = write reverse ordered long ( related entity start and insert time ) ; / / this is the new entity , the domain should be the same byte [ ] key = create domain id key ( related entity get id ( ) , related entity get type ( ) , related entity start time ) ; related write batch put ( key , entity get domain id ( ) get bytes ( utf 8 ) ) ; + + put count ; related write batch put ( create related entity key ( related entity get id ( ) , related entity get type ( ) , related entity start time , entity get entity id ( ) , entity get entity type ( ) ) , empty bytes ) ; + + put count ; related write batch put ( create entity marker key ( related entity get id ( ) , related entity get type ( ) , related entity start time ) , empty bytes ) ; + + put count ; } catch ( i o exception e ) { log error ( " error putting related entity " + related entity get id ( ) + " of type " + related entity get type ( ) + " for entity " + entity get entity id ( ) + " of type " + entity get entity type ( ) , e ) ; timeline put error error = new timeline put error ( ) ; error set entity id ( entity get entity id ( ) ) ; error set entity type ( entity get entity type ( ) ) ; error set error code ( timeline put error io exception ) ; response add error ( error ) ; } } return put count ; }


returns the promise { @ link http 2 frame stream } object for this frame , or { @ code null } if the frame has yet to be associated with a stream


allows creating custom < code > double < code > argument matchers note that { @ link # arg that } will not work with primitive < code > double < code > matchers due to < code > null pointer exception < code > auto - unboxing caveat see examples in javadoc for { @ link argument matchers } class

public static double double that ( argument matcher < double > matcher ) { report matcher ( matcher ) ; return 0 ; }


creates a parent node to be added to the list of children creates a node using the inner node four argument constructor specifying the name , location , parent , and level of this node to be overridden in subclasses for specific inner node implementations , as alternative to overriding the full { @ link # add ( node ) } method

private inner node impl create parent node ( string parent name ) { return new inner node impl ( parent name , get path ( this ) , this , this get level ( ) + 1 ) ; }


calculates the new value for the accumulated mean when a value is added , in the case where at least one of the previous mean and the value is non - finite

static double calculate new mean non finite ( double previous mean , double value ) { / * * desired behaviour is to match the results of applying the naive mean formula in particular , * the update formula can subtract infinities in cases where the naive formula would add them * * consequently : * 1 if the previous mean is finite and the new value is non - finite then the new mean is that * value ( whether it is na n or infinity ) * 2 if the new value is finite and the previous mean is non - finite then the mean is unchanged * ( whether it is na n or infinity ) * 3 if both the previous mean and the new value are non - finite and * 3a either or both is na n ( so mean ! = value ) then the new mean is na n * 3b they are both the same infinities ( so mean = = value ) then the mean is unchanged * 3c they are different infinities ( so mean ! = value ) then the new mean is na n * / if ( is finite ( previous mean ) ) { / / this is case 1 return value ; } else if ( is finite ( value ) | | previous mean = = value ) { / / this is case 2 or 3b return previous mean ; } else { / / this is case 3a or 3c return na n ; } }


lets the visitor visit , with method null

public void accept ( clazz clazz , type annotation type annotation , target info visitor target info visitor ) { target info visitor visit formal parameter target info ( clazz , null , type annotation , this ) ; }


public synchronized int position ( ) { return byte buffer position ( ) ; }


reconfiguration recovery - test that old config members will join the new config if its already active , and not try to complete the reconfiguration

public void test next config already active ( ) throws exception { client base setup test env ( ) ; / / 2 servers in current config , 5 in next config final int server count = 5 ; final int [ ] client ports = new int [ server count ] ; string builder sb = new string builder ( ) ; string server ; string current quorum cfg section = null , next quorum cfg section ; array list < string > all servers = new array list < string > ( ) ; for ( int i = 0 ; i < server count ; i + + ) { client ports [ i ] = port assignment unique ( ) ; server = " server " + i + " = localhost : " + port assignment unique ( ) + " : " + port assignment unique ( ) + " : participant ; localhost : " + client ports [ i ] ; all servers add ( server ) ; sb append ( server + " \ n " ) ; if ( i = = 1 ) { current quorum cfg section = sb to string ( ) ; } } next quorum cfg section = sb to string ( ) ; / / lets start servers 2 , 3 , 4 with the new config main thread [ ] mt = new main thread [ server count ] ; zoo keeper [ ] zk = new zoo keeper [ server count ] ; for ( int i = 2 ; i < server count ; i + + ) { mt [ i ] = new main thread ( i , client ports [ i ] , next quorum cfg section , true , " 200000000 " ) ; mt [ i ] start ( ) ; zk [ i ] = new zoo keeper ( " 127 0 0 1 : " + client ports [ i ] , client base connection timeout , this ) ; } for ( int i = 2 ; i < server count ; i + + ) { assert true ( client base wait for server up ( " 127 0 0 1 : " + client ports [ i ] , connection timeout ) , " waiting for server " + i + " being up " ) ; } reconfig test test normal operation ( zk [ 2 ] , zk [ 3 ] ) ; long epoch = mt [ 2 ] main quorum peer get accepted epoch ( ) ; / / both servers 0 and 1 will have the next config file , which means / / for them that a reconfiguration was in progress when they failed / / and the leader will complete it for ( int i = 0 ; i < 2 ; i + + ) { mt [ i ] = new main thread ( i , client ports [ i ] , current quorum cfg section , true , " 100000000 " ) ; mt [ i ] write temp dynamic config file ( next quorum cfg section , " 200000000 " ) ; mt [ i ] start ( ) ; zk [ i ] = new zoo keeper ( " 127 0 0 1 : " + client ports [ i ] , client base connection timeout , this ) ; } / / servers 0 and 1 should connect to all servers , including the one in / / their next file during startup , and will find the next config and join it for ( int i = 0 ; i < 2 ; i + + ) { assert true ( client base wait for server up ( " 127 0 0 1 : " + client ports [ i ] , connection timeout * 2 ) , " waiting for server " + i + " being up " ) ; } / / make sure they joined the new config without any change to it assert equals ( epoch , mt [ 0 ] main quorum peer get accepted epoch ( ) ) ; assert equals ( epoch , mt [ 1 ] main quorum peer get accepted epoch ( ) ) ; assert equals ( epoch , mt [ 2 ] main quorum peer get accepted epoch ( ) ) ; reconfig test test server has config ( zk [ 0 ] , all servers , null ) ; reconfig test test server has config ( zk [ 1 ] , all servers , null ) ; reconfig test test normal operation ( zk [ 0 ] , zk [ 2 ] ) ; reconfig test test normal operation ( zk [ 4 ] , zk [ 1 ] ) ; for ( int i = 0 ; i < server count ; i + + ) { zk [ i ] close ( ) ; mt [ i ] shutdown ( ) ; } }


determine if the specified url is supported and that any required protocol extensions are recognized

public static boolean is supported u r l ( url url ) { if ( ! ghidra u r l protocol equals ( url get protocol ( ) ) ) { return false ; } if ( url get authority ( ) ! = null ) { / / assume standard ghidra url ( ghidra : / / ) return true ; } try { return get protocol extension handler ( url ) ! = null ; } catch ( malformed u r l exception | not found exception e ) { return false ; } }


public void test client ( ) { / / todo : test client }


register a listener that will be called when this model is unbound from a view the listener will contribute to this model ' s hash code state per the { @ link com airbnb epoxy epoxy attribute option # do not hash } rules you may clear the listener by setting a null value , or by calling { @ link # reset ( ) }

public generate default layout method parent layout $ with layout on unbind ( on model unbound listener < generate default layout method parent layout $ with layout , object > listener ) { on mutation ( ) ; this on model unbound listener epoxy generated model = listener ; return this ; }


public rpc service get rpc service ( ) { return rpc service ; }


public map < string , list < integer > > get map array integer ( ) { return map array integer ; }


parse out a date object given the current parser and field name

public static date parse time field ( x content parser parser , string field name ) throws i o exception { if ( parser current token ( ) = = x content parser token value number ) { return new date ( parser long value ( ) ) ; } else if ( parser current token ( ) = = x content parser token value string ) { return new date ( date formatters from ( date time formatter iso instant parse ( parser text ( ) ) ) to instant ( ) to epoch milli ( ) ) ; } throw new illegal argument exception ( " unexpected token [ " + parser current token ( ) + " ] for [ " + field name + " ] " ) ; }


get the value of whether there are any non - ec blocks using striped i d

public boolean has non ec block using striped i d ( ) { return has non ec block using striped i d ; }


advances the ticker value by { @ code nanoseconds }

public fake ticker advance ( long nanoseconds ) { nanos add and get ( nanoseconds ) ; return this ; }


returns the environments that belong to this group

public set < label > get environments ( ) { return environment labels environments ; }


add the options change listener note : the options uses weak references to manage the listeners ; this means that you must supply a listener and maintain a handle to it , or else the listener will be garbage collected and will never get called so for this reason , do not create the listener in an anonymous inner class

public void add options change listener ( options change listener l ) { listeners add ( l ) ; }


method to authenticate a set of credentials

default cas radius response authenticate ( final string username , final string password ) throws exception { return authenticate ( username , password , optional empty ( ) ) ; }


group the selected vertices into one vertex that represents them all

public attributed vertex group selected vertices ( ) { mutable selected state < attributed vertex > selected v state = vv get selected vertex state ( ) ; mutable selected state < attributed edge > selected e state = vv get selected edge state ( ) ; collection < attributed vertex > selected = selected v state get selected ( ) ; if ( selected size ( ) > 1 ) { attributed vertex group vertex = collapse ( selected ) ; selected v state clear ( ) ; selected e state clear ( ) ; selected v state select ( group vertex ) ; return group vertex ; } return null ; }


copy all given property values into this object guarantees property value references are independent , although it can ' t deep copy objects currently referenced by individual property value objects

public mutable property values add property values ( @ nullable property values other ) { if ( other ! = null ) { property value [ ] pvs = other get property values ( ) ; for ( property value pv : pvs ) { add property value ( new property value ( pv ) ) ; } } return this ; }


public void unselected choice states ( ) { touch listener unselected choice states ( ) ; }


public static boolean un undo log delete lock ( ) { return get root session manager ( ) un scheduled lock ( undolog delete ) ; }


sets the element of this big array at specified index

public void set ( long index , boolean value ) { array [ segment ( index ) ] [ offset ( index ) ] = value ; }


returns the name of the leaf file or directory if called on a { @ link path } instance for a mount name ( eg ' ' or ' c : ' ) , the empty string is returned

public string get base name ( ) { int last separator = path last index of ( separator ) ; return last separator < drive str length ? path substring ( drive str length ) : path substring ( last separator + 1 ) ; }


return a { @ link request mapping handler mapping } ordered at 0 for mapping requests to annotated controllers

public request mapping handler mapping request mapping handler mapping ( @ qualifier ( " mvc content negotiation manager " ) content negotiation manager content negotiation manager , @ qualifier ( " mvc conversion service " ) formatting conversion service conversion service , @ qualifier ( " mvc resource url provider " ) resource url provider resource url provider ) { request mapping handler mapping mapping = create request mapping handler mapping ( ) ; mapping set order ( 0 ) ; mapping set interceptors ( get interceptors ( conversion service , resource url provider ) ) ; mapping set content negotiation manager ( content negotiation manager ) ; mapping set cors configurations ( get cors configurations ( ) ) ; path match configurer path config = get path match configurer ( ) ; if ( path config get pattern parser ( ) ! = null ) { mapping set pattern parser ( path config get pattern parser ( ) ) ; } else { mapping set url path helper ( path config get url path helper or default ( ) ) ; mapping set path matcher ( path config get path matcher or default ( ) ) ; boolean use suffix pattern match = path config is use suffix pattern match ( ) ; if ( use suffix pattern match ! = null ) { mapping set use suffix pattern match ( use suffix pattern match ) ; } boolean use registered suffix pattern match = path config is use registered suffix pattern match ( ) ; if ( use registered suffix pattern match ! = null ) { mapping set use registered suffix pattern match ( use registered suffix pattern match ) ; } } boolean use trailing slash match = path config is use trailing slash match ( ) ; if ( use trailing slash match ! = null ) { mapping set use trailing slash match ( use trailing slash match ) ; } if ( path config get path prefixes ( ) ! = null ) { mapping set path prefixes ( path config get path prefixes ( ) ) ; } return mapping ; }


returns a predicate that evaluates to { @ code true } if the object being tested is an instance of the given class if the object being tested is { @ code null } this predicate evaluates to { @ code false } if you want to filter an { @ code iterable } to narrow its type , consider using { @ link com google common collect iterables # filter ( iterable , class ) } in preference < b > warning : < b > contrary to the typical assumptions about predicates ( as documented at { @ link predicate # apply } ) , the returned predicate may not be consistent with equals for example , { @ code instance of ( array list class ) } will yield different results for the two equal instances { @ code lists new array list ( 1 ) } and { @ code arrays as list ( 1 ) }

public static predicate < object > instance of ( class < ? > clazz ) { return new instance of predicate ( clazz ) ; }


gets the field { @ code attributes } ( along with { @ code attributes count } )

public attribute list get attributes ( ) ;


public int next ( ) { switch ( n ) { case 0 : return - 1 ; case 1 : { int index = mapping get ( 0 ) ; - - n ; return index ; } default : { int pos = rand next int ( n ) ; int index = mapping get ( pos ) ; mapping swap ( pos , - - n ) ; return index ; } } }


public void quick run ( ) { var event manager = new event manager ( ) ; try { / / create an asynchronous event var async event id = event manager create async ( 60 ) ; logger info ( " async event [ { } ] has been created " , async event id ) ; event manager start ( async event id ) ; logger info ( " async event [ { } ] has been started " , async event id ) ; / / create a synchronous event var sync event id = event manager create ( 60 ) ; logger info ( " sync event [ { } ] has been created " , sync event id ) ; event manager start ( sync event id ) ; logger info ( " sync event [ { } ] has been started " , sync event id ) ; event manager status ( async event id ) ; event manager status ( sync event id ) ; event manager cancel ( async event id ) ; logger info ( " async event [ { } ] has been stopped " , async event id ) ; event manager cancel ( sync event id ) ; logger info ( " sync event [ { } ] has been stopped " , sync event id ) ; } catch ( max num of events allowed exception | long running event exception | event does not exist exception | invalid operation exception e ) { logger error ( e get message ( ) ) ; } }


public big decimal get my number ( ) { return my number ; }


public list < integer > get name array ( ) { return name array ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


build call for fake outer boolean serialize

public okhttp 3 call fake outer boolean serialize call ( boolean body , final api callback callback ) throws api exception { object local var post body = body ; / / create path and map variables string local var path = " / fake / outer / boolean " ; list < pair > local var query params = new array list < pair > ( ) ; list < pair > local var collection query params = new array list < pair > ( ) ; map < string , string > local var header params = new hash map < string , string > ( ) ; map < string , string > local var cookie params = new hash map < string , string > ( ) ; map < string , object > local var form params = new hash map < string , object > ( ) ; final string [ ] local var accepts = { " * / * " } ; final string local var accept = local var api client select header accept ( local var accepts ) ; if ( local var accept ! = null ) { local var header params put ( " accept " , local var accept ) ; } final string [ ] local var content types = { } ; final string local var content type = local var api client select header content type ( local var content types ) ; local var header params put ( " content - type " , local var content type ) ; string [ ] local var auth names = new string [ ] { } ; return local var api client build call ( local var path , " post " , local var query params , local var collection query params , local var post body , local var header params , local var cookie params , local var form params , local var auth names , callback ) ; }


method that has to be implemented by implementing classes to fill the queue

public void fill queue for key ( string key name , queue < e > key queue , int num values ) throws i o exception ;


formatted time string to the milliseconds the pattern is { @ code yyyy - mm - dd hh : mm : ss }

public static long string 2 millis ( final string time ) { return string 2 millis ( time , get default format ( ) ) ; }


check for and display message component text associated with option dialog windows

public static string get message text ( window w ) { component c = find component by name ( w , option dialog message component name ) ; if ( c instanceof j label ) { return ( ( j label ) c ) get text ( ) ; } else if ( c instanceof multi line label ) { return ( ( multi line label ) c ) get label ( ) ; } return null ; }


public void test array of number only ( ) { / / todo : test array of number only }


public void kind test ( ) { / / todo : test kind }


returns the { @ link synchronization context } where { @ link # start ( listener 2 ) } , { @ link # shutdown } and { @ link # refresh } are run from

public synchronization context get synchronization context ( ) { return sync context ; }


returns the current find options , creating them if necessary

find options get options ( ) { if ( options = = null ) { options = create options ( ) ; } return options ; }


public list < list < read only first > > get array array of model ( ) { return array array of model ; }


finishing reading the block release all resources

public void close ( ) throws i o exception { if ( closed = = true ) { return ; } try { / / do not set r blk state to null people may access stats after calling / / close ( ) r blk state finish ( ) ; } finally { closed = true ; } }


public boolean get attribute boolean ( ) { return attribute boolean ; }


returns all the function records that have the provided full hash , searching across all attached databases

public list < function record > find functions by full hash ( long full hash ) { array list < function record > result = new array list < function record > ( ) ; for ( fid d b fid db : fid db list ) { list < function record > list = fid db find functions by full hash ( full hash ) ; if ( list ! = null ) { result add all ( list ) ; } } return result ; }


verifies that no { @ link null pointer exception } is thrown when { @ link abstract metric group # get all variables ( ) } is called and the parent is null

public void test get all variables ( ) throws exception { metric registry impl registry = new metric registry impl ( metric registry configuration default metric registry configuration ( ) ) ; abstract metric group group = new abstract metric group < abstract metric group < ? > > ( registry , new string [ 0 ] , null ) { @ override protected query scope info create query service metric info ( character filter filter ) { return null ; } @ override protected string get group name ( character filter filter ) { return " " ; } } ; assert true ( group get all variables ( ) is empty ( ) ) ; registry shutdown ( ) get ( ) ; }


public static int encode longitude ( double longitude ) { / / the maximum possible value cannot be encoded without overflow if ( longitude = = 180 0d ) { longitude = math next down ( longitude ) ; } return ( int ) math floor ( longitude / lon decode ) ; }


public api response < void > add pet with http info ( pet body ) throws api exception { okhttp 3 call local var call = add pet validate before call ( body , null ) ; return local var api client execute ( local var call ) ; }


public t load ( file system fs , path path ) throws i o exception { f s data input stream data input stream = fs open ( path ) ; return from stream ( data input stream ) ; }


< code > optional aapt pb attribute attr = 1 ; < code >

public boolean has attr ( ) { return instance has attr ( ) ; }


read a string as a v int n , followed by n bytes in text format

public static string read string ( data input in ) throws i o exception { int length = read v int ( in ) ; if ( length = = - 1 ) return null ; byte [ ] buffer = new byte [ length ] ; in read fully ( buffer ) ; return text decode ( buffer ) ; }


ensures that { @ code expression } is { @ code true } , throwing a { @ code verify exception } with a custom message otherwise see { @ link # verify ( boolean , string , object ) } for details

public static void verify ( boolean expression , @ nullable decl string error message template , @ nullable decl object p 1 , @ nullable decl object p 2 ) { if ( ! expression ) { throw new verify exception ( lenient format ( error message template , p 1 , p 2 ) ) ; } }


returns true if the exception should be handled as a transient failure on clients we handle g s s exception no cred as retriable on the client - side since this may occur during re - login if a clients attempts to authentication after logout , but before the subsequent login

public static boolean is retriable client gss exception ( exception exception ) { throwable cause = exception get cause ( ) ; while ( cause ! = null & & ! ( cause instanceof g s s exception ) ) { cause = cause get cause ( ) ; } if ( cause ! = null ) { g s s exception gss exception = ( g s s exception ) cause ; return gss exception get major ( ) = = g s s exception no cred ; } return false ; }


decide whether the iterative algorithm has converged

boolean is converged ( int iteration , t value ) ;


this method allows access to the graph ' s edge values along with its source and target vertex values

public data set < triplet < k , vv , ev > > get triplets ( ) { return this get vertices ( ) join ( this get edges ( ) ) where ( 0 ) equal to ( 0 ) with ( new project edge with src value < > ( ) ) name ( " project edge with source value " ) join ( this get vertices ( ) ) where ( 1 ) equal to ( 0 ) with ( new project edge with vertex values < > ( ) ) name ( " project edge with vertex values " ) ; }


converts the internal representation of a sql time ( int ) to the java type used for udf parameters ( { @ link java sql time } )

public static java sql time internal to time ( int v ) { / / note that , in this case , can ' t handle daylight saving time return new java sql time ( v - local tz get offset ( v ) ) ; }


this teardown does not call super teardown ( ) so as to avoid the ddmbs table from being destroyed this is potentially quite slow , depending on ddb io capacity and number of entries to forget

public void tear down ( ) throws exception { log info ( " removing data from ddbms table in teardown " ) ; thread current thread ( ) set name ( " teardown " ) ; / / the following is a way to be sure the table will be cleared and there / / will be no leftovers after the test try { delete all metadata ( ) ; } finally { i o utils cleanup with logger ( log , file system ) ; } }


adds a route to the given handler function that handles http { @ code put } requests

builder put ( handler function < server response > handler function ) ;


returns the < a href = " http : en wikipedia orgwiki variance # sample variance " > unbiased sample variance of the values if this dataset is a sample drawn from a population , this is an unbiased estimator of the population variance of the population the count must be greater than one this is not guaranteed to return zero when the dataset consists of the same value multiple times , due to numerical errors however , it is guaranteed never to return a negative result < h 3 > non - finite values < h 3 > if the dataset contains any non - finite values ( { @ link double # positive infinity } , { @ link double # negative infinity } , or { @ link double # na n } ) then the result is { @ link double # na n }

public final double sample variance ( ) { check state ( count > 1 ) ; if ( is na n ( sum of squares of deltas ) ) { return na n ; } return ensure non negative ( sum of squares of deltas ) / ( count - 1 ) ; }


tests good path saslscram authentication over ssl with old version of client that does not support sasl authenticate headers and new version of server

public void old sasl scram ssl client without sasl authenticate header ( ) throws exception { verify sasl authenticate header interop ( true , false , security protocol sasl ssl , " scram - sha - 512 " ) ; }


returns true if the tracking path is a directory , false otherwise

public boolean is dir ( ) { return ! ( start path id = = file id ) ; }


smart mockito users hardly use this feature because they know it could be a sign of poor tests normally , you don ' t need to reset your mocks , just create new mocks for each test method instead of < code > # reset ( ) < code > please consider writing simple , small and focused test methods over lengthy , over - specified tests < b > first potential code smell is < code > reset ( ) < code > in the middle of the test method < b > this probably means you ' re testing too much follow the whisper of your test methods : " please keep us small & focused on single behavior " there are several threads about it on mockito mailing list the only reason we added < code > reset ( ) < code > method is to make it possible to work with container - injected mocks for more information see the faq ( < a href = " https : github commockitomockitowiki f a q " > here ) < b > don ' t harm yourself < b > < code > reset ( ) < code > in the middle of the test method is a code smell ( you ' re probably testing too much ) < pre class = " code " > < code class = " java " > list mock = mock ( list class ) ; when ( mock size ( ) ) then return ( 10 ) ; mock add ( 1 ) ; reset ( mock ) ; at this point the mock forgot any interactions & stubbing < code >

public static < t > void reset ( t mocks ) { mockito core reset ( mocks ) ; }


implementations must implement this method to process the meta - data passed in exactly what the implementation chooses to do is up to it

t process meta data ( database meta data dbmd ) throws s q l exception , meta data access exception ;


returns a { @ link byte source } that reads from the given url

public static byte source as byte source ( url url ) { return new url byte source ( url ) ; }


returns whether the specified enum method shall be skipped when analyzing checkcast instructions

private boolean is method skipped for checkcast ( string name , string type ) { return name equals ( class constants method name valueof ) | | name equals ( class constants method name values ) ; }


converts the java type used for udf parameters of sql date type ( { @ link java sql date } ) to internal representation ( int ) converse of { @ link # internal to date ( int ) }

public static int date to internal ( java sql date date ) { long ts = date get time ( ) + local tz get offset ( date get time ( ) ) ; return ( int ) ( ts / millis per day ) ; }


void end file lease ( final long inode id ) { synchronized ( files being written ) { remove file being written ( inode id ) ; / / remove client from renewer if no files are open if ( files being written is empty ( ) ) { get lease renewer ( ) close client ( this ) ; } } }


creates a { @ link scheduled executor service } that renames the { @ link thread threads } that its tasks run in the names are retrieved from the { @ code name supplier } on the thread that is being renamed right before each task is run the renaming is best effort , if a { @ link security manager } prevents the renaming then it will be skipped but the tasks will still execute

static scheduled executor service renaming decorator ( final scheduled executor service service , final supplier < string > name supplier ) { check not null ( service ) ; check not null ( name supplier ) ; return new wrapping scheduled executor service ( service ) { @ override protected < t > callable < t > wrap task ( callable < t > callable ) { return callables thread renaming ( callable , name supplier ) ; } @ override protected runnable wrap task ( runnable command ) { return callables thread renaming ( command , name supplier ) ; } } ; }


create the actions for the menu on the tool

private void create actions ( ) { create standard archives menu ( ) ; }


public static boolean is empty ( map < ? , ? > map ) { return ! is not empty ( map ) ; }


the user will be asked on permission if the feature is tried to access


sets the icon that will be used in the window ' s title bar has no effect in mac o s , which doesn ' t use window icons

public void set window icon ( file type file type , string file paths ) { window icon file type = file type ; window icon paths = file paths ; }


format url template using default server variables

public string url ( ) { return url ( null ) ; }


attempts to create or delete convenience symlinks in the workspace to the various output directories , and generates associated log events if { @ code - - symlink prefix } is { @ link no create symlinks prefix } , or { @ code - - experimental convenience symlinks } is { @ link convenience symlinks mode ignore } , this method is a no - op otherwise , for each symlink type , we decide whether the symlink should exist or not if it should exist , it is created with the appropriate destination path ; if not , it is deleted if already present on the file system in either case , the decision of whether to create or delete the symlink is logged ( note that deleting pre - existing symlinks helps ensure the user ' s workspace is in a consistent state after the build however , if the { @ code - - symlink prefix } has changed , we have no way to cleanup old symlink names leftover from a previous invocation ) if { @ code - - experimental convenience symlinks } is set to { @ link convenience symlinks mode clean } , all symlinks are set to be deleted if it ' s set to { @ link convenience symlinks mode normal } , each symlink type decides whether it should be created or deleted ( a symlink may decide to be deleted if e g it is disabled by a flag , or would want to point to more than one destination ) if it ' s set to { @ link convenience symlinks mode log only } , the same logic is run as in the { @ code normal } case , but the result is only emitting log messages , with no actual filesystem mutations a warning is emitted if a symlink would resolve to multiple destinations , or if a filesystem mutation operation fails

static immutable list < convenience symlink > create output directory links ( iterable < symlink definition > symlink definitions , build request options build request options , string workspace name , path workspace , blaze directories directories , event handler event handler , set < build configuration > target configs , function < build options , build configuration > config getter , string product name ) { path exec root = directories get exec root ( workspace name ) ; path output path = directories get output path ( workspace name ) ; path output base = directories get output base ( ) ; string symlink prefix = build request options get symlink prefix ( product name ) ; convenience symlinks mode mode = build request options experimental convenience symlinks ; if ( no create symlinks prefix equals ( symlink prefix ) ) { return immutable list of ( ) ; } immutable list builder < convenience symlink > convenience symlinks builder = immutable list builder ( ) ; list < string > failures = new array list < > ( ) ; list < string > ambiguous links = new array list < > ( ) ; set < string > created links = new linked hash set < > ( ) ; string workspace base name = workspace get base name ( ) ; repository name repository name = repository name create from valid stripped name ( workspace name ) ; boolean log only = mode = = convenience symlinks mode log only ; for ( symlink definition symlink : get all link definitions ( symlink definitions , ! build request options experimental no product name out symlink ) ) { string link name = symlink get link name ( symlink prefix , product name , workspace base name ) ; if ( ! created links add ( link name ) ) { / / already created a link by this name continue ; } if ( mode = = convenience symlinks mode clean ) { remove link ( workspace , link name , failures , convenience symlinks builder , log only ) ; } else { set < path > candidate paths = symlink get link paths ( build request options , target configs , config getter , repository name , output path , exec root ) ; if ( candidate paths size ( ) = = 1 ) { create link ( workspace , link name , output base , iterables get only element ( candidate paths ) , failures , convenience symlinks builder , log only ) ; } else { remove link ( workspace , link name , failures , convenience symlinks builder , log only ) ; / / candidate paths can be empty if the symlink decided not to be created this can happen / / if the symlink is disabled by a flag , or it intercepts an error while computing its / / target path in that case , don ' t trigger a warning about an ambiguous link if ( candidate paths size ( ) > 1 ) { ambiguous links add ( link name ) ; } } } } if ( ! failures is empty ( ) ) { event handler handle ( event warn ( string format ( " failed to create one or more convenience symlinks for prefix ' % s ' : \ n % s " , symlink prefix , joiner on ( " \ n " ) join ( failures ) ) ) ) ; } if ( ! ambiguous links is empty ( ) ) { event handler handle ( event warn ( string format ( " cleared convenience symlink ( s ) % s because their destinations would be ambiguous " , joiner on ( " , " ) join ( ambiguous links ) ) ) ) ; } return convenience symlinks builder build ( ) ; }


find the fields constant that matches name , or null if its not found

public static fields find by name ( string name ) { return by name get ( name ) ; }


returns the u r ls in the class path specified by the { @ code java class path } { @ linkplain system # get property system property }

private static immutable list < url > parse java class path ( ) { immutable list builder < url > urls = immutable list builder ( ) ; for ( string entry : splitter on ( path separator value ( ) ) split ( java class path value ( ) ) ) { try { try { urls add ( new file ( entry ) to u r i ( ) to u r l ( ) ) ; } catch ( security exception e ) { / / file to u r i checks to see if the file is a directory urls add ( new url ( " file " , null , new file ( entry ) get absolute path ( ) ) ) ; } } catch ( malformed u r l exception e ) { assertion error error = new assertion error ( " malformed class path entry : " + entry ) ; error init cause ( e ) ; throw error ; } } return urls build ( ) ; }


add a configuration resource the properties of this resource will override properties of previously added resources , unless they were marked < a href = " # final " > final

public void add resource ( input stream in , string name ) { add resource object ( new resource ( in , name ) ) ; }


returns a markdown rendering of provider documentation for the given provider information object with the given name

public string render ( string provider name , provider info provider info ) throws i o exception { velocity context context = new velocity context ( ) ; context put ( " util " , new markdown util ( ) ) ; context put ( " provider name " , provider name ) ; context put ( " provider info " , provider info ) ; string writer string writer = new string writer ( ) ; reader reader = reader from path ( provider template filename ) ; try { velocity engine evaluate ( context , string writer , provider template filename , reader ) ; } catch ( resource not found exception | parse error exception | method invocation exception e ) { throw new i o exception ( e ) ; } return string writer to string ( ) ; }


protected void write to 0 ( dex file file , annotated output out ) { boolean annotates = out annotates ( ) ; if ( annotates ) { out annotate ( 0 , offset string ( ) + " encoded array " ) ; / * * the output is to be annotated , so redo the work previously * done by place 0 ( ) , except this time annotations will actually * get emitted * / value encoder encoder = new value encoder ( file , out ) ; encoder write array ( array , true ) ; } else { out write ( encoded form ) ; } }


one request followed by one response response has cache control headers set such that a caching http proxy ( such as gfe ) can satisfy subsequent requests

public io grpc testing integration messages simple response cacheable unary call ( io grpc testing integration messages simple request request ) { return io grpc stub client calls blocking unary call ( get channel ( ) , get cacheable unary call method ( ) , get call options ( ) , request ) ; }


consumes the { @ link authentication token } provided by the caller in the case of a { @ code null } token , { @ link # handle null token ( ) } is called in the case of a { @ code non - null } token , the realms are iterated over in the order defined in the configuration while possibly also taking into consideration the last realm that authenticated this principal when consulting multiple realms , the first realm that returns a non - null { @ link user } is the authenticating realm and iteration is stopped this user is then passed to { @ link # consume user ( user , map ) } if no exception was caught while trying to authenticate the token

private void consume token ( authentication token token ) { if ( token = = null ) { handle null token ( ) ; } else { authentication token = token ; final list < realm > realms list = get realm list ( authentication token principal ( ) ) ; logger trace ( " checking token of type [ { } ] against [ { } ] realm ( s ) " , token get class ( ) get name ( ) , realms list size ( ) ) ; final long start invalidation = num invalidation get ( ) ; final map < realm , tuple < string , exception > > messages = new linked hash map < > ( ) ; final bi consumer < realm , action listener < user > > realm authenticating consumer = ( realm , user listener ) - > { if ( realm supports ( authentication token ) ) { logger trace ( " trying to authenticate [ { } ] using realm [ { } ] with token [ { } ] " , token principal ( ) , realm , token get class ( ) get name ( ) ) ; realm authenticate ( authentication token , action listener wrap ( ( result ) - > { assert result ! = null : " realm " + realm + " produced a null authentication result " ; logger debug ( " authentication of [ { } ] using realm [ { } ] with token [ { } ] was [ { } ] " , token principal ( ) , realm , token get class ( ) get simple name ( ) , result ) ; if ( result get status ( ) = = authentication result status success ) { / / user was authenticated , populate the authenticated by information authenticated by = new realm ref ( realm name ( ) , realm type ( ) , node name ) ; authentication result = result ; if ( last successful auth cache ! = null & & start invalidation = = num invalidation get ( ) ) { last successful auth cache put ( authentication token principal ( ) , realm ) ; } user listener on response ( result get user ( ) ) ; } else { / / the user was not authenticated , call this so we can audit the correct event request realm authentication failed ( authentication token , realm name ( ) ) ; if ( result get status ( ) = = authentication result status terminate ) { if ( result get exception ( ) ! = null ) { logger info ( new parameterized message ( " authentication of [ { } ] was terminated by realm [ { } ] - { } " , authentication token principal ( ) , realm name ( ) , result get message ( ) ) , result get exception ( ) ) ; } else { logger info ( " authentication of [ { } ] was terminated by realm [ { } ] - { } " , authentication token principal ( ) , realm name ( ) , result get message ( ) ) ; } user listener on failure ( result get exception ( ) ) ; } else { if ( result get message ( ) ! = null ) { messages put ( realm , new tuple < > ( result get message ( ) , result get exception ( ) ) ) ; } user listener on response ( null ) ; } } } , ( ex ) - > { logger warn ( new parameterized message ( " an error occurred while attempting to authenticate [ { } ] against realm [ { } ] " , authentication token principal ( ) , realm name ( ) ) , ex ) ; user listener on failure ( ex ) ; } ) ) ; } else { user listener on response ( null ) ; } } ; final iterating action listener < user , realm > authenticating listener = new iterating action listener < > ( context preserving action listener wrap preserving context ( action listener wrap ( ( user ) - > consume user ( user , messages ) , ( e ) - > { if ( e ! = null ) { listener on failure ( request exception processing request ( e , token ) ) ; } else { listener on failure ( request authentication failed ( token ) ) ; } } ) , thread context ) , realm authenticating consumer , realms list , thread context ) ; try { authenticating listener run ( ) ; } catch ( exception e ) { logger debug ( new parameterized message ( " authentication of [ { } ] with token [ { } ] failed " , token principal ( ) , token get class ( ) get name ( ) ) , e ) ; listener on failure ( request exception processing request ( e , token ) ) ; } } }


update the view list if the the given path is the an ancestor of any of the paths currently in the view ; remove the descendant and add the ancestor path

private void update view list ( tree path path ) { program node node = ( program node ) path get last path component ( ) ; if ( ! tree has ancestors in view ( node ) & & ! view list contains ( path ) ) { for ( int i = 0 ; i < view list size ( ) ; i + + ) { tree path view path = view list get ( i ) ; if ( path is descendant ( view path ) ) { tree remove from view ( view path ) ; - - i ; } } tree add to view ( path ) ; } }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


abnormally terminates the stream after calling this method , no further messages will be sent or received , however it may still be possible to receive buffered messages for a brief period until { @ link client stream listener # closed } is called this method may only be called after { @ link # start } , but else is safe to be called at any time and multiple times and from any thread


test modify operations ( create , mkdir , delete , etc ) on the mount file system where the pathname references through the mount points hence these operation will modify the target file system verify the operation via mountfs ( ie fc ) and also via the target file system ( ie fclocal ) that the mount link points - to

public void test operations through mount links ( ) throws i o exception { / / create file file context test helper create file non recursive ( fc view , " / user / foo " ) ; assert assert true ( " create file should be file " , is file ( fc view , new path ( " / user / foo " ) ) ) ; assert assert true ( " target of created file should be type file " , is file ( fc target , new path ( target test root , " user / foo " ) ) ) ; / / delete the created file assert assert true ( " delete should succeed " , fc view delete ( new path ( " / user / foo " ) , false ) ) ; assert assert false ( " file should not exist after delete " , exists ( fc view , new path ( " / user / foo " ) ) ) ; assert assert false ( " target file should not exist after delete " , exists ( fc target , new path ( target test root , " user / foo " ) ) ) ; / / create file with a 2 component dirs file context test helper create file non recursive ( fc view , " / internal dir / link to dir 2 / foo " ) ; assert assert true ( " created file should be type file " , is file ( fc view , new path ( " / internal dir / link to dir 2 / foo " ) ) ) ; assert assert true ( " target of created file should be type file " , is file ( fc target , new path ( target test root , " dir 2 / foo " ) ) ) ; / / delete the created file assert assert true ( " delete should succeed " , fc view delete ( new path ( " / internal dir / link to dir 2 / foo " ) , false ) ) ; assert assert false ( " file should not exist after deletion " , exists ( fc view , new path ( " / internal dir / link to dir 2 / foo " ) ) ) ; assert assert false ( " target should not exist after deletion " , exists ( fc target , new path ( target test root , " dir 2 / foo " ) ) ) ; / / create file with a 3 component dirs file context test helper create file non recursive ( fc view , " / internal dir / internal dir 2 / link to dir 3 / foo " ) ; assert assert true ( " created file should be of type file " , is file ( fc view , new path ( " / internal dir / internal dir 2 / link to dir 3 / foo " ) ) ) ; assert assert true ( " target of created file should also be type file " , is file ( fc target , new path ( target test root , " dir 3 / foo " ) ) ) ; / / recursive create file with missing dirs file context test helper create file ( fc view , " / internal dir / link to dir 2 / missing dir / miss 2 / foo " ) ; assert assert true ( " created file should be of type file " , is file ( fc view , new path ( " / internal dir / link to dir 2 / missing dir / miss 2 / foo " ) ) ) ; assert assert true ( " target of created file should also be type file " , is file ( fc target , new path ( target test root , " dir 2 / missing dir / miss 2 / foo " ) ) ) ; / / delete the created file assert assert true ( " delete should succeed " , fc view delete ( new path ( " / internal dir / internal dir 2 / link to dir 3 / foo " ) , false ) ) ; assert assert false ( " deleted file should not exist " , exists ( fc view , new path ( " / internal dir / internal dir 2 / link to dir 3 / foo " ) ) ) ; assert assert false ( " target of deleted file should not exist " , exists ( fc target , new path ( target test root , " dir 3 / foo " ) ) ) ; / / mkdir fc view mkdir ( file context test helper get test root path ( fc view , " / user / dir x " ) , file context default perm , false ) ; assert assert true ( " new dir should be type dir " , is dir ( fc view , new path ( " / user / dir x " ) ) ) ; assert assert true ( " target of new dir should be of type dir " , is dir ( fc target , new path ( target test root , " user / dir x " ) ) ) ; fc view mkdir ( file context test helper get test root path ( fc view , " / user / dir x / dir y " ) , file context default perm , false ) ; assert assert true ( " new dir should be type dir " , is dir ( fc view , new path ( " / user / dir x / dir y " ) ) ) ; assert assert true ( " target of new dir should be of type dir " , is dir ( fc target , new path ( target test root , " user / dir x / dir y " ) ) ) ; / / delete the created dir assert assert true ( " delete should succeed " , fc view delete ( new path ( " / user / dir x / dir y " ) , false ) ) ; assert assert false ( " deleted file should not exist " , exists ( fc view , new path ( " / user / dir x / dir y " ) ) ) ; assert assert false ( " deleted target should not exist " , exists ( fc target , new path ( target test root , " user / dir x / dir y " ) ) ) ; assert assert true ( " delete should succeed " , fc view delete ( new path ( " / user / dir x " ) , false ) ) ; assert assert false ( " deleted file should not exist " , exists ( fc view , new path ( " / user / dir x " ) ) ) ; assert assert false ( " deleted target should not exist " , exists ( fc target , new path ( target test root , " user / dir x " ) ) ) ; / / rename a file file context test helper create file ( fc view , " / user / foo " ) ; fc view rename ( new path ( " / user / foo " ) , new path ( " / user / foo bar " ) ) ; assert assert false ( " renamed src should not exist " , exists ( fc view , new path ( " / user / foo " ) ) ) ; assert assert false ( exists ( fc target , new path ( target test root , " user / foo " ) ) ) ; assert assert true ( is file ( fc view , file context test helper get test root path ( fc view , " / user / foo bar " ) ) ) ; assert assert true ( is file ( fc target , new path ( target test root , " user / foo bar " ) ) ) ; fc view mkdir ( new path ( " / user / dir foo " ) , file context default perm , false ) ; fc view rename ( new path ( " / user / dir foo " ) , new path ( " / user / dir foo bar " ) ) ; assert assert false ( " renamed src should not exist " , exists ( fc view , new path ( " / user / dir foo " ) ) ) ; assert assert false ( " renamed src should not exist in target " , exists ( fc target , new path ( target test root , " user / dir foo " ) ) ) ; assert assert true ( " renamed dest should exist as dir " , is dir ( fc view , file context test helper get test root path ( fc view , " / user / dir foo bar " ) ) ) ; assert assert true ( " renamed dest should exist as dir in target " , is dir ( fc target , new path ( target test root , " user / dir foo bar " ) ) ) ; / / make a directory under a directory that ' s mounted from the root of another fs fc view mkdir ( new path ( " / target root / dir foo " ) , file context default perm , false ) ; assert assert true ( exists ( fc view , new path ( " / target root / dir foo " ) ) ) ; boolean dir foo present = false ; remote iterator < file status > dir contents = fc view list status ( new path ( " / target root / " ) ) ; while ( dir contents has next ( ) ) { file status file status = dir contents next ( ) ; if ( file status get path ( ) get name ( ) equals ( " dir foo " ) ) { dir foo present = true ; } } assert assert true ( dir foo present ) ; remote iterator < located file status > dir located contents = fc view list located status ( new path ( " / target root / " ) ) ; dir foo present = false ; while ( dir located contents has next ( ) ) { file status file status = dir located contents next ( ) ; if ( file status get path ( ) get name ( ) equals ( " dir foo " ) ) { dir foo present = true ; } } assert assert true ( dir foo present ) ; }


apply this filter to the given handler function the given { @ linkplain handler function handler function } represents the next entity in the chain , and can be { @ linkplain handler function # handle ( server request ) invoked } in order to proceed to this entity , or not invoked to block the chain

r filter ( server request request , handler function < t > next ) throws exception ;


returns true if field corresponding to field i d is set ( has been assigned a value ) and false otherwise

public boolean is set ( fields field ) { if ( field = = null ) { throw new illegal argument exception ( ) ; } switch ( field ) { } throw new illegal state exception ( ) ; }


gets a pooled byte buffer from the current contents if the stream has already been closed , then an invalid stream exception is thrown

public memory pooled byte buffer to byte buffer ( ) { ensure valid ( ) ; return new memory pooled byte buffer ( m buf ref , m count ) ; }


found trusted certificates with the same dn + same public keys , but different certificates

private static certificate trust same public key ( list < x 5 0 9 certificate > issuer certs ) { return new certificate trust ( issuer certs , true , false ) ; }


open an input stream for the specified class the default implementation loads a standard class file through the parent class loader ' s { @ code get resource as stream } method

protected input stream open stream for class ( string name ) { string internal name = name replace ( ' ' , ' / ' ) + class file suffix ; return get parent ( ) get resource as stream ( internal name ) ; }


configures the comma - separated list of remote i pv 4 addresses which are allowed to connect to the driver server

public builder with whitelisted ips ( string whitelisted ips ) { this whitelisted ips = whitelisted ips ; return this ; }


return the access key and secret for s3 api use or indicated in the user info of the name uri param

public static s 3x login helper login get a w s access keys ( uri name , configuration conf ) throws i o exception { s 3x login helper reject secrets in u r is ( name ) ; configuration c = provider utils exclude incompatible credential providers ( conf , s 3 a file system class ) ; string bucket = name ! = null ? name get host ( ) : " " ; / / get the secrets from the configuration / / get the access key string access key = lookup password ( bucket , c , access key ) ; / / and the secret string secret key = lookup password ( bucket , c , secret key ) ; return new s 3x login helper login ( access key , secret key ) ; }


enforce memory limits at the query level

private void enforce memory limits ( ) { list < query execution > running queries = query tracker get all queries ( ) stream ( ) filter ( query - > query get state ( ) = = running ) collect ( to immutable list ( ) ) ; memory manager process ( running queries , this : : get queries ) ; }


public static boolean is signed ( int operand type ) { return ( operand type & signed ) ! = 0 ; }


post fakeinline - additional properties : test inline additional properties

default response entity < void > test inline additional properties ( @ api param ( value = " request body " , required = true ) @ valid @ request body map < string , string > param ) { return get delegate ( ) test inline additional properties ( param ) ; }


find the form value given a number value

public static d w a r f form find ( int key ) { d w a r f form access = value map get ( key ) ; if ( access ! = null ) { return access ; } throw new illegal argument exception ( " invalid integer value : " + key ) ; }


return a reference to the singleton node

protected node node ( ) { return node ; }


indicates whether it ' s time to retry to failed host or not

boolean shall be retried ( ) { return time supplier get ( ) - dead until nanos > 0 ; }


called by the bundles when a snapshot changes

private void on playlist updated ( uri url , hls media playlist new snapshot ) { if ( url equals ( primary media playlist url ) ) { if ( primary media playlist snapshot = = null ) { / / this is the first primary url snapshot is live = ! new snapshot has end tag ; initial start time us = new snapshot start time us ; } primary media playlist snapshot = new snapshot ; primary playlist listener on primary playlist refreshed ( new snapshot ) ; } int listeners size = listeners size ( ) ; for ( int i = 0 ; i < listeners size ; i + + ) { listeners get ( i ) on playlist changed ( ) ; } }


public void set ( int n , dalv insn insn ) { set 0 ( n , insn ) ; }


returns the bytes and masking merged together , as a binary string

public string to binary string ( ) { string builder value string = new string builder ( ) ; string builder mask string = new string builder ( ) ; for ( int i = 0 ; i < value length ; i + + ) { value string append ( instruction search utils to binary string ( value [ i ] ) ) ; } for ( int i = 0 ; i < mask length ; i + + ) { mask string append ( instruction search utils to binary string ( mask [ i ] ) ) ; } string combined string = " " ; try { combined string = instruction search utils format search string ( value string to string ( ) , mask string to string ( ) ) ; } catch ( invalid input exception e ) { e print stack trace ( ) ; } return combined string ; }


public string get string ( ) { return this message ; }


convert the given object to string with each line indented by 4 spaces ( except the first line )

private string to indented string ( object o ) { if ( o = = null ) { return " null " ; } return o to string ( ) replace ( " \ n " , " \ n " ) ; }


returns a new { @ link byte array data output } instance sized to hold { @ code size } bytes before resizing

public static byte array data output new data output ( int size ) { / / when called at high frequency , boxing size generates too much garbage , / / so avoid doing that if we can if ( size < 0 ) { throw new illegal argument exception ( string format ( " invalid size : % s " , size ) ) ; } return new data output ( new byte array output stream ( size ) ) ; }


advances the iterator should only be called if { @ link # is valid ( ) } returned true valid flag can only change after calling { @ link # next ( ) }

public void next ( ) { new key group = false ; new k v state = false ; final rocks iterator wrapper rocks iterator = current sub iterator get iterator ( ) ; rocks iterator next ( ) ; byte [ ] old key = current sub iterator get current key ( ) ; if ( rocks iterator is valid ( ) ) { current sub iterator set current key ( rocks iterator key ( ) ) ; if ( is different key group ( old key , current sub iterator get current key ( ) ) ) { heap offer ( current sub iterator ) ; current sub iterator = heap remove ( ) ; new k v state = current sub iterator get iterator ( ) ! = rocks iterator ; detect new key group ( old key ) ; } } else { i o utils close quietly ( rocks iterator ) ; if ( heap is empty ( ) ) { current sub iterator = null ; valid = false ; } else { current sub iterator = heap remove ( ) ; new k v state = true ; detect new key group ( old key ) ; } } }


schedule blocks for deletion at datanodes

int compute invalidate work ( int nodes to process ) { final list < datanode info > nodes = invalidate blocks get datanodes ( ) ; collections shuffle ( nodes ) ; nodes to process = math min ( nodes size ( ) , nodes to process ) ; int block cnt = 0 ; for ( datanode info dn info : nodes ) { int blocks = invalidate work for one node ( dn info ) ; if ( blocks > 0 ) { block cnt + = blocks ; if ( - - nodes to process = = 0 ) { break ; } } } return block cnt ; }


creates a new big - endian buffer whose content is a subregion of the specified { @ code array } encoded in the specified { @ code charset } the new buffer ' s { @ code reader index } and { @ code writer index } are { @ code 0 } and the length of the encoded string respectively

public static byte buf copied buffer ( char [ ] array , int offset , int length , charset charset ) { object util check not null ( array , " array " ) ; if ( length = = 0 ) { return empty buffer ; } return copied buffer ( char buffer wrap ( array , offset , length ) , charset ) ; }


call this to request a model update the controller will schedule a call to { @ link # build models ( ) } so that models can be rebuilt for the current data once a build is requested all subsequent requests are ignored until the model build runs therefore , the calling code need not worry about calling this multiple times in a row the exception is that the first time this is called on a new instance of { @ link epoxy controller } it is run synchronously this allows state to be restored and the initial view to be draw quicker if you would like to be alerted when models have finished building use { @ link # add model build listener ( on model build finished listener ) }

public void request model build ( ) { if ( is building models ( ) ) { throw new illegal epoxy usage ( " cannot call ` request model build ` from inside ` build models ` " ) ; } / / if it is the first time building models then we do it right away , otherwise we post the call / / we want to do it right away the first time so that scroll position can be restored correctly , / / shared element transitions aren ' t delayed , and content is shown asap we post later calls / / so that they are debounced , and so any updates to data can be completely finished before / / the models are built if ( has built models ever ) { request delayed model build ( 0 ) ; } else { build models runnable run ( ) ; } }


returns the string contained in the specified { @ link mem buffer } , or null if all the bytes of the string could not be read this method deals in characters of size { @ link # char size } , that might be { @ link # padded char size padded } to a larger size the raw n - byte characters are converted into a java string using a java { @ link charset } or by using a custom ghidra conversion ( see convert bytes to string custom charset ) the mem buffer ' s endian ' ness is used to determine which end of the { @ link # padded char size padded } field contains our { @ link # char size } character bytes which will be used to create the java string

public string get string value ( ) { string str = get string value no trim ( ) ; return ( str ! = null ) & & string layout should trim trailing nulls ( ) ? trim nulls ( str ) : str ; }


a volatile load ( load + load load barrier ) of an element from a given offset

public static < e > e lv element ( e [ ] buffer , long offset ) { return ( e ) unsafe get object volatile ( buffer , offset ) ; }


get the content of the request body as a byte array

public byte [ ] get content as byte array ( ) { return this content ; }


execute a batch insert using the batch of values passed in

int [ ] execute batch ( sql parameter source batch ) ;


records the given exception using { @ link # thread record failure } , then rethrows the exception , wrapping it in an assertion failed error if necessary

public void thread unexpected exception ( throwable t ) { thread record failure ( t ) ; t print stack trace ( ) ; if ( t instanceof runtime exception ) { throw ( runtime exception ) t ; } else if ( t instanceof error ) { throw ( error ) t ; } else { assertion failed error afe = new assertion failed error ( " unexpected exception : " + t ) ; afe init cause ( t ) ; throw afe ; } }


@ serial data expected values per key , number of distinct keys , and then for each distinct key : the key , number of values for that key , and the key ' s values

private void write object ( object output stream stream ) throws i o exception { stream default write object ( ) ; serialization write multimap ( this , stream ) ; }


returns true if field name is set ( has been assigned a value ) and false otherwise

public boolean is set name ( ) { return this name ! = null ; }


checks if the given session has watches set

public boolean has paths ( long session id ) { return id 2paths contains key ( session id ) ; }


save config file and update md 5 value in cache

public static boolean dump ( string data id , string group , string tenant , string content , long last modified ts , string type ) { string group key = group key 2 get key ( data id , group , tenant ) ; cache item ci = make sure ( group key ) ; ci set type ( type ) ; final int lock result = try write lock ( group key ) ; assert ( lock result ! = 0 ) ; if ( lock result < 0 ) { dump log warn ( " [ dump - error ] write lock failed { } " , group key ) ; return false ; } try { final string md 5 = m d 5 utils md 5 hex ( content , constants encode ) ; if ( md 5 equals ( config cache service get content md 5 ( group key ) ) ) { dump log warn ( " [ dump - ignore ] ignore to save cache file group key = { } , md 5 = { } , last modified old = { } , " + " last modified new = { } " , group key , md 5 , config cache service get last modified ts ( group key ) , last modified ts ) ; } else if ( ! property util is direct read ( ) ) { disk util save to disk ( data id , group , tenant , content ) ; } update md 5 ( group key , md 5 , last modified ts ) ; return true ; } catch ( i o exception ioe ) { dump log error ( " [ dump - exception ] save disk error " + group key + " , " + ioe to string ( ) , ioe ) ; if ( ioe get message ( ) ! = null ) { string err msg = ioe get message ( ) ; if ( no space cn equals ( err msg ) | | no space en equals ( err msg ) | | err msg contains ( disk quata cn ) | | err msg contains ( disk quata en ) ) { / / protect from disk full fatal log error ( " " , ioe ) ; system exit ( 0 ) ; } } return false ; } finally { release write lock ( group key ) ; } }


select the content - type header ' s value from the given array : if json exists in the given array , use it ; otherwise use the first one of the array

public media type select header content type ( string [ ] content types ) { if ( content types length = = 0 ) { return media type application json ; } for ( string content type : content types ) { media type media type = media type parse media type ( content type ) ; if ( is json mime ( media type ) ) { return media type ; } } return media type parse media type ( content types [ 0 ] ) ; }


return the ssh private key corresponding to the specified key file if the specified key file is encrypted the currently installed password provider will be used to obtain the decrypt password

public static object get s s h private key ( file ssh private key file ) throws i o exception { if ( ! ssh private key file is file ( ) ) { throw new file not found exception ( " ssh private key file not found : " + ssh private key file ) ; } input stream key in = new file input stream ( ssh private key file ) ; try { return get s s h private key ( key in , ssh private key file get absolute path ( ) ) ; } finally { try { key in close ( ) ; } catch ( i o exception e ) { } } }


the sink node making the request < code > istio mcp v 1alpha 1 sink node sink node = 1 ; < code >

public builder clear sink node ( ) { if ( sink node builder = = null ) { sink node = null ; on changed ( ) ; } else { sink node = null ; sink node builder = null ; } return this ; }


public void namespace string test ( ) { / / todo : test namespace string }


public string get z k acl ( ) { return configs map get ( zk acl ) ; }


gets the estimates number of records in the file , computed as the file size divided by the average record width , rounded up

public long get number of records ( ) { return ( this file size = = size unknown | | this avg bytes per record = = avg record bytes unknown ) ? num records unknown : ( long ) math ceil ( this file size / this avg bytes per record ) ; }


run the job the default way ( the input format key is not emitted )

public void test command line without key ( ) throws exception { run stream job ( output without key , true ) ; }


returns a predicate that evaluates to { @ code true } if the given predicate evaluates to { @ code false }

public static < t > predicate < t > not ( predicate < t > predicate ) { return new not predicate < t > ( predicate ) ; }


return this vector multiplied by a scalar ; does not alter this vector

public final vec 2 mul ( float a ) { return new vec 2 ( x * a , y * a ) ; }


resolves the given class name into a { @ link type element } the class name is a binary name , but { @ link elements # get type element ( char sequence ) } wants a canonical name so this method searches the space of possible canonical names , starting with the most likely ( since ' $ ' is rarely used in canonical class names )

@ visible for testing static type element resolve type ( elements elements , string class name ) { int index = next dollar ( class name , class name , 0 ) ; if ( index = = - 1 ) { return get type element ( elements , class name ) ; } / / have to test various possibilities of replacing ' $ ' with ' ' since ' ' in a canonical name / / of a nested type is replaced with ' $ ' in the binary name string builder sb = new string builder ( class name ) ; return resolve type ( elements , class name , sb , index ) ; }


tells whether the function was compiled with e ha

public boolean is compiled with async exception handling ( ) { return compiled with async exception handling ; }


public long elapsed time ( ) { return now ( ) - start time ; }


this method is called for each element in the second of the connected streams this function can output zero or more elements using the { @ link collector } parameter and also update internal state or set timers using the { @ link context } parameter

public abstract void process element 2 ( in2 value , context ctx , collector < out > out ) throws exception ;


utility to create a { @ link container status } during exceptional circumstances

public static container status create abnormal container status ( container id container id , string diagnostics ) { return create abnormal container status ( container id , container exit status aborted , diagnostics ) ; }


check that the manager skips over indices that don ' t exist yet , since system indices are created on - demand

public void test manager skips descriptors for indices that do not exist ( ) { system index descriptor d 1 = system index descriptor builder ( ) set index pattern ( " foo - * " ) set primary index ( " foo - 1 " ) set mappings ( get mappings ( ) ) set settings ( get settings ( ) ) set version meta key ( " version " ) set origin ( " fake origin " ) build ( ) ; system index descriptor d 2 = system index descriptor builder ( ) set index pattern ( " bar - * " ) set primary index ( " bar - 1 " ) set mappings ( get mappings ( ) ) set settings ( get settings ( ) ) set version meta key ( " version " ) set origin ( " fake origin " ) build ( ) ; system indices system indices = new system indices ( map of ( " index 1 " , list of ( d 1 ) , " index 2 " , list of ( d 2 ) ) ) ; system index manager manager = new system index manager ( system indices , client ) ; final list < system index descriptor > eligible descriptors = manager get eligible descriptors ( metadata builder ( ) put ( get index metadata ( d 2 , d 2 get mappings ( ) , 6 , index metadata state open ) ) build ( ) ) ; assert that ( eligible descriptors , has size ( 1 ) ) ; assert that ( eligible descriptors , contains ( d 2 ) ) ; }


creates one file , writes a few bytes to it and then closed it reopens the same file for appending using append 2 api , write all blocks and then close verify that all data exists in file

public void test simple append 2 ( ) throws exception { final configuration conf = new hdfs configuration ( ) ; conf set int ( d f s config keys dfs datanode handler count key , 50 ) ; file contents = append test util init buffer ( append test util file size ) ; mini d f s cluster cluster = new mini d f s cluster builder ( conf ) build ( ) ; distributed file system fs = cluster get file system ( ) ; try { { / / test appending to a file / / create a new file path file 1 = new path ( " / simple append dat " ) ; f s data output stream stm = append test util create file ( fs , file 1 , 1 ) ; system out println ( " created file simple append dat " ) ; / / write to file int mid = 186 ; / / io bytes per checksum bytes system out println ( " writing " + mid + " bytes to file " + file 1 ) ; stm write ( file contents , 0 , mid ) ; stm close ( ) ; system out println ( " wrote and closed first part of file " ) ; / / write to file int mid 2 = 607 ; / / io bytes per checksum bytes system out println ( " writing " + mid + " bytes to file " + file 1 ) ; stm = fs append ( file 1 , enum set of ( create flag append , create flag new block ) , 4096 , null ) ; stm write ( file contents , mid , mid 2 - mid ) ; stm close ( ) ; system out println ( " wrote and closed second part of file " ) ; / / write the remainder of the file stm = fs append ( file 1 , enum set of ( create flag append , create flag new block ) , 4096 , null ) ; / / ensure get pos is set to reflect existing size of the file assert true ( stm get pos ( ) > 0 ) ; system out println ( " writing " + ( append test util file size - mid 2 ) + " bytes to file " + file 1 ) ; stm write ( file contents , mid 2 , append test util file size - mid 2 ) ; system out println ( " written second part of file " ) ; stm close ( ) ; system out println ( " wrote and closed second part of file " ) ; / / verify that entire file is good append test util check full file ( fs , file 1 , append test util file size , file contents , " read 2 " ) ; / / also make sure there three different blocks for the file list < located block > blocks = fs get client ( ) get located blocks ( file 1 to string ( ) , 0l ) get located blocks ( ) ; assert equals ( 12 , blocks size ( ) ) ; / / the block size is 1024 assert equals ( mid , blocks get ( 0 ) get block size ( ) ) ; assert equals ( mid 2 - mid , blocks get ( 1 ) get block size ( ) ) ; for ( int i = 2 ; i < 11 ; i + + ) { assert equals ( append test util block size , blocks get ( i ) get block size ( ) ) ; } assert equals ( ( append test util file size - mid 2 ) % append test util block size , blocks get ( 11 ) get block size ( ) ) ; } { / / test appending to an non - existing file f s data output stream out = null ; try { out = fs append ( new path ( " / non - existing dat " ) , enum set of ( create flag append , create flag new block ) , 4096 , null ) ; fail ( " expected to have file not found exception " ) ; } catch ( java io file not found exception fnfe ) { system out println ( " good : got " + fnfe ) ; fnfe print stack trace ( system out ) ; } finally { i o utils close stream ( out ) ; } } { / / test append permission / / set root to all writable path root = new path ( " / " ) ; fs set permission ( root , new fs permission ( ( short ) 0777 ) ) ; fs close ( ) ; / / login as a different user final user group information superuser = user group information get current user ( ) ; string username = " testappenduser " ; string group = " testappendgroup " ; assert false ( superuser get short user name ( ) equals ( username ) ) ; assert false ( arrays as list ( superuser get group names ( ) ) contains ( group ) ) ; user group information appenduser = user group information create user for testing ( username , new string [ ] { group } ) ; fs = ( distributed file system ) d f s test util get file system as ( appenduser , conf ) ; / / create a file path dir = new path ( root , get class ( ) get simple name ( ) ) ; path foo = new path ( dir , " foo dat " ) ; f s data output stream out = null ; int offset = 0 ; try { out = fs create ( foo ) ; int len = 10 + append test util next int ( 100 ) ; out write ( file contents , offset , len ) ; offset + = len ; } finally { i o utils close stream ( out ) ; } / / change dir and foo to minimal permissions fs set permission ( dir , new fs permission ( ( short ) 0100 ) ) ; fs set permission ( foo , new fs permission ( ( short ) 0200 ) ) ; / / try append , should success out = null ; try { out = fs append ( foo , enum set of ( create flag append , create flag new block ) , 4096 , null ) ; int len = 10 + append test util next int ( 100 ) ; out write ( file contents , offset , len ) ; offset + = len ; } finally { i o utils close stream ( out ) ; } / / change dir and foo to all but no write on foo fs set permission ( foo , new fs permission ( ( short ) 0577 ) ) ; fs set permission ( dir , new fs permission ( ( short ) 0777 ) ) ; / / try append , should fail out = null ; try { out = fs append ( foo , enum set of ( create flag append , create flag new block ) , 4096 , null ) ; fail ( " expected to have access control exception " ) ; } catch ( access control exception ace ) { system out println ( " good : got " + ace ) ; ace print stack trace ( system out ) ; } finally { i o utils close stream ( out ) ; } } } finally { fs close ( ) ; cluster shutdown ( ) ; } }


this tests template role mappings ( see { @ link template role name } ) with an ldap realm , using a additional metadata field ( see { @ link ldap metadata resolver settings # additional metadata setting } )

public void test ldap realm with templated role mapping ( ) throws exception { string group search base = " o = seven seas " ; string user template = valid user template ; settings settings = settings builder ( ) put ( default global settings ) put ( build ldap settings ( ldap urls ( ) , user template , group search base , ldap search scope sub tree ) ) put ( get full setting key ( realm identifier get name ( ) , ldap metadata resolver settings additional metadata setting apply ( ldap realm settings ldap type ) ) , " uid " ) build ( ) ; realm config config = get realm config ( realm identifier , settings ) ; security index manager mock security index = mock ( security index manager class ) ; when ( mock security index is available ( ) ) then return ( true ) ; when ( mock security index is index up to date ( ) ) then return ( true ) ; when ( mock security index is mapping up to date ( ) ) then return ( true ) ; client mock client = mock ( client class ) ; when ( mock client thread pool ( ) ) then return ( thread pool ) ; final script service script service = new script service ( default global settings , collections singleton map ( mustache script engine name , new mustache script engine ( ) ) , script module core contexts ) ; native role mapping store role mapper = new native role mapping store ( default global settings , mock client , mock security index , script service ) { @ override protected void load mappings ( action listener < list < expression role mapping > > listener ) { listener on response ( arrays as list ( this build mapping ( " m 1 " , new bytes array ( " { " + " \ " role templates \ " : [ { \ " template \ " : { \ " source \ " : \ " user { { metadata uid } } \ " } } ] , " + " \ " enabled \ " : true , " + " \ " rules \ " : { \ " any \ " : [ " + " { \ " field \ " : { \ " realm name \ " : \ " ldap 1 \ " } } , " + " { \ " field \ " : { \ " realm name \ " : \ " ldap 2 \ " } } " + " ] } } " ) ) , this build mapping ( " m 2 " , new bytes array ( " { " + " \ " roles \ " : [ \ " should not happen \ " ] , " + " \ " enabled \ " : true , " + " \ " rules \ " : { \ " all \ " : [ " + " { \ " field \ " : { \ " realm name \ " : \ " ldap 1 \ " } } , " + " { \ " field \ " : { \ " realm name \ " : \ " ldap 2 \ " } } " + " ] } } " ) ) , this build mapping ( " m 3 " , new bytes array ( " { " + " \ " roles \ " : [ \ " sales admin \ " ] , " + " \ " enabled \ " : true , " + " \ " rules \ " : " + " { \ " field \ " : { \ " dn \ " : \ " * , ou = people , o = seven seas \ " } } " + " } " ) ) ) ) ; } } ; ldap session factory ldap factory = new ldap session factory ( config , ssl service , thread pool ) ; ldap realm ldap = new ldap realm ( config , ldap factory , role mapper , thread pool ) ; ldap initialize ( collections singleton ( ldap ) , license state ) ; plain action future < authentication result > future = new plain action future < > ( ) ; ldap authenticate ( new username password token ( " horatio hornblower " , new secure string ( password ) ) , future ) ; final authentication result result = future action get ( ) ; assert that ( result get status ( ) , is ( authentication result status success ) ) ; user user = result get user ( ) ; assert that ( user , not null value ( ) ) ; assert that ( user roles ( ) , array containing in any order ( " user hhornblo " , " sales admin " ) ) ; }