idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
161,700
protected InputStream getInputStreamToLicenseInsideZip ( final ZipInputStream zis , final String assetId , final String attachmentId ) throws IOException { InputStream is = null ; try { ZipEntry ze = zis . getNextEntry ( ) ; while ( ze != null ) { if ( ze . isDirectory ( ) ) { //do nothing } else { String name = getName ( ze . getName ( ) . replace ( "/" , File . separator ) ) ; String licId = assetId . concat ( String . format ( "#licenses" + File . separator + "%s" , name ) ) ; if ( licId . equals ( attachmentId ) ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; byte [ ] buffer = new byte [ 1024 ] ; int read ; int total = 0 ; while ( ( read = zis . read ( buffer ) ) != - 1 ) { baos . write ( buffer , 0 , read ) ; total += read ; } //ZipEntry sometimes returns -1 when unable to get original size, in this case we want to proceed if ( ze . getSize ( ) != - 1 && total != ze . getSize ( ) ) { throw new IOException ( "The size of the retrieved license was wrong. Expected : " + ze . getSize ( ) + " bytes, but actually was " + total + " bytes." ) ; } byte [ ] content = baos . toByteArray ( ) ; is = new ByteArrayInputStream ( content ) ; } } ze = zis . getNextEntry ( ) ; } } finally { zis . closeEntry ( ) ; zis . close ( ) ; } return is ; }
Given a ZipInputStream to an asset within the repo get an input stream to the license attachment within the asset .
362
23
161,701
void reset ( Object key ) { _nodeKey [ 0 ] = key ; _nodeKey [ midPoint ( ) ] = key ; _population = 1 ; _rightChild = null ; _leftChild = null ; _balance = 0 ; }
Return the node to its post - construction state .
51
10
161,702
boolean hasChild ( ) { boolean has = false ; if ( ( leftChild ( ) != null ) || ( rightChild ( ) != null ) ) has = true ; return has ; }
Return true if the node has either a right child or a left child .
40
15
161,703
public short balance ( ) { if ( ( _balance == - 1 ) || ( _balance == 0 ) || ( _balance == 1 ) ) return _balance ; else { String x = "Found invalid balance factor: " + _balance ; throw new RuntimeException ( x ) ; } }
Return the balance factor for the node .
60
8
161,704
void setBalance ( int b ) { if ( ( b == - 1 ) || ( b == 0 ) || ( b == 1 ) ) _balance = ( short ) b ; else { String x = "Attempt to set invalid balance factor: " + b ; throw new IllegalArgumentException ( x ) ; } }
Set the node s balance factor to a new value .
66
11
161,705
public boolean isLeafNode ( ) { boolean leaf = false ; if ( ( _leftChild == null ) && ( _rightChild == null ) ) leaf = true ; return leaf ; }
Return true if the node is a leaf node .
40
10
161,706
void findInsertPointInLeft ( Object new1 , NodeInsertPoint point ) { int endp = endPoint ( ) ; findIndex ( 0 , endp , new1 , point ) ; }
Find the insert point in the left half of the node for a new key .
41
16
161,707
public int searchLeft ( SearchComparator comp , Object searchKey ) { int idx = - 1 ; int top = middleIndex ( ) ; if ( comp . type ( ) == SearchComparator . EQ ) idx = findEqual ( comp , 0 , top , searchKey ) ; else idx = findGreater ( comp , 0 , top , searchKey ) ; return idx ; }
Search the left half of the node .
84
8
161,708
public int searchRight ( SearchComparator comp , Object searchKey ) { int idx = - 1 ; int bot = middleIndex ( ) ; int right = rightMostIndex ( ) ; if ( bot > right ) { String x = "bot = " + bot + ", right = " + right ; throw new OptimisticDepthException ( x ) ; } if ( comp . type ( ) == SearchComparator . EQ ) idx = findEqual ( comp , bot , right , searchKey ) ; else idx = findGreater ( comp , bot , right , searchKey ) ; return idx ; }
Search the right half of the node .
128
8
161,709
int searchAll ( SearchComparator comp , Object searchKey ) { int idx = - 1 ; if ( comp . type ( ) == SearchComparator . EQ ) idx = findEqual ( comp , 0 , rightMostIndex ( ) , searchKey ) ; else idx = findGreater ( comp , 0 , rightMostIndex ( ) , searchKey ) ; return idx ; }
Search the whole node .
83
5
161,710
private int findEqual ( SearchComparator comp , int lower , int upper , Object searchKey ) { int nkeys = numKeys ( lower , upper ) ; int idx = - 1 ; if ( nkeys < 4 ) idx = sequentialSearchEqual ( comp , lower , upper , searchKey ) ; else idx = binarySearchEqual ( comp , lower , upper , searchKey ) ; return idx ; }
Find an index entry that is equal to the supplied key .
90
12
161,711
private int sequentialSearchEqual ( SearchComparator comp , int lower , int upper , Object searchKey ) { int xcc ; /* Current compare result */ int idx = - 1 ; /* The returned index (-1 if not found) */ for ( int i = lower ; i <= upper ; i ++ ) { xcc = comp . compare ( searchKey , _nodeKey [ i ] ) ; if ( xcc == 0 ) /* Found a match */ { idx = i ; /* Remember current point */ break ; } } return idx ; }
Use sequential search to find a matched key .
115
9
161,712
private int findGreater ( SearchComparator comp , int lower , int upper , Object searchKey ) { int nkeys = numKeys ( lower , upper ) ; int idx = - 1 ; if ( nkeys < 4 ) idx = sequentialSearchGreater ( comp , lower , upper , searchKey ) ; else idx = binarySearchGreater ( comp , lower , upper , searchKey ) ; return idx ; }
Find an index entry that is either greater than or greater than or equal to the supplied key .
90
19
161,713
private void findIndex ( int lower , int upper , Object new1 , NodeInsertPoint point ) { int nkeys = numKeys ( lower , upper ) ; if ( nkeys < 4 ) sequentialFindIndex ( lower , upper , new1 , point ) ; else binaryFindIndex ( lower , upper , new1 , point ) ; }
Find the insert point for a new key .
70
9
161,714
private void binaryFindIndex ( int lower , int upper , Object new1 , NodeInsertPoint point ) { java . util . Comparator comp = insertComparator ( ) ; int xcc ; /* Current compare result */ int lxcc = + 1 ; /* Remembered compare result */ int i ; int idx = upper + 1 ; /* Found index plus one */ while ( lower <= upper ) /* Until they cross */ { i = ( lower + upper ) >>> 1 ; /* Mid-point of current range */ xcc = comp . compare ( new1 , _nodeKey [ i ] ) ; if ( ! ( xcc > 0 ) ) /* SEARCH_KEY <= NODE_KEY */ { upper = i - 1 ; /* Discard upper half of range */ idx = i ; /* Remember last upper bound */ lxcc = xcc ; /* Remember last upper compare result */ } else /* SEARCH_KEY >= NODE_KEY */ lower = i + 1 ; /* Discard lower half of range */ } if ( lxcc != 0 ) /* Never had an equal compare */ point . setInsertPoint ( idx - 1 ) ; /* Desired point is previous one */ else /* Had an equal compare */ point . markDuplicate ( idx ) ; /* Key is a duplicate at point "idx" */ }
Use binary search to find the insert point .
279
9
161,715
int findDeleteInRight ( Object delKey ) { int idx = - 1 ; int r = rightMostIndex ( ) ; int m = midPoint ( ) ; if ( r > m ) idx = findDelete ( m , r , delKey ) ; return idx ; }
Find the delete key in the right half of the node .
60
12
161,716
int findDelete ( int lower , int upper , Object delKey ) { int nkeys = numKeys ( lower , upper ) ; int idx = - 1 ; if ( nkeys < 4 ) idx = sequentialFindDelete ( lower , upper , delKey ) ; else idx = binaryFindDelete ( lower , upper , delKey ) ; return idx ; }
Find the index of the key to delete .
77
9
161,717
private int sequentialFindDelete ( int lower , int upper , Object delKey ) { java . util . Comparator comp = deleteComparator ( ) ; int xcc ; /* Current compare result */ int idx = - 1 ; /* The returned index (-1 if not found) */ for ( int i = lower ; i <= upper ; i ++ ) { xcc = comp . compare ( delKey , _nodeKey [ i ] ) ; if ( xcc == 0 ) /* Found a match */ { idx = i ; /* Remember current point */ break ; } } return idx ; }
Use sequential search to find the delete key .
123
9
161,718
private int binaryFindDelete ( int lower , int upper , Object delKey ) { java . util . Comparator comp = insertComparator ( ) ; int xcc ; /* Current compare result */ int i ; int idx = - 1 ; /* Returned index (-1 if not found) */ while ( lower <= upper ) /* Until they cross */ { i = ( lower + upper ) >>> 1 ; /* Mid-point of current range */ xcc = comp . compare ( delKey , _nodeKey [ i ] ) ; if ( xcc < 0 ) /* SEARCH_KEY < NODE_KEY */ upper = i - 1 ; /* Discard upper half of range */ else /* SEARCH_KEY >= NODE_KEY */ { if ( xcc > 0 ) /* SEARCH_KEY > NODE_KEY */ lower = i + 1 ; /* Discard lower half of range */ else /* SEARCH_KEY FOUND */ { idx = i ; /* Remember the index */ break ; /* We're done */ } } } return idx ; }
Use binary search to find the delete key .
221
9
161,719
public int middleIndex ( ) { int x = midPoint ( ) ; int r = rightMostIndex ( ) ; if ( r < midPoint ( ) ) x = r ; return x ; }
Return the index to the key at the median position in the node .
41
14
161,720
void addRightLeaf ( Object new1 ) { GBSNode p = _index . getNode ( new1 ) ; if ( rightChild ( ) != null ) throw new RuntimeException ( "Help!" ) ; setRightChild ( p ) ; }
Add a right child to the node placing in the new right child the supplied key .
53
17
161,721
Object insertByLeftShift ( int ix , Object new1 ) { Object old1 = leftMostKey ( ) ; leftShift ( ix ) ; _nodeKey [ ix ] = new1 ; if ( midPoint ( ) > rightMostIndex ( ) ) _nodeKey [ midPoint ( ) ] = rightMostKey ( ) ; return old1 ; }
Insert a new key by overlaying the left - most key shifting other keys left and inserting the new key at the appropriate insert point .
77
27
161,722
private void leftShift ( int ix ) { for ( int j = 0 ; j < ix ; j ++ ) _nodeKey [ j ] = _nodeKey [ j + 1 ] ; }
Open up a slot in a node by shifting the keys left .
42
13
161,723
Object insertByRightShift ( int ix , Object new1 ) { Object old1 = null ; if ( isFull ( ) ) { old1 = rightMostKey ( ) ; rightMove ( ix + 1 ) ; _nodeKey [ ix + 1 ] = new1 ; } else { rightShift ( ix + 1 ) ; _nodeKey [ ix + 1 ] = new1 ; _population ++ ; if ( midPoint ( ) > rightMostIndex ( ) ) _nodeKey [ midPoint ( ) ] = rightMostKey ( ) ; } return old1 ; }
Insert a new key by shifting keys right .
124
9
161,724
Object addRightMostKey ( Object new1 ) { Object old1 = null ; if ( isFull ( ) ) /* Node is currently full */ { /* We will overlay right-most key */ old1 = rightMostKey ( ) ; _nodeKey [ rightMostIndex ( ) ] = new1 ; } else { _population ++ ; _nodeKey [ rightMostIndex ( ) ] = new1 ; if ( midPoint ( ) > rightMostIndex ( ) ) _nodeKey [ midPoint ( ) ] = rightMostKey ( ) ; } return old1 ; }
Add the right - most key to the node .
119
10
161,725
void fillFromRight ( ) { int gapWid = width ( ) - population ( ) ; int gidx = population ( ) ; GBSNode p = rightChild ( ) ; for ( int j = 0 ; j < gapWid ; j ++ ) _nodeKey [ j + gidx ] = p . _nodeKey [ j ] ; int delta = gapWid ; if ( p . _population < delta ) delta = p . _population ; _population += delta ; p . _population -= delta ; for ( int j = 0 ; j < gidx ; j ++ ) p . _nodeKey [ j ] = p . _nodeKey [ j + gapWid ] ; }
Fill a node with new keys from the right side .
149
11
161,726
GBSNode rightMostChild ( ) { GBSNode q = this ; GBSNode p = rightChild ( ) ; while ( p != null ) { q = p ; p = p . rightChild ( ) ; } return q ; }
Find the right - most child of a node by following the paths of all of the right - most children all the way to the bottom of the tree .
51
31
161,727
private void rightShift ( int ix ) { for ( int j = rightMostIndex ( ) ; j >= ix ; j -- ) _nodeKey [ j + 1 ] = _nodeKey [ j ] ; }
Open up a slot for a new key by shifting keys right to make room .
46
16
161,728
private void rightMove ( int ix ) { for ( int j = rightMostIndex ( ) - 1 ; j >= ix ; j -- ) _nodeKey [ j + 1 ] = _nodeKey [ j ] ; }
Open up a slot for a new key by shifting keys right to make room and overlaying the right - most key .
48
24
161,729
void overlayLeftShift ( int ix ) { for ( int j = ix ; j < rightMostIndex ( ) ; j ++ ) _nodeKey [ j ] = _nodeKey [ j + 1 ] ; }
Overlay a key to be deleted by moving keys left .
46
12
161,730
private void overlayRightShift ( int ix ) { for ( int j = ix ; j > 0 ; j -- ) _nodeKey [ j ] = _nodeKey [ j - 1 ] ; }
Overlay a key to be deleted by moving keys right .
43
12
161,731
GBSNode lowerPredecessor ( NodeStack stack ) { GBSNode r = leftChild ( ) ; GBSNode lastr = r ; if ( r != null ) stack . push ( NodeStack . PROCESS_CURRENT , this ) ; while ( r != null ) /* Find right-most child of left child */ { if ( r . rightChild ( ) != null ) stack . push ( NodeStack . DONE_VISITS , r ) ; lastr = r ; r = r . rightChild ( ) ; } return lastr ; }
Find the lower predecessor of this node .
117
8
161,732
public boolean validate ( ) { boolean correct = true ; if ( population ( ) > 1 ) { java . util . Comparator comp = index ( ) . insertComparator ( ) ; int xcc = 0 ; for ( int i = 0 ; i < population ( ) - 1 ; i ++ ) { xcc = comp . compare ( _nodeKey [ i ] , _nodeKey [ i + 1 ] ) ; if ( ! ( xcc < 0 ) ) { System . out . println ( "Entry " + i + " not less than entry " + i + 1 ) ; correct = false ; } } } return correct ; }
Used by test code to make sure that all of the keys within a node are in the correct collating sequence .
133
23
161,733
@ Override public Set < String > getExtensionClasses ( ) { Set < String > serviceClazzes = new HashSet <> ( ) ; if ( getType ( ) == ArchiveType . WEB_MODULE ) { Resource webInfClassesMetaInfServicesEntry = getResource ( CDIUtils . WEB_INF_CLASSES_META_INF_SERVICES_CDI_EXTENSION ) ; serviceClazzes . addAll ( CDIUtils . parseServiceSPIExtensionFile ( webInfClassesMetaInfServicesEntry ) ) ; } Resource metaInfServicesEntry = getResource ( CDIUtils . META_INF_SERVICES_CDI_EXTENSION ) ; serviceClazzes . addAll ( CDIUtils . parseServiceSPIExtensionFile ( metaInfServicesEntry ) ) ; return serviceClazzes ; }
Get hold of the extension class names from the file of META - INF \ services \ javax . enterprise . inject . spi . Extension
195
30
161,734
public BeanDiscoveryMode getBeanDiscoveryMode ( CDIRuntime cdiRuntime , BeansXml beansXml ) { BeanDiscoveryMode mode = BeanDiscoveryMode . ANNOTATED ; if ( beansXml != null ) { mode = beansXml . getBeanDiscoveryMode ( ) ; } else if ( cdiRuntime . isImplicitBeanArchivesScanningDisabled ( this ) ) { // If the server.xml has the configuration of enableImplicitBeanArchives sets to false, we will not scan the implicit bean archives mode = BeanDiscoveryMode . NONE ; } return mode ; }
Determine the bean deployment archive scanning mode If there is a beans . xml the bean discovery mode will be used . If there is no beans . xml the mode will be annotated unless the enableImplicitBeanArchives is configured as false via the server . xml . If there is no beans . xml and the enableImplicitBeanArchives attribute on cdi12 is configured to false the scanning mode is none .
135
87
161,735
@ AfterClass public static void teardownClass ( ) throws Exception { try { if ( libertyServer != null ) { libertyServer . stopServer ( "CWIML4537E" ) ; } } finally { if ( ds != null ) { ds . shutDown ( true ) ; } } libertyServer . deleteFileFromLibertyInstallRoot ( "lib/features/internalfeatures/securitylibertyinternals-1.0.mf" ) ; }
Tear down the test .
100
6
161,736
private static void setupLibertyServer ( ) throws Exception { /* * Add LDAP variables to bootstrap properties file */ LDAPUtils . addLDAPVariables ( libertyServer ) ; Log . info ( c , "setUp" , "Starting the server... (will wait for userRegistry servlet to start)" ) ; libertyServer . copyFileToLibertyInstallRoot ( "lib/features" , "internalfeatures/securitylibertyinternals-1.0.mf" ) ; libertyServer . addInstalledAppForValidation ( "userRegistry" ) ; libertyServer . startServer ( c . getName ( ) + ".log" ) ; /* * Make sure the application has come up before proceeding */ assertNotNull ( "Application userRegistry does not appear to have started." , libertyServer . waitForStringInLog ( "CWWKZ0001I:.*userRegistry" ) ) ; assertNotNull ( "Security service did not report it was ready" , libertyServer . waitForStringInLog ( "CWWKS0008I" ) ) ; assertNotNull ( "Server did not came up" , libertyServer . waitForStringInLog ( "CWWKF0011I" ) ) ; Log . info ( c , "setUp" , "Creating servlet connection the server" ) ; servlet = new UserRegistryServletConnection ( libertyServer . getHostname ( ) , libertyServer . getHttpDefaultPort ( ) ) ; if ( servlet . getRealm ( ) == null ) { Thread . sleep ( 5000 ) ; servlet . getRealm ( ) ; } /* * The original server configuration has no registry or Federated Repository configuration. */ emptyConfiguration = libertyServer . getServerConfiguration ( ) ; }
Setup the Liberty server . This server will start with very basic configuration . The tests will configure the server dynamically .
377
22
161,737
private static void setupldapServer ( ) throws Exception { ds = new InMemoryLDAPServer ( SUB_DN ) ; Entry entry = new Entry ( SUB_DN ) ; entry . addAttribute ( "objectclass" , "top" ) ; entry . addAttribute ( "objectclass" , "domain" ) ; ds . add ( entry ) ; /* * Add the partition entries. */ entry = new Entry ( "ou=Test,o=ibm,c=us" ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Test" ) ; ds . add ( entry ) ; entry = new Entry ( USER_BASE_DN ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Test" ) ; entry . addAttribute ( "ou" , "TestUsers" ) ; ds . add ( entry ) ; entry = new Entry ( BAD_USER_BASE_DN ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "BadUsers" ) ; ds . add ( entry ) ; entry = new Entry ( "ou=Dev,o=ibm,c=us" ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Dev" ) ; ds . add ( entry ) ; entry = new Entry ( GROUP_BASE_DN ) ; entry . addAttribute ( "objectclass" , "organizationalunit" ) ; entry . addAttribute ( "ou" , "Dev" ) ; entry . addAttribute ( "ou" , "DevGroups" ) ; ds . add ( entry ) ; /* * Create the user and group. */ entry = new Entry ( USER_DN ) ; entry . addAttribute ( "objectclass" , "inetorgperson" ) ; entry . addAttribute ( "uid" , USER ) ; entry . addAttribute ( "sn" , USER ) ; entry . addAttribute ( "cn" , USER ) ; entry . addAttribute ( "userPassword" , "password" ) ; ds . add ( entry ) ; entry = new Entry ( BAD_USER_DN ) ; entry . addAttribute ( "objectclass" , "inetorgperson" ) ; entry . addAttribute ( "uid" , BAD_USER ) ; entry . addAttribute ( "sn" , BAD_USER ) ; entry . addAttribute ( "cn" , BAD_USER ) ; entry . addAttribute ( "userPassword" , "password" ) ; ds . add ( entry ) ; entry = new Entry ( GROUP_DN ) ; entry . addAttribute ( "objectclass" , "groupofnames" ) ; entry . addAttribute ( "cn" , GROUP ) ; entry . addAttribute ( "member" , USER_DN ) ; entry . addAttribute ( "member" , BAD_USER_DN ) ; ds . add ( entry ) ; }
Configure the embedded LDAP server .
667
8
161,738
private Object syncGetValueFromBucket ( FastSyncHashBucket hb , int key , boolean remove ) { FastSyncHashEntry e = null ; FastSyncHashEntry last = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "syncGetValueFromBucket: key, remove " + key + " " + remove ) ; } synchronized ( hb ) { e = hb . root ; while ( e != null ) { if ( e . key == key ) { if ( remove ) { if ( last == null ) { // this is root hb . root = e . next ; } else { last . next = e . next ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncGetValueFromBucket: found value in bucket" ) ; } return e . value ; } last = e ; e = e . next ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncGetValueFromBucket-returned null" ) ; } return null ; }
Internal get from the table which is partially synchronized at the hash bucket level .
266
15
161,739
public Object put ( int key , Object value ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "put" ) ; } if ( value == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "value == null" ) ; } throw new NullPointerException ( "Missing value" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "key " + key ) ; } // check the table FastSyncHashBucket bucket = getBucket ( key ) ; Object retVal = syncGetValueFromBucket ( bucket , key , false ) ; if ( retVal != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "put: key is already defined in bucket...returning value from bucket and new key value will be discarded." ) ; return retVal ; } // new entry FastSyncHashEntry e = new FastSyncHashEntry ( key , value ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "put: put new key and value into bucket" ) ; } return syncPutIntoBucket ( bucket , e ) ; }
Put into the table if does not exist .
315
9
161,740
private Object syncPutIntoBucket ( FastSyncHashBucket hb , FastSyncHashEntry newEntry ) { FastSyncHashEntry e = null ; FastSyncHashEntry last = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "syncPutIntoBucket" ) ; } synchronized ( hb ) { e = hb . root ; // already in there? while ( e != null ) { if ( e . key == newEntry . key ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncPutIntoBucket: key/hash pair is already in the bucket" ) ; } return e . value ; } last = e ; e = e . next ; } if ( last == null ) { if ( hb . root == null ) { // this is root hb . root = newEntry ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncPutIntoBucket: Adding new entry at the beginning (root)" ) ; } return newEntry . value ; } last = hb . root ; while ( last . next != null ) { last = last . next ; } } last . next = newEntry ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncPutIntoBucket: Adding new entry at the end" ) ; } return newEntry . value ; } // end-sync }
Put synchronized into bucket .
356
5
161,741
public Object [ ] getAllEntryValues ( ) { List < Object > values = new ArrayList < Object > ( ) ; FastSyncHashBucket hb = null ; FastSyncHashEntry e = null ; for ( int i = 0 ; i < xVar ; i ++ ) { for ( int j = 0 ; j < yVar ; j ++ ) { hb = mainTable [ i ] [ j ] ; synchronized ( hb ) { e = hb . root ; while ( e != null ) { values . add ( e . value ) ; e = e . next ; } } } } return values . toArray ( ) ; }
This routine returns a snapshot of all the values in the hash table .
136
14
161,742
void removeSession ( JmsSessionImpl sess ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeSession" , sess ) ; synchronized ( stateLock ) { // Remove the Session // Note that this is a synchronized collection. boolean res = sessions . remove ( sess ) ; // Release the ordering context associated with the session unusedOrderingContexts . add ( sess . getOrderingContext ( ) ) ; if ( ! res && TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "session not found in list" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeSession" ) ; }
This method is used to remove a Session from the list of sessions held by the Connection .
192
18
161,743
protected int getState ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getState" ) ; int tempState ; synchronized ( stateLock ) { tempState = state ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getState" , state ) ; return tempState ; }
Returns the state .
104
4
161,744
protected void setState ( int newState ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setState" , newState ) ; synchronized ( stateLock ) { if ( ( newState == JmsInternalConstants . CLOSED ) || ( newState == JmsInternalConstants . STOPPED ) || ( newState == JmsInternalConstants . STARTED ) ) { state = newState ; stateLock . notifyAll ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setState" ) ; }
Sets the state .
155
5
161,745
protected void checkClosed ( ) throws JMSException { if ( getState ( ) == CLOSED ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "This Connection is closed." ) ; throw ( javax . jms . IllegalStateException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "CONNECTION_CLOSED_CWSIA0021" , null , tc ) ; } }
This method is called at the beginning of every method that should not work if the Connection has been closed . It prevents further execution by throwing a JMSException with a suitable I m closed message .
120
39
161,746
protected void fixClientID ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "fixClientID" ) ; synchronized ( stateLock ) { clientIDFixed = true ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "fixClientID" ) ; }
This method is called in order to mark that the clientID may not now change .
98
17
161,747
void unfixClientID ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "unfixClientID" ) ; synchronized ( stateLock ) { clientIDFixed = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "unfixClientID" ) ; }
This method is called in order to mark that the clientID may now change .
100
16
161,748
protected JmsJcaSession createJcaSession ( boolean transacted ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createJcaSession" , transacted ) ; JmsJcaSession jcaSess = null ; // If we have a JCA connection, then make a JCA session if ( jcaConnection != null ) { try { jcaSess = jcaConnection . createSession ( transacted ) ; } catch ( Exception e ) { // ResourceE, IllegalStateE, SIE, SIErrorE // No FFDC code needed // d238447 Generate FFDC for these cases. throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "JCA_CREATE_SESS_CWSIA0024" , null , e , "JmsConnectionImpl.createSession#1" , this , tc ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "jcaConnection is null, returning null jcaSess" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createJcaSession" , jcaSess ) ; return jcaSess ; }
Create a JCA Session . If this Connection contains a JCA Connection then use it to create a JCA Session .
318
24
161,749
protected void addTemporaryDestination ( JmsTemporaryDestinationInternal tempDest ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "addTemporaryDestination" , System . identityHashCode ( tempDest ) ) ; synchronized ( temporaryDestinations ) { // synchronize against removeTemporaryDestination temporaryDestinations . add ( tempDest ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "addTemporaryDestination" ) ; }
Add a TemporaryDestination to the list of temporary destinations created by sessions under this connection
137
17
161,750
protected void removeTemporaryDestination ( JmsTemporaryDestinationInternal tempDest ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeTemporaryDestination" , System . identityHashCode ( tempDest ) ) ; synchronized ( temporaryDestinations ) { // synchronize against addTemporaryDestination temporaryDestinations . remove ( tempDest ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeTemporaryDestination" ) ; }
Remove a TemporaryDestination from the list of temporary destinations created by sessions under this connection
137
17
161,751
public OrderingContext allocateOrderingContext ( ) throws SIConnectionDroppedException , SIConnectionUnavailableException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "allocateOrderingContext" ) ; // Synchronize on the state lock, and either re-use an existing // unused and open OrderingContext, or create a new one. OrderingContext oc = null ; synchronized ( stateLock ) { while ( oc == null && ! unusedOrderingContexts . isEmpty ( ) ) { oc = unusedOrderingContexts . remove ( 0 ) ; if ( oc . isProxyConnectionClosed ( ) ) { // Abandon this one. oc = null ; } } if ( oc == null ) { oc = coreConnection . createOrderingContext ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "allocateOrderingContext" , oc ) ; return oc ; }
Called by each session when it is created to get an ordering context for that session .
240
18
161,752
private static void initExceptionThreadPool ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "initExceptionThreadPool" ) ; // Do a synchronous check to ensure once-only creation synchronized ( exceptionTPCreateSync ) { if ( exceptionThreadPool == null ) { // Get the maximum size for the thread pool, defaulting if // not specified or if the value cannot be parsed int maxThreads = Integer . parseInt ( ApiJmsConstants . EXCEPTION_MAXTHREADS_DEFAULT_INT ) ; String maxThreadsStr = RuntimeInfo . getProperty ( ApiJmsConstants . EXCEPTION_MAXTHREADS_NAME_INT , ApiJmsConstants . EXCEPTION_MAXTHREADS_DEFAULT_INT ) ; try { maxThreads = Integer . parseInt ( maxThreadsStr ) ; } catch ( NumberFormatException e ) { // No FFDC code needed, but we will exception this SibTr . exception ( tc , e ) ; } // Trace the value we will use if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , ApiJmsConstants . EXCEPTION_MAXTHREADS_NAME_INT + ": " + Integer . toString ( maxThreads ) ) ; // Create the thread pool exceptionThreadPool = new ThreadPool ( ApiJmsConstants . EXCEPTION_THREADPOOL_NAME_INT , 0 , maxThreads ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "initExceptionThreadPool" ) ; }
PK59962 Ensure the existence of a single thread pool within the process
388
14
161,753
private void addClientId ( String clientId ) { //Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml. if ( clientId == null ) return ; //do nothing ConcurrentHashMap < String , Integer > clientIdTable = JmsFactoryFactoryImpl . getClientIdTable ( ) ; if ( clientIdTable . containsKey ( clientId ) ) { clientIdTable . put ( clientId , clientIdTable . get ( clientId ) . intValue ( ) + 1 ) ; } else { clientIdTable . put ( clientId , 1 ) ; } }
If there is no entry for the given Client Id in the clientIdTable then add it with count as 1 . If its already exists then just increment the counter value by 1 .
140
36
161,754
private void removeClientId ( String clientId ) { //Sometimes the client Id will be null. For instance in the case QueueConnectionFactory, there is no default client Id specified in metatype.xml. if ( clientId == null ) return ; //do nothing ConcurrentHashMap < String , Integer > clientIdTable = JmsFactoryFactoryImpl . getClientIdTable ( ) ; if ( clientIdTable . containsKey ( clientId ) ) { int referenceCount = clientIdTable . get ( clientId ) . intValue ( ) ; if ( referenceCount == 1 ) { clientIdTable . remove ( clientId ) ; } else { clientIdTable . put ( clientId , clientIdTable . get ( clientId ) . intValue ( ) - 1 ) ; } } }
To remove the client id from client table . Whenever this method is called the counter of respective HashMap entry is decremented by one . If the count reaches 0 then that entry wil be removed from the clientIdTable .
166
44
161,755
public void initializeForAroundConstruct ( ManagedObjectContext managedObjectContext , Object [ ] interceptors , InterceptorProxy [ ] proxies ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "initializeForAroundConstruct : context = " + managedObjectContext + " interceptors = " + Arrays . toString ( interceptors ) + ", proxies = " + Arrays . toString ( proxies ) ) ; ivBean = null ; ivManagedObjectContext = managedObjectContext ; ivInterceptors = interceptors ; ivInterceptorProxies = proxies ; ivTimer = null ; }
Initialize a InvocationContext for AroundConstruct with an array of interceptor instances created for this bean instance and the interceptor proxies .
141
27
161,756
public Object doAroundInvoke ( InterceptorProxy [ ] proxies , Method businessMethod , Object [ ] parameters , EJSDeployedSupport s ) //LIDB3294-41 throws Exception { ivMethod = businessMethod ; ivParameters = parameters ; ivEJSDeployedSupport = s ; //LIDB3294-41 ivInterceptorProxies = proxies ; ivIsAroundConstruct = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) // d367572.7 { Tr . entry ( tc , "doAroundInvoke for business method: " + ivMethod . getName ( ) ) ; } try { return doAroundInterceptor ( ) ; } finally // d367572.8 { // Let the mapping strategy handle checked and unchecked exceptions // that occurs since it knows whether to treat unchecked exceptions // as an application exception or as a system exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) // d415968 { Tr . exit ( tc , "doAroundInvoke for business method: " + ivMethod . getName ( ) ) ; } ivMethod = null ; ivParameters = null ; } }
Invoke each AroundInvoke interceptor methods for a specified business method of an EJB being invoked .
259
21
161,757
private Object doAroundInterceptor ( ) throws Exception { // Note, we do not call setParameters since the assumption is the // wrapper code passes an Object array that always contains the // correct type. If we want type checking to ensure wrapper // code is correct, we could call setParameters(parameters) instead // of just doing assignment here. ivNextIndex = 0 ; ivNumberOfInterceptors = ivInterceptorProxies == null ? 0 : ivInterceptorProxies . length ; ivParametersModified = false ; //LIDB3294-41 return proceed ( ) ; }
Invoke each AroundInvoke or AroundConstruct interceptor methods
124
12
161,758
public void doLifeCycle ( InterceptorProxy [ ] proxies , EJBModuleMetaDataImpl mmd ) // F743-14982 { ivMethod = null ; ivParameters = null ; // d367572.8 ivInterceptorProxies = proxies ; ivNumberOfInterceptors = ivInterceptorProxies . length ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) // d367572.7 { Tr . entry ( tc , "doLifeCycle, number of interceptors = " + ivNumberOfInterceptors ) ; } if ( ivNumberOfInterceptors > 0 ) { ivNextIndex = 0 ; try { proceed ( ) ; } catch ( Throwable t ) // d415968 { // FFDCFilter.processException( t, CLASS_NAME + ".doLifeCycle", "260", this ); lifeCycleExceptionHandler ( t , mmd ) ; // d367572.7, F743-14982 } finally { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) // d415968 { Tr . exit ( tc , "doLifeCycle" ) ; } } } }
d450431 - add appExceptionMap parameter .
268
10
161,759
private void lifeCycleExceptionHandler ( Throwable t , EJBModuleMetaDataImpl mmd ) // F743-14982 { if ( t instanceof RuntimeException ) { // Is the RuntimeException an application exception? RuntimeException rtex = ( RuntimeException ) t ; if ( mmd . getApplicationExceptionRollback ( rtex ) != null ) // F743-14982 { // Yes it is, which is not valid for lifecycle callback // methods. So turn this into a system runtime exception. InterceptorProxy w = ivInterceptorProxies [ ivNextIndex - 1 ] ; String lifeCycle = w . getMethodGenericString ( ) ; EJBException ex = ExceptionUtil . EJBException ( lifeCycle + " is not allowed to throw an application exception" , rtex ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "lifeCycleExceptionHandler throwing EJBException" , ex ) ; } throw ex ; } else { // Not an application exception, so let the mapping // strategy handle this system runtime exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "lifeCycleExceptionHandler is rethrowing RuntimeException " + "from lifecycle callback method: " + t , t ) ; } throw rtex ; } } else if ( t instanceof Error ) { // Let the mapping strategy handle this unchecked exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "lifeCycleExceptionHandler is rethrowing Error from " + "lifecycle callback method: " + t , t ) ; } throw ( Error ) t ; } else { // Must be a checked exception, which should never happen since // InterceptorMetaDataFactory throws EJBConfigurationException // and does a Tr.error using message key of INVALID_LIFECYCLE_SIGNATURE_CNTR0231E // if interceptor method throws clause is not empty. But if // it does happen, wrap the exception in a special EJBException // that does not include EJB container in the exception stack. InterceptorProxy w = ivInterceptorProxies [ ivNextIndex - 1 ] ; // d367572.7 String lifeCycle = w . getMethodGenericString ( ) ; // d367572.7 EJBException ex = ExceptionUtil . EJBException ( lifeCycle + " is not allowed to throw a checked exception" , t ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) // d367572.7 { Tr . debug ( tc , "lifeCycleExceptionHandler throwing EJBException" , ex ) ; } throw ex ; } }
d450431 - ensure runtime exception is not an application exception .
619
13
161,760
private void throwUndeclaredExceptionCause ( Throwable undeclaredException ) throws Exception { Throwable cause = undeclaredException . getCause ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "proceed unwrappering " + undeclaredException . getClass ( ) . getSimpleName ( ) + " : " + cause , cause ) ; // CDI interceptors tend to result in a UndeclaredThrowableException wrapped in an InvocationTargetException if ( cause instanceof UndeclaredThrowableException ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "proceed unwrappering " + cause . getClass ( ) . getSimpleName ( ) + " : " + cause , cause . getCause ( ) ) ; cause = cause . getCause ( ) ; } if ( cause instanceof RuntimeException ) { // Let the mapping strategy handle this unchecked exception. throw ( RuntimeException ) cause ; } else if ( cause instanceof Error ) { // Let the mapping strategy handle this unchecked exception. throw ( Error ) cause ; } else { // Probably an application exception occurred, so just throw it. The mapping // strategy will handle if it turns out not to be an application exception. throw ( Exception ) cause ; } }
Since some interceptor methods cannot throw Exception but the target method on the bean can throw application exceptions this method may be used to unwrap the application exception from either an InvocationTargetException or UndeclaredThrowableException .
298
46
161,761
protected void setCredentialProvider ( ServiceReference < CredentialProvider > ref ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Resetting unauthenticatedSubject as new CredentialProvider has been set" ) ; } synchronized ( unauthenticatedSubjectLock ) { unauthenticatedSubject = null ; } }
When CredentialProviders come and go reset the unauthenticated subject .
85
16
161,762
@ Override @ FFDCIgnore ( Exception . class ) public Subject getUnauthenticatedSubject ( ) { if ( unauthenticatedSubject == null ) { CredentialsService cs = credentialsServiceRef . getService ( ) ; String unauthenticatedUserid = cs . getUnauthenticatedUserid ( ) ; try { Subject subject = new Subject ( ) ; Hashtable < String , Object > hashtable = new Hashtable < String , Object > ( ) ; hashtable . put ( AttributeNameConstants . WSCREDENTIAL_SECURITYNAME , unauthenticatedUserid ) ; hashtable . put ( AttributeNameConstants . WSCREDENTIAL_UNIQUEID , AccessIdUtil . createAccessId ( AccessIdUtil . TYPE_USER , getUserRegistryRealm ( ) , unauthenticatedUserid ) ) ; subject . getPublicCredentials ( ) . add ( hashtable ) ; SecurityService securityService = securityServiceRef . getService ( ) ; AuthenticationService authenticationService = securityService . getAuthenticationService ( ) ; Subject tempUnauthenticatedSubject = authenticationService . authenticate ( JaasLoginConfigConstants . SYSTEM_UNAUTHENTICATED , subject ) ; tempUnauthenticatedSubject . setReadOnly ( ) ; synchronized ( unauthenticatedSubjectLock ) { if ( unauthenticatedSubject == null ) { unauthenticatedSubject = tempUnauthenticatedSubject ; } } } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Internal error creating UNAUTHENTICATED subject." , e ) ; } } } return unauthenticatedSubject ; }
Return the unauthenticated subject . If we don t already have one create it .
365
17
161,763
public void setClientAlias ( String alias ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "setClientAlias" , new Object [ ] { alias } ) ; if ( ! ks . containsAlias ( alias ) ) { String keyFileName = config . getProperty ( Constants . SSLPROP_KEY_STORE ) ; String tokenLibraryFile = config . getProperty ( Constants . SSLPROP_TOKEN_LIBRARY ) ; String location = keyFileName != null ? keyFileName : tokenLibraryFile ; String message = TraceNLSHelper . getInstance ( ) . getFormattedMessage ( "ssl.client.alias.not.found.CWPKI0023E" , new Object [ ] { alias , location } , "Client alias " + alias + " not found in keystore." ) ; Tr . error ( tc , "ssl.client.alias.not.found.CWPKI0023E" , new Object [ ] { alias , location } ) ; throw new IllegalArgumentException ( message ) ; } this . clientAlias = alias ; if ( customKM != null && customKM instanceof KeyManagerExtendedInfo ) ( ( KeyManagerExtendedInfo ) customKM ) . setKeyStoreClientAlias ( alias ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "setClientAlias" ) ; }
Set the client alias value for the given slot number .
325
11
161,764
public String chooseClientAlias ( String keyType , Principal [ ] issuers ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "chooseClientAlias" , new Object [ ] { keyType , issuers } ) ; Map < String , Object > connectionInfo = JSSEHelper . getInstance ( ) . getOutboundConnectionInfo ( ) ; // if SSL client auth is disabled do not return a client alias if ( connectionInfo != null && Constants . ENDPOINT_IIOP . equals ( connectionInfo . get ( Constants . CONNECTION_INFO_ENDPOINT_NAME ) ) && ! SSLConfigManager . getInstance ( ) . isClientAuthenticationEnabled ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "chooseClientAlias: null" ) ; return null ; } else if ( clientAlias != null && ! clientAlias . equals ( "" ) ) { String [ ] list = km . getClientAliases ( keyType , issuers ) ; if ( list != null ) { boolean found = false ; for ( int i = 0 ; i < list . length && ! found ; i ++ ) { if ( clientAlias . equalsIgnoreCase ( list [ i ] ) ) found = true ; } if ( found ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "chooseClientAlias" , new Object [ ] { clientAlias } ) ; // JCERACFKS and JCECCARACFKS support mixed case, if we see that type, // do not lowercase the alias if ( ks . getType ( ) != null && ( ks . getType ( ) . equals ( Constants . KEYSTORE_TYPE_JCERACFKS ) || ks . getType ( ) . equals ( Constants . KEYSTORE_TYPE_JCECCARACFKS ) || ks . getType ( ) . equals ( Constants . KEYSTORE_TYPE_JCEHYBRIDRACFKS ) ) ) { return clientAlias ; } return clientAlias . toLowerCase ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "chooseClientAlias (default)" , new Object [ ] { clientAlias } ) ; // error case, alias not found in the list. return clientAlias ; } else { String [ ] keyArray = new String [ ] { keyType } ; String alias = km . chooseClientAlias ( keyArray , issuers , null ) ; // JCERACFKS and JCECCARACFKS support mixed case, if we see that type, do // not lowercase the alias if ( ks . getType ( ) != null && ( ! ks . getType ( ) . equals ( Constants . KEYSTORE_TYPE_JCERACFKS ) && ! ks . getType ( ) . equals ( Constants . KEYSTORE_TYPE_JCECCARACFKS ) && ! ks . getType ( ) . equals ( Constants . KEYSTORE_TYPE_JCEHYBRIDRACFKS ) ) ) { if ( alias != null ) { alias = alias . toLowerCase ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "chooseClientAlias (from JSSE)" , new Object [ ] { alias } ) ; return alias ; } }
Choose a client alias .
789
5
161,765
@ Override public String chooseEngineServerAlias ( String keyType , Principal [ ] issuers , SSLEngine engine ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "chooseEngineServerAlias" , new Object [ ] { keyType , issuers , engine } ) ; String rc = null ; if ( null != customKM && customKM instanceof X509ExtendedKeyManager ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "chooseEngineServerAlias, using customKM -> " + customKM . getClass ( ) . getName ( ) ) ; rc = ( ( X509ExtendedKeyManager ) customKM ) . chooseEngineServerAlias ( keyType , issuers , engine ) ; } else { rc = chooseServerAlias ( keyType , issuers ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "chooseEngineServerAlias: " + rc ) ; return rc ; }
Handshakes that use the SSLEngine and not an SSLSocket require this method from the extended X509KeyManager .
249
27
161,766
public X509KeyManager getX509KeyManager ( ) { if ( customKM != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getX509KeyManager -> " + customKM . getClass ( ) . getName ( ) ) ; return customKM ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getX509KeyManager -> " + km . getClass ( ) . getName ( ) ) ; return km ; }
Get the appropriate X509KeyManager for this instance .
132
11
161,767
protected static void getAlpnResult ( SSLEngine engine , SSLConnectionLink link ) { alpnNegotiator . tryToRemoveAlpnNegotiator ( link . getAlpnNegotiator ( ) , engine , link ) ; }
This must be called after the SSL handshake has completed . If an ALPN protocol was selected by the available provider that protocol will be set on the SSLConnectionLink . Also additional cleanup will be done for some ALPN providers .
52
45
161,768
void metadataProcessingInitialize ( ComponentNameSpaceConfiguration nameSpaceConfig ) { ivContext = ( InjectionProcessorContext ) nameSpaceConfig . getInjectionProcessorContext ( ) ; ivNameSpaceConfig = nameSpaceConfig ; // Following must be available after ivContext and ivNameSpaceConfig are cleared ivCheckAppConfig = nameSpaceConfig . isCheckApplicationConfiguration ( ) ; }
d730349 . 1
80
5
161,769
protected void mergeError ( Object oldValue , Object newValue , boolean xml , String elementName , boolean property , String key ) throws InjectionConfigurationException { JNDIEnvironmentRefType refType = getJNDIEnvironmentRefType ( ) ; String component = ivNameSpaceConfig . getDisplayName ( ) ; String module = ivNameSpaceConfig . getModuleName ( ) ; String application = ivNameSpaceConfig . getApplicationName ( ) ; String jndiName = getJndiName ( ) ; if ( xml ) { Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , component , module , application , elementName , refType . getXMLElementName ( ) , refType . getNameXMLElementName ( ) , jndiName , oldValue , newValue ) ; } else { Tr . error ( tc , "CONFLICTING_ANNOTATION_VALUES_CWNEN0054E" , component , module , application , elementName , ' ' + refType . getAnnotationShortName ( ) , refType . getNameAnnotationElementName ( ) , jndiName , oldValue , newValue ) ; } String exMsg ; if ( xml ) { exMsg = "The " + component + " component in the " + module + " module of the " + application + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + elementName + " element values exist for multiple " + refType . getXMLElementName ( ) + " elements with the same " + refType . getNameXMLElementName ( ) + " element value : " + jndiName + ". The conflicting " + elementName + " element values are " + oldValue + " and " + newValue + "." ; } else { exMsg = "The " + component + " component in the " + module + " module of the " + application + " application has conflicting configuration data" + " in source code annotations. Conflicting " + elementName + " attribute values exist for multiple @" + refType . getAnnotationShortName ( ) + " annotations with the same " + refType . getNameAnnotationElementName ( ) + " attribute value : " + jndiName + ". The conflicting " + elementName + " attribute values are " + oldValue + " and " + newValue + "." ; } throw new InjectionConfigurationException ( exMsg ) ; }
Indication that an error has occurred while merging an attribute value .
533
13
161,770
protected Boolean mergeAnnotationBoolean ( Boolean oldValue , boolean oldValueXML , boolean newValue , String elementName , boolean defaultValue ) throws InjectionConfigurationException { if ( newValue == defaultValue || oldValueXML ) { return oldValue ; } if ( isComplete ( ) ) { mergeError ( oldValue , newValue , false , elementName , false , elementName ) ; return oldValue ; } // Merge errors cannot occur for boolean attributes because there are // only two possible values: the default value, for which there is no way // to detect if it was explicitly specified, and the other value. So, if // any of the annotations specify the non-default value, we use it. return newValue ; }
Merges the value of a boolean annotation value .
153
10
161,771
protected Integer mergeAnnotationInteger ( Integer oldValue , boolean oldValueXML , int newValue , String elementName , int defaultValue , Map < Integer , String > valueNames ) throws InjectionConfigurationException { if ( newValue == defaultValue ) { return oldValue ; } if ( oldValueXML ) { return oldValue ; } if ( oldValue == null ? isComplete ( ) : ! oldValue . equals ( newValue ) ) { Object oldValueName = valueNames == null ? oldValue : valueNames . get ( oldValue ) ; Object newValueName = valueNames == null ? newValue : valueNames . get ( newValue ) ; mergeError ( oldValueName , newValueName , false , elementName , false , elementName ) ; return oldValue ; } return newValue ; }
Merges the value of an integer annotation value .
170
10
161,772
protected < T > T mergeAnnotationValue ( T oldValue , boolean oldValueXML , T newValue , String elementName , T defaultValue ) throws InjectionConfigurationException { if ( newValue . equals ( defaultValue ) || oldValueXML ) { // d663356 return oldValue ; } if ( oldValue == null ? isComplete ( ) : ! newValue . equals ( oldValue ) ) { mergeError ( oldValue , newValue , false , elementName , false , elementName ) ; return oldValue ; } return newValue ; }
Merges the value of a String or Enum annotation value .
118
13
161,773
protected < T > T mergeXMLValue ( T oldValue , T newValue , String elementName , String key , Map < T , String > valueNames ) throws InjectionConfigurationException { if ( newValue == null ) { return oldValue ; } if ( oldValue != null && ! newValue . equals ( oldValue ) ) { Object oldValueName = valueNames == null ? oldValue : valueNames . get ( oldValue ) ; Object newValueName = valueNames == null ? newValue : valueNames . get ( newValue ) ; mergeError ( oldValueName , newValueName , true , elementName , false , key ) ; return oldValue ; } return newValue ; }
Merges a value specified in XML .
146
8
161,774
protected Map < String , String > mergeXMLProperties ( Map < String , String > oldProperties , Set < String > oldXMLProperties , List < Property > properties ) throws InjectionConfigurationException { if ( ! properties . isEmpty ( ) ) { if ( oldProperties == null ) { oldProperties = new HashMap < String , String > ( ) ; } for ( Property property : properties ) { String name = property . getName ( ) ; String newValue = property . getValue ( ) ; Object oldValue = oldProperties . put ( name , newValue ) ; if ( oldValue != null && ! newValue . equals ( oldValue ) ) { mergeError ( oldValue , newValue , true , name + " property" , true , name ) ; continue ; } oldXMLProperties . add ( name ) ; } } return oldProperties ; }
Merges the properties specified in XML .
188
8
161,775
protected static < K , V > void addOrRemoveProperty ( Map < K , V > props , K key , V value ) { if ( value == null ) { // Generic properties have already been added to the map. Remove them // so they aren't confused with the builtin properties. props . remove ( key ) ; } else { props . put ( key , value ) ; } }
Add the specified property if the value is non - null or remove it from the map if it is null .
81
22
161,776
public Reference createDefinitionReference ( String bindingName , String type , Map < String , Object > properties ) throws InjectionException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) { Map < String , Object > traceProps = properties ; if ( traceProps . containsKey ( "password" ) ) { traceProps = new HashMap < String , Object > ( properties ) ; traceProps . put ( "password" , "********" ) ; } Tr . entry ( tc , "createDefinitionReference: bindingName=" + bindingName + ", type=" + type , traceProps ) ; } Reference ref ; try { InternalInjectionEngine injectionEngine = ( InternalInjectionEngine ) InjectionEngineAccessor . getInstance ( ) ; ref = injectionEngine . createDefinitionReference ( ivNameSpaceConfig , ivInjectionScope , getJndiName ( ) , bindingName , type , properties ) ; } catch ( Exception ex ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createDefinitionReference" , ex ) ; throw new InjectionException ( ex ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createDefinitionReference" , ref ) ; return ref ; }
Create a Reference to a resource definition .
294
8
161,777
public void setObjects ( Object injectionObject , Reference bindingObject ) throws InjectionException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setObjects" , injectionObject , bindingObjectToString ( bindingObject ) ) ; ivInjectedObject = injectionObject ; // d392996.3 if ( bindingObject != null ) { ivBindingObject = bindingObject ; ivObjectFactoryClassName = bindingObject . getFactoryClassName ( ) ; // F48603.4 if ( ivObjectFactoryClassName == null ) // F54050 { throw new IllegalArgumentException ( "expected non-null getFactoryClassName" ) ; } } else { ivBindingObject = injectionObject ; } }
Sets the object to use for injection and the Reference to use for binding . Usually the injection object is null .
178
23
161,778
public void setReferenceObject ( Reference bindingObject , Class < ? extends ObjectFactory > objectFactory ) throws InjectionException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "setReferenceObject" , bindingObjectToString ( bindingObject ) , objectFactory ) ; ivInjectedObject = null ; ivBindingObject = bindingObject ; ivObjectFactoryClass = objectFactory ; // F48603.4 ivObjectFactoryClassName = objectFactory . getName ( ) ; // F54050 }
F623 - 841 . 1
131
7
161,779
protected Object getInjectionObjectInstance ( Object targetObject , InjectionTargetContext targetContext ) throws Exception { ObjectFactory objectFactory = ivObjectFactory ; // volatile-read InjectionObjectFactory injObjFactory = ivInjectionObjectFactory ; if ( objectFactory == null ) { try { InternalInjectionEngine ie = InjectionEngineAccessor . getInternalInstance ( ) ; objectFactory = ie . getObjectFactory ( ivObjectFactoryClassName , ivObjectFactoryClass ) ; // F54050 if ( objectFactory instanceof InjectionObjectFactory ) // F49213.1 { injObjFactory = ( InjectionObjectFactory ) objectFactory ; ivInjectionObjectFactory = injObjFactory ; } ivObjectFactory = objectFactory ; // volatile-write } catch ( Throwable ex ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getInjectionObjectInstance" , ex ) ; Tr . error ( tc , "OBJECT_FACTORY_CLASS_FAILED_TO_LOAD_CWNEN0024E" , ivObjectFactoryClassName ) ; throw new InjectionException ( ex . toString ( ) , ex ) ; } } if ( injObjFactory != null ) // F49213.1 { return injObjFactory . getInjectionObjectInstance ( ( Reference ) getBindingObject ( ) , targetObject , targetContext ) ; } return objectFactory . getObjectInstance ( getBindingObject ( ) , null , null , null ) ; }
F48603 . 4
325
5
161,780
public final void setJndiName ( String jndiName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) && jndiName . length ( ) != 0 ) Tr . debug ( tc , "setJndiName: " + jndiName ) ; // Starting with Java EE 6, reference names may now start with java: and // then global, app, module, or comp. 'env' is optional, but recommended. // The set jndiName will always be the 'short' name, to make it consistent // to prior releases. "java:comp/" without the optional 'env' subcontext // will be treated specially and will be the full name. d662985.2 ivJndiName = InjectionScope . normalize ( jndiName ) ; // d726563 }
d367834 . 14 Ends
186
7
161,781
public void setInjectionClassType ( Class < ? > injectionClassType ) throws InjectionException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setInjectionClassType: " + injectionClassType ) ; // if the injection class type hasn't been set yet ( null from XML or // Object from annotations, the default) then set it. if ( ivInjectionClassType == null || ivInjectionClassType == Object . class ) { ivInjectionClassType = injectionClassType ; } // If the specified class is a sublcass of the current setting, then // replace it, otherwise insure it is compatible else { if ( ivInjectionClassType . isAssignableFrom ( injectionClassType ) ) { ivInjectionClassType = injectionClassType ; } else { if ( ! injectionClassType . isAssignableFrom ( ivInjectionClassType ) ) { // TODO : Currently this warning will be present for most // primitives... need to improve this method to // properly handle primitives, and throw an exception here! if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "WARNING: Class " + injectionClassType + " is not assignable from " + ivInjectionClassType ) ; } } } }
Set the InjectionClassType to be most fine grained injection target Class type .
293
17
161,782
public void setInjectionClassTypeName ( String name ) // F743-32443 { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setInjectionClassType: " + name ) ; if ( ivInjectionClassTypeName != null ) { throw new IllegalStateException ( "duplicate reference data for " + getJndiName ( ) ) ; } ivInjectionClassTypeName = name ; }
Sets the injection class type name . When class names are specified in XML rather than annotation sub - classes must call this method or override getInjectionClassTypeName in order to support callers of the injection engine that do not have a class loader .
106
51
161,783
public static boolean isClassesCompatible ( Class < ? > memberClass , Class < ? > injectClass ) { // If the class of the field or method is the injection // type or a parent of it, then the injection may occur. d433391 if ( memberClass . isAssignableFrom ( injectClass ) ) return true ; // TODO : Remove this hack when EJB injection is working properly // Currently for EJB injection from XML, the 'member' class is // is always set to 'Object'. d433391 if ( injectClass . isAssignableFrom ( memberClass ) ) return true ; // Otherwise, check to see if either is a primitive, and if so, // verify that the types are compatible. // TODO : this needs to handle where the primitive types are different // but may still be compatible... or one is an Object that // may be autoboxed to a primitive ..like Integer -> short return getPrimitiveClass ( memberClass ) == getPrimitiveClass ( injectClass ) ; }
Test if the input two classes are auto - boxing compatible .
215
12
161,784
public static Class < ? > mostSpecificClass ( Class < ? > classOne , Class < ? > classTwo ) { if ( classOne . isAssignableFrom ( classTwo ) ) { return classTwo ; // d479669 } else if ( classTwo . isAssignableFrom ( classOne ) ) { return classOne ; // d479669 } return null ; }
Returns the most most specific class to the caller . If the two classes are not compatible a null is returned .
80
22
161,785
public static String toStringSecure ( Annotation ann ) { Class < ? > annType = ann . annotationType ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( ' ' ) . append ( annType . getName ( ) ) . append ( ' ' ) ; boolean any = false ; for ( Method m : annType . getMethods ( ) ) { Object defaultValue = m . getDefaultValue ( ) ; if ( defaultValue != null ) { String name = m . getName ( ) ; Object value ; try { value = m . invoke ( ann ) ; if ( name . equals ( "password" ) && ! defaultValue . equals ( value ) ) { value = "********" ; } else if ( value instanceof Object [ ] ) { value = Arrays . toString ( ( Object [ ] ) value ) ; } else { value = String . valueOf ( value ) ; } } catch ( Throwable t ) { value = "<" + t + ">" ; } if ( any ) { sb . append ( ", " ) ; } else { any = true ; } sb . append ( name ) . append ( ' ' ) . append ( value ) ; } } return sb . append ( ' ' ) . toString ( ) ; }
Convert an annotation to a string but mask members named password .
273
13
161,786
@ Override @ FFDCIgnore ( Exception . class ) //manually logged protected int overQualLastAccessTimeUpdate ( BackedSession sess , long nowTime ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; String id = sess . getId ( ) ; int updateCount ; try { if ( trace && tc . isDebugEnabled ( ) ) tcInvoke ( tcSessionMetaCache , "get" , id ) ; synchronized ( sess ) { ArrayList < ? > oldValue = sessionMetaCache . get ( id ) ; if ( trace && tc . isDebugEnabled ( ) ) tcReturn ( tcSessionMetaCache , "get" , oldValue ) ; SessionInfo sessionInfo = oldValue == null ? null : new SessionInfo ( oldValue ) . clone ( ) ; long curAccessTime = sess . getCurrentAccessTime ( ) ; if ( sessionInfo == null || sessionInfo . getLastAccess ( ) != curAccessTime ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "session current access time: " + curAccessTime ) ; updateCount = 0 ; } else if ( sessionInfo . getLastAccess ( ) >= nowTime ) { // avoid setting last access when the cache already has a later time updateCount = 1 ; // be consistent with Statement.executeUpdate which returns 1 when the row matches but no changes are made } else { sessionInfo . setLastAccess ( nowTime ) ; ArrayList < ? > newValue = sessionInfo . getArrayList ( ) ; if ( trace && tc . isDebugEnabled ( ) ) tcInvoke ( tcSessionMetaCache , "replace" , id , oldValue , newValue ) ; boolean replaced = sessionMetaCache . replace ( id , oldValue , newValue ) ; if ( trace && tc . isDebugEnabled ( ) ) tcReturn ( tcSessionMetaCache , "replace" , replaced ) ; if ( replaced ) { sess . updateLastAccessTime ( nowTime ) ; updateCount = 1 ; } else { updateCount = 0 ; } } } } catch ( Exception ex ) { FFDCFilter . processException ( ex , "com.ibm.ws.session.store.cache.CacheHashMap.overQualLastAccessTimeUpdate" , "859" , this , new Object [ ] { sess } ) ; Tr . error ( tc , "ERROR_CACHE_ACCESS" , ex ) ; throw new RuntimeException ( Tr . formatMessage ( tc , "INTERNAL_SERVER_ERROR" ) ) ; } return updateCount ; }
Attempts to update the last access time ensuring the old value matches . This verifies that the copy we have in cache is still valid .
554
27
161,787
@ Trivial public static String typeToString ( MediaType type , List < String > ignoreParams ) { if ( type == null ) { throw new IllegalArgumentException ( "MediaType parameter is null" ) ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( type . getType ( ) ) . append ( ' ' ) . append ( type . getSubtype ( ) ) ; Map < String , String > params = type . getParameters ( ) ; if ( params != null ) { for ( Iterator < Map . Entry < String , String > > iter = params . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry < String , String > entry = iter . next ( ) ; if ( ignoreParams != null && ignoreParams . contains ( entry . getKey ( ) ) ) { continue ; } sb . append ( ' ' ) . append ( entry . getKey ( ) ) . append ( ' ' ) . append ( entry . getValue ( ) ) ; } } return sb . toString ( ) ; }
to the implementation
236
3
161,788
private static void createHandshakeInstance ( ) throws Exception { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createHandshakeInstance" ) ; try { instance = Class . forName ( MfpConstants . COMP_HANDSHAKE_CLASS ) . newInstance ( ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.mfp.CompHandshakeFactory.createHandshakeInstance" , "88" ) ; SibTr . error ( tc , "UNABLE_TO_CREATE_COMPHANDSHAKE_CWSIF0051" , e ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createHandshakeInstance" ) ; }
Create the singleton ComponentHandshake instance .
202
9
161,789
synchronized void setProperties ( Map < Object , Object > m ) throws ChannelFactoryPropertyIgnoredException { this . myProperties = m ; if ( cf != null ) { cf . updateProperties ( m ) ; } }
internally set the properties associated with this object
50
9
161,790
synchronized void setProperty ( Object key , Object value ) throws ChannelFactoryPropertyIgnoredException { if ( null == key ) { throw new ChannelFactoryPropertyIgnoredException ( "Ignored channel factory property key of null" ) ; } if ( myProperties == null ) { this . myProperties = new HashMap < Object , Object > ( ) ; } this . myProperties . put ( key , value ) ; if ( cf != null ) { cf . updateProperties ( myProperties ) ; } }
Iternally set a property associated with this object
110
9
161,791
synchronized void setChannelFactory ( ChannelFactory factory ) throws ChannelFactoryException { if ( factory != null && cf != null ) { throw new ChannelFactoryException ( "ChannelFactory already exists" ) ; } this . cf = factory ; }
Internally set the channel factory in this data object .
50
11
161,792
public void dissociate ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "dissociate" ) ; } if ( WSSecurityHelper . isServerSecurityEnabled ( ) ) { J2CSecurityHelper . removeRunAsSubject ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "dissociate" ) ; } }
This method is called by the WorkProxy class to dissociate the inflown SecurityContext from the workmanager thread after it has run the work By the time this method is called the WSSubject . doAs method call would have exited and the runAs subject would be dissociated . So all that is left to do here is to clear the ThreadLocal variable that is set with the runAs subject in the associate method .
110
86
161,793
public static void validateStatusAtInstanceRestart ( long jobInstanceId , Properties restartJobParameters ) throws JobRestartException , JobExecutionAlreadyCompleteException { IPersistenceManagerService iPers = ServicesManagerStaticAnchor . getServicesManager ( ) . getPersistenceManagerService ( ) ; WSJobInstance jobInstance = iPers . getJobInstance ( jobInstanceId ) ; Helper helper = new Helper ( jobInstance , restartJobParameters ) ; if ( ! StringUtils . isEmpty ( jobInstance . getJobXml ( ) ) ) { helper . validateRestartableFalseJobsDoNotRestart ( ) ; } helper . validateJobInstanceFailedOrStopped ( ) ; }
validates job is restart - able validates the jobInstance is in failed or stopped
149
17
161,794
protected void write ( WriteableLogRecord logRecord ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "write" , new Object [ ] { logRecord , this } ) ; // Retrieve the data stored within this data item. This will either come from // the cached in memory copy or retrieved from disk. byte [ ] data = this . getData ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing '" + data . length + "' bytes " + RLSUtils . toHexString ( data , RLSUtils . MAX_DISPLAY_BYTES ) ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing length field" ) ; logRecord . putInt ( data . length ) ; // If this data item is using the file backed storage method then we need // record details of the mapped storage buffer and offset within that buffer // where the data has been placed. If this is the first write call then the // information would currently be cached in memory. After this call has // executed further access will require the getData method to go to disk. // If this is a subsequent write call then the getData method will retrieve // the information from the current mapped byte buffer and position and // write it to the new mapped byte buffer and position. It will then cache // the new location details. if ( _storageMode == MultiScopeRecoveryLog . FILE_BACKED ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Updaing data location references" ) ; _filePosition = logRecord . position ( ) ; _logRecord = logRecord ; _data = null ; } if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Writing data field" ) ; logRecord . put ( data ) ; if ( ! _written ) { // This is the first time since creation of this object or reset of its internal // data (SingleData class only, setData method) that the write method has been // called. We know that the parent recoverable unit section is accounting for // this data items payload in its unwritten data size. Accordingly we need to // direct it to update this value. _rus . payloadWritten ( _dataSize + HEADER_SIZE ) ; } _written = true ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "write" ) ; }
Instructs this DataItem to write its data to the given WriteableLogRecord . The write involves writing the length of the data as an int followed by the data itself . The data is written at the log record s current position .
519
47
161,795
protected byte [ ] getData ( ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getData" , this ) ; byte [ ] data = _data ; if ( data != null ) { // There is data cached in memory. Simply use this directly. if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Cached data located" ) ; } else { if ( _storageMode == MultiScopeRecoveryLog . FILE_BACKED ) { // There is no data cached in memory - it must be retrieved from disk. if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "No cached data located. Attempting data retreival" ) ; // If there is no data cached in memory and we are operating in file // backed mode then retireve the data from disk. if ( _filePosition != UNWRITTEN ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Retrieving " + _dataSize + " bytes of data @ position " + _filePosition ) ; _logRecord . position ( _filePosition ) ; data = new byte [ _dataSize ] ; _logRecord . get ( data ) ; } else { // The data should have been stored on disk but the file position was not set. Return null // to the caller and allow them to handle this failure. if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Unable to retrieve data as file position is not set" ) ; } } else { // The data should have been cached in memory but was not found Return null to the caller and // allow them to handle this failure. if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "No cached data located" ) ; } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getData" , new Object [ ] { new Integer ( data . length ) , RLSUtils . toHexString ( data , RLSUtils . MAX_DISPLAY_BYTES ) } ) ; return data ; }
Returns the data encapsulated by this DataItem instance . If this DataItem is memory back the in memory copy of the data is always returned . If the DataItem is file backed and it has been written to disk the data is retrieved from disk and then returned .
448
53
161,796
private UserRegistry getActiveUserRegistry ( ) throws WSSecurityException { final String METHOD = "getUserRegistry" ; UserRegistry activeUserRegistry = null ; try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHOD + " securityServiceRef " + securityServiceRef ) ; } SecurityService ss = securityServiceRef . getService ( ) ; if ( ss == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHOD + " No SecurityService, returning null" ) ; } } else { UserRegistryService urs = ss . getUserRegistryService ( ) ; if ( urs == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHOD + " No UserRegistryService, returning null" ) ; } } else { if ( urs . isUserRegistryConfigured ( ) ) { com . ibm . ws . security . registry . UserRegistry userRegistry = urs . getUserRegistry ( ) ; activeUserRegistry = urs . getExternalUserRegistry ( userRegistry ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHOD + " Security enabled but no registry configured" ) ; } } } } } catch ( RegistryException e ) { String msg = "getUserRegistryWrapper failed due to an internal error: " + e . getMessage ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , msg , e ) ; } throw new WSSecurityException ( msg , e ) ; } return activeUserRegistry ; }
Returns the active UserRegistry . If the active user registry is an instance of com . ibm . ws . security . registry . UserRegistry then it will be wrapped . Otherwise if the active user registry is an instance of CustomUserRegistryWrapper then the underlying com . ibm . websphere . security . UserRegistry will be returned .
422
74
161,797
@ Override public synchronized UserTransaction getUserTransaction ( ) { // d367572.1 start if ( state == PRE_CREATE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Incorrect state: " + getStateName ( state ) ) ; throw new IllegalStateException ( getStateName ( state ) ) ; } // d367572.1 end return UserTransactionWrapper . INSTANCE ; // d631349 }
Get user transaction object that bean can use to demarcate transactions .
111
14
161,798
@ Override public Map < String , Object > getContextData ( ) { // Calling getContextData is not allowed from setSessionContext. if ( state == PRE_CREATE || state == DESTROYED ) { IllegalStateException ise ; ise = new IllegalStateException ( "SessionBean: getContextData " + "not allowed from state = " + getStateName ( state ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getContextData: " + ise ) ; throw ise ; } return super . getContextData ( ) ; }
F743 - 21028
139
6
161,799
protected void canBeRemoved ( ) throws RemoveException { ContainerTx tx = container . getCurrentContainerTx ( ) ; //d171654 //------------------------------------------------------------- // If there is no current transaction then we are removing a // TX_BEAN_MANAGED session bean outside of a transaction which // is correct. //------------------------------------------------------------- if ( tx == null ) { return ; } // Stateful beans cannot be removed in a global transaction, // unless this is an EJB 3.0 business method designated as a // removemethod d451675 if ( tx . isTransactionGlobal ( ) && tx . ivRemoveBeanO != this ) { throw new RemoveException ( "Cannot remove session bean " + "within a transaction." ) ; } }
Checks if beanO can be removed . Throws RemoveException if cannot be removed .
154
18