signature:
public class StageLibraryDelegateCreator { /** * Create new instance of the delegator from given stage library .
 * @ param stageLib Stage library task instance .
 * @ param stageLibraryName Name of the stage library from which the delegator should be loaded .
 * @ param exportedInterface Interface describing which delegator is needed
 * @ return New instance of the delegator or null on any issue */
public StageLibraryDelegate create ( StageLibraryTask stageLib , String stageLibraryName , Class exportedInterface ) { } }

implementation: StageLibraryDelegateDefinitition def = stageLib . getStageLibraryDelegateDefinition ( stageLibraryName , exportedInterface ) ; if ( def == null ) { return null ; } return createInstance ( def ) ;


signature:
public class StageLibraryDelegateCreator { /** * Create actual instance of delegator .
 * @ param def Delegator definition
 * @ return New instance or null on any issue */
private StageLibraryDelegate createInstance ( StageLibraryDelegateDefinitition def ) { } }

implementation: StageLibraryDelegate instance = null ; ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( def . getClassLoader ( ) ) ; instance = def . getKlass ( ) . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException ex ) { LOG . error ( "Can't create instance of delegator: " + ex . toString ( ) , ex ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( classLoader ) ; } return instance ;


signature:
public class SdcKrb5HttpClientConfigurer { /** * private static final Configuration jaasConfig = new org . apache . solr . client . solrj . impl . Krb5HttpClientConfigurer . SolrJaasConfiguration ( ) ; */
public void configure ( DefaultHttpClient httpClient , SolrParams config ) { } }

implementation:
super . configure ( httpClient , config ) ; // Begin change for SDC - 2962
// Instead of checking existence of JAAS file , do the following if solr kerberos is enabled
// if ( System . getProperty ( LOGIN _ CONFIG _ PROP ) ! = null ) {
// String configValue = System . getProperty ( LOGIN _ CONFIG _ PROP ) ;
// if ( configValue ! = null ) {
// logger . info ( " Setting up SPNego auth with config : " + configValue ) ;
final String useSubjectCredsProp = "javax.security.auth.useSubjectCredsOnly" ; String useSubjectCredsVal = System . getProperty ( useSubjectCredsProp ) ; // " javax . security . auth . useSubjectCredsOnly " should be false so that the underlying
// authentication mechanism can load the credentials from the JAAS configuration .
if ( useSubjectCredsVal == null ) { System . setProperty ( useSubjectCredsProp , "false" ) ; } else if ( ! useSubjectCredsVal . toLowerCase ( Locale . ROOT ) . equals ( "false" ) ) { // Don ' t overwrite the prop value if it ' s already been written to something else ,
// but log because it is likely the Credentials won ' t be loaded correctly .
logger . warn ( "System Property: " + useSubjectCredsProp + " set to: " + useSubjectCredsVal + " not false.  SPNego authentication may not be successful." ) ; } // Change for SDC - 2962
// javax . security . auth . login . Configuration . setConfiguration ( jaasConfig ) ;
// Enable only SPNEGO authentication scheme .
AuthSchemeRegistry registry = new AuthSchemeRegistry ( ) ; registry . register ( AuthSchemes . SPNEGO , new SPNegoSchemeFactory ( true , false ) ) ; httpClient . setAuthSchemes ( registry ) ; // Get the credentials from the JAAS configuration rather than here
Credentials useJaasCreds = new Credentials ( ) { public String getPassword ( ) { return null ; } public Principal getUserPrincipal ( ) { return null ; } } ; SolrPortAwareCookieSpecFactory cookieFactory = new SolrPortAwareCookieSpecFactory ( ) ; httpClient . getCookieSpecs ( ) . register ( cookieFactory . POLICY_NAME , cookieFactory ) ; httpClient . getParams ( ) . setParameter ( ClientPNames . COOKIE_POLICY , cookieFactory . POLICY_NAME ) ; httpClient . getCredentialsProvider ( ) . setCredentials ( AuthScope . ANY , useJaasCreds ) ; httpClient . addRequestInterceptor ( bufferedEntityInterceptor ) ; // } else {
// httpClient . getCredentialsProvider ( ) . clear ( ) ;


signature:
public class AuthRenewalTask { /** * Scheduler is not used since a dedicated thread will be running to update the token . Even if the
 * thycotic server is not being used , the thread will hit for every refresh interval to get a new
 * access token . So instead < tt > volatile < / tt > variables are used to store the token . So only when
 * the token expires , thycotic server will be called to fetch the new token .
 * There are 2 expire checks to make sure that not more than one thread updates the token in case
 * of expiration */
public String getAccessToken ( ) { } }

implementation: if ( System . currentTimeMillis ( ) > getExpireTime ( ) ) { try { synchronized ( this ) { if ( System . currentTimeMillis ( ) > getExpireTime ( ) ) { accessToken = fetchAccessToken ( ) ; if ( accessToken != null && ! accessToken . isEmpty ( ) ) { expires = ( System . currentTimeMillis ( ) + expires ) ; } } } } catch ( Exception e ) { LOG . debug ( "Error in fetching the access token: {} " , e ) ; } } return accessToken ;


signature:
public class MetricRuleEvaluatorHelper { /** * Get metric value for given rule evaluation .
 * @ param metrics Metric Registry for the pipeline .
 * @ param metricId Name of the metric where the value is " usually " stored . This method cover mappings of metrics
 * that got historically moved .
 * @ param metricType Type of the metric
 * @ param metricElement Value that caller needs in order to assert the right condition .
 * @ return Requested metric value or null if it doesn ' t exists
 * @ throws ObserverException */
public static Object getMetricValue ( MetricRegistry metrics , String metricId , MetricType metricType , MetricElement metricElement ) throws ObserverException { } }

implementation:
// We moved the logic of CURRENT _ BATCH _ AGE and TIME _ IN _ CURRENT _ STAGE due to multi - threaded framework
if ( metricElement . isOneOf ( MetricElement . CURRENT_BATCH_AGE , MetricElement . TIME_IN_CURRENT_STAGE ) ) { switch ( metricElement ) { case CURRENT_BATCH_AGE : return getTimeFromRunner ( metrics , PipeRunner . METRIC_BATCH_START_TIME ) ; case TIME_IN_CURRENT_STAGE : return getTimeFromRunner ( metrics , PipeRunner . METRIC_STAGE_START_TIME ) ; default : throw new IllegalStateException ( Utils . format ( "Unknown metric type '{}'" , metricType ) ) ; } } // Default path
Metric metric = getMetric ( metrics , metricId , metricType ) ; if ( metric != null ) { return getMetricValue ( metricElement , metricType , metric ) ; } return null ;


signature:
public class MetricRuleEvaluatorHelper { /** * Return calculated metric - from all the runners that are available for given pipeline , return the biggest difference
 * between given metric and System . currentTimeMillis ( ) . The semantic is that the runner metric stores start time of
 * certain events ( batch start time , stage start time ) and we need to find out what is the longer running time for one
 * of those metrics .
 * @ param metrics Metric registry for given pipeline .
 * @ param runnerMetricName Name of the PipeRunner metric that contains start time of given action .
 * @ return */
private static long getTimeFromRunner ( MetricRegistry metrics , String runnerMetricName ) { } }

implementation:
// First get number of total runners from the runtime gauge
RuntimeStats runtimeStats = ( RuntimeStats ) ( ( Gauge ) getMetric ( metrics , "RuntimeStatsGauge.gauge" , MetricType . GAUGE ) ) . getValue ( ) ; long totalRunners = runtimeStats . getTotalRunners ( ) ; long currentTime = System . currentTimeMillis ( ) ; long maxTime = 0 ; // Then iterate over all runners and find the biggest time difference
for ( int runnerId = 0 ; runnerId < totalRunners ; runnerId ++ ) { Map < String , Object > runnerMetrics = ( Map < String , Object > ) ( ( Gauge ) getMetric ( metrics , "runner." + runnerId , MetricType . GAUGE ) ) . getValue ( ) ; // Get current value
long value = ( long ) runnerMetrics . getOrDefault ( runnerMetricName , 0L ) ; // Zero means that the runner is not in use at all and thus calculating running time makes no sense
if ( value == 0 ) { continue ; } long runTime = currentTime - value ; if ( maxTime < runTime ) { maxTime = runTime ; } } return maxTime ;


signature:
public class SimpleWebServer { /** * Starts as a standalone file server and waits for Enter . */
public static void main ( String [ ] args ) { } }

implementation:
// Defaults
int port = 8080 ; String host = null ; // bind to all interfaces by default
List < File > rootDirs = new ArrayList < File > ( ) ; boolean quiet = false ; String cors = null ; Map < String , String > options = new HashMap < String , String > ( ) ; // Parse command - line , with short and long versions of the options .
for ( int i = 0 ; i < args . length ; ++ i ) { if ( "-h" . equalsIgnoreCase ( args [ i ] ) || "--host" . equalsIgnoreCase ( args [ i ] ) ) { host = args [ i + 1 ] ; } else if ( "-p" . equalsIgnoreCase ( args [ i ] ) || "--port" . equalsIgnoreCase ( args [ i ] ) ) { port = Integer . parseInt ( args [ i + 1 ] ) ; } else if ( "-q" . equalsIgnoreCase ( args [ i ] ) || "--quiet" . equalsIgnoreCase ( args [ i ] ) ) { quiet = true ; } else if ( "-d" . equalsIgnoreCase ( args [ i ] ) || "--dir" . equalsIgnoreCase ( args [ i ] ) ) { rootDirs . add ( new File ( args [ i + 1 ] ) . getAbsoluteFile ( ) ) ; } else if ( args [ i ] . startsWith ( "--cors" ) ) { cors = "*" ; int equalIdx = args [ i ] . indexOf ( '=' ) ; if ( equalIdx > 0 ) { cors = args [ i ] . substring ( equalIdx + 1 ) ; } } else if ( "--licence" . equalsIgnoreCase ( args [ i ] ) ) { System . out . println ( SimpleWebServer . LICENCE + "\n" ) ; } else if ( args [ i ] . startsWith ( "-X:" ) ) { int dot = args [ i ] . indexOf ( '=' ) ; if ( dot > 0 ) { String name = args [ i ] . substring ( 0 , dot ) ; String value = args [ i ] . substring ( dot + 1 , args [ i ] . length ( ) ) ; options . put ( name , value ) ; } } } if ( rootDirs . isEmpty ( ) ) { rootDirs . add ( new File ( "." ) . getAbsoluteFile ( ) ) ; } options . put ( "host" , host ) ; options . put ( "port" , "" + port ) ; options . put ( "quiet" , String . valueOf ( quiet ) ) ; StringBuilder sb = new StringBuilder ( ) ; for ( File dir : rootDirs ) { if ( sb . length ( ) > 0 ) { sb . append ( ":" ) ; } try { sb . append ( dir . getCanonicalPath ( ) ) ; } catch ( IOException ignored ) { } } options . put ( "home" , sb . toString ( ) ) ; ServiceLoader < WebServerPluginInfo > serviceLoader = ServiceLoader . load ( WebServerPluginInfo . class ) ; for ( WebServerPluginInfo info : serviceLoader ) { String [ ] mimeTypes = info . getMimeTypes ( ) ; for ( String mime : mimeTypes ) { String [ ] indexFiles = info . getIndexFilesForMimeType ( mime ) ; if ( ! quiet ) { System . out . print ( "# Found plugin for Mime type: \"" + mime + "\"" ) ; if ( indexFiles != null ) { System . out . print ( " (serving index files: " ) ; for ( String indexFile : indexFiles ) { System . out . print ( indexFile + " " ) ; } } System . out . println ( ")." ) ; } registerPluginForMimeType ( indexFiles , mime , info . getWebServerPlugin ( mime ) , options ) ; } } ServerRunner . executeInstance ( new SimpleWebServer ( host , port , rootDirs , quiet , cors ) ) ;


signature:
public class SimpleWebServer { /** * Serves file from homeDir and its ' subdirectories ( only ) . Uses only URI ,
 * ignores all headers and HTTP parameters . */
Response serveFile ( String uri , Map < String , String > header , File file , String mime ) { } }

implementation:
Response res ; try { // Calculate etag
String etag = Integer . toHexString ( ( file . getAbsolutePath ( ) + file . lastModified ( ) + "" + file . length ( ) ) . hashCode ( ) ) ; // Support ( simple ) skipping :
long startFrom = 0 ; long endAt = - 1 ; String range = header . get ( "range" ) ; if ( range != null ) { if ( range . startsWith ( "bytes=" ) ) { range = range . substring ( "bytes=" . length ( ) ) ; int minus = range . indexOf ( '-' ) ; try { if ( minus > 0 ) { startFrom = Long . parseLong ( range . substring ( 0 , minus ) ) ; endAt = Long . parseLong ( range . substring ( minus + 1 ) ) ; } } catch ( NumberFormatException ignored ) { } } } // get if - range header . If present , it must match etag or else we
// should ignore the range request
String ifRange = header . get ( "if-range" ) ; boolean headerIfRangeMissingOrMatching = ( ifRange == null || etag . equals ( ifRange ) ) ; String ifNoneMatch = header . get ( "if-none-match" ) ; boolean headerIfNoneMatchPresentAndMatching = ifNoneMatch != null && ( "*" . equals ( ifNoneMatch ) || ifNoneMatch . equals ( etag ) ) ; // Change return code and add Content - Range header when skipping is
// requested
long fileLen = file . length ( ) ; if ( headerIfRangeMissingOrMatching && range != null && startFrom >= 0 && startFrom < fileLen ) { // range request that matches current etag
// and the startFrom of the range is satisfiable
if ( headerIfNoneMatchPresentAndMatching ) { // range request that matches current etag
// and the startFrom of the range is satisfiable
// would return range from file
// respond with not - modified
res = newFixedLengthResponse ( Status . NOT_MODIFIED , mime , "" ) ; res . addHeader ( "ETag" , etag ) ; } else { if ( endAt < 0 ) { endAt = fileLen - 1 ; } long newLen = endAt - startFrom + 1 ; if ( newLen < 0 ) { newLen = 0 ; } FileInputStream fis = new FileInputStream ( file ) ; fis . skip ( startFrom ) ; res = Response . newFixedLengthResponse ( Status . PARTIAL_CONTENT , mime , fis , newLen ) ; res . addHeader ( "Accept-Ranges" , "bytes" ) ; res . addHeader ( "Content-Length" , "" + newLen ) ; res . addHeader ( "Content-Range" , "bytes " + startFrom + "-" + endAt + "/" + fileLen ) ; res . addHeader ( "ETag" , etag ) ; } } else { if ( headerIfRangeMissingOrMatching && range != null && startFrom >= fileLen ) { // return the size of the file
// 4xx responses are not trumped by if - none - match
res = newFixedLengthResponse ( Status . RANGE_NOT_SATISFIABLE , NanoHTTPD . MIME_PLAINTEXT , "" ) ; res . addHeader ( "Content-Range" , "bytes */" + fileLen ) ; res . addHeader ( "ETag" , etag ) ; } else if ( range == null && headerIfNoneMatchPresentAndMatching ) { // full - file - fetch request
// would return entire file
// respond with not - modified
res = newFixedLengthResponse ( Status . NOT_MODIFIED , mime , "" ) ; res . addHeader ( "ETag" , etag ) ; } else if ( ! headerIfRangeMissingOrMatching && headerIfNoneMatchPresentAndMatching ) { // range request that doesn ' t match current etag
// would return entire ( different ) file
// respond with not - modified
res = newFixedLengthResponse ( Status . NOT_MODIFIED , mime , "" ) ; res . addHeader ( "ETag" , etag ) ; } else { // supply the file
res = newFixedFileResponse ( file , mime ) ; res . addHeader ( "Content-Length" , "" + fileLen ) ; res . addHeader ( "ETag" , etag ) ; } } } catch ( IOException ioe ) { res = getForbiddenResponse ( "Reading file failed." ) ; } return res ;


signature:
public class HTTPSession { /** * Decodes the sent headers and loads the data into Key / value pairs */
private void decodeHeader ( BufferedReader in , Map < String , String > pre , Map < String , List < String > > parms , Map < String , String > headers ) throws ResponseException { } }

implementation:
try { // Read the request line
String inLine = in . readLine ( ) ; if ( inLine == null ) { return ; } StringTokenizer st = new StringTokenizer ( inLine ) ; if ( ! st . hasMoreTokens ( ) ) { throw new ResponseException ( Status . BAD_REQUEST , "BAD REQUEST: Syntax error. Usage: GET /example/file.html" ) ; } pre . put ( "method" , st . nextToken ( ) ) ; if ( ! st . hasMoreTokens ( ) ) { throw new ResponseException ( Status . BAD_REQUEST , "BAD REQUEST: Missing URI. Usage: GET /example/file.html" ) ; } String uri = st . nextToken ( ) ; // Decode parameters from the URI
int qmi = uri . indexOf ( '?' ) ; if ( qmi >= 0 ) { decodeParms ( uri . substring ( qmi + 1 ) , parms ) ; uri = NanoHTTPD . decodePercent ( uri . substring ( 0 , qmi ) ) ; } else { uri = NanoHTTPD . decodePercent ( uri ) ; } // If there ' s another token , its protocol version ,
// followed by HTTP headers .
// NOTE : this now forces header names lower case since they are
// case insensitive and vary by client .
if ( st . hasMoreTokens ( ) ) { protocolVersion = st . nextToken ( ) ; } else { protocolVersion = "HTTP/1.1" ; NanoHTTPD . LOG . log ( Level . FINE , "no protocol version specified, strange. Assuming HTTP/1.1." ) ; } String line = in . readLine ( ) ; while ( line != null && ! line . trim ( ) . isEmpty ( ) ) { int p = line . indexOf ( ':' ) ; if ( p >= 0 ) { headers . put ( line . substring ( 0 , p ) . trim ( ) . toLowerCase ( Locale . US ) , line . substring ( p + 1 ) . trim ( ) ) ; } line = in . readLine ( ) ; } pre . put ( "uri" , uri ) ; } catch ( IOException ioe ) { throw new ResponseException ( Status . INTERNAL_ERROR , "SERVER INTERNAL ERROR: IOException: " + ioe . getMessage ( ) , ioe ) ; }


signature:
public class HTTPSession { /** * Decodes the Multipart Body data and put it into Key / Value pairs . */
private void decodeMultipartFormData ( ContentType contentType , ByteBuffer fbuf , Map < String , List < String > > parms , Map < String , String > files ) throws ResponseException { } }

implementation:
int pcount = 0 ; try { int [ ] boundaryIdxs = getBoundaryPositions ( fbuf , contentType . getBoundary ( ) . getBytes ( ) ) ; if ( boundaryIdxs . length < 2 ) { throw new ResponseException ( Status . BAD_REQUEST , "BAD REQUEST: Content type is multipart/form-data but contains less than two boundary strings." ) ; } byte [ ] partHeaderBuff = new byte [ MAX_HEADER_SIZE ] ; for ( int boundaryIdx = 0 ; boundaryIdx < boundaryIdxs . length - 1 ; boundaryIdx ++ ) { fbuf . position ( boundaryIdxs [ boundaryIdx ] ) ; int len = ( fbuf . remaining ( ) < MAX_HEADER_SIZE ) ? fbuf . remaining ( ) : MAX_HEADER_SIZE ; fbuf . get ( partHeaderBuff , 0 , len ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( new ByteArrayInputStream ( partHeaderBuff , 0 , len ) , Charset . forName ( contentType . getEncoding ( ) ) ) , len ) ; int headerLines = 0 ; // First line is boundary string
String mpline = in . readLine ( ) ; headerLines ++ ; if ( mpline == null || ! mpline . contains ( contentType . getBoundary ( ) ) ) { throw new ResponseException ( Status . BAD_REQUEST , "BAD REQUEST: Content type is multipart/form-data but chunk does not start with boundary." ) ; } String partName = null , fileName = null , partContentType = null ; // Parse the reset of the header lines
mpline = in . readLine ( ) ; headerLines ++ ; while ( mpline != null && mpline . trim ( ) . length ( ) > 0 ) { Matcher matcher = NanoHTTPD . CONTENT_DISPOSITION_PATTERN . matcher ( mpline ) ; if ( matcher . matches ( ) ) { String attributeString = matcher . group ( 2 ) ; matcher = NanoHTTPD . CONTENT_DISPOSITION_ATTRIBUTE_PATTERN . matcher ( attributeString ) ; while ( matcher . find ( ) ) { String key = matcher . group ( 1 ) ; if ( "name" . equalsIgnoreCase ( key ) ) { partName = matcher . group ( 2 ) ; } else if ( "filename" . equalsIgnoreCase ( key ) ) { fileName = matcher . group ( 2 ) ; // add these two line to support multiple
// files uploaded using the same field Id
if ( ! fileName . isEmpty ( ) ) { if ( pcount > 0 ) partName = partName + String . valueOf ( pcount ++ ) ; else pcount ++ ; } } } } matcher = NanoHTTPD . CONTENT_TYPE_PATTERN . matcher ( mpline ) ; if ( matcher . matches ( ) ) { partContentType = matcher . group ( 2 ) . trim ( ) ; } mpline = in . readLine ( ) ; headerLines ++ ; } int partHeaderLength = 0 ; while ( headerLines -- > 0 ) { partHeaderLength = scipOverNewLine ( partHeaderBuff , partHeaderLength ) ; } // Read the part data
if ( partHeaderLength >= len - 4 ) { throw new ResponseException ( Status . INTERNAL_ERROR , "Multipart header size exceeds MAX_HEADER_SIZE." ) ; } int partDataStart = boundaryIdxs [ boundaryIdx ] + partHeaderLength ; int partDataEnd = boundaryIdxs [ boundaryIdx + 1 ] - 4 ; fbuf . position ( partDataStart ) ; List < String > values = parms . get ( partName ) ; if ( values == null ) { values = new ArrayList < String > ( ) ; parms . put ( partName , values ) ; } if ( partContentType == null ) { // Read the part into a string
byte [ ] data_bytes = new byte [ partDataEnd - partDataStart ] ; fbuf . get ( data_bytes ) ; values . add ( new String ( data_bytes , contentType . getEncoding ( ) ) ) ; } else { // Read it into a file
String path = saveTmpFile ( fbuf , partDataStart , partDataEnd - partDataStart , fileName ) ; if ( ! files . containsKey ( partName ) ) { files . put ( partName , path ) ; } else { int count = 2 ; while ( files . containsKey ( partName + count ) ) { count ++ ; } files . put ( partName + count , path ) ; } values . add ( fileName ) ; } } } catch ( ResponseException re ) { throw re ; } catch ( Exception e ) { throw new ResponseException ( Status . INTERNAL_ERROR , e . toString ( ) ) ; }


signature:
public class HTTPSession { /** * Decodes parameters in percent - encoded URI - format ( e . g .
 * " name = Jack % 20Daniels & pass = Single % 20Malt " ) and adds them to given Map . */
private void decodeParms ( String parms , Map < String , List < String > > p ) { } }

implementation: if ( parms == null ) { this . queryParameterString = "" ; return ; } this . queryParameterString = parms ; StringTokenizer st = new StringTokenizer ( parms , "&" ) ; while ( st . hasMoreTokens ( ) ) { String e = st . nextToken ( ) ; int sep = e . indexOf ( '=' ) ; String key = null ; String value = null ; if ( sep >= 0 ) { key = NanoHTTPD . decodePercent ( e . substring ( 0 , sep ) ) . trim ( ) ; value = NanoHTTPD . decodePercent ( e . substring ( sep + 1 ) ) ; } else { key = NanoHTTPD . decodePercent ( e ) . trim ( ) ; value = "" ; } List < String > values = p . get ( key ) ; if ( values == null ) { values = new ArrayList < String > ( ) ; p . put ( key , values ) ; } values . add ( value ) ; }


signature:
public class HTTPSession { /** * Find byte index separating header from body . It must be the last byte of
 * the first two sequential new lines . */
private int findHeaderEnd ( final byte [ ] buf , int rlen ) { } }

implementation:
int splitbyte = 0 ; while ( splitbyte + 1 < rlen ) { // RFC2616
if ( buf [ splitbyte ] == '\r' && buf [ splitbyte + 1 ] == '\n' && splitbyte + 3 < rlen && buf [ splitbyte + 2 ] == '\r' && buf [ splitbyte + 3 ] == '\n' ) { return splitbyte + 4 ; } // tolerance
if ( buf [ splitbyte ] == '\n' && buf [ splitbyte + 1 ] == '\n' ) { return splitbyte + 2 ; } splitbyte ++ ; } return 0 ;


signature:
public class HTTPSession { /** * Find the byte positions where multipart boundaries start . This reads a
 * large block at a time and uses a temporary buffer to optimize ( memory
 * mapped ) file access . */
private int [ ] getBoundaryPositions ( ByteBuffer b , byte [ ] boundary ) { } }

implementation:
int [ ] res = new int [ 0 ] ; if ( b . remaining ( ) < boundary . length ) { return res ; } int search_window_pos = 0 ; byte [ ] search_window = new byte [ 4 * 1024 + boundary . length ] ; int first_fill = ( b . remaining ( ) < search_window . length ) ? b . remaining ( ) : search_window . length ; b . get ( search_window , 0 , first_fill ) ; int new_bytes = first_fill - boundary . length ; do { // Search the search _ window
for ( int j = 0 ; j < new_bytes ; j ++ ) { for ( int i = 0 ; i < boundary . length ; i ++ ) { if ( search_window [ j + i ] != boundary [ i ] ) break ; if ( i == boundary . length - 1 ) { // Match found , add it to results
int [ ] new_res = new int [ res . length + 1 ] ; System . arraycopy ( res , 0 , new_res , 0 , res . length ) ; new_res [ res . length ] = search_window_pos + j ; res = new_res ; } } } search_window_pos += new_bytes ; // Copy the end of the buffer to the start
System . arraycopy ( search_window , search_window . length - boundary . length , search_window , 0 , boundary . length ) ; // Refill search _ window
new_bytes = search_window . length - boundary . length ; new_bytes = ( b . remaining ( ) < new_bytes ) ? b . remaining ( ) : new_bytes ; b . get ( search_window , boundary . length , new_bytes ) ; } while ( new_bytes > 0 ) ; return res ;


signature:
public class HTTPSession { /** * Deduce body length in bytes . Either from " content - length " header or read
 * bytes . */
public long getBodySize ( ) { } }

implementation: if ( this . headers . containsKey ( "content-length" ) ) { return Long . parseLong ( this . headers . get ( "content-length" ) ) ; } else if ( this . splitbyte < this . rlen ) { return this . rlen - this . splitbyte ; } return 0 ;


signature:
public class HTTPSession { /** * Retrieves the content of a sent file and saves it to a temporary file .
 * The full path to the saved file is returned . */
private String saveTmpFile ( ByteBuffer b , int offset , int len , String filename_hint ) { } }

implementation:
String path = "" ; if ( len > 0 ) { FileOutputStream fileOutputStream = null ; try { ITempFile tempFile = this . tempFileManager . createTempFile ( filename_hint ) ; ByteBuffer src = b . duplicate ( ) ; fileOutputStream = new FileOutputStream ( tempFile . getName ( ) ) ; FileChannel dest = fileOutputStream . getChannel ( ) ; src . position ( offset ) . limit ( offset + len ) ; dest . write ( src . slice ( ) ) ; path = tempFile . getName ( ) ; } catch ( Exception e ) { // Catch exception if any
throw new Error ( e ) ; // we won ' t recover , so throw an error
} finally { NanoHTTPD . safeClose ( fileOutputStream ) ; } } return path ;


signature:
public class NanoHTTPD { /** * Creates an SSLSocketFactory for HTTPS . Pass a loaded KeyStore and an
 * array of loaded KeyManagers . These objects must properly
 * loaded / initialized by the caller . */
public static SSLServerSocketFactory makeSSLSocketFactory ( KeyStore loadedKeyStore , KeyManager [ ] keyManagers ) throws IOException { } }

implementation: SSLServerSocketFactory res = null ; try { TrustManagerFactory trustManagerFactory = TrustManagerFactory . getInstance ( TrustManagerFactory . getDefaultAlgorithm ( ) ) ; trustManagerFactory . init ( loadedKeyStore ) ; SSLContext ctx = SSLContext . getInstance ( "TLS" ) ; ctx . init ( keyManagers , trustManagerFactory . getTrustManagers ( ) , null ) ; res = ctx . getServerSocketFactory ( ) ; } catch ( Exception e ) { throw new IOException ( e . getMessage ( ) ) ; } return res ;


signature:
public class NanoHTTPD { /** * Creates an SSLSocketFactory for HTTPS . Pass a loaded KeyStore and a
 * loaded KeyManagerFactory . These objects must properly loaded / initialized
 * by the caller . */
public static SSLServerSocketFactory makeSSLSocketFactory ( KeyStore loadedKeyStore , KeyManagerFactory loadedKeyFactory ) throws IOException { } }

implementation: try { return makeSSLSocketFactory ( loadedKeyStore , loadedKeyFactory . getKeyManagers ( ) ) ; } catch ( Exception e ) { throw new IOException ( e . getMessage ( ) ) ; }


signature:
public class NanoHTTPD { /** * Creates an SSLSocketFactory for HTTPS . Pass a KeyStore resource with your
 * certificate and passphrase */
public static SSLServerSocketFactory makeSSLSocketFactory ( String keyAndTrustStoreClasspathPath , char [ ] passphrase ) throws IOException { } }

implementation: try { KeyStore keystore = KeyStore . getInstance ( KeyStore . getDefaultType ( ) ) ; InputStream keystoreStream = NanoHTTPD . class . getResourceAsStream ( keyAndTrustStoreClasspathPath ) ; if ( keystoreStream == null ) { throw new IOException ( "Unable to load keystore from classpath: " + keyAndTrustStoreClasspathPath ) ; } keystore . load ( keystoreStream , passphrase ) ; KeyManagerFactory keyManagerFactory = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; keyManagerFactory . init ( keystore , passphrase ) ; return makeSSLSocketFactory ( keystore , keyManagerFactory ) ; } catch ( Exception e ) { throw new IOException ( e . getMessage ( ) ) ; }


signature:
public class NanoHTTPD { /** * Get MIME type from file name extension , if possible
 * @ param uri
 * the string representing a file
 * @ return the connected mime / type */
public static String getMimeTypeForFile ( String uri ) { } }

implementation: int dot = uri . lastIndexOf ( '.' ) ; String mime = null ; if ( dot >= 0 ) { mime = mimeTypes ( ) . get ( uri . substring ( dot + 1 ) . toLowerCase ( ) ) ; } return mime == null ? "application/octet-stream" : mime ;


signature:
public class NanoHTTPD { /** * This is the " master " method that delegates requests to handlers and makes
 * sure there is a response to every request . You are not supposed to call
 * or override this method in any circumstances . But no one will stop you if
 * you do . I ' m a Javadoc , not Code Police .
 * @ param session
 * the incoming session
 * @ return a response to the incoming session */
public Response handle ( IHTTPSession session ) { } }

implementation: for ( IHandler < IHTTPSession , Response > interceptor : interceptors ) { Response response = interceptor . handle ( session ) ; if ( response != null ) return response ; } return httpHandler . handle ( session ) ;


signature:
public class NanoHTTPD { /** * Override this to customize the server .
 * ( By default , this returns a 404 " Not Found " plain text error response . )
 * @ param session
 * The HTTP session
 * @ return HTTP response , see class Response for details */
@ Deprecated protected Response serve ( IHTTPSession session ) { } }

implementation: return Response . newFixedLengthResponse ( Status . NOT_FOUND , NanoHTTPD . MIME_PLAINTEXT , "Not Found" ) ;


signature:
public class NanoHTTPD { /** * Stop the server . */
public void stop ( ) { } }

implementation: try { safeClose ( this . myServerSocket ) ; this . asyncRunner . closeAll ( ) ; if ( this . myThread != null ) { this . myThread . join ( ) ; } } catch ( Exception e ) { NanoHTTPD . LOG . log ( Level . SEVERE , "Could not stop all connections" , e ) ; }


signature:
public class RouterNanoHTTPD { /** * default routings , they are over writable .
 * < pre >
 * router . setNotFoundHandler ( GeneralHandler . class ) ;
 * < / pre > */
public void addMappings ( ) { } }

implementation: router . setNotImplemented ( NotImplementedHandler . class ) ; router . setNotFoundHandler ( Error404UriHandler . class ) ; router . addRoute ( "/" , Integer . MAX_VALUE / 2 , IndexHandler . class ) ; router . addRoute ( "/index.html" , Integer . MAX_VALUE / 2 , IndexHandler . class ) ;


signature:
public class Response { /** * Sends given response to the socket . */
public void send ( OutputStream outputStream ) { } }

implementation: SimpleDateFormat gmtFrmt = new SimpleDateFormat ( "E, d MMM yyyy HH:mm:ss 'GMT'" , Locale . US ) ; gmtFrmt . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; try { if ( this . status == null ) { throw new Error ( "sendResponse(): Status can't be null." ) ; } PrintWriter pw = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( outputStream , new ContentType ( this . mimeType ) . getEncoding ( ) ) ) , false ) ; pw . append ( "HTTP/1.1 " ) . append ( this . status . getDescription ( ) ) . append ( " \r\n" ) ; if ( this . mimeType != null ) { printHeader ( pw , "Content-Type" , this . mimeType ) ; } if ( getHeader ( "date" ) == null ) { printHeader ( pw , "Date" , gmtFrmt . format ( new Date ( ) ) ) ; } for ( Entry < String , String > entry : this . header . entrySet ( ) ) { printHeader ( pw , entry . getKey ( ) , entry . getValue ( ) ) ; } for ( String cookieHeader : this . cookieHeaders ) { printHeader ( pw , "Set-Cookie" , cookieHeader ) ; } if ( getHeader ( "connection" ) == null ) { printHeader ( pw , "Connection" , ( this . keepAlive ? "keep-alive" : "close" ) ) ; } if ( getHeader ( "content-length" ) != null ) { setUseGzip ( false ) ; } if ( useGzipWhenAccepted ( ) ) { printHeader ( pw , "Content-Encoding" , "gzip" ) ; setChunkedTransfer ( true ) ; } long pending = this . data != null ? this . contentLength : 0 ; if ( this . requestMethod != Method . HEAD && this . chunkedTransfer ) { printHeader ( pw , "Transfer-Encoding" , "chunked" ) ; } else if ( ! useGzipWhenAccepted ( ) ) { pending = sendContentLengthHeaderIfNotAlreadyPresent ( pw , pending ) ; } pw . append ( "\r\n" ) ; pw . flush ( ) ; sendBodyWithCorrectTransferAndEncoding ( outputStream , pending ) ; outputStream . flush ( ) ; NanoHTTPD . safeClose ( this . data ) ; } catch ( IOException ioe ) { NanoHTTPD . LOG . log ( Level . SEVERE , "Could not send response to the client" , ioe ) ; }


