Input: Instantiate bean . [CODESPLIT] public static Object instantiateBean ( BeanMetaDataConfig beanConfig , BeanInfo beanInfo , DeploymentReflectionIndex index , Module module ) throws Throwable { Joinpoint instantiateJoinpoint = null ; ValueConfig [ ] parameters = new ValueConfig [ 0 ] ; String [ ] types = Configurator . NO_PARAMS_TYPES ; ConstructorConfig ctorConfig = beanConfig . getConstructor ( ) ; if ( ctorConfig != null ) { parameters = ctorConfig . getParameters ( ) ; types = Configurator . getTypes ( parameters ) ; String factoryClass = ctorConfig . getFactoryClass ( ) ; FactoryConfig factory = ctorConfig . getFactory ( ) ; if ( factoryClass != null || factory != null ) { String factoryMethod = ctorConfig . getFactoryMethod ( ) ; if ( factoryMethod == null ) throw PojoLogger . ROOT_LOGGER . missingFactoryMethod ( beanConfig ) ; if ( factoryClass != null ) { // static factory Class < ? > factoryClazz = Class . forName ( factoryClass , false , module . getClassLoader ( ) ) ; Method method = Configurator . findMethod ( index , factoryClazz , factoryMethod , types , true , true , true ) ; MethodJoinpoint mj = new MethodJoinpoint ( method ) ; mj . setTarget ( new ImmediateValue < Object > ( null ) ) ; // null, since this is static call mj . setParameters ( parameters ) ; instantiateJoinpoint = mj ; } else if ( factory != null ) { ReflectionJoinpoint rj = new ReflectionJoinpoint ( factory . getBeanInfo ( ) , factoryMethod , types ) ; // null type is ok, as this should be plain injection rj . setTarget ( new ImmediateValue < Object > ( factory . getValue ( null ) ) ) ; rj . setParameters ( parameters ) ; instantiateJoinpoint = rj ; } } } // plain bean's ctor if ( instantiateJoinpoint == null ) { if ( beanInfo == null ) throw new StartException ( PojoLogger . ROOT_LOGGER . missingBeanInfo ( beanConfig ) ) ; Constructor ctor = ( types . length == 0 ) ? beanInfo . getConstructor ( ) : beanInfo . findConstructor ( types ) ; ConstructorJoinpoint constructorJoinpoint = new ConstructorJoinpoint ( ctor ) ; constructorJoinpoint . setParameters ( parameters ) ; instantiateJoinpoint = constructorJoinpoint ; } return instantiateJoinpoint . dispatch ( ) ; }


Input: Configure bean . [CODESPLIT] public static void configure ( BeanMetaDataConfig beanConfig , BeanInfo beanInfo , Module module , Object bean , boolean nullify ) throws Throwable { Set < PropertyConfig > properties = beanConfig . getProperties ( ) ; if ( properties != null ) { List < PropertyConfig > used = new ArrayList < PropertyConfig > ( ) ; for ( PropertyConfig pc : properties ) { try { configure ( beanInfo , module , bean , pc , nullify ) ; used . add ( pc ) ; } catch ( Throwable t ) { if ( nullify == false ) { for ( PropertyConfig upc : used ) { try { configure ( beanInfo , module , bean , upc , true ) ; } catch ( Throwable ignored ) { } } throw new StartException ( t ) ; } } } } }


Input: Dispatch lifecycle joinpoint . [CODESPLIT] public static void dispatchLifecycleJoinpoint ( BeanInfo beanInfo , Object bean , LifecycleConfig config , String defaultMethod ) throws Throwable { if ( config != null && config . isIgnored ( ) ) return ; Joinpoint joinpoint = createJoinpoint ( beanInfo , bean , config , defaultMethod ) ; if ( joinpoint != null ) joinpoint . dispatch ( ) ; }


Input: Adds an outbound connection reference used by a remoting receiver in the client context represented by this { @link EJBClientDescriptorMetaData } [CODESPLIT] public RemotingReceiverConfiguration addRemotingReceiverConnectionRef ( final String outboundConnectionRef ) { if ( outboundConnectionRef == null || outboundConnectionRef . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Cannot add a remoting receiver which references a null/empty outbound connection" ) ; } final RemotingReceiverConfiguration remotingReceiverConfiguration = new RemotingReceiverConfiguration ( outboundConnectionRef ) ; this . remotingReceiverConfigurations . put ( outboundConnectionRef , remotingReceiverConfiguration ) ; return remotingReceiverConfiguration ; }


Input: Create a reference to a sub class of { [CODESPLIT] public static Reference createReference ( final ServiceName service , Class < ? extends ServiceReferenceObjectFactory > factory ) { return ModularReference . create ( Context . class , new ServiceNameRefAdr ( "srof" , service ) , factory ) ; }


Input: Handles the service reference . The parameters are the same as { [CODESPLIT] public Object getObjectInstance ( Object serviceValue , Object obj , Name name , Context nameCtx , Hashtable < ? , ? > environment ) throws Exception { return serviceValue ; }


Input: Get the current context selector for the current thread . [CODESPLIT] public static NamespaceContextSelector getCurrentSelector ( ) { NamespaceContextSelector selector = currentSelector . peek ( ) ; if ( selector != null ) { return selector ; } return defaultSelector ; }


Input: Get MC bean name . [CODESPLIT] public static ServiceName toBeanName ( String name , BeanState state ) { if ( state == null ) state = BeanState . INSTALLED ; return JBOSS_POJO . append ( name ) . append ( state . name ( ) ) ; }


Input: To instances name . [CODESPLIT] public static ServiceName toInstancesName ( Class < ? > clazz , BeanState state ) { String clName ; ClassLoader classLoader = clazz . getClassLoader ( ) ; if ( classLoader != null ) clName = classLoader . toString ( ) ; else clName = "SystemClassLoader" ; if ( state == null ) state = BeanState . INSTALLED ; return JBOSS_POJO . append ( clName , clazz . getName ( ) , state . name ( ) ) ; }


Input: Determines a list of classes the given annotation instances are defined on . If an annotation instance is not defined on a class ( e . g . on a member ) this annotation instance is not reflected anyhow in the resulting list . [CODESPLIT] public static List < ClassInfo > getAnnotatedClasses ( List < AnnotationInstance > instances ) { List < ClassInfo > result = new ArrayList < ClassInfo > ( ) ; for ( AnnotationInstance instance : instances ) { AnnotationTarget target = instance . target ( ) ; if ( target instanceof ClassInfo ) { result . add ( ( ClassInfo ) target ) ; } } return result ; }


Input: Look for a class description in all available modules . [CODESPLIT] public EEModuleClassDescription getClassByName ( String name ) { for ( EEModuleDescription module : availableModules ) { final EEModuleClassDescription desc = module . getClassDescription ( name ) ; if ( desc != null ) { return desc ; } } return null ; }


Input: Process annotations and merge any available metadata at the same time . [CODESPLIT] @ Override protected void processAnnotations ( final DeploymentUnit deploymentUnit , final CompositeIndex compositeIndex ) throws DeploymentUnitProcessingException { if ( MetadataCompleteMarker . isMetadataComplete ( deploymentUnit ) ) { return ; } // Find and process any @Stateless bean annotations final List < AnnotationInstance > slsbAnnotations = compositeIndex . getAnnotations ( STATELESS_ANNOTATION ) ; if ( ! slsbAnnotations . isEmpty ( ) ) { processSessionBeans ( deploymentUnit , slsbAnnotations , SessionBeanComponentDescription . SessionBeanType . STATELESS ) ; } // Find and process any @Stateful bean annotations final List < AnnotationInstance > sfsbAnnotations = compositeIndex . getAnnotations ( STATEFUL_ANNOTATION ) ; if ( ! sfsbAnnotations . isEmpty ( ) ) { processSessionBeans ( deploymentUnit , sfsbAnnotations , SessionBeanComponentDescription . SessionBeanType . STATEFUL ) ; } // Find and process any @Singleton bean annotations final List < AnnotationInstance > sbAnnotations = compositeIndex . getAnnotations ( SINGLETON_ANNOTATION ) ; if ( ! sbAnnotations . isEmpty ( ) ) { processSessionBeans ( deploymentUnit , sbAnnotations , SessionBeanComponentDescription . SessionBeanType . SINGLETON ) ; } }


Input: Returns true if the passed <code > sessionBeanClass< / code > meets the requirements set by the EJB3 spec about bean implementation classes . The passed <code > sessionBeanClass< / code > must not be an interface and must be public and not final and not abstract . If it passes these requirements then this method returns true . Else it returns false . [CODESPLIT] private static boolean assertSessionBeanClassValidity ( final ClassInfo sessionBeanClass ) { final short flags = sessionBeanClass . flags ( ) ; final String className = sessionBeanClass . name ( ) . toString ( ) ; // must *not* be an interface if ( Modifier . isInterface ( flags ) ) { EjbLogger . DEPLOYMENT_LOGGER . sessionBeanClassCannotBeAnInterface ( className ) ; return false ; } // bean class must be public, must *not* be abstract or final if ( ! Modifier . isPublic ( flags ) || Modifier . isAbstract ( flags ) || Modifier . isFinal ( flags ) ) { EjbLogger . DEPLOYMENT_LOGGER . sessionBeanClassMustBePublicNonAbstractNonFinal ( className ) ; return false ; } // valid class return true ; }


Input: { [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final EEResourceReferenceProcessorRegistry registry = deploymentUnit . getAttachment ( Attachments . RESOURCE_REFERENCE_PROCESSOR_REGISTRY ) ; //setup ejb context jndi handlers registry . registerResourceReferenceProcessor ( new EjbContextResourceReferenceProcessor ( EJBContext . class ) ) ; registry . registerResourceReferenceProcessor ( new EjbContextResourceReferenceProcessor ( SessionContext . class ) ) ; registry . registerResourceReferenceProcessor ( new EjbContextResourceReferenceProcessor ( EntityContext . class ) ) ; registry . registerResourceReferenceProcessor ( new EjbContextResourceReferenceProcessor ( MessageDrivenContext . class ) ) ; final EEModuleDescription eeModuleDescription = deploymentUnit . getAttachment ( Attachments . EE_MODULE_DESCRIPTION ) ; final Collection < ComponentDescription > componentConfigurations = eeModuleDescription . getComponentDescriptions ( ) ; if ( componentConfigurations == null || componentConfigurations . isEmpty ( ) ) { return ; } for ( ComponentDescription componentConfiguration : componentConfigurations ) { final CompositeIndex index = deploymentUnit . getAttachment ( org . jboss . as . server . deployment . Attachments . COMPOSITE_ANNOTATION_INDEX ) ; if ( index != null ) { processComponentConfig ( componentConfiguration ) ; } } }


Input: { [CODESPLIT] @ Override protected JaccService < EarMetaData > createService ( String contextId , EarMetaData metaData , Boolean standalone ) { return new EarJaccService ( contextId , metaData , standalone ) ; }


Input:
Some of this might need to move to the install phase [CODESPLIT] private void postParseSteps ( final VirtualFile persistence_xml , final PersistenceUnitMetadataHolder puHolder , final DeploymentUnit deploymentUnit ) { for ( PersistenceUnitMetadata pu : puHolder . getPersistenceUnits ( ) ) { // set URLs List < URL > jarfilesUrls = new ArrayList < URL > ( ) ; if ( pu . getJarFiles ( ) != null ) { for ( String jar : pu . getJarFiles ( ) ) { jarfilesUrls . add ( getRelativeURL ( persistence_xml , jar ) ) ; } } pu . setJarFileUrls ( jarfilesUrls ) ; URL url = getPersistenceUnitURL ( persistence_xml ) ; pu . setPersistenceUnitRootUrl ( url ) ; String scopedPersistenceUnitName ; /**
             * WFLY-5478 allow custom scoped persistence unit name hint in persistence unit definition.
             * Specified scoped persistence unit name needs to be unique across application server deployments.
             * Application is responsible for picking a unique name.
             * Currently, a non-unique name will result in a DuplicateServiceException deployment failure:
             *   org.jboss.msc.service.DuplicateServiceException: Service jboss.persistenceunit.my2lccustom#test_pu.__FIRST_PHASE__ is already registered
             */ scopedPersistenceUnitName = Configuration . getScopedPersistenceUnitName ( pu ) ; if ( scopedPersistenceUnitName == null ) { scopedPersistenceUnitName = createBeanName ( deploymentUnit , pu . getPersistenceUnitName ( ) ) ; } else { ROOT_LOGGER . tracef ( "persistence unit '%s' specified a custom scoped persistence unit name hint " + "(jboss.as.jpa.scopedname=%s).  The specified name *must* be unique across all application server deployments." , pu . getPersistenceUnitName ( ) , scopedPersistenceUnitName ) ; if ( scopedPersistenceUnitName . indexOf ( ' ' ) != - 1 ) { throw JpaLogger . ROOT_LOGGER . invalidScopedName ( scopedPersistenceUnitName , ' ' ) ; } } pu . setScopedPersistenceUnitName ( scopedPersistenceUnitName ) ; } }


Input: Eliminate duplicate PU definitions from clustering the deployment ( first definition will win ) <p / > JPA 8 . 2 A persistence unit must have a name . Only one persistence unit of any given name must be defined within a single EJB - JAR file within a single WAR file within a single application client jar or within an EAR . See Section 8 . 2 . 2 “Persistence Unit Scope” . [CODESPLIT] private PersistenceUnitMetadataHolder normalize ( List < PersistenceUnitMetadataHolder > listPUHolders ) { // eliminate duplicates (keeping the first instance of each PU by name) Map < String , PersistenceUnitMetadata > flattened = new HashMap < String , PersistenceUnitMetadata > ( ) ; for ( PersistenceUnitMetadataHolder puHolder : listPUHolders ) { for ( PersistenceUnitMetadata pu : puHolder . getPersistenceUnits ( ) ) { if ( ! flattened . containsKey ( pu . getPersistenceUnitName ( ) ) ) { flattened . put ( pu . getPersistenceUnitName ( ) , pu ) ; } else { PersistenceUnitMetadata first = flattened . get ( pu . getPersistenceUnitName ( ) ) ; PersistenceUnitMetadata duplicate = pu ; ROOT_LOGGER . duplicatePersistenceUnitDefinition ( duplicate . getPersistenceUnitName ( ) , first . getScopedPersistenceUnitName ( ) , duplicate . getScopedPersistenceUnitName ( ) ) ; } } } PersistenceUnitMetadataHolder holder = new PersistenceUnitMetadataHolder ( new ArrayList < PersistenceUnitMetadata > ( flattened . values ( ) ) ) ; return holder ; }


Input: old as6 names looked like : persistence . unit : unitName = ejb3_ext_propagation . ear / lib / ejb3_ext_propagation . jar#CTS - EXT - UNIT [CODESPLIT] public static String createBeanName ( DeploymentUnit deploymentUnit , String persistenceUnitName ) { // persistenceUnitName must be a simple name if ( persistenceUnitName . indexOf ( ' ' ) != - 1 ) { throw JpaLogger . ROOT_LOGGER . invalidPersistenceUnitName ( persistenceUnitName , ' ' ) ; } if ( persistenceUnitName . indexOf ( ' ' ) != - 1 ) { throw JpaLogger . ROOT_LOGGER . invalidPersistenceUnitName ( persistenceUnitName , ' ' ) ; } String unitName = getScopedDeploymentUnitPath ( deploymentUnit ) + "#" + persistenceUnitName ; return unitName ; }


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 ] ; for ( int i = 0 ; i < specific . length ; i ++ ) { ConnectionFactoryAttribute attr = specific [ i ] ; AttributeDefinition definition = attr . getDefinition ( ) ; if ( definition == ConnectionFactoryAttributes . Pooled . INITIAL_CONNECT_ATTEMPTS ) { result [ i ] = ConnectionFactoryAttribute . create ( SimpleAttributeDefinitionBuilder . create ( ConnectionFactoryAttributes . Pooled . INITIAL_CONNECT_ATTEMPTS ) . setDefaultValue ( new ModelNode ( - 1 ) ) . build ( ) , attr . getPropertyName ( ) , true ) ; } else { result [ i ] = attr ; } } 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 == CommonAttributes . HA ) { newAttr = ConnectionFactoryAttribute . create ( SimpleAttributeDefinitionBuilder . create ( CommonAttributes . HA ) . setDefaultValue ( ModelNode . TRUE ) . setFlags ( AttributeAccess . Flag . RESTART_ALL_SERVICES ) . build ( ) , attr . getPropertyName ( ) , 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 , true ) ) . 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: returns an array of String representations of the parameter types . Primitives are returned as their native representations while classes are returned in the internal descriptor form e . g . Ljava / lang / Integer ; [CODESPLIT] public static String [ ] parameterDescriptors ( String methodDescriptor ) { int i = 1 ; // char 0 is a '(' List < String > ret = new ArrayList < String > ( ) ; int arrayStart = - 1 ; while ( methodDescriptor . charAt ( i ) != ' ' ) { String type = null ; if ( methodDescriptor . charAt ( i ) == ' ' ) { if ( arrayStart == - 1 ) { arrayStart = i ; } } else { if ( methodDescriptor . charAt ( i ) == ' ' ) { int start = i ; i ++ ; while ( methodDescriptor . charAt ( i ) != ' ' ) { ++ i ; } if ( arrayStart == - 1 ) { type = methodDescriptor . substring ( start , i ) ; } else { type = methodDescriptor . substring ( arrayStart , i ) ; } } else { if ( arrayStart == - 1 ) { type = methodDescriptor . charAt ( i ) + "" ; } else { type = methodDescriptor . substring ( arrayStart , i + 1 ) ; } } arrayStart = - 1 ; ret . add ( type ) ; } ++ i ; } String [ ] r = new String [ ret . size ( ) ] ; for ( int j = 0 ; j < ret . size ( ) ; ++ j ) { r [ j ] = ret . get ( j ) ; } return r ; }


Input: performs basic validation on a descriptor [CODESPLIT] public static String validateDescriptor ( String descriptor ) { if ( descriptor . length ( ) == 0 ) { throw EeLogger . ROOT_LOGGER . cannotBeEmpty ( "descriptors" ) ; } if ( descriptor . length ( ) > 1 ) { if ( descriptor . startsWith ( "L" ) ) { if ( ! descriptor . endsWith ( ";" ) ) { throw EeLogger . ROOT_LOGGER . invalidDescriptor ( descriptor ) ; } } else if ( descriptor . startsWith ( "[" ) ) { } else { throw EeLogger . ROOT_LOGGER . invalidDescriptor ( descriptor ) ; } } else { char type = descriptor . charAt ( 0 ) ; switch ( type ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : break ; default : throw EeLogger . ROOT_LOGGER . invalidDescriptor ( descriptor ) ; } } return descriptor ; }


Input: Process a deployment for KernelDeployment configuration . Will install a { @code POJO } for each configured bean . [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext . getDeploymentUnit ( ) ; final List < KernelDeploymentXmlDescriptor > kdXmlDescriptors = unit . getAttachment ( KernelDeploymentXmlDescriptor . ATTACHMENT_KEY ) ; if ( kdXmlDescriptors == null || kdXmlDescriptors . isEmpty ( ) ) return ; final Module module = unit . getAttachment ( Attachments . MODULE ) ; if ( module == null ) throw PojoLogger . ROOT_LOGGER . noModuleFound ( unit ) ; final ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; final DeploymentReflectionIndex index = unit . getAttachment ( Attachments . REFLECTION_INDEX ) ; if ( index == null ) throw PojoLogger . ROOT_LOGGER . missingReflectionIndex ( unit ) ; for ( KernelDeploymentXmlDescriptor kdXmlDescriptor : kdXmlDescriptors ) { final List < BeanMetaDataConfig > beanConfigs = kdXmlDescriptor . getBeans ( ) ; for ( final BeanMetaDataConfig beanConfig : beanConfigs ) { describeBean ( module , serviceTarget , index , beanConfig ) ; } // TODO -- KD::classloader, KD::aliases } }


Input: { [CODESPLIT] public ManagedReference getReference ( ) { try { return view . createInstance ( ) ; } catch ( Exception e ) { throw EeLogger . ROOT_LOGGER . componentViewConstructionFailure ( e ) ; } }


Input: Creates web meta data for EJB deployments . [CODESPLIT] void create ( final Deployment dep ) { final DeploymentUnit unit = WSHelper . getRequiredAttachment ( dep , DeploymentUnit . class ) ; WarMetaData warMD = ASHelper . getOptionalAttachment ( unit , WarMetaData . ATTACHMENT_KEY ) ; JBossWebMetaData jbossWebMD = warMD != null ? warMD . getMergedJBossWebMetaData ( ) : null ; if ( warMD == null ) { warMD = new WarMetaData ( ) ; } if ( jbossWebMD == null ) { jbossWebMD = new JBossWebMetaData ( ) ; warMD . setMergedJBossWebMetaData ( jbossWebMD ) ; unit . putAttachment ( WarMetaData . ATTACHMENT_KEY , warMD ) ; } createWebAppDescriptor ( dep , jbossWebMD ) ; createJBossWebAppDescriptor ( dep , jbossWebMD ) ; dep . addAttachment ( JBossWebMetaData . class , jbossWebMD ) ; }


Input: Creates web . xml descriptor meta data . [CODESPLIT] private void createWebAppDescriptor ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { WSLogger . ROOT_LOGGER . trace ( "Creating web.xml descriptor" ) ; createServlets ( dep , jbossWebMD ) ; createServletMappings ( dep , jbossWebMD ) ; createSecurityConstraints ( dep , jbossWebMD ) ; createLoginConfig ( dep , jbossWebMD ) ; createSecurityRoles ( dep , jbossWebMD ) ; }


Input: Creates jboss - web . xml descriptor meta data . <p / > <pre > &lt ; jboss - web&gt ; &lt ; security - domain&gt ; java : / jaas / custom - security - domain&lt ; / security - domain&gt ; &lt ; context - root&gt ; / custom - context - root&lt ; / context - root&gt ; &lt ; virtual - host&gt ; host1&lt ; / virtual - host&gt ; ... &lt ; virtual - host&gt ; hostN&lt ; / virtual - host&gt ; &lt ; / jboss - web&gt ; < / pre > [CODESPLIT] private void createJBossWebAppDescriptor ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { WSLogger . ROOT_LOGGER . trace ( "Creating jboss-web.xml descriptor" ) ; // Set security domain final String securityDomain = ejb3SecurityAccessor . getSecurityDomain ( dep ) ; final boolean hasSecurityDomain = securityDomain != null ; if ( hasSecurityDomain ) { WSLogger . ROOT_LOGGER . tracef ( "Setting security domain: %s" , securityDomain ) ; jbossWebMD . setSecurityDomain ( securityDomain ) ; } // Set virtual host final String virtualHost = dep . getService ( ) . getVirtualHost ( ) ; ServerHostInfo serverHostInfo = new ServerHostInfo ( virtualHost ) ; if ( serverHostInfo . getHost ( ) != null ) { WSLogger . ROOT_LOGGER . tracef ( "Setting virtual host: %s" , serverHostInfo . getHost ( ) ) ; jbossWebMD . setVirtualHosts ( Arrays . asList ( serverHostInfo . getHost ( ) ) ) ; if ( serverHostInfo . getServerInstanceName ( ) != null ) { jbossWebMD . setServerInstanceName ( serverHostInfo . getServerInstanceName ( ) ) ; } } }


Input: Creates servlets part of web . xml descriptor . <p / > <pre > &lt ; servlet&gt ; &lt ; servlet - name&gt ; EJBEndpointShortName&lt ; / servlet - name&gt ; &lt ; servlet - class&gt ; EJBEndpointTargetBeanName&lt ; / servlet - class&gt ; &lt ; / servlet&gt ; < / pre > [CODESPLIT] private void createServlets ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { WSLogger . ROOT_LOGGER . trace ( "Creating servlets" ) ; final JBossServletsMetaData servlets = WebMetaDataHelper . getServlets ( jbossWebMD ) ; for ( final Endpoint endpoint : dep . getService ( ) . getEndpoints ( ) ) { final String endpointName = endpoint . getShortName ( ) ; final String endpointClassName = endpoint . getTargetBeanName ( ) ; WSLogger . ROOT_LOGGER . tracef ( "Servlet name: %s, class: %s" , endpointName , endpointClassName ) ; WebMetaDataHelper . newServlet ( endpointName , endpointClassName , servlets ) ; } }


Input: Creates servlet - mapping part of web . xml descriptor . <p / > <pre > &lt ; servlet - mapping&gt ; &lt ; servlet - name&gt ; EJBEndpointShortName&lt ; / servlet - name&gt ; &lt ; url - pattern&gt ; EJBEndpointURLPattern&lt ; / url - pattern&gt ; &lt ; / servlet - mapping&gt ; < / pre > [CODESPLIT] private void createServletMappings ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { WSLogger . ROOT_LOGGER . trace ( "Creating servlet mappings" ) ; final List < ServletMappingMetaData > servletMappings = WebMetaDataHelper . getServletMappings ( jbossWebMD ) ; for ( final Endpoint ep : dep . getService ( ) . getEndpoints ( ) ) { if ( ep instanceof HttpEndpoint ) { final String endpointName = ep . getShortName ( ) ; final List < String > urlPatterns = WebMetaDataHelper . getUrlPatterns ( ( ( HttpEndpoint ) ep ) . getURLPattern ( ) ) ; WSLogger . ROOT_LOGGER . tracef ( "Servlet name: %s, URL patterns: %s" , endpointName , urlPatterns ) ; WebMetaDataHelper . newServletMapping ( endpointName , urlPatterns , servletMappings ) ; } } }


Input: Creates security constraints part of web . xml descriptor . <p / > <pre > &lt ; security - constraint&gt ; &lt ; web - resource - collection&gt ; &lt ; web - resource - name&gt ; EJBEndpointShortName&lt ; / web - resource - name&gt ; &lt ; url - pattern&gt ; EJBEndpointURLPattern&lt ; / url - pattern&gt ; &lt ; http - method&gt ; GET&lt ; / http - method&gt ; &lt ; http - method&gt ; POST&lt ; / http - method&gt ; &lt ; / web - resource - collection&gt ; &lt ; auth - constraint&gt ; &lt ; role - name&gt ; * &lt ; / role - name&gt ; &lt ; / auth - constraint&gt ; &lt ; user - data - constraint&gt ; &lt ; transport - guarantee&gt ; EjbTransportGuarantee&lt ; / transport - guarantee&gt ; &lt ; / user - data - constraint&gt ; &lt ; / security - constraint&gt ; < / pre > [CODESPLIT] private void createSecurityConstraints ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { WSLogger . ROOT_LOGGER . trace ( "Creating security constraints" ) ; for ( final Endpoint ejbEndpoint : dep . getService ( ) . getEndpoints ( ) ) { final boolean secureWsdlAccess = ejb3SecurityAccessor . isSecureWsdlAccess ( ejbEndpoint ) ; final String transportGuarantee = ejb3SecurityAccessor . getTransportGuarantee ( ejbEndpoint ) ; final boolean hasTransportGuarantee = transportGuarantee != null ; final String authMethod = ejb3SecurityAccessor . getAuthMethod ( ejbEndpoint ) ; final boolean hasAuthMethod = authMethod != null ; if ( ejbEndpoint instanceof HttpEndpoint && ( hasAuthMethod || hasTransportGuarantee ) ) { final List < SecurityConstraintMetaData > securityConstraints = WebMetaDataHelper . getSecurityConstraints ( jbossWebMD ) ; // security-constraint final SecurityConstraintMetaData securityConstraint = WebMetaDataHelper . newSecurityConstraint ( securityConstraints ) ; // web-resource-collection final WebResourceCollectionsMetaData webResourceCollections = WebMetaDataHelper . getWebResourceCollections ( securityConstraint ) ; final String endpointName = ejbEndpoint . getShortName ( ) ; final String urlPattern = ( ( HttpEndpoint ) ejbEndpoint ) . getURLPattern ( ) ; WSLogger . ROOT_LOGGER . tracef ( "Creating web resource collection for endpoint: %s, URL pattern: %s" , endpointName , urlPattern ) ; WebMetaDataHelper . newWebResourceCollection ( endpointName , urlPattern , secureWsdlAccess , webResourceCollections ) ; // auth-constraint if ( hasAuthMethod ) { WSLogger . ROOT_LOGGER . tracef ( "Creating auth constraint for endpoint: %s" , endpointName ) ; WebMetaDataHelper . newAuthConstraint ( WebMetaDataHelper . getAllRoles ( ) , securityConstraint ) ; } // user-data-constraint if ( hasTransportGuarantee ) { WSLogger . ROOT_LOGGER . tracef ( "Creating new user data constraint for endpoint: %s, transport guarantee: %s" , endpointName , transportGuarantee ) ; WebMetaDataHelper . newUserDataConstraint ( transportGuarantee , securityConstraint ) ; } } } }


Input: Creates login - config part of web . xml descriptor . <p / > <pre > &lt ; login - config&gt ; &lt ; auth - method&gt ; EjbDeploymentAuthMethod&lt ; / auth - method&gt ; &lt ; realm - name&gt ; EJBWebServiceEndpointServlet Realm&lt ; / realm - name&gt ; &lt ; / login - config&gt ; < / pre > [CODESPLIT] private void createLoginConfig ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { final String authMethod = getAuthMethod ( dep ) ; final boolean hasAuthMethod = authMethod != null ; final String realmName = getRealmName ( dep ) ; if ( hasAuthMethod ) { WSLogger . ROOT_LOGGER . tracef ( "Creating new login config: %s, auth method: %s" , EJB_WEBSERVICE_REALM , authMethod ) ; final LoginConfigMetaData loginConfig = WebMetaDataHelper . getLoginConfig ( jbossWebMD ) ; if ( realmName != null ) { loginConfig . setRealmName ( realmName ) ; } else { loginConfig . setRealmName ( WebMetaDataCreator . EJB_WEBSERVICE_REALM ) ; } loginConfig . setAuthMethod ( authMethod ) ; } }


Input: Creates security roles part of web . xml descriptor . <p / > <pre > &lt ; security - role&gt ; &lt ; role - name&gt ; role1&lt ; / role - name&gt ; ... &lt ; role - name&gt ; roleN&lt ; / role - name&gt ; &lt ; / security - role&gt ; < / pre > [CODESPLIT] private void createSecurityRoles ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { final String authMethod = getAuthMethod ( dep ) ; final boolean hasAuthMethod = authMethod != null ; if ( hasAuthMethod ) { final SecurityRolesMetaData securityRolesMD = ejb3SecurityAccessor . getSecurityRoles ( dep ) ; final boolean hasSecurityRolesMD = securityRolesMD != null && ! securityRolesMD . isEmpty ( ) ; if ( hasSecurityRolesMD ) { WSLogger . ROOT_LOGGER . trace ( "Setting security roles" ) ; jbossWebMD . setSecurityRoles ( securityRolesMD ) ; } } //merge security roles from the ear //TODO: is there somewhere better to put this? final DeploymentUnit unit = dep . getAttachment ( DeploymentUnit . class ) ; DeploymentUnit parent = unit . getParent ( ) ; if ( parent != null ) { final EarMetaData earMetaData = parent . getAttachment ( org . jboss . as . ee . structure . Attachments . EAR_METADATA ) ; if ( earMetaData != null ) { if ( jbossWebMD . getSecurityRoles ( ) == null ) { jbossWebMD . setSecurityRoles ( new SecurityRolesMetaData ( ) ) ; } SecurityRolesMetaData earSecurityRolesMetaData = earMetaData . getSecurityRoles ( ) ; if ( earSecurityRolesMetaData != null ) { SecurityRolesMetaDataMerger . merge ( jbossWebMD . getSecurityRoles ( ) , jbossWebMD . getSecurityRoles ( ) , earSecurityRolesMetaData ) ; } } } }


Input: Returns deployment authentication method . [CODESPLIT] private String getAuthMethod ( final Deployment dep ) { for ( final Endpoint ejbEndpoint : dep . getService ( ) . getEndpoints ( ) ) { final String beanAuthMethod = ejb3SecurityAccessor . getAuthMethod ( ejbEndpoint ) ; final boolean hasBeanAuthMethod = beanAuthMethod != null ; if ( hasBeanAuthMethod ) { // First found auth-method defines war // login-config/auth-method return beanAuthMethod ; } } return null ; }


Input: Process a deployment for jboss - service . xml files . Will parse the xml file and attach a configuration discovered during processing . [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final VirtualFile deploymentRoot = phaseContext . getDeploymentUnit ( ) . getAttachment ( Attachments . DEPLOYMENT_ROOT ) . getRoot ( ) ; if ( deploymentRoot == null || ! deploymentRoot . exists ( ) ) return ; VirtualFile serviceXmlFile = null ; if ( deploymentRoot . isDirectory ( ) ) { serviceXmlFile = deploymentRoot . getChild ( SERVICE_DESCRIPTOR_PATH ) ; } else if ( deploymentRoot . getName ( ) . toLowerCase ( Locale . ENGLISH ) . endsWith ( SERVICE_DESCRIPTOR_SUFFIX ) ) { serviceXmlFile = deploymentRoot ; } if ( serviceXmlFile == null || ! serviceXmlFile . exists ( ) ) return ; final XMLMapper xmlMapper = XMLMapper . Factory . create ( ) ; final JBossServiceXmlDescriptorParser jBossServiceXmlDescriptorParser = new JBossServiceXmlDescriptorParser ( JBossDescriptorPropertyReplacement . propertyReplacer ( phaseContext . getDeploymentUnit ( ) ) ) ; xmlMapper . registerRootElement ( new QName ( "urn:jboss:service:7.0" , "server" ) , jBossServiceXmlDescriptorParser ) ; xmlMapper . registerRootElement ( new QName ( null , "server" ) , jBossServiceXmlDescriptorParser ) ; InputStream xmlStream = null ; try { xmlStream = serviceXmlFile . openStream ( ) ; final XMLStreamReader reader = inputFactory . createXMLStreamReader ( xmlStream ) ; final ParseResult < JBossServiceXmlDescriptor > result = new ParseResult < JBossServiceXmlDescriptor > ( ) ; xmlMapper . parseDocument ( result , reader ) ; final JBossServiceXmlDescriptor xmlDescriptor = result . getResult ( ) ; if ( xmlDescriptor != null ) phaseContext . getDeploymentUnit ( ) . putAttachment ( JBossServiceXmlDescriptor . ATTACHMENT_KEY , xmlDescriptor ) ; else throw SarLogger . ROOT_LOGGER . failedXmlParsing ( serviceXmlFile ) ; } catch ( Exception e ) { throw SarLogger . ROOT_LOGGER . failedXmlParsing ( e , serviceXmlFile ) ; } finally { VFSUtils . safeClose ( xmlStream ) ; } }


Input: Handles setting up the ejbCreate and ejbRemove methods for stateless session beans and MDB s [CODESPLIT] private void handleStatelessSessionBean ( final EJBComponentDescription component , final Module module , final DeploymentReflectionIndex reflectionIndex ) throws ClassNotFoundException , DeploymentUnitProcessingException { final Class < ? > componentClass = ClassLoadingUtils . loadClass ( component . getComponentClassName ( ) , module ) ; final MethodIdentifier ejbCreateId = MethodIdentifier . getIdentifier ( void . class , "ejbCreate" ) ; final Method ejbCreate = ClassReflectionIndexUtil . findMethod ( reflectionIndex , componentClass , ejbCreateId ) ; if ( ejbCreate != null ) { final InterceptorClassDescription . Builder builder = InterceptorClassDescription . builder ( ) ; builder . setPostConstruct ( ejbCreateId ) ; component . addInterceptorMethodOverride ( ejbCreate . getDeclaringClass ( ) . getName ( ) , builder . build ( ) ) ; } final MethodIdentifier ejbRemoveId = MethodIdentifier . getIdentifier ( void . class , "ejbRemove" ) ; final Method ejbRemove = ClassReflectionIndexUtil . findMethod ( reflectionIndex , componentClass , ejbRemoveId ) ; if ( ejbRemove != null ) { final InterceptorClassDescription . Builder builder = InterceptorClassDescription . builder ( ) ; builder . setPreDestroy ( ejbRemoveId ) ; component . addInterceptorMethodOverride ( ejbRemove . getDeclaringClass ( ) . getName ( ) , builder . build ( ) ) ; } }


Input: Makes a dynamic stub class if it does not already exist . [CODESPLIT] public static Class < ? > makeStubClass ( final Class < ? > myClass ) { final String stubClassName = myClass + "_Stub" ; ClassLoader cl = WildFlySecurityManager . getCurrentContextClassLoaderPrivileged ( ) ; if ( cl == null ) { cl = myClass . getClassLoader ( ) ; } if ( cl == null ) { throw EjbLogger . ROOT_LOGGER . couldNotFindClassLoaderForStub ( stubClassName ) ; } Class < ? > theClass ; try { theClass = cl . loadClass ( stubClassName ) ; } catch ( ClassNotFoundException e ) { try { final ClassFile clazz = IIOPStubCompiler . compile ( myClass , stubClassName ) ; theClass = clazz . define ( cl , myClass . getProtectionDomain ( ) ) ; } catch ( Throwable ex ) { //there is a possibility that another thread may have defined the same class in the meantime try { theClass = cl . loadClass ( stubClassName ) ; } catch ( ClassNotFoundException e1 ) { EjbLogger . ROOT_LOGGER . dynamicStubCreationFailed ( stubClassName , ex ) ; throw ex ; } } } return theClass ; }


Input: Repository implementation ------------------------------------- [CODESPLIT] public Contained lookup_id ( java . lang . String search_id ) { LocalContained c = _lookup_id ( search_id ) ; if ( c == null ) return null ; return ContainedHelper . narrow ( c . getReference ( ) ) ; }


Input: Generate the ID of the n - th anonymous object created in this IR . [CODESPLIT] protected byte [ ] getAnonymousObjectId ( long n ) { String s = anonOidPrefix + Long . toString ( n ) ; return s . getBytes ( StandardCharsets . UTF_8 ) ; }


Input: Convert a repository ID to an IDL scoped name . Returns <code > null< / code > if the ID cannot be understood . [CODESPLIT] private String scopedName ( String id ) { if ( id == null ) return null ; if ( id . startsWith ( "IDL:" ) ) { // OMG IDL format // Check for base types if ( "IDL:omg.org/CORBA/Object:1.0" . equals ( id ) || "IDL:omg.org/CORBA/ValueBase:1.0" . equals ( id ) ) return null ; // Get 2nd component of ID int idx2 = id . indexOf ( ' ' , 4 ) ; // 2nd colon if ( idx2 == - 1 ) return null ; // invalid ID, version part missing String base = id . substring ( 4 , id . indexOf ( ' ' , 4 ) ) ; // Check special prefixes if ( base . startsWith ( "omg.org" ) ) base = "org/omg" + base . substring ( 7 ) ; if ( base . startsWith ( "w3c.org" ) ) base = "org/w3c" + base . substring ( 7 ) ; // convert '/' to "::" StringBuffer b = new StringBuffer ( ) ; for ( int i = 0 ; i < base . length ( ) ; ++ i ) { char c = base . charAt ( i ) ; if ( c != ' ' ) b . append ( c ) ; else b . append ( "::" ) ; } return b . toString ( ) ; } else if ( id . startsWith ( "RMI:" ) ) { // RMI hashed format // Get 2nd component of ID int idx2 = id . indexOf ( ' ' , 4 ) ; // 2nd colon if ( idx2 == - 1 ) return null ; // invalid ID, version part missing String base = id . substring ( 4 , id . indexOf ( ' ' , 4 ) ) ; // convert '.' to "::" StringBuffer b = new StringBuffer ( ) ; for ( int i = 0 ; i < base . length ( ) ; ++ i ) { char c = base . charAt ( i ) ; if ( c != ' ' ) b . append ( c ) ; else b . append ( "::" ) ; } return b . toString ( ) ; } else return null ; }


Input: { [CODESPLIT] @ Override public TransformedOperation transformOperation ( TransformationContext context , PathAddress address , ModelNode operation ) { return new TransformedOperation ( this . operationTransformer . transformOperation ( operation ) , this . resultTransformer ) ; }


Input: { [CODESPLIT] @ Override public void initialize ( final ExtensionContext context ) { WeldLogger . ROOT_LOGGER . debug ( "Activating Weld Extension" ) ; final SubsystemRegistration subsystem = context . registerSubsystem ( SUBSYSTEM_NAME , CURRENT_MODEL_VERSION ) ; final ManagementResourceRegistration registration = subsystem . registerSubsystemModel ( WeldResourceDefinition . INSTANCE ) ; registration . registerOperationHandler ( GenericSubsystemDescribeHandler . DEFINITION , GenericSubsystemDescribeHandler . INSTANCE ) ; subsystem . registerXMLElementWriter ( WeldSubsystem40Parser . INSTANCE ) ; }


Input: { [CODESPLIT] @ Override public void initializeParsers ( final ExtensionParsingContext context ) { context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , WeldSubsystem10Parser . NAMESPACE , ( ) -> WeldSubsystem10Parser . INSTANCE ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , WeldSubsystem20Parser . NAMESPACE , ( ) -> WeldSubsystem20Parser . INSTANCE ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , WeldSubsystem30Parser . NAMESPACE , ( ) -> WeldSubsystem30Parser . INSTANCE ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , WeldSubsystem40Parser . NAMESPACE , ( ) -> WeldSubsystem40Parser . INSTANCE ) ; }


Input: { [CODESPLIT] public void start ( final StartContext context ) { super . start ( context ) ; if ( SarLogger . ROOT_LOGGER . isTraceEnabled ( ) ) { SarLogger . ROOT_LOGGER . tracef ( "Creating Service: %s" , context . getController ( ) . getName ( ) ) ; } final Runnable task = new Runnable ( ) { @ Override public void run ( ) { try { injectDependencies ( ) ; invokeLifecycleMethod ( createMethod , context ) ; if ( componentInstantiator != null ) { managedReference = componentInstantiator . initializeInstance ( mBeanInstance ) ; } context . complete ( ) ; } catch ( Throwable e ) { uninjectDependencies ( ) ; context . failed ( new StartException ( SarLogger . ROOT_LOGGER . failedExecutingLegacyMethod ( "create()" ) , e ) ) ; } } } ; try { executorSupplier . get ( ) . submit ( task ) ; } catch ( RejectedExecutionException e ) { task . run ( ) ; } finally { context . asynchronous ( ) ; } }


Input: TODO : Remove this method once WFCORE - 3055 and WFCORE - 3056 are fixed [CODESPLIT] @ Override protected void validateUpdatedModel ( OperationContext context , Resource model ) throws OperationFailedException { SecurityDomainResourceDefinition . CACHE_TYPE . validateOperation ( model . getModel ( ) ) ; }


Input: { [CODESPLIT] @ Override public void validateParameter ( String parameterName , ModelNode value ) throws OperationFailedException { super . validateParameter ( parameterName , value ) ; if ( value . isDefined ( ) && value . getType ( ) != ModelType . EXPRESSION ) { String val = value . asString ( ) ; try { PredicateParser . parse ( val , getClass ( ) . getClassLoader ( ) ) ; } catch ( Exception e ) { throw new OperationFailedException ( UndertowLogger . ROOT_LOGGER . predicateNotValid ( val , e . getMessage ( ) ) , e ) ; } } }


Input:
Return a new instance of each persistence provider class [CODESPLIT] @ Override public List < PersistenceProvider > getPersistenceProviders ( ) { List < PersistenceProvider > providersCopy = new ArrayList <> ( providers . size ( ) ) ; /**
         * Add the application specified providers first so they are found before the global providers
         */ synchronized ( persistenceProviderPerClassLoader ) { if ( persistenceProviderPerClassLoader . size ( ) > 0 ) { // get the deployment or subdeployment classloader ClassLoader deploymentClassLoader = findParentModuleCl ( WildFlySecurityManager . getCurrentContextClassLoaderPrivileged ( ) ) ; ROOT_LOGGER . tracef ( "get application level Persistence Provider for classloader %s" , deploymentClassLoader ) ; // collect persistence providers associated with deployment/each sub-deployment List < Class < ? extends PersistenceProvider > > deploymentSpecificPersistenceProviders = persistenceProviderPerClassLoader . get ( deploymentClassLoader ) ; ROOT_LOGGER . tracef ( "got application level Persistence Provider list %s" , deploymentSpecificPersistenceProviders ) ; if ( deploymentSpecificPersistenceProviders != null ) { for ( Class < ? extends PersistenceProvider > providerClass : deploymentSpecificPersistenceProviders ) { try { ROOT_LOGGER . tracef ( "application has its own Persistence Provider %s" , providerClass . getName ( ) ) ; providersCopy . add ( providerClass . newInstance ( ) ) ; } catch ( InstantiationException e ) { throw JpaLogger . ROOT_LOGGER . couldNotCreateInstanceProvider ( e , providerClass . getName ( ) ) ; } catch ( IllegalAccessException e ) { throw JpaLogger . ROOT_LOGGER . couldNotCreateInstanceProvider ( e , providerClass . getName ( ) ) ; } } } } } // add global persistence providers last (so application packaged providers have priority) for ( Class < ? > providerClass : providers ) { try { providersCopy . add ( ( PersistenceProvider ) providerClass . newInstance ( ) ) ; ROOT_LOGGER . tracef ( "returning global (module) Persistence Provider %s" , providerClass . getName ( ) ) ; } catch ( InstantiationException e ) { throw JpaLogger . ROOT_LOGGER . couldNotCreateInstanceProvider ( e , providerClass . getName ( ) ) ; } catch ( IllegalAccessException e ) { throw JpaLogger . ROOT_LOGGER . couldNotCreateInstanceProvider ( e , providerClass . getName ( ) ) ; } } return providersCopy ; }


Input: Cleared at application undeployment time to remove any persistence providers that were deployed with the application [CODESPLIT] public void clearCachedDeploymentSpecificProviders ( Set < ClassLoader > deploymentClassLoaders ) { synchronized ( persistenceProviderPerClassLoader ) { for ( ClassLoader deploymentClassLoader : deploymentClassLoaders ) { persistenceProviderPerClassLoader . remove ( deploymentClassLoader ) ; } } }


Input: Set at application deployment time to the persistence providers packaged in the application [CODESPLIT] public void addDeploymentSpecificPersistenceProvider ( PersistenceProvider persistenceProvider , Set < ClassLoader > deploymentClassLoaders ) { synchronized ( persistenceProviderPerClassLoader ) { for ( ClassLoader deploymentClassLoader : deploymentClassLoaders ) { List < Class < ? extends PersistenceProvider > > list = persistenceProviderPerClassLoader . get ( deploymentClassLoader ) ; ROOT_LOGGER . tracef ( "getting persistence provider list (%s) for deployment (%s)" , list , deploymentClassLoader ) ; if ( list == null ) { list = new ArrayList <> ( ) ; persistenceProviderPerClassLoader . put ( deploymentClassLoader , list ) ; ROOT_LOGGER . tracef ( "saving new persistence provider list (%s) for deployment (%s)" , list , deploymentClassLoader ) ; } list . add ( persistenceProvider . getClass ( ) ) ; ROOT_LOGGER . tracef ( "added new persistence provider (%s) to provider list (%s)" , persistenceProvider . getClass ( ) . getName ( ) , list ) ; } } }


Input: If a custom CL is in use we want to get the module CL it delegates to [CODESPLIT] private ClassLoader findParentModuleCl ( ClassLoader classLoader ) { ClassLoader c = classLoader ; while ( c != null && ! ( c instanceof ModuleClassLoader ) ) { c = c . getParent ( ) ; } return c ; }


Input: <p > Parses the JacORB subsystem configuration according to the XSD version 1 . 0 . < / p > [CODESPLIT] private void readElement_1_0 ( Namespace namespace , XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { final EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { // check the element namespace. if ( Namespace . JacORB_1_0 != Namespace . forUri ( reader . getNamespaceURI ( ) ) ) throw unexpectedElement ( reader ) ; final Element element = Element . forName ( reader . getLocalName ( ) ) ; // there can be multiple property elements. if ( ! encountered . add ( element ) && element != Element . PROPERTY ) { throw duplicateNamedElement ( reader , element . getLocalName ( ) ) ; } switch ( element ) { case ORB : { this . parseORBConfig_1_0 ( reader , node ) ; break ; } case POA : { this . parsePOAConfig ( namespace , reader , node ) ; break ; } case INTEROP : { this . parseInteropConfig ( reader , node ) ; break ; } case SECURITY : { this . parseSecurityConfig_1_0 ( reader , node ) ; break ; } case PROPERTY : { ModelNode propertiesNode = node . get ( JacORBSubsystemConstants . PROPERTIES ) ; this . parseGenericProperty_1_0 ( reader , propertiesNode ) ; break ; } case ORB_INITIALIZERS : { this . parseORBInitializersConfig_1_0 ( reader , node ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: <p > Parses the JacORB subsystem configuration according to the XSD version 1 . 1 or higher . < / p > [CODESPLIT] private void readElement_1_1 ( Namespace namespace , XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { final EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { // check the element namespace. if ( namespace != Namespace . forUri ( reader . getNamespaceURI ( ) ) ) throw unexpectedElement ( reader ) ; final Element element = Element . forName ( reader . getLocalName ( ) ) ; if ( ! encountered . add ( element ) ) { throw duplicateNamedElement ( reader , element . getLocalName ( ) ) ; } switch ( element ) { case ORB : { this . parseORBConfig ( namespace , reader , node ) ; break ; } case POA : { this . parsePOAConfig ( namespace , reader , node ) ; break ; } case NAMING : { this . parseNamingConfig ( reader , node ) ; break ; } case INTEROP : { this . parseInteropConfig ( reader , node ) ; break ; } case SECURITY : { this . parseSecurityConfig ( reader , node ) ; break ; } case PROPERTIES : { this . parsePropertiesConfig ( namespace , reader , node ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: <p > Parses the { @code orb } section of the JacORB subsystem configuration according to the XSD version 1 . 0 . < / p > [CODESPLIT] private void parseORBConfig_1_0 ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse the orb config attributes. EnumSet < Attribute > expectedAttributes = EnumSet . of ( Attribute . NAME , Attribute . ORB_PRINT_VERSION , Attribute . ORB_GIOP_MINOR_VERSION , Attribute . ORB_USE_BOM , Attribute . ORB_USE_IMR , Attribute . ORB_CACHE_POA_NAMES , Attribute . ORB_CACHE_TYPECODES ) ; this . parseAttributes ( reader , node , expectedAttributes , null ) ; // parse the orb config elements. EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { // check the element namespace. if ( Namespace . JacORB_1_0 != Namespace . forUri ( reader . getNamespaceURI ( ) ) ) throw unexpectedElement ( reader ) ; final Element element = Element . forName ( reader . getLocalName ( ) ) ; // check for duplicate elements. if ( ! encountered . add ( element ) ) { throw duplicateNamedElement ( reader , element . getLocalName ( ) ) ; } switch ( element ) { case ORB_CONNECTION : { this . parseORBConnectionConfig ( reader , node ) ; break ; } case NAMING : { this . parseNamingConfig ( reader , node ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: <p > Parses the { @code orb } section of the JacORB subsystem configuration according to the XSD version 1 . 1 or higher . < / p > [CODESPLIT] private void parseORBConfig ( Namespace namespace , XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse the orb config attributes. EnumSet < Attribute > expectedAttributes = EnumSet . of ( Attribute . NAME , Attribute . ORB_PRINT_VERSION , Attribute . ORB_GIOP_MINOR_VERSION , Attribute . ORB_USE_BOM , Attribute . ORB_USE_IMR , Attribute . ORB_CACHE_POA_NAMES , Attribute . ORB_CACHE_TYPECODES ) ; // version 1.2 of the schema allows for the configuration of the ORB socket bindings. if ( namespace . ordinal ( ) >= Namespace . JacORB_1_2 . ordinal ( ) ) { expectedAttributes . add ( Attribute . ORB_SOCKET_BINDING ) ; expectedAttributes . add ( Attribute . ORB_SSL_SOCKET_BINDING ) ; } if ( namespace . ordinal ( ) >= Namespace . JacORB_2_0 . ordinal ( ) ) { expectedAttributes . add ( Attribute . ORB_PERSISTENT_SERVER_ID ) ; } this . parseAttributes ( reader , node , expectedAttributes , null ) ; // parse the orb config elements. EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { // check the element namespace. if ( namespace != Namespace . forUri ( reader . getNamespaceURI ( ) ) ) throw unexpectedElement ( reader ) ; final Element element = Element . forName ( reader . getLocalName ( ) ) ; // check for duplicate elements. if ( ! encountered . add ( element ) ) { throw duplicateNamedElement ( reader , element . getLocalName ( ) ) ; } switch ( element ) { case ORB_CONNECTION : { this . parseORBConnectionConfig ( reader , node ) ; break ; } case ORB_INITIALIZERS : { this . parseORBInitializersConfig ( reader , node ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: <p > Parses the ORB { @code connection } section of the JacORB subsystem configuration . < / p > [CODESPLIT] private void parseORBConnectionConfig ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse the orb connection config attributes. EnumSet < Attribute > attributes = EnumSet . of ( Attribute . ORB_CONN_RETRIES , Attribute . ORB_CONN_RETRY_INTERVAL , Attribute . ORB_CONN_CLIENT_TIMEOUT , Attribute . ORB_CONN_SERVER_TIMEOUT , Attribute . ORB_CONN_MAX_SERVER_CONNECTIONS , Attribute . ORB_CONN_MAX_MANAGED_BUF_SIZE , Attribute . ORB_CONN_OUTBUF_SIZE , Attribute . ORB_CONN_OUTBUF_CACHE_TIMEOUT ) ; this . parseAttributes ( reader , node , attributes , null ) ; // the connection sub-element doesn't have child elements. requireNoContent ( reader ) ; }


Input: <p > Parses the ORB { @code initializers } section of the JacORB subsystem configuration according to the XSD version 1 . 0 . < / p > [CODESPLIT] private void parseORBInitializersConfig_1_0 ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { requireNoAttributes ( reader ) ; // read the element text - a comma-separated list of initializers. String initializersList = reader . getElementText ( ) ; if ( initializersList != null ) { String [ ] initializers = initializersList . split ( "," ) ; // read each configured initializer and set the appropriate values in the model node. for ( String initializer : initializers ) { SimpleAttributeDefinition definition = ( SimpleAttributeDefinition ) JacORBSubsystemDefinitions . valueOf ( initializer ) ; if ( definition != null && JacORBSubsystemDefinitions . ORB_INIT_ATTRIBUTES . contains ( definition ) ) node . get ( definition . getName ( ) ) . set ( JacORBSubsystemConstants . ON ) ; else throw JacORBLogger . ROOT_LOGGER . invalidInitializerConfig ( initializer , reader . getLocation ( ) ) ; } } }


Input: <p > Parses the ORB { @code initializers } section of the JacORB subsystem configuration according to the XSD version 1 . 1 or higher . < / p > [CODESPLIT] private void parseORBInitializersConfig ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse the initializers config attributes. EnumSet < Attribute > attributes = EnumSet . of ( Attribute . ORB_INIT_SECURITY , Attribute . ORB_INIT_TRANSACTIONS ) ; this . parseAttributes ( reader , node , attributes , null ) ; // the initializers element doesn't have child elements. requireNoContent ( reader ) ; //if security="on" change it to security="identity" if ( node . has ( SECURITY ) && node . get ( SECURITY ) . asString ( ) . equals ( JacORBSubsystemConstants . ON ) ) { node . get ( SECURITY ) . set ( SecurityAllowedValues . IDENTITY . toString ( ) ) ; } }


Input: <p > Parses the { @code poa } section of the JacORB subsystem configuration . < / p > [CODESPLIT] private void parsePOAConfig ( Namespace namespace , XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse the poa config attributes. EnumSet < Attribute > expectedAttributes = EnumSet . of ( Attribute . POA_MONITORING , Attribute . POA_QUEUE_WAIT , Attribute . POA_QUEUE_MIN , Attribute . POA_QUEUE_MAX ) ; this . parseAttributes ( reader , node , expectedAttributes , null ) ; // parse the poa config elements. EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { // check the element namespace. if ( namespace != Namespace . forUri ( reader . getNamespaceURI ( ) ) ) throw unexpectedElement ( reader ) ; final Element element = Element . forName ( reader . getLocalName ( ) ) ; // check for duplicate elements. if ( ! encountered . add ( element ) ) { throw duplicateNamedElement ( reader , element . getLocalName ( ) ) ; } switch ( element ) { case POA_REQUEST_PROC : { // parse the poa request-processors config attributes. EnumSet < Attribute > attributes = EnumSet . of ( Attribute . POA_REQUEST_PROC_POOL_SIZE , Attribute . POA_REQUEST_PROC_MAX_THREADS ) ; this . parseAttributes ( reader , node , attributes , null ) ; // the request-processors element doesn't have child elements. requireNoContent ( reader ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: <p > Parses the { @code naming } section of the JacORB subsystem configuration . < / p > [CODESPLIT] private void parseNamingConfig ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse all naming attributes. EnumSet < Attribute > expectedAttributes = EnumSet . of ( Attribute . NAMING_ROOT_CONTEXT , Attribute . NAMING_EXPORT_CORBALOC ) ; this . parseAttributes ( reader , node , expectedAttributes , null ) ; // the naming element doesn't have child elements. requireNoContent ( reader ) ; }


Input: <p > Parses the { @code interop } section of the JacORB subsystem configuration . < / p > [CODESPLIT] private void parseInteropConfig ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse all interop attributes. EnumSet < Attribute > expectedAttributes = EnumSet . of ( Attribute . INTEROP_SUN , Attribute . INTEROP_COMET , Attribute . INTEROP_IONA , Attribute . INTEROP_CHUNK_RMI_VALUETYPES , Attribute . INTEROP_LAX_BOOLEAN_ENCODING , Attribute . INTEROP_INDIRECTION_ENCODING_DISABLE , Attribute . INTEROP_STRICT_CHECK_ON_TC_CREATION ) ; this . parseAttributes ( reader , node , expectedAttributes , null ) ; // the interop element doesn't have child elements. requireNoContent ( reader ) ; }


Input: <p > Parses the { @code security } section of the JacORB subsystem configuration according to the XSD version 1 . 0 . < / p > [CODESPLIT] private void parseSecurityConfig_1_0 ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse all security attributes. EnumSet < Attribute > expectedAttributes = EnumSet . of ( Attribute . SECURITY_SUPPORT_SSL , Attribute . SECURITY_ADD_COMPONENT_INTERCEPTOR , Attribute . SECURITY_CLIENT_SUPPORTS , Attribute . SECURITY_CLIENT_REQUIRES , Attribute . SECURITY_SERVER_SUPPORTS , Attribute . SECURITY_SERVER_REQUIRES , Attribute . SECURITY_USE_DOMAIN_SF , Attribute . SECURITY_USE_DOMAIN_SSF ) ; EnumSet < Attribute > parsedAttributes = EnumSet . noneOf ( Attribute . class ) ; for ( int i = 0 ; i < reader . getAttributeCount ( ) ; i ++ ) { requireNoNamespaceAttribute ( reader , i ) ; String attrValue = reader . getAttributeValue ( i ) ; final Attribute attribute = Attribute . forName ( reader . getAttributeLocalName ( i ) ) ; // check for unexpected attributes. if ( ! expectedAttributes . contains ( attribute ) ) throw unexpectedAttribute ( reader , i ) ; // check for duplicate attributes. if ( ! parsedAttributes . add ( attribute ) ) { throw duplicateAttribute ( reader , attribute . getLocalName ( ) ) ; } switch ( attribute ) { // check the attributes that need to be converted from int to string. case SECURITY_CLIENT_SUPPORTS : case SECURITY_CLIENT_REQUIRES : case SECURITY_SERVER_SUPPORTS : case SECURITY_SERVER_REQUIRES : SSLConfigValue value = SSLConfigValue . fromValue ( attrValue ) ; if ( value == null ) throw JacORBLogger . ROOT_LOGGER . invalidSSLConfig ( attrValue , reader . getLocation ( ) ) ; attrValue = value . toString ( ) ; default : SimpleAttributeDefinition definition = ( ( SimpleAttributeDefinition ) JacORBSubsystemDefinitions . valueOf ( attribute . getLocalName ( ) ) ) ; // a null definition represents an attribute that has been deprecated and is no longer used. if ( definition != null ) definition . parseAndSetParameter ( attrValue , node , reader ) ; } } // the security element doesn't have child elements. requireNoContent ( reader ) ; }


Input: <p > Parses the { @code security } section of the JacORB subsystem configuration according to the XSD version 1 . 1 or higher . < / p > [CODESPLIT] private void parseSecurityConfig ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // parse all security attributes. EnumSet < Attribute > expectedAttributes = EnumSet . of ( Attribute . SECURITY_SUPPORT_SSL , Attribute . SECURITY_SECURITY_DOMAIN , Attribute . SECURITY_ADD_COMPONENT_INTERCEPTOR , Attribute . SECURITY_CLIENT_SUPPORTS , Attribute . SECURITY_CLIENT_REQUIRES , Attribute . SECURITY_SERVER_SUPPORTS , Attribute . SECURITY_SERVER_REQUIRES ) ; this . parseAttributes ( reader , node , expectedAttributes , null ) ; // the security element doesn't have child elements. requireNoContent ( reader ) ; }


Input: <p > Parses the { @code properties } section of the JacORB subsystem configuration . < / p > [CODESPLIT] private void parsePropertiesConfig ( Namespace namespace , XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { // the properties element doesn't define any attributes, just sub-elements. requireNoAttributes ( reader ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { // check the element namespace. if ( namespace != Namespace . forUri ( reader . getNamespaceURI ( ) ) ) throw unexpectedElement ( reader ) ; final Element element = Element . forName ( reader . getLocalName ( ) ) ; switch ( element ) { case PROPERTY : { // parse the property element. this . parseGenericProperty ( reader , node . get ( JacORBSubsystemConstants . PROPERTIES ) ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: <p > Parses a { @code property } element according to the XSD version 1 . 0 and adds the key / value pair to the specified { @code ModelNode } . < / p > [CODESPLIT] private void parseGenericProperty_1_0 ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { String name = null ; String val = null ; EnumSet < Attribute > required = EnumSet . of ( Attribute . PROP_KEY , Attribute . PROP_VALUE ) ; final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { requireNoNamespaceAttribute ( reader , i ) ; final String value = reader . getAttributeValue ( i ) ; final Attribute attribute = Attribute . forName ( reader . getAttributeLocalName ( i ) ) ; required . remove ( attribute ) ; switch ( attribute ) { case PROP_KEY : { name = value ; break ; } case PROP_VALUE : { val = value ; break ; } default : throw unexpectedAttribute ( reader , i ) ; } } if ( ! required . isEmpty ( ) ) { throw missingRequired ( reader , required ) ; } node . get ( name ) . set ( val ) ; requireNoContent ( reader ) ; }


Input: <p > Parses a { @code property } element according to the XSD version 1 . 1 or higher and adds the name / value pair to the specified { @code ModelNode } . < / p > [CODESPLIT] private void parseGenericProperty ( XMLExtendedStreamReader reader , ModelNode node ) throws XMLStreamException { String name = null ; ModelNode val = null ; EnumSet < Attribute > required = EnumSet . of ( Attribute . NAME , Attribute . PROP_VALUE ) ; final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { requireNoNamespaceAttribute ( reader , i ) ; final String value = reader . getAttributeValue ( i ) ; final Attribute attribute = Attribute . forName ( reader . getAttributeLocalName ( i ) ) ; required . remove ( attribute ) ; switch ( attribute ) { case NAME : { name = value ; break ; } case PROP_VALUE : { val = JacORBSubsystemDefinitions . PROPERTIES . parse ( value , reader . getLocation ( ) ) ; break ; } default : throw unexpectedAttribute ( reader , i ) ; } } if ( ! required . isEmpty ( ) ) { throw missingRequired ( reader , required ) ; } node . get ( name ) . set ( val ) ; requireNoContent ( reader ) ; }


Input: <p > Parses all attributes from the current element and sets them in the specified { @code ModelNode } . < / p > [CODESPLIT] private void parseAttributes ( XMLExtendedStreamReader reader , ModelNode node , EnumSet < Attribute > expectedAttributes , EnumSet < Attribute > requiredAttributes ) throws XMLStreamException { EnumSet < Attribute > parsedAttributes = EnumSet . noneOf ( Attribute . class ) ; if ( requiredAttributes == null ) { requiredAttributes = EnumSet . noneOf ( Attribute . class ) ; } for ( int i = 0 ; i < reader . getAttributeCount ( ) ; i ++ ) { requireNoNamespaceAttribute ( reader , i ) ; final String attrValue = reader . getAttributeValue ( i ) ; final Attribute attribute = Attribute . forName ( reader . getAttributeLocalName ( i ) ) ; // check for unexpected attributes. if ( ! expectedAttributes . contains ( attribute ) ) throw unexpectedAttribute ( reader , i ) ; // check for duplicate attributes. if ( ! parsedAttributes . add ( attribute ) ) { throw duplicateAttribute ( reader , attribute . getLocalName ( ) ) ; } requiredAttributes . remove ( attribute ) ; ( ( SimpleAttributeDefinition ) JacORBSubsystemDefinitions . valueOf ( attribute . getLocalName ( ) ) ) . parseAndSetParameter ( attrValue , node , reader ) ; } // throw an exception if a required attribute wasn't found. if ( ! requiredAttributes . isEmpty ( ) ) { throw missingRequired ( reader , requiredAttributes ) ; } }


Input: <p > Writes the { @code orb } section of the JacORB subsystem configuration using the contents of the provided { @code ModelNode } . < / p > [CODESPLIT] private void writeORBConfig ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { boolean writeORB = this . isWritable ( node , JacORBSubsystemDefinitions . ORB_ATTRIBUTES ) ; boolean writeORBConnection = this . isWritable ( node , JacORBSubsystemDefinitions . ORB_CONN_ATTRIBUTES ) ; boolean writeORBInitializer = this . isWritable ( node , JacORBSubsystemDefinitions . ORB_INIT_ATTRIBUTES ) ; // if no connection or initializers properties are available, just write the orb properties (if any) in an empty element. if ( ! writeORBConnection && ! writeORBInitializer ) { if ( writeORB ) { writer . writeEmptyElement ( JacORBSubsystemConstants . ORB ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . ORB_ATTRIBUTES ) ; } } // otherwise write the orb element with the appropriate sub-elements. else { writer . writeStartElement ( JacORBSubsystemConstants . ORB ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . ORB_ATTRIBUTES ) ; if ( writeORBConnection ) { writer . writeEmptyElement ( JacORBSubsystemConstants . ORB_CONN ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . ORB_CONN_ATTRIBUTES ) ; } if ( writeORBInitializer ) { writer . writeEmptyElement ( JacORBSubsystemConstants . ORB_INIT ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . ORB_INIT_ATTRIBUTES ) ; } writer . writeEndElement ( ) ; } }


Input: <p > Writes the { @code poa } section of the JacORB subsystem configuration using the contents of the provided { @code ModelNode } . < / p > [CODESPLIT] private void writePOAConfig ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { boolean writePOA = this . isWritable ( node , JacORBSubsystemDefinitions . POA_ATTRIBUTES ) ; boolean writePOARP = this . isWritable ( node , JacORBSubsystemDefinitions . POA_RP_ATTRIBUTES ) ; // if no request processor properties are available, just write the poa properties (if any) in an empty element. if ( ! writePOARP ) { if ( writePOA ) { writer . writeEmptyElement ( JacORBSubsystemConstants . POA ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . POA_ATTRIBUTES ) ; } } // otherwise write the poa element with the appropriate sub-elements. else { writer . writeStartElement ( JacORBSubsystemConstants . POA ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . POA_ATTRIBUTES ) ; writer . writeEmptyElement ( JacORBSubsystemConstants . POA_RP ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . POA_RP_ATTRIBUTES ) ; writer . writeEndElement ( ) ; } }


Input: <p > Writes the { @code naming } section of the JacORB subsystem configuration using the contents of the provided { @code ModelNode } . < / p > [CODESPLIT] private void writeNamingConfig ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { boolean writeNaming = this . isWritable ( node , JacORBSubsystemDefinitions . NAMING_ATTRIBUTES ) ; if ( writeNaming ) { writer . writeEmptyElement ( JacORBSubsystemConstants . NAMING ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . NAMING_ATTRIBUTES ) ; } }


Input: <p > Writes the { @code interop } section of the JacORB subsystem configuration using the contents of the provided { @code ModelNode } . < / p > [CODESPLIT] private void writeInteropConfig ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { boolean writeInterop = this . isWritable ( node , JacORBSubsystemDefinitions . INTEROP_ATTRIBUTES ) ; if ( writeInterop ) { writer . writeEmptyElement ( JacORBSubsystemConstants . INTEROP ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . INTEROP_ATTRIBUTES ) ; } }


Input: <p > Writes the { @code security } section of the JacORB subsystem configuration using the contents of the provided { @code ModelNode } . < / p > [CODESPLIT] private void writeSecurityConfig ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { boolean writeSecurity = this . isWritable ( node , JacORBSubsystemDefinitions . SECURITY_ATTRIBUTES ) ; if ( writeSecurity ) { writer . writeEmptyElement ( SECURITY ) ; this . writeAttributes ( writer , node , JacORBSubsystemDefinitions . SECURITY_ATTRIBUTES ) ; } }


Input: <p > Writes a { @code property } element for each generic property contained in the specified { @code ModelNode } . < / p > [CODESPLIT] private void writeGenericProperties ( XMLExtendedStreamWriter writer , ModelNode node ) throws XMLStreamException { writer . writeStartElement ( JacORBSubsystemConstants . PROPERTIES ) ; for ( Property prop : node . asPropertyList ( ) ) { writer . writeEmptyElement ( JacORBSubsystemConstants . PROPERTY ) ; writer . writeAttribute ( JacORBSubsystemConstants . NAME , prop . getName ( ) ) ; writer . writeAttribute ( JacORBSubsystemConstants . PROPERTY_VALUE , prop . getValue ( ) . asString ( ) ) ; } writer . writeEndElement ( ) ; }


Input: <p > Writes the attributes contained in the specified { @code ModelNode } to the current element . < / p > [CODESPLIT] private void writeAttributes ( XMLExtendedStreamWriter writer , ModelNode node , List < SimpleAttributeDefinition > attributes ) throws XMLStreamException { for ( SimpleAttributeDefinition definition : attributes ) definition . marshallAsAttribute ( node , writer ) ; }


Input: <p > Iterates through the specified attribute definitions and checks if any of the attributes can be written to XML by verifying if the attribute has been defined in the supplied node . < / p > [CODESPLIT] private boolean isWritable ( ModelNode node , List < SimpleAttributeDefinition > attributeDefinitions ) { boolean isWritable = false ; for ( SimpleAttributeDefinition attributeDefinition : attributeDefinitions ) { if ( attributeDefinition . isMarshallable ( node ) ) { isWritable = true ; break ; } } return isWritable ; }


Input: Add a ContextService for this module . [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; if ( DeploymentTypeMarker . isType ( DeploymentType . EAR , deploymentUnit ) ) { return ; } EEModuleDescription moduleDescription = deploymentUnit . getAttachment ( EE_MODULE_DESCRIPTION ) ; final ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; final ServiceName appContextServiceName = ContextNames . contextServiceNameOfApplication ( moduleDescription . getApplicationName ( ) ) ; final ServiceName moduleContextServiceName = ContextNames . contextServiceNameOfModule ( moduleDescription . getApplicationName ( ) , moduleDescription . getModuleName ( ) ) ; final NamingStoreService contextService = new NamingStoreService ( true ) ; serviceTarget . addService ( moduleContextServiceName , contextService ) . install ( ) ; final ServiceName moduleNameServiceName = moduleContextServiceName . append ( "ModuleName" ) ; final BinderService moduleNameBinder = new BinderService ( "ModuleName" ) ; moduleNameBinder . getManagedObjectInjector ( ) . inject ( new ValueManagedReferenceFactory ( Values . immediateValue ( moduleDescription . getModuleName ( ) ) ) ) ; serviceTarget . addService ( moduleNameServiceName , moduleNameBinder ) . addDependency ( moduleContextServiceName , ServiceBasedNamingStore . class , moduleNameBinder . getNamingStoreInjector ( ) ) . install ( ) ; deploymentUnit . addToAttachmentList ( org . jboss . as . server . deployment . Attachments . JNDI_DEPENDENCIES , moduleNameServiceName ) ; deploymentUnit . putAttachment ( MODULE_CONTEXT_CONFIG , moduleContextServiceName ) ; final InjectedEENamespaceContextSelector selector = new InjectedEENamespaceContextSelector ( ) ; phaseContext . addDependency ( appContextServiceName , NamingStore . class , selector . getAppContextInjector ( ) ) ; phaseContext . addDependency ( moduleContextServiceName , NamingStore . class , selector . getModuleContextInjector ( ) ) ; phaseContext . addDependency ( moduleContextServiceName , NamingStore . class , selector . getCompContextInjector ( ) ) ; phaseContext . addDependency ( ContextNames . JBOSS_CONTEXT_SERVICE_NAME , NamingStore . class , selector . getJbossContextInjector ( ) ) ; phaseContext . addDependency ( ContextNames . EXPORTED_CONTEXT_SERVICE_NAME , NamingStore . class , selector . getExportedContextInjector ( ) ) ; phaseContext . addDependency ( ContextNames . GLOBAL_CONTEXT_SERVICE_NAME , NamingStore . class , selector . getGlobalContextInjector ( ) ) ; moduleDescription . setNamespaceContextSelector ( selector ) ; final Set < ServiceName > serviceNames = new HashSet < ServiceName > ( ) ; serviceNames . add ( appContextServiceName ) ; serviceNames . add ( moduleContextServiceName ) ; serviceNames . add ( ContextNames . JBOSS_CONTEXT_SERVICE_NAME ) ; serviceNames . add ( ContextNames . GLOBAL_CONTEXT_SERVICE_NAME ) ; // add the arquillian setup action, so the module namespace is available in arquillian tests final JavaNamespaceSetup setupAction = new JavaNamespaceSetup ( selector , deploymentUnit . getServiceName ( ) ) ; deploymentUnit . addToAttachmentList ( SETUP_ACTIONS , setupAction ) ; deploymentUnit . addToAttachmentList ( org . jboss . as . ee . component . Attachments . WEB_SETUP_ACTIONS , setupAction ) ; deploymentUnit . putAttachment ( Attachments . JAVA_NAMESPACE_SETUP_ACTION , setupAction ) ; }


Input: Resolves persistence - unit - ref [CODESPLIT] private List < BindingConfiguration > getPersistenceUnitRefs ( DeploymentUnit deploymentUnit , DeploymentDescriptorEnvironment environment , ClassLoader classLoader , DeploymentReflectionIndex deploymentReflectionIndex , ResourceInjectionTarget resourceInjectionTarget ) throws DeploymentUnitProcessingException { final List < BindingConfiguration > bindingConfigurations = new ArrayList < BindingConfiguration > ( ) ; if ( environment . getEnvironment ( ) == null ) { return bindingConfigurations ; } PersistenceUnitReferencesMetaData persistenceUnitRefs = environment . getEnvironment ( ) . getPersistenceUnitRefs ( ) ; if ( persistenceUnitRefs != null ) { if ( persistenceUnitRefs . size ( ) > 0 ) { JPADeploymentMarker . mark ( deploymentUnit ) ; } for ( PersistenceUnitReferenceMetaData puRef : persistenceUnitRefs ) { String name = puRef . getName ( ) ; String persistenceUnitName = puRef . getPersistenceUnitName ( ) ; String lookup = puRef . getLookupName ( ) ; if ( ! isEmpty ( lookup ) && ! isEmpty ( persistenceUnitName ) ) { throw JpaLogger . ROOT_LOGGER . cannotSpecifyBoth ( "<lookup-name>" , lookup , "persistence-unit-name" , persistenceUnitName , "<persistence-unit-ref/>" , resourceInjectionTarget ) ; } if ( ! name . startsWith ( "java:" ) ) { name = environment . getDefaultContext ( ) + name ; } // our injection (source) comes from the local (ENC) lookup, no matter what. LookupInjectionSource injectionSource = new LookupInjectionSource ( name ) ; //add any injection targets processInjectionTargets ( resourceInjectionTarget , injectionSource , classLoader , deploymentReflectionIndex , puRef , EntityManagerFactory . class ) ; BindingConfiguration bindingConfiguration = null ; if ( ! isEmpty ( lookup ) ) { bindingConfiguration = new BindingConfiguration ( name , new LookupInjectionSource ( lookup ) ) ; } else { InjectionSource puBindingSource = this . getPersistenceUnitBindingSource ( deploymentUnit , persistenceUnitName ) ; bindingConfiguration = new BindingConfiguration ( name , puBindingSource ) ; } bindingConfigurations . add ( bindingConfiguration ) ; } } return bindingConfigurations ; }


Input: Resolves persistence - unit - ref [CODESPLIT] private List < BindingConfiguration > getPersistenceContextRefs ( DeploymentUnit deploymentUnit , DeploymentDescriptorEnvironment environment , ClassLoader classLoader , DeploymentReflectionIndex deploymentReflectionIndex , ResourceInjectionTarget resourceInjectionTarget ) throws DeploymentUnitProcessingException { List < BindingConfiguration > bindingConfigurations = new ArrayList < BindingConfiguration > ( ) ; final RemoteEnvironment remoteEnvironment = environment . getEnvironment ( ) ; if ( remoteEnvironment == null ) { return bindingConfigurations ; } if ( remoteEnvironment instanceof Environment ) { PersistenceContextReferencesMetaData persistenceUnitRefs = ( ( Environment ) remoteEnvironment ) . getPersistenceContextRefs ( ) ; if ( persistenceUnitRefs != null ) { for ( PersistenceContextReferenceMetaData puRef : persistenceUnitRefs ) { String name = puRef . getName ( ) ; String persistenceUnitName = puRef . getPersistenceUnitName ( ) ; String lookup = puRef . getLookupName ( ) ; if ( ! isEmpty ( lookup ) && ! isEmpty ( persistenceUnitName ) ) { throw JpaLogger . ROOT_LOGGER . cannotSpecifyBoth ( "<lookup-name>" , lookup , "persistence-unit-name" , persistenceUnitName , "<persistence-context-ref/>" , resourceInjectionTarget ) ; } if ( ! name . startsWith ( "java:" ) ) { name = environment . getDefaultContext ( ) + name ; } // our injection (source) comes from the local (ENC) lookup, no matter what. LookupInjectionSource injectionSource = new LookupInjectionSource ( name ) ; //add any injection targets processInjectionTargets ( resourceInjectionTarget , injectionSource , classLoader , deploymentReflectionIndex , puRef , EntityManager . class ) ; BindingConfiguration bindingConfiguration = null ; if ( ! isEmpty ( lookup ) ) { bindingConfiguration = new BindingConfiguration ( name , new LookupInjectionSource ( lookup ) ) ; } else { PropertiesMetaData properties = puRef . getProperties ( ) ; Map < String , String > map = new HashMap <> ( ) ; if ( properties != null ) { for ( PropertyMetaData prop : properties ) { map . put ( prop . getKey ( ) , prop . getValue ( ) ) ; } } PersistenceContextType type = ( puRef . getPersistenceContextType ( ) == null || puRef . getPersistenceContextType ( ) == PersistenceContextTypeDescription . TRANSACTION ) ? PersistenceContextType . TRANSACTION : PersistenceContextType . EXTENDED ; SynchronizationType synchronizationType = ( puRef . getPersistenceContextSynchronization ( ) == null || PersistenceContextSynchronizationType . Synchronized . equals ( puRef . getPersistenceContextSynchronization ( ) ) ) ? SynchronizationType . SYNCHRONIZED : SynchronizationType . UNSYNCHRONIZED ; InjectionSource pcBindingSource = this . getPersistenceContextBindingSource ( deploymentUnit , persistenceUnitName , type , synchronizationType , map ) ; bindingConfiguration = new BindingConfiguration ( name , pcBindingSource ) ; } bindingConfigurations . add ( bindingConfiguration ) ; } } } return bindingConfigurations ; }


Input: Add dependencies for modules required for manged bean deployments if managed bean configurations are attached to the deployment . [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ModuleSpecification moduleSpecification = deploymentUnit . getAttachment ( Attachments . MODULE_SPECIFICATION ) ; final JBossServiceXmlDescriptor serviceXmlDescriptor = deploymentUnit . getAttachment ( JBossServiceXmlDescriptor . ATTACHMENT_KEY ) ; if ( serviceXmlDescriptor == null ) { return ; // Skip deployments with out a service xml descriptor } moduleSpecification . addSystemDependency ( new ModuleDependency ( Module . getBootModuleLoader ( ) , JBOSS_MODULES_ID , false , false , false , false ) ) ; moduleSpecification . addSystemDependency ( new ModuleDependency ( Module . getBootModuleLoader ( ) , JBOSS_AS_SYSTEM_JMX_ID , true , false , false , false ) ) ; // depend on Properties editor module which uses ServiceLoader approach to load the appropriate org.jboss.common.beans.property.finder.PropertyEditorFinder moduleSpecification . addSystemDependency ( new ModuleDependency ( Module . getBootModuleLoader ( ) , PROPERTIES_EDITOR_MODULE_ID , false , false , true , false ) ) ; // All SARs require the ability to register MBeans. moduleSpecification . addPermissionFactory ( REGISTER_PERMISSION_FACTORY ) ; }


Input: Runs the work contained in { @param runnable } as an authenticated Identity . [CODESPLIT] public void runWork ( Runnable work ) { // if we have an authenticated subject we check if it contains a security identity and use the identity to run the work. if ( this . authenticatedSubject != null ) { Set < SecurityIdentity > authenticatedIdentities = this . getPrivateCredentials ( SecurityIdentity . class ) ; if ( ! authenticatedIdentities . isEmpty ( ) ) { SecurityIdentity identity = authenticatedIdentities . iterator ( ) . next ( ) ; identity . runAs ( work ) ; return ; } } // no authenticated subject found or the subject didn't have a security identity - just run the work. work . run ( ) ; }


Input: { [CODESPLIT] @ Override public void readElement ( XMLExtendedStreamReader reader , List < ModelNode > list ) throws XMLStreamException { // no attributes if ( reader . getAttributeCount ( ) > 0 ) { throw unexpectedAttribute ( reader , 0 ) ; } final ModelNode address = new ModelNode ( ) ; address . add ( ModelDescriptionConstants . SUBSYSTEM , TransactionExtension . SUBSYSTEM_NAME ) ; address . protect ( ) ; final ModelNode subsystem = new ModelNode ( ) ; subsystem . get ( OP ) . set ( ADD ) ; subsystem . get ( OP_ADDR ) . set ( address ) ; list . add ( subsystem ) ; final ModelNode logStoreAddress = address . clone ( ) ; final ModelNode logStoreOperation = new ModelNode ( ) ; logStoreOperation . get ( OP ) . set ( ADD ) ; logStoreAddress . add ( LogStoreConstants . LOG_STORE , LogStoreConstants . LOG_STORE ) ; logStoreAddress . protect ( ) ; logStoreOperation . get ( OP_ADDR ) . set ( logStoreAddress ) ; list . add ( logStoreOperation ) ; // elements final EnumSet < Element > required = EnumSet . of ( Element . RECOVERY_ENVIRONMENT , Element . CORE_ENVIRONMENT ) ; final EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; choiceObjectStoreEncountered = false ; needsDefaultRelativeTo = true ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { if ( Namespace . forUri ( reader . getNamespaceURI ( ) ) != getExpectedNamespace ( ) ) { throw unexpectedElement ( reader ) ; } final Element element = Element . forName ( reader . getLocalName ( ) ) ; required . remove ( element ) ; if ( ! encountered . add ( element ) ) { throw unexpectedElement ( reader ) ; } readElement ( reader , element , list , subsystem , logStoreOperation ) ; } if ( needsDefaultRelativeTo && relativeToHasDefaultValue ) { TransactionSubsystemRootResourceDefinition . OBJECT_STORE_RELATIVE_TO . parseAndSetParameter ( "jboss.server.data.dir" , subsystem , reader ) ; } if ( ! required . isEmpty ( ) ) { throw missingRequiredElement ( reader , required ) ; } }


Input: { [CODESPLIT] public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { if ( context . isNormalServer ( ) ) { context . addStep ( new OperationStepHandler ( ) { public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { final ServiceRegistry registry = context . getServiceRegistry ( false ) ; if ( registry != null ) { try { context . getResult ( ) . set ( getEndpointMetricsFragment ( operation , registry ) ) ; } catch ( Exception e ) { throw new OperationFailedException ( getFallbackMessage ( ) + ": " + e . getMessage ( ) ) ; } } else { context . getResult ( ) . set ( getFallbackMessage ( ) ) ; } } } , OperationContext . Stage . RUNTIME ) ; } else { context . getResult ( ) . set ( getFallbackMessage ( ) ) ; } }


Input: <p > Sets the outgoing SAS reply to <code > ContextError< / code > with major status invalid evidence . < / p > [CODESPLIT] void rejectIncomingContext ( ) { CurrentRequestInfo threadLocal = threadLocalData . get ( ) ; if ( threadLocal . sasContextReceived ) { threadLocal . sasReply = ( threadLocal . contextId == 0 ) ? msgCtx0Rejected : createMsgCtxError ( threadLocal . contextId , 1 /* major status: invalid evidence */ ) ; threadLocal . sasReplyIsAccept = false ; } }


Input: Add one PU service per top level deployment that represents [CODESPLIT] private static void addPuService ( final DeploymentPhaseContext phaseContext , final ArrayList < PersistenceUnitMetadataHolder > puList , final boolean startEarly , final Platform platform ) throws DeploymentUnitProcessingException { if ( puList . size ( ) > 0 ) { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final Module module = deploymentUnit . getAttachment ( Attachments . MODULE ) ; final EEModuleDescription eeModuleDescription = deploymentUnit . getAttachment ( org . jboss . as . ee . component . Attachments . EE_MODULE_DESCRIPTION ) ; final ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; final ModuleClassLoader classLoader = module . getClassLoader ( ) ; for ( PersistenceUnitMetadataHolder holder : puList ) { setAnnotationIndexes ( holder , deploymentUnit ) ; for ( PersistenceUnitMetadata pu : holder . getPersistenceUnits ( ) ) { // only start the persistence unit if JPA_CONTAINER_MANAGED is true String jpaContainerManaged = pu . getProperties ( ) . getProperty ( Configuration . JPA_CONTAINER_MANAGED ) ; boolean deployPU = ( jpaContainerManaged == null ? true : Boolean . parseBoolean ( jpaContainerManaged ) ) ; if ( deployPU ) { final PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder = getPersistenceProviderDeploymentHolder ( deploymentUnit ) ; final PersistenceProvider provider = lookupProvider ( pu , persistenceProviderDeploymentHolder , deploymentUnit ) ; final PersistenceProviderAdaptor adaptor = getPersistenceProviderAdaptor ( pu , persistenceProviderDeploymentHolder , deploymentUnit , provider , platform ) ; final boolean twoPhaseBootStrapCapable = ( adaptor instanceof TwoPhaseBootstrapCapable ) && Configuration . allowTwoPhaseBootstrap ( pu ) ; if ( startEarly ) { if ( twoPhaseBootStrapCapable ) { deployPersistenceUnitPhaseOne ( deploymentUnit , eeModuleDescription , serviceTarget , classLoader , pu , adaptor ) ; } else if ( false == Configuration . needClassFileTransformer ( pu ) ) { // will start later when startEarly == false ROOT_LOGGER . tracef ( "persistence unit %s in deployment %s is configured to not need class transformer to be set, no class rewriting will be allowed" , pu . getPersistenceUnitName ( ) , deploymentUnit . getName ( ) ) ; } else { // we need class file transformer to work, don't allow cdi bean manager to be access since that // could cause application classes to be loaded (workaround by setting jboss.as.jpa.classtransformer to false).  WFLY-1463 final boolean allowCdiBeanManagerAccess = false ; deployPersistenceUnit ( deploymentUnit , eeModuleDescription , serviceTarget , classLoader , pu , provider , adaptor , allowCdiBeanManagerAccess ) ; } } else { // !startEarly if ( twoPhaseBootStrapCapable ) { deployPersistenceUnitPhaseTwo ( deploymentUnit , eeModuleDescription , serviceTarget , classLoader , pu , provider , adaptor ) ; } else if ( false == Configuration . needClassFileTransformer ( pu ) ) { final boolean allowCdiBeanManagerAccess = true ; // PUs that have Configuration.JPA_CONTAINER_CLASS_TRANSFORMER = false will start during INSTALL phase deployPersistenceUnit ( deploymentUnit , eeModuleDescription , serviceTarget , classLoader , pu , provider , adaptor , allowCdiBeanManagerAccess ) ; } } } else { ROOT_LOGGER . tracef ( "persistence unit %s in deployment %s is not container managed (%s is set to false)" , pu . getPersistenceUnitName ( ) , deploymentUnit . getName ( ) , Configuration . JPA_CONTAINER_MANAGED ) ; } } } } }


Input:
start the persistence unit in one phase [CODESPLIT] private static void deployPersistenceUnit ( final DeploymentUnit deploymentUnit , final EEModuleDescription eeModuleDescription , final ServiceTarget serviceTarget , final ModuleClassLoader classLoader , final PersistenceUnitMetadata pu , final PersistenceProvider provider , final PersistenceProviderAdaptor adaptor , final boolean allowCdiBeanManagerAccess ) throws DeploymentUnitProcessingException { pu . setClassLoader ( classLoader ) ; TransactionManager transactionManager = ContextTransactionManager . getInstance ( ) ; TransactionSynchronizationRegistry transactionSynchronizationRegistry = deploymentUnit . getAttachment ( JpaAttachments . TRANSACTION_SYNCHRONIZATION_REGISTRY ) ; CapabilityServiceSupport capabilitySupport = deploymentUnit . getAttachment ( Attachments . CAPABILITY_SERVICE_SUPPORT ) ; try { ValidatorFactory validatorFactory = null ; final HashMap < String , ValidatorFactory > properties = new HashMap <> ( ) ; CapabilityServiceSupport css = deploymentUnit . getAttachment ( Attachments . CAPABILITY_SERVICE_SUPPORT ) ; if ( ! ValidationMode . NONE . equals ( pu . getValidationMode ( ) ) ) { if ( css . hasCapability ( "org.wildfly.bean-validation" ) ) { // Get the CDI-enabled ValidatorFactory validatorFactory = deploymentUnit . getAttachment ( BeanValidationAttachments . VALIDATOR_FACTORY ) ; } } BeanManagerAfterDeploymentValidation beanManagerAfterDeploymentValidation = registerJPAEntityListenerRegister ( deploymentUnit , capabilitySupport ) ; final PersistenceAdaptorRemoval persistenceAdaptorRemoval = new PersistenceAdaptorRemoval ( pu , adaptor ) ; deploymentUnit . addToAttachmentList ( REMOVAL_KEY , persistenceAdaptorRemoval ) ; // add persistence provider specific properties adaptor . addProviderProperties ( properties , pu ) ; final ServiceName puServiceName = PersistenceUnitServiceImpl . getPUServiceName ( pu ) ; deploymentUnit . putAttachment ( JpaAttachments . PERSISTENCE_UNIT_SERVICE_KEY , puServiceName ) ; deploymentUnit . addToAttachmentList ( Attachments . DEPLOYMENT_COMPLETE_SERVICES , puServiceName ) ; deploymentUnit . addToAttachmentList ( Attachments . WEB_DEPENDENCIES , puServiceName ) ; final PersistenceUnitServiceImpl service = new PersistenceUnitServiceImpl ( properties , classLoader , pu , adaptor , provider , PersistenceUnitRegistryImpl . INSTANCE , deploymentUnit . getServiceName ( ) , validatorFactory , deploymentUnit . getAttachment ( org . jboss . as . ee . naming . Attachments . JAVA_NAMESPACE_SETUP_ACTION ) , beanManagerAfterDeploymentValidation ) ; ServiceBuilder < PersistenceUnitService > builder = serviceTarget . addService ( puServiceName , service ) ; boolean useDefaultDataSource = Configuration . allowDefaultDataSourceUse ( pu ) ; final String jtaDataSource = adjustJndi ( pu . getJtaDataSourceName ( ) ) ; final String nonJtaDataSource = adjustJndi ( pu . getNonJtaDataSourceName ( ) ) ; if ( jtaDataSource != null && jtaDataSource . length ( ) > 0 ) { if ( jtaDataSource . equals ( EE_DEFAULT_DATASOURCE ) ) { // explicit use of default datasource useDefaultDataSource = true ; } else { builder . addDependency ( ContextNames . bindInfoForEnvEntry ( eeModuleDescription . getApplicationName ( ) , eeModuleDescription . getModuleName ( ) , eeModuleDescription . getModuleName ( ) , false , jtaDataSource ) . getBinderServiceName ( ) , ManagedReferenceFactory . class , new ManagedReferenceFactoryInjector ( service . getJtaDataSourceInjector ( ) ) ) ; useDefaultDataSource = false ; } } if ( nonJtaDataSource != null && nonJtaDataSource . length ( ) > 0 ) { builder . addDependency ( ContextNames . bindInfoForEnvEntry ( eeModuleDescription . getApplicationName ( ) , eeModuleDescription . getModuleName ( ) , eeModuleDescription . getModuleName ( ) , false , nonJtaDataSource ) . getBinderServiceName ( ) , ManagedReferenceFactory . class , new ManagedReferenceFactoryInjector ( service . getNonJtaDataSourceInjector ( ) ) ) ; useDefaultDataSource = false ; } // JPA 2.0 8.2.1.5, container provides default JTA datasource if ( useDefaultDataSource ) { // try the default datasource defined in the ee subsystem String defaultJtaDataSource = null ; if ( eeModuleDescription != null ) { defaultJtaDataSource = eeModuleDescription . getDefaultResourceJndiNames ( ) . getDataSource ( ) ; } if ( defaultJtaDataSource == null || defaultJtaDataSource . isEmpty ( ) ) { // try the datasource defined in the jpa subsystem defaultJtaDataSource = adjustJndi ( JPAService . getDefaultDataSourceName ( ) ) ; } if ( defaultJtaDataSource != null && ! defaultJtaDataSource . isEmpty ( ) ) { builder . addDependency ( ContextNames . bindInfoFor ( defaultJtaDataSource ) . getBinderServiceName ( ) , ManagedReferenceFactory . class , new ManagedReferenceFactoryInjector ( service . getJtaDataSourceInjector ( ) ) ) ; ROOT_LOGGER . tracef ( "%s is using the default data source '%s'" , puServiceName , defaultJtaDataSource ) ; } } // JPA 2.1 sections 3.5.1 + 9.1 require the CDI bean manager to be passed to the peristence provider // if the persistence unit is contained in a deployment that is a CDI bean archive (has beans.xml). final CapabilityServiceSupport support = deploymentUnit . getAttachment ( Attachments . CAPABILITY_SERVICE_SUPPORT ) ; if ( support . hasCapability ( WELD_CAPABILITY_NAME ) && allowCdiBeanManagerAccess ) { support . getOptionalCapabilityRuntimeAPI ( WELD_CAPABILITY_NAME , WeldCapability . class ) . get ( ) . addBeanManagerService ( deploymentUnit , builder , service . getBeanManagerInjector ( ) ) ; } try { // save a thread local reference to the builder for setting up the second level cache dependencies CacheDeploymentListener . setInternalDeploymentSupport ( builder , capabilitySupport ) ; adaptor . addProviderDependencies ( pu ) ; } finally { CacheDeploymentListener . clearInternalDeploymentSupport ( ) ; } /**
             * handle extension that binds a transaction scoped entity manager to specified JNDI location
             */ entityManagerBind ( eeModuleDescription , serviceTarget , pu , puServiceName , transactionManager , transactionSynchronizationRegistry ) ; /**
             * handle extension that binds an entity manager factory to specified JNDI location
             */ entityManagerFactoryBind ( eeModuleDescription , serviceTarget , pu , puServiceName ) ; // get async executor from Services.addServerExecutorDependency addServerExecutorDependency ( builder , service . getExecutorInjector ( ) ) ; builder . install ( ) ; ROOT_LOGGER . tracef ( "added PersistenceUnitService for '%s'.  PU is ready for injector action." , puServiceName ) ; addManagementConsole ( deploymentUnit , pu , adaptor , persistenceAdaptorRemoval ) ; } catch ( ServiceRegistryException e ) { throw JpaLogger . ROOT_LOGGER . failedToAddPersistenceUnit ( e , pu . getPersistenceUnitName ( ) ) ; } }