idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
162,300
public final void insertNullElementsAt ( int index , int count ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "insertNullElementsAt" , new Object [ ] { new Integer ( index ) , new Integer ( count ) } ) ; for ( int i = index ; i < index + count ; i ++ ) add ( i , null ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "insertNullElementsAt" ) ; }
Inserts count null values at index moving up all the components at index and greater .
162,301
protected void validatePattern ( ) { if ( pattern . length ( ) == 0 ) { throw new IllegalArgumentException ( Tr . formatMessage ( tc , "OPENTRACING_FILTER_PATTERN_BLANK" ) ) ; } if ( ! regex ) { try { URI . create ( pattern ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( Tr . formatMessage ( tc , "OPENTRACING_FILTER_PATTERN_INVALID" , pattern ) , e ) ; } } }
Throw exceptions if the pattern is invalid .
162,302
protected final String prepareUri ( final URI uri ) { if ( compareRelative ) { final String path = uri . getRawPath ( ) ; final String query = uri . getRawQuery ( ) ; final String fragment = uri . getRawFragment ( ) ; if ( query != null && fragment != null ) { return path + "?" + query + "#" + fragment ; } else if ( query != null ) { return path + "?" + query ; } else if ( fragment != null ) { return path + "#" + fragment ; } else { return path ; } } else { return uri . toString ( ) ; } }
Prepare the URI for matching .
162,303
public String readText ( String prompt ) { if ( ! isInputStreamAvailable ( ) ) { return null ; } try { return console . readLine ( prompt ) ; } catch ( IOError e ) { stderr . println ( "Exception while reading stdin: " + e . getMessage ( ) ) ; e . printStackTrace ( stderr ) ; } return null ; }
Reads text from the input String prompting with the given String .
162,304
public synchronized int add ( E object ) { if ( object == null ) throw new NullPointerException ( "FastList add called with null" ) ; if ( ( count + 1 ) >= maxCount ) resize ( capacity * 2 ) ; int initialAddIndex = addIndex ; while ( listElements [ addIndex ] != null ) { addIndex ++ ; if ( addIndex == capacity ) addIndex = 0 ; if ( addIndex == initialAddIndex ) { throw new RuntimeException ( "FastList out of space" ) ; } } count ++ ; listElements [ addIndex ] = object ; return addIndex ; }
Adds specified object to the list and increments size
162,305
public synchronized List < E > getAll ( ) { ArrayList < E > list = new ArrayList < E > ( ) ; for ( E element : listElements ) { if ( element != null ) { list . add ( element ) ; } } return list ; }
Provides a shallow copy of the list
162,306
public Object [ ] addAll ( CacheMap c ) { LinkedList < Object > discards = new LinkedList < Object > ( ) ; Object discard ; for ( int bucketIndex = c . next [ c . BEFORE_LRU ] ; bucketIndex != c . AFTER_MRU ; bucketIndex = c . next [ bucketIndex ] ) for ( int i = 0 ; i < c . bucketSizes [ bucketIndex ] ; i ++ ) if ( ( discard = add ( c . keys [ bucketIndex ] [ i ] , c . values [ bucketIndex ] [ i ] ) ) != null ) discards . add ( discard ) ; return discards . toArray ( ) ; }
Inserts into this CacheMap all entries from the specified CacheMap returning a list of any values that do not fit .
162,307
private Object discardFromBucket ( int bucketIndex , int entryIndex ) { numDiscards ++ ; bucketSizes [ bucketIndex ] -- ; numEntries -- ; return values [ bucketIndex ] [ entryIndex ] ; }
Discard an entry from the specified bucket . The actual entry is not nulled out because it will later be overwritten .
162,308
int addRef ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addRef" ) ; int ret = NOP ; if ( _refCount ++ == 0 ) ret = SUBSCRIBE ; checkRefCount ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addRef" , String . valueOf ( ret ) + ":" + String . valueOf ( _refCount ) ) ; return ret ; }
Adds a reference to the subscription .
162,309
int removeRef ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeRef" ) ; int ret = NOP ; if ( -- _refCount == 0 ) ret = UNSUBSCRIBE ; checkRefCount ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeRef" , String . valueOf ( ret ) + ":" + String . valueOf ( _refCount ) ) ; return ret ; }
Removes a reference to the subscription .
162,310
final String getTopic ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopic" ) ; SibTr . exit ( tc , "getTopic" , _topic ) ; } return _topic ; }
Returns the value of the topic .
162,311
final SIBUuid12 getTopicSpaceUuid ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopicSpaceUuid" ) ; SibTr . exit ( tc , "getTopicSpaceUuid" , _topicSpaceUuid ) ; } return _topicSpaceUuid ; }
Returns the value of the topic space uuid .
162,312
final String getTopicSpaceName ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getTopicSpaceName" ) ; SibTr . exit ( tc , "getTopicSpaceName" , _topicSpaceName ) ; } return _topicSpaceName ; }
Returns the value of the topic space name .
162,313
final String getMESubUserId ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getMESubUserId" ) ; SibTr . exit ( tc , "getMESubUserId" , _meSubUserId ) ; } return _meSubUserId ; }
Returns the value of the userid associated with the subscription .
162,314
final boolean isForeignSecuredProxy ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isForeignSecuredProxy" ) ; SibTr . exit ( tc , "isForeignSecuredProxy" , new Boolean ( _foreignSecuredProxy ) ) ; } return _foreignSecuredProxy ; }
Returns true if this proxy sub was from a foreign bus in a secured env .
162,315
void mark ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "mark" ) ; SibTr . exit ( tc , "mark" ) ; } _marked = true ; }
Marks this object .
162,316
void unmark ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "unmark" ) ; SibTr . exit ( tc , "unmark" ) ; } _marked = false ; }
Unmarks this object .
162,317
boolean isMarked ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isMarked" ) ; SibTr . exit ( tc , "isMarked" , new Boolean ( _marked ) ) ; } return _marked ; }
Is Marked indicates if this object is still marked . If it is then it can be removed .
162,318
protected void registerForPostCommit ( MultiMEProxyHandler proxyHandler , DestinationHandler destination , PubSubOutputHandler handler , Neighbour neighbour ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerForPostCommit" , new Object [ ] { proxyHandler , destination , handler , neighbour } ) ; _proxyHandler = proxyHandler ; _destination = destination ; _handler = handler ; _neighbour = neighbour ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerForPostCommit" ) ; }
Sets the information in the subscription so that when a commit is called it can resolve the correct objects to add items to the MatchSpace .
162,319
protected void registerForPostCommit ( Neighbour neighbour , Neighbours neighbours ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "registerForPostCommit" , new Object [ ] { neighbour , neighbours } ) ; _proxyHandler = null ; _destination = null ; _handler = null ; _neighbour = neighbour ; _neighbours = neighbours ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "registerForPostCommit" ) ; }
Used only for rollback - if the transaction is rolled back and there is a neighbour set then rmeove the proxy reference .
162,320
public void eventPostRollbackAdd ( Transaction transaction ) throws SevereMessageStoreException { super . eventPostRollbackAdd ( transaction ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "eventPostRollbackAdd" , transaction ) ; if ( _handler != null ) { _handler . removeTopic ( _topic ) ; if ( _handler . getTopics ( ) == null || _handler . getTopics ( ) . length == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Deleting PubSubOutputHandler " + _handler ) ; _destination . deletePubSubOutputHandler ( _neighbour . getUUID ( ) ) ; } } else if ( _neighbours != null ) _neighbours . removeTopicSpaceReference ( _neighbour . getUUID ( ) , this , _topicSpaceUuid , _topic ) ; _neighbour . removeSubscription ( _topicSpaceUuid , _topic ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventPostRollbackAdd" ) ; }
When the add rollback is made need to remove the topic . Or the topicSpace reference needs to be removed .
162,321
public void eventPostCommitUpdate ( Transaction transaction ) throws SevereMessageStoreException { super . eventPostCommitAdd ( transaction ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "eventPostCommitUpdate" , transaction ) ; if ( _proxyHandler != null ) { _destination . getSubscriptionIndex ( ) . remove ( _controllableProxySubscription ) ; _proxyHandler . getMessageProcessor ( ) . getMessageProcessorMatching ( ) . removePubSubOutputHandlerMatchTarget ( _controllableProxySubscription ) ; } try { if ( _proxyHandler != null ) { _controllableProxySubscription = _proxyHandler . getMessageProcessor ( ) . getMessageProcessorMatching ( ) . addPubSubOutputHandlerMatchTarget ( _handler , _topicSpaceUuid , _topic , _foreignSecuredProxy , _meSubUserId ) ; } } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.proxyhandler.MESubscription.eventPostCommitUpdate" , "1:738:1.55" , this ) ; SibTr . exception ( tc , e ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription" , "1:745:1.55" , e } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventPostCommitUpdate" , "SIErrorException" ) ; throw new SIErrorException ( nls . getFormattedMessage ( "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.proxyhandler.MESubscription" , "1:755:1.55" , e } , null ) , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "eventPostCommitUpdate" ) ; }
Updates the ControllableProxySubscription .
162,322
public void setMatchspaceSub ( ControllableProxySubscription sub ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "setMatchspaceSub" , sub ) ; _controllableProxySubscription = sub ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "setMatchspaceSub" ) ; }
This sets the field in the MESubscription for the object that was stored in the Matchspace
162,323
public ControllableProxySubscription getMatchspaceSub ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getMatchspaceSub" ) ; SibTr . exit ( tc , "getMatchspaceSub" , _controllableProxySubscription ) ; } return _controllableProxySubscription ; }
Gets the object that was stored in the Matchspace
162,324
public final AbstractItem findById ( long itemId ) throws SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "findById" , Long . valueOf ( itemId ) ) ; AbstractItem item = null ; ReferenceCollection ic = ( ( ReferenceCollection ) _getMembership ( ) ) ; if ( null == ic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findById" ) ; throw new NotInMessageStore ( ) ; } item = ic . findById ( itemId ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findById" , item ) ; return item ; }
Reply the item in the receiver with a matching ID . The item returned stream is neither removed from the message store nor locked for exclusive use of the caller .
162,325
public final ItemReference findOldestReference ( ) throws MessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "findOldestReference" ) ; ReferenceCollection ic = ( ( ReferenceCollection ) _getMembership ( ) ) ; if ( null == ic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findOldestReference" ) ; throw new NotInMessageStore ( ) ; } ItemReference item = null ; if ( ic != null ) { item = ( ItemReference ) ic . findOldestItem ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findOldestReference" , item ) ; return item ; }
Find the reference that has been known to the stream for longest . The reference returned may be in any of the states defined in the state model . The caller should not assume that the reference can be used for any particular purpose .
162,326
private void publishEvent ( WSJobExecution jobEx , String topicToPublish , String correlationId ) { if ( eventsPublisher != null ) { eventsPublisher . publishJobExecutionEvent ( jobEx , topicToPublish , correlationId ) ; } }
Helper method to publish event
162,327
private void publishEvent ( WSJobInstance jobInst , String topicToPublish , String correlationId ) { if ( eventsPublisher != null ) { eventsPublisher . publishJobInstanceEvent ( jobInst , topicToPublish , correlationId ) ; } }
Helper method to publish event with correlationId
162,328
private long restartInternal ( long oldExecutionId , Properties restartParameters ) throws JobExecutionAlreadyCompleteException , NoSuchJobExecutionException , JobExecutionNotMostRecentException , JobRestartException , JobSecurityException { if ( authService != null ) { authService . authorizedJobRestartByExecution ( oldExecutionId ) ; } if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "JobOperator restart, with old executionId = " + oldExecutionId + "\n" + traceJobParameters ( restartParameters ) ) ; } BatchStatusValidator . validateStatusAtExecutionRestart ( oldExecutionId , restartParameters ) ; long instanceId = getPersistenceManagerService ( ) . getJobInstanceIdFromExecutionId ( oldExecutionId ) ; getPersistenceManagerService ( ) . updateJobInstanceOnRestart ( instanceId , new Date ( ) ) ; WSJobExecution jobExecution = getPersistenceManagerService ( ) . createJobExecution ( instanceId , restartParameters , new Date ( ) ) ; long newExecutionId = getBatchKernelService ( ) . restartJob ( jobExecution . getExecutionId ( ) , restartParameters ) . getKey ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "Restarted job with new executionId: " + newExecutionId + ", and old executionID: " + oldExecutionId ) ; } return newExecutionId ; }
Restart the given execution using the given jobparams .
162,329
private void getMessageDigestMD5 ( ) throws AttributeNotFoundException { if ( MBeans . messageDigestMD5 == null ) { try { MBeans . messageDigestMD5 = MessageDigestUtility . createMessageDigest ( "MD5" ) ; } catch ( NoSuchAlgorithmException e ) { Tr . error ( tc , "DYNA1044E" , new Object [ ] { e . getMessage ( ) } ) ; throw new AttributeNotFoundException ( "Message digest for MD5 is not available. " + e . getMessage ( ) ) ; } } }
create messageDigest for MD5 algoritm if it is not created .
162,330
public Map < String , ExtendedAttributeDefinition > getAttributeMap ( ) { Map < String , ExtendedAttributeDefinition > map = null ; AttributeDefinition [ ] attrDefs = getAttributeDefinitions ( ObjectClassDefinition . ALL ) ; if ( attrDefs != null ) { map = new HashMap < String , ExtendedAttributeDefinition > ( ) ; for ( AttributeDefinition attrDef : attrDefs ) { map . put ( attrDef . getID ( ) , new ExtendedAttributeDefinitionImpl ( attrDef ) ) ; } } else { map = Collections . emptyMap ( ) ; } return map ; }
ONLY USED BY SCHEMA WRITER
162,331
private static String getAliasName ( String alias , String bundleLocation ) { String newAlias = alias ; if ( alias != null && ! alias . isEmpty ( ) ) { try { if ( bundleLocation != null && ! bundleLocation . isEmpty ( ) ) { if ( bundleLocation . startsWith ( XMLConfigConstants . BUNDLE_LOC_KERNEL_TAG ) ) { } else if ( bundleLocation . startsWith ( XMLConfigConstants . BUNDLE_LOC_FEATURE_TAG ) ) { int index = bundleLocation . indexOf ( XMLConfigConstants . BUNDLE_LOC_PROD_EXT_TAG ) ; if ( index != - 1 ) { index += XMLConfigConstants . BUNDLE_LOC_PROD_EXT_TAG . length ( ) ; int endIndex = bundleLocation . indexOf ( ":" , index ) ; String productName = bundleLocation . substring ( index , endIndex ) ; newAlias = productName + "_" + alias ; } } else if ( bundleLocation . startsWith ( XMLConfigConstants . BUNDLE_LOC_CONNECTOR_TAG ) ) { } else { newAlias = null ; } } } catch ( Throwable t ) { } } return newAlias ; }
Prefixes the alias with the product extension name if there is a product extension associated to this OCD .
162,332
private static byte [ ] getBytes ( InputStream stream , int knownSize ) throws IOException { try { if ( knownSize == - 1 ) { ByteArrayOutputStream byteOut = new ByteArrayOutputStream ( ) ; try { byte [ ] bytes = new byte [ 1024 ] ; int read ; while ( 0 <= ( read = stream . read ( bytes ) ) ) byteOut . write ( bytes , 0 , read ) ; return byteOut . toByteArray ( ) ; } finally { Util . tryToClose ( byteOut ) ; } } else { byte [ ] bytes = new byte [ knownSize ] ; int read ; int offset = 0 ; while ( knownSize > 0 && ( read = stream . read ( bytes , offset , knownSize ) ) > 0 ) { offset += read ; knownSize -= read ; } return bytes ; } } finally { Util . tryToClose ( stream ) ; } }
Util method to totally read an input stream into a byte array . Used for class definition .
162,333
static URL getSharedClassCacheURL ( URL resourceURL , String resourceName ) { URL sharedClassCacheURL ; if ( resourceURL == null ) { sharedClassCacheURL = null ; } else { String protocol = resourceURL . getProtocol ( ) ; if ( "jar" . equals ( protocol ) ) { sharedClassCacheURL = resourceURL ; } else if ( "wsjar" . equals ( protocol ) ) { try { sharedClassCacheURL = new URL ( resourceURL . toExternalForm ( ) . substring ( 2 ) ) ; } catch ( MalformedURLException e ) { sharedClassCacheURL = null ; } } else if ( ! "file" . equals ( protocol ) ) { sharedClassCacheURL = null ; } else { String externalForm = resourceURL . toExternalForm ( ) ; if ( externalForm . endsWith ( resourceName ) ) { try { sharedClassCacheURL = new URL ( externalForm . substring ( 0 , externalForm . length ( ) - resourceName . length ( ) ) ) ; } catch ( MalformedURLException e ) { sharedClassCacheURL = null ; } } else { sharedClassCacheURL = null ; } } } return sharedClassCacheURL ; }
Computes the shared class cache URL from the resource URL .
162,334
public Package definePackage ( String name , Manifest manifest , URL sealBase ) throws IllegalArgumentException { Attributes mA = manifest . getMainAttributes ( ) ; String specTitle = mA . getValue ( Name . SPECIFICATION_TITLE ) ; String specVersion = mA . getValue ( Name . SPECIFICATION_VERSION ) ; String specVendor = mA . getValue ( Name . SPECIFICATION_VENDOR ) ; String implTitle = mA . getValue ( Name . IMPLEMENTATION_TITLE ) ; String implVersion = mA . getValue ( Name . IMPLEMENTATION_VERSION ) ; String implVendor = mA . getValue ( Name . IMPLEMENTATION_VENDOR ) ; String sealedString = mA . getValue ( Name . SEALED ) ; Boolean sealed = ( sealedString == null ? Boolean . FALSE : sealedString . equalsIgnoreCase ( "true" ) ) ; String unixName = name . replaceAll ( "\\." , "/" ) + "/" ; mA = manifest . getAttributes ( unixName ) ; if ( mA != null ) { String s = mA . getValue ( Name . SPECIFICATION_TITLE ) ; if ( s != null ) specTitle = s ; s = mA . getValue ( Name . SPECIFICATION_VERSION ) ; if ( s != null ) specVersion = s ; s = mA . getValue ( Name . SPECIFICATION_VENDOR ) ; if ( s != null ) specVendor = s ; s = mA . getValue ( Name . IMPLEMENTATION_TITLE ) ; if ( s != null ) implTitle = s ; s = mA . getValue ( Name . IMPLEMENTATION_VERSION ) ; if ( s != null ) implVersion = s ; s = mA . getValue ( Name . IMPLEMENTATION_VENDOR ) ; if ( s != null ) implVendor = s ; s = mA . getValue ( Name . SEALED ) ; if ( s != null ) sealed = s . equalsIgnoreCase ( "true" ) ; } if ( ! sealed ) sealBase = null ; return definePackage ( name , specTitle , specVersion , specVendor , implTitle , implVersion , implVendor , sealBase ) ; }
to set vars passed up to ClassLoader . definePackage .
162,335
protected void addToClassPath ( Iterable < ArtifactContainer > artifacts ) { for ( ArtifactContainer art : artifacts ) { smartClassPath . addArtifactContainer ( art ) ; } }
Add all the artifact containers to the class path
162,336
@ FFDCIgnore ( NullPointerException . class ) protected void addLibraryFile ( File f ) { if ( ! ! ! f . exists ( ) ) { if ( tc . isWarningEnabled ( ) ) { Tr . warning ( tc , "cls.library.archive" , f , new FileNotFoundException ( f . getName ( ) ) ) ; } return ; } if ( ! f . isDirectory ( ) && ! isArchive ( f ) ) return ; BundleContext bc = FrameworkUtil . getBundle ( ContainerClassLoader . class ) . getBundleContext ( ) ; ServiceReference < ArtifactContainerFactory > acfsr = bc . getServiceReference ( ArtifactContainerFactory . class ) ; if ( acfsr != null ) { ArtifactContainerFactory acf = bc . getService ( acfsr ) ; if ( acf != null ) { try { ArtifactContainer ac = acf . getContainer ( bc . getBundle ( ) . getDataFile ( "" ) , f ) ; smartClassPath . addArtifactContainer ( ac ) ; } catch ( NullPointerException e ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception while adding files to classpath" , e ) ; } if ( tc . isInfoEnabled ( ) ) { Tr . info ( tc , "cls.library.file.forbidden" , f ) ; } } } } }
Method to allow adding shared libraries to this classloader currently using File .
162,337
@ FFDCIgnore ( PrivilegedActionException . class ) private boolean isArchive ( File f ) { final File target = f ; try { AccessController . doPrivileged ( new PrivilegedExceptionAction < Void > ( ) { public Void run ( ) throws IOException { new ZipFile ( target ) . close ( ) ; return null ; } } ) ; } catch ( PrivilegedActionException e ) { Exception innerException = e . getException ( ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The following file can not be added to the classpath " + f + " due to error " , innerException ) ; } return false ; } return true ; }
Check that a file is an archive
162,338
public static ComponentMetaData getComponentMetaData ( JavaColonNamespace namespace , String name ) throws NamingException { ComponentMetaData cmd = ComponentMetaDataAccessorImpl . getComponentMetaDataAccessor ( ) . getComponentMetaData ( ) ; if ( cmd == null ) { String fullName = name . isEmpty ( ) ? namespace . toString ( ) : namespace + "/" + name ; String msg = Tr . formatMessage ( tc , "JNDI_NON_JEE_THREAD_CWWKN0100E" , fullName ) ; NamingException nex = new NamingException ( msg ) ; throw nex ; } return cmd ; }
Helper method to get the component metadata from the thread context .
162,339
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE ) protected Map < String , Object > setConfiguration ( ServiceReference < SecurityConfiguration > ref ) { String id = ( String ) ref . getProperty ( KEY_ID ) ; if ( id != null ) { configs . putReference ( id , ref ) ; } else { Tr . error ( tc , "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID" , "securityConfiguration" ) ; } return getServiceProperties ( ) ; }
Method will be called for each SecurityConfiguration that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
162,340
protected Map < String , Object > unsetConfiguration ( ServiceReference < SecurityConfiguration > ref ) { configs . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; return getServiceProperties ( ) ; }
Method will be called for each SecurityConfiguration that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
162,341
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE ) protected Map < String , Object > setAuthentication ( ServiceReference < AuthenticationService > ref ) { if ( hasPropertiesFromFile ( ref ) ) { String id = ( String ) ref . getProperty ( KEY_ID ) ; if ( id != null ) { authentication . putReference ( id , ref ) ; } else { Tr . error ( tc , "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID" , KEY_AUTHENTICATION ) ; } } else { authentication . putReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; } authnService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthenticationService that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
162,342
protected Map < String , Object > unsetAuthentication ( ServiceReference < AuthenticationService > ref ) { authentication . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; authentication . removeReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; authnService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthenticationService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
162,343
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE ) protected Map < String , Object > setAuthorization ( ServiceReference < AuthorizationService > ref ) { if ( hasPropertiesFromFile ( ref ) ) { String id = ( String ) ref . getProperty ( KEY_ID ) ; if ( id != null ) { authorization . putReference ( id , ref ) ; } else { Tr . error ( tc , "SECURITY_SERVICE_REQUIRED_SERVICE_WITHOUT_ID" , KEY_AUTHORIZATION ) ; } } else { authorization . putReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; } authzService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthorizationService that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
162,344
protected Map < String , Object > unsetAuthorization ( ServiceReference < AuthorizationService > ref ) { authorization . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; authorization . removeReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; authzService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each AuthorizationService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
162,345
@ Reference ( policy = ReferencePolicy . DYNAMIC , cardinality = ReferenceCardinality . MULTIPLE , target = "(config.displayId=*)" ) protected Map < String , Object > setUserRegistry ( ServiceReference < UserRegistryService > ref ) { adjustUserRegistryServiceRef ( ref ) ; userRegistryService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each UserRegistryService that is registered in the OSGi service registry . We maintain an internal map of these for easy access .
162,346
protected Map < String , Object > unsetUserRegistry ( ServiceReference < UserRegistryService > ref ) { userRegistry . removeReference ( ( String ) ref . getProperty ( KEY_ID ) , ref ) ; userRegistry . removeReference ( String . valueOf ( ref . getProperty ( KEY_SERVICE_ID ) ) , ref ) ; userRegistryService . set ( null ) ; return getServiceProperties ( ) ; }
Method will be called for each UserRegistryService that is unregistered in the OSGi service registry . We must remove this instance from our internal map .
162,347
private SecurityConfiguration getEffectiveSecurityConfiguration ( ) { SecurityConfiguration effectiveConfig = configs . getService ( cfgSystemDomain ) ; if ( effectiveConfig == null ) { Tr . error ( tc , "SECURITY_SERVICE_ERROR_BAD_DOMAIN" , cfgSystemDomain , CFG_KEY_SYSTEM_DOMAIN ) ; throw new IllegalArgumentException ( Tr . formatMessage ( tc , "SECURITY_SERVICE_ERROR_BAD_DOMAIN" , cfgSystemDomain , CFG_KEY_SYSTEM_DOMAIN ) ) ; } return effectiveConfig ; }
Eventually this will be execution context aware and pick the right domain . Till then we re only accessing the system domain configuration .
162,348
private < V > V autoDetectService ( String serviceName , ConcurrentServiceReferenceMap < String , V > map ) { Iterator < V > services = map . getServices ( ) ; if ( services . hasNext ( ) == false ) { Tr . error ( tc , "SECURITY_SERVICE_NO_SERVICE_AVAILABLE" , serviceName ) ; throw new IllegalStateException ( Tr . formatMessage ( tc , "SECURITY_SERVICE_NO_SERVICE_AVAILABLE" , serviceName ) ) ; } V service = services . next ( ) ; if ( services . hasNext ( ) ) { Tr . error ( tc , "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE" , serviceName ) ; throw new IllegalStateException ( Tr . formatMessage ( tc , "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE" , serviceName ) ) ; } return service ; }
When the configuration element is not defined use some auto - detect logic to try and return the single Service of a specified field . If there is no service or multiple services that is considered an error case which auto - detect can not resolve .
162,349
private AuthenticationService getAuthenticationService ( String id ) { AuthenticationService service = authentication . getService ( id ) ; if ( service == null ) { throwIllegalArgumentExceptionInvalidAttributeValue ( SecurityConfiguration . CFG_KEY_AUTHENTICATION_REF , id ) ; } return service ; }
Retrieve the AuthenticationService for the specified id .
162,350
private AuthorizationService getAuthorizationService ( String id ) { AuthorizationService service = authorization . getService ( id ) ; if ( service == null ) { throwIllegalArgumentExceptionInvalidAttributeValue ( SecurityConfiguration . CFG_KEY_AUTHORIZATION_REF , id ) ; } return service ; }
Retrieve the AuthorizationService for the specified id .
162,351
private UserRegistryService getUserRegistryService ( String id ) { UserRegistryService service = userRegistry . getService ( id ) ; if ( service == null ) { throwIllegalArgumentExceptionInvalidAttributeValue ( SecurityConfiguration . CFG_KEY_USERREGISTRY_REF , id ) ; } return service ; }
Retrieve the UserRegistryService for the specified id .
162,352
protected final String getFacetName ( FaceletContext ctx , UIComponent parent ) { return ( String ) parent . getAttributes ( ) . get ( "facelets.FACET_NAME" ) ; }
Return the Facet name we are scoped in otherwise null
162,353
public void completeTxTimeout ( ) throws TransactionRolledbackException { final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "completeTxTimeout" ) ; if ( tx != null && tx . isTimedOut ( ) ) { if ( traceOn && tc . isEventEnabled ( ) ) Tr . event ( tc , "Transaction has timed out. The transaction will be rolled back now" ) ; Tr . info ( tc , "WTRN0041_TXN_ROLLED_BACK" , tx . getTranName ( ) ) ; ( ( EmbeddableTransactionImpl ) tx ) . rollbackResources ( ) ; final TransactionRolledbackException rbe = new TransactionRolledbackException ( "Transaction is ended due to timeout" ) ; FFDCFilter . processException ( rbe , "com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerImpl.completeTxTimeout" , "100" , this ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "completeTxTimeout" , rbe ) ; throw rbe ; } if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "completeTxTimeout" ) ; }
Complete processing of passive transaction timeout .
162,354
public void addConsumer ( DispatchableConsumerPoint lcp ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addConsumer" , lcp ) ; synchronized ( consumerList ) { consumerList . add ( lcp ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addConsumer" ) ; }
Add a new consumer to this set .
162,355
public void removeConsumer ( DispatchableConsumerPoint lcp ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeConsumer" , lcp ) ; synchronized ( consumerList ) { consumerList . remove ( lcp ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeConsumer" ) ; }
Remove a consumer from the set .
162,356
public int getGetCursorIndex ( SIMPMessage msg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getGetCursorIndex" ) ; int classPos = 0 ; synchronized ( classifications ) { if ( classifications . getNumberOfClasses ( ) > 0 ) { String keyClassification = msg . getMessageControlClassification ( true ) ; if ( keyClassification != null && classifications . getWeight ( keyClassification ) > 0 ) classPos = classifications . getPosition ( keyClassification ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getGetCursorIndex" , classPos ) ; return classPos ; }
Determine the index of the getCursor to use based on the classification of a message .
162,357
public synchronized int chooseGetCursorIndex ( int previous ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "chooseGetCursorIndex" , new Object [ ] { Integer . valueOf ( previous ) } ) ; int classPos = 0 ; if ( classifications . getNumberOfClasses ( ) > 0 ) { if ( previous == - 1 ) { weightMap = classifications . getWeightings ( ) ; } else { weightMap . remove ( Integer . valueOf ( previous ) ) ; } if ( ! weightMap . isEmpty ( ) ) { classPos = classifications . findClassIndex ( weightMap ) ; } else if ( unitTestOperation ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "chooseGetCursorIndex" , "SIErrorException" ) ; throw new SIErrorException ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "chooseGetCursorIndex" , classPos ) ; return classPos ; }
Determine the index of the getCursor to use based on the classifications defined for the ConsumerSet that this consumer belongs to .
162,358
public JSConsumerClassifications getClassifications ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getClassifications" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getClassifications" , classifications ) ; return classifications ; }
Returns a reference to the Classifications object that wraps the classifications specified by XD .
162,359
public boolean prepareAddActiveMessage ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "prepareAddActiveMessage" ) ; boolean messageAccepted = false ; boolean limitReached = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock ) ; maxActiveMessagePrepareReadLock . lock ( ) ; synchronized ( maxActiveMessageLock ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Active Messages: current: " + currentActiveMessages + ", prepared: " + preparedActiveMessages + ", maximum: " + maxActiveMessages + " (suspended: " + consumerSetSuspended + ")" ) ; if ( ! consumerSetSuspended ) { if ( ( currentActiveMessages + preparedActiveMessages ) == ( maxActiveMessages - 1 ) ) { limitReached = true ; } else { preparedActiveMessages ++ ; messageAccepted = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Prepare added" ) ; } } if ( ! messageAccepted ) { maxActiveMessagePrepareReadLock . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareReadLock.unlock(): " + maxActiveMessagePrepareLock ) ; } } if ( limitReached ) { boolean releaseWriteLock = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareWriteLock.lock(): " + maxActiveMessagePrepareLock ) ; maxActiveMessagePrepareWriteLock . lock ( ) ; synchronized ( maxActiveMessageLock ) { if ( ! consumerSetSuspended ) { messageAccepted = true ; preparedActiveMessages ++ ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Prepare added" ) ; if ( ( currentActiveMessages + preparedActiveMessages ) == maxActiveMessages ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Write lock held until commit/rollback" ) ; releaseWriteLock = false ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock ) ; maxActiveMessagePrepareReadLock . lock ( ) ; } } if ( releaseWriteLock ) { maxActiveMessagePrepareWriteLock . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareWriteLock.unlock(): " + maxActiveMessagePrepareLock ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "prepareAddActiveMessage" , Boolean . valueOf ( messageAccepted ) ) ; return messageAccepted ; }
Because there may be multiple members or the ConsumerSet if we re managing the active mesage count we must reserve a space for any message that a consumer may lock rather than lock it first then realise that the ConsumerSet has reached its maximum active message limit and have to unlock it .
162,360
public void takeClassificationReadLock ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "takeClassificationReadLock" ) ; classificationReadLock . lock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "takeClassificationReadLock" ) ; }
Take a classification readlock
162,361
public void freeClassificationReadLock ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "freeClassificationReadLock" ) ; classificationReadLock . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "freeClassificationReadLock" ) ; }
Free a classification readlock
162,362
public void registerSynchronization ( Synchronization s ) throws CPIException { try { ivContainer . uowCtrl . enlistWithSession ( s ) ; } catch ( CSIException e ) { throw new CPIException ( e . toString ( ) ) ; } }
Register the synchronization object with this activity session
162,363
private EJBKey [ ] getEJBKeys ( BeanO [ ] beans ) { EJBKey result [ ] = null ; if ( beans != null ) { result = new EJBKey [ beans . length ] ; for ( int i = 0 ; i < beans . length ; ++ i ) { result [ i ] = beans [ i ] . getId ( ) ; } } return result ; }
Get snapshot of all EJBKeys associated with the beans involved in current activity session
162,364
private BeanO [ ] getBeanOs ( ) { BeanO result [ ] ; result = new BeanO [ ivBeanOs . size ( ) ] ; Iterator < BeanO > iter = ivBeanOs . values ( ) . iterator ( ) ; int i = 0 ; while ( iter . hasNext ( ) ) { result [ i ++ ] = iter . next ( ) ; } return result ; }
Get snapshot of all beans involved in current activity session
162,365
public void scanClasses ( ClassSource_Streamer streamer , Set < String > i_seedClassNamesSet , ScanPolicy scanPolicy ) { throw new UnsupportedOperationException ( ) ; }
scan policy and external regions are never scanned iteratively .
162,366
public List < com . ibm . wsspi . security . wim . model . PartyRole > getPartyRoles ( ) { if ( partyRoles == null ) { partyRoles = new ArrayList < com . ibm . wsspi . security . wim . model . PartyRole > ( ) ; } return this . partyRoles ; }
Gets the value of the partyRoles property .
162,367
public JSchema getExpectedSchema ( Map context ) { if ( expectedSchema != null ) return expectedSchema ; if ( expectedType == null ) return null ; expectedSchema = ( JSchema ) context . get ( expectedType ) ; if ( expectedSchema != null ) return expectedSchema ; expectedSchema = new JSchema ( expectedType , context ) ; return expectedSchema ; }
Retrieve the subschema corresponding to the expected type ( will be null iff expected type is null . Constructs the subschema if it doesn t already exist . The context argument guards against duplicate construction of schemas in the event that the definition is recursive .
162,368
public void taskStarting ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; prevInvocationSubject = subjectManager . getInvocationSubject ( ) ; prevCallerSubject = subjectManager . getCallerSubject ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "taskStarting" , "previous caller/invocation subjects" , prevCallerSubject , prevInvocationSubject ) ; subjectManager . setInvocationSubject ( invocationSubject ) ; subjectManager . setCallerSubject ( callerSubject ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "taskStarting" , new Object [ ] { "new caller/invocation subjects" , callerSubject , invocationSubject } ) ; }
Push the subjects associated with this security context onto the thread .
162,369
public void taskStopping ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "taskStopping" , "restore caller/invocation subjects" , prevCallerSubject , prevInvocationSubject ) ; subjectManager . setCallerSubject ( prevCallerSubject ) ; subjectManager . setInvocationSubject ( prevInvocationSubject ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "taskStopping" ) ; }
Restore the subjects that were previously on the thread prior to applying this security context .
162,370
private void readState ( GetField fields ) throws IOException { callerPrincipal = ( WSPrincipal ) fields . get ( CALLER_PRINCIPAL , null ) ; subjectsAreEqual = fields . get ( SUBJECTS_ARE_EQUAL , false ) ; if ( ! subjectsAreEqual ) { invocationPrincipal = ( WSPrincipal ) fields . get ( INVOCATION_PRINCIPAL , null ) ; } else { invocationPrincipal = callerPrincipal ; } jaasLoginContextEntry = ( String ) fields . get ( JAAS_LOGIN_CONTEXT , null ) ; callerSubjectCacheKey = ( String ) fields . get ( CALLER_SUBJECT_CACHE_KEY , null ) ; invocationSubjectCacheKey = ( String ) fields . get ( INVOCATION_SUBJECT_CACHE_KEY , null ) ; }
Read the security context
162,371
@ FFDCIgnore ( AuthenticationException . class ) protected Subject recreateFullSubject ( WSPrincipal wsPrincipal , SecurityService securityService , AtomicServiceReference < UnauthenticatedSubjectService > unauthenticatedSubjectServiceRef , String customCacheKey ) { Subject subject = null ; if ( wsPrincipal != null ) { String userName = wsPrincipal . getName ( ) ; AuthenticateUserHelper authHelper = new AuthenticateUserHelper ( ) ; if ( jaasLoginContextEntry == null ) { jaasLoginContextEntry = DESERIALIZE_LOGINCONTEXT_DEFAULT ; } try { subject = authHelper . authenticateUser ( securityService . getAuthenticationService ( ) , userName , jaasLoginContextEntry , customCacheKey ) ; } catch ( AuthenticationException e ) { Tr . error ( tc , "SEC_CONTEXT_DESERIALIZE_AUTHN_ERROR" , new Object [ ] { e . getLocalizedMessage ( ) } ) ; } } if ( subject == null ) { subject = unauthenticatedSubjectServiceRef . getService ( ) . getUnauthenticatedSubject ( ) ; } return subject ; }
Perform a login to recreate the full subject given a WSPrincipal
162,372
protected WSPrincipal getWSPrincipal ( Subject subject ) throws IOException { WSPrincipal wsPrincipal = null ; Set < WSPrincipal > principals = ( subject != null ) ? subject . getPrincipals ( WSPrincipal . class ) : null ; if ( principals != null && ! principals . isEmpty ( ) ) { if ( principals . size ( ) > 1 ) { String principalNames = null ; for ( WSPrincipal principal : principals ) { if ( principalNames == null ) principalNames = principal . getName ( ) ; else principalNames = principalNames + ", " + principal . getName ( ) ; } throw new IOException ( Tr . formatMessage ( tc , "SEC_CONTEXT_DESERIALIZE_TOO_MANY_PRINCIPALS" , principalNames ) ) ; } else { wsPrincipal = principals . iterator ( ) . next ( ) ; } } return wsPrincipal ; }
Get the WSPrincipal from the subject
162,373
private void serializeSubjectCacheKey ( PutField fields ) throws Exception { if ( callerSubject != null ) { Hashtable < String , ? > hashtable = subjectHelper . getHashtableFromSubject ( callerSubject , new String [ ] { AttributeNameConstants . WSCREDENTIAL_CACHE_KEY } ) ; if ( hashtable != null ) { callerSubjectCacheKey = ( String ) hashtable . get ( AttributeNameConstants . WSCREDENTIAL_CACHE_KEY ) ; } } if ( callerSubjectCacheKey != null ) fields . put ( CALLER_SUBJECT_CACHE_KEY , callerSubjectCacheKey ) ; if ( ! subjectsAreEqual ) { if ( invocationSubject != null ) { Hashtable < String , ? > hashtable = subjectHelper . getHashtableFromSubject ( invocationSubject , new String [ ] { AttributeNameConstants . WSCREDENTIAL_CACHE_KEY } ) ; if ( hashtable != null ) { invocationSubjectCacheKey = ( String ) hashtable . get ( AttributeNameConstants . WSCREDENTIAL_CACHE_KEY ) ; } } } if ( invocationSubjectCacheKey != null ) fields . put ( INVOCATION_SUBJECT_CACHE_KEY , invocationSubjectCacheKey ) ; }
Serialize the cache lookup keys for the caller and invocation subjects
162,374
public void clear ( ) throws IOException { if ( writer != null ) { throw new IOException ( ) ; } else { nextChar = 0 ; if ( limitBuffer && ( strBuffer . length ( ) > this . bodyContentBuffSize ) ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "BodyContentImpl" , "clear buffer, create new one with buffer size [" + this . bodyContentBuffSize + "]" ) ; } strBuffer = new StringBuffer ( this . bodyContentBuffSize ) ; } else if ( strBuffer != null ) { strBuffer . setLength ( 0 ) ; } } }
Clear the contents of the buffer . If the buffer has been already been flushed then the clear operation shall throw an IOException to signal the fact that some data has already been irrevocably written to the client response stream .
162,375
public void writeOut ( Writer out ) throws IOException { if ( writer == null ) { out . write ( strBuffer . toString ( ) ) ; } }
Write the contents of this BodyJspWriter into a Writer . Subclasses are likely to do interesting things with the implementation so some things are extra efficient .
162,376
void setWriter ( Writer writer ) { if ( closed ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "setWriter" , "resetting closed to false for this=[" + this + "]" ) ; } closed = false ; strBuffer = new StringBuffer ( this . bodyContentBuffSize ) ; } this . writer = writer ; if ( writer != null ) { if ( bufferSize != 0 ) { if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "setWriter" , "BodyContentImpl setWriter A. bufferSize=[" + bufferSize + "] this=[" + this + "]" ) ; } bufferSizeSave = bufferSize ; bufferSize = 0 ; } } else { bufferSize = bufferSizeSave ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINE ) ) { logger . logp ( Level . FINE , CLASS_NAME , "setWriter" , "BodyContentImpl setWriter B. bufferSize=[" + bufferSize + "] this=[" + this + "]" ) ; } clearBody ( ) ; } }
Sets the writer to which all output is written .
162,377
public final Map < String , String > getExecutionProperties ( ) { TreeMap < String , String > copy = null ; if ( internalPropNames != null ) { copy = new TreeMap < String , String > ( threadContextDescriptor . getExecutionProperties ( ) ) ; for ( String name : internalPropNames ) copy . remove ( name ) ; } return copy ; }
Returns a copy of execution properties .
162,378
public TimerWorkItem createTimeoutRequest ( long timeoutTime , TimerCallback _callback , IAbstractAsyncFuture _future ) { TimerWorkItem wi = new TimerWorkItem ( timeoutTime , _callback , _future , _future . getReuseCount ( ) ) ; _future . setTimeoutWorkItem ( wi ) ; if ( ( this . queueToUse == 1 ) || ( numQueues == 1 ) ) { synchronized ( this . requestQueue1 ) { this . requestQueue1 . add ( wi ) ; } } else { synchronized ( this . requestQueue2 ) { this . requestQueue2 . add ( wi ) ; } } return wi ; }
Creates a work item and puts it on the work queue for requesting a timeout to be started .
162,379
public void timeSlotPruning ( long curTime ) { TimeSlot slotEntry = this . firstSlot ; TimeSlot nextSlot = null ; int endIndex = 0 ; int i ; while ( slotEntry != null ) { nextSlot = slotEntry . nextEntry ; if ( curTime - slotEntry . mostRecentlyAccessedTime > TIMESLOT_PRUNING_THRESHOLD ) { endIndex = slotEntry . lastEntryIndex ; for ( i = endIndex ; i >= 0 ; i -- ) { if ( slotEntry . entries [ i ] . state == TimerWorkItem . ENTRY_ACTIVE ) { break ; } } if ( i < 0 ) { removeSlot ( slotEntry ) ; } } slotEntry = nextSlot ; } }
Remove slots which have no active requests and no new requests have been added in a set amount of time .
162,380
public void insertWorkItem ( TimerWorkItem work , long curTime ) { long insertTime = work . timeoutTime ; TimeSlot nextSlot = this . firstSlot ; while ( nextSlot != null ) { if ( ( insertTime == nextSlot . timeoutTime ) && ( nextSlot . lastEntryIndex != TimeSlot . TIMESLOT_LAST_ENTRY ) ) { nextSlot . addEntry ( work , curTime ) ; break ; } else if ( insertTime < nextSlot . timeoutTime ) { nextSlot = insertSlot ( insertTime , nextSlot ) ; nextSlot . addEntry ( work , curTime ) ; break ; } else { nextSlot = nextSlot . nextEntry ; } } if ( nextSlot == null ) { nextSlot = insertSlotAtEnd ( insertTime ) ; nextSlot . addEntry ( work , curTime ) ; } }
Put a work item into an existing time slot or create a new time slot and put the work item into that time slot .
162,381
public TimeSlot insertSlot ( long newSlotTimeout , TimeSlot slot ) { TimeSlot retSlot = new TimeSlot ( newSlotTimeout ) ; retSlot . nextEntry = slot ; retSlot . prevEntry = slot . prevEntry ; if ( retSlot . prevEntry != null ) { retSlot . prevEntry . nextEntry = retSlot ; } else { this . firstSlot = retSlot ; } slot . prevEntry = retSlot ; return retSlot ; }
Create a new time slot with a given timeout time and add this new time slot in front of an existing time slot in the list .
162,382
public TimeSlot insertSlotAtEnd ( long newSlotTimeout ) { TimeSlot retSlot = new TimeSlot ( newSlotTimeout ) ; if ( this . lastSlot == null ) { this . lastSlot = retSlot ; this . firstSlot = retSlot ; } else { retSlot . prevEntry = this . lastSlot ; this . lastSlot . nextEntry = retSlot ; this . lastSlot = retSlot ; } return retSlot ; }
Create a new time slot with a given timeout time and add this new time slot at the end of the time slot list .
162,383
public void removeSlot ( TimeSlot oldSlot ) { if ( oldSlot . nextEntry != null ) { oldSlot . nextEntry . prevEntry = oldSlot . prevEntry ; } else { this . lastSlot = oldSlot . prevEntry ; } if ( oldSlot . prevEntry != null ) { oldSlot . prevEntry . nextEntry = oldSlot . nextEntry ; } else { this . firstSlot = oldSlot . nextEntry ; } }
Remove a time slot from the list .
162,384
public void checkForTimeouts ( long checkTime ) { TimeSlot nextSlot = this . firstSlot ; TimerWorkItem entry = null ; TimeSlot oldSlot = null ; while ( nextSlot != null && checkTime >= nextSlot . timeoutTime ) { int endIndex = nextSlot . lastEntryIndex ; for ( int i = 0 ; i <= endIndex ; i ++ ) { entry = nextSlot . entries [ i ] ; if ( entry . state == TimerWorkItem . ENTRY_ACTIVE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found a timeout, calling timerTriggered" ) ; } entry . state = TimerWorkItem . ENTRY_CANCELLED ; entry . callback . timerTriggered ( entry ) ; } } oldSlot = nextSlot ; removeSlot ( oldSlot ) ; nextSlot = nextSlot . nextEntry ; } }
Check for timeouts in the time slot list .
162,385
public static List < String > getMatchingFileNames ( String root , String filterExpr , boolean fullPath ) { List < File > fileList = getMatchingFiles ( root , filterExpr ) ; List < String > list = new ArrayList < String > ( fileList . size ( ) ) ; for ( File f : fileList ) { if ( fullPath ) list . add ( f . getAbsolutePath ( ) ) ; else list . add ( f . getName ( ) ) ; } return list ; }
Get a list of file names from the given path that match the provided filter ; not recursive .
162,386
public PartnerLogData getEntry ( int index ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getEntry" , index ) ; _pltReadLock . lock ( ) ; try { final PartnerLogData entry = _partnerLogTable . get ( index - 1 ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getEntry" , entry ) ; return entry ; } catch ( IndexOutOfBoundsException ioobe ) { FFDCFilter . processException ( ioobe , "com.ibm.ws.Transaction.JTA.PartnerLogTable.getEntry" , "122" , this ) ; } finally { _pltReadLock . unlock ( ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getEntry" , null ) ; return null ; }
Return the entry in the recovery table at the given index or null if the index is out of the table s bounds
162,387
public void addEntry ( PartnerLogData logData ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addEntry" , logData ) ; _pltWriteLock . lock ( ) ; try { addPartnerEntry ( logData ) ; } finally { _pltWriteLock . unlock ( ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addEntry" ) ; }
Add an entry at the end of the recovery table .
162,388
public PartnerLogData findEntry ( RecoveryWrapper rw ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "findEntry" , rw ) ; PartnerLogData entry ; _pltWriteLock . lock ( ) ; try { for ( PartnerLogData pld : _partnerLogTable ) { final RecoveryWrapper nextWrapper = pld . getLogData ( ) ; if ( rw . isSameAs ( nextWrapper ) ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Found entry in table" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findEntry" , pld . getIndex ( ) ) ; return pld ; } } entry = rw . container ( _failureScopeController ) ; addPartnerEntry ( entry ) ; } finally { _pltWriteLock . unlock ( ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "findEntry" , entry ) ; return entry ; }
This method searches the partner log table for an entry with matching wrapper . If an entry does not exist one is created and added to the table . It should only be accessing the runtime table .
162,389
public void clearUnused ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "clearUnused" ) ; final RecoveryLog partnerLog = _failureScopeController . getPartnerLog ( ) ; _pltWriteLock . lock ( ) ; try { boolean cleared = false ; for ( PartnerLogData pld : _partnerLogTable ) { cleared |= pld . clearIfNotInUse ( ) ; } try { if ( cleared ) { ( ( DistributedRecoveryLog ) partnerLog ) . keypoint ( ) ; } } catch ( Exception exc ) { } } finally { _pltWriteLock . unlock ( ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "clearUnused" ) ; }
Scans through the partners listed in this table and instructs each of them to clear themselves from the recovery log if they are not associated with current transactions . Entries remain in the table an can be re - logged during if they are used again .
162,390
public boolean recover ( RecoveryManager recoveryManager , ClassLoader cl , Xid [ ] xids ) { boolean success = true ; if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "recover" , new Object [ ] { this , _failureScopeController . serverName ( ) } ) ; final int restartEpoch = recoveryManager . getCurrentEpoch ( ) ; final byte [ ] cruuid = recoveryManager . getApplId ( ) ; for ( PartnerLogData pld : _partnerLogTable ) { if ( ! pld . recover ( cl , xids , null , cruuid , restartEpoch ) ) { success = false ; } if ( recoveryManager . shutdownInProgress ( ) ) { success = false ; break ; } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "recover" , success ) ; return success ; }
Determine XA RMs needing recovery .
162,391
private < T > ServiceRegistration < T > registerMBean ( ObjectName on , Class < T > type , T o ) { Dictionary < String , Object > props = new Hashtable < String , Object > ( ) ; props . put ( "jmx.objectname" , on . toString ( ) ) ; return context . registerService ( type , o , props ) ; }
Used to Register an MBean
162,392
public void startReadListener ( ThreadContextManager tcm , SRTInputStream31 inputStream ) throws Exception { try { ReadListenerRunnable rlRunnable = new ReadListenerRunnable ( tcm , inputStream , this ) ; this . setReadListenerRunning ( true ) ; com . ibm . ws . webcontainer . osgi . WebContainer . getExecutorService ( ) . execute ( rlRunnable ) ; notifyITransferContextPreProcessWorkState ( ) ; } catch ( Exception e ) { this . setReadListenerRunning ( false ) ; throw e ; } }
A read listener has been set on the SRTInputStream and we will set it up to do its first read on another thread .
162,393
public ThreadPool getThreadPool ( String threadPoolName , int minSize , int maxSize ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getThreadPool" , new Object [ ] { threadPoolName , minSize , maxSize } ) ; ThreadPool threadPool = null ; if ( RuntimeInfo . isThinClient ( ) ) { try { Class clazz = Class . forName ( JFapChannelConstants . THIN_CLIENT_THREADPOOL_CLASS ) ; threadPool = ( ThreadPool ) clazz . newInstance ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".getInstance" , JFapChannelConstants . FRAMEWORK_GETTHREADPOOL_01 , JFapChannelConstants . THIN_CLIENT_THREADPOOL_CLASS ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unable to instantiate thin client thread pool" , e ) ; throw new SIErrorException ( e ) ; } } else { try { Class clazz = Class . forName ( JFapChannelConstants . RICH_CLIENT_THREADPOOL_CLASS ) ; threadPool = ( ThreadPool ) clazz . newInstance ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".getInstance" , JFapChannelConstants . FRAMEWORK_GETTHREADPOOL_02 , JFapChannelConstants . RICH_CLIENT_THREADPOOL_CLASS ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unable to instantiate rich client thread pool" , e ) ; throw new SIErrorException ( e ) ; } } threadPool . initialise ( threadPoolName , minSize , maxSize ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getThreadPool" , threadPool ) ; return threadPool ; }
Retrieves a thread pool that is backed by the appropriate framework implementation .
162,394
private void cleanup ( ) { StatsDataReference ref = null ; while ( ( ref = ( StatsDataReference ) statisticsReferenceQueue . poll ( ) ) != null ) { StatsData oldStats = null ; StatsData updatedStats = null ; do { oldStats = terminatedThreadStats . get ( ) ; updatedStats = aggregateStats ( oldStats , ref . statsData ) ; } while ( ! terminatedThreadStats . compareAndSet ( oldStats , updatedStats ) ) ; allReferences . remove ( ref ) ; } }
Poll the reference queue looking for statistics data associated with a thread that is no longer reachable . If one is found update the terminated thread statistics .
162,395
public Expectations goodAppExpectations ( String theUrl , String appClass ) throws Exception { Expectations expectations = new Expectations ( ) ; expectations . addExpectations ( CommonExpectations . successfullyReachedUrl ( theUrl ) ) ; expectations . addExpectation ( new ResponseFullExpectation ( MpJwtFatConstants . STRING_CONTAINS , appClass , "Did not invoke the app " + appClass + "." ) ) ; return expectations ; }
Set good app check expectations - sets checks for good status code and for a message indicating what if any app class was invoked successfully
162,396
public Expectations badAppExpectations ( String errorMessage ) throws Exception { Expectations expectations = new Expectations ( ) ; expectations . addExpectation ( new ResponseStatusExpectation ( HttpServletResponse . SC_UNAUTHORIZED ) ) ; expectations . addExpectation ( new ResponseMessageExpectation ( MpJwtFatConstants . STRING_CONTAINS , errorMessage , "Did not find the error message: " + errorMessage ) ) ; return expectations ; }
Set bad app check expectations - sets checks for a 401 status code and the expected error message in the server s messages . log
162,397
public String buildAppUrl ( LibertyServer theServer , String root , String app ) throws Exception { return SecurityFatHttpUtils . getServerUrlBase ( theServer ) + root + "/rest/" + app + "/" + MpJwtFatConstants . MPJWT_GENERIC_APP_NAME ; }
Build the http app url
162,398
public String buildAppSecureUrl ( LibertyServer theServer , String root , String app ) throws Exception { return SecurityFatHttpUtils . getServerSecureUrlBase ( theServer ) + root + "/rest/" + app + "/" + MpJwtFatConstants . MPJWT_GENERIC_APP_NAME ; }
Build the https app url
162,399
public Expectations setBadIssuerExpectations ( LibertyServer server ) throws Exception { Expectations expectations = new Expectations ( ) ; expectations . addExpectation ( new ResponseStatusExpectation ( HttpServletResponse . SC_UNAUTHORIZED ) ) ; expectations . addExpectation ( new ServerMessageExpectation ( server , MpJwtMessageConstants . CWWKS5523E_ERROR_CREATING_JWT_USING_TOKEN_IN_REQ , "Messagelog did not contain an error indicating a problem authenticating the request with the provided token." ) ) ; expectations . addExpectation ( new ServerMessageExpectation ( server , MpJwtMessageConstants . CWWKS6022E_ISSUER_NOT_TRUSTED , "Messagelog did not contain an exception indicating that the issuer is NOT valid." ) ) ; return expectations ; }
Set expectations for tests that have bad issuers