signature:
public class Response { /** * Sends the body to the specified OutputStream . The pending parameter
 * limits the maximum amounts of bytes sent unless it is - 1 , in which case
 * everything is sent .
 * @ param outputStream
 * the OutputStream to send data to
 * @ param pending
 * - 1 to send everything , otherwise sets a max limit to the
 * number of bytes sent
 * @ throws IOException
 * if something goes wrong while sending the data . */
private void sendBody ( OutputStream outputStream , long pending ) throws IOException { } }

implementation: long BUFFER_SIZE = 16 * 1024 ; byte [ ] buff = new byte [ ( int ) BUFFER_SIZE ] ; boolean sendEverything = pending == - 1 ; while ( pending > 0 || sendEverything ) { long bytesToRead = sendEverything ? BUFFER_SIZE : Math . min ( pending , BUFFER_SIZE ) ; int read = this . data . read ( buff , 0 , ( int ) bytesToRead ) ; if ( read <= 0 ) { break ; } try { outputStream . write ( buff , 0 , read ) ; } catch ( Exception e ) { if ( this . data != null ) { this . data . close ( ) ; } } if ( ! sendEverything ) { pending -= read ; } }


signature:
public class Response { /** * Create a response with unknown length ( using HTTP 1.1 chunking ) . */
public static Response newChunkedResponse ( IStatus status , String mimeType , InputStream data ) { } }

