Input: Return the class hash code as specified in The Common Object Request Broker : Architecture and Specification ( 01 - 02 - 33 ) section 10 . 6 . 2 . [CODESPLIT] static long getClassHashCode ( Class cls ) { // The simple cases if ( cls . isInterface ( ) ) return 0 ; if ( ! Serializable . class . isAssignableFrom ( cls ) ) return 0 ; if ( Externalizable . class . isAssignableFrom ( cls ) ) return 1 ; // Try cache Long l = ( Long ) classHashCodeCache . get ( cls ) ; if ( l != null ) return l . longValue ( ) ; // Has to calculate the hash. ByteArrayOutputStream baos = new ByteArrayOutputStream ( 256 ) ; DataOutputStream dos = new DataOutputStream ( baos ) ; // Step 1 Class superClass = cls . getSuperclass ( ) ; if ( superClass != null && superClass != Object . class ) { try { dos . writeLong ( getClassHashCode ( superClass ) ) ; } catch ( IOException ex ) { throw IIOPLogger . ROOT_LOGGER . unexpectedException ( ex ) ; } } // Step 2 boolean hasWriteObject = false ; try { Method m ; int mods ; m = cls . getDeclaredMethod ( "writeObject" , new Class [ ] { ObjectOutputStream . class } ) ; mods = m . getModifiers ( ) ; if ( ! Modifier . isPrivate ( mods ) && ! Modifier . isStatic ( mods ) ) hasWriteObject = true ; } catch ( NoSuchMethodException ex ) { // ignore } try { dos . writeInt ( hasWriteObject ? 2 : 1 ) ; } catch ( IOException ex ) { throw IIOPLogger . ROOT_LOGGER . unexpectedException ( ex ) ; } // Step 3 Field [ ] fields = cls . getDeclaredFields ( ) ; SortedSet set = new TreeSet ( new FieldComparator ( ) ) ; for ( int i = 0 ; i < fields . length ; ++ i ) { int mods = fields [ i ] . getModifiers ( ) ; if ( ! Modifier . isStatic ( mods ) && ! Modifier . isTransient ( mods ) ) set . add ( fields [ i ] ) ; } Iterator iter = set . iterator ( ) ; try { while ( iter . hasNext ( ) ) { Field f = ( Field ) iter . next ( ) ; dos . writeUTF ( f . getName ( ) ) ; dos . writeUTF ( getSignature ( f . getType ( ) ) ) ; } } catch ( IOException ex ) { throw IIOPLogger . ROOT_LOGGER . unexpectedException ( ex ) ; } // Convert to byte[] try { dos . flush ( ) ; } catch ( IOException ex ) { throw IIOPLogger . ROOT_LOGGER . unexpectedException ( ex ) ; } byte [ ] bytes = baos . toByteArray ( ) ; // Calculate SHA digest MessageDigest digest ; try { digest = MessageDigest . getInstance ( "SHA" ) ; } catch ( NoSuchAlgorithmException ex ) { throw IIOPLogger . ROOT_LOGGER . unavailableSHADigest ( ex ) ; } digest . update ( bytes ) ; byte [ ] sha = digest . digest ( ) ; // Calculate hash as per section 10.6.2 long hash = 0 ; for ( int i = 0 ; i < Math . min ( 8 , sha . length ) ; i ++ ) { hash += ( long ) ( sha [ i ] & 255 ) << ( i * 8 ) ; } // Save in cache classHashCodeCache . put ( cls , new Long ( hash ) ) ; return hash ; }


Input: Calculate the signature of a class according to the Java VM specification section 4 . 3 . 2 . [CODESPLIT] private static String getSignature ( Class cls ) { if ( cls . isArray ( ) ) return "[" + cls . getComponentType ( ) ; if ( cls . isPrimitive ( ) ) { if ( cls == Byte . TYPE ) return "B" ; if ( cls == Character . TYPE ) return "C" ; if ( cls == Double . TYPE ) return "D" ; if ( cls == Float . TYPE ) return "F" ; if ( cls == Integer . TYPE ) return "I" ; if ( cls == Long . TYPE ) return "J" ; if ( cls == Short . TYPE ) return "S" ; if ( cls == Boolean . TYPE ) return "Z" ; throw IIOPLogger . ROOT_LOGGER . unknownPrimitiveType ( cls . getName ( ) ) ; } return "L" + cls . getName ( ) . replace ( ' ' , ' ' ) + ";" ; }


Input: Calculate the signature of a method according to the Java VM specification section 4 . 3 . 3 . [CODESPLIT] private static String getSignature ( Method method ) { StringBuffer b = new StringBuffer ( "(" ) ; Class [ ] parameterTypes = method . getParameterTypes ( ) ; for ( int i = 0 ; i < parameterTypes . length ; ++ i ) b . append ( getSignature ( parameterTypes [ i ] ) ) ; b . append ( ' ' ) . append ( getSignature ( method . getReturnType ( ) ) ) ; return b . toString ( ) ; }


Input: Handle mappings for primitive types as per section 1 . 3 . 3 . [CODESPLIT] static String primitiveTypeIDLName ( Class type ) { if ( type == Void . TYPE ) return "void" ; if ( type == Boolean . TYPE ) return "boolean" ; if ( type == Character . TYPE ) return "wchar" ; if ( type == Byte . TYPE ) return "octet" ; if ( type == Short . TYPE ) return "short" ; if ( type == Integer . TYPE ) return "long" ; if ( type == Long . TYPE ) return "long long" ; if ( type == Float . TYPE ) return "float" ; if ( type == Double . TYPE ) return "double" ; throw IIOPLogger . ROOT_LOGGER . notAPrimitive ( type . getName ( ) ) ; }


Input: Process a deployment for standard ra deployment files . Will parse the xml file and attach a configuration discovered during processing . [CODESPLIT] @ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final VirtualFile deploymentRoot = phaseContext . getDeploymentUnit ( ) . getAttachment ( Attachments . DEPLOYMENT_ROOT ) . getRoot ( ) ; process ( deploymentRoot ) ; }


Input: Get the permission with the given name . [CODESPLIT] public static BatchPermission forName ( final String name ) { Assert . checkNotNullParam ( "name" , name ) ; return "*" . equals ( name ) ? allPermission : mapping . getItemByString ( name ) ; }


Input: Binds the java : comp / UserTransaction service and the java : comp / TransactionSynchronizationRegistry [CODESPLIT] private void bindServices ( DeploymentUnit deploymentUnit , ServiceTarget serviceTarget , ServiceName contextServiceName ) { final ServiceName userTransactionServiceName = contextServiceName . append ( "UserTransaction" ) ; final UserTransactionBindingService userTransactionBindingService = new UserTransactionBindingService ( "UserTransaction" ) ; serviceTarget . addService ( userTransactionServiceName , userTransactionBindingService ) . addDependency ( UserTransactionAccessControlService . SERVICE_NAME , UserTransactionAccessControlService . class , userTransactionBindingService . getUserTransactionAccessControlServiceInjector ( ) ) . addDependency ( UserTransactionService . INTERNAL_SERVICE_NAME , UserTransaction . class , new ManagedReferenceInjector < UserTransaction > ( userTransactionBindingService . getManagedObjectInjector ( ) ) ) . addDependency ( contextServiceName , ServiceBasedNamingStore . class , userTransactionBindingService . getNamingStoreInjector ( ) ) . install ( ) ; final Map < ServiceName , Set < ServiceName > > jndiComponentDependencies = deploymentUnit . getAttachment ( org . jboss . as . server . deployment . Attachments . COMPONENT_JNDI_DEPENDENCIES ) ; Set < ServiceName > jndiDependencies = jndiComponentDependencies . get ( contextServiceName ) ; if ( jndiDependencies == null ) { jndiComponentDependencies . put ( contextServiceName , jndiDependencies = new HashSet <> ( ) ) ; } jndiDependencies . add ( userTransactionServiceName ) ; final ServiceName transactionSynchronizationRegistryName = contextServiceName . append ( "TransactionSynchronizationRegistry" ) ; BinderService transactionSyncBinderService = new BinderService ( "TransactionSynchronizationRegistry" ) ; serviceTarget . addService ( transactionSynchronizationRegistryName , transactionSyncBinderService ) . addDependency ( TransactionSynchronizationRegistryService . INTERNAL_SERVICE_NAME , TransactionSynchronizationRegistry . class , new ManagedReferenceInjector < TransactionSynchronizationRegistry > ( transactionSyncBinderService . getManagedObjectInjector ( ) ) ) . addDependency ( contextServiceName , ServiceBasedNamingStore . class , transactionSyncBinderService . getNamingStoreInjector ( ) ) . install ( ) ; jndiDependencies . add ( transactionSynchronizationRegistryName ) ; }


