idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,400
private void rebuildDiscriminatorList ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "rebuildDiscriminatorList" ) ; } discAL . clear ( ) ; DiscriminatorNode dn = discriminators ; discAL . add ( dn . disc ) ; dn = dn . next ; while ( dn != null ) { discAL . add ( dn . disc ) ; dn = dn . next ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "rebuildDiscriminatorList" ) ; } }
Rebuild the array list from the linked list .
153
10
161,401
private void addChannel ( Channel chan ) { if ( channelList == null ) { channelList = new Channel [ 1 ] ; channelList [ 0 ] = chan ; } else { Channel [ ] oldList = channelList ; channelList = new Channel [ oldList . length + 1 ] ; System . arraycopy ( oldList , 0 , channelList , 0 , oldList . length ) ; channelList [ oldList . length ] = chan ; } }
Add a channel to the channel list to be searched .
97
11
161,402
@ FFDCIgnore ( { NamingException . class } ) @ Sensitive Object resolveObject ( Object o , WSName subname ) throws NamingException { ServiceReference < ? > ref = null ; try { if ( o instanceof ContextNode ) return new WSContext ( userContext , ( ContextNode ) o , env ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Resolving object" , o ) ; if ( o instanceof ServiceReference ) { ref = ( ServiceReference < ? > ) o ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "External service registry entry." ) ; } else if ( o instanceof AutoBindNode ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "AutoBindNode entry." ) ; AutoBindNode abNode = ( AutoBindNode ) o ; ref = ( ServiceReference < ? > ) abNode . getLastEntry ( ) ; // null means the node was removed in another thread. if ( ref == null ) { // Use the same semantics as ContextNode.lookup. throw new NameNotFoundException ( subname . toString ( ) ) ; } } else if ( o instanceof ServiceRegistration ) { ref = ( ( ServiceRegistration < ? > ) o ) . getReference ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Programmatic JNDI entry." ) ; } boolean getObjectInstance ; if ( ref == null ) { getObjectInstance = true ; } else { o = getReference ( userContext , ref ) ; if ( o == null ) { throw new NamingException ( Tr . formatMessage ( tc , "jndi.servicereference.failed" , subname . toString ( ) ) ) ; } Object origin = ref . getProperty ( JNDIServiceBinder . OSGI_JNDI_SERVICE_ORIGIN ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Retrieved service from registry" , o , JNDIServiceBinder . OSGI_JNDI_SERVICE_ORIGIN + "=" + origin , Constants . OBJECTCLASS + "=" + Arrays . toString ( ( String [ ] ) ref . getProperty ( Constants . OBJECTCLASS ) ) ) ; getObjectInstance = JNDIServiceBinder . OSGI_JNDI_SERVICE_ORIGIN_VALUE . equals ( origin ) || contains ( ( String [ ] ) ref . getProperty ( Constants . OBJECTCLASS ) , Reference . class . getName ( ) ) ; } if ( getObjectInstance ) { // give JNDI a chance to resolve any references try { Object oldO = o ; o = NamingManager . getObjectInstance ( o , subname , this , env ) ; if ( o != oldO ) if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Resolved object through NamingManager" ) ; // remove logging object o since it might contain the sensitive information. } catch ( NamingException e ) { throw e ; } catch ( Exception e ) { // FFDC and proceed } } return o ; } catch ( NamingException e ) { throw e ; } catch ( Exception e ) { NamingException ne = new NamingException ( ) ; ne . setRootCause ( e ) ; throw ne ; } }
Perform any needed conversions on an object retrieved from the context tree .
743
14
161,403
public void send ( ) throws AuditServiceUnavailableException { AuditService auditService = SecurityUtils . getAuditService ( ) ; if ( auditService != null ) { auditService . sendEvent ( this ) ; } else { throw new AuditServiceUnavailableException ( ) ; } }
Send this event to the audit service for logging .
60
10
161,404
public static boolean isAuditRequired ( String eventType , String outcome ) throws AuditServiceUnavailableException { AuditService auditService = SecurityUtils . getAuditService ( ) ; if ( auditService != null ) { return auditService . isAuditRequired ( eventType , outcome ) ; } else { throw new AuditServiceUnavailableException ( ) ; } }
Check to see if auditing is required for an event type and outcome .
76
15
161,405
private void removeEntriesStartingWith ( String key ) { synchronized ( eventMap ) { Iterator < String > iter = eventMap . keySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { String str = iter . next ( ) ; if ( str . startsWith ( key ) ) { iter . remove ( ) ; } } } }
Remove all entries starting with the given key
77
8
161,406
public void put ( SimpleEntry simpleEntry ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "put" , simpleEntry ) ; simpleEntry . previous = last ; simpleEntry . list = this ; if ( last != null ) last . next = simpleEntry ; else first = simpleEntry ; last = simpleEntry ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" , printList ( ) ) ; }
Add an entry to the list
129
6
161,407
protected String printList ( ) { String output = "[" ; SimpleEntry pointer = first ; int counter = 0 ; while ( ( pointer != null ) && ( counter < 3 ) ) { output += "@" + Integer . toHexString ( pointer . hashCode ( ) ) ; pointer = pointer . next ; if ( pointer != null ) output += ", " ; counter ++ ; } if ( pointer != null ) { output += "..., @" + Integer . toHexString ( last . hashCode ( ) ) + "]" ; } else output += "]" ; return output ; }
Return the first and last entries in the list
123
9
161,408
private void initializePort ( ) throws ChannelException { try { this . endPoint . initServerSocket ( ) ; } catch ( IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "TCP Channel: " + getExternalName ( ) + "- Problem occurred while initializing TCP Channel: " + ioe . getMessage ( ) ) ; } throw new ChannelException ( "TCP Channel: " + getExternalName ( ) + "- Problem occurred while starting channel: " + ioe . getMessage ( ) ) ; } catch ( RetryableChannelException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "TCP Channel: " + getExternalName ( ) + "- Problem occurred while starting TCP Channel: " + e . getMessage ( ) ) ; } throw e ; } // add property to config to provide actual port used (could be ephemeral // port if '0' passed in) this . channelData . getPropertyBag ( ) . put ( TCPConfigConstants . LISTENING_PORT , String . valueOf ( this . endPoint . getListenPort ( ) ) ) ; }
Initialize the endpoint listening socket .
274
7
161,409
private synchronized void destroyConnLinks ( ) { // inUse queue is still open to modification // during this time. Returned iterator is a "weakly consistent" // I don't believe this has (yet) caused any issues. for ( Queue < TCPConnLink > queue : this . inUse ) { try { TCPConnLink tcl = queue . poll ( ) ; while ( tcl != null ) { tcl . close ( tcl . getVirtualConnection ( ) , null ) ; tcl = queue . poll ( ) ; } } catch ( Throwable t ) { FFDCFilter . processException ( t , getClass ( ) . getName ( ) , "destroyConnLinks" , new Object [ ] { this } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error closing connection: " + t + " " + queue ) ; } } } }
call the destroy on all the TCPConnLink objects related to this TCPChannel which are currently in use .
202
21
161,410
protected Object getValue ( String propertyName , Type propertyType , boolean optional , String defaultString ) { Object value = null ; assertNotClosed ( ) ; SourcedValue sourced = getSourcedValue ( propertyName , propertyType ) ; if ( sourced != null ) { value = sourced . getValue ( ) ; } else { if ( optional ) { value = convertValue ( defaultString , propertyType ) ; } else { throw new NoSuchElementException ( Tr . formatMessage ( tc , "no.such.element.CWMCG0015E" , propertyName ) ) ; } } return value ; }
Get the converted value of the given property . If the property is not found and optional is true then use the default string to create a value to return . If the property is not found and optional is false then throw an exception .
129
46
161,411
@ Trivial public static void logToJobLogAndTraceOnly ( Level level , String msg , Object [ ] params , Logger traceLogger ) { String formattedMsg = getFormattedMessage ( msg , params , "Job event." ) ; logRawMsgToJobLogAndTraceOnly ( level , formattedMsg , traceLogger ) ; }
Logs the message to joblog and trace .
75
10
161,412
@ Trivial public static void logRawMsgToJobLogAndTraceOnly ( Level level , String msg , Logger traceLogger ) { if ( level . intValue ( ) > Level . FINE . intValue ( ) ) { traceLogger . log ( Level . FINE , msg ) ; logToJoblogIfNotTraceLoggable ( Level . FINE , msg , traceLogger ) ; } else { traceLogger . log ( level , msg ) ; logToJoblogIfNotTraceLoggable ( level , msg , traceLogger ) ; } }
logs the message to joblog and trace .
126
10
161,413
public byte [ ] toEncodedForm ( ) { if ( encodedForm == null ) { encodedForm = new byte [ encodedSize ( ) ] ; ArrayUtil . writeLong ( encodedForm , 0 , accessSchemaId ) ; encode ( encodedForm , new int [ ] { 8 , encodedForm . length } ) ; } return encodedForm ; }
Turn an CompatibilityMap into its encoded form
74
8
161,414
private void encode ( byte [ ] frame , int [ ] limits ) { JSType . setCount ( frame , limits , indices . length ) ; for ( int i = 0 ; i < indices . length ; i ++ ) JSType . setCount ( frame , limits , indices [ i ] ) ; JSType . setCount ( frame , limits , varBias ) ; JSType . setCount ( frame , limits , setCases . length ) ; for ( int i = 0 ; i < setCases . length ; i ++ ) { int [ ] cases = setCases [ i ] ; if ( cases == null ) JSType . setCount ( frame , limits , - 1 ) ; else { JSType . setCount ( frame , limits , cases . length ) ; for ( int j = 0 ; j < cases . length ; j ++ ) JSType . setCount ( frame , limits , cases [ j ] ) ; } } JSType . setCount ( frame , limits , getCases . length ) ; for ( int i = 0 ; i < getCases . length ; i ++ ) { int [ ] cases = getCases [ i ] ; if ( cases == null ) JSType . setCount ( frame , limits , - 1 ) ; else { JSType . setCount ( frame , limits , cases . length ) ; for ( int j = 0 ; j < cases . length ; j ++ ) JSType . setCount ( frame , limits , cases [ j ] ) ; } } }
Encode subroutine used by toEncodedForm
327
11
161,415
private int encodedSize ( ) { int ans = 16 /* for accessSchemaID, indices.length, varBias, setCases.length, and getCases.length */ + 2 * indices . length ; // for the elements in indices for ( int i = 0 ; i < setCases . length ; i ++ ) { int [ ] cases = setCases [ i ] ; ans += 2 ; // for cases.length or null indicator if ( cases != null ) ans += 2 * cases . length ; } for ( int i = 0 ; i < getCases . length ; i ++ ) { int [ ] cases = getCases [ i ] ; ans += 2 ; // for cases.length or null indicator if ( cases != null ) ans += 2 * cases . length ; } return ans ; }
Find the number of bytes it takes to encode this CompatibilityMap
172
12
161,416
private static void violation ( JMFType from , JMFType to ) throws JMFSchemaViolationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) JmfTr . debug ( tc , "Violation:" + " from = " + from . getFeatureName ( ) + " : " + from + ", to = " + to . getFeatureName ( ) + " : " + to ) ; throw new JMFSchemaViolationException ( from . getFeatureName ( ) + " not compatible with " + to . getFeatureName ( ) ) ; }
Handle violation of the compatibility rules by throwing an informative exception
132
11
161,417
private void recordOnePair ( JSField access , JSchema accSchema , JSField encoding , JSchema encSchema ) { int acc = access . getAccessor ( accSchema ) ; if ( acc >= indices . length ) return ; indices [ acc ] = encoding . getAccessor ( encSchema ) ; }
later when maps are built for variant box schemas .
71
11
161,418
private void checkForDeletingVariant ( JMFType nonVar , JSVariant var , boolean varIsAccess , JSchema accSchema , JSchema encSchema ) throws JMFSchemaViolationException { // Deleting variant always has exactly two cases if ( var . getCaseCount ( ) != 2 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) JmfTr . debug ( this , tc , "Compatibility violation (deleting variant):" + " var CaseCount = " + var . getCaseCount ( ) + ", varIsAccess " + varIsAccess ) ; if ( varIsAccess ) { violation ( var , nonVar ) ; } else { violation ( nonVar , var ) ; } } if ( isEmpty ( var . getCase ( 1 ) ) ) { // Second case is empty tuple, so we proceed to compare the first case to the // candidate deletable type. JMFType compare = var . getCase ( 0 ) ; if ( varIsAccess ) recordCompatibilityInfo ( compare , accSchema , nonVar , encSchema ) ; else recordCompatibilityInfo ( nonVar , accSchema , compare , encSchema ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) JmfTr . debug ( this , tc , "Compatibility violation (deleting variant):" + " var Case(1) not empty" ) ; if ( varIsAccess ) { violation ( var , nonVar ) ; } else { violation ( nonVar , var ) ; } } }
info stripping off the deleting variant .
352
7
161,419
private static void checkExtraFields ( JSTuple tuple , int startCol , int count ) throws JMFSchemaViolationException { for ( int i = startCol ; i < count ; i ++ ) { JMFType field = tuple . getField ( i ) ; if ( field instanceof JSVariant ) { JMFType firstCase = ( ( JSVariant ) field ) . getCase ( 0 ) ; if ( firstCase instanceof JSTuple ) if ( ( ( JSTuple ) firstCase ) . getFieldCount ( ) == 0 ) continue ; } throw new JMFSchemaViolationException ( field . getFeatureName ( ) + " not defaulting variant" ) ; } }
Check the extra columns in a tuple to make sure they are all defaultable
150
15
161,420
public StampedValue asType ( final Type type ) { StampedValue cachedValue = null ; //looping around a list is probably quicker than having a map since there are probably only one or two different //types in use at any one time for ( StampedValue value : typeCache ) { if ( value . getType ( ) . equals ( type ) ) { cachedValue = value ; break ; } } if ( cachedValue == null ) { StampedValue newValue = new StampedValue ( type , this , config ) ; typeCache . add ( newValue ) ; cachedValue = newValue ; } return cachedValue ; }
Check if a StampedValue already exists for the type if it does return it otherwise create a new one and add it
132
24
161,421
@ Deprecated public static void finalizeForDeletion ( UIComponent component ) { // remove any existing marks of deletion component . getAttributes ( ) . remove ( MARK_DELETED ) ; // finally remove any children marked as deleted if ( component . getChildCount ( ) > 0 ) { for ( Iterator < UIComponent > iter = component . getChildren ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { UIComponent child = iter . next ( ) ; if ( child . getAttributes ( ) . containsKey ( MARK_DELETED ) ) { iter . remove ( ) ; } } } // remove any facets marked as deleted if ( component . getFacetCount ( ) > 0 ) { Map < String , UIComponent > facets = component . getFacets ( ) ; Collection < UIComponent > col = facets . values ( ) ; for ( Iterator < UIComponent > itr = col . iterator ( ) ; itr . hasNext ( ) ; ) { UIComponent fc = itr . next ( ) ; if ( fc . getAttributes ( ) . containsKey ( MARK_DELETED ) ) { itr . remove ( ) ; } } } }
Used in conjunction with markForDeletion where any UIComponent marked will be removed .
267
20
161,422
public static UIComponent findChild ( UIComponent parent , String id ) { int childCount = parent . getChildCount ( ) ; if ( childCount > 0 ) { for ( int i = 0 ; i < childCount ; i ++ ) { UIComponent child = parent . getChildren ( ) . get ( i ) ; if ( id . equals ( child . getId ( ) ) ) { return child ; } } } return null ; }
A lighter - weight version of UIComponent s findChild .
98
14
161,423
public static UIComponent findChildByTagId ( UIComponent parent , String id ) { Iterator < UIComponent > itr = null ; if ( parent . getChildCount ( ) > 0 ) { for ( int i = 0 , childCount = parent . getChildCount ( ) ; i < childCount ; i ++ ) { UIComponent child = parent . getChildren ( ) . get ( i ) ; if ( id . equals ( child . getAttributes ( ) . get ( MARK_CREATED ) ) ) { return child ; } } } if ( parent . getFacetCount ( ) > 0 ) { itr = parent . getFacets ( ) . values ( ) . iterator ( ) ; while ( itr . hasNext ( ) ) { UIComponent facet = itr . next ( ) ; // check if this is a dynamically generated UIPanel if ( Boolean . TRUE . equals ( facet . getAttributes ( ) . get ( FACET_CREATED_UIPANEL_MARKER ) ) ) { // only check the children and facets of the panel if ( facet . getChildCount ( ) > 0 ) { for ( int i = 0 , childCount = facet . getChildCount ( ) ; i < childCount ; i ++ ) { UIComponent child = facet . getChildren ( ) . get ( i ) ; if ( id . equals ( child . getAttributes ( ) . get ( MARK_CREATED ) ) ) { return child ; } } } if ( facet . getFacetCount ( ) > 0 ) { Iterator < UIComponent > itr2 = facet . getFacets ( ) . values ( ) . iterator ( ) ; while ( itr2 . hasNext ( ) ) { UIComponent child = itr2 . next ( ) ; if ( id . equals ( child . getAttributes ( ) . get ( MARK_CREATED ) ) ) { return child ; } } } } else if ( id . equals ( facet . getAttributes ( ) . get ( MARK_CREATED ) ) ) { return facet ; } } } return null ; }
By TagId find Child
455
5
161,424
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 .
246
25
161,425
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 .
139
31
161,426
@ Deprecated public static void markForDeletion ( UIComponent component ) { // flag this component as deleted 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 .
129
14
161,427
private static UIComponent createFacetUIPanel ( FaceletContext ctx , UIComponent parent , String facetName ) { FacesContext facesContext = ctx . getFacesContext ( ) ; UIComponent panel = facesContext . getApplication ( ) . createComponent ( facesContext , UIPanel . COMPONENT_TYPE , null ) ; // The panel created by this method is special. To be restored properly and do not // create duplicate ids or any other unwanted conflicts, it requires an unique id. // This code is usually called when more than one component is added to a facet and // it is necessary to create a shared container. // Use FaceletCompositionContext.generateUniqueComponentId() is not possible, because // <c:if> blocks inside a facet will make component ids unstable. Use UniqueIdVendor // is feasible but also will be affected by <c:if> blocks inside a facet. // The only solution that will generate real unique ids is use the parent id and the // facet name and derive an unique id that cannot be generated by SectionUniqueIdCounter, // doing the same trick as with metadata: use a double __ and add a prefix (f). // Note this id will never be printed into the response, because this is just a container. FaceletCompositionContext mctx = FaceletCompositionContext . getCurrentInstance ( ctx ) ; UniqueIdVendor uniqueIdVendor = mctx . getUniqueIdVendorFromStack ( ) ; if ( uniqueIdVendor == null ) { uniqueIdVendor = ComponentSupport . getViewRoot ( ctx , parent ) ; } if ( uniqueIdVendor != null ) { // UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot // and call createUniqueId(). See ComponentTagHandlerDelegate 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 .
572
42
161,428
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 .
74
40
161,429
public PolicyExecutor create ( String identifier ) { return new PolicyExecutorImpl ( ( ExecutorServiceImpl ) globalExecutor , "PolicyExecutorProvider-" + identifier , null , policyExecutors ) ; }
Creates a new policy executor instance .
45
9
161,430
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 .
45
35
161,431
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 ) ; // d651126 } } ) ; } 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 } ) ; //p111002.3 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 .
398
16
161,432
private String getPortableFilename ( BeanId beanId ) { // Historically, this method returned the equivalent of // appendPortableFilenameString(beanId.toString()), where BeanId.toString // returned "BeanId(" + j2eeName + ", " + pkey + ")", which translates to // "BeanId_" + j2eeName + "__" + pkey + "_". RTC102568 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 _
191
52
161,433
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 ) ; //d248740 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 ) ; //LIDB2018 } } ) ; } 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 } ) ; //p111002.3 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 .
363
25
161,434
public static LooseConfig convertToLooseConfig ( File looseFile ) throws Exception { //make sure the file exists, can be read and is an xml 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 ) ; /* * Normally we specifically request the system default XMLInputFactory to avoid issues when * another XMLInputFactory is available on the thread context class loader. In this case it * should be safe to use XMLInputFactory.newInstance() because the commands run separately * from the rest of the code base. */ 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 ) ; //put current Loose Entry into stack 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 ( ) ; //make sure stack isn't empty before we try and look at it if ( ! stack . empty ( ) ) { //set current entry to be the top of stack 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 .
651
47
161,435
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 ) ; // trim the .xml File archiveFile = processArchive ( looseFile . getName ( ) , looseConfig , true , bootProps ) ; return new FileEntryConfig ( entryPath , archiveFile ) ; }
Using the method to create Loose config s Archive entry config
282
12
161,436
public static Pattern convertToRegex ( String excludeStr ) { // make all "." safe decimles then convert ** to .* and /* to /.* to make it regex if ( excludeStr . contains ( "." ) ) { // regex for "." is \. - but we are converting the string to a regex string so need to escape the escape slash... excludeStr = excludeStr . replace ( "." , "\\." ) ; } //if we exclude a dir (eg /**/) we need to remove the closing slash so our regex is /.* if ( excludeStr . endsWith ( "/" ) ) { excludeStr = excludeStr . substring ( 0 , excludeStr . length ( ) - 1 ) ; } if ( excludeStr . contains ( "**" ) ) { excludeStr = excludeStr . replace ( "**" , ".*" ) ; } if ( excludeStr . contains ( "/*" ) ) { excludeStr = excludeStr . replace ( "/*" , "/.*" ) ; } //need to escape the file seperators correctly, as / is a regex keychar if ( excludeStr . contains ( "/" ) ) { excludeStr = excludeStr . replace ( "/" , "\\/" ) ; } //at this point we should not have any **, if we do replace with * as all * should be prefixed with a . 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
440
22
161,437
public synchronized CommsByteBuffer allocate ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "allocate" ) ; // Remove a CommsByteBuffer from the pool CommsByteBuffer buff = ( CommsByteBuffer ) pool . remove ( ) ; // If the buffer is null then there was none available in the pool // So create a new one 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 .
165
11
161,438
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 .
79
16
161,439
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 .
91
17
161,440
private final int encodeIds ( byte [ ] buffer , int offset ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeIds" ) ; int idOffset = offset ; // Write the JMF version number and Schema id for the header ArrayUtil . writeShort ( buffer , idOffset , ( ( JMFMessage ) headerPart . jmfPart ) . getJMFEncodingVersion ( ) ) ; idOffset += ArrayUtil . SHORT_SIZE ; ArrayUtil . writeLong ( buffer , idOffset , headerPart . jmfPart . getEncodingSchema ( ) . getID ( ) ) ; idOffset += ArrayUtil . LONG_SIZE ; // Write the JMF version number and Schema id for the payload, if there is one 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 ; } // Otherwise we just write zeros to fill up the same space 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
421
39
161,441
private final DataSlice encodeHeaderPartToSlice ( JsMsgPart jsPart ) throws MessageEncodeFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "encodeHeaderPartToSlice" , jsPart ) ; // We hope that it is already encoded so we can just get it from JMF..... DataSlice slice = ( ( JMFMessage ) jsPart . jmfPart ) . getAssembledContent ( ) ; // ... if not, then we have to encode it now if ( slice == null ) { byte [ ] buff ; // We need to ensure noone updates any vital aspects of the message part // between the calls to getEncodedLength() and toByteArray() d364050 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 .
265
77
161,442
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 ) { // Dump whatever we can of both message parts 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
457
14
161,443
JsMsgObject getCopy ( ) throws MessageCopyFailedException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getCopy" ) ; JsMsgObject newJmo = null ; try { // We need to lock the whole of the copy with the getHdr2, getApi & getPayload // methods on the owning message, otherwise someone could reinstate the partcaches // between clearing them and creating the new parts. d352642 synchronized ( theMessage ) { // Ensure any cached message data is written back and cached message parts are // invalidated. theMessage . updateDataFields ( MfpConstants . UDF_GET_COPY ) ; theMessage . clearPartCaches ( ) ; // Clone this JMO and insert a copy of the underlying JMF message. It is the JMF // that handles all the "lazy" copying. newJmo = new JsMsgObject ( null ) ; newJmo . headerPart = new JsMsgPart ( ( ( JMFMessage ) headerPart . jmfPart ) . copy ( ) ) ; newJmo . payloadPart = new JsMsgPart ( ( ( JMFMessage ) payloadPart . jmfPart ) . copy ( ) ) ; } } catch ( MessageDecodeFailedException e ) { // Dump whatever we can of both message parts 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 .
513
10
161,444
private final void ensureReceiverHasSchemata ( CommsConnection conn ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "ensureReceiverHasSchemata" , conn ) ; // 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. 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 .
222
29
161,445
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 .
85
4
161,446
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
46
10
161,447
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 ) ; // As it is logged to disk, we must have a _partnerLog available _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 } ) ; } // Just ignore the error and clean it up on the next server run } } 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 .
357
54
161,448
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
90
10
161,449
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 : { // No resource for this feature break ; } case BUNDLE_TYPE : case BOOT_JAR_TYPE : { // Add to the list of bundle files addJarResource ( absPathsForLibertyBundles , fd , br , fr ) ; break ; } case JAR_TYPE : { // Add to the list of normal files addJarResource ( absPathsForLibertyContent , fd , br , fr ) ; break ; } case FILE_TYPE : { // file uses loc as a relative path from install root. String locString = fr . getLocation ( ) ; if ( locString != null ) { addFileResource ( installRoot , absPathsForLibertyContent , locString ) ; } else { // a file type without a loc is bad, means misuse of the // type. throw new BuildException ( "No location on file type for resource " + fr . getSymbolicName ( ) + " in feature " + fd . getFeatureName ( ) ) ; } break ; } case UNKNOWN : { // if its not jar,bundle,feature, or file.. then something // is wrong. log ( "Unknown feature resource for " + fr . getSymbolicName ( ) + " in feature " + fd . getFeatureName ( ) + ". The type is: " + fr . getRawType ( ) , Project . MSG_ERR ) ; // we assume that other types will use the location field as // something useful. String locString = fr . getLocation ( ) ; if ( locString != null ) { addFileResource ( installRoot , absPathsForLibertyContent , locString ) ; } } } } // add in (all) the NLS files for this featuredef.. if any.. 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
682
10
161,450
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 .
130
11
161,451
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
101
8
161,452
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 .
62
19
161,453
public static String getSql ( Object jdbcWrapper ) { if ( jdbcWrapper instanceof WSJdbcPreparedStatement ) // also includes WSJdbcCallableStatement 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 .
103
15
161,454
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 ; // Instead of closing the statements, mark them as // not poolable so that they are prevented from being cached again when closed. connWrapper . markStmtsAsNotPoolable ( ) ; // Clear out the cache. if ( mc != null ) mc . clearStatementCache ( ) ; } catch ( NullPointerException nullX ) { // No FFDC code needed; probably closed by another thread. if ( ! ( ( WSJdbcObject ) jdbcWrapper ) . isClosed ( ) ) throw nullX ; } }
Performs special handling for stale statements such as clearing the statement cache and marking existing statements non - poolable .
252
22
161,455
public static SQLException mapException ( WSJdbcWrapper jdbcWrapper , SQLException sqlX ) { Object mapper = null ; WSJdbcConnection connWrapper = null ; if ( jdbcWrapper instanceof WSJdbcObject ) { // Use the connection and managed connection. 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 .
182
37
161,456
@ Trivial 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 .
44
25
161,457
public static ManifestInfo parseManifest ( JarFile jar ) throws RepositoryArchiveException , RepositoryArchiveIOException { String prov = null ; // Create the WLPInformation and populate it 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 ( ) ; // Iterate over the main attributes in the manifest and look for the ones we are interested in. 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 ) ) { // We need to split the required features, from a String of comma seperated // features into a List of String, where each String is a feature name. 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 .
775
36
161,458
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
109
22
161,459
void checkMEs ( JsMessagingEngine [ ] MEList ) throws ResourceException { final String methodName = "checkMEs" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { MEList } ) ; } // Filter out any non preferred MEs. User specified target data is used to perform this filter. // If no target data is set then all the MEs are considered "preferred" for point to point and // non durable pub sub, but none of them are considered preferred for durable pub sub (which has // a preference for the durable subscription home) JsMessagingEngine [ ] preferredMEs = _destinationStrategy . getPreferredLocalMEs ( MEList ) ; // TODO: Can we wrapper the connect call if a try catch block, if engine is being reloaded then absorb the // exception (trace a warning) and let us kick off a timer (if one is needed). // Try to connect to the list of filtered MEs. 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 ) { // After attempting to create connections check to see if we should continue to check for more connections // or not. If we should then kick of a timer to try again after a user specified interval. 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 will close the connections // The connection might be successful but session might fail due to authorization error // Hence before retrying, old connection must be closed deactivate ( ) ; kickOffTimer ( ) ; } //its possible that there was no exception thrown and connection was not successfull // in that case a check is made to see if an retry attempt is needed 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 .
686
18
161,460
void kickOffTimer ( ) throws UnavailableException { final String methodName = "kickOffTimer" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } synchronized ( _timerLock ) { // Another timer is already running - no need to create a new one if ( _timer != null ) { return ; } _timer = _bootstrapContext . createTimer ( ) ; _timer . schedule ( new TimerTask ( ) { @ Override 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 .
309
16
161,461
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 ) { // No FFDC code needed 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 ) { // No FFDC code needed // Failed to create a consumer so blow away the connection and try // again 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
557
10
161,462
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 ( ) ; /* * Create destination listener */ final DestinationListener destinationListener = new SibRaDestinationListener ( connection , _messageEndpointFactory ) ; /* * Determine destination type */ final DestinationType destinationType = _endpointConfiguration . getDestinationType ( ) ; /* * Register destination listener */ 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" ) ; } /* * Create a listener for each destination ... */ 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
710
16
161,463
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 .
373
46
161,464
void dropNonPreferredConnections ( ) { final String methodName = "dropNonPreferredConnections" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } // If we are connected to a non preferred then we will NEVER be connect to a preferred as // well, there is no mixing of connection types. 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 .
148
42
161,465
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 .
112
10
161,466
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 .
182
9
161,467
@ Override 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 ( ) } ) ; // dropConnection (messagingEngine.getUuid().toString(), null, true); 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
200
26
161,468
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 ) { /* * Does the connection that we've been passed, still exist? */ connectionCheck = _connections . get ( meUuid ) ; /* * If the connection object that we've been passed is the same object as that retrieved from _connections, close it. */ if ( connection == connectionCheck ) { closeConnection ( meUuid , alreadyClosed ) ; } } // If we are reloading the engine then don't try and reconnect now. Wait until we get an engine // reloaded shoulder tap. Since we don't know if remote MEs are having an engine reloaded we will fail // the connection and deactivate the MDB. The connection is only passed in as a parameter from session // error method call. if ( ! isSessionError || ( ! SibRaEngineComponent . isMessagingEngineReloading ( meUuid ) ) ) { // PM49608 The lock hierarchy is first _timerLock and then _connections // This hierarchy is necessary to avoid deadlock synchronized ( _timerLock ) { synchronized ( _connections ) { // If this was our last (or only) connection then kick off another loop to check if // we can obtain a new connection. 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 { // Stop any timers as no point in trying again until we have finished reloading the engine. 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 .
626
22
161,469
@ Override 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 .
114
11
161,470
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
199
24
161,471
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
62
9
161,472
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
82
13
161,473
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
63
10
161,474
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
67
10
161,475
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
63
10
161,476
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 .
93
10
161,477
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 .
107
12
161,478
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 .
62
17
161,479
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 .
81
17
161,480
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
62
9
161,481
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 .
116
57
161,482
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 .
80
10
161,483
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 var field data was not previously set this is the first time it will become set 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 .
171
38
161,484
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 .
66
26
161,485
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 .
116
15
161,486
public TransactionCommon registerInBatch ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "registerInBatch" ) ; _readWriteLock . lock ( ) ; // Register as a reader synchronized ( this ) // lock the state against other readers { 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 .
152
20
161,487
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 ) // lock the state against other readers { _currentBatchSize += msgCount ; if ( ( listener != null ) && ( ! _listeners . contains ( listener ) ) ) { // Remember that this listener needs calling when the batch completes _listeners . add ( listener ) ; } if ( _currentBatchSize >= _batchSize ) // Full batch, commit all updates { completeBatch = true ; // We can't do this under the synchronize as the exclusive lock // we need will deadlock with reader's trying to get this } // synchronize before these release their shared lock else if ( ( _currentBatchSize - msgCount ) == 0 ) // New batch so ensure a timer is running { startTimer ( ) ; } } } finally { _readWriteLock . unlock ( ) ; // release the read lock we took in registerInBatch } // Now we hold no locks we can try to complete he batch (this takes an exclusive lock if ( completeBatch ) { completeBatch ( false ) ; // false = only complete a full batch } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "messagesAdded" ) ; }
Tell the BatchHandler how many messages were added under the current transaction .
348
15
161,488
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 ( ) ; // Lock the batchHandler exclusively try { // If force is true we complete the batch even if it isn't full, otherwise // we only complete a full batch (it's possible someone else got in before us and completed // the old batch before we got the lock). 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 ( ) ; // Commit the current transaction (this'll drive all the CDs) 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 ; } // Clear the batch details under the lock _currentBatchSize = 0 ; _currentTran = null ; // Commit or Rollback the listeners 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 the commit threw an exception, pass it back now if ( exceptionOnCommit != null ) { //Release exclusive lock on the batch or everything grinds //to a halt _readWriteLock . unlockExclusive ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "completeBatch" , exceptionOnCommit ) ; throw new SIResourceException ( exceptionOnCommit ) ; } // Ensure any running timer is cancelled cancelTimer ( ) ; } else // Nothing transacted to do but still need to call finalListener to cleanup { 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 .
698
43
161,489
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 ) { //No FFDC code needed SibTr . exception ( this , tc , e ) ; //can't do anything else here } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "alarm" ) ; }
Method called when an alarm pops
143
6
161,490
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 ) { // session id marker was found, try to pull out the value 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 .
221
15
161,491
public static String encodeURL ( String url , SessionInfo info ) { // could be /path/page#fragment?query // could be /page/page;session=existing#fragment?query // where fragment and query are both optional 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 ) { // a session exists in the URL, overlay this ID sb . append ( url ) ; int start = parser . idMarker + target . length ( ) ; if ( start + 23 < url . length ( ) ) { sb . replace ( start , start + 23 , id ) ; } else { // invalid length on existing session, just remove that // TODO: what if a fragment or query string was after the // invalid session data sb . setLength ( parser . idMarker ) ; sb . append ( target ) . append ( id ) ; } } else { // add session data to the URL if ( - 1 != parser . fragmentMarker ) { // prepend it before the uri fragment sb . append ( url , 0 , parser . fragmentMarker ) ; sb . append ( target ) . append ( id ) ; sb . append ( url , parser . fragmentMarker , url . length ( ) ) ; } else if ( - 1 != parser . queryMarker ) { // prepend it before the query data sb . append ( url , 0 , parser . queryMarker ) ; sb . append ( target ) . append ( id ) ; sb . append ( url , parser . queryMarker , url . length ( ) ) ; } else { // just a uri 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 .
452
19
161,492
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 ) { // the parser found an id marker, see if we need to include // any trailing fragment or query data 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 .
226
12
161,493
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 ++ ; // TODO this is assuming that the full value is valid and // grabbing just the 4 digit id... 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 .
213
14
161,494
public static Cookie encodeCookie ( SessionInfo info ) { // create a cookie using the configuration information 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 .
140
10
161,495
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 .
75
50
161,496
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
155
9
161,497
public PersistenceUnitTransactionType getTransactionType ( ) { // Convert this TransactionType from the class defined in JAXB // (com.ibm.ws.jpa.pxml21.PersistenceUnitTransactionType) to JPA // (javax.persistence.spi.PersistenceUnitTransactionType). 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 .
226
10
161,498
public static boolean copyModuleMetaDataSlot ( MetaDataEvent < ModuleMetaData > event , MetaDataSlot slot ) { Container container = event . getContainer ( ) ; MetaData metaData = event . getMetaData ( ) ; try { // For now, we just need to copy from WebModuleInfo, and ClientModuleInfo // Supports EJB in WAR and ManagedBean in Client 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 ) { // The caller is required to populate slot data. 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 .
274
42
161,499
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 .
222
18