implementation: return new Response ( status , mimeType , data , - 1 ) ;


signature:
public class Response { /** * Create a response with known length . */
public static Response newFixedLengthResponse ( IStatus status , String mimeType , InputStream data , long totalBytes ) { } }

implementation: return new Response ( status , mimeType , data , totalBytes ) ;


signature:
public class Response { /** * Create a text response with known length . */
public static Response newFixedLengthResponse ( IStatus status , String mimeType , String txt ) { } }

implementation: ContentType contentType = new ContentType ( mimeType ) ; if ( txt == null ) { return newFixedLengthResponse ( status , mimeType , new ByteArrayInputStream ( new byte [ 0 ] ) , 0 ) ; } else { byte [ ] bytes ; try { CharsetEncoder newEncoder = Charset . forName ( contentType . getEncoding ( ) ) . newEncoder ( ) ; if ( ! newEncoder . canEncode ( txt ) ) { contentType = contentType . tryUTF8 ( ) ; } bytes = txt . getBytes ( contentType . getEncoding ( ) ) ; } catch ( UnsupportedEncodingException e ) { NanoHTTPD . LOG . log ( Level . SEVERE , "encoding problem, responding nothing" , e ) ; bytes = new byte [ 0 ] ; } return newFixedLengthResponse ( status , contentType . getContentTypeHeader ( ) , new ByteArrayInputStream ( bytes ) , bytes . length ) ; }


signature:
public class Response { /** * Create a text response with known length . */
public static Response newFixedLengthResponse ( String msg ) { } }

implementation: return newFixedLengthResponse ( Status . OK , NanoHTTPD . MIME_HTML , msg ) ;


signature:
public class Response { /** * Else decide whether or not to use Gzip . */
public boolean useGzipWhenAccepted ( ) { } }

implementation: if ( gzipUsage == GzipUsage . DEFAULT ) return getMimeType ( ) != null && ( getMimeType ( ) . toLowerCase ( ) . contains ( "text/" ) || getMimeType ( ) . toLowerCase ( ) . contains ( "/json" ) ) ; else return gzipUsage == GzipUsage . ALWAYS ;


signature:
public class WebSocket { /** * Facade - - - - - */
private void readWebsocket ( ) { } }

