idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
36,000
private void clearAllHeaders ( ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; if ( bTrace && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "clearAllHeaders()" ) ; } HeaderElement elem = this . hdrSequence ; while ( null != elem ) { final HeaderElement next = elem . nextSequence ; final HeaderKeys key = elem . getKey ( ) ; final int ord = key . getOrdinal ( ) ; if ( storage . containsKey ( ord ) ) { if ( key . useFilters ( ) ) { filterRemove ( key , null ) ; } storage . remove ( ord ) ; } elem . destroy ( ) ; elem = next ; } this . hdrSequence = null ; this . lastHdrInSequence = null ; this . numberOfHeaders = 0 ; if ( bTrace && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "clearAllHeaders()" ) ; } }
Clear all traces of the headers from storage .
36,001
public void removeSpecialHeader ( HeaderKeys key ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "removeSpecialHeader(h): " + key . getName ( ) ) ; } removeHdrInstances ( findHeader ( key ) , FILTER_NO ) ; }
Remove all instances of a special header that does not require the headerkey filterRemove method to be called .
36,002
public WsByteBuffer returnCurrentBuffer ( ) { WsByteBuffer buff = null ; if ( HeaderStorage . NOTSET != this . parseIndex ) { buff = this . parseBuffers [ this . parseIndex ] ; this . parseIndex -- ; } return buff ; }
Method to remove the current parsing buffer from this object s ownership so it can be used by others .
36,003
private void createSingleHeader ( HeaderKeys key , byte [ ] value , int offset , int length ) { HeaderElement elem = findHeader ( key ) ; if ( null != elem ) { if ( null != elem . nextInstance ) { HeaderElement temp = elem . nextInstance ; while ( null != temp ) { temp . remove ( ) ; temp = temp . nextInstance ; } } if ( HeaderStorage . NOTSET != this . headerChangeLimit ) { if ( length <= elem . getValueLength ( ) ) { this . headerChangeCount ++ ; elem . setByteArrayValue ( value , offset , length ) ; } else { elem . remove ( ) ; elem = null ; } } else { elem . setByteArrayValue ( value , offset , length ) ; } } if ( null == elem ) { elem = getElement ( key ) ; elem . setByteArrayValue ( value , offset , length ) ; addHeader ( elem , FILTER_NO ) ; } else if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Replacing header " + key . getName ( ) + " [" + elem . getDebugValue ( ) + "]" ) ; } }
Utility method to create a single header instance with the given information . If elements already exist this will delete secondary ones and overlay the value on the first element .
36,004
private void addHeader ( HeaderElement elem , boolean bFilter ) { final HeaderKeys key = elem . getKey ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Adding header [" + key . getName ( ) + "] with value [" + elem . getDebugValue ( ) + "]" ) ; } if ( getRemoteIp ( ) && key . getName ( ) . toLowerCase ( ) . startsWith ( "x-forwarded" ) && ! forwardHeaderErrorState ) { processForwardedHeader ( elem , true ) ; } else if ( getRemoteIp ( ) && key . getName ( ) . toLowerCase ( ) . startsWith ( "forwarded" ) && ! forwardHeaderErrorState ) { processForwardedHeader ( elem , false ) ; } if ( bFilter ) { if ( key . useFilters ( ) && ! filterAdd ( key , elem . asBytes ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "filter disallowed: " + elem . getDebugValue ( ) ) ; } return ; } } if ( HttpHeaderKeys . isWasPrivateHeader ( key . getName ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "checking to see if private header is allowed: " + key . getName ( ) ) ; } if ( ! filterAdd ( key , elem . asBytes ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , key . getName ( ) + " is not trusted for this host; not adding header" ) ; } return ; } } incrementHeaderCounter ( ) ; HeaderElement root = findHeader ( key ) ; boolean rc = addInstanceOfElement ( root , elem ) ; if ( rc ) { final int ord = key . getOrdinal ( ) ; storage . put ( ord , elem ) ; } }
Add this new instance of a header to storage .
36,005
private HeaderElement findHeader ( HeaderKeys key , int instance ) { final int ord = key . getOrdinal ( ) ; if ( ! storage . containsKey ( ord ) && ord <= HttpHeaderKeys . ORD_MAX ) { return null ; } HeaderElement elem = null ; if ( ord > HttpHeaderKeys . ORD_MAX ) { for ( HeaderElement header : storage . values ( ) ) { if ( header . getKey ( ) . getName ( ) . equals ( key . getName ( ) ) ) { elem = header ; break ; } } } else { elem = storage . get ( ord ) ; } int i = - 1 ; while ( null != elem ) { if ( ! elem . wasRemoved ( ) ) { if ( ++ i == instance ) { return elem ; } } elem = elem . nextInstance ; } return null ; }
Find the specific instance of this header in storage .
36,006
private void removeHdr ( HeaderElement elem ) { if ( null == elem ) { return ; } HeaderKeys key = elem . getKey ( ) ; elem . remove ( ) ; if ( key . useFilters ( ) ) { filterRemove ( key , elem . asBytes ( ) ) ; } }
Remove this single instance of a header .
36,007
private void removeHdrInstances ( HeaderElement root , boolean bFilter ) { if ( null == root ) { return ; } HeaderKeys key = root . getKey ( ) ; if ( bFilter && key . useFilters ( ) ) { filterRemove ( key , null ) ; } HeaderElement elem = root ; while ( null != elem ) { elem . remove ( ) ; elem = elem . nextInstance ; } }
Remove all instances of this header .
36,008
protected void setSpecialHeader ( HeaderKeys key , byte [ ] value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "setSpecialHeader(h,b[]): " + key . getName ( ) ) ; } removeHdrInstances ( findHeader ( key ) , FILTER_NO ) ; HeaderElement elem = getElement ( key ) ; elem . setByteArrayValue ( value ) ; addHeader ( elem , FILTER_NO ) ; }
Set one of the special headers that does not require the headerkey filterX methods to be called .
36,009
public void setHeaderChangeLimit ( int limit ) { this . headerChangeLimit = limit ; this . bOverChangeLimit = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Setting header change limit to " + limit ) ; } }
Set the limit on the number of allowed header changes before this message must be remarshalled .
36,010
public WsByteBuffer allocateBuffer ( int size ) { WsByteBufferPoolManager mgr = HttpDispatcher . getBufferManager ( ) ; WsByteBuffer wsbb = ( this . useDirectBuffer ) ? mgr . allocateDirect ( size ) : mgr . allocate ( size ) ; addToCreatedBuffer ( wsbb ) ; return wsbb ; }
Allocate a buffer according to the requested input size .
36,011
public void setDebugContext ( Object o ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "debugContext set to " + o + " for " + this ) ; } if ( null != o ) { this . debugContext = o ; } }
Allow the debug context object to be set to the input Object for more specialized debugging . A null input object will be ignored .
36,012
private void incrementHeaderCounter ( ) { this . numberOfHeaders ++ ; this . headerAddCount ++ ; if ( this . limitNumHeaders < this . numberOfHeaders ) { String msg = "Too many headers in storage: " + this . numberOfHeaders ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , msg ) ; } throw new IllegalArgumentException ( msg ) ; } }
Increment the number of headers in storage counter by one . If this puts it over the limit for the message then an exception is thrown .
36,013
private void checkHeaderValue ( byte [ ] data , int offset , int length ) { int index = ( offset + length ) - 1 ; if ( index < 0 ) { return ; } String error = null ; if ( BNFHeaders . LF == data [ index ] || BNFHeaders . CR == data [ index ] ) { error = "Illegal trailing EOL" ; } for ( int i = offset ; null == error && i < index ; i ++ ) { if ( BNFHeaders . CR == data [ i ] ) { if ( BNFHeaders . LF != data [ i + 1 ] ) { error = "Invalid CR not followed by LF" ; } else if ( getCharacterValidation ( ) ) { data [ i ] = BNFHeaders . SPACE ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found a CR replacing it with a SP" ) ; } } } else if ( BNFHeaders . LF == data [ i ] ) { if ( BNFHeaders . TAB != data [ i + 1 ] && BNFHeaders . SPACE != data [ i + 1 ] ) { error = "Invalid LF not followed by whitespace" ; } else if ( getCharacterValidation ( ) ) { data [ i ] = BNFHeaders . SPACE ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found a LF replacing it with a SP" ) ; } } } } if ( null != error ) { IllegalArgumentException iae = new IllegalArgumentException ( error ) ; FFDCFilter . processException ( iae , getClass ( ) . getName ( ) + ".checkHeaderValue(byte[])" , "1" , this ) ; throw iae ; } }
Check the input header value for validity starting at the offset and continuing for the input length of characters .
36,014
private void checkHeaderValue ( String data ) { int index = data . length ( ) - 1 ; if ( index < 0 ) { return ; } String error = null ; char c = data . charAt ( index ) ; if ( BNFHeaders . LF == c || BNFHeaders . CR == c ) { error = "Illegal trailing EOL" ; } for ( int i = 0 ; null == error && i < index ; i ++ ) { c = data . charAt ( i ) ; if ( BNFHeaders . CR == c ) { if ( BNFHeaders . LF != data . charAt ( i + 1 ) ) { error = "Invalid CR not followed by LF" ; } } else if ( BNFHeaders . LF == c ) { c = data . charAt ( ++ i ) ; if ( BNFHeaders . TAB != c && BNFHeaders . SPACE != c ) { error = "Invalid LF not followed by whitespace" ; } } } if ( null != error ) { IllegalArgumentException iae = new IllegalArgumentException ( error ) ; FFDCFilter . processException ( iae , getClass ( ) . getName ( ) + ".checkHeaderValue(String)" , "1" , this ) ; throw iae ; } }
Check the input header value for validity .
36,015
private int countInstances ( HeaderElement root ) { int count = 0 ; HeaderElement elem = root ; while ( null != elem ) { if ( ! elem . wasRemoved ( ) ) { count ++ ; } elem = elem . nextInstance ; } return count ; }
Count the number of instances of this header starting at the given element .
36,016
private boolean skipWhiteSpace ( WsByteBuffer buff ) { byte b ; do { if ( this . bytePosition >= this . byteLimit ) { if ( ! fillByteCache ( buff ) ) { return false ; } } b = this . byteCache [ this . bytePosition ++ ] ; } while ( BNFHeaders . SPACE == b || BNFHeaders . TAB == b ) ; this . bytePosition -- ; return true ; }
Skip any whitespace that might be at the start of this buffer .
36,017
private boolean addInstanceOfElement ( HeaderElement root , HeaderElement elem ) { if ( null == this . hdrSequence ) { this . hdrSequence = elem ; this . lastHdrInSequence = elem ; } else { this . lastHdrInSequence . nextSequence = elem ; elem . prevSequence = this . lastHdrInSequence ; this . lastHdrInSequence = elem ; } if ( null == root ) { return true ; } HeaderElement prev = root ; while ( null != prev . nextInstance ) { prev = prev . nextInstance ; } prev . nextInstance = elem ; return false ; }
Helper method to add a new instance of a HeaderElement to root s internal list . This might be the first instance or an additional instance in which case it will be added at the end of the list .
36,018
protected WsByteBuffer [ ] putInt ( int data , WsByteBuffer [ ] buffers ) { return putBytes ( GenericUtils . asBytes ( data ) , buffers ) ; }
Place the input int value into the outgoing cache . This will return the buffer array as it may have changed if the cache need to be flushed .
36,019
protected WsByteBuffer [ ] flushCache ( WsByteBuffer [ ] buffers ) { int pos = this . bytePosition ; if ( 0 == pos ) { return buffers ; } this . bytePosition = 0 ; return GenericUtils . putByteArray ( buffers , this . byteCache , 0 , pos , this ) ; }
Method to flush whatever is in the cache into the input buffers . These buffers are then returned to the caller as the flush may have needed to expand the list .
36,020
final protected void decrementBytePositionIgnoringLFs ( ) { this . bytePosition -- ; if ( BNFHeaders . LF == this . byteCache [ this . bytePosition ] ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "decrementILF found an LF character" ) ; } this . bytePosition ++ ; } }
Decrement the byte position unless it points to an LF character in which case just leave the byte position alone .
36,021
final protected void resetCacheToken ( int len ) { if ( null == this . parsedToken || len != this . parsedToken . length ) { this . parsedToken = new byte [ len ] ; } this . parsedTokenLength = 0 ; }
Reset the parse byte token based on the input length . If the existing array is the same size then this is a simple reset . This is intended to only be used when the contents have already been extracted and can be overwritten with new data .
36,022
final protected boolean fillCacheToken ( WsByteBuffer buff ) { int curr_len = this . parsedTokenLength ; int need_len = this . parsedToken . length - curr_len ; int copy_len = need_len ; while ( 0 < need_len ) { if ( this . bytePosition >= this . byteLimit ) { if ( ! fillByteCache ( buff ) ) { this . parsedTokenLength = curr_len ; return false ; } } int available = this . byteLimit - this . bytePosition ; if ( available < need_len ) { copy_len = available ; } else { copy_len = need_len ; } System . arraycopy ( this . byteCache , this . bytePosition , this . parsedToken , curr_len , copy_len ) ; need_len -= copy_len ; curr_len += copy_len ; this . bytePosition += copy_len ; } return true ; }
Method to fill the parse token from the given input buffer . The token array must have been created prior to this attempt to fill it .
36,023
protected boolean fillByteCache ( WsByteBuffer buff ) { if ( this . bytePosition < this . byteLimit ) { return false ; } int size = buff . remaining ( ) ; if ( size > this . byteCacheSize ) { size = this . byteCacheSize ; } this . bytePosition = 0 ; this . byteLimit = size ; if ( 0 == this . byteLimit ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "fillByteCache: no data" ) ; } return false ; } if ( HeaderStorage . NOTSET != this . headerChangeLimit && - 1 != this . parseIndex && - 1 == this . parseBuffersStartPos [ this . parseIndex ] ) { this . parseBuffersStartPos [ this . parseIndex ] = buff . position ( ) ; } buff . get ( this . byteCache , this . bytePosition , this . byteLimit ) ; return true ; }
Fills the byte cache .
36,024
protected TokenCodes findCRLFTokenLength ( WsByteBuffer buff ) throws MalformedMessageException { TokenCodes rc = TokenCodes . TOKEN_RC_MOREDATA ; if ( null == buff ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Null buffer provided" ) ; } return rc ; } int length = this . parsedTokenLength ; byte b ; while ( true ) { if ( this . bytePosition >= this . byteLimit ) { if ( ! fillByteCache ( buff ) ) { break ; } } b = this . byteCache [ this . bytePosition ++ ] ; if ( BNFHeaders . CR == b ) { rc = TokenCodes . TOKEN_RC_DELIM ; if ( HeaderStorage . NOTSET != this . headerChangeLimit ) { this . lastCRLFPosition = findCurrentBufferPosition ( buff ) - 1 ; this . lastCRLFBufferIndex = this . parseIndex ; this . lastCRLFisCR = true ; } break ; } else if ( BNFHeaders . LF == b ) { rc = TokenCodes . TOKEN_RC_DELIM ; this . numCRLFs = 1 ; if ( HeaderStorage . NOTSET != this . headerChangeLimit ) { this . lastCRLFPosition = findCurrentBufferPosition ( buff ) - 1 ; this . lastCRLFBufferIndex = this . parseIndex ; this . lastCRLFisCR = false ; } break ; } length ++ ; if ( length > this . limitTokenSize ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "findCRLFTokenLength: length is too big: " + length ) ; } throw new MalformedMessageException ( "Token length: " + length ) ; } } this . parsedTokenLength = length ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "findCRLFTokenLength returning " + rc . getName ( ) + "; len=" + length ) ; } return rc ; }
Parse a CRLF delimited token and return the length of the token .
36,025
protected TokenCodes skipCRLFs ( WsByteBuffer buffer ) { int maxCRLFs = 33 ; if ( this . bytePosition >= this . byteLimit ) { if ( ! fillByteCache ( buffer ) ) { return TokenCodes . TOKEN_RC_MOREDATA ; } } byte b = this . byteCache [ this . bytePosition ++ ] ; for ( int i = 0 ; i < maxCRLFs ; i ++ ) { if ( - 1 == b ) { return TokenCodes . TOKEN_RC_MOREDATA ; } if ( BNFHeaders . CR != b && BNFHeaders . LF != b ) { this . bytePosition -- ; return TokenCodes . TOKEN_RC_DELIM ; } if ( this . bytePosition >= this . byteLimit ) { return TokenCodes . TOKEN_RC_MOREDATA ; } b = this . byteCache [ this . bytePosition ++ ] ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Too many leading CRLFs found" ) ; } return TokenCodes . TOKEN_RC_CRLF ; }
This method is used to skip leading CRLF characters . It will stop when it finds a non - CRLF character runs out of data or finds too many CRLFs
36,026
protected TokenCodes findHeaderLength ( WsByteBuffer buff ) throws MalformedMessageException { TokenCodes rc = TokenCodes . TOKEN_RC_MOREDATA ; if ( null == buff ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "findHeaderLength: null buffer provided" ) ; } return rc ; } byte b ; int numSpaces = 0 ; int length = this . parsedTokenLength ; while ( true ) { if ( this . bytePosition >= this . byteLimit ) { if ( ! fillByteCache ( buff ) ) { break ; } } b = this . byteCache [ this . bytePosition ++ ] ; if ( BNFHeaders . COLON == b ) { length -= numSpaces ; if ( numSpaces > 0 ) { this . foundTrailingWhitespace = true ; } rc = TokenCodes . TOKEN_RC_DELIM ; break ; } if ( BNFHeaders . SPACE == b || BNFHeaders . TAB == b ) { numSpaces ++ ; } else { numSpaces = 0 ; } if ( BNFHeaders . CR == b || BNFHeaders . LF == b ) { throw new MalformedMessageException ( "Invalid CRLF found in header name" ) ; } length ++ ; if ( length > this . limitTokenSize ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "findTokenLength: length is too big: " + length ) ; } throw new MalformedMessageException ( "Token length: " + length ) ; } } this . parsedTokenLength = length ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "findHeaderLength: " + rc . getName ( ) + "; len=" + length ) ; } return rc ; }
Parse a byte delimited token and return the length of the token .
36,027
private boolean parseHeaderName ( WsByteBuffer buff ) throws MalformedMessageException { if ( null == this . parsedToken ) { if ( ! skipWhiteSpace ( buff ) ) { return false ; } } int start = findCurrentBufferPosition ( buff ) ; int cachestart = this . bytePosition ; TokenCodes rc = findHeaderLength ( buff ) ; if ( TokenCodes . TOKEN_RC_MOREDATA . equals ( rc ) ) { saveParsedToken ( buff , start , false , LOG_FULL ) ; return false ; } byte [ ] data ; int length = this . parsedTokenLength ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "length=" + length + " pos=" + this . bytePosition + ", cachestart=" + cachestart + ", start=" + start + ", trailingWhitespace=" + this . foundTrailingWhitespace ) ; } if ( ! this . foundTrailingWhitespace && null == this . parsedToken && length < this . bytePosition ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Using bytecache" ) ; } data = this . byteCache ; start = cachestart ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Using bytebuffer" ) ; } saveParsedToken ( buff , start , true , LOG_FULL ) ; data = this . parsedToken ; start = 0 ; length = data . length ; } this . currentElem = getElement ( findKey ( data , start , length ) ) ; if ( HeaderStorage . NOTSET != this . headerChangeLimit ) { this . currentElem . updateLastCRLFInfo ( this . lastCRLFBufferIndex , this . lastCRLFPosition , this . lastCRLFisCR ) ; } this . stateOfParsing = PARSING_VALUE ; this . parsedToken = null ; this . parsedTokenLength = 0 ; this . foundTrailingWhitespace = false ; return true ; }
Utility method to parse the header name from the input buffer .
36,028
private boolean parseHeaderValueExtract ( WsByteBuffer buff ) throws MalformedMessageException { int log = LOG_FULL ; HeaderKeys key = this . currentElem . getKey ( ) ; if ( null != key && ! key . shouldLogValue ( ) ) { log = LOG_NONE ; } TokenCodes tcRC = parseCRLFTokenExtract ( buff , log ) ; if ( ! tcRC . equals ( TokenCodes . TOKEN_RC_MOREDATA ) ) { setHeaderValue ( ) ; this . parsedToken = null ; this . currentElem = null ; this . stateOfParsing = PARSING_CRLF ; return true ; } return false ; }
Utility method for parsing a header value out of the input buffer .
36,029
protected int parseTokenNonExtract ( WsByteBuffer buff , byte bDelimiter , boolean bApproveCRLF ) throws MalformedMessageException { TokenCodes rc = findTokenLength ( buff , bDelimiter , bApproveCRLF ) ; return ( TokenCodes . TOKEN_RC_MOREDATA . equals ( rc ) ) ? - 1 : this . parsedTokenLength ; }
Standard parsing of a token ; however instead of saving the data into the global parsedToken variable this merely returns the length of the token . Used for occasions where we just need to find the length of the token .
36,030
private void saveParsedToken ( WsByteBuffer buff , int start , boolean delim , int log ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; int length = this . parsedTokenLength ; this . parsedTokenLength = 0 ; if ( 0 > length ) { throw new IllegalArgumentException ( "Negative token length: " + length ) ; } if ( bTrace && tc . isDebugEnabled ( ) ) { String value = GenericUtils . getEnglishString ( this . parsedToken ) ; if ( null != value ) { if ( LOG_PARTIAL == log ) { value = GenericUtils . nullOutPasswords ( value , LF ) ; } else if ( LOG_NONE == log ) { value = GenericUtils . blockContents ( value ) ; } } Tr . debug ( tc , "Saving token: " + value + " len:" + length + " start:" + start + " pos:" + this . bytePosition + " delim:" + delim ) ; } byte [ ] temp ; int offset ; if ( null != this . parsedToken ) { offset = this . parsedToken . length ; temp = new byte [ offset + length ] ; System . arraycopy ( this . parsedToken , 0 , temp , 0 , offset ) ; } else { offset = 0 ; temp = new byte [ length ] ; } if ( ! this . foundTrailingWhitespace && this . bytePosition > length ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "savedParsedToken - using bytecache" ) ; } int cacheStart = this . bytePosition - length ; if ( delim ) { cacheStart -- ; } System . arraycopy ( this . byteCache , cacheStart , temp , offset , length ) ; } else { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "savedParsedToken - pulling from buffer" ) ; } int orig = buff . position ( ) ; buff . position ( start ) ; buff . get ( temp , offset , length ) ; buff . position ( orig ) ; } this . parsedToken = temp ; if ( bTrace && tc . isDebugEnabled ( ) ) { String value = GenericUtils . getEnglishString ( this . parsedToken ) ; if ( LOG_PARTIAL == log ) { value = GenericUtils . nullOutPasswords ( value , LF ) ; } else if ( LOG_NONE == log ) { value = GenericUtils . blockContents ( value ) ; } Tr . debug ( tc , "Saved token [" + value + "]" ) ; } }
Sets the temporary parse token from the input buffer .
36,031
public void parsedCompactHeader ( boolean flag ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "parsedCompactHeader: " + flag ) ; } this . compactHeaderFlag = flag ; }
Sets the flag indicating that a SIP compact header has been parsed .
36,032
void finishAlarmThread ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "finishAlarmThread" ) ; synchronized ( wakeupLock ) { finished = true ; wakeupLock . notify ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "finishAlarmThread" ) ; }
Terminate this alarm thread . This is final the thread should not be restarted .
36,033
public void run ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "run" ) ; try { while ( ! finished ) { long now = System . currentTimeMillis ( ) ; boolean fire = false ; synchronized ( wakeupLock ) { if ( running ) { fire = ( now >= nextWakeup ) ; } } if ( fire ) { manager . fireInternalAlarm ( ) ; synchronized ( wakeupLock ) { setNextWakeup ( manager . getNextWakeup ( ) ) ; } } synchronized ( wakeupLock ) { if ( running ) { if ( wakeupDelta > 0 ) { try { if ( ! finished ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Thread wait : " + wakeupDelta ) ; long start = System . currentTimeMillis ( ) ; wakeupLock . wait ( wakeupDelta + 10 ) ; long end = System . currentTimeMillis ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Thread slept for " + ( end - start ) ) ; if ( end < nextWakeup ) setNextWakeup ( nextWakeup ) ; } } catch ( InterruptedException e ) { } } } else { try { if ( ! finished ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Thread wait : Inifinite" ) ; wakeupLock . wait ( ) ; } } catch ( InterruptedException e ) { } } } } } catch ( RuntimeException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.utils.am.MPAlarmThread.run" , "1:284:1.8.1.7" , this ) ; SibTr . error ( tc , nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.utils.am.MPAlarmThread" , "1:290:1.8.1.7" , e } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exception ( tc , e ) ; SibTr . exit ( tc , "run" , e ) ; } throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "run" ) ; }
The main loop for the MPAlarmThread . Loops until the alarm thread is marked as finished . If the alarm thread is suspended it will wait forever . Otherwise the it will wait inside the loop until a specified time and then call the MPAlarmManager . fireInternalAlarm method .
36,034
public boolean startInactivityTimer ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "startInactivityTimer" ) ; if ( _inactivityTimeout > 0 && _status . getState ( ) == TransactionState . STATE_ACTIVE && ! _inactivityTimerActive ) { EmbeddableTimeoutManager . setTimeout ( this , EmbeddableTimeoutManager . INACTIVITY_TIMEOUT , _inactivityTimeout ) ; _inactivityTimerActive = true ; _mostRecentThread . pop ( ) ; } if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "startInactivityTimer" , _inactivityTimerActive ) ; return _inactivityTimerActive ; }
Start an inactivity timer and call alarm method of parameter when timeout expires .
36,035
public void rollbackResources ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "rollbackResources" ) ; try { final Transaction t = ( ( EmbeddableTranManagerSet ) TransactionManagerFactory . getTransactionManager ( ) ) . suspend ( ) ; getResources ( ) . rollbackResources ( ) ; if ( t != null ) ( ( EmbeddableTranManagerSet ) TransactionManagerFactory . getTransactionManager ( ) ) . resume ( t ) ; } catch ( Exception ex ) { FFDCFilter . processException ( ex , "com.ibm.tx.jta.impl.EmbeddableTransactionImpl.rollbackResources" , "104" , this ) ; if ( traceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception caught from rollbackResources()" , ex ) ; } if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "rollbackResources" ) ; }
Rollback all resources but do not drive state changes . Used when transaction HAS TIMED OUT .
36,036
public synchronized void stopInactivityTimer ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "stopInactivityTimer" ) ; if ( _inactivityTimerActive ) { _inactivityTimerActive = false ; EmbeddableTimeoutManager . setTimeout ( this , EmbeddableTimeoutManager . INACTIVITY_TIMEOUT , 0 ) ; } _mostRecentThread . push ( Thread . currentThread ( ) ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "stopInactivityTimer" ) ; }
Stop inactivity timer associated with transaction . This method needs to be synchronized to serialize with inactivity timeout . If the timeout runs after this method then there will be no _inactivityTimer to call and the context will be on_server . If the timeout runs before then a subsequent resume will fail as the transaction will be rolled back .
36,037
public void resumeAssociation ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "resumeAssociation" ) ; resumeAssociation ( true ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "resumeAssociation" ) ; }
Called by interceptor when incoming reply arrives . This polices the single threaded operation of the transaction .
36,038
public synchronized void resumeAssociation ( boolean allowSetRollback ) throws TRANSACTION_ROLLEDBACK { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "resumeAssociation" , allowSetRollback ) ; boolean doSetRollback = false ; while ( _activeAssociations > _suspendedAssociations ) { doSetRollback = allowSetRollback ; try { if ( doSetRollback && ! _rollbackOnly ) setRollbackOnly ( ) ; } catch ( Exception ex ) { FFDCFilter . processException ( ex , "com.ibm.ws.Transaction.JTA.TransactionImpl.resumeAssociation" , "1748" , this ) ; if ( traceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setRollbackOnly threw exception" , ex ) ; } try { wait ( ) ; } catch ( InterruptedException iex ) { } } _suspendedAssociations -- ; if ( doSetRollback ) { if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "resumeAssociation throwing rolledback" ) ; throw new TRANSACTION_ROLLEDBACK ( "Context already active" ) ; } if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "resumeAssociation" ) ; }
This polices the single threaded operation of the transaction . allowSetRollback indicates whether the condition where there is already an active association should result in rolling back the transaction .
36,039
public synchronized void addAssociation ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addAssociation" ) ; if ( _activeAssociations > _suspendedAssociations ) { if ( traceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "addAssociation received incoming request for active context" ) ; try { setRollbackOnly ( ) ; } catch ( Exception ex ) { FFDCFilter . processException ( ex , "com.ibm.ws.Transaction.JTA.TransactionImpl.addAssociation" , "1701" , this ) ; if ( traceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setRollbackOnly threw exception" , ex ) ; } if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addAssociation throwing rolledback" ) ; throw new TRANSACTION_ROLLEDBACK ( "Context already active" ) ; } stopInactivityTimer ( ) ; _activeAssociations ++ ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addAssociation" ) ; }
Called by interceptor when incoming request arrives . This polices the single threaded operation of the transaction .
36,040
public synchronized void removeAssociation ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "removeAssociation" ) ; _activeAssociations -- ; if ( _activeAssociations <= 0 ) { startInactivityTimer ( ) ; } else { _mostRecentThread . pop ( ) ; } notifyAll ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeAssociation" ) ; }
Called by interceptor when reply is sent . This updates the server association count for this context .
36,041
public void enlistAsyncResource ( String xaResFactoryFilter , Serializable xaResInfo , Xid xid ) throws SystemException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "enlistAsyncResource (SPI): args: " , new Object [ ] { xaResFactoryFilter , xaResInfo , xid } ) ; try { final WSATAsyncResource res = new WSATAsyncResource ( xaResFactoryFilter , xaResInfo , xid ) ; final WSATParticipantWrapper wrapper = new WSATParticipantWrapper ( res ) ; getResources ( ) . addAsyncResource ( wrapper ) ; } finally { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistAsyncResource (SPI)" ) ; } }
Enlist an asynchronous resource with the target TransactionImpl object . A WSATParticipantWrapper is typically a representation of a downstream WSAT subordinate server .
36,042
public synchronized void inactivityTimeout ( ) { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "inactivityTimeout" , this ) ; _inactivityTimerActive = false ; if ( _inactivityTimer != null ) { try { _inactivityTimer . alarm ( ) ; } catch ( Throwable exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.tx.jta.TransactionImpl.inactivityTimeout" , "2796" , this ) ; if ( traceOn && tc . isEventEnabled ( ) ) Tr . event ( tc , "exception caught in inactivityTimeout" , exc ) ; } finally { _inactivityTimer = null ; } } else { if ( _activeAssociations <= 0 ) { final EmbeddableTranManagerSet tranManager = ( EmbeddableTranManagerSet ) TransactionManagerFactory . getTransactionManager ( ) ; try { tranManager . resume ( this ) ; try { tranManager . setRollbackOnly ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.Transaction.JTA.TransactionImpl.inactivityTimeout" , "4353" , this ) ; if ( traceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "inactivityTimeout setRollbackOnly threw exception" , e ) ; } tranManager . rollback ( ) ; } catch ( Exception ex ) { if ( traceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "inactivityTimeout resume/rollback threw exception" , ex ) ; } } } if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "inactivityTimeout" ) ; }
Called by the timeout manager when inactivity timer expires . Needs to be synchronized as it may interfere with normal timeout .
36,043
synchronized ConsumerSessionImpl get ( long id ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "get" , new Long ( id ) ) ; ConsumerSessionImpl consumer = null ; if ( _messageProcessor . isStarted ( ) ) { consumer = ( ConsumerSessionImpl ) _consumers . get ( new Long ( id ) ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "get" , consumer ) ; return consumer ; }
Gets a consumer using its id .
36,044
synchronized void add ( ConsumerSessionImpl consumer ) { consumer . setId ( _consumerCount ) ; if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "add" , new Long ( consumer . getIdInternal ( ) ) ) ; _consumers . put ( new Long ( _consumerCount ) , consumer ) ; _consumerCount ++ ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "add" ) ; }
Adds a consumer to the list of Consumers that this messaging engine contains
36,045
private static Collection < String > getFromAppliesTo ( final Asset asset , final AppliesToFilterGetter getter ) { Collection < AppliesToFilterInfo > atfis = asset . getWlpInformation ( ) . getAppliesToFilterInfo ( ) ; Collection < String > ret = new ArrayList < String > ( ) ; if ( atfis != null ) { for ( AppliesToFilterInfo at : atfis ) { if ( at != null ) { String val = getter . getValue ( at ) ; if ( val != null ) { ret . add ( val ) ; } } } } return ret ; }
Utility method to cycle through the applies to filters info and collate the values found
36,046
protected void activate ( ComponentContext ctx , Map < String , Object > properties ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "activate" , properties ) ; } if ( isEnabled ( ) ) { loadMaps ( properties ) ; } else { Tr . error ( tc , "SF_ERROR_NOT_ENABLED" ) ; } }
to be deleted
36,047
private void updateCacheState ( Map < String , Object > props ) { getAuthenticationConfig ( props ) ; if ( cacheEnabled ) { authCacheServiceRef . activate ( cc ) ; } else { authCacheServiceRef . deactivate ( cc ) ; } }
Based on the configuration properties the auth cache should either be active or not .
36,048
private ReentrantLock optionallyObtainLockedLock ( AuthenticationData authenticationData ) { ReentrantLock currentLock = null ; if ( isAuthCacheServiceAvailable ( ) ) { currentLock = authenticationGuard . requestAccess ( authenticationData ) ; currentLock . lock ( ) ; } return currentLock ; }
This method will try to obtain a lock from the authentication guard based on the given authentication data and lock it . If an equals authentication data on another thread is received for which a lock already exists this method will block that another thread until the first thread relinquishes the lock . This allows having locking based on authentication data instead of blindly locking all access . The intention is to NOT allow multiple concurrent JAAS logins for the same authentication data in order to be able to correctly represent the user with the same runtime subject for the same data better manage caching and to prevent cycles doing logins for which potentially many of the results will be discarded .
36,049
public Subject delegate ( String roleName , String appName ) { Subject runAsSubject = getRunAsSubjectFromProvider ( roleName , appName ) ; return runAsSubject ; }
Gets the delegation subject based on the currently configured delegation provider or the MethodDelegationProvider if one is not configured .
36,050
static private StringBuilder determineType ( String name , Object o ) { String value = null ; if ( o instanceof String || o instanceof StringBuffer || o instanceof java . nio . CharBuffer || o instanceof Integer || o instanceof Long || o instanceof Byte || o instanceof Double || o instanceof Float || o instanceof Short || o instanceof BigInteger || o instanceof java . math . BigDecimal ) { value = o . toString ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Skipping class: " + o . getClass ( ) ) ; } return null ; } StringBuilder buffer = new StringBuilder ( 48 ) ; buffer . append ( name ) ; buffer . append ( "type=\"" ) ; if ( o instanceof java . nio . CharBuffer ) { buffer . append ( "java.nio.CharBuffer" ) ; } else { buffer . append ( o . getClass ( ) . getName ( ) ) ; } buffer . append ( "\" " ) ; buffer . append ( name ) ; buffer . append ( "=\"" ) ; buffer . append ( value ) ; buffer . append ( "\"" ) ; return buffer ; }
Determine the type of the Object passed in and add the XML format for the result .
36,051
static private StringBuilder serializeChannel ( StringBuilder buffer , OutboundChannelDefinition ocd , int order ) throws NotSerializableException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Serializing channel: " + order + " " + ocd . getOutboundFactory ( ) . getName ( ) ) ; } buffer . append ( " <channel order=\"" ) ; buffer . append ( order ) ; buffer . append ( "\" factory=\"" ) ; buffer . append ( ocd . getOutboundFactory ( ) . getName ( ) ) ; buffer . append ( "\">\n" ) ; Map < Object , Object > props = ocd . getOutboundChannelProperties ( ) ; if ( null != props ) { for ( Entry < Object , Object > entry : props . entrySet ( ) ) { if ( null == entry . getValue ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Property value [" + entry . getKey ( ) + "] is null, " + ocd . toString ( ) ) ; } throw new NotSerializableException ( "Property value for [" + entry . getKey ( ) + "] is null" ) ; } StringBuilder kBuff = determineType ( "key" , entry . getKey ( ) ) ; if ( null != kBuff ) { StringBuilder vBuff = determineType ( "value" , entry . getValue ( ) ) ; if ( null != vBuff ) { buffer . append ( " <property " ) ; buffer . append ( kBuff ) ; buffer . append ( " " ) ; buffer . append ( vBuff ) ; buffer . append ( "/>\n" ) ; } } } } buffer . append ( " </channel>\n" ) ; return buffer ; }
Method to serialize a given channel object into the overall output buffer .
36,052
static public String serialize ( CFEndPoint point ) throws NotSerializableException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "serialize" ) ; } if ( null == point ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Null CFEndPoint input for serialization" ) ; } throw new NotSerializableException ( "Null input" ) ; } StringBuilder buffer = new StringBuilder ( 512 ) ; buffer . append ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Serializing endpoint: " + point . getName ( ) ) ; } buffer . append ( "<cfendpoint name=\"" ) ; buffer . append ( point . getName ( ) ) ; buffer . append ( "\" host=\"" ) ; buffer . append ( point . getAddress ( ) . getCanonicalHostName ( ) ) ; buffer . append ( "\" port=\"" ) ; buffer . append ( point . getPort ( ) ) ; buffer . append ( "\" local=\"" ) ; buffer . append ( point . isLocal ( ) ) ; buffer . append ( "\" ssl=\"" ) ; buffer . append ( point . isSSLEnabled ( ) ) ; buffer . append ( "\">\n" ) ; int i = 0 ; for ( OutboundChannelDefinition def : point . getOutboundChannelDefs ( ) ) { buffer = serializeChannel ( buffer , def , i ++ ) ; } buffer . append ( "</cfendpoint>" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Serialized string: \n" + buffer . toString ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "serialize" ) ; } return buffer . toString ( ) ; }
Method to serialize the given end point object into an XML string .
36,053
public MessageStore getOwningMessageStore ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "getOwningMessageStore" ) ; SibTr . exit ( this , tc , "getOwningMessageStore" , "return=" + _ms ) ; } return _ms ; }
This method is used to check the MessageStore instance that an implementing transaction object originated from . This is used to check that a transaction is being used to add Items to the same MessageStore as that it came from .
36,054
protected void createRealizationAndState ( MessageProcessor messageProcessor , TransactionCommon transaction ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createRealizationAndState" , new Object [ ] { messageProcessor , transaction } ) ; if ( isPubSub ( ) ) { _pubSubRealization = new PubSubRealization ( this , messageProcessor , getLocalisationManager ( ) , transaction ) ; _protoRealization = _pubSubRealization ; } else { _ptoPRealization = new JSPtoPRealization ( this , messageProcessor , getLocalisationManager ( ) ) ; _protoRealization = _ptoPRealization ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createRealizationAndState" ) ; }
Cold start version of method to create state associated with Destination .
36,055
protected void reconstitute ( MessageProcessor processor , HashMap < String , Object > durableSubscriptionsTable , int startMode ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "reconstitute" , new Object [ ] { processor , durableSubscriptionsTable , Integer . valueOf ( startMode ) } ) ; super . reconstitute ( processor ) ; if ( ! isLink ( ) ) { _name = getDefinition ( ) . getName ( ) ; _destinationAddr = SIMPUtils . createJsDestinationAddress ( _name , null , getBus ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Reconstituting " + ( isPubSub ( ) ? "pubsub" : "ptp" ) + " BaseDestinationHandler " + getName ( ) ) ; String name = getName ( ) ; if ( ( name . startsWith ( SIMPConstants . TEMPORARY_QUEUE_DESTINATION_PREFIX ) || name . startsWith ( SIMPConstants . TEMPORARY_PUBSUB_DESTINATION_PREFIX ) ) ) { _isTemporary = true ; _isSystem = false ; } else { _isTemporary = false ; _isSystem = name . startsWith ( SIMPConstants . SYSTEM_DESTINATION_PREFIX ) ; } try { createRealizationAndState ( messageProcessor ) ; _protoRealization . getRemoteSupport ( ) . reconstituteGD ( ) ; if ( isPubSub ( ) ) { _reconciled = false ; createControlAdapter ( ) ; _singleServer = messageProcessor . isSingleServer ( ) ; _pubSubRealization . reconstitute ( startMode , durableSubscriptionsTable ) ; } else { initializeNonPersistent ( processor , durableSubscriptionsTable , null ) ; _reconciled = false ; _ptoPRealization . reconstitute ( startMode , definition , isToBeDeleted ( ) , isSystem ( ) ) ; } _protoRealization . reconstituteGDTargetStreams ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.reconstitute" , "1:945:1.700.3.45" , this ) ; SibTr . exception ( tc , e ) ; _isCorruptOrIndoubt = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reconstitute" , e ) ; throw new SIResourceException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Reconstituted " + ( isPubSub ( ) ? "pubsub" : "ptp" ) + " BaseDestinationHandler " + getName ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "reconstitute" ) ; }
Recover a BaseDestinationHandler retrieved from the MessageStore .
36,056
public void deleteMsgsWithNoReferences ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteMsgsWithNoReferences" ) ; if ( null != _pubSubRealization ) _pubSubRealization . deleteMsgsWithNoReferences ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteMsgsWithNoReferences" ) ; }
This method deletes the messages which are not having any references . Previously these messages were deleted during ME startup in reconstitute method . This method is called from DeletePubSubMsgsThread context
36,057
public final synchronized AnycastOutputHandler getAnycastOutputHandler ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getAnycastOutputHandler" ) ; AnycastOutputHandler aoh = null ; if ( _ptoPRealization != null ) aoh = _ptoPRealization . getAnycastOutputHandler ( definition , false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAnycastOutputHandler" , aoh ) ; return aoh ; }
Called to get the AnycastOutputHandler for this Destination
36,058
public Object [ ] getPostReconstitutePseudoIds ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getPostReconstitutePseudoIds" ) ; Object [ ] result = _protoRealization . getRemoteSupport ( ) . getPostReconstitutePseudoIds ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getPostReconstitutePseudoIds" , result ) ; return result ; }
Returns an array of all pseudoDestination UUIDs which should be mapped to this BaseDestinationHandler . This method is used by the DestinationManager to determine what pseudo references need to be added after a destination is reconstituted .
36,059
protected void addPubSubLocalisation ( LocalizationDefinition destinationLocalizationDefinition ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addPubSubLocalisation" , new Object [ ] { destinationLocalizationDefinition } ) ; _pubSubRealization . addPubSubLocalisation ( destinationLocalizationDefinition ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addPubSubLocalisation" ) ; }
Add PubSubLocalisation .
36,060
public void setRemote ( boolean hasRemote ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setRemote" , Boolean . valueOf ( hasRemote ) ) ; getLocalisationManager ( ) . setRemote ( hasRemote ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setRemote" ) ; }
Do we have a remote localisation?
36,061
public void setLocal ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setLocal" ) ; getLocalisationManager ( ) . setLocal ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setLocal" ) ; }
Do we have a local localisation?
36,062
public boolean isToBeIgnored ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isToBeIgnored" ) ; SibTr . exit ( tc , "isToBeIgnored" , Boolean . valueOf ( _toBeIgnored ) ) ; } return _toBeIgnored ; }
Are we ignoring this destination handler due to corruption?
36,063
PtoPXmitMsgsItemStream getXmitQueuePoint ( SIBUuid8 meUuid ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getXmitQueuePoint" , meUuid ) ; PtoPXmitMsgsItemStream stream = getLocalisationManager ( ) . getXmitQueuePoint ( meUuid ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getXmitQueuePoint" , stream ) ; return stream ; }
Return the itemstream representing a transmit queue to a remote ME
36,064
private void eventMessageExpiryNotification ( SIMPMessage msg , TransactionCommon tran ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "eventMessageExpiryNotification" , new Object [ ] { msg , tran } ) ; if ( _reportHandler == null ) _reportHandler = new ReportHandler ( messageProcessor ) ; try { _reportHandler . handleMessage ( msg , tran , SIApiConstants . REPORT_EXPIRY ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.eventMessageExpiryNotification" , "1:3778:1.700.3.45" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventMessageExpiryNotification" , "SIResourceException" ) ; throw new SIResourceException ( nls . getFormattedMessage ( "REPORT_MESSAGE_ERROR_CWSIP0422" , new Object [ ] { messageProcessor . getMessagingEngineName ( ) , e } , null ) , e ) ; } if ( _protoRealization != null ) _protoRealization . onExpiryReport ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventMessageExpiryNotification" ) ; }
This is a callback required for expiry notification . For example we generate a report message here if expiry reports are requested .
36,065
public String constructPseudoDurableDestName ( String subName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "constructPseudoDurableDestName" , subName ) ; String psuedoDestName = constructPseudoDurableDestName ( messageProcessor . getMessagingEngineUuid ( ) . toString ( ) , subName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "constructPseudoDurableDestName" , psuedoDestName ) ; return psuedoDestName ; }
Creates the pseudo destination name string for remote durable subscriptions . The case when this local ME is the DME .
36,066
public String constructPseudoDurableDestName ( String meUUID , String durableName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "constructPseudoDurableDestName" , new Object [ ] { meUUID , durableName } ) ; String returnString = meUUID + "##" + durableName ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "constructPseudoDurableDestName" , returnString ) ; return returnString ; }
Creates the pseudo destination name string for remote durable subscriptions . The case when the the DME is remote to this ME .
36,067
public AnycastOutputHandler getAnycastOHForPseudoDest ( String destName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getAnycastOHForPseudoDest" , destName ) ; AnycastOutputHandler returnAOH = _pubSubRealization . getRemotePubSubSupport ( ) . getAnycastOHForPseudoDest ( destName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getAnycastOHForPseudoDest" , returnAOH ) ; return returnAOH ; }
Durable subscriptions homed on this ME but attached to from remote MEs have AnycastOutputHandlers mapped by their pseudo destination names .
36,068
void sendCODMessage ( SIMPMessage msg , TransactionCommon tran ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "sendCODMessage" , new Object [ ] { msg , tran } ) ; if ( msg . getReportCOD ( ) != null ) { if ( _reportHandler == null ) _reportHandler = new ReportHandler ( messageProcessor ) ; try { _reportHandler . handleMessage ( msg , tran , SIApiConstants . REPORT_COD ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.sendCODMessage" , "1:3909:1.700.3.45" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendCODMessage" , "SIResourceException" ) ; throw new SIResourceException ( nls . getFormattedMessage ( "REPORT_MESSAGE_ERROR_CWSIP0423" , new Object [ ] { messageProcessor . getMessagingEngineName ( ) , e } , null ) , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "sendCODMessage" ) ; }
Method sendCODMessage . Initializes the reportHandler and sends a COD message if appropriate
36,069
public void announceMPStopping ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "announceMPStopping" ) ; if ( isPubSub ( ) ) { if ( null != _pubSubRealization ) { _pubSubRealization . stopDeletingMsgsWihoutReferencesTask ( true ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "announceMPStopping" ) ; }
MP is stopping . All mediation activity should stop also .
36,070
public void stop ( int mode ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "stop" , Integer . valueOf ( mode ) ) ; deregisterDestination ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "stop" ) ; }
Stop anything that needs stopping like mediations .. etc .
36,071
public int createDurableFromRemote ( String subName , SelectionCriteria criteria , String user , boolean isCloned , boolean isNoLocal , boolean isSIBServerSubject ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createDurableFromRemote" , new Object [ ] { subName , criteria , user , Boolean . valueOf ( isSIBServerSubject ) } ) ; int status = DurableConstants . STATUS_OK ; ConsumerDispatcherState subState = new ConsumerDispatcherState ( subName , definition . getUUID ( ) , criteria , isNoLocal , messageProcessor . getMessagingEngineName ( ) , definition . getName ( ) , getBus ( ) ) ; subState . setUser ( user , isSIBServerSubject ) ; subState . setIsCloned ( isCloned ) ; try { _pubSubRealization . createLocalDurableSubscription ( subState , null ) ; } catch ( SIDurableSubscriptionAlreadyExistsException e ) { status = DurableConstants . STATUS_SUB_ALREADY_EXISTS ; } catch ( Throwable e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.BaseDestinationHandler.createDurableFromRemote" , "1:4436:1.700.3.45" , this ) ; status = DurableConstants . STATUS_SUB_GENERAL_ERROR ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createDurableFromRemote" , Integer . valueOf ( status ) ) ; return status ; }
Handle a remote request to create a local durable subscription .
36,072
public JsDestinationAddress getRoutingDestinationAddr ( JsDestinationAddress inAddress , boolean fixedMessagePoint ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getRoutingDestinationAddr" , new Object [ ] { this , inAddress , Boolean . valueOf ( fixedMessagePoint ) } ) ; JsDestinationAddress routingAddress = null ; SIBUuid8 encodedME = null ; if ( _isSystem || _isTemporary ) encodedME = SIMPUtils . parseME ( inAddress . getDestinationName ( ) ) ; if ( ( encodedME != null ) && ! ( encodedME . equals ( getMessageProcessor ( ) . getMessagingEngineUuid ( ) ) ) ) { routingAddress = inAddress ; } else if ( fixedMessagePoint ) { routingAddress = _destinationAddr ; } else if ( ( inAddress != null ) && ( inAddress . getME ( ) != null ) ) { routingAddress = _destinationAddr ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getRoutingDestinationAddr" , routingAddress ) ; return routingAddress ; }
Being a real destination there is no implicit need to add a routing destination address to any messages sent to this destination . However if the sender is bound to a single message point then we need to set a routing destination so that a particular ME Uuid can be set into it . Another reason for setting a routing address is if we re sending to a remote system or temporary queue
36,073
public void deleteRemoteDurableDME ( String subName ) throws SIRollbackException , SIConnectionLostException , SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "deleteRemoteDurableDME" , new Object [ ] { subName } ) ; _pubSubRealization . getRemotePubSubSupport ( ) . deleteRemoteDurableDME ( subName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "deleteRemoteDurableDME" ) ; }
Clean up the local AnycastOutputHandler that was created to handle access to a locally homed durable subscription . This method should only be invoked as part of ConsumerDispatcher . deleteConsumerDispatcher .
36,074
public void requestReallocation ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "requestReallocation" ) ; if ( ! isCorruptOrIndoubt ( ) ) { synchronized ( this ) { _isToBeReallocated = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "requestReallocation" , "Have set reallocation flag" ) ; } destinationManager . getDestinationIndex ( ) . cleanup ( this ) ; destinationManager . startAsynchDeletion ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "requestReallocation" ) ; }
Request reallocation of transmitQs on the next asynch deletion thread run
36,075
public boolean isTopicAccessCheckRequired ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isTopicAccessCheckRequired" ) ; if ( ! isPubSub ( ) || isTemporary ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isTopicAccessCheckRequired" , Boolean . FALSE ) ; return false ; } boolean check = super . isTopicAccessCheckRequired ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isTopicAccessCheckRequired" , Boolean . valueOf ( check ) ) ; return check ; }
Override Method in AbstractBaseDestinationHandler
36,076
public boolean removeAnycastInputHandlerAndRCD ( String key ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeAnycastInputHandlerAndRCD" , key ) ; boolean removed = _protoRealization . getRemoteSupport ( ) . removeAnycastInputHandlerAndRCD ( key ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeAnycastInputHandlerAndRCD" , Boolean . valueOf ( removed ) ) ; return removed ; }
Removes the AIH and the RCD instances for a given dme ID . Also removes the itemStreams from the messageStore for the aiContainerItemStream and the rcdItemStream
36,077
public void closeRemoteConsumer ( SIBUuid8 dmeUuid ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "closeRemoteConsumer" , dmeUuid ) ; _protoRealization . getRemoteSupport ( ) . closeRemoteConsumers ( dmeUuid ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "closeRemoteConsumer" ) ; return ; }
Close the remote consumers for a given remote ME
36,078
public PubSubRealization getPubSubRealization ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getPubSubRealization" ) ; SibTr . exit ( tc , "getPubSubRealization" , _pubSubRealization ) ; } return _pubSubRealization ; }
Retrieve the PubSubRealization
36,079
public PtoPRealization getPtoPRealization ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getPtoPRealization" ) ; SibTr . exit ( tc , "getPtoPRealization" , _ptoPRealization ) ; } return _ptoPRealization ; }
Retrieve the PtoPRealization
36,080
public AbstractProtoRealization getProtocolRealization ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getProtocolRealization" ) ; SibTr . exit ( tc , "getProtocolRealization" , _protoRealization ) ; } return _protoRealization ; }
Retrieve the ProtocolRealization
36,081
public LocalisationManager getLocalisationManager ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getLocalisationManager" , this ) ; if ( _localisationManager == null ) { _localisationManager = new LocalisationManager ( this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getLocalisationManager" , _localisationManager ) ; return _localisationManager ; }
Retrieve the LocalisationManager
36,082
protected void setByteArrayValue ( byte [ ] input ) { this . sValue = null ; this . bValue = input ; this . offset = 0 ; this . valueLength = input . length ; if ( ELEM_ADDED != this . status ) { this . status = ELEM_CHANGED ; } }
Set the byte array value to the given input .
36,083
protected void setByteArrayValue ( byte [ ] input , int offset , int length ) { if ( ( offset + length ) > input . length ) { throw new IllegalArgumentException ( "Invalid length: " + offset + "+" + length + " > " + input . length ) ; } this . sValue = null ; this . bValue = input ; this . offset = offset ; this . valueLength = length ; if ( ELEM_ADDED != this . status ) { this . status = ELEM_CHANGED ; } }
Set the byte array value of this header based on the input array but starting at the input offset into that array and with the given length .
36,084
protected void setStringValue ( String input ) { this . bValue = null ; this . sValue = input ; this . offset = 0 ; this . valueLength = ( null == input ) ? 0 : input . length ( ) ; if ( ELEM_ADDED != this . status ) { this . status = ELEM_CHANGED ; } }
Set the string value to the given input .
36,085
protected void updateLastCRLFInfo ( int index , int pos , boolean isCR ) { this . lastCRLFBufferIndex = index ; this . lastCRLFPosition = pos ; this . lastCRLFisCR = isCR ; }
Set the relevant information for the CRLF position information from the parsing code .
36,086
protected void destroy ( ) { this . nextSequence = null ; this . prevSequence = null ; this . bValue = null ; this . sValue = null ; this . buffIndex = - 1 ; this . offset = 0 ; this . valueLength = 0 ; this . myHashCode = - 1 ; this . lastCRLFBufferIndex = - 1 ; this . lastCRLFisCR = false ; this . lastCRLFPosition = - 1 ; this . status = ELEM_ADDED ; this . myOwner . freeElement ( this ) ; }
Perform cleanup when this object is no longer needed .
36,087
public Properties getHeader ( RepositoryLogRecord record ) { if ( ! headerMap . containsKey ( record ) ) { throw new IllegalArgumentException ( "Record was not return by an iterator over this instance" ) ; } return headerMap . get ( record ) ; }
Returns header information for the server this record was created on .
36,088
public static URL createWSJPAURL ( URL url ) throws MalformedURLException { if ( url == null ) { return null ; } final String encodedURLPathStr = encode ( url . toExternalForm ( ) ) ; URL returnURL ; try { returnURL = AccessController . doPrivileged ( new PrivilegedExceptionAction < URL > ( ) { public URL run ( ) throws MalformedURLException { return new URL ( WSJPA_PROTOCOL_NAME + ":" + encodedURLPathStr ) ; } } ) ; } catch ( PrivilegedActionException e ) { throw ( MalformedURLException ) e . getException ( ) ; } return returnURL ; }
Encapsulates the specified URL within a wsjpa URL .
36,089
public static URL extractEmbeddedURL ( URL url ) throws MalformedURLException { if ( url == null ) { return null ; } if ( ! url . getProtocol ( ) . equalsIgnoreCase ( WSJPA_PROTOCOL_NAME ) ) { throw new IllegalArgumentException ( "The specified URL \"" + url + "\" does not use the \"" + WSJPA_PROTOCOL_NAME + "\" protocol." ) ; } String encodedPath = url . getPath ( ) ; if ( encodedPath == null || encodedPath . trim ( ) . equals ( "" ) ) { throw new IllegalArgumentException ( "The specified URL \"" + url + "\" is missing path information." ) ; } final String decodedPath = decode ( encodedPath ) ; try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < URL > ( ) { public URL run ( ) throws MalformedURLException { return new URL ( decodedPath ) ; } } ) ; } catch ( PrivilegedActionException e ) { throw ( MalformedURLException ) e . getException ( ) ; } }
Extracts the embedded URL from the provided wsjpa protocoled URL .
36,090
private static String encode ( String s ) { if ( s == null ) { return null ; } if ( s . contains ( "%21" ) ) { throw new IllegalArgumentException ( "WSJPAURLUtils.encode() cannot encode Strings containing \"%21\"." ) ; } return s . replace ( "!" , "%21" ) ; }
Private method that substitutes ! characters with its escaped code %21 .
36,091
private static String decode ( String s ) { if ( s == null ) { return null ; } return s . replace ( "%21" , "!" ) ; }
Private method that substitutes the escape code %21 with the ! character .
36,092
public ValidationMode getValidationMode ( ) { ValidationMode rtnMode = null ; PersistenceUnitValidationModeType jaxbMode = null ; jaxbMode = ivPUnit . getValidationMode ( ) ; if ( jaxbMode == PersistenceUnitValidationModeType . AUTO ) { rtnMode = ValidationMode . AUTO ; } else if ( jaxbMode == PersistenceUnitValidationModeType . CALLBACK ) { rtnMode = ValidationMode . CALLBACK ; } else if ( jaxbMode == PersistenceUnitValidationModeType . NONE ) { rtnMode = ValidationMode . NONE ; } return rtnMode ; }
Gets the value of the validationMode property .
36,093
public static void setServiceProviderFinder ( ExternalContext ectx , ServiceProviderFinder slp ) { ectx . getApplicationMap ( ) . put ( SERVICE_PROVIDER_KEY , slp ) ; }
Set a ServiceProviderFinder to the current application to locate SPI service providers used by MyFaces .
36,094
private static ServiceProviderFinder _getServiceProviderFinderFromInitParam ( ExternalContext context ) { String initializerClassName = context . getInitParameter ( SERVICE_PROVIDER_FINDER_PARAM ) ; if ( initializerClassName != null ) { try { Class < ? > clazz = ClassUtils . classForName ( initializerClassName ) ; if ( ! ServiceProviderFinder . class . isAssignableFrom ( clazz ) ) { throw new FacesException ( "Class " + clazz + " does not implement ServiceProviderFinder" ) ; } return ( ServiceProviderFinder ) ClassUtils . newInstance ( clazz ) ; } catch ( ClassNotFoundException cnfe ) { throw new FacesException ( "Could not find class of specified ServiceProviderFinder" , cnfe ) ; } } return null ; }
Gets a ServiceProviderFinder from the web . xml config param .
36,095
public void psSetBytes ( PreparedStatement pstmtImpl , int i , byte [ ] x ) throws SQLException { pstmtImpl . setBytes ( i , x ) ; }
Allow for special handling of Oracle prepared statement setBytes This method just does the normal setBytes call Oracle helper overrides it
36,096
public void psSetString ( PreparedStatement pstmtImpl , int i , String x ) throws SQLException { pstmtImpl . setString ( i , x ) ; }
Allow for special handling of Oracle prepared statement setString This method just does the normal setString call Oracle helper overrides it
36,097
public void resetClientInformation ( WSRdbManagedConnectionImpl mc ) throws SQLException { if ( mc . mcf . jdbcDriverSpecVersion >= 40 && ( mc . clientInfoExplicitlySet || mc . clientInfoImplicitlySet ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "resetClientInformation" , mc ) ; try { mc . sqlConn . setClientInfo ( mc . mcf . defaultClientInfo ) ; mc . clientInfoExplicitlySet = false ; mc . clientInfoImplicitlySet = false ; } catch ( SQLException ex ) { FFDCFilter . processException ( ex , getClass ( ) . getName ( ) + "resetClientInformation" , "780" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "resetClientInformation" , ex ) ; throw AdapterUtil . mapSQLException ( ex , mc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "resetClientInformation" ) ; } }
This method is used to reset the client information on the backend database connection . Information will be reset only if it has been set .
36,098
public ConnectionResults getPooledConnection ( final CommonDataSource ds , String userName , String password , final boolean is2Phase , final WSConnectionRequestInfoImpl cri , boolean useKerberos , Object gssCredential ) throws ResourceException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getPooledConnection" , AdapterUtil . toString ( ds ) , userName , "******" , is2Phase ? "two-phase" : "one-phase" , cri , useKerberos , gssCredential ) ; if ( useKerberos ) { Tr . warning ( tc , "KERBEROS_NOT_SUPPORTED_WARNING" ) ; } try { final String user = userName == null ? null : userName . trim ( ) ; final String pwd = password == null ? null : password . trim ( ) ; PooledConnection pConn = AccessController . doPrivileged ( new PrivilegedExceptionAction < PooledConnection > ( ) { public PooledConnection run ( ) throws SQLException { boolean buildConnection = cri . ivShardingKey != null || cri . ivSuperShardingKey != null ; if ( is2Phase ) if ( buildConnection ) return mcf . jdbcRuntime . buildXAConnection ( ( XADataSource ) ds , user , pwd , cri ) ; else if ( user == null ) return ( ( XADataSource ) ds ) . getXAConnection ( ) ; else return ( ( XADataSource ) ds ) . getXAConnection ( user , pwd ) ; else if ( buildConnection ) return mcf . jdbcRuntime . buildPooledConnection ( ( ConnectionPoolDataSource ) ds , user , pwd , cri ) ; else if ( user == null ) return ( ( ConnectionPoolDataSource ) ds ) . getPooledConnection ( ) ; else return ( ( ConnectionPoolDataSource ) ds ) . getPooledConnection ( user , pwd ) ; } } ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getPooledConnection" , AdapterUtil . toString ( pConn ) ) ; return new ConnectionResults ( pConn , null ) ; } catch ( PrivilegedActionException pae ) { FFDCFilter . processException ( pae . getException ( ) , getClass ( ) . getName ( ) , "1298" ) ; ResourceException resX = new DataStoreAdapterException ( "JAVAX_CONN_ERR" , pae . getException ( ) , DatabaseHelper . class , is2Phase ? "XAConnection" : "PooledConnection" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getPooledConnection" , "Exception" ) ; throw resX ; } catch ( ClassCastException castX ) { FFDCFilter . processException ( castX , getClass ( ) . getName ( ) , "1312" ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "Caught ClassCastException" , castX ) ; ResourceException resX = new DataStoreAdapterException ( castX . getMessage ( ) , null , DatabaseHelper . class , is2Phase ? "NOT_A_2_PHASE_DS" : "NOT_A_1_PHASE_DS" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getPooledConnection" , "Exception" ) ; throw resX ; } }
Get a Pooled or XA Connection from the specified DataSource . A null userName indicates that no user name or password should be provided .
36,099
public void setClientRerouteData ( Object dataSource , String cRJNDIName , String cRAlternateServer , String cRAlternatePort , String cRPrimeServer , String cRPrimePort , Context jndiContext , String driverType ) throws Throwable { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Client reroute is not supported on non-DB2 JCC driver." ) ; } }
This method is used to set the client reroute options on the datasoruce Object . This method will be a no - op for all but the DB2 universal driver .