idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
38,100
public static Locale getLocale ( FaceletContext ctx , TagAttribute attr ) throws TagAttributeException { Object obj = attr . getObject ( ctx ) ; if ( obj instanceof Locale ) { return ( Locale ) obj ; } if ( obj instanceof String ) { String s = ( String ) obj ; if ( s . length ( ) == 2 ) { return new Locale ( s ) ; } if ( s . length ( ) == 5 ) { return new Locale ( s . substring ( 0 , 2 ) , s . substring ( 3 , 5 ) . toUpperCase ( ) ) ; } if ( s . length ( ) >= 7 ) { return new Locale ( s . substring ( 0 , 2 ) , s . substring ( 3 , 5 ) . toUpperCase ( ) , s . substring ( 6 , s . length ( ) ) ) ; } throw new TagAttributeException ( attr , "Invalid Locale Specified: " + s ) ; } else { throw new TagAttributeException ( attr , "Attribute did not evaluate to a String or Locale: " + obj ) ; } }
According to JSF 1 . 2 tag specs this helper method will use the TagAttribute passed in determining the Locale intended .
38,101
public static UIViewRoot getViewRoot ( FaceletContext ctx , UIComponent parent ) { UIComponent c = parent ; do { if ( c instanceof UIViewRoot ) { return ( UIViewRoot ) c ; } else { c = c . getParent ( ) ; } } while ( c != null ) ; UIViewRoot root = ctx . getFacesContext ( ) . getViewRoot ( ) ; if ( root == null ) { root = FaceletCompositionContext . getCurrentInstance ( ctx ) . getViewRoot ( ctx . getFacesContext ( ) ) ; } return root ; }
Tries to walk up the parent to find the UIViewRoot if not found then go to FaceletContext s FacesContext for the view root .
38,102
public static void markForDeletion ( UIComponent component ) { component . getAttributes ( ) . put ( MARK_DELETED , Boolean . TRUE ) ; Iterator < UIComponent > iter = component . getFacetsAndChildren ( ) ; while ( iter . hasNext ( ) ) { UIComponent child = iter . next ( ) ; if ( child . getAttributes ( ) . containsKey ( MARK_CREATED ) ) { child . getAttributes ( ) . put ( MARK_DELETED , Boolean . TRUE ) ; } } }
Marks all direct children and Facets with an attribute for deletion .
38,103
private static UIComponent createFacetUIPanel ( FaceletContext ctx , UIComponent parent , String facetName ) { FacesContext facesContext = ctx . getFacesContext ( ) ; UIComponent panel = facesContext . getApplication ( ) . createComponent ( facesContext , UIPanel . COMPONENT_TYPE , null ) ; FaceletCompositionContext mctx = FaceletCompositionContext . getCurrentInstance ( ctx ) ; UniqueIdVendor uniqueIdVendor = mctx . getUniqueIdVendorFromStack ( ) ; if ( uniqueIdVendor == null ) { uniqueIdVendor = ComponentSupport . getViewRoot ( ctx , parent ) ; } if ( uniqueIdVendor != null ) { int index = facetName . indexOf ( '.' ) ; String cleanFacetName = facetName ; if ( index >= 0 ) { cleanFacetName = facetName . replace ( '.' , '_' ) ; } panel . setId ( uniqueIdVendor . createUniqueId ( facesContext , mctx . getSharedStringBuilder ( ) . append ( parent . getId ( ) ) . append ( "__f_" ) . append ( cleanFacetName ) . toString ( ) ) ) ; } panel . getAttributes ( ) . put ( FACET_CREATED_UIPANEL_MARKER , Boolean . TRUE ) ; panel . getAttributes ( ) . put ( ComponentSupport . COMPONENT_ADDED_BY_HANDLER_MARKER , Boolean . TRUE ) ; return panel ; }
Create a new UIPanel for the use as a dynamically created container for multiple children in a facet . Duplicate in javax . faces . webapp . UIComponentClassicTagBase .
38,104
public PolicyExecutor create ( Map < String , Object > props ) { PolicyExecutor executor = new PolicyExecutorImpl ( ( ExecutorServiceImpl ) globalExecutor , ( String ) props . get ( "config.displayId" ) , null , policyExecutors ) ; executor . updateConfig ( props ) ; return executor ; }
Creates a new policy executor instance and initializes it per the specified OSGi service component properties . The config . displayId of the OSGi service component properties is used as the unique identifier .
38,105
public PolicyExecutor create ( String identifier ) { return new PolicyExecutorImpl ( ( ExecutorServiceImpl ) globalExecutor , "PolicyExecutorProvider-" + identifier , null , policyExecutors ) ; }
Creates a new policy executor instance .
38,106
public PolicyExecutor create ( String fullIdentifier , String owner ) { return new PolicyExecutorImpl ( ( ExecutorServiceImpl ) globalExecutor , fullIdentifier , owner , policyExecutors ) ; }
Creates a new policy executor instance for use by a single application . Policy executors owned by this application can be shut down via the shutdownNow method of this class .
38,107
public GZIPOutputStream getGZIPOutputStream ( BeanId beanId ) throws CSIException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getOutputStream" , beanId ) ; final String fileName = getPortableFilename ( beanId ) ; final long beanTimeoutTime = getBeanTimeoutTime ( beanId ) ; GZIPOutputStream result = null ; try { result = ( GZIPOutputStream ) AccessController . doPrivileged ( new PrivilegedExceptionAction < GZIPOutputStream > ( ) { public GZIPOutputStream run ( ) throws IOException { File statefulBeanFile = getStatefulBeanFile ( fileName , false ) ; FileOutputStream fos = EJSPlatformHelper . isZOS ( ) ? new WSFileOutputStream ( statefulBeanFile , beanTimeoutTime ) : new FileOutputStream ( statefulBeanFile ) ; return new GZIPOutputStream ( fos ) ; } } ) ; } catch ( PrivilegedActionException ex2 ) { Exception ex = ex2 . getException ( ) ; FFDCFilter . processException ( ex , CLASS_NAME + ".getOutputStream" , "127" , this ) ; Tr . warning ( tc , "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W" , new Object [ ] { fileName , this , ex } ) ; throw new CSIException ( "Unable to open output stream" , ex ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getOutputStream" ) ; return result ; }
Get object ouput stream suitable for reading persistent state associated with given key .
38,108
private String getPortableFilename ( BeanId beanId ) { StringBuilder result = new StringBuilder ( ) ; result . append ( FILENAME_PREFIX ) ; appendPortableFilenameString ( result , beanId . getJ2EEName ( ) . toString ( ) ) ; result . append ( "__" ) ; appendPortableFilenameString ( result , beanId . getPrimaryKey ( ) . toString ( ) ) ; result . append ( '_' ) ; return result . toString ( ) ; }
Create a safe file name given the BeanId . There are a number of characters which can cause problems on different platforms . A safe file name will container only the following characters a - z A - Z _ - . All other characters will get converted to a _
38,109
public OutputStream getOutputStream ( BeanId beanId ) throws CSIException { final String fileName = getPortableFilename ( beanId ) ; final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getOutputStream: key=" + beanId + ", file=" , fileName ) ; final long beanTimeoutTime = getBeanTimeoutTime ( beanId ) ; FileOutputStream result = null ; try { result = ( FileOutputStream ) AccessController . doPrivileged ( new PrivilegedExceptionAction < FileOutputStream > ( ) { public FileOutputStream run ( ) throws IOException { File file = new File ( passivationDir , fileName ) ; if ( EJSPlatformHelper . isZOS ( ) ) { return new WSFileOutputStream ( file , beanTimeoutTime ) ; } return new FileOutputStream ( file ) ; } } ) ; } catch ( PrivilegedActionException ex ) { FFDCFilter . processException ( ex , CLASS_NAME + ".getUnCompressedOutputStream" , "460" , this ) ; Tr . warning ( tc , "IOEXCEPTION_WRITING_FILE_FOR_STATEFUL_SESSION_BEAN_CNTR0025W" , new Object [ ] { fileName , this , ex } ) ; throw new CSIException ( "Unable to open output stream" , ex ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getOutputStream" ) ; return result ; }
LIDB2018 - 1 new method for just dumping in the byte array to a file byte array in gzip format .
38,110
public static LooseConfig convertToLooseConfig ( File looseFile ) throws Exception { if ( looseFile . exists ( ) && looseFile . isFile ( ) && looseFile . canRead ( ) && looseFile . getName ( ) . toLowerCase ( ) . endsWith ( ".xml" ) ) { LooseConfig root = new LooseConfig ( LooseType . ARCHIVE ) ; XMLStreamReader reader = null ; try { LooseConfig cEntry = root ; Stack < LooseConfig > stack = new Stack < LooseConfig > ( ) ; stack . push ( cEntry ) ; reader = XMLInputFactory . newInstance ( ) . createXMLStreamReader ( new FileInputStream ( looseFile ) ) ; while ( reader . hasNext ( ) && cEntry != null ) { int result = reader . next ( ) ; if ( result == XMLStreamConstants . START_ELEMENT ) { if ( "archive" . equals ( reader . getLocalName ( ) ) ) { String targetLocation = XMLUtils . getAttribute ( reader , "targetInArchive" ) ; if ( targetLocation != null ) { LooseConfig pEntry = cEntry ; cEntry = new LooseConfig ( LooseType . ARCHIVE ) ; cEntry . targetInArchive = targetLocation ; pEntry . children . add ( cEntry ) ; stack . push ( cEntry ) ; } } else if ( "dir" . equals ( reader . getLocalName ( ) ) ) { cEntry . children . add ( createElement ( reader , LooseType . DIR ) ) ; } else if ( "file" . equals ( reader . getLocalName ( ) ) ) { cEntry . children . add ( createElement ( reader , LooseType . FILE ) ) ; } } else if ( result == XMLStreamConstants . END_ELEMENT ) { if ( "archive" . equals ( reader . getLocalName ( ) ) ) { stack . pop ( ) ; if ( ! stack . empty ( ) ) { cEntry = stack . peek ( ) ; } else { cEntry = null ; } } } } } catch ( FileNotFoundException e ) { throw e ; } catch ( XMLStreamException e ) { throw e ; } catch ( FactoryConfigurationError e ) { throw e ; } finally { if ( reader != null ) { try { reader . close ( ) ; reader = null ; } catch ( XMLStreamException e ) { Debug . printStackTrace ( e ) ; } } } return root ; } return null ; }
Refer to the com . ibm . ws . artifact . api . loose . internal . LooseContainerFactoryHelper . createContainer . Parse the loose config file and create the looseConfig object which contains the file s content .
38,111
public static ArchiveEntryConfig createLooseArchiveEntryConfig ( LooseConfig looseConfig , File looseFile , BootstrapConfig bootProps , String archiveEntryPrefix , boolean isUsr ) throws IOException { File usrRoot = bootProps . getUserRoot ( ) ; int len = usrRoot . getAbsolutePath ( ) . length ( ) ; String entryPath = null ; if ( archiveEntryPrefix . equalsIgnoreCase ( PackageProcessor . PACKAGE_ARCHIVE_PREFIX ) || ! isUsr ) { entryPath = archiveEntryPrefix + BootstrapConstants . LOC_AREA_NAME_USR + looseFile . getAbsolutePath ( ) . substring ( len ) ; } else { entryPath = archiveEntryPrefix + looseFile . getAbsolutePath ( ) . substring ( len ) ; } entryPath = entryPath . replace ( "\\" , "/" ) ; entryPath = entryPath . replace ( "//" , "/" ) ; entryPath = entryPath . substring ( 0 , entryPath . length ( ) - 4 ) ; File archiveFile = processArchive ( looseFile . getName ( ) , looseConfig , true , bootProps ) ; return new FileEntryConfig ( entryPath , archiveFile ) ; }
Using the method to create Loose config s Archive entry config
38,112
public static Pattern convertToRegex ( String excludeStr ) { if ( excludeStr . contains ( "." ) ) { excludeStr = excludeStr . replace ( "." , "\\." ) ; } if ( excludeStr . endsWith ( "/" ) ) { excludeStr = excludeStr . substring ( 0 , excludeStr . length ( ) - 1 ) ; } if ( excludeStr . contains ( "**" ) ) { excludeStr = excludeStr . replace ( "**" , ".*" ) ; } if ( excludeStr . contains ( "/*" ) ) { excludeStr = excludeStr . replace ( "/*" , "/.*" ) ; } if ( excludeStr . contains ( "/" ) ) { excludeStr = excludeStr . replace ( "/" , "\\/" ) ; } if ( excludeStr . contains ( "**" ) ) { excludeStr = excludeStr . replace ( "**" , "*" ) ; } if ( excludeStr . startsWith ( "*" ) ) { excludeStr = "." + excludeStr ; } if ( excludeStr . contains ( "[" ) ) { excludeStr = excludeStr . replace ( "[" , "\\[" ) ; } if ( excludeStr . contains ( "]" ) ) { excludeStr = excludeStr . replace ( "]" , "\\]" ) ; } if ( excludeStr . contains ( "-" ) ) { excludeStr = excludeStr . replace ( "-" , "\\-" ) ; } return Pattern . compile ( excludeStr ) ; }
Copy from com . ibm . ws . artifact . api . loose . internal . LooseArchive
38,113
public synchronized CommsByteBuffer allocate ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "allocate" ) ; CommsByteBuffer buff = ( CommsByteBuffer ) pool . remove ( ) ; if ( buff == null ) { if ( tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "No buffer available from pool - creating a new one" ) ; buff = createNew ( ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "allocate" , buff ) ; return buff ; }
Gets a CommsByteBuffer from the pool .
38,114
synchronized void release ( CommsByteBuffer buff ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "release" , buff ) ; buff . reset ( ) ; pool . add ( buff ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "release" ) ; }
Returns a buffer back to the pool so that it can be re - used .
38,115
void setMessage ( MessageImpl msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setMessage" , msg ) ; theMessage = msg ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setMessage" ) ; }
Set the back - pointer to the MFP message that contains this JMO instance .
38,116
DataSlice encodeSinglePartMessage ( Object conn ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeSinglePartMessage" ) ; if ( payloadPart != null ) { MessageEncodeFailedException mefe = new MessageEncodeFailedException ( "Invalid call to encodeSinglePartMessage" ) ; FFDCFilter . processException ( mefe , "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodeSinglePartMessage" , "jmo530" , this , new Object [ ] { MfpConstants . DM_MESSAGE , headerPart . jmfPart , theMessage } ) ; throw mefe ; } if ( conn != null && ! ( conn instanceof CommsConnection ) ) { throw new MessageEncodeFailedException ( "Incorrect connection object: " + conn . getClass ( ) ) ; } byte [ ] buffer = null ; try { synchronized ( theMessage ) { theMessage . updateDataFields ( MfpConstants . UDF_ENCODE ) ; ensureReceiverHasSchemata ( ( CommsConnection ) conn ) ; synchronized ( getPartLockArtefact ( headerPart ) ) { buffer = new byte [ IDS_LENGTH + ArrayUtil . INT_SIZE + ( ( JMFMessage ) headerPart . jmfPart ) . getEncodedLength ( ) ] ; int offset = encodeIds ( buffer , 0 ) ; encodePartToBuffer ( headerPart , true , buffer , offset ) ; } } } catch ( MessageEncodeFailedException e1 ) { FFDCFilter . processException ( e1 , "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodeSinglePartMessage" , "jmo500" , this , new Object [ ] { MfpConstants . DM_MESSAGE , null , theMessage } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "encodeSinglePartMessage failed: " + e1 ) ; throw e1 ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodeSinglePartMessage" , "jmo520" , this , new Object [ ] { MfpConstants . DM_MESSAGE , headerPart . jmfPart , theMessage } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "encodeSinglePartMessage failed: " + e ) ; throw new MessageEncodeFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Encoded JMF Message" , debugMsg ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( this , tc , "buffers: " , SibTr . formatBytes ( buffer , 0 , buffer . length ) ) ; } DataSlice slice = new DataSlice ( buffer ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodeSinglePartMessage" , slice ) ; return slice ; }
Encode the message into a single DataSlice . The DataSlice will be used by the Comms component to transmit the message over the wire . This method may only be used for a single - part message .
38,117
List < DataSlice > encodeFast ( Object conn ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeFast" ) ; if ( conn != null && ! ( conn instanceof CommsConnection ) ) { throw new MessageEncodeFailedException ( "Incorrect connection object: " + conn . getClass ( ) ) ; } List < DataSlice > messageSlices = new ArrayList < DataSlice > ( 3 ) ; DataSlice slice0 = null ; DataSlice slice1 = null ; DataSlice slice2 = null ; try { ensureReceiverHasSchemata ( ( CommsConnection ) conn ) ; byte [ ] buff0 = new byte [ IDS_LENGTH + ArrayUtil . INT_SIZE ] ; int offset = 0 ; offset += encodeIds ( buff0 , 0 ) ; slice0 = new DataSlice ( buff0 , 0 , buff0 . length ) ; synchronized ( theMessage ) { theMessage . updateDataFields ( MfpConstants . UDF_ENCODE ) ; slice1 = encodeHeaderPartToSlice ( headerPart ) ; ArrayUtil . writeInt ( buff0 , offset , slice1 . getLength ( ) ) ; messageSlices . add ( slice0 ) ; messageSlices . add ( slice1 ) ; if ( payloadPart != null ) { slice2 = encodePayloadPartToSlice ( payloadPart , ( CommsConnection ) conn ) ; messageSlices . add ( slice2 ) ; } } } catch ( MessageEncodeFailedException e1 ) { FFDCFilter . processException ( e1 , "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodeFast" , "jmo560" , this , new Object [ ] { MfpConstants . DM_MESSAGE , null , theMessage } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "encodeFast failed: " + e1 ) ; throw e1 ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodeFast" , "jmo570" , this , new Object [ ] { MfpConstants . DM_MESSAGE , headerPart . jmfPart , theMessage } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "encodeFast failed: " + e ) ; throw new MessageEncodeFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Encoded JMF Message" , debugMsg ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Message DataSlices: " , SibTr . formatSlices ( messageSlices , MfpDiagnostics . getDiagnosticDataLimitInt ( ) ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodeFast" ) ; return messageSlices ; }
Encode the message into a List of DataSlices . The DataSlices will be used by the Comms component to transmit the message over the wire . This method has been substantially reworked . d348294
38,118
private final int encodeIds ( byte [ ] buffer , int offset ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeIds" ) ; int idOffset = offset ; ArrayUtil . writeShort ( buffer , idOffset , ( ( JMFMessage ) headerPart . jmfPart ) . getJMFEncodingVersion ( ) ) ; idOffset += ArrayUtil . SHORT_SIZE ; ArrayUtil . writeLong ( buffer , idOffset , headerPart . jmfPart . getEncodingSchema ( ) . getID ( ) ) ; idOffset += ArrayUtil . LONG_SIZE ; if ( payloadPart != null ) { ArrayUtil . writeShort ( buffer , idOffset , ( ( JMFMessage ) payloadPart . jmfPart ) . getJMFEncodingVersion ( ) ) ; idOffset += ArrayUtil . SHORT_SIZE ; ArrayUtil . writeLong ( buffer , idOffset , payloadPart . jmfPart . getEncodingSchema ( ) . getID ( ) ) ; idOffset += ArrayUtil . LONG_SIZE ; } else { ArrayUtil . writeShort ( buffer , idOffset , ( short ) 0 ) ; idOffset += ArrayUtil . SHORT_SIZE ; ArrayUtil . writeLong ( buffer , idOffset , 0L ) ; idOffset += ArrayUtil . LONG_SIZE ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodeIds" , Integer . valueOf ( idOffset - offset ) ) ; return idOffset - offset ; }
Encode the JMF version and schema ids into a byte array buffer . The buffer will be used when transmitting over the wire hardening into a database and for any other need for serialization
38,119
private final DataSlice encodeHeaderPartToSlice ( JsMsgPart jsPart ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeHeaderPartToSlice" , jsPart ) ; DataSlice slice = ( ( JMFMessage ) jsPart . jmfPart ) . getAssembledContent ( ) ; if ( slice == null ) { byte [ ] buff ; synchronized ( getPartLockArtefact ( jsPart ) ) { buff = encodePart ( jsPart ) ; } slice = new DataSlice ( buff , 0 , buff . length ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodeHeaderPartToSlice" , slice ) ; return slice ; }
Encode the header or only a message part into a DataSlice for transmitting over the wire or flattening for persistence . If the message part is already assembled the contents are simply be wrapped in a DataSlice by the JMFMessage & returned . If the message part is not already assembled the part is encoded into a new byte array which is wrapped by a DataSlice .
38,120
private final DataSlice encodePayloadPartToSlice ( JsMsgPart jsPart , CommsConnection conn ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodePayloadPartToSlice" , new Object [ ] { jsPart , conn } ) ; boolean beans = false ; DataSlice slice = null ; if ( ( ( ( JsMessage ) theMessage ) . getProducerType ( ) != ProducerType . API ) || payloadPart . getField ( JsPayloadAccess . FORMAT ) == null || ! ( ( ( String ) payloadPart . getField ( JsPayloadAccess . FORMAT ) ) . startsWith ( "Bean:" ) ) ) { slice = ( ( JMFMessage ) jsPart . jmfPart ) . getAssembledContent ( ) ; } else { beans = true ; } if ( slice == null ) { try { synchronized ( getPartLockArtefact ( jsPart ) ) { if ( beans ) { if ( conn != null ) MfpThreadDataImpl . setPartnerLevel ( conn . getMetaData ( ) . getProtocolVersion ( ) ) ; try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "unassembling Beans message" ) ; ( ( JMFNativePart ) jsPart . getField ( JsPayloadAccess . PAYLOAD_DATA ) ) . unassemble ( ) ; } catch ( JMFException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.JsMsgObject.encodePayloadPartToSlice" , "jmo620" , this , new Object [ ] { MfpConstants . DM_MESSAGE , jsPart . jmfPart , theMessage } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "encodePayloadPartToSlice unassemble failed: " + e ) ; throw new MessageEncodeFailedException ( e ) ; } } byte [ ] buff = encodePart ( jsPart ) ; slice = new DataSlice ( buff , 0 , buff . length ) ; } } finally { MfpThreadDataImpl . clearPartnerLevel ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "encodePayloadPartToSlice" , slice ) ; return slice ; }
Encode a payload part into a DataSlice for transmitting over the wire or flattening for persistence . If the message part is already assembled the contents are simply be wrapped in a DataSlice by the JMFMessage & returned unless the message part contains a Beans Payload . If the message part is not already assembled or contains a Beans payload the part is encoded into a new byte array which is wrapped by a DataSlice .
38,121
JMFSchema [ ] getEncodingSchemas ( ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getEncodingSchemas" ) ; JMFSchema [ ] result ; try { JMFSchema [ ] result1 = ( ( JMFMessage ) headerPart . jmfPart ) . getSchemata ( ) ; JMFSchema [ ] result2 = null ; int resultSize = result1 . length ; if ( payloadPart != null ) { result2 = ( ( JMFMessage ) payloadPart . jmfPart ) . getSchemata ( ) ; resultSize += result2 . length ; } result = new JMFSchema [ resultSize ] ; System . arraycopy ( result1 , 0 , result , 0 , result1 . length ) ; if ( payloadPart != null ) { System . arraycopy ( result2 , 0 , result , result1 . length , result2 . length ) ; } } catch ( JMFException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.JsMsgObject.getEncodingSchemas" , "jmo700" , this , new Object [ ] { new Object [ ] { MfpConstants . DM_MESSAGE , headerPart . jmfPart , theMessage } , new Object [ ] { MfpConstants . DM_MESSAGE , payloadPart . jmfPart , theMessage } } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "getEncodingSchemas failed: " + e ) ; throw new MessageEncodeFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getEncodingSchemas" ) ; return result ; }
Get a list of the JMF schemas needed to decode this message
38,122
JsMsgObject getCopy ( ) throws MessageCopyFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getCopy" ) ; JsMsgObject newJmo = null ; try { synchronized ( theMessage ) { theMessage . updateDataFields ( MfpConstants . UDF_GET_COPY ) ; theMessage . clearPartCaches ( ) ; newJmo = new JsMsgObject ( null ) ; newJmo . headerPart = new JsMsgPart ( ( ( JMFMessage ) headerPart . jmfPart ) . copy ( ) ) ; newJmo . payloadPart = new JsMsgPart ( ( ( JMFMessage ) payloadPart . jmfPart ) . copy ( ) ) ; } } catch ( MessageDecodeFailedException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.impl.JsMsgObject.getCopy" , "jmo800" , this , new Object [ ] { new Object [ ] { MfpConstants . DM_MESSAGE , headerPart . jmfPart , theMessage } , new Object [ ] { MfpConstants . DM_MESSAGE , payloadPart . jmfPart , theMessage } } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "copy failed: " + e ) ; throw new MessageCopyFailedException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getCopy" , newJmo ) ; return newJmo ; }
Return a copy of this JsMsgObject .
38,123
private final void ensureReceiverHasSchemata ( CommsConnection conn ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "ensureReceiverHasSchemata" , conn ) ; if ( conn != null ) { SchemaManager . sendSchemas ( conn , ( ( JMFMessage ) headerPart . jmfPart ) . getSchemata ( ) ) ; if ( payloadPart != null ) { SchemaManager . sendSchemas ( conn , ( ( JMFMessage ) payloadPart . jmfPart ) . getSchemata ( ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "ensureReceiverHasSchemata" ) ; }
We need to check if the receiver has all the necessary schema definitions to be able to decode this message and pre - send any that are missing .
38,124
final String debugMsg ( ) { StringBuffer result ; result = new StringBuffer ( JSFormatter . format ( ( JMFMessage ) headerPart . jmfPart ) ) ; if ( payloadPart != null ) { result . append ( JSFormatter . formatWithoutPayloadData ( ( JMFMessage ) payloadPart . jmfPart ) ) ; } return result . toString ( ) ; }
in the payload .
38,125
final String debugId ( long id ) { byte [ ] buf = new byte [ 8 ] ; ArrayUtil . writeLong ( buf , 0 , id ) ; return HexUtil . toString ( buf ) ; }
For debug only ... Write a schema ID in hex
38,126
public synchronized boolean clearIfNotInUse ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "clearIfNotInUse" , new Object [ ] { _recoveryId , _recoveredInUseCount } ) ; boolean cleared = false ; if ( _loggedToDisk && _recoveredInUseCount == 0 ) { try { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "removing recoverable unit " + _recoveryId ) ; _partnerLog . removeRecoverableUnit ( _recoveryId ) ; _loggedToDisk = false ; _recoveryId = 0 ; cleared = true ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.Transaction.JTA.PartnerLogData.clearIfNotInUse" , "218" , this ) ; if ( e instanceof WriteOperationFailedException ) { Tr . error ( tc , "WTRN0066_LOG_WRITE_ERROR" , e ) ; } else { Tr . error ( tc , "WTRN0000_ERR_INT_ERROR" , new Object [ ] { "clearIfNotInUse" , "com.ibm.ws.Transaction.JTA.PartnerLogData" , e } ) ; } } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "clearIfNotInUse" , cleared ) ; return cleared ; }
Clears the recovery log record associated with this partner from the partner log if this partner is not associated with current transactions . If this partner is re - used the logData call will allocate a new recoverable unit and re - log the information back to the partner log .
38,127
public boolean recover ( ClassLoader cl , Xid [ ] xids , byte [ ] failedStoken , byte [ ] cruuid , int restartEpoch ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "recover" , new Object [ ] { this , cl , xids , failedStoken , cruuid , restartEpoch } ) ; decrementCount ( ) ; return true ; }
Default implementation for non - XA recovery data items
38,128
private void getFilesForFeature ( File installRoot , final Set < String > absPathsForLibertyContent , final Set < String > absPathsForLibertyBundles , final Set < String > absPathsForLibertyLocalizations , final Set < String > absPathsForLibertyIcons , final ProvisioningFeatureDefinition fd , final ContentBasedLocalBundleRepository br ) { Collection < FeatureResource > frs = fd . getConstituents ( null ) ; for ( FeatureResource fr : frs ) { switch ( fr . getType ( ) ) { case FEATURE_TYPE : { break ; } case BUNDLE_TYPE : case BOOT_JAR_TYPE : { addJarResource ( absPathsForLibertyBundles , fd , br , fr ) ; break ; } case JAR_TYPE : { addJarResource ( absPathsForLibertyContent , fd , br , fr ) ; break ; } case FILE_TYPE : { String locString = fr . getLocation ( ) ; if ( locString != null ) { addFileResource ( installRoot , absPathsForLibertyContent , locString ) ; } else { throw new BuildException ( "No location on file type for resource " + fr . getSymbolicName ( ) + " in feature " + fd . getFeatureName ( ) ) ; } break ; } case UNKNOWN : { log ( "Unknown feature resource for " + fr . getSymbolicName ( ) + " in feature " + fd . getFeatureName ( ) + ". The type is: " + fr . getRawType ( ) , Project . MSG_ERR ) ; String locString = fr . getLocation ( ) ; if ( locString != null ) { addFileResource ( installRoot , absPathsForLibertyContent , locString ) ; } } } } for ( File nls : fd . getLocalizationFiles ( ) ) { if ( nls . exists ( ) ) { absPathsForLibertyLocalizations . add ( nls . getAbsolutePath ( ) ) ; } } for ( String icon : fd . getIcons ( ) ) { File iconFile = new File ( fd . getFeatureDefinitionFile ( ) . getParentFile ( ) , "icons/" + fd . getSymbolicName ( ) + "/" + icon ) ; if ( iconFile . exists ( ) ) { absPathsForLibertyIcons . add ( iconFile . getAbsolutePath ( ) ) ; } else { throw new BuildException ( "Icon file " + iconFile . getAbsolutePath ( ) + " doesn't exist" ) ; } } }
as we have a complete build we don t need
38,129
public void addFileResource ( File installRoot , final Set < String > content , String locString ) { String [ ] locs ; if ( locString . contains ( "," ) ) { locs = locString . split ( "," ) ; } else { locs = new String [ ] { locString } ; } for ( String loc : locs ) { File test = new File ( loc ) ; if ( ! test . isAbsolute ( ) ) { test = new File ( installRoot , loc ) ; } loc = test . getAbsolutePath ( ) ; content . add ( loc ) ; } }
Adds a file resource to the set of file paths .
38,130
private void copy ( OutputStream out , File in ) throws IOException { FileInputStream inStream = null ; try { inStream = new FileInputStream ( in ) ; byte [ ] buffer = new byte [ 4096 ] ; int len ; while ( ( len = inStream . read ( buffer ) ) != - 1 ) { out . write ( buffer , 0 , len ) ; } } finally { if ( inStream != null ) { inStream . close ( ) ; } } }
Copies the file to the output stream
38,131
public static String getDataSourceIdentifier ( WSJdbcWrapper jdbcWrapper ) { DSConfig config = jdbcWrapper . dsConfig . get ( ) ; return config . jndiName == null ? config . id : config . jndiName ; }
Utility method to obtain the unique identifier of the data source associated with a JDBC wrapper .
38,132
public static String getSql ( Object jdbcWrapper ) { if ( jdbcWrapper instanceof WSJdbcPreparedStatement ) return ( ( WSJdbcPreparedStatement ) jdbcWrapper ) . sql ; else if ( jdbcWrapper instanceof WSJdbcResultSet ) return ( ( WSJdbcResultSet ) jdbcWrapper ) . sql ; else return null ; }
Utility method to obtain the SQL command associated with a JDBC resource .
38,133
public static void handleStaleStatement ( WSJdbcWrapper jdbcWrapper ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( tc , "Encountered a Stale Statement: " + jdbcWrapper ) ; if ( jdbcWrapper instanceof WSJdbcObject ) try { WSJdbcConnection connWrapper = ( WSJdbcConnection ) ( ( WSJdbcObject ) jdbcWrapper ) . getConnectionWrapper ( ) ; WSRdbManagedConnectionImpl mc = connWrapper . managedConn ; connWrapper . markStmtsAsNotPoolable ( ) ; if ( mc != null ) mc . clearStatementCache ( ) ; } catch ( NullPointerException nullX ) { if ( ! ( ( WSJdbcObject ) jdbcWrapper ) . isClosed ( ) ) throw nullX ; } }
Performs special handling for stale statements such as clearing the statement cache and marking existing statements non - poolable .
38,134
public static SQLException mapException ( WSJdbcWrapper jdbcWrapper , SQLException sqlX ) { Object mapper = null ; WSJdbcConnection connWrapper = null ; if ( jdbcWrapper instanceof WSJdbcObject ) { connWrapper = ( WSJdbcConnection ) ( ( WSJdbcObject ) jdbcWrapper ) . getConnectionWrapper ( ) ; if ( connWrapper != null ) { mapper = connWrapper . isClosed ( ) ? connWrapper . mcf : connWrapper . managedConn ; } } else mapper = jdbcWrapper . mcf ; return ( SQLException ) AdapterUtil . mapException ( sqlX , connWrapper , mapper , true ) ; }
Map a SQLException . And if it s a connection error send a CONNECTION_ERROR_OCCURRED ConnectionEvent to all listeners of the Managed Connection .
38,135
public static boolean validLocalHostName ( String hostName ) { InetAddress addr = findLocalHostAddress ( hostName , PREFER_IPV6 ) ; return addr != null ; }
Verifies whether or not the provided hostname references an interface on this machine . The provided name is unchanged by this operation .
38,136
public static ManifestInfo parseManifest ( JarFile jar ) throws RepositoryArchiveException , RepositoryArchiveIOException { String prov = null ; Manifest mf = null ; try { mf = jar . getManifest ( ) ; } catch ( IOException e ) { throw new RepositoryArchiveIOException ( "Unable to access manifest in sample" , new File ( jar . getName ( ) ) , e ) ; } finally { try { jar . close ( ) ; } catch ( IOException e ) { throw new RepositoryArchiveIOException ( "Unable to access manifest in sample" , new File ( jar . getName ( ) ) , e ) ; } } if ( null == mf ) { throw new RepositoryArchiveEntryNotFoundException ( "No manifest file found in sample" , new File ( jar . getName ( ) ) , "/META-INF/MANIFEST.MF" ) ; } String appliesTo = null ; ResourceType type = null ; List < String > requiresList = new ArrayList < String > ( ) ; Attributes mainattrs = mf . getMainAttributes ( ) ; for ( Object at : mainattrs . keySet ( ) ) { String attribName = ( ( Attributes . Name ) at ) . toString ( ) ; String attribValue = ( String ) mainattrs . get ( at ) ; if ( APPLIES_TO . equals ( attribName ) ) { appliesTo = attribValue ; } else if ( SAMPLE_TYPE . equals ( attribName ) ) { String typeString = ( String ) mainattrs . get ( at ) ; if ( SAMPLE_TYPE_OPENSOURCE . equals ( typeString ) ) { type = ResourceType . OPENSOURCE ; } else if ( SAMPLE_TYPE_PRODUCT . equals ( typeString ) ) { type = ResourceType . PRODUCTSAMPLE ; } else { throw new IllegalArgumentException ( "The following jar file is not a known sample type " + jar . getName ( ) ) ; } } else if ( REQUIRE_FEATURE . equals ( attribName ) ) { StringTokenizer featuresTokenizer = new StringTokenizer ( attribValue , "," ) ; while ( featuresTokenizer . hasMoreElements ( ) ) { String nextFeature = ( String ) featuresTokenizer . nextElement ( ) ; requiresList . add ( nextFeature ) ; } } else if ( PROVIDER . equals ( attribName ) ) { prov = attribValue ; } } if ( null == prov ) { throw new RepositoryArchiveInvalidEntryException ( "No Bundle-Vendor specified in the sample's manifest" , new File ( jar . getName ( ) ) , "/META-INF/MANIFEST.MF" ) ; } if ( null == type ) { throw new RepositoryArchiveInvalidEntryException ( "No Sample-Type specified in the sample's manifest" , new File ( jar . getName ( ) ) , "/META-INF/MANIFEST.MF" ) ; } String archiveRoot = mainattrs . getValue ( "Archive-Root" ) ; archiveRoot = archiveRoot != null ? archiveRoot : "" ; ManifestInfo mi = new ManifestInfo ( prov , appliesTo , type , requiresList , archiveRoot , mf ) ; return mi ; }
Extracts information from the manifest in the supplied jar file and populates a newly created WlpInformation object with the extracted information as well as putting information into the asset itself .
38,137
void timerLoop ( ) throws ResourceException { final String methodName = "timerLoop" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } checkMEs ( getMEsToCheck ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName ) ; } }
This method will be driven by a timer pop or by the MDB starting up . This is the entry point
38,138
void checkMEs ( JsMessagingEngine [ ] MEList ) throws ResourceException { final String methodName = "checkMEs" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { MEList } ) ; } JsMessagingEngine [ ] preferredMEs = _destinationStrategy . getPreferredLocalMEs ( MEList ) ; try { connect ( preferredMEs , _targetType , _targetSignificance , _target , true ) ; SibTr . info ( TRACE , "TARGETTED_CONNECTION_SUCCESSFUL_CWSIV0556" , new Object [ ] { ( ( MDBMessageEndpointFactory ) _messageEndpointFactory ) . getActivationSpecId ( ) , _endpointConfiguration . getDestination ( ) . getDestinationName ( ) } ) ; } catch ( Exception e ) { SibTr . warning ( TRACE , SibTr . Suppressor . ALL_FOR_A_WHILE , "CONNECT_FAILED_CWSIV0782" , new Object [ ] { _endpointConfiguration . getDestination ( ) . getDestinationName ( ) , _endpointConfiguration . getBusName ( ) , ( ( MDBMessageEndpointFactory ) _messageEndpointFactory ) . getActivationSpecId ( ) , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Failed to obtain a connection - retry after a set interval" ) ; } clearTimer ( ) ; deactivate ( ) ; kickOffTimer ( ) ; } if ( _destinationStrategy . isTimerNeeded ( ) ) { clearTimer ( ) ; kickOffTimer ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName ) ; } }
This method will check the supplied MEs to see if they are suitable for connecting to .
38,139
void kickOffTimer ( ) throws UnavailableException { final String methodName = "kickOffTimer" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } synchronized ( _timerLock ) { if ( _timer != null ) { return ; } _timer = _bootstrapContext . createTimer ( ) ; _timer . schedule ( new TimerTask ( ) { public void run ( ) { try { synchronized ( _timerLock ) { _timer . cancel ( ) ; _timer = null ; timerLoop ( ) ; } } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:420:1.45" , this ) ; SibTr . error ( TRACE , "CONNECT_FAILED_CWSIV0783" , new Object [ ] { _endpointConfiguration . getDestination ( ) . getDestinationName ( ) , _endpointConfiguration . getBusName ( ) , this , exception } ) ; } } } , _retryInterval ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName ) ; } }
Kicks of a timer to attempt to create connections after a user specified interval .
38,140
private void createSingleListener ( final SibRaMessagingEngineConnection connection ) throws ResourceException { final String methodName = "createSingleListener" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , connection ) ; } final SIDestinationAddress destination = _endpointConfiguration . getDestination ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Creating a consumer to consume from destination " + destination + " on ME " + connection . getConnection ( ) . getMeName ( ) ) ; } try { connection . createListener ( destination , _messageEndpointFactory ) ; SibTr . info ( TRACE , "CONNECTED_CWSIV0777" , new Object [ ] { connection . getConnection ( ) . getMeName ( ) , _endpointConfiguration . getDestination ( ) . getDestinationName ( ) , _endpointConfiguration . getBusName ( ) } ) ; } catch ( final IllegalStateException exception ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Failed to create a session - blowing away the connection - rethrow the exception" ) ; } _connections . remove ( connection . getConnection ( ) . getMeUuid ( ) ) ; connection . close ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } throw exception ; } catch ( final ResourceException exception ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Failed to create a session - blowing away the connection - a retry should occur" ) ; SibTr . debug ( TRACE , "Exception cause was " + exception . getCause ( ) ) ; } _connections . remove ( connection . getConnection ( ) . getMeUuid ( ) ) ; connection . close ( ) ; throw exception ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
This method will create a listener to the specified destination
38,141
private void createMultipleListeners ( final SibRaMessagingEngineConnection connection ) throws ResourceException { final String methodName = "createMultipleListeners" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , connection ) ; } try { final SICoreConnection coreConnection = connection . getConnection ( ) ; final DestinationListener destinationListener = new SibRaDestinationListener ( connection , _messageEndpointFactory ) ; final DestinationType destinationType = _endpointConfiguration . getDestinationType ( ) ; final SIDestinationAddress [ ] destinations = coreConnection . addDestinationListener ( _endpointConfiguration . getDestinationName ( ) , destinationListener , destinationType , DestinationAvailability . RECEIVE ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( P2PTRACE , "Found " + destinations . length + " destinations that make the wildcard" ) ; } for ( int j = 0 ; j < destinations . length ; j ++ ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( P2PTRACE , "Creating a consumer for destination " + destinations [ j ] ) ; } connection . createListener ( destinations [ j ] , _messageEndpointFactory ) ; } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:877:1.45" , this ) ; SibTr . error ( TRACE , "CREATE_LISTENER_FAILED_CWSIV0803" , new Object [ ] { exception , destinations [ j ] . getDestinationName ( ) , connection . getConnection ( ) . getMeName ( ) , connection . getBusName ( ) } ) ; } } } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , "1:889:1.45" , this ) ; SibTr . error ( TRACE , "ADD_DESTINATION_LISTENER_FAILED_CWSIV0804" , new Object [ ] { exception , connection . getConnection ( ) . getMeName ( ) , connection . getBusName ( ) } ) ; _connections . remove ( connection . getConnection ( ) . getMeUuid ( ) ) ; connection . close ( ) ; } if ( connection . getNumberListeners ( ) == 0 ) { SibTr . warning ( TRACE , "NO_LISTENERS_CREATED_CWSIV0809" , new Object [ ] { _endpointConfiguration . getDestinationName ( ) , connection . getConnection ( ) . getMeName ( ) , connection . getBusName ( ) } ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
This method will create a listener to each destination that matches the wildcarded destination
38,142
boolean checkIfRemote ( SibRaMessagingEngineConnection conn ) { final String methodName = "checkIfRemote" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { conn } ) ; } String meName = conn . getConnection ( ) . getMeName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Connections's ME name " + meName ) ; } boolean remote = true ; JsMessagingEngine [ ] localMEs = SibRaEngineComponent . getActiveMessagingEngines ( _endpointConfiguration . getBusName ( ) ) ; for ( int i = 0 ; i < localMEs . length ; i ++ ) { JsMessagingEngine me = localMEs [ i ] ; String localName = me . getName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Checking ME name " + localName ) ; } if ( localName . equals ( meName ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Me name matched, the connection is local" ) ; } remote = false ; break ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName , remote ) ; } return remote ; }
This method checks to see if the specified connection is to a remote ME . It will check the name of the ME the connection is connected to againgst the list of local MEs that are on the locla server .
38,143
void dropNonPreferredConnections ( ) { final String methodName = "dropNonPreferredConnections" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } if ( ! _connectedToPreferred ) { closeConnections ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName ) ; } }
This method will close any connections that are considered non preferred . Non preferred connections are only created when target significane is set to preferred and the system was not able to create a connection that match the target data .
38,144
void dropRemoteConnections ( ) { final String methodName = "dropRemoteConnections" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } if ( _connectedRemotely ) { closeConnections ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName ) ; } }
If we are connected remotely then drop the connection .
38,145
void closeConnections ( ) { final String methodName = "closeConnections" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } synchronized ( _connections ) { Collection < SibRaMessagingEngineConnection > cons = _connections . values ( ) ; Iterator < SibRaMessagingEngineConnection > iter = cons . iterator ( ) ; while ( iter . hasNext ( ) ) { SibRaMessagingEngineConnection connection = iter . next ( ) ; connection . close ( ) ; } _connections . clear ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( TRACE , methodName ) ; } }
Close all the connections we currently have open .
38,146
public synchronized void messagingEngineStopping ( final JsMessagingEngine messagingEngine , final int mode ) { final String methodName = "messagingEngineStopping" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { messagingEngine , Integer . valueOf ( mode ) } ) ; } SibTr . info ( TRACE , "ME_STOPPING_CWSIV0784" , new Object [ ] { messagingEngine . getName ( ) , messagingEngine . getBus ( ) } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Overrides the parent method so that if there are no connections left it will check to see if a new connection can be made
38,147
void dropConnection ( SibRaMessagingEngineConnection connection , boolean isSessionError , boolean retryImmediately , boolean alreadyClosed ) { String methodName = "dropConnection" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { connection , Boolean . valueOf ( isSessionError ) , Boolean . valueOf ( retryImmediately ) , Boolean . valueOf ( alreadyClosed ) } ) ; } SibRaMessagingEngineConnection connectionCheck = null ; String meUuid = connection . getConnection ( ) . getMeUuid ( ) ; synchronized ( _connections ) { connectionCheck = _connections . get ( meUuid ) ; if ( connection == connectionCheck ) { closeConnection ( meUuid , alreadyClosed ) ; } } if ( ! isSessionError || ( ! SibRaEngineComponent . isMessagingEngineReloading ( meUuid ) ) ) { synchronized ( _timerLock ) { synchronized ( _connections ) { if ( _connections . size ( ) == 0 ) { try { clearTimer ( ) ; if ( retryImmediately ) { timerLoop ( ) ; } else { kickOffTimer ( ) ; } } catch ( final ResourceException resEx ) { FFDCFilter . processException ( resEx , CLASS_NAME + "." + methodName , "1:1434:1.45" , this ) ; SibTr . error ( TRACE , "CONNECT_FAILED_CWSIV0783" , new Object [ ] { _endpointConfiguration . getDestination ( ) . getDestinationName ( ) , _endpointConfiguration . getBusName ( ) , this , resEx } ) ; } } } } } else { clearTimer ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Drop the connection to the specified ME . If we have no connections left then try to create a new connection .
38,148
public void messagingEngineDestroyed ( JsMessagingEngine messagingEngine ) { final String methodName = "messagingEngineDestroyed" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
The messaging engine has been destroyed nothing to do here .
38,149
private boolean validMagicNumber ( byte [ ] magicNumberBuffer ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "validMagicNumber" , new java . lang . Object [ ] { RLSUtils . toHexString ( magicNumberBuffer , RLSUtils . MAX_DISPLAY_BYTES ) , this } ) ; boolean incorrectByteDetected = false ; int currentByte = 0 ; while ( ( ! incorrectByteDetected ) && ( currentByte < LogFileHeader . MAGIC_NUMBER . length ) ) { if ( magicNumberBuffer [ currentByte ] != LogFileHeader . MAGIC_NUMBER [ currentByte ] ) { incorrectByteDetected = true ; } currentByte ++ ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "validMagicNumber" , new Boolean ( ! incorrectByteDetected ) ) ; return ! incorrectByteDetected ; }
Determines if the supplied magic number is a valid log file header magic number as stored in MAGIC_NUMBER
38,150
public long date ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "date" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "date" , new Long ( _date ) ) ; return _date ; }
Return the date field stored in the target header
38,151
public long firstRecordSequenceNumber ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "firstRecordSequenceNumber" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "firstRecordSequenceNumber" , new Long ( _firstRecordSequenceNumber ) ) ; return _firstRecordSequenceNumber ; }
Return the firstRecordSequenceNumber field stored in the target header
38,152
public String serviceName ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "serviceName" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "serviceName" , _serviceName ) ; return _serviceName ; }
Return the serviceName field stored in the target header
38,153
public int serviceVersion ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "serviceVersion" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "serviceVersion" , new Integer ( _serviceVersion ) ) ; return _serviceVersion ; }
Return the serviceVersion field stored in the target header
38,154
public String logName ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "logName" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "logName" , _logName ) ; return _logName ; }
Return the logName field stored in the target header
38,155
public byte [ ] getServiceData ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getServiceData" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getServiceData" , RLSUtils . toHexString ( _serviceData , RLSUtils . MAX_DISPLAY_BYTES ) ) ; return _serviceData ; }
Return the service data stored in the target header .
38,156
public void setServiceData ( byte [ ] serviceData ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "setServiceData" , new java . lang . Object [ ] { RLSUtils . toHexString ( serviceData , RLSUtils . MAX_DISPLAY_BYTES ) , this } ) ; _serviceData = serviceData ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "setServiceData" ) ; }
Change the service data associated with the target log file header .
38,157
public boolean compatible ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "compatible" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "compatible" , new Boolean ( _compatible ) ) ; return _compatible ; }
Test to determine if the target log file header belongs to a compatible RLS file .
38,158
public boolean valid ( ) { boolean valid = true ; if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "valid" , this ) ; if ( _status == STATUS_INVALID ) valid = false ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "valid" , new Boolean ( valid ) ) ; return valid ; }
Test to determine if the target log file header belongs to a valid RLS file .
38,159
public int status ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "status" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "status" , new Integer ( _status ) ) ; return _status ; }
Return the status field stored in the target header
38,160
public void reset ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "reset" , this ) ; _status = STATUS_ACTIVE ; _date = 0 ; _firstRecordSequenceNumber = 0 ; _serverName = null ; _serviceName = null ; _serviceVersion = 0 ; _logName = null ; _variableFieldData = initVariableFieldData ( ) ; _serviceData = null ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "reset" ) ; }
Destroy the internal state of this header object . Note that we don t reset the _compatible flag as we call this method from points in the code wher its both true and false and we want to ensure that it is represented in the exceptions that get thrown when other calls are made .
38,161
public void changeStatus ( int newStatus ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "changeStatus" , new java . lang . Object [ ] { this , new Integer ( newStatus ) } ) ; _status = newStatus ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "changeStatus" ) ; }
Update the status field stored in the target header .
38,162
public void keypointStarting ( long nextRecordSequenceNumber ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "keypointStarting" , new Object [ ] { this , new Long ( nextRecordSequenceNumber ) } ) ; GregorianCalendar currentCal = new GregorianCalendar ( ) ; Date currentDate = currentCal . getTime ( ) ; _date = currentDate . getTime ( ) ; _firstRecordSequenceNumber = nextRecordSequenceNumber ; _status = STATUS_KEYPOINTING ; _variableFieldData = initVariableFieldData ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointStarting" ) ; }
Informs the LogFileHeader instance that a keypoint operation is about begin into file associated with this LogFileHeader instance . The status of the header is updated to KEYPOINTING .
38,163
public void keypointComplete ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "keypointComplete" , this ) ; _status = STATUS_ACTIVE ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "keypointComplete" ) ; }
Informs the LogFileHeader instance that the keypoint operation has completed . The status of the header is updated to ACTIVE .
38,164
static String statusToString ( int status ) { String result = null ; if ( status == STATUS_INACTIVE ) { result = "INACTIVE" ; } else if ( status == STATUS_ACTIVE ) { result = "ACTIVE" ; } else if ( status == STATUS_KEYPOINTING ) { result = "KEYPOINTING" ; } else if ( status == STATUS_INVALID ) { result = "INVALID" ; } else { result = "UNKNOWN" ; } return result ; }
Utility method to convert a numerical status into a printable string form .
38,165
public TransactionCommon registerInBatch ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "registerInBatch" ) ; _readWriteLock . lock ( ) ; synchronized ( this ) { if ( _currentTran == null ) _currentTran = _txManager . createLocalTransaction ( false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "registerInBatch" , _currentTran ) ; return _currentTran ; }
Register an interest in the current batch . The batch can not be completed until messagesAdded is called .
38,166
public void messagesAdded ( int msgCount , BatchListener listener ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "messagesAdded" , "msgCount=" + msgCount + ",listener=" + listener ) ; boolean completeBatch = false ; try { synchronized ( this ) { _currentBatchSize += msgCount ; if ( ( listener != null ) && ( ! _listeners . contains ( listener ) ) ) { _listeners . add ( listener ) ; } if ( _currentBatchSize >= _batchSize ) { completeBatch = true ; } else if ( ( _currentBatchSize - msgCount ) == 0 ) { startTimer ( ) ; } } } finally { _readWriteLock . unlock ( ) ; } if ( completeBatch ) { completeBatch ( false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "messagesAdded" ) ; }
Tell the BatchHandler how many messages were added under the current transaction .
38,167
public void completeBatch ( boolean force , BatchListener finalListener ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "completeBatch" , "force=" + force + ",finalListener=" + finalListener ) ; _readWriteLock . lockExclusive ( ) ; try { if ( ( force && ( _currentBatchSize > 0 ) ) || ( _currentBatchSize >= _batchSize ) ) { Iterator itr = _listeners . iterator ( ) ; while ( itr . hasNext ( ) ) { BatchListener listener = ( BatchListener ) itr . next ( ) ; listener . batchPrecommit ( _currentTran ) ; } if ( finalListener != null ) finalListener . batchPrecommit ( _currentTran ) ; boolean committed = false ; Exception exceptionOnCommit = null ; try { _currentTran . commit ( ) ; committed = true ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.store.BatchHandler.completeBatch" , "1:254:1.30" , this ) ; committed = false ; SibTr . exception ( tc , e ) ; exceptionOnCommit = e ; } _currentBatchSize = 0 ; _currentTran = null ; itr = _listeners . iterator ( ) ; while ( itr . hasNext ( ) ) { BatchListener listener = ( BatchListener ) itr . next ( ) ; if ( committed ) listener . batchCommitted ( ) ; else listener . batchRolledBack ( ) ; itr . remove ( ) ; } if ( finalListener != null ) { if ( committed ) finalListener . batchCommitted ( ) ; else finalListener . batchRolledBack ( ) ; } if ( exceptionOnCommit != null ) { _readWriteLock . unlockExclusive ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "completeBatch" , exceptionOnCommit ) ; throw new SIResourceException ( exceptionOnCommit ) ; } cancelTimer ( ) ; } else { if ( finalListener != null ) finalListener . batchCommitted ( ) ; } } finally { _readWriteLock . unlockExclusive ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "completeBatch" ) ; }
Complete the current batch . If timer is false then the batch is only completed if the batch is full . If timer is true then the batch is completed so long as there are one or more messages in the batch .
38,168
public void alarm ( Object alarmContext ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "alarm" , alarmContext ) ; synchronized ( this ) { _alarm = null ; } try { completeBatch ( true ) ; } catch ( SIException e ) { SibTr . exception ( this , tc , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "alarm" ) ; }
Method called when an alarm pops
38,169
private void parseIDFromURL ( RequestMessage request ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Looking for ID in URL" ) ; } String url = request . getRawRequestURI ( ) ; String target = getSessionConfig ( ) . getURLRewritingMarker ( ) ; URLParser parser = new URLParser ( url , target ) ; if ( - 1 != parser . idMarker ) { int start = parser . idMarker + target . length ( ) ; if ( - 1 != parser . fragmentMarker ) { this . id = url . substring ( start , parser . fragmentMarker ) ; } else if ( - 1 != parser . queryMarker ) { this . id = url . substring ( start , parser . queryMarker ) ; } else { this . id = url . substring ( start ) ; } this . fromURL = true ; } }
Look for the possible session ID in the URL of the input request message .
38,170
public static String encodeURL ( String url , SessionInfo info ) { HttpSession session = info . getSession ( ) ; if ( null == session ) { return url ; } final String id = session . getId ( ) ; final String target = info . getSessionConfig ( ) . getURLRewritingMarker ( ) ; URLParser parser = new URLParser ( url , target ) ; StringBuilder sb = new StringBuilder ( ) ; if ( - 1 != parser . idMarker ) { sb . append ( url ) ; int start = parser . idMarker + target . length ( ) ; if ( start + 23 < url . length ( ) ) { sb . replace ( start , start + 23 , id ) ; } else { sb . setLength ( parser . idMarker ) ; sb . append ( target ) . append ( id ) ; } } else { if ( - 1 != parser . fragmentMarker ) { sb . append ( url , 0 , parser . fragmentMarker ) ; sb . append ( target ) . append ( id ) ; sb . append ( url , parser . fragmentMarker , url . length ( ) ) ; } else if ( - 1 != parser . queryMarker ) { sb . append ( url , 0 , parser . queryMarker ) ; sb . append ( target ) . append ( id ) ; sb . append ( url , parser . queryMarker , url . length ( ) ) ; } else { sb . append ( url ) . append ( target ) . append ( id ) ; } } return sb . toString ( ) ; }
Encode session information into the provided URL . This will replace any existing session in that URL .
38,171
public static String stripURL ( String url , SessionInfo info ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Removing any session id from [" + url + "]" ) ; } String target = info . getSessionConfig ( ) . getURLRewritingMarker ( ) ; URLParser parser = new URLParser ( url , target ) ; if ( - 1 != parser . idMarker ) { StringBuilder sb = new StringBuilder ( url . substring ( 0 , parser . idMarker ) ) ; if ( - 1 != parser . fragmentMarker ) { sb . append ( url . substring ( parser . fragmentMarker ) ) ; } else if ( - 1 != parser . queryMarker ) { sb . append ( url . substring ( parser . queryMarker ) ) ; } return sb . toString ( ) ; } return url ; }
Strip out any session id information from the input URL .
38,172
private void parseIDFromCookies ( RequestMessage request ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Looking for ID in cookies" ) ; } Enumeration < String > list = request . getHeaders ( "Cookie" ) ; while ( list . hasMoreElements ( ) ) { String item = list . nextElement ( ) ; int index = item . indexOf ( getSessionConfig ( ) . getIDName ( ) ) ; if ( - 1 != index ) { index = item . indexOf ( '=' , index ) ; if ( - 1 != index ) { index ++ ; if ( item . length ( ) >= ( index + 4 ) ) { this . id = item . substring ( index , index + 4 ) ; this . fromCookie = true ; break ; } } } } }
Look for a possible session id in the cookies of the request message .
38,173
public static Cookie encodeCookie ( SessionInfo info ) { HttpSession session = info . getSession ( ) ; SessionConfig config = info . getSessionConfig ( ) ; Cookie cookie = new Cookie ( config . getIDName ( ) , config . getSessionVersion ( ) + session . getId ( ) ) ; cookie . setSecure ( config . isCookieSecure ( ) ) ; cookie . setMaxAge ( config . getCookieMaxAge ( ) ) ; cookie . setPath ( config . getCookiePath ( ) ) ; cookie . setDomain ( config . getCookieDomain ( ) ) ; return cookie ; }
Create a proper Cookie for the given session object .
38,174
public HttpSession getSession ( boolean create ) { if ( null != this . mySession ) { if ( this . mySession . isInvalid ( ) ) { this . mySession = null ; } else { return this . mySession ; } } this . mySession = mgr . getSession ( this , create ) ; return this . mySession ; }
Access the current session for this connection . This may return null if one was not found and the create flag was false . If a cached session is found but it reports as invalid then this will look for a new session if the create flag is true .
38,175
public int get_searchScope ( ) { int searchScope = SearchControls . OBJECT_SCOPE ; String scopeBuf = get_scope ( ) ; if ( scopeBuf != null ) { if ( scopeBuf . compareToIgnoreCase ( "base" ) == 0 ) { searchScope = SearchControls . OBJECT_SCOPE ; } else if ( scopeBuf . compareToIgnoreCase ( "one" ) == 0 ) { searchScope = SearchControls . ONELEVEL_SCOPE ; } else if ( scopeBuf . compareToIgnoreCase ( "sub" ) == 0 ) { searchScope = SearchControls . SUBTREE_SCOPE ; } } return searchScope ; }
Returns the search scope used in LDAP search
38,176
public PersistenceUnitTransactionType getTransactionType ( ) { PersistenceUnitTransactionType rtnType = null ; com . ibm . ws . jpa . pxml21 . PersistenceUnitTransactionType jaxbType = null ; jaxbType = ivPUnit . getTransactionType ( ) ; if ( jaxbType == com . ibm . ws . jpa . pxml21 . PersistenceUnitTransactionType . JTA ) { rtnType = PersistenceUnitTransactionType . JTA ; } else if ( jaxbType == com . ibm . ws . jpa . pxml21 . PersistenceUnitTransactionType . RESOURCE_LOCAL ) { rtnType = PersistenceUnitTransactionType . RESOURCE_LOCAL ; } return rtnType ; }
Gets the value of the transactionType property .
38,177
public static boolean copyModuleMetaDataSlot ( MetaDataEvent < ModuleMetaData > event , MetaDataSlot slot ) { Container container = event . getContainer ( ) ; MetaData metaData = event . getMetaData ( ) ; try { ExtendedModuleInfo moduleInfo = ( ExtendedModuleInfo ) container . adapt ( NonPersistentCache . class ) . getFromCache ( WebModuleInfo . class ) ; if ( moduleInfo == null ) { moduleInfo = ( ExtendedModuleInfo ) container . adapt ( NonPersistentCache . class ) . getFromCache ( ClientModuleInfo . class ) ; } if ( moduleInfo != null ) { ModuleMetaData primaryMetaData = moduleInfo . getMetaData ( ) ; if ( metaData != primaryMetaData ) { Object slotData = primaryMetaData . getMetaData ( slot ) ; if ( slotData == null ) { throw new IllegalStateException ( ) ; } metaData . setMetaData ( slot , slotData ) ; return true ; } } } catch ( UnableToAdaptException e ) { throw new UnsupportedOperationException ( e ) ; } return false ; }
Copy slot data from a primary module metadata to a nested module metadata . This is necessary for containers that want to share module - level data for all components in a module because nested modules have their own distinct metadata .
38,178
private static Object injectAndPostConstruct ( Object injectionProvider , Class Klass , List injectedBeanStorage ) { Object instance = null ; if ( injectionProvider != null ) { try { Object managedObject = _FactoryFinderProviderFactory . INJECTION_PROVIDER_INJECT_CLASS_METHOD . invoke ( injectionProvider , Klass ) ; instance = _FactoryFinderProviderFactory . MANAGED_OBJECT_GET_OBJECT_METHOD . invoke ( managedObject , null ) ; if ( instance != null ) { Object creationMetaData = _FactoryFinderProviderFactory . MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD . invoke ( managedObject , CreationalContext . class ) ; addBeanEntry ( instance , creationMetaData , injectedBeanStorage ) ; _FactoryFinderProviderFactory . INJECTION_PROVIDER_POST_CONSTRUCT_METHOD . invoke ( injectionProvider , instance , creationMetaData ) ; } } catch ( Exception ex ) { throw new FacesException ( ex ) ; } } return instance ; }
injectANDPostConstruct based on a class added for CDI 1 . 2 support .
38,179
private Collection < String > getCollectionFromSpaceSplitString ( String stringValue ) { if ( stringValue . equals ( VAL_FORM ) ) { return VAL_FORM_LIST ; } else if ( stringValue . equals ( VAL_ALL ) ) { return VAL_ALL_LIST ; } else if ( stringValue . equals ( VAL_NONE ) ) { return VAL_NONE_LIST ; } else if ( stringValue . equals ( VAL_THIS ) ) { return VAL_THIS_LIST ; } String [ ] arrValue = stringValue . split ( " " ) ; return Arrays . asList ( arrValue ) ; }
Splits the String based on spaces and returns the resulting Strings as Collection .
38,180
public static void traceSetTxCommon ( int opType , String txId , String desc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { StringBuffer sbuf = new StringBuffer ( ) ; sbuf . append ( TxLifeCycle_Set_Tx_Type_Str ) . append ( DataDelimiter ) . append ( TxLifeCycle_Set_Tx_Type ) . append ( DataDelimiter ) . append ( opType ) . append ( DataDelimiter ) . append ( txId ) . append ( DataDelimiter ) . append ( desc ) ; Tr . debug ( tc , sbuf . toString ( ) ) ; } }
This is called by the EJB container server code to write a set transaction record to the trace log if enabled .
38,181
public static void traceCommon ( int opType , String txId , String desc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { StringBuffer sbuf = new StringBuffer ( ) ; sbuf . append ( TxLifeCycle_State_Type_Str ) . append ( DataDelimiter ) . append ( TxLifeCycle_State_Type ) . append ( DataDelimiter ) . append ( opType ) . append ( DataDelimiter ) . append ( txId ) . append ( DataDelimiter ) . append ( desc ) ; Tr . debug ( tc , sbuf . toString ( ) ) ; } }
This is called by the EJB container server code to write a common record to the trace log if enabled .
38,182
synchronized private JaspiConfig readConfigFile ( final File configFile ) throws PrivilegedActionException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "readConfigFile" , new Object [ ] { configFile } ) ; if ( configFile == null ) { } PrivilegedExceptionAction < JaspiConfig > unmarshalFile = new PrivilegedExceptionAction < JaspiConfig > ( ) { public JaspiConfig run ( ) throws Exception { JaspiConfig cfg = null ; JAXBContext jc = JAXBContext . newInstance ( JaspiConfig . class ) ; Object obj = jc . createUnmarshaller ( ) . unmarshal ( configFile ) ; if ( obj instanceof JaspiConfig ) { cfg = ( JaspiConfig ) obj ; } return cfg ; } } ; JaspiConfig jaspi = AccessController . doPrivileged ( unmarshalFile ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "readConfigFile" , jaspi ) ; return jaspi ; }
Return a Java representation of the JASPI persistent providers that are defined in the given configuration file or null if the object returned by JAXB is not an JaspiConfig instance or an exception is thrown by method AccessController . doPrivileged .
38,183
synchronized private void writeConfigFile ( final JaspiConfig jaspiConfig ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "writeConfigFile" , new Object [ ] { jaspiConfig } ) ; if ( configFile == null ) { } PrivilegedExceptionAction < Object > marshalFile = new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws Exception { JAXBContext jc = JAXBContext . newInstance ( JaspiConfig . class ) ; Marshaller writer = jc . createMarshaller ( ) ; writer . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , Boolean . TRUE ) ; writer . marshal ( jaspiConfig , configFile ) ; return null ; } } ; try { AccessController . doPrivileged ( marshalFile ) ; } catch ( PrivilegedActionException e ) { FFDCFilter . processException ( e , this . getClass ( ) . getName ( ) + ".writeConfigFile" , "290" , this ) ; throw new RuntimeException ( "Unable to write " + configFile , e ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "writeConfigFile" ) ; }
Store the in - memory Java representation of the JASPI persistent providers into the given configuration file .
38,184
public ProviderAuthenticationResult authenticate ( HttpServletRequest req , HttpServletResponse res , ConvergedClientConfig clientConfig ) { ProviderAuthenticationResult oidcResult = null ; if ( ! isEndpointValid ( clientConfig ) ) { return new ProviderAuthenticationResult ( AuthResult . SEND_401 , HttpServletResponse . SC_UNAUTHORIZED ) ; } boolean isImplicit = false ; if ( Constants . IMPLICIT . equals ( clientConfig . getGrantType ( ) ) ) { isImplicit = true ; } String authzCode = null ; String responseState = null ; Hashtable < String , String > reqParameters = new Hashtable < String , String > ( ) ; String encodedReqParams = CookieHelper . getCookieValue ( req . getCookies ( ) , ClientConstants . WAS_OIDC_CODE ) ; OidcClientUtil . invalidateReferrerURLCookie ( req , res , ClientConstants . WAS_OIDC_CODE ) ; if ( encodedReqParams != null && ! encodedReqParams . isEmpty ( ) ) { boolean validCookie = validateReqParameters ( clientConfig , reqParameters , encodedReqParams ) ; if ( validCookie ) { authzCode = reqParameters . get ( ClientConstants . CODE ) ; responseState = reqParameters . get ( ClientConstants . STATE ) ; } else { oidcResult = new ProviderAuthenticationResult ( AuthResult . SEND_401 , HttpServletResponse . SC_UNAUTHORIZED ) ; Tr . error ( tc , "OIDC_CLIENT_BAD_PARAM_COOKIE" , new Object [ ] { encodedReqParams , clientConfig . getClientId ( ) } ) ; return oidcResult ; } } if ( responseState != null ) { String id_token = req . getParameter ( Constants . ID_TOKEN ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "id_token:" + id_token ) ; } if ( id_token != null ) { reqParameters . put ( Constants . ID_TOKEN , id_token ) ; } String access_token = req . getParameter ( Constants . ACCESS_TOKEN ) ; if ( access_token != null ) { reqParameters . put ( Constants . ACCESS_TOKEN , access_token ) ; } if ( req . getMethod ( ) . equals ( "POST" ) && req instanceof IExtendedRequest ) { ( ( IExtendedRequest ) req ) . setMethod ( "GET" ) ; } } if ( responseState == null ) { oidcResult = handleRedirectToServer ( req , res , clientConfig ) ; } else if ( isImplicit ) { oidcResult = handleImplicitFlowTokens ( req , res , responseState , clientConfig , reqParameters ) ; } else { AuthorizationCodeHandler authzCodeHandler = new AuthorizationCodeHandler ( sslSupport ) ; oidcResult = authzCodeHandler . handleAuthorizationCode ( req , res , authzCode , responseState , clientConfig ) ; } if ( oidcResult . getStatus ( ) != AuthResult . REDIRECT_TO_PROVIDER ) { WebAppSecurityConfig webAppSecConfig = WebAppSecurityCollaboratorImpl . getGlobalWebAppSecurityConfig ( ) ; PostParameterHelper pph = new PostParameterHelper ( webAppSecConfig ) ; pph . restore ( req , res , true ) ; OidcClientUtil . invalidateReferrerURLCookies ( req , res , OIDC_COOKIES ) ; } return oidcResult ; }
Perform OpenID Connect client authenticate for the given web request . Return an OidcAuthenticationResult which contains the status and subject
38,185
public String getRedirectUrlFromServerToClient ( String clientId , String contextPath , String redirectToRPHostAndPort ) { String redirectURL = null ; if ( redirectToRPHostAndPort != null && redirectToRPHostAndPort . length ( ) > 0 ) { try { final String fHostPort = redirectToRPHostAndPort ; @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) URL url = ( URL ) java . security . AccessController . doPrivileged ( new java . security . PrivilegedExceptionAction ( ) { public Object run ( ) throws Exception { return new URL ( fHostPort ) ; } } ) ; int port = url . getPort ( ) ; String path = url . getPath ( ) ; if ( path == null ) path = "" ; if ( path . endsWith ( "/" ) ) { path = path . substring ( 0 , path . length ( ) - 1 ) ; } String entryPoint = path + contextPath + "/redirect/" + clientId ; redirectURL = url . getProtocol ( ) + "://" + url . getHost ( ) + ( port > 0 ? ":" + port : "" ) ; redirectURL = redirectURL + ( entryPoint . startsWith ( "/" ) ? "" : "/" ) + entryPoint ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "the value of redirectToRPHostAndPort might not valid. Please verify that the format is <protocol>://<host>:<port> " + redirectToRPHostAndPort + "\n" + e . getMessage ( ) ) ; } } } return redirectURL ; }
moved from oidcconfigimpl so social can use it .
38,186
@ FFDCIgnore ( { IndexOutOfBoundsException . class } ) public boolean validateReqParameters ( ConvergedClientConfig clientConfig , Hashtable < String , String > reqParameters , String cookieValue ) { boolean validCookie = true ; String encoded = null ; String cookieName = "WASOidcCode" ; String requestParameters = null ; try { int lastindex = cookieValue . lastIndexOf ( "_" ) ; if ( lastindex < 1 ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The cookie may have been tampered with." ) ; if ( lastindex < 0 ) { Tr . debug ( tc , "The cookie does not contain an underscore." ) ; } if ( lastindex == 0 ) { Tr . debug ( tc , "The cookie does not contain a value before the underscore." ) ; } } return false ; } encoded = cookieValue . substring ( 0 , lastindex ) ; String testCookie = OidcClientUtil . calculateOidcCodeCookieValue ( encoded , clientConfig ) ; if ( ! cookieValue . equals ( testCookie ) ) { String msg = "The value for the OIDC state cookie [" + cookieName + "] failed validation." ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , msg ) ; } validCookie = false ; } } catch ( IndexOutOfBoundsException e ) { validCookie = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "unexpected exception:" , e ) ; } } if ( validCookie ) { requestParameters = Base64Coder . toString ( Base64Coder . base64DecodeString ( encoded ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "decodedRequestParameters:" + requestParameters ) ; } JsonParser parser = new JsonParser ( ) ; JsonObject jsonObject = ( JsonObject ) parser . parse ( requestParameters ) ; Set < Map . Entry < String , JsonElement > > entries = jsonObject . entrySet ( ) ; for ( Map . Entry < String , JsonElement > entry : entries ) { String key = entry . getKey ( ) ; JsonElement element = entry . getValue ( ) ; if ( element . isJsonObject ( ) || element . isJsonPrimitive ( ) ) { reqParameters . put ( key , element . getAsString ( ) ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "parameterKey:" + key + " value:" + element . getAsString ( ) ) ; } } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "unexpected json element:" + element . getClass ( ) . getName ( ) ) ; } validCookie = false ; } } } return validCookie ; }
This gets called after an auth code or implicit token might have been received . This method examines the encodedReqParameters extracted from the WASOidcCode cookie along with the client config and request params to determine if the params in the cookie are valid .
38,187
public Boolean verifyState ( HttpServletRequest req , HttpServletResponse res , String responseState , ConvergedClientConfig clientConfig ) { if ( responseState . length ( ) < OidcUtil . STATEVALUE_LENGTH ) { return false ; } long clockSkewMillSeconds = clientConfig . getClockSkewInSeconds ( ) * 1000 ; long allowHandleTimeMillSeconds = ( clientConfig . getAuthenticationTimeLimitInSeconds ( ) * 1000 ) + clockSkewMillSeconds ; javax . servlet . http . Cookie [ ] cookies = req . getCookies ( ) ; String cookieName = ClientConstants . WAS_OIDC_STATE_KEY + HashUtils . getStrHashCode ( responseState ) ; String stateKey = CookieHelper . getCookieValue ( cookies , cookieName ) ; OidcClientUtil . invalidateReferrerURLCookie ( req , res , cookieName ) ; String cookieValue = HashUtils . createStateCookieValue ( clientConfig , responseState ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "stateKey:'" + stateKey + "' cookieValue:'" + cookieValue + "'" ) ; } if ( cookieValue . equals ( stateKey ) ) { long lNumber = OidcUtil . convertNormalizedTimeStampToLong ( responseState ) ; long lDate = ( new Date ( ) ) . getTime ( ) ; long difference = lDate - lNumber ; if ( difference < 0 ) { difference *= - 1 ; if ( difference >= clockSkewMillSeconds ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "error current: " + lDate + " ran at:" + lNumber ) ; } } return difference < clockSkewMillSeconds ; } else { if ( difference >= allowHandleTimeMillSeconds ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "error current: " + lDate + " ran at:" + lNumber ) ; } } return difference < allowHandleTimeMillSeconds ; } } return false ; }
Determine the name of the state cookie based on the state name key + hashcode of response state . Retrieve that cookie value then create a check value by hashing the clinet config and resonseState again . If the hash result equals the cookie value request is valid proceed to check the clock skew .
38,188
void update ( Dictionary < String , Object > props ) { if ( deleted ) { return ; } final String instancePid = ( String ) props . get ( "service.pid" ) ; final String instanceId = ( String ) props . get ( "id" ) ; if ( instanceId == null ) { Tr . error ( tc , "cls.library.id.missing" ) ; } if ( libraryListenersTracker == null ) { Filter listenerFilter = null ; try { listenerFilter = FrameworkUtil . createFilter ( "(&(objectClass=" + LibraryChangeListener . class . getName ( ) + ")(|(library=" + instanceId + ")(libraryRef=*" + instancePid + "*)))" ) ; } catch ( InvalidSyntaxException e ) { Tr . error ( tc , "cls.library.id.invalid" , instanceId , e . toString ( ) ) ; } ServiceTracker < LibraryChangeListener , LibraryChangeListener > tracker ; tracker = new ServiceTracker < LibraryChangeListener , LibraryChangeListener > ( this . ctx , listenerFilter , null ) ; tracker . open ( ) ; libraryListenersTracker = tracker ; } LibraryGeneration nextGen ; synchronized ( generationLock ) { nextGen = nextGeneration ; if ( nextGen != null ) { nextGeneration = null ; nextGen . cancel ( ) ; } nextGeneration = nextGen = new LibraryGeneration ( this , instanceId , props ) ; } nextGen . fetchFilesets ( ) ; }
called from SharedLibraryFactory inside a synchronized block over this instance
38,189
public void mapFunction ( String prefix , String fnName , final Class c , final String methodName , final Class [ ] args ) { if ( fnName == null ) { return ; } java . lang . reflect . Method method ; if ( System . getSecurityManager ( ) != null ) { try { method = ( java . lang . reflect . Method ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { public Object run ( ) throws Exception { return c . getDeclaredMethod ( methodName , args ) ; } } ) ; } catch ( PrivilegedActionException ex ) { throw new RuntimeException ( "Invalid function mapping - no such method: " + ex . getException ( ) . getMessage ( ) ) ; } } else { try { method = c . getDeclaredMethod ( methodName , args ) ; } catch ( NoSuchMethodException e ) { throw new RuntimeException ( "Invalid function mapping - no such method: " + e . getMessage ( ) ) ; } } this . fnmap . put ( prefix + ":" + fnName , method ) ; }
Stores a mapping from the given EL function prefix and name to the given Java method .
38,190
void add ( int event ) { int b = bits . addAndGet ( event ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "add " + event + ", polling state: " + b ) ; }
Add an event without checking if we are ready to start polling .
38,191
boolean addAndCheckIfReady ( int event ) { int b = bits . addAndGet ( event ) ; boolean isReady = b == READY_WITHOUT_SIGNAL || b == READY_WITH_UNNECESSARY_SIGNAL || b == READY_WITH_SIGNAL ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "addAndCheckIfReady " + event + ", polling state: " + b + ", " + isReady ) ; return isReady ; }
Add an event and then check if we are ready for polling .
38,192
public int getTransactionTimeout ( ) throws XAException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getTransactionTimeout" ) ; int timeout = 0 ; try { CommsByteBuffer request = getCommsByteBuffer ( ) ; request . putInt ( getTransactionId ( ) ) ; CommsByteBuffer reply = jfapExchange ( request , JFapChannelConstants . SEG_XA_GETTXTIMEOUT , JFapChannelConstants . PRIORITY_MEDIUM , true ) ; try { reply . checkXACommandCompletionStatus ( JFapChannelConstants . SEG_XA_GETTXTIMEOUT_R , getConversation ( ) ) ; timeout = reply . getInt ( ) ; } finally { if ( reply != null ) reply . release ( ) ; } } catch ( XAException xa ) { throw xa ; } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".getTransactionTimeout" , CommsConstants . SIXARESOURCEPROXY_GETTXTIMEOUT_01 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Caught a comms problem:" , e ) ; throw new XAException ( XAException . XAER_RMFAIL ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getTransactionTimeout" , "" + timeout ) ; return timeout ; }
Returns the transaction timeout for this XAResource instance .
38,193
private HashMap < Xid , SIXAResourceProxy > getLinkLevelXAResourceMap ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getLinkLevelXAResourceMap" ) ; HashMap < Xid , SIXAResourceProxy > map = ( ( ClientLinkLevelState ) getConversation ( ) . getLinkLevelAttachment ( ) ) . getXidToXAResourceMap ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getLinkLevelXAResourceMap" , map ) ; return map ; }
Helper method to retrieve the map in the link level state that contains the XAResources and the XId they are currently enlisted with .
38,194
private String replaceCharacters ( String name ) { name = name . replaceAll ( "&gt;" , ">" ) ; name = name . replaceAll ( "&lt;" , "<" ) ; name = name . replaceAll ( "&amp;" , "&" ) ; name = name . replaceAll ( "<\\%" , "<%" ) ; name = name . replaceAll ( "%\\>" , "%>" ) ; return name ; }
PK40417 Method to replace translated characters to their original form . This prevents compilation errors when escaped characters are used in tags .
38,195
private boolean handleCaseSensitivityCheck ( String path , boolean checkWEBINF ) throws IOException { if ( System . getSecurityManager ( ) != null ) { final String tmpPath = path ; final boolean tmpCheckWEBINF = checkWEBINF ; try { return ( ( Boolean ) AccessController . doPrivileged ( new PrivilegedExceptionAction ( ) { public Object run ( ) throws IOException { return _handleCaseSensitivityCheck ( tmpPath , tmpCheckWEBINF ) ; } } ) ) . booleanValue ( ) ; } catch ( PrivilegedActionException pae ) { throw ( IOException ) pae . getException ( ) ; } } else { return ( _handleCaseSensitivityCheck ( path , checkWEBINF ) ) . booleanValue ( ) ; } }
PK81387 - added checkWEBINF param
38,196
public final void nameSpace ( String namespace ) { if ( namespace == null || namespace . equals ( "" ) ) { _namespace = "" ; } else { _namespace = namespace + ":" ; } }
Set the namespace prefix to be prefixed to subseqyent tags . The namespace prefix allow different components to use the same tag without risk of confusion .
38,197
public final void write ( Throwable e ) throws IOException { indent ( ) ; newLine ( ) ; write ( e . toString ( ) ) ; StackTraceElement [ ] elements = e . getStackTrace ( ) ; for ( int i = 0 ; i < elements . length ; i ++ ) { newLine ( ) ; write ( elements [ i ] . toString ( ) ) ; } Throwable cause = e . getCause ( ) ; if ( cause != null ) { newLine ( ) ; write ( cause . toString ( ) ) ; } outdent ( ) ; }
Write a throwable used to indicate a problem during data collection not formatted .
38,198
public PublicKey getPublicKeyFromJwk ( String kid , String x5t , boolean useSystemPropertiesForHttpClientConnections ) throws PrivilegedActionException , IOException , KeyStoreException , InterruptedException { return getPublicKeyFromJwk ( kid , x5t , null , useSystemPropertiesForHttpClientConnections ) ; }
Either kid or x5t will work . But not both
38,199
@ FFDCIgnore ( { KeyStoreException . class } ) public PublicKey getPublicKeyFromJwk ( String kid , String x5t , String use , boolean useSystemPropertiesForHttpClientConnections ) throws PrivilegedActionException , IOException , KeyStoreException , InterruptedException { PublicKey key = null ; KeyStoreException errKeyStoreException = null ; InterruptedException errInterruptedException = null ; boolean isHttp = remoteHttpCall ( this . jwkEndpointUrl , this . publicKeyText , this . keyLocation ) ; try { if ( isHttp ) { key = this . getJwkRemote ( kid , x5t , use , useSystemPropertiesForHttpClientConnections ) ; } else { key = this . getJwkLocal ( kid , x5t , publicKeyText , keyLocation , use ) ; } } catch ( KeyStoreException e ) { errKeyStoreException = e ; } catch ( InterruptedException e ) { errInterruptedException = e ; } if ( key == null ) { if ( errKeyStoreException != null ) { throw errKeyStoreException ; } if ( errInterruptedException != null ) { throw errInterruptedException ; } } return key ; }
Either kid x5t or use will work but not all