implementation: try { while ( this . state == State . OPEN ) { handleWebsocketFrame ( WebSocketFrame . read ( this . in ) ) ; } } catch ( CharacterCodingException e ) { onException ( e ) ; doClose ( CloseCode . InvalidFramePayloadData , e . toString ( ) , false ) ; } catch ( IOException e ) { onException ( e ) ; if ( e instanceof WebSocketException ) { doClose ( ( ( WebSocketException ) e ) . getCode ( ) , ( ( WebSocketException ) e ) . getReason ( ) , false ) ; } } finally { doClose ( CloseCode . InternalServerError , "Handler terminated without closing the connection." , false ) ; }


signature:
public class NanoWSD { /** * Translates the specified byte array into Base64 string .
 * Android has android . util . Base64 , sun has sun . misc . Base64Encoder , Java 8
 * hast java . util . Base64 , I have this from stackoverflow :
 * http : / / stackoverflow . com / a / 4265472
 * @ param buf
 * the byte array ( not null )
 * @ return the translated Base64 string ( not null ) */
private static String encodeBase64 ( byte [ ] buf ) { } }

implementation: int size = buf . length ; char [ ] ar = new char [ ( size + 2 ) / 3 * 4 ] ; int a = 0 ; int i = 0 ; while ( i < size ) { byte b0 = buf [ i ++ ] ; byte b1 = i < size ? buf [ i ++ ] : 0 ; byte b2 = i < size ? buf [ i ++ ] : 0 ; int mask = 0x3F ; ar [ a ++ ] = NanoWSD . ALPHABET [ b0 >> 2 & mask ] ; ar [ a ++ ] = NanoWSD . ALPHABET [ ( b0 << 4 | ( b1 & 0xFF ) >> 4 ) & mask ] ; ar [ a ++ ] = NanoWSD . ALPHABET [ ( b1 << 2 | ( b2 & 0xFF ) >> 6 ) & mask ] ; ar [ a ++ ] = NanoWSD . ALPHABET [ b2 & mask ] ; } switch ( size % 3 ) { case 1 : ar [ -- a ] = '=' ; case 2 : ar [ -- a ] = '=' ; } return new String ( ar ) ;


signature:
public class WebSocketFrame { /** * - - - - - SERIALIZATION - - - - - */
public String getTextPayload ( ) { } }

implementation: if ( this . _payloadString == null ) { try { this . _payloadString = binary2Text ( getBinaryPayload ( ) ) ; } catch ( CharacterCodingException e ) { throw new RuntimeException ( "Undetected CharacterCodingException" , e ) ; } } return this . _payloadString ;


signature:
public class WebSocketFrame { /** * - - - - - ENCODING - - - - - */
private void readPayloadInfo ( InputStream in ) throws IOException { } }

implementation:
byte b = ( byte ) checkedRead ( in . read ( ) ) ; boolean masked = ( b & 0x80 ) != 0 ; this . _payloadLength = ( byte ) ( 0x7F & b ) ; if ( this . _payloadLength == 126 ) { // checkedRead must return int for this to work
this . _payloadLength = ( checkedRead ( in . read ( ) ) << 8 | checkedRead ( in . read ( ) ) ) & 0xFFFF ; if ( this . _payloadLength < 126 ) { throw new WebSocketException ( CloseCode . ProtocolError , "Invalid data frame 2byte length. (not using minimal length encoding)" ) ; } } else if ( this . _payloadLength == 127 ) { long _payloadLength = ( long ) checkedRead ( in . read ( ) ) << 56 | ( long ) checkedRead ( in . read ( ) ) << 48 | ( long ) checkedRead ( in . read ( ) ) << 40 | ( long ) checkedRead ( in . read ( ) ) << 32 | checkedRead ( in . read ( ) ) << 24 | checkedRead ( in . read ( ) ) << 16 | checkedRead ( in . read ( ) ) << 8 | checkedRead ( in . read ( ) ) ; if ( _payloadLength < 65536 ) { throw new WebSocketException ( CloseCode . ProtocolError , "Invalid data frame 4byte length. (not using minimal length encoding)" ) ; } if ( _payloadLength < 0 || _payloadLength > Integer . MAX_VALUE ) { throw new WebSocketException ( CloseCode . MessageTooBig , "Max frame length has been exceeded." ) ; } this . _payloadLength = ( int ) _payloadLength ; } if ( this . opCode . isControlFrame ( ) ) { if ( this . _payloadLength > 125 ) { throw new WebSocketException ( CloseCode . ProtocolError , "Control frame with payload length > 125 bytes." ) ; } if ( this . opCode == OpCode . Close && this . _payloadLength == 1 ) { throw new WebSocketException ( CloseCode . ProtocolError , "Received close frame with payload len 1." ) ; } } if ( masked ) { this . maskingKey = new byte [ 4 ] ; int read = 0 ; while ( read < this . maskingKey . length ) { read += checkedRead ( in . read ( this . maskingKey , read , this . maskingKey . length - read ) ) ; } }


signature: public class WebSocketFrame { public void write ( OutputStream out ) throws IOException { } }

implementation:
byte header = 0 ; if ( this . fin ) { header |= 0x80 ; } header |= this . opCode . getValue ( ) & 0x0F ; out . write ( header ) ; this . _payloadLength = getBinaryPayload ( ) . length ; if ( this . _payloadLength <= 125 ) { out . write ( isMasked ( ) ? 0x80 | ( byte ) this . _payloadLength : ( byte ) this . _payloadLength ) ; } else if ( this . _payloadLength <= 0xFFFF ) { out . write ( isMasked ( ) ? 0xFE : 126 ) ; out . write ( this . _payloadLength >>> 8 ) ; out . write ( this . _payloadLength ) ; } else { out . write ( isMasked ( ) ? 0xFF : 127 ) ; out . write ( this . _payloadLength >>> 56 & 0 ) ; // integer only
// contains
// 31 bit
out . write ( this . _payloadLength >>> 48 & 0 ) ; out . write ( this . _payloadLength >>> 40 & 0 ) ; out . write ( this . _payloadLength >>> 32 & 0 ) ; out . write ( this . _payloadLength >>> 24 ) ; out . write ( this . _payloadLength >>> 16 ) ; out . write ( this . _payloadLength >>> 8 ) ; out . write ( this . _payloadLength ) ; } if ( isMasked ( ) ) { out . write ( this . maskingKey ) ; for ( int i = 0 ; i < this . _payloadLength ; i ++ ) { out . write ( getBinaryPayload ( ) [ i ] ^ this . maskingKey [ i % 4 ] ) ; } } else { out . write ( getBinaryPayload ( ) ) ; } out . flush ( ) ;


signature:
public class CookieHandler { /** * Sets a cookie .
 * @ param name
 * The cookie ' s name .
 * @ param value
 * The cookie ' s value .
 * @ param expires
 * How many days until the cookie expires . */
public void set ( String name , String value , int expires ) { } }

implementation: this . queue . add ( new Cookie ( name , value , Cookie . getHTTPTime ( expires ) ) ) ;


signature:
public class CookieHandler { /** * Internally used by the webserver to add all queued cookies into the
 * Response ' s HTTP Headers .
 * @ param response
 * The Response object to which headers the queued cookies will
 * be added . */
public void unloadQueue ( Response response ) { } }

implementation: for ( Cookie cookie : this . queue ) { response . addCookieHeader ( cookie . getHTTPHeader ( ) ) ; }


signature:
public class IndexController { /** * end : : findbyusername [ ] */
@ RequestMapping ( value = "/sessions/{sessionIdToDelete}" , method = RequestMethod . DELETE ) public String removeSession ( Principal principal , @ PathVariable String sessionIdToDelete ) { } }

implementation: Set < String > usersSessionIds = this . sessions . findByPrincipalName ( principal . getName ( ) ) . keySet ( ) ; if ( usersSessionIds . contains ( sessionIdToDelete ) ) { this . sessions . deleteById ( sessionIdToDelete ) ; } return "redirect:/" ;


signature:
public class DefaultCookieSerializer { /** * ( non - Javadoc )
 * @ see org . springframework . session . web . http . CookieSerializer # readCookieValues ( javax .
 * servlet . http . HttpServletRequest ) */
@ Override public List < String > readCookieValues ( HttpServletRequest request ) { } }

implementation: Cookie [ ] cookies = request . getCookies ( ) ; List < String > matchingCookieValues = new ArrayList < > ( ) ; if ( cookies != null ) { for ( Cookie cookie : cookies ) { if ( this . cookieName . equals ( cookie . getName ( ) ) ) { String sessionId = ( this . useBase64Encoding ? base64Decode ( cookie . getValue ( ) ) : cookie . getValue ( ) ) ; if ( sessionId == null ) { continue ; } if ( this . jvmRoute != null && sessionId . endsWith ( this . jvmRoute ) ) { sessionId = sessionId . substring ( 0 , sessionId . length ( ) - this . jvmRoute . length ( ) ) ; } matchingCookieValues . add ( sessionId ) ; } } } return matchingCookieValues ;


signature:
public class DefaultCookieSerializer { /** * ( non - Javadoc )
 * @ see org . springframework . session . web . http . CookieWriter # writeCookieValue ( org .
 * springframework . session . web . http . CookieWriter . CookieValue ) */
@ Override public void writeCookieValue ( CookieValue cookieValue ) { } }

implementation: HttpServletRequest request = cookieValue . getRequest ( ) ; HttpServletResponse response = cookieValue . getResponse ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( this . cookieName ) . append ( '=' ) ; String value = getValue ( cookieValue ) ; if ( value != null && value . length ( ) > 0 ) { validateValue ( value ) ; sb . append ( value ) ; } int maxAge = getMaxAge ( cookieValue ) ; if ( maxAge > - 1 ) { sb . append ( "; Max-Age=" ) . append ( cookieValue . getCookieMaxAge ( ) ) ; OffsetDateTime expires = ( maxAge != 0 ) ? OffsetDateTime . now ( ) . plusSeconds ( maxAge ) : Instant . EPOCH . atOffset ( ZoneOffset . UTC ) ; sb . append ( "; Expires=" ) . append ( expires . format ( DateTimeFormatter . RFC_1123_DATE_TIME ) ) ; } String domain = getDomainName ( request ) ; if ( domain != null && domain . length ( ) > 0 ) { validateDomain ( domain ) ; sb . append ( "; Domain=" ) . append ( domain ) ; } String path = getCookiePath ( request ) ; if ( path != null && path . length ( ) > 0 ) { validatePath ( path ) ; sb . append ( "; Path=" ) . append ( path ) ; } if ( isSecureCookie ( request ) ) { sb . append ( "; Secure" ) ; } if ( this . useHttpOnlyCookie ) { sb . append ( "; HttpOnly" ) ; } if ( this . sameSite != null ) { sb . append ( "; SameSite=" ) . append ( this . sameSite ) ; } response . addHeader ( "Set-Cookie" , sb . toString ( ) ) ;


signature:
public class DefaultCookieSerializer { /** * Decode the value using Base64.
 * @ param base64Value the Base64 String to decode
 * @ return the Base64 decoded value
 * @ since 1.2.2 */
private String base64Decode ( String base64Value ) { } }

implementation: try { byte [ ] decodedCookieBytes = Base64 . getDecoder ( ) . decode ( base64Value ) ; return new String ( decodedCookieBytes ) ; } catch ( Exception ex ) { logger . debug ( "Unable to Base64 decode value: " + base64Value ) ; return null ; }


signature:
public class DefaultCookieSerializer { /** * Encode the value using Base64.
 * @ param value the String to Base64 encode
 * @ return the Base64 encoded value
 * @ since 1.2.2 */
private String base64Encode ( String value ) { } }

implementation: byte [ ] encodedCookieBytes = Base64 . getEncoder ( ) . encode ( value . getBytes ( ) ) ; return new String ( encodedCookieBytes ) ;


signature:
public class DefaultCookieSerializer { /** * Sets a case insensitive pattern used to extract the domain name from the
 * { @ link HttpServletRequest # getServerName ( ) } . The pattern should provide a single
 * grouping that defines what the value is that should be matched . User ' s should be
 * careful not to output malicious characters like new lines to prevent from things
 * like < a href = " https : / / www . owasp . org / index . php / HTTP _ Response _ Splitting " > HTTP
 * Response Splitting < / a > .
 * If the pattern does not match , then no domain will be set . This is useful to ensure
 * the domain is not set during development when localhost might be used .
 * An example value might be " ^ . + ? \ \ . ( \ \ w + \ \ . [ a - z ] + ) $ " . For the given input , it would
 * provide the following explicit domain ( null means no domain name is set ) :
 * < ul >
 * < li > example . com - null < / li >
 * < li > child . sub . example . com - example . com < / li >
 * < li > localhost - null < / li >
 * < li > 127.0.1.1 - null < / li >
 * < / ul >
 * @ param domainNamePattern the case insensitive pattern to extract the domain name
 * with
 * @ throws IllegalStateException if the domainName is also set */
public void setDomainNamePattern ( String domainNamePattern ) { } }