Input: { [CODESPLIT] @ Override public void readElement ( final XMLExtendedStreamReader reader , final List < ModelNode > operations ) throws XMLStreamException { final ModelNode ejb3SubsystemAddOperation = new ModelNode ( ) ; ejb3SubsystemAddOperation . get ( OP ) . set ( ADD ) ; ejb3SubsystemAddOperation . get ( OP_ADDR ) . add ( SUBSYSTEM , EJB3Extension . SUBSYSTEM_NAME ) ; operations . add ( ejb3SubsystemAddOperation ) ; // elements final EnumSet < EJB3SubsystemXMLElement > encountered = EnumSet . noneOf ( EJB3SubsystemXMLElement . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != XMLStreamConstants . END_ELEMENT ) { switch ( EJB3SubsystemNamespace . forUri ( reader . getNamespaceURI ( ) ) ) { case EJB3_1_1 : { final EJB3SubsystemXMLElement element = EJB3SubsystemXMLElement . forName ( reader . getLocalName ( ) ) ; if ( ! encountered . add ( element ) ) { throw unexpectedElement ( reader ) ; } switch ( element ) { case MDB : { // read <mdb> this . parseMDB ( reader , operations , ejb3SubsystemAddOperation ) ; break ; } case POOLS : { // read <pools> this . parsePools ( reader , operations ) ; break ; } case SESSION_BEAN : { // read <session-bean> this . parseSessionBean ( reader , operations , ejb3SubsystemAddOperation ) ; break ; } case TIMER_SERVICE : { parseTimerService ( reader , operations ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input:
Creates a new InjectionTarget for a given class . If the interceptionSupport flag is set to true the resulting instance will support interception ( support provided by Weld ) . If an InjectionTarget is created for a component where interception support is implemented through component s view ( EJBs managed beans ) the flag must be set to false . [CODESPLIT] public static < T > WeldInjectionTarget < T > createInjectionTarget ( Class < ? > componentClass , Bean < T > bean , BeanManagerImpl beanManager , boolean interceptionSupport ) { final ClassTransformer transformer = beanManager . getServices ( ) . get ( ClassTransformer . class ) ; @ SuppressWarnings ( "unchecked" ) final Class < T > clazz = ( Class < T > ) componentClass ; EnhancedAnnotatedType < T > type = transformer . getEnhancedAnnotatedType ( clazz , beanManager . getId ( ) ) ; if ( ! type . getJavaClass ( ) . equals ( componentClass ) ) { /*
             * Jasper loads a class with multiple classloaders which is not supported by Weld.
             * If this happens, use a combination of a bean archive identifier and class' classloader hashCode as the BDA ID.
             * This breaks AnnotatedType serialization but that does not matter as these are non-contextual components.
             */ final ClassLoader classLoader = WildFlySecurityManager . isChecking ( ) ? doPrivileged ( new GetClassLoaderAction ( componentClass ) ) : componentClass . getClassLoader ( ) ; final String bdaId = beanManager . getId ( ) + classLoader . hashCode ( ) ; type = transformer . getEnhancedAnnotatedType ( clazz , bdaId ) ; } if ( Beans . getBeanConstructor ( type ) == null ) { /*
             * For example, AsyncListeners may be CDI-incompatible as long as the application never calls javax.servletAsyncContext#createListener(Class)
             * and only instantiates the listener itself.
             */ return beanManager . getInjectionTargetFactory ( type ) . createNonProducibleInjectionTarget ( ) ; } WeldInjectionTargetBuilder < T > builder = beanManager . createInjectionTargetBuilder ( type ) ; builder . setBean ( bean ) ; builder . setResourceInjectionEnabled ( false ) ; // because these are all EE components where resource injection is not handled by Weld if ( interceptionSupport ) { return builder . build ( ) ; } else { // suppress interception/decoration because this is a component for which WF provides interception support return builder . setInterceptionEnabled ( false ) . setTargetClassLifecycleCallbacksEnabled ( false ) . setDecorationEnabled ( false ) . build ( ) ; } }


Input: { [CODESPLIT] public void getResourceValue ( final ResolutionContext resolutionContext , final ServiceBuilder < ? > serviceBuilder , final DeploymentPhaseContext phaseContext , final Injector < ManagedReferenceFactory > injector ) { injector . inject ( managedReferenceFactory ) ; }


Input: get or create a Transactional entity manager . Only call while a transaction is active in the current thread . [CODESPLIT] private EntityManager getOrCreateTransactionScopedEntityManager ( final EntityManagerFactory emf , final String scopedPuName , final Map properties , final SynchronizationType synchronizationType ) { EntityManager entityManager = TransactionUtil . getTransactionScopedEntityManager ( puScopedName , transactionSynchronizationRegistry ) ; if ( entityManager == null ) { entityManager = createEntityManager ( emf , properties , synchronizationType ) ; if ( ROOT_LOGGER . isDebugEnabled ( ) ) { ROOT_LOGGER . debugf ( "%s: created entity manager session %s" , TransactionUtil . getEntityManagerDetails ( entityManager , scopedPuName ) , TransactionUtil . getTransaction ( transactionManager ) . toString ( ) ) ; } TransactionUtil . registerSynchronization ( entityManager , scopedPuName , transactionSynchronizationRegistry , transactionManager ) ; TransactionUtil . putEntityManagerInTransactionRegistry ( scopedPuName , entityManager , transactionSynchronizationRegistry ) ; } else { testForMixedSynchronizationTypes ( emf , entityManager , puScopedName , synchronizationType , properties ) ; if ( ROOT_LOGGER . isDebugEnabled ( ) ) { ROOT_LOGGER . debugf ( "%s: reuse entity manager session already in tx %s" , TransactionUtil . getEntityManagerDetails ( entityManager , scopedPuName ) , TransactionUtil . getTransaction ( transactionManager ) . toString ( ) ) ; } } return entityManager ; }


Input: return true if non - tx invocations should defer detaching of entities until entity manager is closed . Note that this is an extension for compatibility with JBoss application server 5 . 0 / 6 . 0 ( see AS7 - 2781 ) [CODESPLIT] @ Override protected boolean deferEntityDetachUntilClose ( ) { if ( deferDetach == null ) deferDetach = ( true == Configuration . deferEntityDetachUntilClose ( emf . getProperties ( ) ) ? Boolean . TRUE : Boolean . FALSE ) ; return deferDetach . booleanValue ( ) ; }


Input: Returns <tt > true< / tt > if this map maps one or more keys to the specified value . Note : This method requires a full internal traversal of the hash table and so is much slower than method <tt > containsKey< / tt > . [CODESPLIT] public boolean containsValue ( Object value ) { if ( value == null ) throw new NullPointerException ( ) ; // See explanation of modCount use above final Segment < K , V > [ ] segments = this . segments ; int [ ] mc = new int [ segments . length ] ; // Try a few times without locking for ( int k = 0 ; k < RETRIES_BEFORE_LOCK ; ++ k ) { int mcsum = 0 ; for ( int i = 0 ; i < segments . length ; ++ i ) { mcsum += mc [ i ] = segments [ i ] . modCount ; if ( segments [ i ] . containsValue ( value ) ) return true ; } boolean cleanSweep = true ; if ( mcsum != 0 ) { for ( int i = 0 ; i < segments . length ; ++ i ) { if ( mc [ i ] != segments [ i ] . modCount ) { cleanSweep = false ; break ; } } } if ( cleanSweep ) return false ; } // Resort to locking all segments for ( int i = 0 ; i < segments . length ; ++ i ) segments [ i ] . lock ( ) ; boolean found = false ; try { for ( int i = 0 ; i < segments . length ; ++ i ) { if ( segments [ i ] . containsValue ( value ) ) { found = true ; break ; } } } finally { for ( int i = 0 ; i < segments . length ; ++ i ) segments [ i ] . unlock ( ) ; } return found ; }


Input: Maps the specified key to the specified value in this table . Neither the key nor the value can be null . [CODESPLIT] public V put ( K key , V value ) { if ( value == null ) throw new NullPointerException ( ) ; int hash = hashOf ( key ) ; return segmentFor ( hash ) . put ( key , hash , value , false ) ; }


Input:
Copies all of the mappings from the specified map to this one . These mappings replace any mappings that this map had for any of the keys currently in the specified map . [CODESPLIT] public void putAll ( Map < ? extends K , ? extends V > m ) { for ( Map . Entry < ? extends K , ? extends V > e : m . entrySet ( ) ) put ( e . getKey ( ) , e . getValue ( ) ) ; } /**
     * Removes the key (and its corresponding value) from this map.
     * This method does nothing if the key is not in the map.
     *
     * @param  key the key that needs to be removed
     * @return the previous value associated with <tt>key</tt>, or
     *         <tt>null</tt> if there was no mapping for <tt>key</tt>
     * @throws NullPointerException if the specified key is null
     */ public V remove ( Object key ) { int hash = hashOf ( key ) ; return segmentFor ( hash ) . remove ( key , hash , null , false ) ; } /**
     * {@inheritDoc}
     *
     * @throws NullPointerException if the specified key is null
     */ public boolean remove ( Object key , Object value ) { int hash = hashOf ( key ) ; if ( value == null ) return false ; return segmentFor ( hash ) . remove ( key , hash , value , false ) != null ; } /**
     * {@inheritDoc}
     *
     * @throws NullPointerException if any of the arguments are null
     */ public boolean replace  ( K key , V oldValue , V newValue ) { if ( oldValue == null || newValue == null ) throw new NullPointerException ( ) ; int hash = hashOf ( key ) ; return segmentFor ( hash ) . replace ( key , hash , oldValue , newValue ) ; } /**
     * {@inheritDoc}
     *
     * @return the previous value associated with the specified key,
     *         or <tt>null</tt> if there was no mapping for the key
     * @throws NullPointerException if the specified key or value is null
     */ public V replace  ( K key , V value ) { if ( value == null ) throw new NullPointerException ( ) ; int hash = hashOf ( key ) ; return segmentFor ( hash ) . replace ( key , hash , value ) ; } /**
     * Removes all of the mappings from this map.
     */ public void clear  ( ) { for ( int i = 0 ; i < segments . length ; ++ i ) segments [ i ] . clear ( ) ; } /**
     * Removes any stale entries whose keys have been finalized. Use of this
     * method is normally not necessary since stale entries are automatically
     * removed lazily, when blocking operations are required. However, there
     * are some cases where this operation should be performed eagerly, such
     * as cleaning up old references to a ClassLoader in a multi-classloader
     * environment.
     *
     * Note: this method will acquire locks, one at a time, across all segments
     * of this table, so if it is to be used, it should be used sparingly.
     */ public void purgeStaleEntries  ( ) { for ( int i = 0 ; i < segments . length ; ++ i ) segments [ i ] . removeStale ( ) ; } /**
     * Returns a {@link Set} view of the keys contained in this map.
     * The set is backed by the map, so changes to the map are
     * reflected in the set, and vice-versa.  The set supports element
     * removal, which removes the corresponding mapping from this map,
     * via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
     * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
     * operations.  It does not support the <tt>add</tt> or
     * <tt>addAll</tt> operations.
     *
     *
The view's <tt>iterator</tt> is a "weakly consistent" iterator
     * that will never throw {@link java.util.ConcurrentModificationException},
     * and guarantees to traverse elements as they existed upon
     * construction of the iterator, and may (but is not guaranteed to)
     * reflect any modifications subsequent to construction.
     */ public Set < K > keySet  ( ) { Set < K > ks = keySet ; return ( ks != null ) ? ks : ( keySet = new KeySet ( ) ) ; } /**
     * Returns a {@link Collection} view of the values contained in this map.
     * The collection is backed by the map, so changes to the map are
     * reflected in the collection, and vice-versa.  The collection
     * supports element removal, which removes the corresponding
     * mapping from this map, via the <tt>Iterator.remove</tt>,
     * <tt>Collection.remove</tt>, <tt>removeAll</tt>,
     * <tt>retainAll</tt>, and <tt>clear</tt> operations.  It does not
     * support the <tt>add</tt> or <tt>addAll</tt> operations.
     *
     *
The view's <tt>iterator</tt> is a "weakly consistent" iterator
     * that will never throw {@link java.util.ConcurrentModificationException},
     * and guarantees to traverse elements as they existed upon
     * construction of the iterator, and may (but is not guaranteed to)
     * reflect any modifications subsequent to construction.
     */ public Collection < V > values  ( ) { Collection < V > vs = values ; return ( vs != null ) ? vs : ( values = new Values ( ) ) ; } /**
     * Returns a {@link Set} view of the mappings contained in this map.
     * The set is backed by the map, so changes to the map are
     * reflected in the set, and vice-versa.  The set supports element
     * removal, which removes the corresponding mapping from the map,
     * via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
     * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
     * operations.  It does not support the <tt>add</tt> or
     * <tt>addAll</tt> operations.
     *
     *
The view's <tt>iterator</tt> is a "weakly consistent" iterator
     * that will never throw {@link java.util.ConcurrentModificationException},
     * and guarantees to traverse elements as they existed upon
     * construction of the iterator, and may (but is not guaranteed to)
     * reflect any modifications subsequent to construction.
     */ public Set < Map . Entry < K , V > > entrySet  ( ) { Set < Map . Entry < K , V > > es = entrySet ; return ( es != null ) ? es : ( entrySet = new EntrySet ( ) ) ; } /**
     * Returns an enumeration of the keys in this table.
     *
     * @return an enumeration of the keys in this table
     * @see #keySet()
     */ public Enumeration < K > keys  ( ) { return new KeyIterator ( ) ; } /**
     * Returns an enumeration of the values in this table.
     *
     * @return an enumeration of the values in this table
     * @see #values()
     */ public Enumeration < V > elements  ( ) { return new ValueIterator ( ) ; } /* ---------------- Iterator Support -------------- */ abstract class HashIterator { int nextSegmentIndex ; int nextTableIndex ; HashEntry < K , V > [ ] currentTable ; HashEntry < K , V > nextEntry ; HashEntry < K , V > lastReturned ; K currentKey ; // Strong reference to weak key (prevents gc) HashIterator ( ) { nextSegmentIndex = segments . length - 1 ; nextTableIndex = - 1 ; advance ( ) ; } public boolean hasMoreElements ( ) { return hasNext ( ) ; } final void advance ( ) { if ( nextEntry != null && ( nextEntry = nextEntry . next ) != null ) return ; while ( nextTableIndex >= 0 ) { if ( ( nextEntry = currentTable [ nextTableIndex -- ] ) != null ) return ; } while ( nextSegmentIndex >= 0 ) { Segment < K , V > seg = segments [ nextSegmentIndex -- ] ; if ( seg . count != 0 ) { currentTable = seg . table ; for ( int j = currentTable . length - 1 ; j >= 0 ; -- j ) { if ( ( nextEntry = currentTable [ j ] ) != null ) { nextTableIndex = j - 1 ; return ; } } } } } public boolean hasNext ( ) { while ( nextEntry != null ) { if ( nextEntry . key ( ) != null ) return true ; advance ( ) ; } return false ; } HashEntry < K , V > nextEntry ( ) { do { if ( nextEntry == null ) throw new NoSuchElementException ( ) ; lastReturned = nextEntry ; currentKey = lastReturned . key ( ) ; advance ( ) ; } while ( currentKey == null ) ; // Skip GC'd keys return lastReturned ; } public void remove ( ) { if ( lastReturned == null ) throw new IllegalStateException ( ) ; ConcurrentReferenceHashMap . this . remove ( currentKey ) ; lastReturned = null ; } } final class KeyIterator extends HashIterator implements Iterator < K > , Enumeration < K > { public K next ( ) { return super . nextEntry ( ) . key ( ) ; } public K nextElement ( ) { return super . nextEntry ( ) . key ( ) ; } } final class ValueIterator extends HashIterator implements Iterator < V > , Enumeration < V > { public V next ( ) { return super . nextEntry ( ) . value ( ) ; } public V nextElement ( ) { return super . nextEntry ( ) . value ( ) ; } } /*
      * This class is needed for JDK5 compatibility.
      */ static class SimpleEntry < K , V > implements Entry < K , V > , java . io . Serializable { private static final long serialVersionUID = - 8499721149061103585L ; private final K key ; private V value ; public SimpleEntry ( K key , V value ) { this . key = key ; this . value = value ; } public SimpleEntry ( Entry < ? extends K , ? extends V > entry ) { this . key = entry . getKey ( ) ; this . value = entry . getValue ( ) ; } public K getKey ( ) { return key ; } public V getValue ( ) { return value ; } public V setValue ( V value ) { V oldValue = this . value ; this . value = value ; return oldValue ; } public boolean equals ( Object o ) { if ( ! ( o instanceof Map . Entry ) ) return false ; Map . Entry < ? , ? > e = ( Map . Entry < ? , ? > ) o ; return eq ( key , e . getKey ( ) ) && eq ( value , e . getValue ( ) ) ; } public int hashCode ( ) { return ( key == null ? 0 : key . hashCode ( ) ) ^ ( value == null ? 0 : value . hashCode ( ) ) ; } public String toString ( ) { return key + "=" + value ; } private static boolean eq ( Object o1 , Object o2 ) { return o1 == null ? o2 == null : o1 . equals ( o2 ) ; } } /**
     * Custom Entry class used by EntryIterator.next(), that relays setValue
     * changes to the underlying map.
     */ final class WriteThroughEntry extends SimpleEntry < K , V > { private static final long serialVersionUID = - 7900634345345313646L ; WriteThroughEntry ( K k , V v ) { super ( k , v ) ; } /**
         * Set our entry's value and write through to the map. The
         * value to return is somewhat arbitrary here. Since a
         * WriteThroughEntry does not necessarily track asynchronous
         * changes, the most recent "previous" value could be
         * different from what we return (or could even have been
         * removed in which case the put will re-establish). We do not
         * and cannot guarantee more.
         */ public V setValue ( V value ) { if ( value == null ) throw new NullPointerException ( ) ; V v = super . setValue ( value ) ; ConcurrentReferenceHashMap . this . put ( getKey ( ) , value ) ; return v ; } } final class EntryIterator extends HashIterator implements Iterator < Entry < K , V > > { public Map . Entry < K , V > next ( ) { HashEntry < K , V > e = super . nextEntry ( ) ; return new WriteThroughEntry ( e . key ( ) , e . value ( ) ) ; } } final class KeySet extends AbstractSet < K > { public Iterator < K > iterator ( ) { return new KeyIterator ( ) ; } public int size ( ) { return ConcurrentReferenceHashMap . this . size ( ) ; } public boolean isEmpty ( ) { return ConcurrentReferenceHashMap . this . isEmpty ( ) ; } public boolean contains ( Object o ) { return ConcurrentReferenceHashMap . this . containsKey ( o ) ; } public boolean remove ( Object o ) { return ConcurrentReferenceHashMap . this . remove ( o ) != null ; } public void clear ( ) { ConcurrentReferenceHashMap . this . clear ( ) ; } } final class Values extends AbstractCollection < V > { public Iterator < V > iterator ( ) { return new ValueIterator ( ) ; } public int size ( ) { return ConcurrentReferenceHashMap . this . size ( ) ; } public boolean isEmpty ( ) { return ConcurrentReferenceHashMap . this . isEmpty ( ) ; } public boolean contains ( Object o ) { return ConcurrentReferenceHashMap . this . containsValue ( o ) ; } public void clear ( ) { ConcurrentReferenceHashMap . this . clear ( ) ; } } final class EntrySet extends AbstractSet < Map . Entry < K , V > > { public Iterator < Map . Entry < K , V > > iterator ( ) { return new EntryIterator ( ) ; } public boolean contains ( Object o ) { if ( ! ( o instanceof Map . Entry ) ) return false ; Map . Entry < ? , ? > e = ( Map . Entry < ? , ? > ) o ; V v = ConcurrentReferenceHashMap . this . get ( e . getKey ( ) ) ; return v != null && v . equals ( e . getValue ( ) ) ; } public boolean remove ( Object o ) { if ( ! ( o instanceof Map . Entry ) ) return false ; Map . Entry < ? , ? > e = ( Map . Entry < ? , ? > ) o ; return ConcurrentReferenceHashMap . this . remove ( e . getKey ( ) , e . getValue ( ) ) ; } public int size ( ) { return ConcurrentReferenceHashMap . this . size ( ) ; } public boolean isEmpty ( ) { return ConcurrentReferenceHashMap . this . isEmpty ( ) ; } public void clear ( ) { ConcurrentReferenceHashMap . this . clear ( ) ; } } /* ---------------- Serialization Support -------------- */ /**
     * Save the state of the <tt>ConcurrentReferenceHashMap</tt> instance to a
     * stream (i.e., serialize it).
     * @param s the stream
     * @serialData
     * the key (Object) and value (Object)
     * for each key-value mapping, followed by a null pair.
     * The key-value mappings are emitted in no particular order.
     */ private void writeObject  ( java . io . ObjectOutputStream s ) throws IOException { s . defaultWriteObject ( ) ; for ( int k = 0 ; k < segments . length ; ++ k ) { Segment < K , V > seg = segments [ k ] ; seg . lock ( ) ; try { HashEntry < K , V > [ ] tab = seg . table ; for ( int i = 0 ; i < tab . length ; ++ i ) { for ( HashEntry < K , V > e = tab [ i ] ; e != null ; e = e . next ) { K key = e . key ( ) ; if ( key == null ) // Skip GC'd keys continue ; s . writeObject ( key ) ; s . writeObject ( e . value ( ) ) ; } } } finally { seg . unlock ( ) ; } } s . writeObject ( null ) ; s . writeObject ( null ) ; } /**
     * Reconstitute the <tt>ConcurrentReferenceHashMap</tt> instance from a
     * stream (i.e., deserialize it).
     * @param s the stream
     */ @ SuppressWarnings ( "unchecked" ) private void readObject  ( java . io . ObjectInputStream s ) throws IOException , ClassNotFoundException { s . defaultReadObject ( ) ; // Initialize each segment to be minimally sized, and let grow. for ( int i = 0 ; i < segments . length ; ++ i ) { segments [ i ] . setTable ( new HashEntry [ 1 ] ) ; } // Read the keys and values, and put the mappings in the table for ( ; ; ) { K key = ( K ) s . readObject ( ) ; V value = ( V ) s . readObject ( ) ; if ( key == null ) break ; put ( key , value ) ; } } }


Input: Utility for converting camel case based ActiveMQ formats to WildFly standards . [CODESPLIT] static ModelNode convertSecurityRole ( final ModelNode camelCase ) { final ModelNode result = new ModelNode ( ) ; result . setEmptyList ( ) ; if ( camelCase . isDefined ( ) ) { for ( ModelNode role : camelCase . asList ( ) ) { final ModelNode roleNode = result . add ( ) ; for ( Property prop : role . asPropertyList ( ) ) { String key = prop . getName ( ) ; if ( "createDurableQueue" . equals ( key ) ) { key = SecurityRoleDefinition . CREATE_DURABLE_QUEUE . getName ( ) ; } else if ( "deleteDurableQueue" . equals ( key ) ) { key = SecurityRoleDefinition . DELETE_DURABLE_QUEUE . getName ( ) ; } else if ( "createNonDurableQueue" . equals ( key ) ) { key = SecurityRoleDefinition . CREATE_NON_DURABLE_QUEUE . getName ( ) ; } else if ( "deleteNonDurableQueue" . equals ( key ) ) { key = SecurityRoleDefinition . DELETE_NON_DURABLE_QUEUE . getName ( ) ; } roleNode . get ( key ) . set ( prop . getValue ( ) ) ; } } } return result ; }


Input: Consider the uninstalls . <p / > This method is here to be able to override the behavior after installs failed . e . g . perhaps only running uninstalls from the index . <p / > By default we run all uninstalls in the case at least one install failed . [CODESPLIT] protected void considerUninstalls ( List < Joinpoint > uninstalls , int index ) { if ( uninstalls == null ) return ; for ( int j = Math . min ( index , uninstalls . size ( ) - 1 ) ; j >= 0 ; j -- ) { try { uninstalls . get ( j ) . dispatch ( ) ; } catch ( Throwable t ) { PojoLogger . ROOT_LOGGER . ignoreUninstallError ( uninstalls . get ( j ) , t ) ; } } }


Input: Analyze the given class and return the analysis . public static ClassAnalysis getClassAnalysis ( Class cls ) throws RMIIIOPViolationException { if ( cls == null ) throw new IllegalArgumentException ( Cannot analyze NULL class . ) ; if ( cls == java . lang . String . class || cls == java . lang . Object . class || cls == java . lang . Class . class || cls == java . io . Serializable . class || cls == java . io . Externalizable . class || cls == java . rmi . Remote . class ) throw new IllegalArgumentException ( Cannot analyze special class : + cls . getName () ) ; <p / > if ( cls . isPrimitive () ) return PrimitiveAnalysis . getPrimitiveAnalysis ( cls ) ; <p / > <p / > if ( cls . isInterface () && java . rmi . Remote . class . isAssignableFrom ( cls )) return InterfaceAnalysis . getInterfaceAnalysis ( cls ) ; // TODO throw new RuntimeException ( ClassAnalysis . getClassAnalysis () TODO ) ; } [CODESPLIT] private static String javaNameOfClass ( Class cls ) { if ( cls == null ) throw IIOPLogger . ROOT_LOGGER . cannotAnalyzeNullClass ( ) ; String s = cls . getName ( ) ; return s . substring ( s . lastIndexOf ( ' ' ) + 1 ) ; }


Input: Returns either the loaded entity or the most recent version of the entity that has been persisted in this transaction . [CODESPLIT] private TimerImpl mostRecentEntityVersion ( final TimerImpl timerImpl ) { try { final int status = ContextTransactionManager . getInstance ( ) . getStatus ( ) ; if ( status == Status . STATUS_UNKNOWN || status == Status . STATUS_NO_TRANSACTION ) { return timerImpl ; } final String key = timerTransactionKey ( timerImpl ) ; TimerImpl existing = ( TimerImpl ) transactionSynchronizationRegistry . getValue ( ) . getResource ( key ) ; return existing != null ? existing : timerImpl ; } catch ( SystemException e ) { throw new RuntimeException ( e ) ; } }


Input: Gets the timer map loading from the persistent store if necessary . Should be called under lock [CODESPLIT] private Map < String , TimerImpl > getTimers ( final String timedObjectId , final TimerServiceImpl timerService ) { return loadTimersFromFile ( timedObjectId , timerService ) ; }


Input: Gets the directory for a given timed object making sure it exists . [CODESPLIT] private String getDirectory ( String timedObjectId ) { String dirName = directories . get ( timedObjectId ) ; if ( dirName == null ) { dirName = baseDir . getAbsolutePath ( ) + File . separator + timedObjectId . replace ( File . separator , "-" ) ; File file = new File ( dirName ) ; if ( ! file . exists ( ) ) { if ( ! file . mkdirs ( ) ) { EJB3_TIMER_LOGGER . failToCreateDirectoryForPersistTimers ( file ) ; } } directories . put ( timedObjectId , dirName ) ; } return dirName ; }


Input: Process a deployment for JbossService configuration . Will install a { @code JBossService } for each configured service . [CODESPLIT] @ Override public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final JBossServiceXmlDescriptor serviceXmlDescriptor = deploymentUnit . getAttachment ( JBossServiceXmlDescriptor . ATTACHMENT_KEY ) ; if ( serviceXmlDescriptor == null ) { // Skip deployments without a service xml descriptor return ; } // assert module final Module module = deploymentUnit . getAttachment ( Attachments . MODULE ) ; if ( module == null ) throw SarLogger . ROOT_LOGGER . failedToGetAttachment ( "module" , deploymentUnit ) ; // assert reflection index final DeploymentReflectionIndex reflectionIndex = deploymentUnit . getAttachment ( Attachments . REFLECTION_INDEX ) ; if ( reflectionIndex == null ) throw SarLogger . ROOT_LOGGER . failedToGetAttachment ( "reflection index" , deploymentUnit ) ; // install services final ClassLoader classLoader = module . getClassLoader ( ) ; final List < JBossServiceConfig > serviceConfigs = serviceXmlDescriptor . getServiceConfigs ( ) ; final ServiceTarget target = phaseContext . getServiceTarget ( ) ; final Map < String , ServiceComponentInstantiator > serviceComponents = deploymentUnit . getAttachment ( ServiceAttachments . SERVICE_COMPONENT_INSTANTIATORS ) ; for ( final JBossServiceConfig serviceConfig : serviceConfigs ) { addServices ( target , serviceConfig , classLoader , reflectionIndex , serviceComponents != null ? serviceComponents . get ( serviceConfig . getName ( ) ) : null , phaseContext ) ; } }


Input: creates and returns a { @link Sanitizer } instance that only operates on files that end with a { @code . properties } suffix . [CODESPLIT] public static Sanitizer pattern ( String pattern , String replacement ) throws Exception { return new PatternSanitizer ( pattern , replacement , Filters . suffix ( ".properties" ) ) ; }


Input: { [CODESPLIT] @ Override public void registerAttributes ( ManagementResourceRegistration resourceRegistration ) { ReloadRequiredWriteAttributeHandler reloadWrtiteHandler = new ReloadRequiredWriteAttributeHandler ( JNDI_NAME , CM_TABLE_NAME , CM_TABLE_BATCH_SIZE , CM_TABLE_IMMEDIATE_CLEANUP ) ; resourceRegistration . registerReadWriteAttribute ( CM_TABLE_NAME , null , reloadWrtiteHandler ) ; resourceRegistration . registerReadWriteAttribute ( CM_TABLE_BATCH_SIZE , null , reloadWrtiteHandler ) ; resourceRegistration . registerReadWriteAttribute ( CM_TABLE_IMMEDIATE_CLEANUP , null , reloadWrtiteHandler ) ; //This comes from the address resourceRegistration . registerReadOnlyAttribute ( JNDI_NAME , ReadResourceNameOperationStepHandler . INSTANCE ) ; }


Input: Returns true if the passed <code > exceptionClass< / code > is an application exception . Else returns false . [CODESPLIT] private boolean isApplicationException ( final EJBComponent ejbComponent , final Class < ? > exceptionClass , final Method invokedMethod ) { return ejbComponent . getApplicationException ( exceptionClass , invokedMethod ) != null ; }


Input: Add a listener to the coordinator with a given target name and event scope . This information is used when an event is fired to determine whether or not to fire this listener . [CODESPLIT] synchronized void addListener ( final String target , final int scope , final NamingListener namingListener ) { final TargetScope targetScope = new TargetScope ( target , scope ) ; // Do we have a holder for this listener ListenerHolder holder = holdersByListener . get ( namingListener ) ; if ( holder == null ) { holder = new ListenerHolder ( namingListener , targetScope ) ; final Map < NamingListener , ListenerHolder > byListenerCopy = new FastCopyHashMap < NamingListener , ListenerHolder > ( holdersByListener ) ; byListenerCopy . put ( namingListener , holder ) ; holdersByListener = byListenerCopy ; } else { holder . addTarget ( targetScope ) ; } List < ListenerHolder > holdersForTarget = holdersByTarget . get ( targetScope ) ; if ( holdersForTarget == null ) { holdersForTarget = new CopyOnWriteArrayList < ListenerHolder > ( ) ; final Map < TargetScope , List < ListenerHolder > > byTargetCopy = new FastCopyHashMap < TargetScope , List < ListenerHolder > > ( holdersByTarget ) ; byTargetCopy . put ( targetScope , holdersForTarget ) ; holdersByTarget = byTargetCopy ; } holdersForTarget . add ( holder ) ; }


Input: Remove a listener . Will remove it from all target mappings . Once this method returns the listener will no longer receive any events . [CODESPLIT] synchronized void removeListener ( final NamingListener namingListener ) { // Do we have a holder for this listener final ListenerHolder holder = holdersByListener . get ( namingListener ) ; if ( holder == null ) { return ; } final Map < NamingListener , ListenerHolder > byListenerCopy = new FastCopyHashMap < NamingListener , ListenerHolder > ( holdersByListener ) ; byListenerCopy . remove ( namingListener ) ; holdersByListener = byListenerCopy ; final Map < TargetScope , List < ListenerHolder > > byTargetCopy = new FastCopyHashMap < TargetScope , List < ListenerHolder > > ( holdersByTarget ) ; for ( TargetScope targetScope : holder . targets ) { final List < ListenerHolder > holders = holdersByTarget . get ( targetScope ) ; holders . remove ( holder ) ; if ( holders . isEmpty ( ) ) { byTargetCopy . remove ( targetScope ) ; } } holdersByTarget = byTargetCopy ; }


Input: Fire a naming event . An event will be created with the provided information and sent to each listener that matches the target and scope information . [CODESPLIT] void fireEvent ( final EventContext context , final Name name , final Binding existingBinding , final Binding newBinding , int type , final String changeInfo , final Integer ... scopes ) { final String target = name . toString ( ) ; final Set < Integer > scopeSet = new HashSet < Integer > ( Arrays . asList ( scopes ) ) ; final NamingEvent event = new NamingEvent ( context , type , newBinding , existingBinding , changeInfo ) ; final Set < ListenerHolder > holdersToFire = new HashSet < ListenerHolder > ( ) ; // Check for OBJECT_SCOPE based listeners if ( scopeSet . contains ( EventContext . OBJECT_SCOPE ) ) { final TargetScope targetScope = new TargetScope ( target , EventContext . OBJECT_SCOPE ) ; final List < ListenerHolder > holders = holdersByTarget . get ( targetScope ) ; if ( holders != null ) { for ( ListenerHolder holder : holders ) { holdersToFire . add ( holder ) ; } } } // Check for ONELEVEL_SCOPE based listeners if ( scopeSet . contains ( EventContext . ONELEVEL_SCOPE ) && ! name . isEmpty ( ) ) { final TargetScope targetScope = new TargetScope ( name . getPrefix ( name . size ( ) - 1 ) . toString ( ) , EventContext . ONELEVEL_SCOPE ) ; final List < ListenerHolder > holders = holdersByTarget . get ( targetScope ) ; if ( holders != null ) { for ( ListenerHolder holder : holders ) { holdersToFire . add ( holder ) ; } } } // Check for SUBTREE_SCOPE based listeners if ( scopeSet . contains ( EventContext . SUBTREE_SCOPE ) && ! name . isEmpty ( ) ) { for ( int i = 1 ; i < name . size ( ) ; i ++ ) { final Name parentName = name . getPrefix ( i ) ; final TargetScope targetScope = new TargetScope ( parentName . toString ( ) , EventContext . SUBTREE_SCOPE ) ; final List < ListenerHolder > holders = holdersByTarget . get ( targetScope ) ; if ( holders != null ) { for ( ListenerHolder holder : holders ) { holdersToFire . add ( holder ) ; } } } } executor . execute ( new FireEventTask ( holdersToFire , event ) ) ; }


Input: Returns a consumer that closes its input . [CODESPLIT] public static < T extends AutoCloseable > Consumer < T > close ( ) { return value -> { try { value . close ( ) ; } catch ( Throwable e ) { ClusteringLogger . ROOT_LOGGER . failedToClose ( e , value ) ; } } ; }


Input: { [CODESPLIT] public Subject createSubject ( ) { // If a authenticationContext was defined on the subsystem use that context, otherwise use capture the current // configuration. final Subject subject = this . createSubject ( getAuthenticationContext ( ) ) ; if ( ROOT_LOGGER . isTraceEnabled ( ) ) { ROOT_LOGGER . subject ( subject , Integer . toHexString ( System . identityHashCode ( subject ) ) ) ; } return subject ; }


Input: { [CODESPLIT] public Subject createSubject ( final String authenticationContextName ) { AuthenticationContext context ; if ( authenticationContextName != null && ! authenticationContextName . isEmpty ( ) ) { final ServiceContainer container = this . currentServiceContainer ( ) ; final ServiceName authContextServiceName = AUTHENTICATION_CONTEXT_RUNTIME_CAPABILITY . getCapabilityServiceName ( authenticationContextName ) ; context = ( AuthenticationContext ) container . getRequiredService ( authContextServiceName ) . getValue ( ) ; } else { context = getAuthenticationContext ( ) ; } final Subject subject = this . createSubject ( context ) ; if ( ROOT_LOGGER . isTraceEnabled ( ) ) { ROOT_LOGGER . subject ( subject , Integer . toHexString ( System . identityHashCode ( subject ) ) ) ; } return subject ; }


Input: Create a { @link Subject } with the principal and password credential obtained from the authentication configuration that matches the target { @link URI } . [CODESPLIT] private Subject createSubject ( final AuthenticationContext authenticationContext ) { final AuthenticationConfiguration configuration = AUTH_CONFIG_CLIENT . getAuthenticationConfiguration ( this . targetURI , authenticationContext ) ; final CallbackHandler handler = AUTH_CONFIG_CLIENT . getCallbackHandler ( configuration ) ; final NameCallback nameCallback = new NameCallback ( "Username: " ) ; final PasswordCallback passwordCallback = new PasswordCallback ( "Password: " , false ) ; final CredentialCallback credentialCallback = new CredentialCallback ( GSSKerberosCredential . class ) ; try { handler . handle ( new Callback [ ] { nameCallback , passwordCallback , credentialCallback } ) ; Subject subject = new Subject ( ) ; // if a GSSKerberosCredential was found, add the enclosed GSSCredential and KerberosTicket to the private set in the Subject. if ( credentialCallback . getCredential ( ) != null ) { GSSKerberosCredential kerberosCredential = GSSKerberosCredential . class . cast ( credentialCallback . getCredential ( ) ) ; this . addPrivateCredential ( subject , kerberosCredential . getKerberosTicket ( ) ) ; this . addPrivateCredential ( subject , kerberosCredential . getGssCredential ( ) ) ; // use the GSSName to build a kerberos principal and set it in the Subject. GSSName gssName = kerberosCredential . getGssCredential ( ) . getName ( ) ; subject . getPrincipals ( ) . add ( new KerberosPrincipal ( gssName . toString ( ) ) ) ; } // use the name from the callback, if available, to build a principal and set it in the Subject. if ( nameCallback . getName ( ) != null ) { subject . getPrincipals ( ) . add ( new NamePrincipal ( nameCallback . getName ( ) ) ) ; } // use the password from the callback, if available, to build a credential and set it as a private credential in the Subject. if ( passwordCallback . getPassword ( ) != null ) { this . addPrivateCredential ( subject , new PasswordCredential ( nameCallback . getName ( ) , passwordCallback . getPassword ( ) ) ) ; } return subject ; } catch ( Exception e ) { throw new SecurityException ( e ) ; } }


Input: Get a reference to the current { @link ServiceContainer } . [CODESPLIT] private ServiceContainer currentServiceContainer ( ) { if ( WildFlySecurityManager . isChecking ( ) ) { return AccessController . doPrivileged ( CurrentServiceContainer . GET_ACTION ) ; } return CurrentServiceContainer . getServiceContainer ( ) ; }


Input: Add the specified credential to the subject s private credentials set . [CODESPLIT] private void addPrivateCredential ( final Subject subject , final Object credential ) { if ( ! WildFlySecurityManager . isChecking ( ) ) { subject . getPrivateCredentials ( ) . add ( credential ) ; } else { AccessController . doPrivileged ( ( PrivilegedAction < Void > ) ( ) -> { subject . getPrivateCredentials ( ) . add ( credential ) ; return null ; } ) ; } }


Input: --- // [CODESPLIT] protected static AgroalConnectionFactoryConfigurationSupplier connectionFactoryConfiguration ( OperationContext context , ModelNode model ) throws OperationFailedException { AgroalConnectionFactoryConfigurationSupplier configuration = new AgroalConnectionFactoryConfigurationSupplier ( ) ; if ( AbstractDataSourceDefinition . URL_ATTRIBUTE . resolveModelAttribute ( context , model ) . isDefined ( ) ) { configuration . jdbcUrl ( AbstractDataSourceDefinition . URL_ATTRIBUTE . resolveModelAttribute ( context , model ) . asString ( ) ) ; } if ( AbstractDataSourceDefinition . NEW_CONNECTION_SQL_ATTRIBUTE . resolveModelAttribute ( context , model ) . isDefined ( ) ) { configuration . initialSql ( AbstractDataSourceDefinition . NEW_CONNECTION_SQL_ATTRIBUTE . resolveModelAttribute ( context , model ) . asString ( ) ) ; } if ( AbstractDataSourceDefinition . TRANSACTION_ISOLATION_ATTRIBUTE . resolveModelAttribute ( context , model ) . isDefined ( ) ) { configuration . jdbcTransactionIsolation ( TransactionIsolation . valueOf ( AbstractDataSourceDefinition . TRANSACTION_ISOLATION_ATTRIBUTE . resolveModelAttribute ( context , model ) . asString ( ) ) ) ; } if ( AbstractDataSourceDefinition . CONNECTION_PROPERTIES_ATTRIBUTE . resolveModelAttribute ( context , model ) . isDefined ( ) ) { for ( Property jdbcProperty : AbstractDataSourceDefinition . CONNECTION_PROPERTIES_ATTRIBUTE . resolveModelAttribute ( context , model ) . asPropertyList ( ) ) { configuration . jdbcProperty ( jdbcProperty . getName ( ) , jdbcProperty . getValue ( ) . asString ( ) ) ; } } if ( AbstractDataSourceDefinition . USERNAME_ATTRIBUTE . resolveModelAttribute ( context , model ) . isDefined ( ) ) { configuration . principal ( new NamePrincipal ( AbstractDataSourceDefinition . USERNAME_ATTRIBUTE . resolveModelAttribute ( context , model ) . asString ( ) ) ) ; } if ( AbstractDataSourceDefinition . PASSWORD_ATTRIBUTE . resolveModelAttribute ( context , model ) . isDefined ( ) ) { configuration . credential ( new SimplePassword ( AbstractDataSourceDefinition . PASSWORD_ATTRIBUTE . resolveModelAttribute ( context , model ) . asString ( ) ) ) ; } return configuration ; }


Input: --- // [CODESPLIT] private static AgroalDataSource getDataSource ( OperationContext context ) throws OperationFailedException { ServiceRegistry registry = context . getServiceRegistry ( false ) ; String dataSourceName = context . getCurrentAddressValue ( ) ; switch ( context . getCurrentAddress ( ) . getLastElement ( ) . getKey ( ) ) { case DataSourceOperations . DATASOURCE_SERVICE_NAME : ServiceController < ? > controller = registry . getRequiredService ( AbstractDataSourceDefinition . DATA_SOURCE_CAPABILITY . getCapabilityServiceName ( dataSourceName ) ) ; return ( ( AgroalDataSource ) controller . getValue ( ) ) ; case XADataSourceOperations . XADATASOURCE_SERVICE_NAME : ServiceController < ? > xaController = registry . getRequiredService ( AbstractDataSourceDefinition . DATA_SOURCE_CAPABILITY . getCapabilityServiceName ( dataSourceName ) ) ; return ( ( AgroalDataSource ) xaController . getValue ( ) ) ; default : throw AgroalLogger . SERVICE_LOGGER . unknownDatasourceServiceType ( context . getCurrentAddress ( ) . getLastElement ( ) . getKey ( ) ) ; } }


Input: { [CODESPLIT] public Object processInvocation ( final InterceptorContext context ) throws Exception { try { return context . proceed ( ) ; } finally { final ManagedReference managedReference = ( ManagedReference ) context . getPrivateData ( ComponentInstance . class ) . getInstanceData ( contextKey ) ; if ( managedReference != null ) { managedReference . release ( ) ; } } }


Input: Create an object factory . If the object parameter is a reference it will attempt to create an { @link javax . naming . spi . ObjectFactory } from the reference . If the parameter is not a reference or the reference does not create an { @link javax . naming . spi . ObjectFactory } it will return { @code this } as the { @link javax . naming . spi . ObjectFactory } to use . [CODESPLIT] public ObjectFactory createObjectFactory ( final Object obj , Hashtable < ? , ? > environment ) throws NamingException { try { if ( obj instanceof Reference ) { return factoryFromReference ( ( Reference ) obj , environment ) ; } } catch ( Throwable ignored ) { } return this ; }


Input: Create an object instance . [CODESPLIT] public Object getObjectInstance ( final Object ref , final Name name , final Context nameCtx , final Hashtable < ? , ? > environment ) throws Exception { final ClassLoader classLoader = WildFlySecurityManager . getCurrentContextClassLoaderPrivileged ( ) ; if ( classLoader == null ) { return ref ; } final String factoriesProp = ( String ) environment . get ( Context . OBJECT_FACTORIES ) ; if ( factoriesProp != null ) { final String [ ] classes = factoriesProp . split ( ":" ) ; for ( String className : classes ) { try { final Class < ? > factoryClass = classLoader . loadClass ( className ) ; final ObjectFactory objectFactory = ObjectFactory . class . cast ( factoryClass . newInstance ( ) ) ; final Object result = objectFactory . getObjectInstance ( ref , name , nameCtx , environment ) ; if ( result != null ) { return result ; } } catch ( Throwable ignored ) { } } } return ref ; }


Input: Calls to Hibernate ORM 5 . 3 getFlushMode () will not be changed as the desc will not match ( desc == () Ljavax . persistence . FlushModeType ; ) [CODESPLIT] @ Override public void visitMethodInsn ( int opcode , String owner , String name , String desc , boolean itf ) { if ( rewriteSessionImplementor && hasSessionImplementor ( desc ) && ( opcode == Opcodes . INVOKESPECIAL || opcode == Opcodes . INVOKEVIRTUAL ) ) { // if we have a user type calling a method from org.hibernate, we rewrite it to use SharedSessionContractImplementor logger . debugf ( "Deprecated Hibernate51CompatibilityTransformer transformed application classes in '%s', " + "class '%s' is calling method %s.%s, which must be changed to use SharedSessionContractImplementor as parameter." , moduleName , className , owner , name ) ; mv . visitMethodInsn ( opcode , owner , name , replaceSessionImplementor ( desc ) , itf ) ; transformedState . setClassTransformed ( true ) ; } else if ( opcode == Opcodes . INVOKEINTERFACE && ( owner . equals ( "org/hibernate/Session" ) || owner . equals ( "org/hibernate/BasicQueryContract" ) ) && name . equals ( "getFlushMode" ) && desc . equals ( "()Lorg/hibernate/FlushMode;" ) ) { logger . debugf ( "Deprecated Hibernate51CompatibilityTransformer transformed application classes in '%s', " + "class '%s' is calling %s.getFlushMode, which must be changed to call getHibernateFlushMode()." , moduleName , className , owner ) ; name = "getHibernateFlushMode" ; mv . visitMethodInsn ( opcode , owner , name , desc , itf ) ; transformedState . setClassTransformed ( true ) ; } else if ( opcode == Opcodes . INVOKEINTERFACE && owner . equals ( "org/hibernate/Query" ) && name . equals ( "getFirstResult" ) && desc . equals ( "()Ljava/lang/Integer;" ) ) { logger . debugf ( "Deprecated Hibernate51CompatibilityTransformer transformed application classes in '%s', " + "class '%s', is calling org.hibernate.Query.getFirstResult, which must be changed to call getHibernateFirstResult() " + "so null can be returned when the value is uninitialized. Please note that if a negative value was set using " + "org.hibernate.Query.setFirstResult, then getHibernateFirstResult() will return 0." , moduleName , className ) ; name = "getHibernateFirstResult" ; mv . visitMethodInsn ( opcode , owner , name , desc , itf ) ; transformedState . setClassTransformed ( true ) ; } else if ( opcode == Opcodes . INVOKEINTERFACE && owner . equals ( "org/hibernate/Query" ) && name . equals ( "getMaxResults" ) && desc . equals ( "()Ljava/lang/Integer;" ) ) { logger . debugf ( "Deprecated Hibernate51CompatibilityTransformer transformed application classes in '%s', " + "class '%s', is calling org.hibernate.Query.getMaxResults, which must be changed to call getHibernateMaxResults() " + "so that null will be returned when the value is uninitialized or ORM 5.1 org.hibernate.Query#setMaxResults was " + "used to set a value <= 0" , moduleName , className ) ; name = "getHibernateMaxResults" ; mv . visitMethodInsn ( opcode , owner , name , desc , itf ) ; transformedState . setClassTransformed ( true ) ; } else if ( ! disableAmbiguousChanges && opcode == Opcodes . INVOKEINTERFACE && owner . equals ( "org/hibernate/Query" ) && name . equals ( "setFirstResult" ) && desc . equals ( "(I)Lorg/hibernate/Query;" ) ) { logger . debugf ( "Deprecated Hibernate51CompatibilityTransformer transformed application classes in '%s', " + "class '%s', is calling org.hibernate.Query.setFirstResult, which must be changed to call setHibernateFirstResult() " + "so setting a value < 0 results in pagination starting with the 0th row as was done in Hibernate ORM 5.1 " + "(instead of throwing IllegalArgumentException as specified by JPA)." , moduleName , className ) ; name = "setHibernateFirstResult" ; mv . visitMethodInsn ( opcode , owner , name , desc , itf ) ; transformedState . setClassTransformed ( true ) ; } else if ( ! disableAmbiguousChanges && opcode == Opcodes . INVOKEINTERFACE && owner . equals ( "org/hibernate/Query" ) && name . equals ( "setMaxResults" ) && desc . equals ( "(I)Lorg/hibernate/Query;" ) ) { logger . debugf ( "Deprecated Hibernate51CompatibilityTransformer transformed application classes in '%s', " + "class '%s', is calling org.hibernate.Query.setMaxResults, which must be changed to call setHibernateMaxResults() " + "so that values <= 0 are treated the same as uninitialized.  Review Hibernate ORM migration doc " , moduleName , className ) ; name = "setHibernateMaxResults" ; mv . visitMethodInsn ( opcode , owner , name , desc , itf ) ; transformedState . setClassTransformed ( true ) ; } else { mv . visitMethodInsn ( opcode , owner , name , desc , itf ) ; } }


Input: Sets up the transaction management interceptor for all methods of the passed view . [CODESPLIT] protected static void addTxManagementInterceptorForView ( ViewDescription view ) { // add a Tx configurator view . getConfigurators ( ) . add ( new ViewConfigurator ( ) { @ Override public void configure ( DeploymentPhaseContext context , ComponentConfiguration componentConfiguration , ViewDescription description , ViewConfiguration configuration ) throws DeploymentUnitProcessingException { EJBComponentDescription ejbComponentDescription = ( EJBComponentDescription ) componentConfiguration . getComponentDescription ( ) ; // Add CMT interceptor factory if ( TransactionManagementType . CONTAINER . equals ( ejbComponentDescription . getTransactionManagementType ( ) ) ) { configuration . addViewInterceptor ( CMTTxInterceptor . FACTORY , InterceptorOrder . View . CMT_TRANSACTION_INTERCEPTOR ) ; } } } ) ; }


Input:
First checks if <code > name< / code > is a primitive type . If yes then returns the corresponding { @link Class } for that primitive . If it s not a primitive then the { @link Class#forName ( String boolean ClassLoader ) } method is invoked passing it the <code > name< / code > false and the <code > cl< / code > classloader [CODESPLIT] public static Class < ? > loadClass ( String name , ClassLoader cl ) throws ClassNotFoundException { /*
        * Handle Primitives
        */ if ( name . equals ( void . class . getName ( ) ) ) { return void . class ; } if ( name . equals ( byte . class . getName ( ) ) ) { return byte . class ; } if ( name . equals ( short . class . getName ( ) ) ) { return short . class ; } if ( name . equals ( int . class . getName ( ) ) ) { return int . class ; } if ( name . equals ( long . class . getName ( ) ) ) { return long . class ; } if ( name . equals ( char . class . getName ( ) ) ) { return char . class ; } if ( name . equals ( boolean . class . getName ( ) ) ) { return boolean . class ; } if ( name . equals ( float . class . getName ( ) ) ) { return float . class ; } if ( name . equals ( double . class . getName ( ) ) ) { return double . class ; } // Now that we know its not a primitive, lets just allow // the passed classloader to handle the request. // Note that we are intentionally using Class.forName(name,boolean,cl) // to handle issues with loading array types in Java 6 http://bugs.sun.com/view_bug.do?bug_id=6434149 return Class . forName ( name , false , cl ) ; }


Input: transform a Hibernate HQL query into something that can be displayed / used for management operations [CODESPLIT] private String displayable ( String query ) { if ( query == null || query . length ( ) == 0 ) { return query ; } StringBuilder buff = new StringBuilder ( query ) ; // handle two character transforms first subst ( buff , SQL_NE , NOT_EQUAL__ ) ; subst ( buff , NE_BANG , BANG_NOT_EQUAL__ ) ; subst ( buff , NE_HAT , HAT_NOT_EQUAL__ ) ; subst ( buff , LE , LESS_THAN_EQUAL__ ) ; subst ( buff , GE , GREATER_THAN_EQUAL__ ) ; subst ( buff , CONCAT , CONCAT__ ) ; subst ( buff , LT , LESS_THAN__ ) ; subst ( buff , EQ , EQUAL__ ) ; subst ( buff , GT , GREATER__ ) ; subst ( buff , OPEN , LEFT_PAREN__ ) ; subst ( buff , CLOSE , RIGHT_PAREN__ ) ; subst ( buff , OPEN_BRACKET , LEFT_BRACKET__ ) ; subst ( buff , CLOSE_BRACKET , RIGHT_BRACKET__ ) ; subst ( buff , PLUS , PLUS__ ) ; subst ( buff , MINUS , MINUS__ ) ; subst ( buff , STAR , STAR__ ) ; subst ( buff , DIV , DIVIDE__ ) ; subst ( buff , MOD , MODULUS__ ) ; subst ( buff , COLON , COLON__ ) ; subst ( buff , PARAM , PARAM__ ) ; subst ( buff , COMMA , COMMA__ ) ; subst ( buff , SPACE , SPACE__ ) ; subst ( buff , TAB , TAB__ ) ; subst ( buff , NEWLINE , NEWLINE__ ) ; subst ( buff , LINEFEED , LINEFEED__ ) ; subst ( buff , QUOTE , QUOTE__ ) ; subst ( buff , DQUOTE , DQUOTE__ ) ; subst ( buff , TICK , TICK__ ) ; subst ( buff , OPEN_BRACE , OPEN_BRACE__ ) ; subst ( buff , CLOSE_BRACE , CLOSE_BRACE__ ) ; subst ( buff , HAT , HAT__ ) ; subst ( buff , AMPERSAND , AMPERSAND__ ) ; return buff . toString ( ) ; }


Input: Substitute sub - strings inside of a string . [CODESPLIT] private static void subst ( final StringBuilder stringBuilder , final String from , final String to ) { int begin = 0 , end = 0 ; while ( ( end = stringBuilder . indexOf ( from , end ) ) != - 1 ) { stringBuilder . delete ( end , end + from . length ( ) ) ; stringBuilder . insert ( end , to ) ; // update positions begin = end + to . length ( ) ; end = begin ; } }


Input: { [CODESPLIT] @ Override public void transformResource ( ResourceTransformationContext context , PathAddress address , Resource resource ) throws OperationFailedException { context . addTransformedResourceFromRoot ( this . addressTransformer . transform ( address ) , resource ) . processChildren ( resource ) ; }


Input: Performs the actual work of stopping the service . Should be called by { [CODESPLIT] protected synchronized void stopService ( ) { if ( deploymentMD != null ) { if ( deploymentMD . getResourceAdapterKey ( ) != null ) { try { raRepository . getValue ( ) . unregisterResourceAdapter ( deploymentMD . getResourceAdapterKey ( ) ) ; } catch ( org . jboss . jca . core . spi . rar . NotFoundException nfe ) { ConnectorLogger . ROOT_LOGGER . exceptionDuringUnregistering ( nfe ) ; } } if ( deploymentMD . getResourceAdapter ( ) != null ) { deploymentMD . getResourceAdapter ( ) . stop ( ) ; if ( BootstrapContextCoordinator . getInstance ( ) != null && deploymentMD . getBootstrapContextIdentifier ( ) != null ) { BootstrapContextCoordinator . getInstance ( ) . removeBootstrapContext ( deploymentMD . getBootstrapContextIdentifier ( ) ) ; } } if ( deploymentMD . getDataSources ( ) != null && managementRepositoryValue . getValue ( ) != null ) { for ( org . jboss . jca . core . api . management . DataSource mgtDs : deploymentMD . getDataSources ( ) ) { managementRepositoryValue . getValue ( ) . getDataSources ( ) . remove ( mgtDs ) ; } } if ( deploymentMD . getConnectionManagers ( ) != null ) { for ( ConnectionManager cm : deploymentMD . getConnectionManagers ( ) ) { cm . shutdown ( ) ; } } } sqlDataSource = null ; }


Input: The XmlDataImporter requires a connector to connect to the artemis broker . [CODESPLIT] private TransportConfiguration createInVMTransportConfiguration ( OperationContext context ) throws OperationFailedException { final Resource serverResource = context . readResource ( EMPTY_ADDRESS , false ) ; Set < Resource . ResourceEntry > invmConnectors = serverResource . getChildren ( CommonAttributes . IN_VM_CONNECTOR ) ; if ( invmConnectors . isEmpty ( ) ) { throw MessagingLogger . ROOT_LOGGER . noInVMConnector ( ) ; } Resource . ResourceEntry connectorEntry = invmConnectors . iterator ( ) . next ( ) ; Resource connectorResource = context . readResource ( PathAddress . pathAddress ( connectorEntry . getPathElement ( ) ) , false ) ; ModelNode model = connectorResource . getModel ( ) ; Map < String , Object > params = new HashMap <> ( CommonAttributes . PARAMS . unwrap ( context , model ) ) ; params . put ( InVMTransportDefinition . SERVER_ID . getName ( ) , InVMTransportDefinition . SERVER_ID . resolveModelAttribute ( context , model ) . asInt ( ) ) ; TransportConfiguration transportConfiguration = new TransportConfiguration ( InVMConnectorFactory . class . getName ( ) , params ) ; return transportConfiguration ; }


Input: adds ear prefix to configured adapter name if it is specified in relative form [CODESPLIT] private String addEarPrefixIfRelativeName ( final String configuredName , final DeploymentUnit deploymentUnit , final Class < ? > componentClass ) throws DeploymentUnitProcessingException { if ( ! configuredName . startsWith ( "#" ) ) { return configuredName ; } final DeploymentUnit parent = deploymentUnit . getParent ( ) ; if ( parent == null ) { throw EjbLogger . ROOT_LOGGER . relativeResourceAdapterNameInStandaloneModule ( deploymentUnit . getName ( ) , componentClass . getName ( ) , configuredName ) ; } return new StringBuilder ( ) . append ( parent . getName ( ) ) . append ( configuredName ) . toString ( ) ; }


Input: Returns the parent of the given deployment unit if such a parent exists . If the given deployment unit is the parent deployment unit it is returned . [CODESPLIT] public static DeploymentUnit getRootDeploymentUnit ( DeploymentUnit deploymentUnit ) { if ( deploymentUnit . getParent ( ) == null ) { return deploymentUnit ; } return deploymentUnit . getParent ( ) ; }


Input: Get the service name for this view . [CODESPLIT] public ServiceName getServiceName ( ) { //TODO: need to set viewNameParts somewhere if ( ! viewNameParts . isEmpty ( ) ) { return componentDescription . getServiceName ( ) . append ( "VIEW" ) . append ( viewNameParts . toArray ( new String [ viewNameParts . size ( ) ] ) ) ; } else { return componentDescription . getServiceName ( ) . append ( "VIEW" ) . append ( viewClassName ) ; } }


Input: Creates view configuration . Allows for extensibility in EE sub components . [CODESPLIT] public ViewConfiguration createViewConfiguration ( final Class < ? > viewClass , final ComponentConfiguration componentConfiguration , final ProxyFactory < ? > proxyFactory ) { return new ViewConfiguration ( viewClass , componentConfiguration , getServiceName ( ) , proxyFactory ) ; }


Input: Create the injection source [CODESPLIT] protected InjectionSource createInjectionSource ( final ServiceName serviceName , Value < ClassLoader > viewClassLoader , boolean appclient ) { return new ViewBindingInjectionSource ( serviceName ) ; }


Input: LocalIRObject implementation --------------------------------- [CODESPLIT] public IRObject getReference ( ) { if ( ref == null ) { ref = org . omg . CORBA . SequenceDefHelper . narrow ( servantToReference ( new SequenceDefPOATie ( this ) ) ) ; } return ref ; }


Input: Get the view interceptors for a method . These interceptors are run sequentially on the server side of an invocation . The interceptor factories are used every time a new view instance is constructed called with a new factory context each time . The factory may return the same interceptor instance or a new interceptor instance as appropriate . [CODESPLIT] public List < InterceptorFactory > getViewInterceptors ( Method method ) { OrderedItemContainer < InterceptorFactory > container = viewInterceptors . get ( method ) ; if ( container == null ) { return Collections . emptyList ( ) ; } return container . getSortedItems ( ) ; }


Input: Adds an interceptor factory to all methods of a view [CODESPLIT] public void addViewInterceptor ( InterceptorFactory interceptorFactory , int priority ) { for ( Method method : proxyFactory . getCachedMethods ( ) ) { addViewInterceptor ( method , interceptorFactory , priority ) ; } }


Input: Adds a view interceptor to the given method [CODESPLIT] public void addViewInterceptor ( Method method , InterceptorFactory interceptorFactory , int priority ) { OrderedItemContainer < InterceptorFactory > container = viewInterceptors . get ( method ) ; if ( container == null ) { viewInterceptors . put ( method , container = new OrderedItemContainer < InterceptorFactory > ( ) ) ; } container . add ( interceptorFactory , priority ) ; }


Input: Get the client interceptors for a method . These interceptors are run sequentially on the client side of an invocation . The interceptor factories are used every time a new client proxy instance is constructed called with a new factory context each time . The factory may return the same interceptor instance or a new interceptor instance as appropriate . [CODESPLIT] public List < InterceptorFactory > getClientInterceptors ( Method method ) { OrderedItemContainer < InterceptorFactory > container = clientInterceptors . get ( method ) ; if ( container == null ) { return Collections . emptyList ( ) ; } return container . getSortedItems ( ) ; }


Input: Adds a client interceptor factory to all methods of a view [CODESPLIT] public void addClientInterceptor ( InterceptorFactory interceptorFactory , int priority ) { for ( Method method : proxyFactory . getCachedMethods ( ) ) { addClientInterceptor ( method , interceptorFactory , priority ) ; } }


Input: Adds a client interceptor to the given method [CODESPLIT] public void addClientInterceptor ( Method method , InterceptorFactory interceptorFactory , int priority ) { OrderedItemContainer < InterceptorFactory > container = clientInterceptors . get ( method ) ; if ( container == null ) { clientInterceptors . put ( method , container = new OrderedItemContainer < InterceptorFactory > ( ) ) ; } container . add ( interceptorFactory , priority ) ; }


Input: Attaches arbitrary private data to this view instance [CODESPLIT] public < T > void putPrivateData ( final Class < T > type , T data ) { privateData . put ( type , data ) ; }


Input: Returns the <code > ModuleClassLoaderLocator . CombinedClassLoader< / code > instance with consideration of security manager enabled [CODESPLIT] static ModuleClassLoaderLocator . CombinedClassLoader createCombinedClassLoader ( final List < ClassLoader > classLoaders ) { if ( WildFlySecurityManager . isChecking ( ) ) { return doPrivileged ( new PrivilegedAction < ModuleClassLoaderLocator . CombinedClassLoader > ( ) { @ Override public CombinedClassLoader run ( ) { return new ModuleClassLoaderLocator . CombinedClassLoader ( classLoaders ) ; } } ) ; } else { return new ModuleClassLoaderLocator . CombinedClassLoader ( classLoaders ) ; } }


Input: Throws a XMLStreamException for the unexpected element that was encountered during the parse [CODESPLIT] protected static void unexpectedElement ( final XMLExtendedStreamReader reader ) throws XMLStreamException { throw EeLogger . ROOT_LOGGER . unexpectedElement ( reader . getName ( ) , reader . getLocation ( ) ) ; }


Input: / * Determines whether resource removal happens in this step or a subsequent step [CODESPLIT] private static boolean removeInCurrentStep ( Resource resource ) { for ( String childType : resource . getChildTypes ( ) ) { for ( Resource . ResourceEntry entry : resource . getChildren ( childType ) ) { if ( ! entry . isRuntime ( ) && resource . hasChild ( entry . getPathElement ( ) ) ) { return false ; } } } return true ; }


Input: the regular and pooled CF [CODESPLIT] private static ConnectionFactoryAttribute [ ] define ( ConnectionFactoryAttribute [ ] specific , ConnectionFactoryAttribute ... common ) { int size = common . length + specific . length ; ConnectionFactoryAttribute [ ] result = new ConnectionFactoryAttribute [ size ] ; arraycopy ( specific , 0 , result , 0 , specific . length ) ; for ( int i = 0 ; i < common . length ; i ++ ) { ConnectionFactoryAttribute attr = common [ i ] ; AttributeDefinition definition = attr . getDefinition ( ) ; ConnectionFactoryAttribute newAttr ; // replace the reconnect-attempts attribute to use a different default value for pooled CF if ( definition == Common . RECONNECT_ATTEMPTS ) { AttributeDefinition copy = copy ( Pooled . RECONNECT_ATTEMPTS , AttributeAccess . Flag . RESTART_ALL_SERVICES ) ; newAttr = ConnectionFactoryAttribute . create ( copy , Pooled . RECONNECT_ATTEMPTS_PROP_NAME , true ) ; } else if ( definition == Common . CONNECTORS ) { StringListAttributeDefinition copy = new StringListAttributeDefinition . Builder ( Common . CONNECTORS ) . setAlternatives ( CommonAttributes . DISCOVERY_GROUP ) . setRequired ( true ) . setAttributeParser ( AttributeParser . STRING_LIST ) . setAttributeMarshaller ( AttributeMarshaller . STRING_LIST ) . setCapabilityReference ( new AbstractTransportDefinition . TransportCapabilityReferenceRecorder ( CAPABILITY_NAME , CONNECTOR_CAPABILITY_NAME , false ) ) . setRestartAllServices ( ) . build ( ) ; newAttr = ConnectionFactoryAttribute . create ( copy , attr . getPropertyName ( ) , attr . isResourceAdapterProperty ( ) , attr . getConfigType ( ) ) ; } else { AttributeDefinition copy = copy ( definition , AttributeAccess . Flag . RESTART_ALL_SERVICES ) ; newAttr = ConnectionFactoryAttribute . create ( copy , attr . getPropertyName ( ) , attr . isResourceAdapterProperty ( ) , attr . getConfigType ( ) ) ; } result [ specific . length + i ] = newAttr ; } return result ; }


Input: Gets list of JAXWS EJBs meta data . [CODESPLIT] public static List < EJBEndpoint > getJaxwsEjbs ( final DeploymentUnit unit ) { final JAXWSDeployment jaxwsDeployment = getOptionalAttachment ( unit , WSAttachmentKeys . JAXWS_ENDPOINTS_KEY ) ; return jaxwsDeployment != null ? jaxwsDeployment . getEjbEndpoints ( ) : Collections . < EJBEndpoint > emptyList ( ) ; }


Input: Gets list of JAXWS POJOs meta data . [CODESPLIT] public static List < POJOEndpoint > getJaxwsPojos ( final DeploymentUnit unit ) { final JAXWSDeployment jaxwsDeployment = unit . getAttachment ( WSAttachmentKeys . JAXWS_ENDPOINTS_KEY ) ; return jaxwsDeployment != null ? jaxwsDeployment . getPojoEndpoints ( ) : Collections . < POJOEndpoint > emptyList ( ) ; }


Input: Returns endpoint name . [CODESPLIT] public static String getEndpointName ( final ServletMetaData servletMD ) { final String endpointName = servletMD . getName ( ) ; return endpointName != null ? endpointName . trim ( ) : null ; }


Input: Returns endpoint class name . [CODESPLIT] public static String getEndpointClassName ( final ServletMetaData servletMD ) { final String endpointClass = servletMD . getServletClass ( ) ; return endpointClass != null ? endpointClass . trim ( ) : null ; }


Input: Returns servlet meta data for requested servlet name . [CODESPLIT] public static ServletMetaData getServletForName ( final JBossWebMetaData jbossWebMD , final String servletName ) { for ( JBossServletMetaData servlet : jbossWebMD . getServlets ( ) ) { if ( servlet . getName ( ) . equals ( servletName ) ) { return servlet ; } } return null ; }


Input: Returns required attachment value from deployment unit . [CODESPLIT] public static < A > A getRequiredAttachment ( final DeploymentUnit unit , final AttachmentKey < A > key ) { final A value = unit . getAttachment ( key ) ; if ( value == null ) { throw new IllegalStateException ( ) ; } return value ; }


Input: Returns optional attachment value from deployment unit or null if not bound . [CODESPLIT] public static < A > A getOptionalAttachment ( final DeploymentUnit unit , final AttachmentKey < A > key ) { return unit . getAttachment ( key ) ; }


Input: Gets the JBossWebMetaData from the WarMetaData attached to the provided deployment unit if any . [CODESPLIT] public static JBossWebMetaData getJBossWebMetaData ( final DeploymentUnit unit ) { final WarMetaData warMetaData = getOptionalAttachment ( unit , WarMetaData . ATTACHMENT_KEY ) ; JBossWebMetaData result = null ; if ( warMetaData != null ) { result = warMetaData . getMergedJBossWebMetaData ( ) ; if ( result == null ) { result = warMetaData . getJBossWebMetaData ( ) ; } } else { result = getOptionalAttachment ( unit , WSAttachmentKeys . JBOSSWEB_METADATA_KEY ) ; } return result ; }


Input: Return a named port - component from the jboss - webservices . xml [CODESPLIT] public static JBossPortComponentMetaData getJBossWebserviceMetaDataPortComponent ( final DeploymentUnit unit , final String name ) { if ( name != null ) { final JBossWebservicesMetaData jbossWebserviceMetaData = unit . getAttachment ( JBOSS_WEBSERVICES_METADATA_KEY ) ; if ( jbossWebserviceMetaData != null ) { JBossPortComponentMetaData [ ] portComponent = jbossWebserviceMetaData . getPortComponents ( ) ; if ( portComponent != null ) { for ( JBossPortComponentMetaData component : portComponent ) { if ( name . equals ( component . getEjbName ( ) ) ) { return component ; } } } } } return null ; }


Input: Returns an EJBEndpoint based upon fully qualified classname . [CODESPLIT] public static EJBEndpoint getWebserviceMetadataEJBEndpoint ( final JAXWSDeployment jaxwsDeployment , final String className ) { java . util . List < EJBEndpoint > ejbEndpointList = jaxwsDeployment . getEjbEndpoints ( ) ; for ( EJBEndpoint ejbEndpoint : ejbEndpointList ) { if ( className . equals ( ejbEndpoint . getClassName ( ) ) ) { return ejbEndpoint ; } } return null ; }


Input: Returns context root associated with webservice deployment . [CODESPLIT] public static String getContextRoot ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { final DeploymentUnit unit = WSHelper . getRequiredAttachment ( dep , DeploymentUnit . class ) ; final JBossAppMetaData jbossAppMD = unit . getParent ( ) == null ? null : ASHelper . getOptionalAttachment ( unit . getParent ( ) , WSAttachmentKeys . JBOSS_APP_METADATA_KEY ) ; String contextRoot = null ; // prefer context root defined in application.xml over one defined in jboss-web.xml if ( jbossAppMD != null ) { final ModuleMetaData moduleMD = jbossAppMD . getModules ( ) . get ( dep . getSimpleName ( ) ) ; if ( moduleMD != null ) { final WebModuleMetaData webModuleMD = ( WebModuleMetaData ) moduleMD . getValue ( ) ; contextRoot = webModuleMD . getContextRoot ( ) ; } } if ( contextRoot == null ) { contextRoot = jbossWebMD != null ? jbossWebMD . getContextRoot ( ) : null ; } return contextRoot ; }


Input: { [CODESPLIT] @ Override public TransformedOperation transformOperation ( TransformationContext context , PathAddress address , ModelNode originalOperation ) throws OperationFailedException { String originalName = Operations . getName ( originalOperation ) ; PathAddress originalAddress = Operations . getPathAddress ( originalOperation ) ; Deque < ModelNode > preSteps = new LinkedList <> ( ) ; Deque < ModelNode > postSteps = new LinkedList <> ( ) ; ModelNode operation = originalOperation ; for ( OperationTransformer transformer : this . transformers ) { operation = transformer . transformOperation ( context , address , operation ) . getTransformedOperation ( ) ; // If the transformed operation is a composite operation, locate the modified operation and record any pre/post operations if ( this . collate && operation . get ( ModelDescriptionConstants . OP ) . asString ( ) . equals ( ModelDescriptionConstants . COMPOSITE ) ) { List < ModelNode > stepList = operation . get ( ModelDescriptionConstants . STEPS ) . asList ( ) ; ListIterator < ModelNode > steps = stepList . listIterator ( ) ; while ( steps . hasNext ( ) ) { ModelNode step = steps . next ( ) ; String operationName = Operations . getName ( step ) ; PathAddress operationAddress = Operations . getPathAddress ( step ) ; if ( operationName . equals ( originalName ) && operationAddress . equals ( originalAddress ) ) { operation = step ; break ; } preSteps . addLast ( step ) ; } steps = stepList . listIterator ( stepList . size ( ) ) ; while ( steps . hasPrevious ( ) ) { ModelNode step = steps . previous ( ) ; String operationName = Operations . getName ( step ) ; PathAddress operationAddress = Operations . getPathAddress ( step ) ; if ( operationName . equals ( originalName ) && operationAddress . equals ( originalAddress ) ) { break ; } postSteps . addFirst ( step ) ; } } } if ( this . collate ) { int count = preSteps . size ( ) + postSteps . size ( ) + 1 ; // If there are any pre or post steps, we need a composite operation if ( count > 1 ) { List < ModelNode > steps = new ArrayList <> ( count ) ; steps . addAll ( preSteps ) ; steps . add ( operation ) ; steps . addAll ( postSteps ) ; operation = Operations . createCompositeOperation ( steps ) ; } } return new TransformedOperation ( operation , OperationResultTransformer . ORIGINAL_RESULT ) ; }


Input: { [CODESPLIT] @ Override public void start ( StartContext context ) throws StartException { SecurityLogger . ROOT_LOGGER . debug ( "Starting JaasConfigurationService" ) ; // set new configuration synchronized ( Configuration . class ) { Configuration . setConfiguration ( configuration ) ; } }


Input: <p > Obtains the subsystem configuration properties from the specified { @code ModelNode } using default values for undefined properties . If the property has a IIOP equivalent it is translated into its IIOP counterpart before being added to the returned { @code Properties } object . < / p > [CODESPLIT] protected Properties getConfigurationProperties ( OperationContext context , ModelNode model ) throws OperationFailedException { Properties props = new Properties ( ) ; getResourceProperties ( props , IIOPRootDefinition . INSTANCE , context , model ) ; // check if the node contains a list of generic properties. ModelNode configNode = model . get ( Constants . CONFIGURATION ) ; if ( configNode . hasDefined ( Constants . PROPERTIES ) ) { for ( Property property : configNode . get ( Constants . PROPERTIES ) . get ( Constants . PROPERTY ) . asPropertyList ( ) ) { String name = property . getName ( ) ; String value = property . getValue ( ) . get ( Constants . PROPERTY_VALUE ) . asString ( ) ; props . setProperty ( name , value ) ; } } return props ; }


Input: <p > Sets up the ORB initializers according to what has been configured in the subsystem . < / p > [CODESPLIT] private void setupInitializers ( Properties props ) { List < String > orbInitializers = new ArrayList < String > ( ) ; // check which groups of initializers are to be installed. String installSecurity = ( String ) props . remove ( Constants . ORB_INIT_SECURITY ) ; if ( installSecurity . equalsIgnoreCase ( Constants . CLIENT ) ) { orbInitializers . addAll ( Arrays . asList ( IIOPInitializer . SECURITY_CLIENT . getInitializerClasses ( ) ) ) ; } else if ( installSecurity . equalsIgnoreCase ( Constants . IDENTITY ) ) { orbInitializers . addAll ( Arrays . asList ( IIOPInitializer . SECURITY_IDENTITY . getInitializerClasses ( ) ) ) ; } else if ( installSecurity . equalsIgnoreCase ( Constants . ELYTRON ) ) { final String authContext = props . getProperty ( Constants . ORB_INIT_AUTH_CONTEXT ) ; ElytronSASClientInterceptor . setAuthenticationContextName ( authContext ) ; orbInitializers . addAll ( Arrays . asList ( IIOPInitializer . SECURITY_ELYTRON . getInitializerClasses ( ) ) ) ; } String installTransaction = ( String ) props . remove ( Constants . ORB_INIT_TRANSACTIONS ) ; if ( installTransaction . equalsIgnoreCase ( Constants . FULL ) ) { orbInitializers . addAll ( Arrays . asList ( IIOPInitializer . TRANSACTIONS . getInitializerClasses ( ) ) ) ; } else if ( installTransaction . equalsIgnoreCase ( Constants . SPEC ) ) { orbInitializers . addAll ( Arrays . asList ( IIOPInitializer . SPEC_TRANSACTIONS . getInitializerClasses ( ) ) ) ; } // add the standard opendk initializer plus all configured initializers. for ( String initializerClass : orbInitializers ) { props . setProperty ( Constants . ORB_INITIALIZER_PREFIX + initializerClass , "" ) ; } }


Input: <p > Sets up the SSL domain socket factories if SSL support has been enabled . < / p > [CODESPLIT] private boolean setupSSLFactories ( final Properties props ) throws OperationFailedException { final boolean supportSSL = "true" . equalsIgnoreCase ( props . getProperty ( Constants . SECURITY_SUPPORT_SSL ) ) ; final boolean sslConfigured ; if ( supportSSL ) { // if the config is using Elytron supplied SSL contexts, install the SSLSocketFactory. final String serverSSLContextName = props . getProperty ( Constants . SERVER_SSL_CONTEXT ) ; final String clientSSLContextName = props . getProperty ( Constants . CLIENT_SSL_CONTEXT ) ; if ( serverSSLContextName != null && clientSSLContextName != null ) { SSLSocketFactory . setServerSSLContextName ( serverSSLContextName ) ; SSLSocketFactory . setClientSSLContextName ( clientSSLContextName ) ; props . setProperty ( ORBConstants . SOCKET_FACTORY_CLASS_PROPERTY , SSLSocketFactory . class . getName ( ) ) ; } else { // if the config only has a legacy JSSE domain reference, install the LegacySSLSocketFactory. final String securityDomain = props . getProperty ( Constants . SECURITY_SECURITY_DOMAIN ) ; LegacySSLSocketFactory . setSecurityDomain ( securityDomain ) ; props . setProperty ( ORBConstants . SOCKET_FACTORY_CLASS_PROPERTY , LegacySSLSocketFactory . class . getName ( ) ) ; } sslConfigured = true ; } else { props . setProperty ( ORBConstants . SOCKET_FACTORY_CLASS_PROPERTY , NoSSLSocketFactory . class . getName ( ) ) ; sslConfigured = false ; } return sslConfigured ; }


Input: { [CODESPLIT] @ Override public void start ( StartContext context ) throws StartException { log . debugf ( "Starting SecurityBootstrapService" ) ; //Print out the current version of PicketBox SecurityLogger . ROOT_LOGGER . currentVersion ( org . picketbox . Version . VERSION ) ; initializeJacc ( ) ; setupPolicyRegistration ( context ) ; }


Input: { [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) @ Override public void stop ( StopContext context ) { // remove handlers Set handlerKeys = PolicyContext . getHandlerKeys ( ) ; handlerKeys . remove ( SecurityConstants . CALLBACK_HANDLER_KEY ) ; handlerKeys . remove ( SecurityConstants . SUBJECT_CONTEXT_KEY ) ; // Install the policy provider that existed on startup if ( initializeJacc && jaccPolicy != null ) Policy . setPolicy ( oldPolicy ) ; }


Input: { [CODESPLIT] @ Override public TransformedOperation transformOperation ( TransformationContext context , PathAddress address , ModelNode operation ) { ModelNode legacyOperation = Util . createRemoveOperation ( this . addressTransformer . transform ( address ) ) ; return new TransformedOperation ( legacyOperation , OperationResultTransformer . ORIGINAL_RESULT ) ; }


Input: If the class name is found in additionalClasses then return it . [CODESPLIT] @ Override public Class < ? > classForName ( String name ) { try { if ( classes . containsKey ( name ) ) { return classes . get ( name ) ; } final Class < ? > clazz = module . getClassLoader ( ) . loadClass ( name ) ; classes . put ( name , clazz ) ; return clazz ; } catch ( ClassNotFoundException | LinkageError e ) { throw new ResourceLoadingException ( e ) ; } }


Input: Loads a resource from the module class loader [CODESPLIT] @ Override public URL getResource ( String name ) { try { return module . getClassLoader ( ) . getResource ( name ) ; } catch ( Exception e ) { throw new ResourceLoadingException ( e ) ; } }


Input: Loads resources from the module class loader [CODESPLIT] @ Override public Collection < URL > getResources ( String name ) { try { final HashSet < URL > resources = new HashSet < URL > ( ) ; Enumeration < URL > urls = module . getClassLoader ( ) . getResources ( name ) ; while ( urls . hasMoreElements ( ) ) { resources . add ( urls . nextElement ( ) ) ; } return resources ; } catch ( Exception e ) { throw new ResourceLoadingException ( e ) ; } }


Input: Lists all children of a particular path taking overlays into account [CODESPLIT] public List < Resource > list ( String path ) { try { final List < Resource > ret = new ArrayList <> ( ) ; Resource res = deploymentResourceManager . getResource ( path ) ; if ( res != null ) { for ( Resource child : res . list ( ) ) { ret . add ( new ServletResource ( this , child ) ) ; } } String p = path ; if ( p . startsWith ( "/" ) ) { p = p . substring ( 1 ) ; } if ( overlays != null ) { for ( VirtualFile overlay : overlays ) { VirtualFile child = overlay . getChild ( p ) ; if ( child . exists ( ) ) { VirtualFileResource vfsResource = new VirtualFileResource ( overlay . getPhysicalFile ( ) , child , path ) ; for ( Resource c : vfsResource . list ( ) ) { ret . add ( new ServletResource ( this , c ) ) ; } } } } return ret ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; //this method really should have thrown IOException } }


Input: Add dependencies for modules required for ra deployments [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; final ModuleSpecification moduleSpecification = deploymentUnit . getAttachment ( Attachments . MODULE_SPECIFICATION ) ; moduleSpecification . addSystemDependency ( new ModuleDependency ( moduleLoader , RESOURCE_API_ID , false , false , false , false ) ) ; if ( phaseContext . getDeploymentUnit ( ) . getAttachment ( ConnectorXmlDescriptor . ATTACHMENT_KEY ) == null ) { return ; // Skip non ra deployments } //if a module depends on a rar it also needs a dep on all the rar's "local dependencies" moduleSpecification . setLocalDependenciesTransitive ( true ) ; moduleSpecification . addSystemDependency ( new ModuleDependency ( moduleLoader , JMS_ID , false , false , false , false ) ) ; moduleSpecification . addSystemDependency ( new ModuleDependency ( moduleLoader , VALIDATION_ID , false , false , false , false ) ) ; moduleSpecification . addSystemDependency ( new ModuleDependency ( moduleLoader , IRON_JACAMAR_ID , false , false , false , false ) ) ; moduleSpecification . addSystemDependency ( new ModuleDependency ( moduleLoader , IRON_JACAMAR_IMPL_ID , false , true , false , false ) ) ; moduleSpecification . addSystemDependency ( new ModuleDependency ( moduleLoader , HIBERNATE_VALIDATOR_ID , false , false , true , false ) ) ; if ( ! appclient ) phaseContext . addDeploymentDependency ( ConnectorServices . RESOURCEADAPTERS_SUBSYSTEM_SERVICE , ResourceAdaptersSubsystemService . ATTACHMENT_KEY ) ; }


Input: current session bean invocation is ending close any transactional entity managers created without a JTA transaction . [CODESPLIT] public static void popCall ( ) { Map < String , EntityManager > emStack = nonTxStack . pop ( ) ; if ( emStack != null ) { for ( EntityManager entityManager : emStack . values ( ) ) { try { if ( entityManager . isOpen ( ) ) { entityManager . close ( ) ; } } catch ( RuntimeException safeToIgnore ) { if ( ROOT_LOGGER . isTraceEnabled ( ) ) { ROOT_LOGGER . trace ( "Could not close (non-transactional) container managed entity manager." + "  This shouldn't impact application functionality (only read " + "operations occur in non-transactional mode)" , safeToIgnore ) ; } } } } }


Input: Return the transactional entity manager for the specified scoped persistence unit name [CODESPLIT] public static EntityManager get ( String puScopedName ) { Map < String , EntityManager > map = nonTxStack . peek ( ) ; if ( map != null ) { return map . get ( puScopedName ) ; } return null ; }


Input: Closing of transaction scoped JMSContext is executed through Synchronization listener . This method registers listener which takes care of closing JMSContext . [CODESPLIT] void registerCleanUpListener ( TransactionSynchronizationRegistry transactionSynchronizationRegistry , JMSContext contextInstance ) { //to avoid registration of more listeners for one context, flag in transaction is used. Object alreadyRegistered = transactionSynchronizationRegistry . getResource ( contextInstance ) ; if ( alreadyRegistered == null ) { transactionSynchronizationRegistry . registerInterposedSynchronization ( new AfterCompletionSynchronization ( contextInstance ) ) ; transactionSynchronizationRegistry . putResource ( contextInstance , AfterCompletionSynchronization . class . getName ( ) ) ; } }


Input: { [CODESPLIT] @ Override public void readElement ( final XMLExtendedStreamReader reader , final List < ModelNode > operations ) throws XMLStreamException { final ModelNode ejb3SubsystemAddOperation = Util . createAddOperation ( SUBSYSTEM_PATH ) ; operations . add ( ejb3SubsystemAddOperation ) ; readAttributes ( reader ) ; // elements final EnumSet < EJB3SubsystemXMLElement > encountered = EnumSet . noneOf ( EJB3SubsystemXMLElement . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != XMLStreamConstants . END_ELEMENT ) { if ( EJB3SubsystemNamespace . forUri ( reader . getNamespaceURI ( ) ) != getExpectedNamespace ( ) ) { throw unexpectedElement ( reader ) ; } final EJB3SubsystemXMLElement element = EJB3SubsystemXMLElement . forName ( reader . getLocalName ( ) ) ; if ( ! encountered . add ( element ) ) { throw unexpectedElement ( reader ) ; } readElement ( reader , element , operations , ejb3SubsystemAddOperation ) ; } }


Input: Process web annotations . [CODESPLIT] public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; if ( ! DeploymentTypeMarker . isType ( DeploymentType . WAR , deploymentUnit ) ) { return ; // Skip non web deployments } WarMetaData warMetaData = deploymentUnit . getAttachment ( WarMetaData . ATTACHMENT_KEY ) ; assert warMetaData != null ; Map < String , WebMetaData > annotationsMetaData = warMetaData . getAnnotationsMetaData ( ) ; if ( annotationsMetaData == null ) { annotationsMetaData = new HashMap < String , WebMetaData > ( ) ; warMetaData . setAnnotationsMetaData ( annotationsMetaData ) ; } Map < ResourceRoot , Index > indexes = AnnotationIndexUtils . getAnnotationIndexes ( deploymentUnit ) ; // Process lib/*.jar for ( final Entry < ResourceRoot , Index > entry : indexes . entrySet ( ) ) { final Index jarIndex = entry . getValue ( ) ; annotationsMetaData . put ( entry . getKey ( ) . getRootName ( ) , processAnnotations ( jarIndex ) ) ; } Map < ModuleIdentifier , CompositeIndex > additionalModelAnnotations = deploymentUnit . getAttachment ( Attachments . ADDITIONAL_ANNOTATION_INDEXES_BY_MODULE ) ; if ( additionalModelAnnotations != null ) { final List < WebMetaData > additional = new ArrayList < WebMetaData > ( ) ; for ( Entry < ModuleIdentifier , CompositeIndex > entry : additionalModelAnnotations . entrySet ( ) ) { for ( Index index : entry . getValue ( ) . getIndexes ( ) ) { additional . add ( processAnnotations ( index ) ) ; } } warMetaData . setAdditionalModuleAnnotationsMetadata ( additional ) ; } }