idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
163,500
private void configureServerSocket ( SSLServerSocket serverSocket , SSLServerSocketFactory serverSocketFactory , String sslConfigName , OptionsKey options ) throws IOException { try { String [ ] cipherSuites = sslConfig . getCipherSuites ( sslConfigName , serverSocketFactory . getSupportedCipherSuites ( ) ) ; serverSocket . setEnabledCipherSuites ( cipherSuites ) ; // set the SSL protocol on the server socket String protocol = sslConfig . getSSLProtocol ( sslConfigName ) ; if ( protocol != null ) serverSocket . setEnabledProtocols ( new String [ ] { protocol } ) ; boolean clientAuthRequired = ( ( options . requires & EstablishTrustInClient . value ) == EstablishTrustInClient . value ) ; boolean clientAuthSupported = ( ( options . supports & EstablishTrustInClient . value ) == EstablishTrustInClient . value ) ; if ( clientAuthRequired ) { serverSocket . setNeedClientAuth ( true ) ; } else if ( clientAuthSupported ) { serverSocket . setWantClientAuth ( true ) ; } else { serverSocket . setNeedClientAuth ( false ) ; //could set want with the same effect } serverSocket . setSoTimeout ( 60 * 1000 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . debug ( tc , "Created SSL server socket on port " + serverSocket . getLocalPort ( ) ) ; Tr . debug ( tc , " client authentication " + ( clientAuthSupported ? "SUPPORTED" : "UNSUPPORTED" ) ) ; Tr . debug ( tc , " client authentication " + ( clientAuthRequired ? "REQUIRED" : "OPTIONAL" ) ) ; Tr . debug ( tc , " cipher suites:" ) ; for ( int i = 0 ; i < cipherSuites . length ; i ++ ) { Tr . debug ( tc , " " + cipherSuites [ i ] ) ; } } } catch ( SSLException e ) { throw new IOException ( "Could not configure server socket" , e ) ; } }
Set the server socket configuration to our required QOS values .
457
12
163,501
private Collection < String > getRolesForSpecialSubject ( String resourceName , String specialSubject ) { int found = 0 ; Collection < String > roles = null ; FeatureAuthorizationTableService featureAuthzTableSvc = featureAuthzTableServiceRef . getService ( ) ; String featureAuthzRoleHeaderValue = null ; if ( featureAuthzTableSvc != null ) { featureAuthzRoleHeaderValue = featureAuthzTableSvc . getFeatureAuthzRoleHeaderValue ( ) ; } if ( featureAuthzRoleHeaderValue != null && ! featureAuthzRoleHeaderValue . equals ( MGMT_AUTHZ_ROLES ) ) { roles = featureAuthzTableSvc . getRolesForSpecialSubject ( resourceName , specialSubject ) ; } else { Iterator < AuthorizationTableService > itr = authorizationTables . getServices ( ) ; while ( itr . hasNext ( ) ) { AuthorizationTableService authzTableSvc = itr . next ( ) ; Collection < String > rolesFound = authzTableSvc . getRolesForSpecialSubject ( resourceName , specialSubject ) ; if ( rolesFound != null ) { roles = rolesFound ; found ++ ; } } // We must find one, and only one, Collection of roles if ( found > 1 ) { Tr . error ( tc , "AUTHZ_MULTIPLE_RESOURCES_WITH_SAME_NAME" , resourceName ) ; roles = null ; } } return roles ; }
Check all of the authorization table services for the resourceName . If no authorization table can be found for the resourceName null is returned . If more than one authorization table can be found for the resourceName null is returned .
320
44
163,502
private boolean isSubjectAuthorized ( String resourceName , Collection < String > requiredRoles , Subject subject ) { AccessDecisionService accessDecisionService = accessDecisionServiceRef . getService ( ) ; // check user access first boolean isGranted = false ; WSCredential wsCred = getWSCredentialFromSubject ( subject ) ; String accessId = getAccessId ( wsCred ) ; // if (useRoleAsGroupName && !isAuthzInfoAvailableForApp(resourceName) && !resourceName.equalsIgnoreCase(ADMIN_RESOURCE_NAME)) { if ( useRoleAsGroupName && ! isAuthzInfoAvailableForApp ( resourceName ) ) { isGranted = useRoleAsGroupNameForAccessDecision ( resourceName , requiredRoles , subject , accessDecisionService , wsCred ) ; } else { isGranted = useAppBndForAccessDecision ( resourceName , requiredRoles , subject , accessDecisionService , wsCred , accessId ) ; } return isGranted ; }
Check if the Subject is authorized to the required roles for a given resource . The user is checked first and if it s not authorized then each group is checked .
232
32
163,503
private WSCredential getWSCredentialFromSubject ( Subject subject ) { if ( subject != null ) { java . util . Collection < Object > publicCreds = subject . getPublicCredentials ( ) ; if ( publicCreds != null && publicCreds . size ( ) > 0 ) { java . util . Iterator < Object > publicCredIterator = publicCreds . iterator ( ) ; while ( publicCredIterator . hasNext ( ) ) { Object cred = publicCredIterator . next ( ) ; if ( cred instanceof WSCredential ) { return ( WSCredential ) cred ; } } } } return null ; }
Get the WSCredential from the given Subject
144
10
163,504
private String getAccessId ( WSCredential cred ) { String accessId = null ; try { accessId = cred . getAccessId ( ) ; } catch ( CredentialExpiredException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception getting the access id: " + e ) ; } } catch ( CredentialDestroyedException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception getting the access id: " + e ) ; } } // TODO if ignoreCase is Collection, then lower case the accessid return accessId ; }
Get the access ID from the specified credential .
163
9
163,505
@ SuppressWarnings ( "unchecked" ) private String [ ] getGroupIds ( WSCredential cred ) { Collection < String > ids = null ; if ( cred != null ) { try { ids = cred . getGroupIds ( ) ; } catch ( CredentialExpiredException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception getting the group access ids: " + e ) ; } } catch ( CredentialDestroyedException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception getting the group access ids: " + e ) ; } } if ( ids != null ) { return ids . toArray ( new String [ ids . size ( ) ] ) ; } } return null ; // TODO if ignoreCase is Collection, then lower case the groupids }
Get the group IDs from the specified credential .
221
9
163,506
protected boolean isAllAuthenticatedGranted ( String resourceName , Collection < String > requiredRoles , Subject subject ) { Collection < String > roles = getRolesForSpecialSubject ( resourceName , AuthorizationTableService . ALL_AUTHENTICATED_USERS ) ; AccessDecisionService accessDecisionService = accessDecisionServiceRef . getService ( ) ; return accessDecisionService . isGranted ( resourceName , requiredRoles , roles , subject ) ; }
Check if the special subject ALL_AUTHENTICATED_USERS is mapped to the requiredRole .
100
22
163,507
private boolean isSubjectValid ( Subject subject ) { final WSCredential wsCred = getWSCredentialFromSubject ( subject ) ; if ( wsCred == null ) { return false ; } else { // TODO revisit this when EJBs are supported add additional // checks would be required return ! wsCred . isUnauthenticated ( ) && ! wsCred . isBasicAuth ( ) ; } }
Check if the subject has a WScredential is authenticated and is not a basic auth credential .
93
20
163,508
private String getRealmName ( WSCredential cred ) { String realmName = null ; if ( cred != null ) { try { realmName = cred . getRealmName ( ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception getting the realm name: " + e ) ; } } } return realmName ; }
Get the realm name from the specified credential .
98
9
163,509
final void init ( ) throws DiagnosticModuleRegistrationFailureException { if ( initialized ) { return ; } initialized = true ; Method [ ] methods = getClass ( ) . getMethods ( ) ; for ( Method method : methods ) { String name = method . getName ( ) . toLowerCase ( ) ; if ( name . startsWith ( FFDC_DUMP_PREFIX ) ) { Class < ? > [ ] params = method . getParameterTypes ( ) ; if ( params . length == FFDC_DUMP_PARAMS . length ) { // Possible candidate method, so check the types boolean allOK = true ; for ( int i = 0 ; ( i < params . length ) && ( allOK ) ; i ++ ) { allOK = ( params [ i ] == FFDC_DUMP_PARAMS [ i ] ) ; } if ( allOK ) { _directives . add ( method . getName ( ) ) ; if ( name . startsWith ( FFDC_DUMP_DEFAULT_PREFIX ) ) _dumpDefaultMethods . add ( method ) ; else _dumpMethods . add ( method ) ; } else if ( makeNoise ( ) ) { throw new DiagnosticModuleRegistrationFailureException ( "Error: " + method + " starts with " + FFDC_DUMP_DEFAULT_PREFIX + " but does not conform to the signature. Method skipped!" ) ; } } else if ( makeNoise ( ) ) { throw new DiagnosticModuleRegistrationFailureException ( "Error: " + method + " starts with " + FFDC_DUMP_DEFAULT_PREFIX + " but does not conform to the signature. Method skipped!" ) ; } } } }
The init method is provided to subclasses to initialize this particular DiagnosticModule . Called when the diagnostic module is registered .
363
24
163,510
public final boolean dumpComponentData ( String [ ] input_directives , Throwable ex , IncidentStream ffdcis , Object callerThis , Object [ ] catcherObjects , String sourceId , String [ ] callStack ) { startProcessing ( ) ; try { ffdcis . writeLine ( "==> Performing default dump from " + getClass ( ) . getName ( ) + " " , new Date ( ) ) ; for ( Method m : _dumpDefaultMethods ) { invokeDiagnosticMethod ( m , ex , ffdcis , callerThis , catcherObjects , sourceId ) ; if ( ! continueProcessing ( ) ) break ; } if ( input_directives != null && input_directives . length > 0 ) { ffdcis . writeLine ( "==> Performing custom/other dump from " + getClass ( ) . getName ( ) + " " , new Date ( ) ) ; getDataForDirectives ( input_directives , ex , ffdcis , callerThis , catcherObjects , sourceId ) ; } ffdcis . writeLine ( "==> Dump complete for " + getClass ( ) . getName ( ) + " " , new Date ( ) ) ; } catch ( Throwable th ) { ffdcis . writeLine ( "==> Dump did not complete for " + getClass ( ) . getName ( ) + " " , new Date ( ) ) ; } return finishProcessing ( ) ; }
This method is invoked to instruct the diagnostic module to capture all relevant information that it has about a particular incident
321
21
163,511
public final void getDataForDirectives ( String [ ] directives , Throwable ex , IncidentStream ffdcis , Object callerThis , Object [ ] catcherObjects , String sourceId ) { if ( directives == null || directives . length <= 0 || ! continueProcessing ( ) ) return ; for ( String s : directives ) { String sName = s . toLowerCase ( ) ; for ( Method m : _dumpMethods ) { String mName = m . getName ( ) . toLowerCase ( ) ; if ( mName . equals ( sName ) ) { invokeDiagnosticMethod ( m , ex , ffdcis , callerThis , catcherObjects , sourceId ) ; break ; } } if ( ! continueProcessing ( ) ) break ; } }
Invoke all the ffdcdump methods for a set of directives
164
14
163,512
private final void invokeDiagnosticMethod ( Method m , Throwable ex , IncidentStream ffdcis , Object callerThis , Object [ ] catcherObjects , String sourceId ) { try { m . invoke ( this , new Object [ ] { ex , ffdcis , callerThis , catcherObjects , sourceId } ) ; ffdcis . writeLine ( "+ Data for directive [" + m . getName ( ) . substring ( FFDC_DUMP_PREFIX . length ( ) ) + "] obtained." , "" ) ; } catch ( Throwable t ) { ffdcis . writeLine ( "Error while processing directive [" + m . getName ( ) . substring ( FFDC_DUMP_PREFIX . length ( ) ) + "] !!!" , t ) ; } }
Invoke dump method
176
4
163,513
public final boolean validate ( ) { if ( makeNoise ( ) ) { System . out . println ( "This method is NOT intended to be called from the runtime" ) ; System . out . println ( "but is provided as part of unit test for diagnostic modules" ) ; ListIterator < Method > im ; try { init ( ) ; System . out . println ( "default directives on the diagnostic module : " ) ; im = _dumpDefaultMethods . listIterator ( ) ; while ( im . hasNext ( ) ) { System . out . println ( "\t" + im . next ( ) ) ; } System . out . println ( "ffdc methods on the diagnostic module : " ) ; im = _dumpMethods . listIterator ( ) ; while ( im . hasNext ( ) ) { System . out . println ( "\t" + im . next ( ) ) ; } } catch ( DiagnosticModuleRegistrationFailureException dmfailed ) { System . out . println ( "Diagnostic Module failed to register: " + dmfailed ) ; dmfailed . printStackTrace ( ) ; return false ; } catch ( Throwable th ) { System . out . println ( "Some unknown failure occured: " + th ) ; th . printStackTrace ( ) ; return false ; } } return true ; }
Validate whether the diagnostic module is correctly coded . Method can be used as a simple validation of a components diagnostic module . The information printed can be used during the development of the DM .
279
37
163,514
private boolean continueProcessing ( ) { Boolean currentValue = _continueProcessing . get ( ) ; if ( currentValue != null ) return currentValue . booleanValue ( ) ; return true ; }
Check the the ThreadLocal to see if we should continue processing this FFDC exception
41
16
163,515
public static int [ ] parseSpecStr ( String in ) { if ( in == null ) { return new int [ 0 ] ; } in = in . replaceAll ( " " , "" ) ; in = in . trim ( ) ; if ( in . length ( ) == 0 ) { return new int [ 0 ] ; } String [ ] tokens = in . split ( "," ) ; int [ ] toReturn = new int [ tokens . length ] ; for ( int i = 0 ; i < tokens . length ; i ++ ) { tokens [ i ] = tokens [ i ] . trim ( ) ; try { toReturn [ i ] = Integer . parseInt ( tokens [ i ] ) ; } catch ( NumberFormatException e ) { if ( tokens [ i ] . equals ( "*" ) && i == 0 ) { toReturn [ i ] = PmiConstants . ALL_DATA ; } // invalid configuration specification, set to undefined (no op) else { toReturn [ i ] = PmiConstants . LEVEL_UNDEFINED ; } } } return toReturn ; }
Helper function to parse the configuration s spec strings .
229
10
163,516
public static SelectionCriteriaFactory getInstance ( ) { if ( _instance == null ) { synchronized ( SIDestinationAddressFactory . class ) { try { Class cls = Class . forName ( MESSAGE_SELECTOR_FACTORY_CLASS ) ; _instance = ( SelectionCriteriaFactory ) cls . newInstance ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.wsspi.sib.core.SelectionCriteriaFactory.createFactoryInstance" , "100" ) ; SibTr . error ( tc , "UNABLE_TO_CREATE_FACTORY_CWSIB0001" , e ) ; } } } /* Otherwise, return the singleton */ return _instance ; }
Get the singleton SIDestinationAddressFactory which is to be used for creating SIDestinationAddress instances .
168
24
163,517
private void setValue ( Object newValue ) { try { if ( this . type == null ) value = newValue ; else if ( this . type . equals ( "java.lang.String" ) ) value = newValue ; else if ( this . type . equals ( "java.lang.Boolean" ) ) value = Boolean . valueOf ( ( String ) newValue ) ; else if ( this . type . equals ( "java.lang.Integer" ) ) value = new Integer ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Double" ) ) value = new Double ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Byte" ) ) value = new Byte ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Short" ) ) value = new Short ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Long" ) ) value = new Long ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Float" ) ) value = new Float ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Character" ) ) value = Character . valueOf ( ( ( String ) newValue ) . charAt ( 0 ) ) ; else value = newValue ; } catch ( NumberFormatException nfe ) { Tr . warning ( tc , "INCOMPATIBLE_PROPERTY_TYPE_J2CA0207" , new Object [ ] { name , type , newValue } ) ; } }
should be identical to version 1 . 3 except newValue is of type Object .
371
16
163,518
public void addSelectionCriteria ( SelectionCriteria selCriteria ) throws SIDiscriminatorSyntaxException , SISelectorSyntaxException , SIResourceException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addSelectionCriteria" , new Object [ ] { selCriteria } ) ; // We should really check discriminator access at this stage // However since these checks require access to the connection which // does not belong on this object , I have decided to avoid the checks // at this stage as they will be done at message delivery time // Also, it is the case that in all current usage the discriminators will // be the same for all selectionCriteria boolean duplicateCriteria = _consumerDispatcher . getConsumerDispatcherState ( ) . addSelectionCriteria ( selCriteria ) ; if ( ! duplicateCriteria ) { // Add the new criteria to the matchspace try { _messageProcessor . getMessageProcessorMatching ( ) . addConsumerDispatcherMatchTarget ( _consumerDispatcher , _consumerDispatcher . getDestination ( ) . getUuid ( ) , selCriteria ) ; } catch ( SIDiscriminatorSyntaxException e ) { // No FFDC code needed // Remove the selection criteria as it was added to the list _consumerDispatcher . getConsumerDispatcherState ( ) . removeSelectionCriteria ( selCriteria ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addSelectionCriteria" , e ) ; throw e ; } catch ( SISelectorSyntaxException e ) { // No FFDC code needed // Remove the selection criteria as it was added to the list _consumerDispatcher . getConsumerDispatcherState ( ) . removeSelectionCriteria ( selCriteria ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addSelectionCriteria" , e ) ; throw e ; } // Persist change made to consumerDispatcherState Transaction tran = _messageProcessor . getTXManager ( ) . createAutoCommitTransaction ( ) ; if ( ! _consumerDispatcher . getReferenceStream ( ) . isUpdating ( ) ) { try { _consumerDispatcher . getReferenceStream ( ) . requestUpdate ( tran ) ; } catch ( MessageStoreException e ) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.MPSubscriptionImpl.addSelectionCriteria" , "1:153:1.6" , this ) ; // Remove the selection criteria as it was added to the list _consumerDispatcher . getConsumerDispatcherState ( ) . removeSelectionCriteria ( selCriteria ) ; SibTr . exception ( tc , e ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addSelectionCriteria" , "SIResourceException" ) ; throw new SIResourceException ( e ) ; } } } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addSelectionCriteria" ) ; }
Add an additional selection criteria to the to the subscription Duplicate selection criterias are ignored
712
18
163,519
public SelectionCriteria [ ] getSelectionCriteria ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getSelectionCriteria" ) ; SelectionCriteria [ ] list = _consumerDispatcher . getConsumerDispatcherState ( ) . getSelectionCriteriaList ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getSelectionCriteria" , list ) ; return list ; }
List existing selection criterias registered with the subscription
105
10
163,520
public void setUserProperties ( Map userData ) throws SIResourceException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setUserProperties" , new Object [ ] { userData } ) ; _consumerDispatcher . getConsumerDispatcherState ( ) . setUserData ( userData ) ; Transaction tran = _messageProcessor . getTXManager ( ) . createAutoCommitTransaction ( ) ; if ( ! _consumerDispatcher . getReferenceStream ( ) . isUpdating ( ) ) { try { _consumerDispatcher . getReferenceStream ( ) . requestUpdate ( tran ) ; } catch ( MessageStoreException e ) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.MPSubscriptionImpl.setUserProperties" , "1:269:1.6" , this ) ; SibTr . exception ( tc , e ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setUserProperties" , "SIResourceException" ) ; throw new SIResourceException ( e ) ; } } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setUserProperties" ) ; }
Store a map of user properties with a subscription The map provided on this call will replace any existing map stored with the subscription
296
24
163,521
public Map getUserProperties ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getUserProperties" ) ; Map map = _consumerDispatcher . getConsumerDispatcherState ( ) . getUserData ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getUserProperties" , map ) ; return map ; }
Get the map currently stored with the subscription
91
8
163,522
public String getSubscriberId ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getSubscriberId" ) ; String subscriberId = _consumerDispatcher . getConsumerDispatcherState ( ) . getSubscriberID ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getSubscriberId" , subscriberId ) ; return subscriberId ; }
Get subscriberID for this subscription
99
6
163,523
public String getWPMTopicSpaceName ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getWPMTopicSpaceName" ) ; String tsName = _consumerDispatcher . getConsumerDispatcherState ( ) . getTopicSpaceName ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getWPMTopicSpaceName" , tsName ) ; return tsName ; }
Get WPMTopicSpaceName for this subscription
101
9
163,524
public String getMEName ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getMEName" ) ; String meName = _messageProcessor . getMessagingEngineName ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getMEName" , meName ) ; return meName ; }
Get MEName for this subscription
83
6
163,525
@ Override public int getLocalId ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getLocalId" ) ; int localId = 0 ; final TransactionImpl tran = ( ( TranManagerSet ) TransactionManagerFactory . getTransactionManager ( ) ) . getTransactionImpl ( ) ; if ( tran != null ) { localId = ( int ) tran . getLocalTID ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getLocalId" , localId ) ; return localId ; }
Returns a process - unique identifier for the transaction currently associated with the calling thread . The local - id is valid only within the local process . The local - id is recovered as part of the state of a recovered transaction .
148
44
163,526
public static void beforeCompletion ( TransactionImpl tran , int syncLevel ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "beforeCompletion" , new Object [ ] { tran , syncLevel } ) ; if ( syncLevel >= 0 ) { final ArrayList syncs = _syncLevels . get ( syncLevel ) ; if ( syncs != null ) { final int localID = ( int ) tran . getLocalTID ( ) ; final byte [ ] globalID = tran . getTID ( ) ; final int numSyncs = syncs . size ( ) ; for ( int s = 0 ; s < numSyncs ; s ++ ) { ( ( SynchronizationCallback ) syncs . get ( s ) ) . beforeCompletion ( localID , globalID ) ; // exception here means rollback } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "beforeCompletion" ) ; }
Notify all the registered syncs of the begin of the completion phase of the given transaction
231
18
163,527
public static void afterCompletion ( TransactionImpl tran , int status , int syncLevel ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "afterCompletion" , new Object [ ] { tran , status , syncLevel } ) ; if ( syncLevel >= 0 ) { final ArrayList syncs = _syncLevels . get ( syncLevel ) ; if ( syncs != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "syncs.length=" + syncs . size ( ) ) ; final int localID = ( int ) tran . getLocalTID ( ) ; final byte [ ] globalID = tran . getTID ( ) ; // d281425 - status maybe committed, unknown or rolledback final boolean committed = ! ( status == Status . STATUS_ROLLEDBACK ) ; // @281425C final int numSyncs = syncs . size ( ) ; for ( int s = 0 ; s < numSyncs ; s ++ ) { try { ( ( SynchronizationCallback ) syncs . get ( s ) ) . afterCompletion ( localID , globalID , committed ) ; } catch ( Throwable t ) { // No FFDC needed Tr . error ( tc , "WTRN0074_SYNCHRONIZATION_EXCEPTION" , new Object [ ] { "afterCompletion" , syncs . get ( s ) , t } ) ; // absorb and allow other afterCompletions to run. } } } else if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "syncs is null" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "afterCompletion" ) ; }
Notify all the registered syncs of the end of the completion phase of the given transaction . The completion resulted in the transaction having the given status .
425
30
163,528
public static boolean callbacksRegistered ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "callbacksRegistered" ) ; if ( _syncLevel < 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "callbacksRegistered" , Boolean . FALSE ) ; return false ; } final int maxLevels = _syncLevels . size ( ) ; for ( int level = 0 ; level < maxLevels ; level ++ ) { final ArrayList syncs = _syncLevels . get ( _syncLevel ) ; if ( syncs != null && ! syncs . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "callbacksRegistered" , Boolean . TRUE ) ; return true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "callbacksRegistered" , Boolean . FALSE ) ; return false ; }
which can still be called otherwise false .
246
8
163,529
private static void garbageCollectUnusedLevels ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "garbageCollectUnusedLevels" ) ; final int numLevels = _syncLevels . size ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Levels: " + numLevels ) ; // No need to do anything if we only have one level if ( numLevels < 2 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "garbageCollectUnusedLevels" , "Doing nothing" ) ; return ; } final int [ ] counts = new int [ numLevels ] ; // Check through all transactions to see which levels are still in use final TransactionImpl [ ] txns = LocalTIDTable . getAllTransactions ( ) ; // Record the levels with transactions referring to them // Record the levels with transactions referring to them for ( int i = txns . length ; -- i >= 0 ; ) { // TransactionImpl has a dependency on CORBA which we definitely don't want // Skip this step to avoid a classcastexception // TODO can we work around the dependency? int level = 0 ; // final int level = ((com.ibm.ws.tx.jta.TransactionImpl) txns[i]).getExtJTASyncLevel(); if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Not generating any counts for garbageCollectUnusedLevels()" ) ; } if ( level >= 0 && level < numLevels ) { counts [ level ] ++ ; } } // Now null out the levels with no references for ( int i = counts . length ; -- i >= 0 ; ) { // We never want to null out the current level if ( i != _syncLevel ) { if ( counts [ i ] == 0 ) { _syncLevels . set ( i , null ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "garbageCollectUnusedLevels" , _syncLevels . size ( ) ) ; }
Null out levels that will never be referenced again . Null entries are candidates to be the next current level .
500
21
163,530
private static void setLevel ( ArrayList level ) { _syncLevel = nextLevel ( ) ; if ( _syncLevel == _syncLevels . size ( ) ) { _syncLevels . add ( level ) ; } else { _syncLevels . set ( _syncLevel , level ) ; } }
Utility method to make a list into the new current level
65
12
163,531
private void validateParameters ( String filePath , String password , int validity , String subjectDN , int keySize , String sigAlg ) { if ( ! validateFilePath ( filePath ) ) { throw new IllegalArgumentException ( "filePath must be a valid filePath within the file system." ) ; } if ( password == null || password . length ( ) < MINIMUM_PASSWORD_LENGTH ) { throw new IllegalArgumentException ( "The password must be at least " + MINIMUM_PASSWORD_LENGTH + " characters in length." ) ; } if ( validity < MINIMUM_VALIDITY ) { throw new IllegalArgumentException ( "The validity period must be at least " + MINIMUM_VALIDITY + " days." ) ; } List < String > validSigAlg = VALID_SIG_ALG ; if ( ! validSigAlg . contains ( sigAlg ) ) { throw new IllegalArgumentException ( "The signagure algorithm values include " + VALID_SIG_ALG ) ; } String type = getKeyFromSigAlg ( sigAlg ) ; if ( type . equals ( KEYALG_RSA_TYPE ) ) { List < Integer > validKeySizes = VALID_RSA_KEYSIZE ; if ( ! validKeySizes . contains ( keySize ) ) { throw new IllegalArgumentException ( "The key sizes for an RSA key include " + VALID_RSA_KEYSIZE ) ; } } else { List < Integer > validKeySizes = VALID_EC_KEYSIZE ; if ( ! validKeySizes . contains ( keySize ) ) { throw new IllegalArgumentException ( "The key sizes for an EC key include " + VALID_EC_KEYSIZE ) ; } } validateSubjectDN ( subjectDN ) ; }
Validate the parameters .
400
5
163,532
private boolean validateFilePath ( String filePath ) { if ( filePath == null || filePath . isEmpty ( ) ) { throw new IllegalArgumentException ( "filePath must be a valid filePath within the file system." ) ; } // Check if the filename exists as a File -- use an absolute file to ensure we have // a parent: even if that parent is ${user.dir} ... File loc = new File ( filePath ) . getAbsoluteFile ( ) ; return ( loc . exists ( ) || loc . getParentFile ( ) . exists ( ) ) ; }
The specified filePath must either exist or in the case the file should be created its parent directory .
123
20
163,533
public < K2 extends K , E2 extends E > BlockingList < K2 , E2 > make ( ) { @ SuppressWarnings ( "unchecked" ) BlockingListMaker < K2 , E2 > stricterThis = ( BlockingListMaker < K2 , E2 > ) this ; return stricterThis . internalCreateBlockingList ( ) ; }
Construct a list
80
3
163,534
public BlockingListMaker < K , E > log ( Logger logger ) { this . logger = logger == null ? NULL_LOGGER : logger ; return this ; }
Define the logger to use to log interesting events within the list
36
13
163,535
public BlockingListMaker < K , E > waitFor ( long time , TimeUnit unit ) { this . nanoTimeout = time == 0 ? 1 : NANOSECONDS . convert ( time , unit ) ; return this ; }
Specify the total time to wait for the elements of the list to become available
50
16
163,536
public String getSystemMessageId ( ) { //based on com.ibm.ws.sib.mfp.impl.JsHdrsImpl if ( uuid != null ) { StringBuilder buff = new StringBuilder ( uuid . toString ( ) ) ; buff . append ( MfpConstants . MESSAGE_HANDLE_SEPARATOR ) ; buff . append ( value ) ; return new String ( buff ) ; } else { return null ; } }
Returns the SIMessageHandles System Message ID .
102
10
163,537
private void processExistingWSDL ( String wsdlLocation , Member newMember ) throws InjectionException { // if the wsdlLocation for this service reference is specified in the DD, log a debug statement and continue if ( wsrInfo . getWsdlLocation ( ) != null && ! "" . equals ( wsrInfo . getWsdlLocation ( ) ) ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "For the " + wsrInfo . getJndiName ( ) + " service reference, " + "the " + wsrInfo . getWsdlLocation ( ) + " WSDL file is specified in the " + "deployment descriptor. Annotation metadata referencing a WSDL file for " + "this service reference will be ignored." ) ; } } else { // else we want to set the value to whatever is in the annotation if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "For the " + wsrInfo . getJndiName ( ) + " service reference, " + "setting the wsdlLocation: " + wsdlLocation ) ; } wsrInfo . setWsdlLocation ( wsdlLocation ) ; } }
This will compare the wsdlLocation attribute of the various annotations that have refer to the same service reference . If they differ we will throw an exception as the runtime will not be able to determine which WSDL to use . We will only do this checking if there was not a WSDL location specified in the deployment descriptor . If the DD specifies a deployment descriptor that value will be used and other values will be ignored .
270
86
163,538
public int compare ( Object o1 , Object o2 ) { String re1 = ( ( ConnectionStatus ) o1 ) . getRemoteEngineName ( ) ; String re2 = ( ( ConnectionStatus ) o2 ) . getRemoteEngineName ( ) ; return re1 . compareTo ( re2 ) ; }
If o1 comes after o2 return 1
65
9
163,539
public synchronized void put ( byte item ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "put" , Byte . valueOf ( item ) ) ; checkValid ( ) ; getCurrentByteBuffer ( 1 ) . put ( item ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "put" ) ; }
Puts a single byte into the byte buffer .
108
10
163,540
public synchronized void putShort ( short item ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "putShort" , Short . valueOf ( item ) ) ; checkValid ( ) ; getCurrentByteBuffer ( 2 ) . putShort ( item ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "putShort" ) ; }
Puts a short into the byte buffer .
112
9
163,541
public synchronized void putInt ( int item ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "putInt" , Integer . valueOf ( item ) ) ; checkValid ( ) ; getCurrentByteBuffer ( 4 ) . putInt ( item ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "putInt" ) ; }
Puts an int into the byte buffer .
112
9
163,542
public synchronized void putLong ( long item ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "putLong" , Long . valueOf ( item ) ) ; checkValid ( ) ; getCurrentByteBuffer ( 4 ) . putLong ( item ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "putLong" ) ; }
Puts a long into the byte buffer .
112
9
163,543
public synchronized void setReadOnly ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setReadOnly" ) ; // And actually mark the real buffers as read-only too for ( int x = 0 ; x < dataList . size ( ) ; x ++ ) { WsByteBuffer buff = dataList . get ( x ) ; buff . setReadOnly ( true ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setReadOnly" ) ; }
This method sets all the byte buffers that we have in the list as read only .
142
17
163,544
public synchronized long prepareForTransmission ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "prepareForTransmission" ) ; checkValid ( ) ; valid = false ; // Get the last buffer and flip it. Then we can simply return the list of buffers if ( dataList . size ( ) > 0 ) { WsByteBuffer buff = dataList . get ( dataList . size ( ) - 1 ) ; buff . flip ( ) ; } long sendAmount = 0 ; for ( int x = 0 ; x < dataList . size ( ) ; x ++ ) { WsByteBuffer buff = dataList . get ( x ) ; sendAmount += buff . remaining ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "prepareForTransmission" , Long . valueOf ( sendAmount ) ) ; return sendAmount ; }
This method prepares the byte buffers wrapped by this class for transmission . In practise this means that all the buffers are flipped and the number of bytes that will be transmitted is returned .
221
35
163,545
public synchronized WsByteBuffer [ ] getBuffersForTransmission ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getBufferForTransmission" ) ; // Ensure the buffer has been prepared checkNotValid ( ) ; WsByteBuffer [ ] bufferArray = new WsByteBuffer [ dataList . size ( ) ] ; for ( int x = 0 ; x < dataList . size ( ) ; x ++ ) { bufferArray [ x ] = dataList . get ( x ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getBufferForTransmission" , dataList ) ; return bufferArray ; }
This method is called just before this buffer is due to be transmitted by the JFap channel . When calling this method the underlying byte buffer is prepared by setting the correct limits and the buffer is added to a List that is returned . Once this method is called the buffer may not be used again and any attempt to modify the data will cause a RuntimeException to be thrown . This method can only be called once .
176
83
163,546
protected WsByteBuffer getCurrentByteBuffer ( int sizeNeeded ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getCurrentByteBuffer" , Integer . valueOf ( sizeNeeded ) ) ; WsByteBuffer byteBuffer = null ; // First have a look in the dataList for a buffer. if ( dataList . size ( ) == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Creating first buffer" ) ; // This is the first piece of data to be written into the buffer. As such, we simply // allocate a new buffer and return that dataList = new ArrayList < WsByteBuffer > ( ) ; byteBuffer = createNewWsByteBuffer ( sizeNeeded ) ; dataList . add ( byteBuffer ) ; } else { // Otherwise get the last byte buffer in the list byteBuffer = dataList . get ( dataList . size ( ) - 1 ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Last buffer: " , byteBuffer ) ; // Now check and see if there is enough room in there for data that needs to be written. // If there is enough room, great - we return that buffer. Otherwise we need to complete // the current buffer and start a new one. if ( byteBuffer . remaining ( ) < sizeNeeded ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "No room in buffer, creating a new one" ) ; // First flip the finished one byteBuffer . flip ( ) ; // Now create a new one and add it onto the list byteBuffer = createNewWsByteBuffer ( sizeNeeded ) ; dataList . add ( byteBuffer ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getCurrentByteBuffer" , byteBuffer ) ; return byteBuffer ; }
This method will return a byte buffer that can be written to for the amount of data that needs to be written . If there is no room left in the current byte buffer a new one will be created and added to the list .
479
46
163,547
private WsByteBuffer createNewWsByteBuffer ( int sizeNeeded ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createNewWsByteBuffer" , Integer . valueOf ( sizeNeeded ) ) ; if ( sizeNeeded < DEFAULT_BUFFER_SIZE ) { sizeNeeded = DEFAULT_BUFFER_SIZE ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Allocating a buffer of size: " + sizeNeeded ) ; WsByteBuffer buffer = poolMan . allocate ( sizeNeeded ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createNewWsByteBuffer" , buffer ) ; return buffer ; }
This method will create a new WsByteBuffer . By default it will be created to hold 200 bytes but if the size needed is larger than this then the buffer will simply be allocated to hold the exact number of bytes requested .
203
46
163,548
public synchronized String getDumpReceivedBytes ( int bytesToDump ) { String dump = null ; if ( receivedBuffer != null ) { dump = getDumpBytes ( receivedBuffer , bytesToDump , false ) ; } return dump ; }
Returns the String that represents a dump of the bytes received in this comms byte buffer . This method is not intended to be used for buffers that are being contructed for outbound use .
53
39
163,549
private static String getDumpBytes ( WsByteBuffer buffer , int bytesToDump , boolean rewind ) { // Save the current position int pos = buffer . position ( ) ; if ( rewind ) { buffer . rewind ( ) ; } byte [ ] data = null ; int start ; int count = bytesToDump ; if ( count > buffer . remaining ( ) || count == ENTIRE_BUFFER ) count = buffer . remaining ( ) ; if ( buffer . hasArray ( ) ) { data = buffer . array ( ) ; start = buffer . arrayOffset ( ) + buffer . position ( ) ; } else { data = new byte [ count ] ; buffer . get ( data ) ; start = 0 ; } String strData = "Dumping " + count + " bytes of buffer data:\r\n" ; if ( count > 0 ) strData += SibTr . formatBytes ( data , start , count ) ; // Return the position to where it should be if ( rewind ) buffer . position ( pos ) ; return strData ; }
Returns a dump of the specified number of bytes of the specified buffer .
224
14
163,550
private int getIntKeyForString ( ArrayList < String > uniqueStrings , Object value ) { String stringValue = String . valueOf ( value ) ; int retval = uniqueStrings . indexOf ( stringValue ) ; if ( retval < 0 ) { retval = uniqueStrings . size ( ) ; uniqueStrings . add ( stringValue ) ; } return retval ; }
Helper method to get or assign a unique key to a string from an ArrayList containing the unique keys .
83
21
163,551
public static void writeObjectInstanceOutput ( final RESTResponse response , final ObjectInstanceWrapper value , final JSONConverter converter ) { response . setContentType ( APIConstants . MEDIA_TYPE_APPLICATION_JSON ) ; OutputStream outStream = null ; try { outStream = response . getOutputStream ( ) ; //Converter the value converter . writeObjectInstance ( outStream , value ) ; //Return converter JSONConverter . returnConverter ( converter ) ; outStream . flush ( ) ; } catch ( Exception e ) { throw ErrorHelper . createRESTHandlerJsonException ( e , converter , APIConstants . STATUS_INTERNAL_SERVER_ERROR ) ; } finally { FileUtils . tryToClose ( outStream ) ; } }
Write ObjectInstanceWrapper to the response
173
8
163,552
public static StatsGroup createStatsGroup ( String groupName , String statsTemplate , StatsGroup parentGroup , ObjectName mBean , StatisticActions actionLsnr ) throws StatsFactoryException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , new StringBuffer ( "createStatsGroup:name=" ) . append ( groupName ) . append ( ";parent group=" ) . append ( parentGroup . getName ( ) ) . append ( ";template=" ) . append ( statsTemplate ) . append ( ";mBean=" ) . append ( ( mBean == null ) ? null : mBean . toString ( ) ) . toString ( ) ) ; checkPMIService ( groupName ) ; StatsGroup group ; try { group = StatsGroupImpl . createGroup ( groupName , parentGroup , statsTemplate , mBean , false , actionLsnr ) ; } catch ( StatsFactoryException e ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception:" , e ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createStatsGroup" ) ; throw e ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createStatsGroup" ) ; return group ; }
Create a StatsGroup using the Stats template and add to the PMI tree under the specified parent group . This method will associate the MBean provided by the caller to the Stats group .
280
38
163,553
public static void removeStatsInstance ( StatsInstance instance ) throws StatsFactoryException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , new StringBuffer ( "removeStatsInstance:name=" ) . append ( instance . getName ( ) ) . toString ( ) ) ; StatsFactoryUtil . unRegisterStats ( ( PmiModule ) instance , instance . getMBean ( ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatsInstance" ) ; }
Removes a StatsInstance from the PMI tree . Note that any children under the instance will also be removed . If the instance is associated with a default CustomStats MBean the MBean will be de - activated .
111
46
163,554
public static void removeStatsGroup ( StatsGroup group ) throws StatsFactoryException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , new StringBuffer ( "removeStatsGroup:name=" ) . append ( group . getName ( ) ) . toString ( ) ) ; StatsFactoryUtil . unRegisterStats ( ( PmiModule ) group , group . getMBean ( ) ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "removeStatsGroup" ) ; }
Removes a StatsGroup from the PMI tree . Note that any children under the group will also be removed . If the group is associated with a default CustomStats MBean the MBean will be de - activated .
111
46
163,555
@ Override protected Validator createValidator ( ) throws JspException { if ( null == _minimum && null == _maximum ) { throw new JspException ( "a minimum and / or a maximum have to be specified" ) ; } ELContext elContext = FacesContext . getCurrentInstance ( ) . getELContext ( ) ; if ( null != _minimum ) { _min = getValue ( _minimum . getValue ( elContext ) ) ; } if ( null != _maximum ) { _max = getValue ( _maximum . getValue ( elContext ) ) ; } if ( null != _minimum && null != _maximum ) { if ( ! isMinLTMax ( ) ) { throw new JspException ( "maximum limit must be greater than the minimum limit" ) ; } } return super . createValidator ( ) ; }
This method returns the Validator you have to cast it to the correct type and apply the min and max values .
178
23
163,556
private String incrementAlias ( KeyStore jKeyStore , String alias ) throws KeyStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "incrementAlias: " + alias ) ; int num = 0 ; String base ; int index = alias . lastIndexOf ( ' ' ) ; if ( - 1 == index ) { // no underscore found base = alias + ' ' ; } else if ( index == ( alias . length ( ) - 1 ) ) { // alias ends with underscore base = alias ; } else { // alias ends with _X where X might be a number... try { ++ index ; // jump past the underscore num = Integer . parseInt ( alias . substring ( index ) ) ; base = alias . substring ( 0 , index ) ; } catch ( NumberFormatException nfe ) { // not a number base = alias + ' ' ; } } String newAlias = base + Integer . toString ( ++ num ) ; while ( jKeyStore . containsAlias ( newAlias ) ) { newAlias = base + Integer . toString ( ++ num ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "incrementAlias: " + newAlias ) ; return newAlias ; }
Increment the trailing number on the alias value until one is found that does not currently exist in the input store .
286
23
163,557
public String getUserName ( boolean notAlternateUser ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getUserName" , new Object [ ] { new Boolean ( notAlternateUser ) } ) ; String userName = null ; if ( ! notAlternateUser // this catches the case where we want the // user associated with the subject && isAlternateUserBased ( ) ) { userName = alternateUser ; } else if ( isSubjectBased ( ) ) { if ( authorisationUtils != null ) { userName = authorisationUtils . getUserName ( subject ) ; } } else if ( isUserIdBased ( ) ) { userName = userId ; } else if ( isMsgBased ( ) ) { userName = msg . getSecurityUserid ( ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getUserName" , userName ) ; return userName ; }
Extract the appropriate username from this security context
209
9
163,558
public boolean isSIBServerSubject ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isSIBServerSubject" ) ; boolean ispriv = false ; // If the context is userid or alternate user based then it cannot be the // privileged SIBServerSubject, so we only need to check the Subject and // msg based contexts. if ( isSubjectBased ( ) ) { if ( authorisationUtils != null ) { ispriv = authorisationUtils . isSIBServerSubject ( subject ) ; } } else if ( isMsgBased ( ) ) { if ( authorisationUtils != null ) { ispriv = authorisationUtils . sentBySIBServer ( msg ) ; } } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isSIBServerSubject" , new Boolean ( ispriv ) ) ; return ispriv ; }
Check whether this security context belongs to the privileged SIBServerSubject or not .
196
16
163,559
@ Override public void complete ( VirtualConnection vc , TCPWriteRequestContext wsc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "complete() called: vc=" + vc ) ; } HttpInboundServiceContextImpl mySC = ( HttpInboundServiceContextImpl ) vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPISC ) ; if ( null != wsc ) { wsc . setBuffers ( null ) ; } // access logging if the finishResponse API was used if ( mySC . isMessageSent ( ) ) { mySC . logFinalResponse ( mySC . getNumBytesWritten ( ) ) ; HttpInvalidMessageException inv = mySC . checkResponseValidity ( ) ; if ( null != inv ) { // response was invalid in some way... error scenario mySC . setPersistent ( false ) ; if ( null != mySC . getAppWriteCallback ( ) ) { mySC . getAppWriteCallback ( ) . error ( vc , inv ) ; } return ; } } // if a callback exists above, pass along the complete. But if the // app channel didn't give us a callback (it doesn't care) then we // can't pass anything along and we stop further work here if ( null != mySC . getAppWriteCallback ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Calling write complete callback of app channel." ) ; } if ( mySC . getResponseImpl ( ) . isTemporaryStatusCode ( ) ) { // allow other responses to follow a temporary one if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Temp response sent, resetting send flags" ) ; } mySC . resetWrite ( ) ; } mySC . getAppWriteCallback ( ) . complete ( vc ) ; } else { // this is dangerous since we're not notifying the channel above // of the complete work, but they don't care since they didn't // give us a callback to use... hopefully they will continue this // connection properly. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "No available app channel callback" ) ; } } }
Called by the channel below us when a write has finished .
526
13
163,560
@ Override public void error ( VirtualConnection vc , TCPWriteRequestContext wsc , IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "error called: vc=" + vc + " ioe=" + ioe ) ; } HttpInboundServiceContextImpl mySC = ( HttpInboundServiceContextImpl ) vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPISC ) ; if ( mySC . getHttpConfig ( ) . getDebugLog ( ) . isEnabled ( DebugLog . Level . WARN ) ) { mySC . getHttpConfig ( ) . getDebugLog ( ) . log ( DebugLog . Level . WARN , HttpMessages . MSG_WRITE_FAIL , mySC ) ; } mySC . logLegacyMessage ( ) ; // pass on the error if possible, else just close the connection mySC . setPersistent ( false ) ; if ( null != mySC . getAppWriteCallback ( ) ) { mySC . getAppWriteCallback ( ) . error ( vc , ioe ) ; } else { mySC . getLink ( ) . getDeviceLink ( ) . close ( vc , ioe ) ; } }
Called by the channel below us when an error occurs during a write .
280
15
163,561
@ Deactivate protected void deactivate ( int reason ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Deactivating " + this , "reason=" + reason ) ; } // purge cached data from config this . cachedEncoding = null ; this . cachedLocale = null ; this . localeMap . clear ( ) ; this . converterMap . clear ( ) ; this . supportedEncodingsCache . clear ( ) ; this . localesCache . clear ( ) ; }
DS deactivation method for this component .
119
8
163,562
private List < List < String > > processAcceptLanguage ( String acceptLanguage ) { StringTokenizer languageTokenizer = new StringTokenizer ( acceptLanguage , "," ) ; TreeMap < Double , List < String > > map = new TreeMap < Double , List < String > > ( Collections . reverseOrder ( ) ) ; List < String > list ; while ( languageTokenizer . hasMoreTokens ( ) ) { String language = languageTokenizer . nextToken ( ) . trim ( ) ; if ( language . length ( ) == 0 ) { continue ; } int semicolonIndex = language . indexOf ( ' ' ) ; Double qValue = Double . valueOf ( 1 ) ; if ( semicolonIndex > - 1 ) { int qIndex = language . indexOf ( "q=" ) ; String qValueStr = language . substring ( qIndex + 2 ) ; try { qValue = Double . valueOf ( qValueStr . trim ( ) ) ; } catch ( NumberFormatException nfe ) { FFDCFilter . processException ( nfe , "EncodingUtils.processAcceptLanguage" , "215" ) ; } language = language . substring ( 0 , semicolonIndex ) ; } if ( language . length ( ) > 0 ) { if ( ( qValue . doubleValue ( ) > 0 ) && ( language . charAt ( 0 ) != ' ' ) ) { list = map . get ( qValue ) ; if ( null == list ) { list = new ArrayList < String > ( 1 ) ; } list . add ( language ) ; map . put ( qValue , list ) ; } } } List < List < String > > rc = null ; if ( ! map . isEmpty ( ) ) { rc = new ArrayList < List < String > > ( map . values ( ) ) ; } return rc ; }
Processes the accept language header into a sublists based on the qvalue . Each sublist is a list of string values for a given qvalue and the overall list is ordered with preferred languages first .
392
41
163,563
private List < Locale > extractLocales ( List < List < String > > allLangs ) { List < Locale > rc = new ArrayList < Locale > ( ) ; for ( List < String > langList : allLangs ) { for ( String language : langList ) { String country = "" ; String variant = "" ; int countryIndex = language . indexOf ( ' ' ) ; if ( countryIndex > - 1 ) { int variantIndex = language . indexOf ( ' ' , ( countryIndex + 1 ) ) ; if ( variantIndex > - 1 ) { variant = language . substring ( variantIndex + 1 ) . trim ( ) ; country = language . substring ( countryIndex , variantIndex ) . trim ( ) ; } else { country = language . substring ( countryIndex + 1 ) . trim ( ) ; } language = language . substring ( 0 , countryIndex ) . trim ( ) ; } rc . add ( new Locale ( language , country , variant ) ) ; } } return rc ; }
Extract the locales from a passed in language list .
219
12
163,564
public Token getMetaDataToken ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "getMetaDataToken" ) ; SibTr . exit ( this , tc , "getMetaDataToken" , "return=" + _metaDataToken ) ; } return _metaDataToken ; }
startup of the message store
84
6
163,565
public void updateMetaDataOnly ( Transaction tran , Persistable persistable ) throws PersistenceException , ObjectManagerException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "updateMetaDataOnly" , new Object [ ] { "Tran=" + tran , "Persistable=" + persistable } ) ; // Defect 585163 // Get the meta data object to work with. This may involve // pulling it off disk if it has fallen out of memory. PersistableMetaData metaData = getMetaData ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "MetaData=" + metaData ) ; tran . lock ( metaData ) ; // Update the MetaData with the cached values metaData . setLockID ( persistable . getLockID ( ) ) ; metaData . setRedeliveredCount ( persistable . getRedeliveredCount ( ) ) ; tran . replace ( metaData ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "updateMetaDataOnly" , "MetaData=" + metaData ) ; }
Only update the persistent copy of the meta data associated with this Persistable . This variant is for a cached persistable in which the lock ID has been cached by the task .
287
36
163,566
@ Override public java . util . List < DataSlice > getData ( ) throws PersistentDataEncodingException , SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getData" ) ; java . util . List < DataSlice > retval = null ; synchronized ( this ) { if ( _link != null ) { retval = _link . getMemberData ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getData" , "return=" + retval ) ; return retval ; }
This method is used by the task layer to get hold of data from the cache layer before it is hardened to disk . It should therefore return the data from the Item and not that from the ManagedObject .
160
42
163,567
@ Override public void setWasSpillingAtAddition ( boolean wasSpillingAtAddition ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setWasSpillingAtAddition" , Boolean . valueOf ( wasSpillingAtAddition ) ) ; _wasSpillingAtAddition = wasSpillingAtAddition ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setWasSpillingAtAddition" ) ; }
we need to correctly track the value of this flag .
135
11
163,568
public void setWriter ( Object sysLogHolder , Object sysErrHolder ) { this . sysOutHolder = ( SystemLogHolder ) sysLogHolder ; this . sysErrHolder = ( SystemLogHolder ) sysErrHolder ; }
Set the writers for SystemOut and SystemErr respectfully
58
11
163,569
public static SecurityMetadata getSecurityMetadata ( ) { SecurityMetadata secMetadata = null ; ModuleMetaData mmd = ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . getComponentMetaData ( ) . getModuleMetaData ( ) ; if ( mmd instanceof WebModuleMetaData ) { secMetadata = ( SecurityMetadata ) ( ( WebModuleMetaData ) mmd ) . getSecurityMetaData ( ) ; } else { // ejb environment, check threadlocal. WebModuleMetaData wmmd = getWebModuleMetaData ( ) ; if ( wmmd != null ) { secMetadata = ( SecurityMetadata ) wmmd . getSecurityMetaData ( ) ; } } return secMetadata ; }
Get the security metadata
162
4
163,570
public CompoundName getFirstInChain ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getFirstInChain" ) ; CompoundName firstInChain = collector . getFirst ( ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getFirstInChain" , firstInChain ) ; return firstInChain ; }
Get the first compound name in any alias chain we re validating .
87
14
163,571
public void validate ( String destName , String busName ) throws SINotPossibleInCurrentConfigurationException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "validate" , new Object [ ] { destName , busName } ) ; if ( collector . contains ( destName , busName ) ) { // Throw out exception detailing loop // Add the destination name which has triggered the exception to the end // of the list, making the problem obvious. String chainText = toStringPlus ( destName , busName ) ; CompoundName firstInChain = getFirstInChain ( ) ; String nlsMessage = nls . getFormattedMessage ( "ALIAS_CIRCULAR_DEPENDENCY_ERROR_CWSIP0621" , new Object [ ] { firstInChain , chainText , busName } , null ) ; SINotPossibleInCurrentConfigurationException e = new SINotPossibleInCurrentConfigurationException ( nlsMessage ) ; SibTr . exception ( tc , e ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "validate" , nlsMessage ) ; throw e ; } collector . add ( destName , busName ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "validate" ) ; }
Check that the given destination busname combination has not been seen before when resolving an alias . If it has not been seen we add it to the map for checking next time .
290
35
163,572
public String toStringPlus ( String destName , String busName ) { StringBuffer sb = new StringBuffer ( toString ( ) ) ; // Add the destination name which has triggered the exception to the end // of the list, making the problem obvious. String compoundName = new CompoundName ( destName , busName ) . toString ( ) ; sb . append ( " -> " ) ; sb . append ( compoundName ) ; return sb . toString ( ) ; }
Return a string representation of the alias chain appended with the destination name given .
103
16
163,573
private void initialize ( final File logDirectory , final String aaplName ) { if ( logDirectory == null ) { captureEnabled = false ; return ; } AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { @ Override public Void run ( ) { // Create a new or reuse an existing base capture directory String captureDirStr = "JPATransform" + "/" + ( ( aaplName != null ) ? aaplName : "unknownapp" ) ; captureRootDir = new File ( logDirectory , captureDirStr ) ; captureEnabled = captureRootDir . mkdirs ( ) || captureRootDir . isDirectory ( ) ; if ( ! captureEnabled ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Cannot create server instance capture directory, so enhanced entity bytecode will not be captured." ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Capturing enhanced bytecode for JPA entities to " + captureRootDir . getAbsolutePath ( ) ) ; } } return null ; } } ) ; }
Determines the existence of the server log directory and attempts to create a capture directory within the log directory . If this can be accomplished the field captureEnabled is set to true . Otherwise it is left to its default value false if the capture directory cannot be used .
266
53
163,574
private static boolean resourceExist ( ExternalContext externalContext , String path ) { if ( "/" . equals ( path ) ) { // The root context exists always return true ; } Object ctx = externalContext . getContext ( ) ; if ( ctx instanceof ServletContext ) { ServletContext servletContext = ( ServletContext ) ctx ; InputStream stream = servletContext . getResourceAsStream ( path ) ; if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException e ) { // Ignore here, since we donnot wanted to read from this // resource anyway } return true ; } } return false ; }
doesnt exist . Otherwise the URL will fail on the first access .
140
14
163,575
public synchronized void addSlice ( CommsByteBuffer bufferContainingSlice , boolean last ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "addSlice" , new Object [ ] { bufferContainingSlice , last } ) ; slices . add ( bufferContainingSlice . getDataSlice ( ) ) ; // If this is the last slice, calculate the message length if ( last ) { for ( DataSlice slice : slices ) { messageLength += slice . getLength ( ) ; } complete = true ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Message now consists of " + slices . size ( ) + " slices" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "addSlice" ) ; }
This method will add a data slice to the list of slices for this message .
222
16
163,576
public void updateArrivalTime ( long messageArrivalTime ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "updateMessageArrivalTime" , messageArrivalTime ) ; this . arrivalTime = messageArrivalTime ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "updateMessageArrivalTime" ) ; }
Used to update the message arrival time for this data .
110
11
163,577
public void stop ( int requestNumber , SendListener sendListener ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "stop" , requestNumber ) ; logicallyStarted = false ; super . stop ( requestNumber , sendListener ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "stop" ) ; }
Stops the session and marks it as stopped .
107
10
163,578
public void close ( int requestNumber ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "close" , requestNumber ) ; // Deregister any error callback created for this connection. if ( asynchReader != null ) { try { mainConsumer . getConsumerSession ( ) . getConnection ( ) . removeConnectionListener ( asynchReader ) ; } catch ( SIException e ) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if ( ! ( ( ConversationState ) getConversation ( ) . getAttachment ( ) ) . hasMETerminated ( ) ) { FFDCFilter . processException ( e , CLASS_NAME + ".close" , CommsConstants . CATSESSSYNCHCONSUMER_CLOSE_01 , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . exception ( this , tc , e ) ; } if ( asynchReader . isCurrentlyDoingReceiveWithWait ( ) ) asynchReader . sendNoMessageToClient ( ) ; } super . close ( requestNumber ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "close" ) ; }
Closes the session . If we are currently doing a receiveWithWait then that will be interrupted and a response will be sent to the client .
310
29
163,579
public void setAsynchConsumerCallback ( int requestNumber , int maxActiveMessages , long messageLockExpiry , int batchsize , OrderingContext orderContext ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setAsynchConsumerCallback" , new Object [ ] { requestNumber , maxActiveMessages , messageLockExpiry , batchsize , orderContext } ) ; mainConsumer . setAsynchConsumerCallback ( requestNumber , maxActiveMessages , messageLockExpiry , batchsize , orderContext ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setAsynchConsumerCallback" ) ; }
This will cause the synchronous session to become asynchrnous . As such this class will not handle the session anymore so we inform the main consumer and that will then switch over the delegated class to handle the consumer .
177
45
163,580
@ Override public void postConstruct ( Object instance , Object creationMetaData ) throws InjectionProviderException { // TODO the servlet spec is not clear about searching in superclass?? Class clazz = instance . getClass ( ) ; Method [ ] methods = getDeclaredMethods ( clazz ) ; if ( methods == null ) { methods = clazz . getDeclaredMethods ( ) ; Map < Class , Method [ ] > declaredMethodBeansMap = getDeclaredMethodBeansMap ( ) ; synchronized ( declaredMethodBeansMap ) { declaredMethodBeansMap . put ( clazz , methods ) ; } } Method postConstruct = null ; for ( int i = 0 ; i < methods . length ; i ++ ) { Method method = methods [ i ] ; if ( method . isAnnotationPresent ( PostConstruct . class ) ) { // a method that does not take any arguments // the method must not be static // must not throw any checked expections // the return value must be void // the method may be public, protected, package private or private if ( ( postConstruct != null ) || ( method . getParameterTypes ( ) . length != 0 ) || ( Modifier . isStatic ( method . getModifiers ( ) ) ) || ( method . getExceptionTypes ( ) . length > 0 ) || ( ! method . getReturnType ( ) . getName ( ) . equals ( "void" ) ) ) { throw new IllegalArgumentException ( "Invalid PostConstruct annotation" ) ; } postConstruct = method ; } } try { invokeAnnotatedMethod ( postConstruct , instance ) ; } catch ( IllegalAccessException ex ) { throw new InjectionProviderException ( ex ) ; } catch ( InvocationTargetException ex ) { throw new InjectionProviderException ( ex ) ; } }
Call postConstruct method on the specified instance .
378
9
163,581
private WebSphereCDIDeployment createWebSphereCDIDeployment ( Application application , Set < ExtensionArchive > extensionArchives ) throws CDIException { WebSphereCDIDeployment webSphereCDIDeployment = new WebSphereCDIDeploymentImpl ( application , cdiRuntime ) ; DiscoveredBdas discoveredBdas = new DiscoveredBdas ( webSphereCDIDeployment ) ; if ( application . hasModules ( ) ) { Collection < CDIArchive > libraryArchives = application . getLibraryArchives ( ) ; Collection < CDIArchive > moduleArchives = application . getModuleArchives ( ) ; ClassLoader applicationClassLoader = application . getClassLoader ( ) ; webSphereCDIDeployment . setClassLoader ( applicationClassLoader ) ; processLibraries ( webSphereCDIDeployment , discoveredBdas , libraryArchives ) ; processModules ( webSphereCDIDeployment , discoveredBdas , moduleArchives ) ; //discoveredBdas has the full map, let's go through them all to make sure the wire is complete discoveredBdas . makeCrossBoundaryWiring ( ) ; //and finally the runtime extensions addRuntimeExtensions ( webSphereCDIDeployment , discoveredBdas ) ; } return webSphereCDIDeployment ; }
This method creates the Deployment structure with all it s BDAs .
293
14
163,582
private void addRuntimeExtensions ( WebSphereCDIDeployment webSphereCDIDeployment , DiscoveredBdas discoveredBdas ) throws CDIException { //add the normal runtime extension using the bundle classloader to load the bda classes Set < WebSphereBeanDeploymentArchive > extensions = createExtensionBDAs ( webSphereCDIDeployment ) ; //add the runtime extensions containers webSphereCDIDeployment . addBeanDeploymentArchives ( extensions ) ; //add the runtime extensions containers for ( WebSphereBeanDeploymentArchive bda : webSphereCDIDeployment . getApplicationBDAs ( ) ) { for ( WebSphereBeanDeploymentArchive extBDA : extensions ) { if ( bda != extBDA ) { bda . addBeanDeploymentArchive ( extBDA ) ; if ( extBDA . extensionCanSeeApplicationBDAs ( ) && ! discoveredBdas . isExcluded ( bda ) ) { extBDA . addBeanDeploymentArchive ( bda ) ; } } } } }
Create a BDA for each runtime extension and add it to the deployment .
236
15
163,583
private Set < WebSphereBeanDeploymentArchive > createExtensionBDAs ( WebSphereCDIDeployment applicationContext ) throws CDIException { Set < WebSphereBeanDeploymentArchive > extensionBdas = new HashSet < WebSphereBeanDeploymentArchive > ( ) ; Set < ExtensionArchive > extensions = getExtensionArchives ( ) ; if ( extensions != null ) { for ( ExtensionArchive extArchive : extensions ) { WebSphereBeanDeploymentArchive moduleCDIContext = BDAFactory . createBDA ( applicationContext , extArchive , cdiRuntime ) ; extensionBdas . add ( moduleCDIContext ) ; } } return extensionBdas ; }
Create BDAs for all runtime extensions that cannot see application bdas
157
14
163,584
private void processModules ( WebSphereCDIDeployment applicationContext , DiscoveredBdas discoveredBdas , Collection < CDIArchive > moduleArchives ) throws CDIException { List < WebSphereBeanDeploymentArchive > moduleBDAs = new ArrayList < WebSphereBeanDeploymentArchive > ( ) ; for ( CDIArchive archive : moduleArchives ) { if ( cdiRuntime . isClientProcess ( ) ) { // when on a client process, we only process client modules and ignore the others if ( ArchiveType . CLIENT_MODULE != archive . getType ( ) ) { continue ; } } else { // when on a server process, we do not process client modules, just the others if ( ArchiveType . CLIENT_MODULE == archive . getType ( ) ) { continue ; } } //if the app is not an EAR then there should be only one module and we can just use it's classloader if ( applicationContext . getClassLoader ( ) == null ) { applicationContext . setClassLoader ( archive . getClassLoader ( ) ) ; } String archiveID = archive . getJ2EEName ( ) . toString ( ) ; // we need to work our whether to create a bda or not if ( cdiRuntime . skipCreatingBda ( archive ) ) { continue ; } WebSphereBeanDeploymentArchive moduleBda = BDAFactory . createBDA ( applicationContext , archiveID , archive , cdiRuntime ) ; discoveredBdas . addDiscoveredBda ( archive . getType ( ) , moduleBda ) ; moduleBDAs . add ( moduleBda ) ; } // Having processed all the modules, we now process their libraries // We do it in this order in case one of the modules references another of the same type as a library for ( WebSphereBeanDeploymentArchive bda : moduleBDAs ) { processModuleLibraries ( bda , discoveredBdas ) ; } }
Create BDAs for either the EJB Web or Client modules and any libraries they reference on their classpath .
421
22
163,585
private synchronized Set < ExtensionArchive > getExtensionArchives ( ) throws CDIException { if ( runtimeExtensionSet == null ) { runtimeExtensionSet = new HashSet < ExtensionArchive > ( ) ; // get hold of the container for extension bundle //add create the bean deployment archive from the container Iterator < ServiceAndServiceReferencePair < WebSphereCDIExtension > > extensions = cdiRuntime . getExtensionServices ( ) ; while ( extensions . hasNext ( ) ) { ServiceAndServiceReferencePair < WebSphereCDIExtension > extension = extensions . next ( ) ; ServiceReference < WebSphereCDIExtension > sr = extension . getServiceReference ( ) ; Bundle bundle = null ; if ( sr == null ) { continue ; } bundle = sr . getBundle ( ) ; String extra_classes_blob = ( String ) sr . getProperty ( EXTENSION_API_CLASSES ) ; Set < String > extra_classes = new HashSet < String > ( ) ; //parse the list if ( extra_classes_blob != null ) { String [ ] classes = extra_classes_blob . split ( EXTENSION_API_CLASSES_SEPARATOR ) ; if ( ( classes != null ) && ( classes . length > 0 ) ) { Collections . addAll ( extra_classes , classes ) ; } } String extraAnnotationsBlob = ( String ) sr . getProperty ( EXTENSION_BEAN_DEFINING_ANNOTATIONS ) ; Set < String > extraAnnotations = new HashSet < String > ( ) ; if ( extraAnnotationsBlob != null ) { String [ ] annotations = extraAnnotationsBlob . split ( EXTENSION_API_CLASSES_SEPARATOR ) ; if ( ( annotations != null ) && ( annotations . length > 0 ) ) { Collections . addAll ( extraAnnotations , annotations ) ; } } String applicationBDAsVisibleStr = ( String ) sr . getProperty ( EXTENSION_APP_BDAS_VISIBLE ) ; boolean applicationBDAsVisible = Boolean . parseBoolean ( applicationBDAsVisibleStr ) ; String extClassesOnlyStr = ( String ) sr . getProperty ( EXTENSION_CLASSES_ONLY_MODE ) ; boolean extClassesOnly = Boolean . parseBoolean ( extClassesOnlyStr ) ; ExtensionArchive extensionArchive = cdiRuntime . getExtensionArchiveForBundle ( bundle , extra_classes , extraAnnotations , applicationBDAsVisible , extClassesOnly ) ; runtimeExtensionSet . add ( extensionArchive ) ; } if ( CDIUtils . isDevelopementMode ( ) ) { //add the probeExcension runtimeExtensionSet . add ( new ProbeExtensionArchive ( cdiRuntime , null ) ) ; } } return runtimeExtensionSet ; }
Returns the extension container info with ContainerInfo classloader and container name
612
13
163,586
public int compareEntitysWithRespectToProperties ( Entity entity1 , Entity entity2 ) { List < SortKeyType > sortKeys = sortControl . getSortKeys ( ) ; int temp = 0 ; for ( int i = 0 ; i < sortKeys . size ( ) && temp == 0 ; i ++ ) { SortKeyType sortKey = ( SortKeyType ) sortKeys . get ( i ) ; String propName = sortKey . getPropertyName ( ) ; boolean ascendingSorting = sortKey . isAscendingOrder ( ) ; Object propValue1 = getPropertyValue ( entity1 , propName , ascendingSorting ) ; Object propValue2 = getPropertyValue ( entity2 , propName , ascendingSorting ) ; temp = compareProperties ( propValue1 , propValue2 ) ; if ( ! ascendingSorting ) { temp = 0 - temp ; } } return temp ; }
Compares the two entity data objects .
191
8
163,587
public List < Entity > sortEntities ( List < Entity > entities ) { if ( entities != null && entities . size ( ) > 0 ) { Entity [ ] ents = ( Entity [ ] ) entities . toArray ( new Entity [ entities . size ( ) ] ) ; WIMSortCompare < Entity > wimSortComparator = new WIMSortCompare < Entity > ( sortControl ) ; Arrays . sort ( ents , wimSortComparator ) ; entities . clear ( ) ; for ( int i = 0 ; i < ents . length ; i ++ ) { entities . add ( ents [ i ] ) ; } } return entities ; }
Sorts the set of Member Objects
140
7
163,588
@ Override public void encodeBegin ( FacesContext context ) throws IOException { _initialDescendantComponentState = null ; if ( _isValidChilds && ! hasErrorMessages ( context ) ) { // Clear the data model so that when rendering code calls // getDataModel a fresh model is fetched from the backing // bean via the value-binding. _dataModelMap . clear ( ) ; // When the data model is cleared it is also necessary to // clear the saved row state, as there is an implicit 1:1 // relation between objects in the _rowStates and the // corresponding DataModel element. if ( ! isRowStatePreserved ( ) ) { _rowStates . clear ( ) ; } } super . encodeBegin ( context ) ; }
Perform necessary actions when rendering of this component starts before delegating to the inherited implementation which calls the associated renderer s encodeBegin method .
159
28
163,589
private void processColumnFacets ( FacesContext context , int processAction ) { for ( int i = 0 , childCount = getChildCount ( ) ; i < childCount ; i ++ ) { UIComponent child = getChildren ( ) . get ( i ) ; if ( child instanceof UIColumn ) { if ( ! _ComponentUtils . isRendered ( context , child ) ) { // Column is not visible continue ; } if ( child . getFacetCount ( ) > 0 ) { for ( UIComponent facet : child . getFacets ( ) . values ( ) ) { process ( context , facet , processAction ) ; } } } } }
Invoke the specified phase on all facets of all UIColumn children of this component . Note that no methods are called on the UIColumn child objects themselves .
144
35
163,590
private void processColumnChildren ( FacesContext context , int processAction ) { int first = getFirst ( ) ; int rows = getRows ( ) ; int last ; if ( rows == 0 ) { last = getRowCount ( ) ; } else { last = first + rows ; } for ( int rowIndex = first ; last == - 1 || rowIndex < last ; rowIndex ++ ) { setRowIndex ( rowIndex ) ; // scrolled past the last row if ( ! isRowAvailable ( ) ) { break ; } for ( int i = 0 , childCount = getChildCount ( ) ; i < childCount ; i ++ ) { UIComponent child = getChildren ( ) . get ( i ) ; if ( child instanceof UIColumn ) { if ( ! _ComponentUtils . isRendered ( context , child ) ) { // Column is not visible continue ; } for ( int j = 0 , columnChildCount = child . getChildCount ( ) ; j < columnChildCount ; j ++ ) { UIComponent columnChild = child . getChildren ( ) . get ( j ) ; process ( context , columnChild , processAction ) ; } } } } }
Invoke the specified phase on all non - facet children of all UIColumn children of this component . Note that no methods are called on the UIColumn child objects themselves .
253
38
163,591
public void setRows ( int rows ) { if ( rows < 0 ) { throw new IllegalArgumentException ( "rows: " + rows ) ; } getStateHelper ( ) . put ( PropertyKeys . rows , rows ) ; }
Set the maximum number of rows displayed in the table .
50
11
163,592
@ JSFProperty ( literalOnly = true , faceletsOnly = true ) public boolean isRowStatePreserved ( ) { Boolean b = ( Boolean ) getStateHelper ( ) . get ( PropertyKeys . rowStatePreserved ) ; return b == null ? false : b . booleanValue ( ) ; }
Indicates whether the state for a component in each row should not be discarded before the datatable is rendered again .
64
23
163,593
@ Override public List < String > getManagedObjects ( ) { ArrayList < String > managedObjects = new ArrayList < String > ( ) ; if ( this . application != null ) { managedObjects . addAll ( application . getManagedObjects ( ) ) ; } if ( this . factory != null ) { managedObjects . addAll ( factory . getManagedObjects ( ) ) ; } if ( this . lifecycle != null ) { managedObjects . addAll ( lifecycle . getManagedObjects ( ) ) ; } return managedObjects ; }
This method is only called from jsf 2 . 2
126
11
163,594
public long getLastModified ( ) { if ( matchedEntry != null ) { return matchedEntry . getLastModified ( ) ; } else if ( matchedZipFile != null ) { return matchedZipFile . getLastModified ( ) ; } else if ( matchedFile != null ) { return matchedFile . lastModified ( ) ; } else { return 0 ; } }
Get the last modified date of the appropriate matched item
79
10
163,595
public void expiryAlarm ( AORequestedTick requestedTick ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "expiryAlarm" , requestedTick ) ; boolean transitionOccured = false ; ArrayList < AORequestedTick > satisfiedTicks = null ; try { this . lock ( ) ; try { // it is possible that this event occurs after this object is closed. // it is safe to ignore it since we must have already transitioned the requestedTick to its final state if ( closed ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "expiryAlarm" ) ; return ; } transitionOccured = cancelRequestInternal ( requestedTick , true ) ; // If we expired the request and have more then process those // requests now if ( transitionOccured && ! listOfRequests . isEmpty ( ) ) satisfiedTicks = processQueuedMsgs ( null ) ; } finally { this . unlock ( ) ; } } catch ( SINotPossibleInCurrentConfigurationException e ) { // No FFDC code needed notifyException ( e ) ; } if ( transitionOccured ) { // parent needs to be informed parent . expiredRequest ( requestedTick . tick ) ; } if ( satisfiedTicks != null ) { // inform parent about satisfied ticks - outside lock int length = satisfiedTicks . size ( ) ; for ( int i = 0 ; i < length ; i ++ ) { AORequestedTick aotick = ( AORequestedTick ) satisfiedTicks . get ( i ) ; long tick = aotick . tick ; SIMPMessage m = aotick . getMessage ( ) ; parent . satisfiedRequest ( tick , m ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "expiryAlarm" ) ; }
Callback from the AORequestedTick when the expiry alarm occurs .
443
16
163,596
public void alarm ( Object thandle ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "alarm" , thandle ) ; boolean doClose = false ; // We're probably about to close this consumer, which needs us to remove it from the AOStream's // consciousness first (so that it doesn't allow it to be used while we're closing it - as that's // done outside of the lock). To do this we need to take the AOStream's (parent's) lock first and // remove it from the parent's list prior to releasing the lock. synchronized ( parent ) { this . lock ( ) ; try { if ( idleHandler != null ) { // so we are still idle if ( ! listOfRequests . isEmpty ( ) ) { // we have an outstanding request. idleHandler should be null, and therefore != thandle // Since this should never occur, log this error SIErrorException e = new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.JSRemoteConsumerPoint" , "1:1121:1.43.2.26" } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.JSRemoteConsumerPoint.alarm" , "1:1126:1.43.2.26" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0001" , new Object [ ] { "com.ibm.ws.sib.processor.impl.JSRemoteConsumerPoint" , "1:1132:1.43.2.26" } ) ; } else { // Remove this consumer so that it is no longer handed out for new requests (they'll // have to create a new consumer to use) parent . removeConsumerKey ( selectionCriteriasAsString , this ) ; doClose = true ; } } } finally { this . unlock ( ) ; } } // synchronised(parent) if ( doClose ) { close ( ) ; //Never call close() from within synchronized (this)!! } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "alarm" ) ; }
The idle timeout has expired
555
5
163,597
public void cleanup ( ) { cleanupLock . lock ( ) ; try { // Clean up the write interface. if ( null != writeInterface ) { this . writeInterface . close ( ) ; this . writeInterface = null ; } // Clean up the read interface. if ( null != readInterface ) { this . readInterface . close ( ) ; this . readInterface = null ; } // Clean up the SSL engine. if ( null != getSSLEngine ( ) ) { //If the channel has already processed the stop signal, it is too late to try and send the write handshake if ( this . sslChannel . getstop0Called ( ) == true ) { this . connected = false ; } SSLUtils . shutDownSSLEngine ( this , isInbound , this . connected ) ; this . sslEngine = null ; } // mark that we have disconnected this . connected = false ; } finally { cleanupLock . unlock ( ) ; } }
This method is called from both close and destroy to clean up local resources . Avoid object synchronization but ensure only one thread does cleanup at a time .
202
29
163,598
protected void readyInboundPostHandshake ( WsByteBuffer netBuffer , WsByteBuffer decryptedNetBuffer , WsByteBuffer encryptedAppBuffer , HandshakeStatus hsStatus ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "readyInboundPostHandshake, vc=" + getVCHash ( ) ) ; } // Release the no longer needed buffers. encryptedAppBuffer . release ( ) ; if ( hsStatus == HandshakeStatus . FINISHED ) { AlpnSupportUtils . getAlpnResult ( getSSLEngine ( ) , this ) ; // PK16095 - take certain actions when the handshake completes getChannel ( ) . onHandshakeFinish ( getSSLEngine ( ) ) ; // Handshake complete. Now get the request. Use our read interface so unwrap already done. // Check if data exists in the network buffer still. This would be app data beyond handshake. if ( netBuffer . remaining ( ) == 0 || netBuffer . position ( ) == 0 ) { // No app data. Release the netBuffer as it will no longer be used. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Releasing netBuffer: " + netBuffer . hashCode ( ) ) ; } netBuffer . release ( ) ; getDeviceReadInterface ( ) . setBuffers ( null ) ; } else { // Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "App data exists in netBuffer after handshake: " + netBuffer . remaining ( ) ) ; } } readInterface . setBuffer ( decryptedNetBuffer ) ; // No need to save number of bytes read. MyReadCompletedCallback readCallback = new MyReadCompletedCallback ( decryptedNetBuffer ) ; if ( null != readInterface . read ( 1 , readCallback , false , TCPRequestContext . USE_CHANNEL_TIMEOUT ) ) { // Read was handled synchronously. determineNextChannel ( ) ; } } else { // Unknown result from handshake. All other results should have thrown exceptions. // Clean up buffers used during read. netBuffer . release ( ) ; getDeviceReadInterface ( ) . setBuffers ( null ) ; decryptedNetBuffer . release ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unhandled result from SSL engine: " + hsStatus ) ; } SSLException ssle = new SSLException ( "Unhandled result from SSL engine: " + hsStatus ) ; FFDCFilter . processException ( ssle , getClass ( ) . getName ( ) , "401" , this ) ; close ( getVirtualConnection ( ) , ssle ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "readyInboundPostHandshake" ) ; } }
This method is called after the SSL handshake has taken place .
685
12
163,599
private void readyOutbound ( VirtualConnection inVC , boolean async ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "readyOutbound, vc=" + getVCHash ( ) ) ; } final SSLChannelData config = this . sslChannel . getConfig ( ) ; // Encrypted buffer from the network. WsByteBuffer netBuffer = SSLUtils . allocateByteBuffer ( getPacketBufferSize ( ) , config . getEncryptBuffersDirect ( ) ) ; // Unencrypted buffer from the ssl engine output to be handed up to the application. WsByteBuffer decryptedNetBuffer = SSLUtils . allocateByteBuffer ( getAppBufferSize ( ) , config . getDecryptBuffersDirect ( ) ) ; // Encrypted buffer from the ssl engine to be sent sent out on the network. WsByteBuffer encryptedAppBuffer = SSLUtils . allocateByteBuffer ( getPacketBufferSize ( ) , true ) ; // Result from the SSL engine. SSLEngineResult sslResult = null ; // Build the required callback. MyHandshakeCompletedCallback callback = null ; // Flag if an error took place IOException exception = null ; // Only create the callback if this is for an async request. if ( async ) { callback = new MyHandshakeCompletedCallback ( this , netBuffer , decryptedNetBuffer , encryptedAppBuffer , FlowType . OUTBOUND ) ; } try { // Start the aynchronous SSL handshake. sslResult = SSLUtils . handleHandshake ( this , netBuffer , decryptedNetBuffer , encryptedAppBuffer , sslResult , callback , false ) ; // Check to see if the work was able to be done synchronously. if ( sslResult != null ) { // Handshake was done synchronously. readyOutboundPostHandshake ( netBuffer , decryptedNetBuffer , encryptedAppBuffer , sslResult . getHandshakeStatus ( ) , async ) ; } } catch ( IOException e ) { exception = e ; } catch ( ReadOnlyBufferException e ) { exception = new IOException ( "Caught exception: " + e ) ; } if ( exception != null ) { FFDCFilter . processException ( exception , getClass ( ) . getName ( ) , "540" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception during handshake after connect, " + exception ) ; } // Release the buffers. if ( netBuffer != null ) { netBuffer . release ( ) ; netBuffer = null ; getDeviceReadInterface ( ) . setBuffers ( null ) ; } if ( decryptedNetBuffer != null ) { decryptedNetBuffer . release ( ) ; decryptedNetBuffer = null ; } if ( encryptedAppBuffer != null ) { encryptedAppBuffer . release ( ) ; encryptedAppBuffer = null ; } if ( async ) { close ( inVC , exception ) ; } else { this . syncConnectFailure = true ; close ( inVC , exception ) ; throw exception ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "readyOutbound" ) ; } return ; }
Handle work required by the ready method for outbound connections . When called the outbound socket has been established . Establish the SSL connection before reporting to the next channel . Note this method is called in both sync and async flows .
712
46