implementation: if ( this . domainName != null ) { throw new IllegalStateException ( "Cannot set both domainName and domainNamePattern" ) ; } this . domainNamePattern = Pattern . compile ( domainNamePattern , Pattern . CASE_INSENSITIVE ) ;


signature:
public class JdbcOperationsSessionRepository { /** * Set the name of database table used to store sessions .
 * @ param tableName the database table name */
public void setTableName ( String tableName ) { } }

implementation: Assert . hasText ( tableName , "Table name must not be empty" ) ; this . tableName = tableName . trim ( ) ; prepareQueries ( ) ;


signature:
public class SessionEventHttpSessionListenerAdapter { /** * ( non - Javadoc )
 * @ see org . springframework . context . ApplicationListener # onApplicationEvent ( org .
 * springframework . context . ApplicationEvent ) */
@ Override public void onApplicationEvent ( AbstractSessionEvent event ) { } }

implementation: if ( this . listeners . isEmpty ( ) ) { return ; } HttpSessionEvent httpSessionEvent = createHttpSessionEvent ( event ) ; for ( HttpSessionListener listener : this . listeners ) { if ( event instanceof SessionDestroyedEvent ) { listener . sessionDestroyed ( httpSessionEvent ) ; } else if ( event instanceof SessionCreatedEvent ) { listener . sessionCreated ( httpSessionEvent ) ; } }


signature:
public class Config { /** * tag : : cookie - serializer [ ] */
@ Bean public CookieSerializer cookieSerializer ( ) { } }

implementation: DefaultCookieSerializer serializer = new DefaultCookieSerializer ( ) ; serializer . setCookieName ( "JSESSIONID" ) ; serializer . setCookiePath ( "/" ) ; serializer . setDomainNamePattern ( "^.+?\\.(\\w+\\.[a-z]+)$" ) ; return serializer ;


signature:
public class SessionConfig { /** * Customized { @ link ObjectMapper } to add mix - in for class that doesn ' t have default
 * constructors
 * @ return the { @ link ObjectMapper } to use */
private ObjectMapper objectMapper ( ) { } }

implementation: ObjectMapper mapper = new ObjectMapper ( ) ; mapper . registerModules ( SecurityJackson2Modules . getModules ( this . loader ) ) ; return mapper ;


signature:
public class SessionDetailsFilter { /** * tag : : dofilterinternal [ ] */
@ Override public void doFilterInternal ( HttpServletRequest request , HttpServletResponse response , FilterChain chain ) throws IOException , ServletException { } }

implementation: chain . doFilter ( request , response ) ; HttpSession session = request . getSession ( false ) ; if ( session != null ) { String remoteAddr = getRemoteAddress ( request ) ; String geoLocation = getGeoLocation ( remoteAddr ) ; SessionDetails details = new SessionDetails ( ) ; details . setAccessType ( request . getHeader ( "User-Agent" ) ) ; details . setLocation ( remoteAddr + " " + geoLocation ) ; session . setAttribute ( "SESSION_DETAILS" , details ) ; }


signature:
public class SessionDetailsFilter { /** * end : : dofilterinternal [ ] */
String getGeoLocation ( String remoteAddr ) { } }

implementation: try { CityResponse city = this . reader . city ( InetAddress . getByName ( remoteAddr ) ) ; String cityName = city . getCity ( ) . getName ( ) ; String countryName = city . getCountry ( ) . getName ( ) ; if ( cityName == null && countryName == null ) { return null ; } else if ( cityName == null ) { return countryName ; } else if ( countryName == null ) { return cityName ; } return cityName + ", " + countryName ; } catch ( Exception ex ) { return UNKNOWN ; }


signature:
public class ConfigureNotifyKeyspaceEventsAction { /** * ( non - Javadoc )
 * @ see
 * org . springframework . session . data . redis . config . ConfigureRedisAction # configure ( org .
 * springframework . data . redis . connection . RedisConnection ) */
@ Override public void configure ( RedisConnection connection ) { } }

implementation: String notifyOptions = getNotifyOptions ( connection ) ; String customizedNotifyOptions = notifyOptions ; if ( ! customizedNotifyOptions . contains ( "E" ) ) { customizedNotifyOptions += "E" ; } boolean A = customizedNotifyOptions . contains ( "A" ) ; if ( ! ( A || customizedNotifyOptions . contains ( "g" ) ) ) { customizedNotifyOptions += "g" ; } if ( ! ( A || customizedNotifyOptions . contains ( "x" ) ) ) { customizedNotifyOptions += "x" ; } if ( ! notifyOptions . equals ( customizedNotifyOptions ) ) { connection . setConfig ( CONFIG_NOTIFY_KEYSPACE_EVENTS , customizedNotifyOptions ) ; }


signature:
public class SpringWebSessionConfiguration { /** * Configure a { @ link WebSessionManager } using a provided { @ link ReactiveSessionRepository } .
 * @ param repository a bean that implements { @ link ReactiveSessionRepository } .
 * @ return a configured { @ link WebSessionManager } registered with a preconfigured name . */
@ Bean ( WebHttpHandlerBuilder . WEB_SESSION_MANAGER_BEAN_NAME ) public WebSessionManager webSessionManager ( ReactiveSessionRepository < ? extends Session > repository ) { } }

implementation: SpringSessionWebSessionStore < ? extends Session > sessionStore = new SpringSessionWebSessionStore < > ( repository ) ; DefaultWebSessionManager manager = new DefaultWebSessionManager ( ) ; manager . setSessionStore ( sessionStore ) ; if ( this . webSessionIdResolver != null ) { manager . setSessionIdResolver ( this . webSessionIdResolver ) ; } return manager ;


signature:
public class UserRepositoryUserDetailsService { /** * ( non - Javadoc )
 * @ see
 * org . springframework . security . core . userdetails . UserDetailsService # loadUserByUsername
 * ( java . lang . String ) */
@ Override public UserDetails loadUserByUsername ( String username ) throws UsernameNotFoundException { } }

implementation: User user = this . userRepository . findByEmail ( username ) ; if ( user == null ) { throw new UsernameNotFoundException ( "Could not find user " + username ) ; } return new CustomUserDetails ( user ) ;


signature:
public class SpringSessionRememberMeServices { /** * Allows customization of whether a remember - me login has been requested . The default
 * is to return { @ code true } if the configured parameter name has been included in the
 * request and is set to the value { @ code true } .
 * @ param request the request submitted from an interactive login , which may include
 * additional information indicating that a persistent login is desired .
 * @ param parameter the configured remember - me parameter name .
 * @ return true if the request includes information indicating that a persistent login
 * has been requested . */
protected boolean rememberMeRequested ( HttpServletRequest request , String parameter ) { } }

implementation: String rememberMe = request . getParameter ( parameter ) ; if ( rememberMe != null ) { if ( rememberMe . equalsIgnoreCase ( "true" ) || rememberMe . equalsIgnoreCase ( "on" ) || rememberMe . equalsIgnoreCase ( "yes" ) || rememberMe . equals ( "1" ) ) { return true ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Did not send remember-me cookie (principal did not set " + "parameter '" + parameter + "')" ) ; } return false ;


signature:
public class SpringSessionBackedSessionRegistry { /** * Derives a String name for the given principal .
 * @ param principal as provided by Spring Security
 * @ return name of the principal , or its { @ code toString ( ) } representation if no name
 * could be derived */
protected String name ( Object principal ) { } }

implementation: if ( principal instanceof UserDetails ) { return ( ( UserDetails ) principal ) . getUsername ( ) ; } if ( principal instanceof Principal ) { return ( ( Principal ) principal ) . getName ( ) ; } return principal . toString ( ) ;


signature:
public class AbstractHttpSessionApplicationInitializer { /** * Registers the springSessionRepositoryFilter .
 * @ param servletContext the { @ link ServletContext } */
private void insertSessionRepositoryFilter ( ServletContext servletContext ) { } }

implementation: String filterName = DEFAULT_FILTER_NAME ; DelegatingFilterProxy springSessionRepositoryFilter = new DelegatingFilterProxy ( filterName ) ; String contextAttribute = getWebApplicationContextAttribute ( ) ; if ( contextAttribute != null ) { springSessionRepositoryFilter . setContextAttribute ( contextAttribute ) ; } registerFilter ( servletContext , true , filterName , springSessionRepositoryFilter ) ;


signature:
public class AbstractHttpSessionApplicationInitializer { /** * Get the { @ link DispatcherType } for the springSessionRepositoryFilter .
 * @ return the { @ link DispatcherType } for the filter */
protected EnumSet < DispatcherType > getSessionDispatcherTypes ( ) { } }

implementation: return EnumSet . of ( DispatcherType . REQUEST , DispatcherType . ERROR , DispatcherType . ASYNC ) ;


signature:
public class SpringSessionBackedSessionInformation { /** * Tries to determine the principal ' s name from the given Session .
 * @ param session the session
 * @ return the principal ' s name , or empty String if it couldn ' t be determined */
private static String resolvePrincipal ( Session session ) { } }

implementation: String principalName = session . getAttribute ( FindByIndexNameSessionRepository . PRINCIPAL_NAME_INDEX_NAME ) ; if ( principalName != null ) { return principalName ; } SecurityContext securityContext = session . getAttribute ( SPRING_SECURITY_CONTEXT ) ; if ( securityContext != null && securityContext . getAuthentication ( ) != null ) { return securityContext . getAuthentication ( ) . getName ( ) ; } return "" ;


signature:
public class OncePerRequestFilter { /** * This { @ code doFilter } implementation stores a request attribute for
 * " already filtered " , proceeding without filtering again if the attribute is already
 * there .
 * @ param request the request
 * @ param response the response
 * @ param filterChain the filter chain
 * @ throws ServletException if request is not HTTP request
 * @ throws IOException in case of I / O operation exception */
@ Override public final void doFilter ( ServletRequest request , ServletResponse response , FilterChain filterChain ) throws ServletException , IOException { } }

implementation:
if ( ! ( request instanceof HttpServletRequest ) || ! ( response instanceof HttpServletResponse ) ) { throw new ServletException ( "OncePerRequestFilter just supports HTTP requests" ) ; } HttpServletRequest httpRequest = ( HttpServletRequest ) request ; HttpServletResponse httpResponse = ( HttpServletResponse ) response ; boolean hasAlreadyFilteredAttribute = request . getAttribute ( this . alreadyFilteredAttributeName ) != null ; if ( hasAlreadyFilteredAttribute ) { // Proceed without invoking this filter . . .
filterChain . doFilter ( request , response ) ; } else { // Do invoke this filter . . .
request . setAttribute ( this . alreadyFilteredAttributeName , Boolean . TRUE ) ; try { doFilterInternal ( httpRequest , httpResponse , filterChain ) ; } finally { // Remove the " already filtered " request attribute for this request .
request . removeAttribute ( this . alreadyFilteredAttributeName ) ; } }


signature:
public class RedisOperationsSessionRepository { /** * Gets the session .
 * @ param id the session id
 * @ param allowExpired if true , will also include expired sessions that have not been
 * deleted . If false , will ensure expired sessions are not returned .
 * @ return the Redis session */
private RedisSession getSession ( String id , boolean allowExpired ) { } }

implementation: Map < Object , Object > entries = getSessionBoundHashOperations ( id ) . entries ( ) ; if ( entries . isEmpty ( ) ) { return null ; } MapSession loaded = loadSession ( id , entries ) ; if ( ! allowExpired && loaded . isExpired ( ) ) { return null ; } RedisSession result = new RedisSession ( loaded ) ; result . originalLastAccessTime = loaded . getLastAccessedTime ( ) ; return result ;


signature:
public class RedisOperationsSessionRepository { /** * Gets the { @ link BoundHashOperations } to operate on a { @ link Session } .
 * @ param sessionId the id of the { @ link Session } to work with
 * @ return the { @ link BoundHashOperations } to operate on a { @ link Session } */
private BoundHashOperations < Object , Object , Object > getSessionBoundHashOperations ( String sessionId ) { } }

implementation: String key = getSessionKey ( sessionId ) ; return this . sessionRedisOperations . boundHashOps ( key ) ;


signature:
public class MailSessionAdd { /** * Make any runtime changes necessary to effect the changes indicated by the given { @ code operation } . E
 * It constructs a MailSessionService that provides mail session and registers it to Naming service .
 * @ param context the operation context
 * @ param operation the operation being executed
 * @ param model persistent configuration model node that corresponds to the address of { @ code operation }
 * @ throws org . jboss . as . controller . OperationFailedException
 * if { @ code operation } is invalid or updating the runtime otherwise fails */
@ Override protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode model ) throws OperationFailedException { } }

implementation: final PathAddress address = context . getCurrentAddress ( ) ; ModelNode fullTree = Resource . Tools . readModel ( context . readResource ( PathAddress . EMPTY_ADDRESS ) ) ; installRuntimeServices ( context , address , fullTree ) ;


signature:
public class MailSessionAdd { /** * Extracts the raw JNDI _ NAME value from the given model node , and depending on the value and
 * the value of any USE _ JAVA _ CONTEXT child node , converts the raw name into a compliant jndi name .
 * @ param modelNode the model node ; either an operation or the model behind a mail session resource
 * @ return the compliant jndi name */
static String getJndiName ( final ModelNode modelNode , OperationContext context ) throws OperationFailedException { } }

implementation: final String rawJndiName = MailSessionDefinition . JNDI_NAME . resolveModelAttribute ( context , modelNode ) . asString ( ) ; return getJndiName ( rawJndiName ) ;


signature:
public class MethodInfoHelper { /** * This method returns the class names of the parameters of the given method
 * in canonical form . In case of a method without parameters it will return an empty
 * array .
 * < p > The canonical form is the one that is used in deployment descriptors .
 * < p > Example : For the method < code > f ( String [ ] arg0 , String arg1 , int ) < / code > this method will return
 * < code > { " java . lang . String [ ] " , " java . lang . String " , " int " } < / code >
 * @ param viewMethod
 * @ return */
public static String [ ] getCanonicalParameterTypes ( Method viewMethod ) { } }

implementation: Class < ? > [ ] parameterTypes = viewMethod . getParameterTypes ( ) ; if ( parameterTypes == null ) { return NO_STRINGS ; } String [ ] canonicalNames = new String [ parameterTypes . length ] ; for ( int i = 0 ; i < parameterTypes . length ; i ++ ) { canonicalNames [ i ] = parameterTypes [ i ] . getCanonicalName ( ) ; } return canonicalNames ;


signature:
public class JCAOrderedLastSynchronizationList { /** * This is only allowed at various points of the transaction lifecycle .
 * @ param synchronization The synchronization to register
 * @ throws IllegalStateException In case the transaction was in a state that was not valid to register under
 * @ throws SystemException In case the transaction status was not known */
public void registerInterposedSynchronization ( Synchronization synchronization ) throws IllegalStateException , SystemException { } }

implementation:
int status = ContextTransactionSynchronizationRegistry . getInstance ( ) . getTransactionStatus ( ) ; switch ( status ) { case javax . transaction . Status . STATUS_ACTIVE : case javax . transaction . Status . STATUS_PREPARING : break ; case Status . STATUS_MARKED_ROLLBACK : // do nothing ; we can pretend like it was registered , but it ' ll never be run anyway .
return ; default : throw TransactionLogger . ROOT_LOGGER . syncsnotallowed ( status ) ; } if ( synchronization . getClass ( ) . getName ( ) . startsWith ( "org.jboss.jca" ) ) { if ( TransactionLogger . ROOT_LOGGER . isTraceEnabled ( ) ) { TransactionLogger . ROOT_LOGGER . trace ( "JCAOrderedLastSynchronizationList.jcaSyncs.add - Class: " + synchronization . getClass ( ) + " HashCode: " + synchronization . hashCode ( ) + " toString: " + synchronization ) ; } jcaSyncs . add ( synchronization ) ; } else { if ( TransactionLogger . ROOT_LOGGER . isTraceEnabled ( ) ) { TransactionLogger . ROOT_LOGGER . trace ( "JCAOrderedLastSynchronizationList.preJcaSyncs.add - Class: " + synchronization . getClass ( ) + " HashCode: " + synchronization . hashCode ( ) + " toString: " + synchronization ) ; } preJcaSyncs . add ( synchronization ) ; }


signature:
public class JCAOrderedLastSynchronizationList { /** * Exceptions from Synchronizations that are registered with this TSR are not trapped for before completion . This is because
 * an error in a Sync here should result in the transaction rolling back .
 * You can see that in effect in these classes :
 * https : / / github . com / jbosstm / narayana / blob / 5.0.4 . Final / ArjunaCore / arjuna / classes
 * / com / arjuna / ats / arjuna / coordinator / TwoPhaseCoordinator . java # L91
 * https : / / github . com / jbosstm / narayana / blob / 5.0.4 . Final / ArjunaJTA
 * / jta / classes / com / arjuna / ats / internal / jta / resources / arjunacore / SynchronizationImple . java # L76 */
@ Override public void beforeCompletion ( ) { } }

implementation:
// This is needed to guard against syncs being registered during the run , otherwise we could have used an iterator
int lastIndexProcessed = 0 ; while ( ( lastIndexProcessed < preJcaSyncs . size ( ) ) ) { Synchronization preJcaSync = preJcaSyncs . get ( lastIndexProcessed ) ; if ( TransactionLogger . ROOT_LOGGER . isTraceEnabled ( ) ) { TransactionLogger . ROOT_LOGGER . trace ( "JCAOrderedLastSynchronizationList.preJcaSyncs.before_completion - Class: " + preJcaSync . getClass ( ) + " HashCode: " + preJcaSync . hashCode ( ) + " toString: " + preJcaSync ) ; } preJcaSync . beforeCompletion ( ) ; lastIndexProcessed = lastIndexProcessed + 1 ; } // Do the same for the jca syncs
lastIndexProcessed = 0 ; while ( ( lastIndexProcessed < jcaSyncs . size ( ) ) ) { Synchronization jcaSync = jcaSyncs . get ( lastIndexProcessed ) ; if ( TransactionLogger . ROOT_LOGGER . isTraceEnabled ( ) ) { TransactionLogger . ROOT_LOGGER . trace ( "JCAOrderedLastSynchronizationList.jcaSyncs.before_completion - Class: " + jcaSync . getClass ( ) + " HashCode: " + jcaSync . hashCode ( ) + " toString: " + jcaSync ) ; } jcaSync . beforeCompletion ( ) ; lastIndexProcessed = lastIndexProcessed + 1 ; }


signature:
public class TxServerInterceptor { /** * Called by < code > TxServerInterceptorInitializer < / code > at ORB initialization time . */
static void init ( int slotId , Codec codec , org . omg . PortableInterceptor . Current piCurrent ) { } }

implementation: TxServerInterceptor . slotId = slotId ; TxServerInterceptor . codec = codec ; TxServerInterceptor . piCurrent = piCurrent ;


signature:
public class TxServerInterceptor { /** * Returns the transaction associated with the transaction propagation
 * context that arrived in the current IIOP request . */
public static Transaction getCurrentTransaction ( ) { } }

implementation:
Transaction tx = null ; if ( piCurrent != null ) { // A non - null piCurrent means that a TxServerInterceptor was
// installed : check if there is a transaction propagation context
try { Any any = piCurrent . get_slot ( slotId ) ; if ( any . type ( ) . kind ( ) . value ( ) != TCKind . _tk_null ) { // Yes , there is a TPC : add the foreign transaction marker
tx = ForeignTransaction . INSTANCE ; } } catch ( InvalidSlot e ) { throw IIOPLogger . ROOT_LOGGER . errorGettingSlotInTxInterceptor ( e ) ; } } return tx ;


signature:
public class TransactionSubsystem30Parser { /** * Reads and trims the text for the given attribute and returns it or { @ code defaultValue } if there is no
 * value for the attribute
 * @ param reader source for the attribute text
 * @ param attributeName the name of the attribute
 * @ param defaultValue value to return if there is no value for the attribute
 * @ return the string representing raw attribute text or { @ code defaultValue } if there is none */
private String rawAttributeText ( XMLStreamReader reader , String attributeName , String defaultValue ) { } }

implementation: return reader . getAttributeValue ( "" , attributeName ) == null ? defaultValue : reader . getAttributeValue ( "" , attributeName ) . trim ( ) ;


signature:
public class SubjectFactoryService { /** * { @ inheritDoc } */
@ Override public synchronized void start ( StartContext context ) throws StartException { } }

implementation: SecurityLogger . ROOT_LOGGER . debugf ( "Starting SubjectFactoryService" ) ; final ISecurityManagement injectedSecurityManagement = securityManagementValue . getValue ( ) ; int i = subjectFactoryClassName . lastIndexOf ( ":" ) ; if ( i == - 1 ) throw SecurityLogger . ROOT_LOGGER . missingModuleName ( "subject-factory-class-name attribute" ) ; String moduleSpec = subjectFactoryClassName . substring ( 0 , i ) ; String className = subjectFactoryClassName . substring ( i + 1 ) ; JBossSecuritySubjectFactory subjectFactory = null ; try { Class < ? > subjectFactoryClazz = SecurityActions . getModuleClassLoader ( moduleSpec ) . loadClass ( className ) ; subjectFactory = ( JBossSecuritySubjectFactory ) subjectFactoryClazz . newInstance ( ) ; } catch ( Exception e ) { throw SecurityLogger . ROOT_LOGGER . unableToStartException ( "SubjectFactoryService" , e ) ; } subjectFactory . setSecurityManagement ( injectedSecurityManagement ) ; this . subjectFactory = subjectFactory ;


signature:
public class KernelDeploymentModuleProcessor { /** * Add POJO module if we have any bean factories .
 * @ param phaseContext the deployment unit context
 * @ throws org . jboss . as . server . deployment . DeploymentUnitProcessingException */
@ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } }

implementation: final DeploymentUnit unit = phaseContext . getDeploymentUnit ( ) ; final List < KernelDeploymentXmlDescriptor > kdXmlDescriptors = unit . getAttachment ( KernelDeploymentXmlDescriptor . ATTACHMENT_KEY ) ; if ( kdXmlDescriptors == null || kdXmlDescriptors . isEmpty ( ) ) return ; for ( KernelDeploymentXmlDescriptor kdxd : kdXmlDescriptors ) { if ( kdxd . getBeanFactoriesCount ( ) > 0 ) { final ModuleSpecification moduleSpecification = unit . getAttachment ( Attachments . MODULE_SPECIFICATION ) ; final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; ModuleDependency dependency = new ModuleDependency ( moduleLoader , POJO_MODULE , false , false , false , false ) ; PathFilter filter = PathFilters . isChildOf ( BaseBeanFactory . class . getPackage ( ) . getName ( ) ) ; dependency . addImportFilter ( filter , true ) ; dependency . addImportFilter ( PathFilters . rejectAll ( ) , false ) ; moduleSpecification . addSystemDependency ( dependency ) ; return ; } }


signature:
public class ValueAnalysis { /** * Return a list of all the entries contained here . */
protected ArrayList getContainedEntries ( ) { } }

implementation: final ArrayList ret = new ArrayList ( constants . length + attributes . length + members . length ) ; for ( int i = 0 ; i < constants . length ; ++ i ) ret . add ( constants [ i ] ) ; for ( int i = 0 ; i < attributes . length ; ++ i ) ret . add ( attributes [ i ] ) ; for ( int i = 0 ; i < members . length ; ++ i ) ret . add ( members [ i ] ) ; return ret ;


signature:
public class HibernatePersistenceProviderAdaptor { /** * determine if management console can display the second level cache entries
 * @ param pu
 * @ return false if a custom AvailableSettings . CACHE _ REGION _ PREFIX property is specified .
 * true if the scoped persistence unit name is used to prefix cache entries . */
@ Override public boolean doesScopedPersistenceUnitNameIdentifyCacheRegionName ( PersistenceUnitMetadata pu ) { } }

implementation: String cacheRegionPrefix = pu . getProperties ( ) . getProperty ( AvailableSettings . CACHE_REGION_PREFIX ) ; return cacheRegionPrefix == null || cacheRegionPrefix . equals ( pu . getScopedPersistenceUnitName ( ) ) ;


signature:
public class WSSubsystemAdd { /** * Process the model to figure out the name of the services the server config service has to depend on */
private static List < ServiceName > getServerConfigDependencies ( OperationContext context , boolean appclient ) { } }

implementation: final List < ServiceName > serviceNames = new ArrayList < ServiceName > ( ) ; final Resource subsystemResource = context . readResourceFromRoot ( PathAddress . pathAddress ( WSExtension . SUBSYSTEM_PATH ) , false ) ; readConfigServiceNames ( serviceNames , subsystemResource , Constants . CLIENT_CONFIG ) ; readConfigServiceNames ( serviceNames , subsystemResource , Constants . ENDPOINT_CONFIG ) ; if ( ! appclient ) { serviceNames . add ( CommonWebServer . SERVICE_NAME ) ; } return serviceNames ;


signature:
public class TrustedIdentityTokenLoginModule { /** * Validates the credential . Unfortunately there is not much we can do here by default .
 * This method can be overridden to provide some real validation logic
 * @ param username The username
 * @ param credential The SASCurrent . */
protected void validateCredential ( final String username , final SASCurrent credential ) throws LoginException { } }

implementation: if ( credential . get_incoming_principal_name ( ) == null || credential . get_incoming_principal_name ( ) . length == 0 ) { throw new LoginException ( ) ; }


signature:
public class EjbValidationsUtil { /** * Returns true if the passed < code > mdbClass < / code > meets the requirements set by the EJB3 spec about bean implementation
 * classes . The passed < code > mdbClass < / code > must not be an interface and must be public and not final and not abstract . If
 * it passes these requirements then this method returns true . Else it returns false .
 * @ param mdbClass The MDB class
 * @ return
 * @ throws DeploymentUnitProcessingException */
public static Collection < MdbValidityStatus > assertEjbClassValidity ( final ClassInfo mdbClass ) throws DeploymentUnitProcessingException { } }

implementation: Collection < MdbValidityStatus > mdbComplianceIssueList = new ArrayList < > ( MdbValidityStatus . values ( ) . length ) ; final String className = mdbClass . name ( ) . toString ( ) ; verifyModifiers ( className , mdbClass . flags ( ) , mdbComplianceIssueList ) ; for ( MethodInfo method : mdbClass . methods ( ) ) { if ( "onMessage" . equals ( method . name ( ) ) ) { verifyOnMessageMethod ( className , method . flags ( ) , mdbComplianceIssueList ) ; } if ( "finalize" . equals ( method . name ( ) ) ) { EjbLogger . DEPLOYMENT_LOGGER . mdbCantHaveFinalizeMethod ( className ) ; mdbComplianceIssueList . add ( MdbValidityStatus . MDB_SHOULD_NOT_HAVE_FINALIZE_METHOD ) ; } } return mdbComplianceIssueList ;


signature:
public class CorbaNamingContext { /** * This method needs to be called once to initialize the static fields orb and rootPoa .
 * @ param orb a reference to the running { @ code ORB } instance .
 * @ param rootPoa a reference to the root { @ code POA } . */
public static void init ( org . omg . CORBA . ORB orb , org . omg . PortableServer . POA rootPoa ) { } }

implementation: CorbaNamingContext . orb = orb ; CorbaNamingContext . rootPoa = rootPoa ;


signature:
public class CorbaNamingContext { /** * This method needs to be called for each newly created or re - read naming context to set its POA .
 * @ param poa a reference to the Naming Service { @ code POA } .
 * @ param doPurge a boolean that indicates if dead objects should be purged from the context ( { @ code true } ) upon cleanup
 * or not ( { @ code false } ) .
 * @ param noPing a boolean that indicates if the method { @ code resolve } should check if the resolved name or context is
 * alive before returning it . If { @ code false } , the name will be checked ( default ) */
public void init ( POA poa , boolean doPurge , boolean noPing ) { } }

implementation: this . poa = poa ; this . doPurge = doPurge ; this . noPing = noPing ;


signature:
public class CorbaNamingContext { /** * = = = = = NamingContextOperation Methods = = = = = / / */
public void bind ( NameComponent [ ] nc , org . omg . CORBA . Object obj ) throws NotFound , CannotProceed , InvalidName , AlreadyBound { } }

implementation:
if ( this . destroyed ) throw new CannotProceed ( ) ; if ( nc == null || nc . length == 0 ) throw new InvalidName ( ) ; if ( obj == null ) throw new org . omg . CORBA . BAD_PARAM ( ) ; Name n = new Name ( nc ) ; Name ctx = n . ctxName ( ) ; NameComponent nb = n . baseNameComponent ( ) ; if ( ctx == null ) { if ( this . names . containsKey ( n ) ) { // if the name is still in use , try to ping the object
org . omg . CORBA . Object ref = ( org . omg . CORBA . Object ) this . names . get ( n ) ; if ( isDead ( ref ) ) { rebind ( n . components ( ) , obj ) ; return ; } throw new AlreadyBound ( ) ; } else if ( this . contexts . containsKey ( n ) ) { // if the name is still in use , try to ping the object
org . omg . CORBA . Object ref = ( org . omg . CORBA . Object ) this . contexts . get ( n ) ; if ( isDead ( ref ) ) unbind ( n . components ( ) ) ; throw new AlreadyBound ( ) ; } if ( ( this . names . put ( n , obj ) ) != null ) throw new CannotProceed ( _this ( ) , n . components ( ) ) ; IIOPLogger . ROOT_LOGGER . debugf ( "Bound name: %s" , n ) ; } else { NameComponent [ ] ncx = new NameComponent [ ] { nb } ; org . omg . CORBA . Object context = this . resolve ( ctx . components ( ) ) ; // try first to call the context implementation object directly .
String contextOID = this . getObjectOID ( context ) ; CorbaNamingContext jbossContext = ( contextOID == null ? null : contextImpls . get ( contextOID ) ) ; if ( jbossContext != null ) jbossContext . bind ( ncx , obj ) ; else NamingContextExtHelper . narrow ( context ) . bind ( ncx , obj ) ; }


signature:
public class CorbaNamingContext { /** * = = = = = NamingContextExtOperations Methods = = = = = / / */
public org . omg . CORBA . Object resolve_str ( String n ) throws NotFound , CannotProceed , InvalidName { } }

implementation: return resolve ( to_name ( n ) ) ;


signature:
public class CorbaNamingContext { /** * Cleanup bindings , i . e . ping every object and remove bindings to non - existent objects . */
private void cleanup ( ) { } }

implementation:
// Check if object purging enabled
if ( ! this . doPurge ) return ; for ( Name key : this . names . keySet ( ) ) { if ( isDead ( ( ( org . omg . CORBA . Object ) this . names . get ( key ) ) ) ) { this . names . remove ( key ) ; } } for ( Name key : this . contexts . keySet ( ) ) { org . omg . CORBA . Object object = ( org . omg . CORBA . Object ) this . contexts . get ( key ) ; if ( isDead ( object ) ) { this . contexts . remove ( key ) ; String oid = this . getObjectOID ( object ) ; if ( oid != null ) contextImpls . remove ( oid ) ; } }


signature:
public class CorbaNamingContext { /** * Obtains the OID of the specified CORBA object .
 * @ param object the CORBA object whose OID is to be extracted .
 * @ return a { @ code String } representing the object OID or null if the method is unable to obtain the object OID . */
private String getObjectOID ( org . omg . CORBA . Object object ) { } }

implementation: String oid = null ; try { byte [ ] oidBytes = this . poa . reference_to_id ( object ) ; if ( oidBytes != null ) oid = new String ( oidBytes , StandardCharsets . UTF_8 ) ; } catch ( Exception e ) { IIOPLogger . ROOT_LOGGER . debug ( "Unable to obtain id from object" , e ) ; } return oid ;


signature:
public class CorbaNamingContext { /** * Determines if the supplied object is non _ existent
 * @ param o the CORBA object being verified .
 * @ return { @ code true } if the object is non - existent ; { @ code false } otherwise . */
private boolean isDead ( org . omg . CORBA . Object o ) { } }

implementation: boolean non_exist ; try { non_exist = o . _non_existent ( ) ; } catch ( org . omg . CORBA . SystemException e ) { non_exist = true ; } return non_exist ;


signature:
public class CorbaNamingContext { /** * Overrides writeObject in Serializable .
 * @ param out the { @ code OutputStream } where the objects will be written .
 * @ throws IOException if an error occurs while writing the objects to the stream . */
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { } }

implementation:
/* * For serialization , object references are transformed into strings */
for ( Name key : this . contexts . keySet ( ) ) { org . omg . CORBA . Object o = ( org . omg . CORBA . Object ) this . contexts . remove ( key ) ; this . contexts . put ( key , orb . object_to_string ( o ) ) ; } for ( Name key : this . names . keySet ( ) ) { org . omg . CORBA . Object o = ( org . omg . CORBA . Object ) this . names . remove ( key ) ; this . names . put ( key , orb . object_to_string ( o ) ) ; } out . defaultWriteObject ( ) ;


signature:
public class EJBReadWriteLock { /** * Ensures that the current thread doesn ' t hold any read locks . If
 * the thread holds any read locks , this method throws a { @ link javax . ejb . IllegalLoopbackException } . */
private void checkLoopback ( ) { } }

implementation: Integer current = readLockCount . get ( ) ; if ( current != null ) { assert current . intValue ( ) > 0 : "readLockCount is set, but to 0" ; throw EjbLogger . ROOT_LOGGER . failToUpgradeToWriteLock ( ) ; }


signature:
public class EJBReadWriteLock { /** * Decrements the read lock count held by the thread */
private void decReadLockCount ( ) { } }

implementation: Integer current = readLockCount . get ( ) ; int next ; assert current != null : "can't decrease, readLockCount is not set" ; next = current . intValue ( ) - 1 ; if ( next == 0 ) readLockCount . remove ( ) ; else readLockCount . set ( new Integer ( next ) ) ;


signature:
public class EJBReadWriteLock { /** * Increments the read lock count held by the thread */
private void incReadLockCount ( ) { } }

implementation: Integer current = readLockCount . get ( ) ; int next ; if ( current == null ) next = 1 ; else next = current . intValue ( ) + 1 ; readLockCount . set ( new Integer ( next ) ) ;


signature:
public class BeanDeploymentModule { /** * Makes all { @ link BeanDeploymentArchiveImpl } s in the given module accessible to all bdas in this module
 * @ param module The module to make accessible */
public synchronized void addBeanDeploymentModule ( BeanDeploymentModule module ) { } }

implementation: for ( BeanDeploymentArchiveImpl bda : beanDeploymentArchives ) { bda . addBeanDeploymentArchives ( module . beanDeploymentArchives ) ; }


signature:
public class BeanDeploymentModule { /** * Makes all { @ link BeanDeploymentArchiveImpl } s in the given modules accessible to all bdas in this module
 * @ param modules The modules to make accessible */
public synchronized void addBeanDeploymentModules ( Collection < BeanDeploymentModule > modules ) { } }

implementation: for ( BeanDeploymentArchiveImpl bda : beanDeploymentArchives ) { for ( BeanDeploymentModule bdm : modules ) { bda . addBeanDeploymentArchives ( bdm . beanDeploymentArchives ) ; } }


signature:
public class BeanDeploymentModule { /** * Adds a service to all bean deployment archives in the module
 * @ param clazz The service type
 * @ param service The service
 * @ param < S > The service type */
public synchronized < S extends Service > void addService ( Class < S > clazz , S service ) { } }

implementation: for ( BeanDeploymentArchiveImpl bda : beanDeploymentArchives ) { bda . getServices ( ) . add ( clazz , service ) ; }


signature:
public class SecurityContextInterceptor { /** * Sets the JACC contextID using a privileged action and returns the previousID from the { @ code PolicyContext } .
 * @ param contextID the JACC contextID to be set .
 * @ return the previous contextID as retrieved from the { @ code PolicyContext } . */
protected String setContextID ( final String contextID ) { } }

implementation: if ( ! WildFlySecurityManager . isChecking ( ) ) { final String previousID = PolicyContext . getContextID ( ) ; PolicyContext . setContextID ( contextID ) ; return previousID ; } else { final PrivilegedAction < String > action = new SetContextIDAction ( contextID ) ; return AccessController . doPrivileged ( action ) ; }


signature:
public class ProxyConfigurationServiceConfigurator { /** * FunctionalService # destroyer implementation */
@ Override public void accept ( ModClusterConfiguration modClusterConfiguration ) { } }

implementation: if ( advertiseSocketDependency != null ) { SocketBinding binding = advertiseSocketDependency . get ( ) ; ManagedBinding simpleManagedBinding = ManagedBinding . Factory . createSimpleManagedBinding ( binding ) ; binding . getSocketBindings ( ) . getNamedRegistry ( ) . unregisterBinding ( simpleManagedBinding ) ; }


signature:
public class WebValveDefinition { /** * { @ inheritDoc }
 * Registers an add operation handler or a remove operation handler if one was provided to the constructor . */
@ Override public void registerOperations ( ManagementResourceRegistration container ) { } }

implementation: super . registerOperations ( container ) ; container . registerOperationHandler ( ADD_PARAM , WebValveParamAdd . INSTANCE ) ; container . registerOperationHandler ( REMOVE_PARAM , ReloadRequiredRemoveStepHandler . INSTANCE ) ;


signature:
public class CalendarTimer { /** * Makes sure that the timer is only run once after being restored . */
public void handleRestorationCalculation ( ) { } }

implementation:
if ( nextExpiration == null ) { return ; } // next expiration in the future , we don ' t care
if ( nextExpiration . getTime ( ) >= System . currentTimeMillis ( ) ) { return ; } // just set the next expiration to 1ms in the past
// this means it will run to catch up the missed expiration
// and then the next calculated expiration will be in the future
nextExpiration = new Date ( System . currentTimeMillis ( ) - 1 ) ;


signature:
public class CalendarTimer { /** * Returns the { @ link java . lang . reflect . Method } , represented by the { @ link org . jboss . as . ejb3 . timerservice . persistence . TimeoutMethod }
 * Note : This method uses the { @ link Thread # getContextClassLoader ( ) } to load the
 * relevant classes while getting the { @ link java . lang . reflect . Method }
 * @ param timeoutMethodInfo The timeout method
 * @ param classLoader The class loader
 * @ return */
public static Method getTimeoutMethod ( TimeoutMethod timeoutMethodInfo , ClassLoader classLoader ) { } }

implementation:
if ( timeoutMethodInfo == null ) { return null ; } String declaringClass = timeoutMethodInfo . getDeclaringClass ( ) ; Class < ? > timeoutMethodDeclaringClass = null ; try { timeoutMethodDeclaringClass = Class . forName ( declaringClass , false , classLoader ) ; } catch ( ClassNotFoundException cnfe ) { throw EjbLogger . EJB3_TIMER_LOGGER . failToLoadDeclaringClassOfTimeOut ( declaringClass ) ; } String timeoutMethodName = timeoutMethodInfo . getMethodName ( ) ; String [ ] timeoutMethodParams = timeoutMethodInfo . getMethodParams ( ) ; // load the method param classes
Class < ? > [ ] timeoutMethodParamTypes = new Class < ? > [ ] { } ; if ( timeoutMethodParams != null ) { timeoutMethodParamTypes = new Class < ? > [ timeoutMethodParams . length ] ; int i = 0 ; for ( String paramClassName : timeoutMethodParams ) { Class < ? > methodParamClass = null ; try { methodParamClass = Class . forName ( paramClassName , false , classLoader ) ; } catch ( ClassNotFoundException cnfe ) { throw EjbLogger . EJB3_TIMER_LOGGER . failedToLoadTimeoutMethodParamClass ( cnfe , paramClassName ) ; } timeoutMethodParamTypes [ i ++ ] = methodParamClass ; } } // now start looking for the method
Class < ? > klass = timeoutMethodDeclaringClass ; while ( klass != null ) { Method [ ] methods = klass . getDeclaredMethods ( ) ; for ( Method method : methods ) { if ( method . getName ( ) . equals ( timeoutMethodName ) ) { Class < ? > [ ] methodParamTypes = method . getParameterTypes ( ) ; // param length doesn ' t match
if ( timeoutMethodParamTypes . length != methodParamTypes . length ) { continue ; } boolean match = true ; for ( int i = 0 ; i < methodParamTypes . length ; i ++ ) { // param type doesn ' t match
if ( ! timeoutMethodParamTypes [ i ] . equals ( methodParamTypes [ i ] ) ) { match = false ; break ; } } if ( match ) { // match found
return method ; } } } klass = klass . getSuperclass ( ) ; } // no match found
return null ;


signature:
public class ElytronCallbackHandler { /** * { @ inheritDoc } */
public void handle ( javax . security . auth . callback . Callback [ ] callbacks ) throws UnsupportedCallbackException , IOException { } }

implementation:
if ( SUBSYSTEM_RA_LOGGER . isTraceEnabled ( ) ) SUBSYSTEM_RA_LOGGER . elytronHandlerHandle ( Arrays . toString ( callbacks ) ) ; // work wrapper calls the callback handler a second time with default callback values after the handler was invoked
// by the RA . We must check if the execution subject already contains an identity and allow for replacement of the
// identity with values found in the default callbacks only if the subject has no identity yet or if the identity
// is the anonymous one .
if ( this . executionSubject != null ) { final SecurityIdentity subjectIdentity = this . getPrivateCredential ( this . executionSubject , SecurityIdentity . class ) ; if ( subjectIdentity != null && ! subjectIdentity . isAnonymous ( ) ) { return ; } } if ( callbacks != null && callbacks . length > 0 ) { if ( this . mappings != null && this . mappings . isMappingRequired ( ) ) { callbacks = this . mappings . mapCallbacks ( callbacks ) ; } GroupPrincipalCallback groupPrincipalCallback = null ; CallerPrincipalCallback callerPrincipalCallback = null ; PasswordValidationCallback passwordValidationCallback = null ; for ( javax . security . auth . callback . Callback callback : callbacks ) { if ( callback instanceof GroupPrincipalCallback ) { groupPrincipalCallback = ( GroupPrincipalCallback ) callback ; if ( this . executionSubject == null ) { this . executionSubject = groupPrincipalCallback . getSubject ( ) ; } else if ( ! this . executionSubject . equals ( groupPrincipalCallback . getSubject ( ) ) ) { // TODO merge the contents of the subjects ?
} } else if ( callback instanceof CallerPrincipalCallback ) { callerPrincipalCallback = ( CallerPrincipalCallback ) callback ; if ( this . executionSubject == null ) { this . executionSubject = callerPrincipalCallback . getSubject ( ) ; } else if ( ! this . executionSubject . equals ( callerPrincipalCallback . getSubject ( ) ) ) { // TODO merge the contents of the subjects ?
} } else if ( callback instanceof PasswordValidationCallback ) { passwordValidationCallback = ( PasswordValidationCallback ) callback ; if ( this . executionSubject == null ) { this . executionSubject = passwordValidationCallback . getSubject ( ) ; } else if ( ! this . executionSubject . equals ( passwordValidationCallback . getSubject ( ) ) ) { // TODO merge the contents of the subjects ?
} } else { throw new UnsupportedCallbackException ( callback ) ; } } this . handleInternal ( callerPrincipalCallback , groupPrincipalCallback , passwordValidationCallback ) ; }


signature:
public class ElytronCallbackHandler { /** * Authenticate the user with the given credential against the configured Elytron security domain .
 * @ param username the user being authenticated .
 * @ param credential the credential used as evidence to verify the user ' s identity .
 * @ return the authenticated and authorized { @ link SecurityIdentity } .
 * @ throws IOException if an error occurs while authenticating the user . */
private SecurityIdentity authenticate ( final String username , final char [ ] credential ) throws IOException { } }

implementation: final ServerAuthenticationContext context = this . securityDomain . createNewAuthenticationContext ( ) ; final PasswordGuessEvidence evidence = new PasswordGuessEvidence ( credential != null ? credential : null ) ; try { context . setAuthenticationName ( username ) ; if ( context . verifyEvidence ( evidence ) ) { if ( context . authorize ( ) ) { context . succeed ( ) ; return context . getAuthorizedIdentity ( ) ; } else { context . fail ( ) ; throw new SecurityException ( "Authorization failed" ) ; } } else { context . fail ( ) ; throw new SecurityException ( "Authentication failed" ) ; } } catch ( IllegalArgumentException | IllegalStateException | RealmUnavailableException e ) { context . fail ( ) ; throw e ; } finally { if ( ! context . isDone ( ) ) { context . fail ( ) ; } evidence . destroy ( ) ; }


signature:
public class PersistenceProviderAdaptorLoader { /** * Loads the persistence provider adapter
 * @ param adapterModule may specify the adapter module name ( can be null to use noop provider )
 * @ return the persistence provider adaptor for the provider class
 * @ throws ModuleLoadException */
public static PersistenceProviderAdaptor loadPersistenceAdapterModule ( final String adapterModule , final Platform platform , JtaManagerImpl manager ) throws ModuleLoadException { } }

implementation: final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; if ( adapterModule == null ) { return noopAdaptor ; } PersistenceProviderAdaptor persistenceProviderAdaptor = null ; Module module = moduleLoader . loadModule ( ModuleIdentifier . fromString ( adapterModule ) ) ; final ServiceLoader < PersistenceProviderAdaptor > serviceLoader = module . loadService ( PersistenceProviderAdaptor . class ) ; if ( serviceLoader != null ) { for ( PersistenceProviderAdaptor adaptor : serviceLoader ) { if ( persistenceProviderAdaptor != null ) { throw JpaLogger . ROOT_LOGGER . multipleAdapters ( adapterModule ) ; } persistenceProviderAdaptor = adaptor ; ROOT_LOGGER . debugf ( "loaded persistence provider adapter %s" , adapterModule ) ; } if ( persistenceProviderAdaptor != null ) { persistenceProviderAdaptor . injectJtaManager ( manager ) ; persistenceProviderAdaptor . injectPlatform ( platform ) ; } } return persistenceProviderAdaptor ;


signature:
public class PersistenceProviderAdaptorLoader { /** * Loads the persistence provider adapter
 * @ param persistenceProvider classloader will be used to load the persistence provider adapter
 * @ return the persistence provider adaptor for the provider class */
public static PersistenceProviderAdaptor loadPersistenceAdapter ( final PersistenceProvider persistenceProvider , final Platform platform , final JtaManagerImpl jtaManager ) { } }

implementation: PersistenceProviderAdaptor persistenceProviderAdaptor = null ; final ServiceLoader < PersistenceProviderAdaptor > serviceLoader = ServiceLoader . load ( PersistenceProviderAdaptor . class , persistenceProvider . getClass ( ) . getClassLoader ( ) ) ; if ( serviceLoader != null ) { for ( PersistenceProviderAdaptor adaptor : serviceLoader ) { if ( persistenceProviderAdaptor != null ) { throw JpaLogger . ROOT_LOGGER . classloaderHasMultipleAdapters ( persistenceProvider . getClass ( ) . getClassLoader ( ) . toString ( ) ) ; } persistenceProviderAdaptor = adaptor ; ROOT_LOGGER . debugf ( "loaded persistence provider adapter %s from classloader %s" , persistenceProviderAdaptor . getClass ( ) . getName ( ) , persistenceProvider . getClass ( ) . getClassLoader ( ) . toString ( ) ) ; } if ( persistenceProviderAdaptor != null ) { persistenceProviderAdaptor . injectJtaManager ( jtaManager ) ; persistenceProviderAdaptor . injectPlatform ( platform ) ; } } return persistenceProviderAdaptor == null ? noopAdaptor : persistenceProviderAdaptor ;


signature:
public class HibernateSearchProcessor { /** * if set to ` auto ` , will behave like not having set the property */
public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } }

implementation: final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ModuleSpecification moduleSpecification = deploymentUnit . getAttachment ( Attachments . MODULE_SPECIFICATION ) ; final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; if ( JPADeploymentMarker . isJPADeployment ( deploymentUnit ) ) { addSearchDependency ( moduleSpecification , moduleLoader , deploymentUnit ) ; }


signature:
public class TimerHandleImpl { /** * Returns the { @ link javax . ejb . Timer } corresponding to this timer handle
 * { @ inheritDoc } */
public Timer getTimer ( ) throws IllegalStateException , EJBException { } }

implementation:
if ( service == null ) { // get hold of the timer service through the use of timed object id
service = ( TimerServiceImpl ) currentServiceContainer ( ) . getRequiredService ( ServiceName . parse ( serviceName ) ) . getValue ( ) ; if ( service == null ) { throw EjbLogger . EJB3_TIMER_LOGGER . timerServiceWithIdNotRegistered ( timedObjectId ) ; } } final TimerImpl timer = this . service . getTimer ( this ) ; if ( timer == null || ! timer . isActive ( ) ) { throw EjbLogger . EJB3_TIMER_LOGGER . timerHandleIsNotActive ( this ) ; } return timer ;


signature:
public class WeldDeployment { /** * { @ link org . jboss . as . weld . deployment . processors . WeldDeploymentProcessor } assembles a basic accessibility graph based on
 * the deployment structure . Here , we complete the graph by examining classloader visibility . This allows additional
 * accessibility edges caused e . g . by the Class - Path declaration in the manifest file , to be recognized .
 * @ param beanDeploymentArchives */
private void calculateAccessibilityGraph ( Iterable < BeanDeploymentArchiveImpl > beanDeploymentArchives ) { } }

implementation: for ( BeanDeploymentArchiveImpl from : beanDeploymentArchives ) { for ( BeanDeploymentArchiveImpl target : beanDeploymentArchives ) { if ( from . isAccessible ( target ) ) { from . addBeanDeploymentArchive ( target ) ; } } }


signature:
public class WeldDeployment { /** * Adds additional edges to the accessibility graph that allow static CDI - enabled modules to inject beans from top - level deployment units */
private void makeTopLevelBdasVisibleFromStaticModules ( ) { } }

implementation: for ( BeanDeploymentArchiveImpl bda : beanDeploymentArchives ) { if ( bda . getBeanArchiveType ( ) . equals ( BeanDeploymentArchiveImpl . BeanArchiveType . EXTERNAL ) || bda . getBeanArchiveType ( ) . equals ( BeanDeploymentArchiveImpl . BeanArchiveType . SYNTHETIC ) ) { for ( BeanDeploymentArchiveImpl topLevelBda : rootBeanDeploymentModule . getBeanDeploymentArchives ( ) ) { bda . addBeanDeploymentArchive ( topLevelBda ) ; } } }


signature:
public class WeldDeployment { /** * { @ inheritDoc } */
public synchronized BeanDeploymentArchive loadBeanDeploymentArchive ( final Class < ? > beanClass ) { } }

implementation:
final BeanDeploymentArchive bda = this . getBeanDeploymentArchive ( beanClass ) ; if ( bda != null ) { return bda ; } Module module = Module . forClass ( beanClass ) ; if ( module == null ) { // Bean class loaded by the bootstrap class loader
if ( bootstrapClassLoaderBeanDeploymentArchive == null ) { bootstrapClassLoaderBeanDeploymentArchive = createAndRegisterAdditionalBeanDeploymentArchive ( module , beanClass ) ; } else { bootstrapClassLoaderBeanDeploymentArchive . addBeanClass ( beanClass ) ; } return bootstrapClassLoaderBeanDeploymentArchive ; } /* * No , there is no BDA for the class yet . Let ' s create one . */
return createAndRegisterAdditionalBeanDeploymentArchive ( module , beanClass ) ;