Input: Construct the component instance . Upon return the object instance should have injections and lifecycle invocations completed already . [CODESPLIT] protected BasicComponentInstance constructComponentInstance ( ManagedReference instance , boolean invokePostConstruct ) { return constructComponentInstance ( instance , invokePostConstruct , Collections . emptyMap ( ) ) ; }


Input: Construct the component instance . Upon return the object instance should have injections and lifecycle invocations completed already . [CODESPLIT] protected BasicComponentInstance constructComponentInstance ( ManagedReference instance , boolean invokePostConstruct , final Map < Object , Object > context ) { waitForComponentStart ( ) ; // create the component instance final BasicComponentInstance basicComponentInstance = this . instantiateComponentInstance ( preDestroyInterceptor , interceptorInstanceMap , context ) ; if ( instance != null ) { basicComponentInstance . setInstanceData ( BasicComponentInstance . INSTANCE_KEY , instance ) ; } if ( invokePostConstruct ) { // now invoke the postconstruct interceptors final InterceptorContext interceptorContext = new InterceptorContext ( ) ; interceptorContext . putPrivateData ( Component . class , this ) ; interceptorContext . putPrivateData ( ComponentInstance . class , basicComponentInstance ) ; interceptorContext . putPrivateData ( InvocationType . class , InvocationType . POST_CONSTRUCT ) ; interceptorContext . setContextData ( new HashMap < String , Object > ( ) ) ; try { postConstructInterceptor . processInvocation ( interceptorContext ) ; } catch ( Exception e ) { throw EeLogger . ROOT_LOGGER . componentConstructionFailure ( e ) ; } } componentInstanceCreated ( basicComponentInstance ) ; // return the component instance return basicComponentInstance ; }


Input: { [CODESPLIT] public void stop ( ) { if ( stopping . compareAndSet ( false , true ) ) { synchronized ( this ) { gate = false ; this . interceptorInstanceMap = null ; this . preDestroyInterceptor = null ; this . postConstructInterceptor = null ; } //TODO: only run this if there is no instances //TODO: trigger destruction of all component instances //TODO: this has lots of potential for race conditions unless we are careful //TODO: using stopContext.asynchronous() and then executing synchronously is pointless. // Use org.jboss.as.server.Services#addServerExecutorDependency to inject an executor to do this async } }


Input: Merges two descriptors either of the parameters will be null . <p / > this method will never return null ; [CODESPLIT] public static InterceptorClassDescription merge ( InterceptorClassDescription existing , InterceptorClassDescription override ) { if ( existing == null && override == null ) { return EMPTY_INSTANCE ; } if ( override == null ) { return existing ; } if ( existing == null ) { return override ; } final Builder builder = builder ( existing ) ; if ( override . getAroundInvoke ( ) != null ) { builder . setAroundInvoke ( override . getAroundInvoke ( ) ) ; } if ( override . getAroundTimeout ( ) != null ) { builder . setAroundTimeout ( override . getAroundTimeout ( ) ) ; } if ( override . getAroundConstruct ( ) != null ) { builder . setAroundConstruct ( override . getAroundConstruct ( ) ) ; } if ( override . getPostConstruct ( ) != null ) { builder . setPostConstruct ( override . getPostConstruct ( ) ) ; } if ( override . getPreDestroy ( ) != null ) { builder . setPreDestroy ( override . getPreDestroy ( ) ) ; } if ( override . getPrePassivate ( ) != null ) { builder . setPrePassivate ( override . getPrePassivate ( ) ) ; } if ( override . getPostActivate ( ) != null ) { builder . setPostActivate ( override . getPostActivate ( ) ) ; } return builder . build ( ) ; }


Input: Lookup Seam integration resource loader . [CODESPLIT] protected synchronized VirtualFile getResteasySpringVirtualFile ( ) throws DeploymentUnitProcessingException { if ( resourceRoot != null ) { return resourceRoot ; } try { Module module = Module . getBootModuleLoader ( ) . loadModule ( MODULE ) ; URL fileUrl = module . getClassLoader ( ) . getResource ( JAR_LOCATION ) ; if ( fileUrl == null ) { throw JaxrsLogger . JAXRS_LOGGER . noSpringIntegrationJar ( ) ; } File dir = new File ( fileUrl . toURI ( ) ) ; File file = null ; for ( String jar : dir . list ( ) ) { if ( jar . endsWith ( ".jar" ) ) { file = new File ( dir , jar ) ; break ; } } if ( file == null ) { throw JaxrsLogger . JAXRS_LOGGER . noSpringIntegrationJar ( ) ; } VirtualFile vf = VFS . getChild ( file . toURI ( ) ) ; final Closeable mountHandle = VFS . mountZip ( file , vf , TempFileProviderService . provider ( ) ) ; Service < Closeable > mountHandleService = new Service < Closeable > ( ) { public void start ( StartContext startContext ) throws StartException { } public void stop ( StopContext stopContext ) { VFSUtils . safeClose ( mountHandle ) ; } public Closeable getValue ( ) throws IllegalStateException , IllegalArgumentException { return mountHandle ; } } ; ServiceBuilder < Closeable > builder = serviceTarget . addService ( ServiceName . JBOSS . append ( SERVICE_NAME ) , mountHandleService ) ; builder . setInitialMode ( ServiceController . Mode . ACTIVE ) . install ( ) ; resourceRoot = vf ; return resourceRoot ; } catch ( Exception e ) { throw new DeploymentUnitProcessingException ( e ) ; } }


Input: Resolves runtime name of model resource . [CODESPLIT] protected static String resolveRuntimeName ( final OperationContext context , final PathElement address ) { final ModelNode runtimeName = context . readResourceFromRoot ( PathAddress . pathAddress ( address ) , false ) . getModel ( ) . get ( ModelDescriptionConstants . RUNTIME_NAME ) ; return runtimeName . asString ( ) ; }


Input: Check the deployment annotation index for all classes with the @ManagedBean annotation . For each class with the annotation collect all the required information to create a managed bean instance and attach it to the context . [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final EEResourceReferenceProcessorRegistry registry = deploymentUnit . getAttachment ( org . jboss . as . ee . component . Attachments . RESOURCE_REFERENCE_PROCESSOR_REGISTRY ) ; final EEModuleDescription moduleDescription = deploymentUnit . getAttachment ( org . jboss . as . ee . component . Attachments . EE_MODULE_DESCRIPTION ) ; final CompositeIndex compositeIndex = deploymentUnit . getAttachment ( Attachments . COMPOSITE_ANNOTATION_INDEX ) ; final PropertyReplacer replacer = EJBAnnotationPropertyReplacement . propertyReplacer ( deploymentUnit ) ; if ( compositeIndex == null ) { return ; } final List < AnnotationInstance > instances = compositeIndex . getAnnotations ( MANAGED_BEAN_ANNOTATION_NAME ) ; if ( instances == null || instances . isEmpty ( ) ) { return ; } for ( AnnotationInstance instance : instances ) { AnnotationTarget target = instance . target ( ) ; if ( ! ( target instanceof ClassInfo ) ) { throw EeLogger . ROOT_LOGGER . classOnlyAnnotation ( "@ManagedBean" , target ) ; } final ClassInfo classInfo = ( ClassInfo ) target ; // skip if it's not a valid managed bean class if ( ! assertManagedBeanClassValidity ( classInfo ) ) { continue ; } final String beanClassName = classInfo . name ( ) . toString ( ) ; // Get the managed bean name from the annotation final AnnotationValue nameValue = instance . value ( ) ; final String beanName = ( nameValue == null || nameValue . asString ( ) . isEmpty ( ) ) ? beanClassName : replacer . replaceProperties ( nameValue . asString ( ) ) ; final ManagedBeanComponentDescription componentDescription = new ManagedBeanComponentDescription ( beanName , beanClassName , moduleDescription , deploymentUnit . getServiceName ( ) ) ; // Add the view ViewDescription viewDescription = new ViewDescription ( componentDescription , beanClassName ) ; viewDescription . getConfigurators ( ) . addFirst ( new ViewConfigurator ( ) { public void configure ( final DeploymentPhaseContext context , final ComponentConfiguration componentConfiguration , final ViewDescription description , final ViewConfiguration configuration ) throws DeploymentUnitProcessingException { // Add MB association interceptors configuration . addClientPostConstructInterceptor ( ManagedBeanCreateInterceptor . FACTORY , InterceptorOrder . ClientPostConstruct . INSTANCE_CREATE ) ; final ClassLoader classLoader = componentConfiguration . getModuleClassLoader ( ) ; configuration . addViewInterceptor ( AccessCheckingInterceptor . getFactory ( ) , InterceptorOrder . View . CHECKING_INTERCEPTOR ) ; configuration . addViewInterceptor ( new ImmediateInterceptorFactory ( new ContextClassLoaderInterceptor ( classLoader ) ) , InterceptorOrder . View . TCCL_INTERCEPTOR ) ; } } ) ; viewDescription . getBindingNames ( ) . addAll ( Arrays . asList ( "java:module/" + beanName , "java:app/" + moduleDescription . getModuleName ( ) + "/" + beanName ) ) ; componentDescription . getViews ( ) . add ( viewDescription ) ; moduleDescription . addComponent ( componentDescription ) ; // register an EEResourceReferenceProcessor which can process @Resource references to this managed bean. registry . registerResourceReferenceProcessor ( new ManagedBeanResourceReferenceProcessor ( beanClassName ) ) ; } }


Input: Returns true if the passed <code > managedBeanClass< / code > meets the requirements set by the Managed bean spec about bean implementation classes . The passed <code > managedBeanClass< / code > must not be an interface and must not be final or abstract . If it passes these requirements then this method returns true . Else it returns false . [CODESPLIT] private static boolean assertManagedBeanClassValidity ( final ClassInfo managedBeanClass ) { final short flags = managedBeanClass . flags ( ) ; final String className = managedBeanClass . name ( ) . toString ( ) ; // must *not* be an interface if ( Modifier . isInterface ( flags ) ) { ROOT_LOGGER . invalidManagedBeanInterface ( "MB.2.1.1" , className ) ; return false ; } // bean class must *not* be abstract or final if ( Modifier . isAbstract ( flags ) || Modifier . isFinal ( flags ) ) { ROOT_LOGGER . invalidManagedBeanAbstractOrFinal ( "MB.2.1.1" , className ) ; return false ; } // valid class return true ; }


Input: Registers attributes common across listener types [CODESPLIT] private static PersistentResourceXMLDescription . PersistentResourceXMLBuilder listenerBuilder ( PersistentResourceDefinition resource ) { return builder ( resource . getPathElement ( ) ) // xsd socket-optionsType . addAttributes ( ListenerResourceDefinition . RECEIVE_BUFFER , ListenerResourceDefinition . SEND_BUFFER , ListenerResourceDefinition . BACKLOG , ListenerResourceDefinition . KEEP_ALIVE , ListenerResourceDefinition . READ_TIMEOUT , ListenerResourceDefinition . WRITE_TIMEOUT , ListenerResourceDefinition . MAX_CONNECTIONS ) // xsd listener-type . addAttributes ( ListenerResourceDefinition . SOCKET_BINDING , ListenerResourceDefinition . WORKER , ListenerResourceDefinition . BUFFER_POOL , ListenerResourceDefinition . ENABLED , ListenerResourceDefinition . RESOLVE_PEER_ADDRESS , ListenerResourceDefinition . MAX_ENTITY_SIZE , ListenerResourceDefinition . BUFFER_PIPELINED_DATA , ListenerResourceDefinition . MAX_HEADER_SIZE , ListenerResourceDefinition . MAX_PARAMETERS , ListenerResourceDefinition . MAX_HEADERS , ListenerResourceDefinition . MAX_COOKIES , ListenerResourceDefinition . ALLOW_ENCODED_SLASH , ListenerResourceDefinition . DECODE_URL , ListenerResourceDefinition . URL_CHARSET , ListenerResourceDefinition . ALWAYS_SET_KEEP_ALIVE , ListenerResourceDefinition . MAX_BUFFERED_REQUEST_SIZE , ListenerResourceDefinition . RECORD_REQUEST_START_TIME , ListenerResourceDefinition . ALLOW_EQUALS_IN_COOKIE_VALUE , ListenerResourceDefinition . NO_REQUEST_TIMEOUT , ListenerResourceDefinition . REQUEST_PARSE_TIMEOUT , ListenerResourceDefinition . DISALLOWED_METHODS , ListenerResourceDefinition . SECURE , ListenerResourceDefinition . RFC6265_COOKIE_VALIDATION , ListenerResourceDefinition . ALLOW_UNESCAPED_CHARACTERS_IN_URL ) ; }


Input: { [CODESPLIT] public void initialize ( ExtensionContext context ) { TransactionLogger . ROOT_LOGGER . debug ( "Initializing Transactions Extension" ) ; final LogStoreResource resource = new LogStoreResource ( ) ; final boolean registerRuntimeOnly = context . isRuntimeOnlyRegistrationValid ( ) ; final SubsystemRegistration subsystem = context . registerSubsystem ( SUBSYSTEM_NAME , CURRENT_MODEL_VERSION ) ; final TransactionSubsystemRootResourceDefinition rootResourceDefinition = new TransactionSubsystemRootResourceDefinition ( registerRuntimeOnly ) ; final ManagementResourceRegistration registration = subsystem . registerSubsystemModel ( rootResourceDefinition ) ; registration . registerOperationHandler ( GenericSubsystemDescribeHandler . DEFINITION , GenericSubsystemDescribeHandler . INSTANCE ) ; // Create the path resolver handlers if ( context . getProcessType ( ) . isServer ( ) ) { // It's less than ideal to create a separate operation here, but this extension contains two relative-to attributes final ResolvePathHandler objectStorePathHandler = ResolvePathHandler . Builder . of ( RESOLVE_OBJECT_STORE_PATH , context . getPathManager ( ) ) . setPathAttribute ( TransactionSubsystemRootResourceDefinition . OBJECT_STORE_PATH ) . setRelativeToAttribute ( TransactionSubsystemRootResourceDefinition . OBJECT_STORE_RELATIVE_TO ) . build ( ) ; registration . registerOperationHandler ( objectStorePathHandler . getOperationDefinition ( ) , objectStorePathHandler ) ; } ManagementResourceRegistration logStoreChild = registration . registerSubModel ( new LogStoreDefinition ( resource , registerRuntimeOnly ) ) ; if ( registerRuntimeOnly ) { ManagementResourceRegistration transactionChild = logStoreChild . registerSubModel ( new LogStoreTransactionDefinition ( resource ) ) ; transactionChild . registerSubModel ( LogStoreTransactionParticipantDefinition . INSTANCE ) ; } subsystem . registerXMLElementWriter ( TransactionSubsystemXMLPersister . INSTANCE ) ; }


Input: { [CODESPLIT] @ Override public void initializeParsers ( ExtensionParsingContext context ) { context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_1_0 . getUriString ( ) , TransactionSubsystem10Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_1_1 . getUriString ( ) , TransactionSubsystem11Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_1_2 . getUriString ( ) , TransactionSubsystem12Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_1_3 . getUriString ( ) , TransactionSubsystem13Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_1_4 . getUriString ( ) , TransactionSubsystem14Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_1_5 . getUriString ( ) , TransactionSubsystem15Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_2_0 . getUriString ( ) , TransactionSubsystem20Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_3_0 . getUriString ( ) , TransactionSubsystem30Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_4_0 . getUriString ( ) , TransactionSubsystem40Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , Namespace . TRANSACTIONS_5_0 . getUriString ( ) , TransactionSubsystem50Parser :: new ) ; }


Input: Get a singleton instance representing one of the primitive types . [CODESPLIT] public static PrimitiveAnalysis getPrimitiveAnalysis ( final Class cls ) { if ( cls == null ) throw IIOPLogger . ROOT_LOGGER . cannotAnalyzeNullClass ( ) ; if ( cls == Void . TYPE ) return voidAnalysis ; if ( cls == Boolean . TYPE ) return booleanAnalysis ; if ( cls == Character . TYPE ) return charAnalysis ; if ( cls == Byte . TYPE ) return byteAnalysis ; if ( cls == Short . TYPE ) return shortAnalysis ; if ( cls == Integer . TYPE ) return intAnalysis ; if ( cls == Long . TYPE ) return longAnalysis ; if ( cls == Float . TYPE ) return floatAnalysis ; if ( cls == Double . TYPE ) return doubleAnalysis ; throw IIOPLogger . ROOT_LOGGER . notAPrimitive ( cls . getName ( ) ) ; }


Input: Upon calling this method the EJB will be set to a shutdown state and no further invocations will be allowed . It will then wait for all active invocation to finish and then return . [CODESPLIT] public void shutdown ( ) { int value ; int oldValue ; //set the shutdown bit do { oldValue = invocationCount ; value = SHUTDOWN_FLAG | oldValue ; //the component has already been shutdown if ( oldValue == value ) { return ; } } while ( ! updater . compareAndSet ( this , oldValue , value ) ) ; synchronized ( lock ) { value = invocationCount ; while ( value != SHUTDOWN_FLAG ) { try { lock . wait ( ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } value = invocationCount ; if ( ( value & SHUTDOWN_FLAG ) == 0 ) { return ; //component has been restarted } } } }


Input: Create EE container entity manager factory [CODESPLIT] private EntityManagerFactory createContainerEntityManagerFactory ( ) { persistenceProviderAdaptor . beforeCreateContainerEntityManagerFactory ( pu ) ; try { ROOT_LOGGER . tracef ( "calling createContainerEntityManagerFactory for pu=%s with integration properties=%s, application properties=%s" , pu . getScopedPersistenceUnitName ( ) , properties , pu . getProperties ( ) ) ; return persistenceProvider . createContainerEntityManagerFactory ( pu , properties ) ; } finally { try { persistenceProviderAdaptor . afterCreateContainerEntityManagerFactory ( pu ) ; } finally { pu . setAnnotationIndex ( null ) ; // close reference to Annotation Index (only needed during call to createContainerEntityManagerFactory) //This is needed if the datasource is restarted //pu.setTempClassLoaderFactory(null);    // close reference to temp classloader factory (only needed during call to createEntityManagerFactory) } } }


Input: Creates URL pattern list from passed string . [CODESPLIT] public static List < String > getUrlPatterns ( final String urlPattern ) { final List < String > linkedList = new LinkedList < String > ( ) ; linkedList . add ( urlPattern ) ; return linkedList ; }


Input: Gets servlets meta data from jboss web meta data . If not found it creates new servlets meta data and associates them with jboss web meta data . [CODESPLIT] public static JBossServletsMetaData getServlets ( final JBossWebMetaData jbossWebMD ) { JBossServletsMetaData servletsMD = jbossWebMD . getServlets ( ) ; if ( servletsMD == null ) { servletsMD = new JBossServletsMetaData ( ) ; jbossWebMD . setServlets ( servletsMD ) ; } return servletsMD ; }


Input: Gets servlet mappings meta data from jboss web meta data . If not found it creates new servlet mappings meta data and associates them with jboss web meta data . [CODESPLIT] public static List < ServletMappingMetaData > getServletMappings ( final JBossWebMetaData jbossWebMD ) { List < ServletMappingMetaData > servletMappingsMD = jbossWebMD . getServletMappings ( ) ; if ( servletMappingsMD == null ) { servletMappingsMD = new LinkedList < ServletMappingMetaData > ( ) ; jbossWebMD . setServletMappings ( servletMappingsMD ) ; } return servletMappingsMD ; }


Input: Gets security constraints meta data from jboss web meta data . If not found it creates new security constraints meta data and associates them with jboss web meta data . [CODESPLIT] public static List < SecurityConstraintMetaData > getSecurityConstraints ( final JBossWebMetaData jbossWebMD ) { List < SecurityConstraintMetaData > securityConstraintsMD = jbossWebMD . getSecurityConstraints ( ) ; if ( securityConstraintsMD == null ) { securityConstraintsMD = new LinkedList < SecurityConstraintMetaData > ( ) ; jbossWebMD . setSecurityConstraints ( securityConstraintsMD ) ; } return securityConstraintsMD ; }


Input: Gets login config meta data from jboss web meta data . If not found it creates new login config meta data and associates them with jboss web meta data . [CODESPLIT] public static LoginConfigMetaData getLoginConfig ( final JBossWebMetaData jbossWebMD ) { LoginConfigMetaData loginConfigMD = jbossWebMD . getLoginConfig ( ) ; if ( loginConfigMD == null ) { loginConfigMD = new LoginConfigMetaData ( ) ; jbossWebMD . setLoginConfig ( loginConfigMD ) ; } return loginConfigMD ; }


Input: Gets context parameters meta data from jboss web meta data . If not found it creates new context parameters meta data and associates them with jboss web meta data . [CODESPLIT] public static List < ParamValueMetaData > getContextParams ( final JBossWebMetaData jbossWebMD ) { List < ParamValueMetaData > contextParamsMD = jbossWebMD . getContextParams ( ) ; if ( contextParamsMD == null ) { contextParamsMD = new LinkedList < ParamValueMetaData > ( ) ; jbossWebMD . setContextParams ( contextParamsMD ) ; } return contextParamsMD ; }


Input: Gets web resource collections meta data from security constraint meta data . If not found it creates new web resource collections meta data and associates them with security constraint meta data . [CODESPLIT] public static WebResourceCollectionsMetaData getWebResourceCollections ( final SecurityConstraintMetaData securityConstraintMD ) { WebResourceCollectionsMetaData webResourceCollectionsMD = securityConstraintMD . getResourceCollections ( ) ; if ( webResourceCollectionsMD == null ) { webResourceCollectionsMD = new WebResourceCollectionsMetaData ( ) ; securityConstraintMD . setResourceCollections ( webResourceCollectionsMD ) ; } return webResourceCollectionsMD ; }


Input: Gets init parameters meta data from servlet meta data . If not found it creates new init parameters meta data and associates them with servlet meta data . [CODESPLIT] public static List < ParamValueMetaData > getServletInitParams ( final ServletMetaData servletMD ) { List < ParamValueMetaData > initParamsMD = servletMD . getInitParam ( ) ; if ( initParamsMD == null ) { initParamsMD = new LinkedList < ParamValueMetaData > ( ) ; servletMD . setInitParam ( initParamsMD ) ; } return initParamsMD ; }


Input: Creates new security constraint meta data and associates them with security constraints meta data . [CODESPLIT] public static SecurityConstraintMetaData newSecurityConstraint ( final List < SecurityConstraintMetaData > securityConstraintsMD ) { final SecurityConstraintMetaData securityConstraintMD = new SecurityConstraintMetaData ( ) ; securityConstraintsMD . add ( securityConstraintMD ) ; return securityConstraintMD ; }


Input: Creates new web resource collection meta data and associates them with web resource collections meta data . [CODESPLIT] public static WebResourceCollectionMetaData newWebResourceCollection ( final String servletName , final String urlPattern , final boolean securedWsdl , final WebResourceCollectionsMetaData webResourceCollectionsMD ) { final WebResourceCollectionMetaData webResourceCollectionMD = new WebResourceCollectionMetaData ( ) ; webResourceCollectionMD . setWebResourceName ( servletName ) ; webResourceCollectionMD . setUrlPatterns ( WebMetaDataHelper . getUrlPatterns ( urlPattern ) ) ; webResourceCollectionMD . setHttpMethods ( WebMetaDataHelper . getHttpMethods ( securedWsdl ) ) ; webResourceCollectionsMD . add ( webResourceCollectionMD ) ; return webResourceCollectionMD ; }


Input: Creates new servlet meta data and associates them with servlets meta data . [CODESPLIT] public static JBossServletMetaData newServlet ( final String servletName , final String servletClass , final JBossServletsMetaData servletsMD ) { final JBossServletMetaData servletMD = new JBossServletMetaData ( ) ; servletMD . setServletName ( servletName ) ; servletMD . setServletClass ( servletClass ) ; servletsMD . add ( servletMD ) ; return servletMD ; }


Input: Creates new servlet mapping meta data and associates them with servlet mappings meta data . [CODESPLIT] public static ServletMappingMetaData newServletMapping ( final String servletName , final List < String > urlPatterns , final List < ServletMappingMetaData > servletMappingsMD ) { final ServletMappingMetaData servletMappingMD = new ServletMappingMetaData ( ) ; servletMappingMD . setServletName ( servletName ) ; servletMappingMD . setUrlPatterns ( urlPatterns ) ; servletMappingsMD . add ( servletMappingMD ) ; return servletMappingMD ; }


Input: Creates new authentication constraint and associates it with security constraint meta data . [CODESPLIT] public static AuthConstraintMetaData newAuthConstraint ( final List < String > roleNames , final SecurityConstraintMetaData securityConstraintMD ) { final AuthConstraintMetaData authConstraintMD = new AuthConstraintMetaData ( ) ; authConstraintMD . setRoleNames ( roleNames ) ; securityConstraintMD . setAuthConstraint ( authConstraintMD ) ; return authConstraintMD ; }


Input: Creates new user constraint meta data and associates it with security constraint meta data . [CODESPLIT] public static UserDataConstraintMetaData newUserDataConstraint ( final String transportGuarantee , final SecurityConstraintMetaData securityConstraintMD ) { final UserDataConstraintMetaData userDataConstraintMD = new UserDataConstraintMetaData ( ) ; final TransportGuaranteeType transportGuaranteeValue = TransportGuaranteeType . valueOf ( transportGuarantee ) ; userDataConstraintMD . setTransportGuarantee ( transportGuaranteeValue ) ; securityConstraintMD . setUserDataConstraint ( userDataConstraintMD ) ; return userDataConstraintMD ; }


Input: Creates new parameter meta data and associates it with parameters meta data . [CODESPLIT] public static ParamValueMetaData newParamValue ( final String key , final String value , final List < ParamValueMetaData > paramsMD ) { final ParamValueMetaData paramValueMD = WebMetaDataHelper . newParamValue ( key , value ) ; paramsMD . add ( paramValueMD ) ; return paramValueMD ; }


Input: Creates new parameter with specified key and value . [CODESPLIT] private static ParamValueMetaData newParamValue ( final String key , final String value ) { final ParamValueMetaData paramMD = new ParamValueMetaData ( ) ; paramMD . setParamName ( key ) ; paramMD . setParamValue ( value ) ; return paramMD ; }


Input: Process a deployment for standard ra deployment files . Will parse the xml file and attach a configuration discovered during processing . [CODESPLIT] @ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final CapabilityServiceSupport support = deploymentUnit . getAttachment ( Attachments . CAPABILITY_SERVICE_SUPPORT ) ; final List < DataSources > dataSourcesList = deploymentUnit . getAttachmentList ( DsXmlDeploymentParsingProcessor . DATA_SOURCES_ATTACHMENT_KEY ) ; final boolean legacySecurityPresent = phaseContext . getDeploymentUnit ( ) . hasAttachment ( SecurityAttachments . SECURITY_ENABLED ) ; for ( DataSources dataSources : dataSourcesList ) { if ( dataSources . getDrivers ( ) != null && dataSources . getDrivers ( ) . size ( ) > 0 ) { ConnectorLogger . DS_DEPLOYER_LOGGER . driversElementNotSupported ( deploymentUnit . getName ( ) ) ; } ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; if ( dataSources . getDataSource ( ) != null && dataSources . getDataSource ( ) . size ( ) > 0 ) { for ( int i = 0 ; i < dataSources . getDataSource ( ) . size ( ) ; i ++ ) { DataSource ds = ( DataSource ) dataSources . getDataSource ( ) . get ( i ) ; if ( ds . isEnabled ( ) && ds . getDriver ( ) != null ) { try { final String jndiName = Util . cleanJndiName ( ds . getJndiName ( ) , ds . isUseJavaContext ( ) ) ; LocalDataSourceService lds = new LocalDataSourceService ( jndiName , ContextNames . bindInfoFor ( jndiName ) ) ; lds . getDataSourceConfigInjector ( ) . inject ( buildDataSource ( ds ) ) ; final String dsName = ds . getJndiName ( ) ; final PathAddress addr = getDataSourceAddress ( dsName , deploymentUnit , false ) ; installManagementModel ( ds , deploymentUnit , addr ) ; // TODO why have we been ignoring a configured legacy security domain but no legacy security present? boolean useLegacySecurity = legacySecurityPresent && isLegacySecurityRequired ( ds . getSecurity ( ) ) ; startDataSource ( lds , jndiName , ds . getDriver ( ) , serviceTarget , getRegistration ( false , deploymentUnit ) , getResource ( dsName , false , deploymentUnit ) , dsName , useLegacySecurity , ds . isJTA ( ) , support ) ; } catch ( Exception e ) { throw ConnectorLogger . ROOT_LOGGER . exceptionDeployingDatasource ( e , ds . getJndiName ( ) ) ; } } else { ConnectorLogger . DS_DEPLOYER_LOGGER . debugf ( "Ignoring: %s" , ds . getJndiName ( ) ) ; } } } if ( dataSources . getXaDataSource ( ) != null && dataSources . getXaDataSource ( ) . size ( ) > 0 ) { for ( int i = 0 ; i < dataSources . getXaDataSource ( ) . size ( ) ; i ++ ) { XaDataSource xads = ( XaDataSource ) dataSources . getXaDataSource ( ) . get ( i ) ; if ( xads . isEnabled ( ) && xads . getDriver ( ) != null ) { try { String jndiName = Util . cleanJndiName ( xads . getJndiName ( ) , xads . isUseJavaContext ( ) ) ; XaDataSourceService xds = new XaDataSourceService ( jndiName , ContextNames . bindInfoFor ( jndiName ) ) ; xds . getDataSourceConfigInjector ( ) . inject ( buildXaDataSource ( xads ) ) ; final String dsName = xads . getJndiName ( ) ; final PathAddress addr = getDataSourceAddress ( dsName , deploymentUnit , true ) ; installManagementModel ( xads , deploymentUnit , addr ) ; final Credential credential = xads . getRecovery ( ) == null ? null : xads . getRecovery ( ) . getCredential ( ) ; // TODO why have we been ignoring a configured legacy security domain but no legacy security present? boolean useLegacySecurity = legacySecurityPresent && ( isLegacySecurityRequired ( xads . getSecurity ( ) ) || isLegacySecurityRequired ( credential ) ) ; startDataSource ( xds , jndiName , xads . getDriver ( ) , serviceTarget , getRegistration ( true , deploymentUnit ) , getResource ( dsName , true , deploymentUnit ) , dsName , useLegacySecurity , true , support ) ; } catch ( Exception e ) { throw ConnectorLogger . ROOT_LOGGER . exceptionDeployingDatasource ( e , xads . getJndiName ( ) ) ; } } else { ConnectorLogger . DS_DEPLOYER_LOGGER . debugf ( "Ignoring %s" , xads . getJndiName ( ) ) ; } } } } }


Input: { [CODESPLIT] @ Override public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final Module module = deploymentUnit . getAttachment ( Attachments . MODULE ) ; final ServicesAttachment servicesAttachment = deploymentUnit . getAttachment ( Attachments . SERVICES ) ; if ( module != null && servicesAttachment != null ) { final ModuleClassLoader classLoader = module . getClassLoader ( ) ; final List < String > driverNames = servicesAttachment . getServiceImplementations ( Driver . class . getName ( ) ) ; int idx = 0 ; for ( String driverClassName : driverNames ) { try { final Class < ? extends Driver > driverClass = classLoader . loadClass ( driverClassName ) . asSubclass ( Driver . class ) ; final Constructor < ? extends Driver > constructor = driverClass . getConstructor ( ) ; final Driver driver = constructor . newInstance ( ) ; final int majorVersion = driver . getMajorVersion ( ) ; final int minorVersion = driver . getMinorVersion ( ) ; final boolean compliant = driver . jdbcCompliant ( ) ; if ( compliant ) { DEPLOYER_JDBC_LOGGER . deployingCompliantJdbcDriver ( driverClass , Integer . valueOf ( majorVersion ) , Integer . valueOf ( minorVersion ) ) ; } else { DEPLOYER_JDBC_LOGGER . deployingNonCompliantJdbcDriver ( driverClass , Integer . valueOf ( majorVersion ) , Integer . valueOf ( minorVersion ) ) ; } String driverName = deploymentUnit . getName ( ) ; if ( ( driverName . contains ( "." ) && ! driverName . endsWith ( ".jar" ) ) || driverNames . size ( ) != 1 ) { driverName += "_" + driverClassName + "_" + majorVersion + "_" + minorVersion ; } InstalledDriver driverMetadata = new InstalledDriver ( driverName , driverClass . getName ( ) , null , null , majorVersion , minorVersion , compliant ) ; DriverService driverService = new DriverService ( driverMetadata , driver ) ; phaseContext . getServiceTarget ( ) . addService ( ServiceName . JBOSS . append ( "jdbc-driver" , driverName . replaceAll ( "\\." , "_" ) ) , driverService ) . addDependency ( ConnectorServices . JDBC_DRIVER_REGISTRY_SERVICE , DriverRegistry . class , driverService . getDriverRegistryServiceInjector ( ) ) . setInitialMode ( Mode . ACTIVE ) . install ( ) ; if ( idx == 0 && driverNames . size ( ) != 1 ) { // create short name driver service driverName = deploymentUnit . getName ( ) ; // reset driverName to the deployment unit name driverMetadata = new InstalledDriver ( driverName , driverClass . getName ( ) , null , null , majorVersion , minorVersion , compliant ) ; driverService = new DriverService ( driverMetadata , driver ) ; phaseContext . getServiceTarget ( ) . addService ( ServiceName . JBOSS . append ( "jdbc-driver" , driverName . replaceAll ( "\\." , "_" ) ) , driverService ) . addDependency ( ConnectorServices . JDBC_DRIVER_REGISTRY_SERVICE , DriverRegistry . class , driverService . getDriverRegistryServiceInjector ( ) ) . setInitialMode ( Mode . ACTIVE ) . install ( ) ; } idx ++ ; } catch ( Throwable e ) { DEPLOYER_JDBC_LOGGER . cannotInstantiateDriverClass ( driverClassName , e ) ; } } } }


Input: Parses the <code > interceptor - binding< / code > element and returns the corresponding { @link InterceptorBindingMetaData } [CODESPLIT] private InterceptorBindingMetaData readInterceptorBinding ( final XMLStreamReader reader , final PropertyReplacer propertyReplacer ) throws XMLStreamException { return InterceptorBindingMetaDataParser . INSTANCE . parse ( reader , propertyReplacer ) ; }


Input: Register our listeners on SFSB that will be created [CODESPLIT] private void registerSessionBeanInterceptors ( SessionBeanComponentDescription componentDescription , final DeploymentUnit deploymentUnit ) { // if it's a SFSB then setup appropriate interceptors if ( componentDescription . isStateful ( ) ) { // first setup the post construct and pre destroy component interceptors componentDescription . getConfigurators ( ) . addFirst ( new ComponentConfigurator ( ) { @ Override public void configure ( DeploymentPhaseContext context , ComponentDescription description , ComponentConfiguration configuration ) throws DeploymentUnitProcessingException { configuration . addPostConstructInterceptor ( SFSBPreCreateInterceptor . FACTORY , InterceptorOrder . ComponentPostConstruct . JPA_SFSB_PRE_CREATE ) ; configuration . addPostConstructInterceptor ( SFSBCreateInterceptor . FACTORY , InterceptorOrder . ComponentPostConstruct . JPA_SFSB_CREATE ) ; configuration . addPreDestroyInterceptor ( SFSBDestroyInterceptor . FACTORY , InterceptorOrder . ComponentPreDestroy . JPA_SFSB_DESTROY ) ; configuration . addComponentInterceptor ( SFSBInvocationInterceptor . FACTORY , InterceptorOrder . Component . JPA_SFSB_INTERCEPTOR , false ) ; //we need to serialized the entity manager state configuration . getInterceptorContextKeys ( ) . add ( SFSBInvocationInterceptor . CONTEXT_KEY ) ; } } ) ; } // register interceptor on stateful/stateless SB with transactional entity manager. if ( ( componentDescription . isStateful ( ) || componentDescription . isStateless ( ) ) ) { componentDescription . getConfigurators ( ) . add ( new ComponentConfigurator ( ) { @ Override public void configure ( DeploymentPhaseContext context , ComponentDescription description , ComponentConfiguration configuration ) throws DeploymentUnitProcessingException { configuration . addComponentInterceptor ( SBInvocationInterceptor . FACTORY , InterceptorOrder . Component . JPA_SESSION_BEAN_INTERCEPTOR , false ) ; } } ) ; } }


Input: <p > Make a deep copy of an { @code IOP : TaggedComponent } . < / p > [CODESPLIT] public static TaggedComponent createCopy ( TaggedComponent tc ) { TaggedComponent copy = null ; if ( tc != null ) { byte [ ] buf = new byte [ tc . component_data . length ] ; System . arraycopy ( tc . component_data , 0 , buf , 0 , tc . component_data . length ) ; copy = new TaggedComponent ( tc . tag , buf ) ; } return copy ; }


Input: <p > Return a top - level { @code IOP :: TaggedComponent } to be stuffed into an IOR containing a structure { @code SSLIOP :: SSL } tagged as { @code TAG_SSL_SEC_TRANS } . < / p > <p > Should be called with non - null metadata in which case we probably don t want to include security info in the IOR . < / p > [CODESPLIT] public static TaggedComponent createSSLTaggedComponent ( IORSecurityConfigMetaData metadata , Codec codec , int sslPort , ORB orb ) { if ( metadata == null ) { IIOPLogger . ROOT_LOGGER . debug ( "Method createSSLTaggedComponent() called with null metadata" ) ; return null ; } if ( sslPort == 0 ) { // no support for transport security. return null ; } TaggedComponent tc ; try { int supports = createTargetSupports ( metadata . getTransportConfig ( ) ) ; int requires = createTargetRequires ( metadata . getTransportConfig ( ) ) ; SSL ssl = new SSL ( ( short ) supports , ( short ) requires , ( short ) sslPort ) ; Any any = orb . create_any ( ) ; SSLHelper . insert ( any , ssl ) ; byte [ ] componentData = codec . encode_value ( any ) ; tc = new TaggedComponent ( TAG_SSL_SEC_TRANS . value , componentData ) ; } catch ( InvalidTypeForEncoding e ) { throw IIOPLogger . ROOT_LOGGER . unexpectedException ( e ) ; } return tc ; }


Input: <p > Return a top - level { @code IOP : TaggedComponent } to be stuffed into an IOR containing a { @code org . omg . CSIIOP } . { @code CompoundSecMechList } tagged as { @code TAG_CSI_SEC_MECH_LIST } . Only one such component can exist inside an IOR . < / p > <p > Should be called with non - null metadata in which case we probably don t want to include security info in the IOR . < / p > [CODESPLIT] public static TaggedComponent createSecurityTaggedComponent ( IORSecurityConfigMetaData metadata , Codec codec , int sslPort , ORB orb ) { if ( metadata == null ) { IIOPLogger . ROOT_LOGGER . debug ( "Method createSecurityTaggedComponent() called with null metadata" ) ; return null ; } TaggedComponent tc ; // get the the supported security mechanisms. CompoundSecMech [ ] mechList = createCompoundSecMechanisms ( metadata , codec , sslPort , orb ) ; // the above is wrapped into a org.omg.CSIIOP.CompoundSecMechList structure, which is NOT a CompoundSecMech[]. // we don't support stateful/reusable security contexts (false). CompoundSecMechList csmList = new CompoundSecMechList ( false , mechList ) ; // finally, the CompoundSecMechList must be encoded as a TaggedComponent try { Any any = orb . create_any ( ) ; CompoundSecMechListHelper . insert ( any , csmList ) ; byte [ ] b = codec . encode_value ( any ) ; tc = new TaggedComponent ( TAG_CSI_SEC_MECH_LIST . value , b ) ; } catch ( InvalidTypeForEncoding e ) { throw IIOPLogger . ROOT_LOGGER . unexpectedException ( e ) ; } return tc ; }


Input: <p > Create a { @code org . omg . CSIIOP . CompoundSecMechanisms } which is a sequence of { @code CompoundSecMech } . Here we only support one security mechanism . < / p > [CODESPLIT] public static CompoundSecMech [ ] createCompoundSecMechanisms ( IORSecurityConfigMetaData metadata , Codec codec , int sslPort , ORB orb ) { // support just 1 security mechanism for now (and ever). CompoundSecMech [ ] csmList = new CompoundSecMech [ 1 ] ; // a CompoundSecMech contains: target_requires, transport_mech, as_context_mech, sas_context_mech. TaggedComponent transport_mech = createTransportMech ( metadata . getTransportConfig ( ) , codec , sslPort , orb ) ; // create AS Context. AS_ContextSec asContext = createAuthenticationServiceContext ( metadata ) ; // create SAS Context. SAS_ContextSec sasContext = createSecureAttributeServiceContext ( metadata ) ; // create target_requires bit field (AssociationOption) can't read directly the transport_mech TaggedComponent. int target_requires = createTargetRequires ( metadata . getTransportConfig ( ) ) | asContext . target_requires | sasContext . target_requires ; CompoundSecMech csm = new CompoundSecMech ( ( short ) target_requires , transport_mech , asContext , sasContext ) ; csmList [ 0 ] = csm ; return csmList ; }


Input: <p > Create the Secure Attribute Service ( SAS ) context included in a { @code CompoundSecMech } definition . < / p > [CODESPLIT] public static SAS_ContextSec createSecureAttributeServiceContext ( IORSecurityConfigMetaData metadata ) { SAS_ContextSec context ; // context contains target_supports, target_requires, privilige_authorities, supported_naming_mechanisms, supported_identity_types. int support = 0 ; int require = 0 ; ServiceConfiguration [ ] privilAuth = new ServiceConfiguration [ 0 ] ; byte [ ] [ ] supNamMechs = { } ; int supIdenTypes = 0 ; // 0 means ITTAbsent // the the SasContext metadata. IORSASContextMetaData sasMeta = metadata . getSasContext ( ) ; // if no SAS context metadata, or caller propagation is not supported, we return with a more or less empty sas context. if ( sasMeta == null || sasMeta . getCallerPropagation ( ) . equals ( IORSASContextMetaData . CALLER_PROPAGATION_NONE ) ) { context = new SAS_ContextSec ( ( short ) support , ( short ) require , privilAuth , supNamMechs , supIdenTypes ) ; } else { support = IdentityAssertion . value ; // supporting GSSUP (username/password) naming mechanism. byte [ ] upMech = createGSSUPMechOID ( ) ; supNamMechs = new byte [ 1 ] [ upMech . length ] ; System . arraycopy ( upMech , 0 , supNamMechs [ 0 ] , 0 , upMech . length ) ; // since we support IdentityAssertion we need to specify supported identity types. CTS says we need them all supIdenTypes = ITTAnonymous . value | ITTPrincipalName . value | ITTX509CertChain . value | ITTDistinguishedName . value ; context = new SAS_ContextSec ( ( short ) support , ( short ) require , privilAuth , supNamMechs , supIdenTypes ) ; } return context ; }


Input: <p > Create the client Authentication Service ( AS ) context included in a { @code CompoundSecMech } definition . < / p > [CODESPLIT] public static AS_ContextSec createAuthenticationServiceContext ( IORSecurityConfigMetaData metadata ) { AS_ContextSec context ; // the content of the context. int support = 0 ; int require = 0 ; byte [ ] clientAuthMech = { } ; byte [ ] targetName = { } ; IORASContextMetaData asMeta = metadata . getAsContext ( ) ; // if no AS context metatada exists, or authentication method "none" is specified, we can produce an empty AS context. if ( asMeta == null || asMeta . getAuthMethod ( ) . equals ( IORASContextMetaData . AUTH_METHOD_NONE ) ) { context = new AS_ContextSec ( ( short ) support , ( short ) require , clientAuthMech , targetName ) ; } else { // we do support. support = EstablishTrustInClient . value ; // required depends on the metadata. if ( asMeta . isRequired ( ) ) { require = EstablishTrustInClient . value ; } // we only support GSSUP authentication method. clientAuthMech = createGSSUPMechOID ( ) ; // finally, encode the "realm" name as a CSI.GSS_NT_ExportedName. // clientAuthMech should contain the DER encoded GSSUPMechOID at this point. String realm = asMeta . getRealm ( ) ; targetName = createGSSExportedName ( clientAuthMech , realm . getBytes ( StandardCharsets . UTF_8 ) ) ; context = new AS_ContextSec ( ( short ) support , ( short ) require , clientAuthMech , targetName ) ; } return context ; }


Input: <p > Create a transport mechanism { @code TaggedComponent } to be stuffed into a { @code CompoundSecMech } . < / p > <p > If no { @code TransportConfig } metadata is specified or ssl port is negative or the specified metadata indicates that transport config is not supported then a { @code TAG_NULL_TAG } ( empty ) { @code TaggedComponent } will be returned . < / p > <p > Otherwise a { @code org . omg . CSIIOP . TLS_SEC_TRANS } tagged as { @code TAG_TLS_SEC_TRANS } will be returned indicating support for TLS / SSL as a CSIv2 transport mechanism . < / p > <p > Multiple { @code TransportAddress } may be included in the SSL info ( host / port pairs ) but we only include one . < / p > [CODESPLIT] public static TaggedComponent createTransportMech ( IORTransportConfigMetaData tconfig , Codec codec , int sslPort , ORB orb ) { TaggedComponent tc ; // what we support and require as a target. int support = 0 ; int require = 0 ; if ( tconfig != null ) { require = createTargetRequires ( tconfig ) ; support = createTargetSupports ( tconfig ) ; } if ( tconfig == null || support == 0 || sslPort == 0 ) { // no support for transport security. tc = new TaggedComponent ( TAG_NULL_TAG . value , new byte [ 0 ] ) ; } else { // my ip address. String host = CorbaORBService . getORBProperty ( Constants . ORB_ADDRESS ) ; // this will create only one transport address. TransportAddress [ ] taList = createTransportAddress ( host , sslPort ) ; TLS_SEC_TRANS tst = new TLS_SEC_TRANS ( ( short ) support , ( short ) require , taList ) ; // The tricky part, we must encode TLS_SEC_TRANS into an octet sequence. try { Any any = orb . create_any ( ) ; TLS_SEC_TRANSHelper . insert ( any , tst ) ; byte [ ] b = codec . encode_value ( any ) ; tc = new TaggedComponent ( TAG_TLS_SEC_TRANS . value , b ) ; } catch ( InvalidTypeForEncoding e ) { throw IIOPLogger . ROOT_LOGGER . unexpectedException ( e ) ; } } return tc ; }


Input: <p > Create a { @code TransportAddress [] } with a single { @code TransportAddress } . < / p > [CODESPLIT] public static TransportAddress [ ] createTransportAddress ( String host , int port ) { // idl type is unsigned sort, so we need this trick short short_port = ( port > 32767 ) ? ( short ) ( port - 65536 ) : ( short ) port ; TransportAddress ta = new TransportAddress ( host , short_port ) ; TransportAddress [ ] taList = new TransportAddress [ 1 ] ; taList [ 0 ] = ta ; return taList ; }


Input: <p > Create the bitmask of what the target requires . < / p > [CODESPLIT] public static int createTargetRequires ( IORTransportConfigMetaData tc ) { int requires = 0 ; if ( tc != null ) { if ( tc . getIntegrity ( ) . equals ( IORTransportConfigMetaData . INTEGRITY_REQUIRED ) ) { requires = requires | Integrity . value ; } if ( tc . getConfidentiality ( ) . equals ( IORTransportConfigMetaData . CONFIDENTIALITY_REQUIRED ) ) { requires = requires | Confidentiality . value ; } if ( tc . getDetectMisordering ( ) . equalsIgnoreCase ( IORTransportConfigMetaData . DETECT_MISORDERING_REQUIRED ) ) { requires = requires | DetectMisordering . value ; } if ( tc . getDetectReplay ( ) . equalsIgnoreCase ( IORTransportConfigMetaData . DETECT_REPLAY_REQUIRED ) ) { requires = requires | DetectReplay . value ; } // no EstablishTrustInTarget required - client decides if ( tc . getEstablishTrustInClient ( ) . equals ( IORTransportConfigMetaData . ESTABLISH_TRUST_IN_CLIENT_REQUIRED ) ) { requires = requires | EstablishTrustInClient . value ; } } return requires ; }


Input: <p > Create the bitmask of what the target supports . < / p > [CODESPLIT] public static int createTargetSupports ( IORTransportConfigMetaData tc ) { int supports = 0 ; if ( tc != null ) { if ( ! tc . getIntegrity ( ) . equals ( IORTransportConfigMetaData . INTEGRITY_NONE ) ) { supports = supports | Integrity . value ; } if ( ! tc . getConfidentiality ( ) . equals ( IORTransportConfigMetaData . CONFIDENTIALITY_NONE ) ) { supports = supports | Confidentiality . value ; } if ( ! tc . getDetectMisordering ( ) . equalsIgnoreCase ( IORTransportConfigMetaData . DETECT_MISORDERING_NONE ) ) { supports = supports | DetectMisordering . value ; } if ( ! tc . getDetectReplay ( ) . equalsIgnoreCase ( IORTransportConfigMetaData . DETECT_REPLAY_NONE ) ) { supports = supports | DetectReplay . value ; } if ( ! tc . getEstablishTrustInTarget ( ) . equals ( IORTransportConfigMetaData . ESTABLISH_TRUST_IN_TARGET_NONE ) ) { supports = supports | EstablishTrustInTarget . value ; } if ( ! tc . getEstablishTrustInClient ( ) . equals ( IORTransportConfigMetaData . ESTABLISH_TRUST_IN_CLIENT_NONE ) ) { supports = supports | EstablishTrustInClient . value ; } } return supports ; }


Input: <p > Create an ASN . 1 DER encoded representation for the GSSUP OID mechanism . < / p > [CODESPLIT] public static byte [ ] createGSSUPMechOID ( ) { // kudos to org.ietf.jgss.Oid for the Oid utility need to strip the "oid:" part of the GSSUPMechOID first. byte [ ] retval = { } ; try { Oid oid = new Oid ( GSSUPMechOID . value . substring ( 4 ) ) ; retval = oid . getDER ( ) ; } catch ( GSSException e ) { IIOPLogger . ROOT_LOGGER . caughtExceptionEncodingGSSUPMechOID ( e ) ; } return retval ; }


Input: <p / > Generate an exported name as specified in [ RFC 2743 ] section 3 . 2 copied below : <p / > 3 . 2 : Mechanism - Independent Exported Name Object Format <p / > This section specifies a mechanism - independent level of encapsulating representation for names exported via the GSS_Export_name () call including an object identifier representing the exporting mechanism . The format of names encapsulated via this representation shall be defined within individual mechanism drafts . The Object Identifier value to indicate names of this type is defined in Section 4 . 7 of this document . <p / > No name type OID is included in this mechanism - independent level of format definition since ( depending on individual mechanism specifications ) the enclosed name may be implicitly typed or may be explicitly typed using a means other than OID encoding . <p / > The bytes within MECH_OID_LEN and NAME_LEN elements are represented most significant byte first ( equivalently in IP network byte order ) . <p / > Length Name Description <p / > 2 TOK_ID Token Identifier For exported name objects this must be hex 04 01 . 2 MECH_OID_LEN Length of the Mechanism OID MECH_OID_LEN MECH_OID Mechanism OID in DER 4 NAME_LEN Length of name NAME_LEN NAME Exported name ; format defined in applicable mechanism draft . <p / > A concrete example of the contents of an exported name object derived from the Kerberos Version 5 mechanism is as follows : <p / > 04 01 00 0B 06 09 2A 86 48 86 F7 12 01 02 02 hx xx xx xl pp qq ... zz <p / > ... [CODESPLIT] public static byte [ ] createGSSExportedName ( byte [ ] oid , byte [ ] name ) { int olen = oid . length ; int nlen = name . length ; // size according to spec. int size = 2 + 2 + olen + 4 + nlen ; // allocate space for the exported name. byte [ ] buf = new byte [ size ] ; // index. int i = 0 ; // standard header. buf [ i ++ ] = 0x04 ; buf [ i ++ ] = 0x01 ; // encode oid length. buf [ i ++ ] = ( byte ) ( olen & 0xFF00 ) ; buf [ i ++ ] = ( byte ) ( olen & 0x00FF ) ; // copy the oid in the exported name buffer. System . arraycopy ( oid , 0 , buf , i , olen ) ; i += olen ; // encode the name length in the exported buffer. buf [ i ++ ] = ( byte ) ( nlen & 0xFF000000 ) ; buf [ i ++ ] = ( byte ) ( nlen & 0x00FF0000 ) ; buf [ i ++ ] = ( byte ) ( nlen & 0x0000FF00 ) ; buf [ i ++ ] = ( byte ) ( nlen & 0x000000FF ) ; // finally, copy the name bytes. System . arraycopy ( name , 0 , buf , i , nlen ) ; return buf ; }


Input: <p > ASN . 1 - encode an { @code InitialContextToken } as defined in RFC 2743 Section 3 . 1 Mechanism - Independent Token Format pp . 81 - 82 . The encoded token contains the ASN . 1 tag 0x60 followed by a token length ( which is itself stored in a variable - length format and takes 1 to 5 bytes ) the GSSUP mechanism identifier and a mechanism - specific token which in this case is a CDR encapsulation of the GSSUP { @code InitialContextToken } in the { @code authToken } parameter . < / p > [CODESPLIT] public static byte [ ] encodeInitialContextToken ( InitialContextToken authToken , Codec codec ) { byte [ ] out ; Any any = ORB . init ( ) . create_any ( ) ; InitialContextTokenHelper . insert ( any , authToken ) ; try { out = codec . encode_value ( any ) ; } catch ( Exception e ) { return new byte [ 0 ] ; } int length = out . length + gssUpMechOidArray . length ; int n ; if ( length < ( 1 << 7 ) ) { n = 0 ; } else if ( length < ( 1 << 8 ) ) { n = 1 ; } else if ( length < ( 1 << 16 ) ) { n = 2 ; } else if ( length < ( 1 << 24 ) ) { n = 3 ; } else { // if (length < (1 << 32)) n = 4 ; } byte [ ] encodedToken = new byte [ 2 + n + length ] ; encodedToken [ 0 ] = 0x60 ; if ( n == 0 ) { encodedToken [ 1 ] = ( byte ) length ; } else { encodedToken [ 1 ] = ( byte ) ( n | 0x80 ) ; switch ( n ) { case 1 : encodedToken [ 2 ] = ( byte ) length ; break ; case 2 : encodedToken [ 2 ] = ( byte ) ( length >> 8 ) ; encodedToken [ 3 ] = ( byte ) length ; break ; case 3 : encodedToken [ 2 ] = ( byte ) ( length >> 16 ) ; encodedToken [ 3 ] = ( byte ) ( length >> 8 ) ; encodedToken [ 4 ] = ( byte ) length ; break ; default : // case 4: encodedToken [ 2 ] = ( byte ) ( length >> 24 ) ; encodedToken [ 3 ] = ( byte ) ( length >> 16 ) ; encodedToken [ 4 ] = ( byte ) ( length >> 8 ) ; encodedToken [ 5 ] = ( byte ) length ; } } System . arraycopy ( gssUpMechOidArray , 0 , encodedToken , 2 + n , gssUpMechOidArray . length ) ; System . arraycopy ( out , 0 , encodedToken , 2 + n + gssUpMechOidArray . length , out . length ) ; return encodedToken ; }


Input: <p > Decodes an ASN . 1 - encoded { @code InitialContextToken } . See { @code encodeInitialContextToken } for a description of the encoded token format . < / p > [CODESPLIT] public static InitialContextToken decodeInitialContextToken ( byte [ ] encodedToken , Codec codec ) { if ( encodedToken [ 0 ] != 0x60 ) return null ; int encodedLength = 0 ; int n = 0 ; if ( encodedToken [ 1 ] >= 0 ) encodedLength = encodedToken [ 1 ] ; else { n = encodedToken [ 1 ] & 0x7F ; for ( int i = 1 ; i <= n ; i ++ ) { encodedLength += ( encodedToken [ 1 + i ] & 0xFF ) << ( n - i ) * 8 ; } } int length = encodedLength - gssUpMechOidArray . length ; byte [ ] encodedInitialContextToken = new byte [ length ] ; System . arraycopy ( encodedToken , 2 + n + gssUpMechOidArray . length , encodedInitialContextToken , 0 , length ) ; Any any ; try { any = codec . decode_value ( encodedInitialContextToken , InitialContextTokenHelper . type ( ) ) ; } catch ( Exception e ) { return null ; } return InitialContextTokenHelper . extract ( any ) ; }


Input: <p > Decodes a GSS exported name that has been encoded with the GSSUP mechanism OID . See { @code createGSSExportedName } for a description of the encoding format . < / p > [CODESPLIT] public static byte [ ] decodeGssExportedName ( byte [ ] encodedName ) { if ( encodedName [ 0 ] != 0x04 || encodedName [ 1 ] != 0x01 ) return null ; int mechOidLength = ( encodedName [ 2 ] & 0xFF ) << 8 ; //MECH_OID_LEN mechOidLength += ( encodedName [ 3 ] & 0xFF ) ; // MECH_OID_LEN byte [ ] oidArray = new byte [ mechOidLength ] ; System . arraycopy ( encodedName , 4 , oidArray , 0 , mechOidLength ) ; for ( int i = 0 ; i < mechOidLength ; i ++ ) { if ( gssUpMechOidArray [ i ] != oidArray [ i ] ) { return null ; } } int offset = 4 + mechOidLength ; int nameLength = ( encodedName [ offset ] & 0xFF ) << 24 ; nameLength += ( encodedName [ ++ offset ] & 0xFF ) << 16 ; nameLength += ( encodedName [ ++ offset ] & 0xFF ) << 8 ; nameLength += ( encodedName [ ++ offset ] & 0xFF ) ; byte [ ] name = new byte [ nameLength ] ; System . arraycopy ( encodedName , ++ offset , name , 0 , nameLength ) ; return name ; }


Input: <p > Helper method to be called from a client request interceptor . The { @code ri } parameter refers to the current request . This method returns the first { @code CompoundSecMech } found in the target IOR such that <ul > <li > all { @code CompoundSecMech } requirements are satisfied by the options in the { @code clientSupports } parameter and< / li > <li > every requirement in the { @code clientRequires } parameter is satisfied by the { @code CompoundSecMech } . < / li > < / ul > The method returns null if the target IOR contains no { @code CompoundSecMech } s or if no matching { @code CompoundSecMech } is found . < / p > <p > Since this method is intended to be called from a client request interceptor it converts unexpected exceptions into { @code MARSHAL } exceptions . < / p > [CODESPLIT] public static CompoundSecMech getMatchingSecurityMech ( ClientRequestInfo ri , Codec codec , short clientSupports , short clientRequires ) { CompoundSecMechList csmList ; try { TaggedComponent tc = ri . get_effective_component ( org . omg . IOP . TAG_CSI_SEC_MECH_LIST . value ) ; Any any = codec . decode_value ( tc . component_data , CompoundSecMechListHelper . type ( ) ) ; csmList = CompoundSecMechListHelper . extract ( any ) ; // look for the first matching security mech. for ( int i = 0 ; i < csmList . mechanism_list . length ; i ++ ) { CompoundSecMech securityMech = csmList . mechanism_list [ i ] ; AS_ContextSec authConfig = securityMech . as_context_mech ; if ( ( EstablishTrustInTarget . value & ( clientRequires ^ authConfig . target_supports ) & ~ authConfig . target_supports ) != 0 ) { // client requires EstablishTrustInTarget, but target does not support it: skip this securityMech. continue ; } if ( ( EstablishTrustInClient . value & ( authConfig . target_requires ^ clientSupports ) & ~ clientSupports ) != 0 ) { // target requires EstablishTrustInClient, but client does not support it: skip this securityMech. continue ; } SAS_ContextSec identityConfig = securityMech . sas_context_mech ; if ( ( IdentityAssertion . value & ( identityConfig . target_requires ^ clientSupports ) & ~ clientSupports ) != 0 ) { // target requires IdentityAssertion, but client does not support it: skip this securityMech continue ; } // found matching securityMech. return securityMech ; } // no matching securityMech was found. return null ; } catch ( BAD_PARAM e ) { // no component with TAG_CSI_SEC_MECH_LIST was found. return null ; } catch ( org . omg . IOP . CodecPackage . TypeMismatch e ) { // unexpected exception in codec throw IIOPLogger . ROOT_LOGGER . unexpectedException ( e ) ; } catch ( org . omg . IOP . CodecPackage . FormatMismatch e ) { // unexpected exception in codec throw IIOPLogger . ROOT_LOGGER . unexpectedException ( e ) ; } }


Input: { [CODESPLIT] @ Override public void readElement ( XMLExtendedStreamReader reader , List < ModelNode > list ) throws XMLStreamException { // EE subsystem doesn't have any attributes, so make sure that the xml doesn't have any requireNoAttributes ( reader ) ; final ModelNode eeSubSystem = Util . createAddOperation ( PathAddress . pathAddress ( EeExtension . PATH_SUBSYSTEM ) ) ; // add the subsystem to the ModelNode(s) list . add ( eeSubSystem ) ; // elements final EnumSet < Element > encountered = EnumSet . noneOf ( Element . class ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { switch ( Namespace . forUri ( reader . getNamespaceURI ( ) ) ) { case EE_1_0 : { final Element element = Element . forName ( reader . getLocalName ( ) ) ; if ( ! encountered . add ( element ) ) { throw unexpectedElement ( reader ) ; } switch ( element ) { case GLOBAL_MODULES : { final ModelNode model = parseGlobalModules ( reader ) ; eeSubSystem . get ( GlobalModulesDefinition . GLOBAL_MODULES ) . set ( model ) ; break ; } case EAR_SUBDEPLOYMENTS_ISOLATED : { final String earSubDeploymentsIsolated = parseEarSubDeploymentsIsolatedElement ( reader ) ; // set the ear subdeployment isolation on the subsystem operation EeSubsystemRootResource . EAR_SUBDEPLOYMENTS_ISOLATED . parseAndSetParameter ( earSubDeploymentsIsolated , eeSubSystem , reader ) ; break ; } default : { throw unexpectedElement ( reader ) ; } } break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: Resolves ejb - ref and ejb - local - ref elements [CODESPLIT] protected List < BindingConfiguration > processDescriptorEntries ( DeploymentUnit deploymentUnit , DeploymentDescriptorEnvironment environment , ResourceInjectionTarget resourceInjectionTarget , final ComponentDescription componentDescription , ClassLoader classLoader , DeploymentReflectionIndex deploymentReflectionIndex , final EEApplicationClasses applicationClasses ) throws DeploymentUnitProcessingException { final RemoteEnvironment remoteEnvironment = environment . getEnvironment ( ) ; List < BindingConfiguration > bindingDescriptions = new ArrayList < BindingConfiguration > ( ) ; EJBReferencesMetaData ejbRefs = remoteEnvironment . getEjbReferences ( ) ; if ( ejbRefs != null ) { for ( EJBReferenceMetaData ejbRef : ejbRefs ) { String name = ejbRef . getEjbRefName ( ) ; String ejbName = ejbRef . getLink ( ) ; String lookup = ejbRef . getLookupName ( ) != null ? ejbRef . getLookupName ( ) : ejbRef . getMappedName ( ) ; String remoteInterface = ejbRef . getRemote ( ) ; String home = ejbRef . getHome ( ) ; Class < ? > remoteInterfaceType = null ; //if a home is specified this is the type that is bound if ( ! isEmpty ( home ) ) { try { remoteInterfaceType = ClassLoadingUtils . loadClass ( home , deploymentUnit ) ; } catch ( ClassNotFoundException e ) { throw EjbLogger . ROOT_LOGGER . failedToLoadViewClass ( e , home ) ; } } else if ( ! isEmpty ( remoteInterface ) ) { try { remoteInterfaceType = ClassLoadingUtils . loadClass ( remoteInterface , deploymentUnit ) ; } catch ( ClassNotFoundException e ) { throw EjbLogger . ROOT_LOGGER . failedToLoadViewClass ( e , remoteInterface ) ; } } 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 remoteInterfaceType = processInjectionTargets ( resourceInjectionTarget , injectionSource , classLoader , deploymentReflectionIndex , ejbRef , remoteInterfaceType ) ; final BindingConfiguration bindingConfiguration ; EjbInjectionSource ejbInjectionSource = null ; if ( ! isEmpty ( lookup ) ) { if ( ! lookup . startsWith ( "java:" ) ) { bindingConfiguration = new BindingConfiguration ( name , new EjbLookupInjectionSource ( lookup , remoteInterfaceType ) ) ; } else { bindingConfiguration = new BindingConfiguration ( name , new LookupInjectionSource ( lookup ) ) ; } } else { if ( remoteInterfaceType == null ) { throw EjbLogger . ROOT_LOGGER . couldNotDetermineEjbRefForInjectionTarget ( name , resourceInjectionTarget ) ; } if ( ! isEmpty ( ejbName ) ) { bindingConfiguration = new BindingConfiguration ( name , ejbInjectionSource = new EjbInjectionSource ( ejbName , remoteInterfaceType . getName ( ) , name , deploymentUnit , appclient ) ) ; } else { bindingConfiguration = new BindingConfiguration ( name , ejbInjectionSource = new EjbInjectionSource ( remoteInterfaceType . getName ( ) , name , deploymentUnit , appclient ) ) ; } } if ( ejbInjectionSource != null ) { deploymentUnit . addToAttachmentList ( EjbDeploymentAttachmentKeys . EJB_INJECTIONS , ejbInjectionSource ) ; } bindingDescriptions . add ( bindingConfiguration ) ; } } if ( remoteEnvironment instanceof Environment && ! appclient ) { EJBLocalReferencesMetaData ejbLocalRefs = ( ( Environment ) remoteEnvironment ) . getEjbLocalReferences ( ) ; if ( ejbLocalRefs != null ) { for ( EJBLocalReferenceMetaData ejbRef : ejbLocalRefs ) { String name = ejbRef . getEjbRefName ( ) ; String ejbName = ejbRef . getLink ( ) ; String lookup = ejbRef . getLookupName ( ) != null ? ejbRef . getLookupName ( ) : ejbRef . getMappedName ( ) ; String localInterface = ejbRef . getLocal ( ) ; String localHome = ejbRef . getLocalHome ( ) ; Class < ? > localInterfaceType = null ; //if a home is specified this is the type that is bound if ( ! isEmpty ( localHome ) ) { try { localInterfaceType = ClassLoadingUtils . loadClass ( localHome , deploymentUnit ) ; } catch ( ClassNotFoundException e ) { throw EjbLogger . ROOT_LOGGER . failedToLoadViewClass ( e , localHome ) ; } } else if ( ! isEmpty ( localInterface ) ) { try { localInterfaceType = ClassLoadingUtils . loadClass ( localInterface , deploymentUnit ) ; } catch ( ClassNotFoundException e ) { throw EjbLogger . ROOT_LOGGER . failedToLoadViewClass ( e , localInterface ) ; } } 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 localInterfaceType = processInjectionTargets ( resourceInjectionTarget , injectionSource , classLoader , deploymentReflectionIndex , ejbRef , localInterfaceType ) ; if ( localInterfaceType == null ) { throw EjbLogger . ROOT_LOGGER . couldNotDetermineEjbLocalRefForInjectionTarget ( name , resourceInjectionTarget ) ; } final BindingConfiguration bindingConfiguration ; EjbInjectionSource ejbInjectionSource = null ; if ( ! isEmpty ( lookup ) ) { if ( ! lookup . startsWith ( "java:" ) ) { bindingConfiguration = new BindingConfiguration ( name , new EjbLookupInjectionSource ( lookup , localInterfaceType ) ) ; } else { bindingConfiguration = new BindingConfiguration ( name , new LookupInjectionSource ( lookup ) ) ; } } else if ( ! isEmpty ( ejbName ) ) { bindingConfiguration = new BindingConfiguration ( name , ejbInjectionSource = new EjbInjectionSource ( ejbName , localInterfaceType . getName ( ) , name , deploymentUnit , appclient ) ) ; } else { bindingConfiguration = new BindingConfiguration ( name , ejbInjectionSource = new EjbInjectionSource ( localInterfaceType . getName ( ) , name , deploymentUnit , appclient ) ) ; } if ( ejbInjectionSource != null ) { deploymentUnit . addToAttachmentList ( EjbDeploymentAttachmentKeys . EJB_INJECTIONS , ejbInjectionSource ) ; } bindingDescriptions . add ( bindingConfiguration ) ; } } } return bindingDescriptions ; }


Input: Processes the injection targets of a resource binding [CODESPLIT] protected Class < ? > processInjectionTargets ( final ResourceInjectionTarget resourceInjectionTarget , InjectionSource injectionSource , ClassLoader classLoader , DeploymentReflectionIndex deploymentReflectionIndex , ResourceInjectionMetaData entry , Class < ? > classType ) throws DeploymentUnitProcessingException { if ( entry . getInjectionTargets ( ) != null ) { for ( ResourceInjectionTargetMetaData injectionTarget : entry . getInjectionTargets ( ) ) { final String injectionTargetClassName = injectionTarget . getInjectionTargetClass ( ) ; final String injectionTargetName = injectionTarget . getInjectionTargetName ( ) ; final AccessibleObject fieldOrMethod = getInjectionTarget ( injectionTargetClassName , injectionTargetName , classLoader , deploymentReflectionIndex ) ; final Class < ? > injectionTargetType = fieldOrMethod instanceof Field ? ( ( Field ) fieldOrMethod ) . getType ( ) : ( ( Method ) fieldOrMethod ) . getParameterTypes ( ) [ 0 ] ; final String memberName = fieldOrMethod instanceof Field ? ( ( Field ) fieldOrMethod ) . getName ( ) : ( ( Method ) fieldOrMethod ) . getName ( ) ; if ( classType != null ) { if ( ! injectionTargetType . isAssignableFrom ( classType ) ) { boolean ok = false ; if ( classType . isPrimitive ( ) ) { if ( BOXED_TYPES . get ( classType ) . equals ( injectionTargetType ) ) { ok = true ; } } else if ( injectionTargetType . isPrimitive ( ) ) { if ( BOXED_TYPES . get ( injectionTargetType ) . equals ( classType ) ) { ok = true ; } } if ( ! ok ) { throw EeLogger . ROOT_LOGGER . invalidInjectionTarget ( injectionTarget . getInjectionTargetName ( ) , injectionTarget . getInjectionTargetClass ( ) , classType ) ; } classType = injectionTargetType ; } } else { classType = injectionTargetType ; } final InjectionTarget injectionTargetDescription = fieldOrMethod instanceof Field ? new FieldInjectionTarget ( injectionTargetClassName , memberName , classType . getName ( ) ) : new MethodInjectionTarget ( injectionTargetClassName , memberName , classType . getName ( ) ) ; final ResourceInjectionConfiguration injectionConfiguration = new ResourceInjectionConfiguration ( injectionTargetDescription , injectionSource ) ; resourceInjectionTarget . addResourceInjection ( injectionConfiguration ) ; } } return classType ; }


Input: Stops the container Executed in WeldStartService to shutdown the runtime before NamingService is closed . [CODESPLIT] @ Override public void stop ( final StopContext context ) { final WeldBootstrapService bootstrapService = bootstrapSupplier . get ( ) ; if ( ! bootstrapService . isStarted ( ) ) { throw WeldLogger . ROOT_LOGGER . notStarted ( "WeldContainer" ) ; } WeldLogger . DEPLOYMENT_LOGGER . stoppingWeldService ( bootstrapService . getDeploymentName ( ) ) ; ClassLoader oldTccl = WildFlySecurityManager . getCurrentContextClassLoaderPrivileged ( ) ; try { WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( bootstrapService . getDeployment ( ) . getModule ( ) . getClassLoader ( ) ) ; WeldProvider . containerShutDown ( Container . instance ( bootstrapService . getDeploymentName ( ) ) ) ; bootstrapService . getBootstrap ( ) . shutdown ( ) ; } finally { WildFlySecurityManager . setCurrentContextClassLoaderPrivileged ( oldTccl ) ; ModuleGroupSingletonProvider . removeClassLoader ( bootstrapService . getDeployment ( ) . getModule ( ) . getClassLoader ( ) ) ; } bootstrapService . setStarted ( false ) ; }


Input: Extracts the raw JNDINAME value from the given model node and depending on the value and the value of any USE_JAVA_CONTEXT child node converts the raw name into a compliant jndi name . [CODESPLIT] public static String getJndiName ( final OperationContext context , final ModelNode modelNode ) throws OperationFailedException { final String rawJndiName = JNDI_NAME . resolveModelAttribute ( context , modelNode ) . asString ( ) ; return cleanJndiName ( rawJndiName , modelNode . hasDefined ( USE_JAVA_CONTEXT . getName ( ) ) && modelNode . get ( USE_JAVA_CONTEXT . getName ( ) ) . asBoolean ( ) ) ; }


Input: { [CODESPLIT] @ Override public void performBoottime ( OperationContext context , ModelNode operation , ModelNode model ) { MicroProfileConfigLogger . ROOT_LOGGER . activatingSubsystem ( ) ; ConfigProviderService . install ( context ) ; context . addStep ( new AbstractDeploymentChainStep ( ) { public void execute ( DeploymentProcessorTarget processorTarget ) { processorTarget . addDeploymentProcessor ( MicroProfileConfigExtension . SUBSYSTEM_NAME , Phase . DEPENDENCIES , Phase . DEPENDENCIES_MICROPROFILE_CONFIG , new DependencyProcessor ( ) ) ; processorTarget . addDeploymentProcessor ( MicroProfileConfigExtension . SUBSYSTEM_NAME , Phase . POST_MODULE , Phase . POST_MODULE_MICROPROFILE_CONFIG , new SubsystemDeploymentProcessor ( ) ) ; } } , OperationContext . Stage . RUNTIME ) ; }


Input: Return null if the resolved attribute is not defined [CODESPLIT] private String resolveAttribute ( SimpleAttributeDefinition attr , OperationContext context , ModelNode model ) throws OperationFailedException { final ModelNode node = attr . resolveModelAttribute ( context , model ) ; return node . isDefined ( ) ? node . asString ( ) : null ; }


Input: Finds an ejb - jar . xml ( at WEB - INF of a . war or META - INF of a . jar ) parses the file and creates metadata out of it . The metadata is then attached to the deployment unit . [CODESPLIT] @ Override public void deploy ( DeploymentPhaseContext deploymentPhase ) throws DeploymentUnitProcessingException { // get hold of the deployment unit. final DeploymentUnit deploymentUnit = deploymentPhase . getDeploymentUnit ( ) ; // get the root of the deployment unit final EEModuleDescription eeModuleDescription = deploymentUnit . getAttachment ( org . jboss . as . ee . component . Attachments . EE_MODULE_DESCRIPTION ) ; final EEApplicationClasses applicationClassesDescription = deploymentUnit . getAttachment ( org . jboss . as . ee . component . Attachments . EE_APPLICATION_CLASSES_DESCRIPTION ) ; final EjbJarMetaData ejbJarMetaData ; final EjbJarMetaData specMetaData = parseEjbJarXml ( deploymentUnit ) ; final EjbJarMetaData jbossMetaData = parseJBossEjb3Xml ( deploymentUnit ) ; if ( specMetaData == null ) { if ( jbossMetaData == null ) return ; ejbJarMetaData = jbossMetaData ; } else if ( jbossMetaData == null ) { ejbJarMetaData = specMetaData ; } else { ejbJarMetaData = jbossMetaData . createMerged ( specMetaData ) ; } // Mark it as an EJB deployment EjbDeploymentMarker . mark ( deploymentUnit ) ; if ( ! deploymentUnit . hasAttachment ( EjbDeploymentAttachmentKeys . EJB_JAR_DESCRIPTION ) ) { final EEModuleDescription moduleDescription = deploymentUnit . getAttachment ( org . jboss . as . ee . component . Attachments . EE_MODULE_DESCRIPTION ) ; final EjbJarDescription ejbModuleDescription = new EjbJarDescription ( moduleDescription , deploymentUnit . getName ( ) . endsWith ( ".war" ) ) ; deploymentUnit . putAttachment ( EjbDeploymentAttachmentKeys . EJB_JAR_DESCRIPTION , ejbModuleDescription ) ; } // attach the EjbJarMetaData to the deployment unit deploymentUnit . putAttachment ( EjbDeploymentAttachmentKeys . EJB_JAR_METADATA , ejbJarMetaData ) ; // if the jboss-ejb3.xml has a distinct-name configured then attach it to the deployment unit if ( jbossMetaData != null && jbossMetaData . getDistinctName ( ) != null ) { deploymentUnit . putAttachment ( org . jboss . as . ee . structure . Attachments . DISTINCT_NAME , jbossMetaData . getDistinctName ( ) ) ; } if ( ejbJarMetaData . getModuleName ( ) != null ) { eeModuleDescription . setModuleName ( ejbJarMetaData . getModuleName ( ) ) ; } if ( ejbJarMetaData . isMetadataComplete ( ) ) { MetadataCompleteMarker . setMetadataComplete ( deploymentUnit , true ) ; } if ( ! ejbJarMetaData . isEJB3x ( ) ) { //EJB spec 20.5.1, we do not process annotations for older deployments MetadataCompleteMarker . setMetadataComplete ( deploymentUnit , true ) ; } if ( ejbJarMetaData . getEnterpriseBeans ( ) != null ) { //check for entity beans StringBuilder beans = new StringBuilder ( ) ; boolean error = false ; for ( AbstractEnterpriseBeanMetaData bean : ejbJarMetaData . getEnterpriseBeans ( ) ) { if ( bean . getEjbType ( ) == EjbType . ENTITY ) { if ( ! error ) { error = true ; } else { beans . append ( ", " ) ; } beans . append ( bean . getEjbName ( ) ) ; } } if ( error ) { throw EjbLogger . ROOT_LOGGER . entityBeansAreNotSupported ( beans . toString ( ) ) ; } } }


Input: Creates and returns a { @link XMLStreamReader } for the passed { @link VirtualFile ejb - jar . xml } [CODESPLIT] private static XMLStreamReader getXMLStreamReader ( InputStream stream , VirtualFile ejbJarXml , XMLResolver resolver ) throws DeploymentUnitProcessingException { try { final XMLInputFactory inputFactory = XMLInputFactory . newInstance ( ) ; inputFactory . setXMLResolver ( resolver ) ; XMLStreamReader xmlReader = inputFactory . createXMLStreamReader ( stream ) ; return xmlReader ; } catch ( XMLStreamException xmlse ) { throw EjbLogger . ROOT_LOGGER . failedToParse ( xmlse , "ejb-jar.xml: " + ejbJarXml . getPathName ( ) ) ; } }


Input:
{ [CODESPLIT] @ Override public void createPermissions ( WarMetaData metaData , PolicyConfiguration pc ) throws PolicyContextException { JBossWebMetaData jbossWebMetaData = metaData . getMergedJBossWebMetaData ( ) ; HashMap < String , PatternInfo > patternMap = qualifyURLPatterns ( jbossWebMetaData ) ; List < SecurityConstraintMetaData > secConstraints = jbossWebMetaData . getSecurityConstraints ( ) ; if ( secConstraints != null ) { for ( SecurityConstraintMetaData secConstraint : secConstraints ) { WebResourceCollectionsMetaData resourceCollectionsMetaData = secConstraint . getResourceCollections ( ) ; UserDataConstraintMetaData userDataConstraintMetaData = secConstraint . getUserDataConstraint ( ) ; if ( resourceCollectionsMetaData != null ) { if ( secConstraint . isExcluded ( ) || secConstraint . isUnchecked ( ) ) { // Process the permissions for the excluded/unchecked resources for ( WebResourceCollectionMetaData resourceCollectionMetaData : resourceCollectionsMetaData ) { List < String > httpMethods = new ArrayList <> ( resourceCollectionMetaData . getHttpMethods ( ) ) ; List < String > ommisions = resourceCollectionMetaData . getHttpMethodOmissions ( ) ; if ( httpMethods . isEmpty ( ) && ! ommisions . isEmpty ( ) ) { httpMethods . addAll ( WebResourceCollectionMetaData . ALL_HTTP_METHODS ) ; httpMethods . removeAll ( ommisions ) ; } List < String > urlPatterns = resourceCollectionMetaData . getUrlPatterns ( ) ; for ( String urlPattern : urlPatterns ) { PatternInfo info = patternMap . get ( urlPattern ) ; info . descriptor = true ; // Add the excluded methods if ( secConstraint . isExcluded ( ) ) { info . addExcludedMethods ( httpMethods ) ; } // SECURITY-63: Missing auth-constraint needs unchecked policy if ( secConstraint . isUnchecked ( ) && httpMethods . isEmpty ( ) ) { info . isMissingAuthConstraint = true ; } else { info . missingAuthConstraintMethods . addAll ( httpMethods ) ; } } } } else { // Process the permission for the resources x roles for ( WebResourceCollectionMetaData resourceCollectionMetaData : resourceCollectionsMetaData ) { List < String > httpMethods = new ArrayList <> ( resourceCollectionMetaData . getHttpMethods ( ) ) ; List < String > methodOmissions = resourceCollectionMetaData . getHttpMethodOmissions ( ) ; if ( httpMethods . isEmpty ( ) && ! methodOmissions . isEmpty ( ) ) { httpMethods . addAll ( WebResourceCollectionMetaData . ALL_HTTP_METHODS ) ; httpMethods . removeAll ( methodOmissions ) ; } List < String > urlPatterns = resourceCollectionMetaData . getUrlPatterns ( ) ; for ( String urlPattern : urlPatterns ) { // Get the qualified url pattern PatternInfo info = patternMap . get ( urlPattern ) ; info . descriptor = true ; HashSet < String > mappedRoles = new HashSet < String > ( ) ; secConstraint . getAuthConstraint ( ) . getRoleNames ( ) ; List < String > authRoles = secConstraint . getAuthConstraint ( ) . getRoleNames ( ) ; for ( String role : authRoles ) { if ( "*" . equals ( role ) ) { // The wildcard ref maps to all declared security-role names mappedRoles . addAll ( jbossWebMetaData . getSecurityRoleNames ( ) ) ; } else { mappedRoles . add ( role ) ; } } info . addRoles ( mappedRoles , httpMethods ) ; // Add the transport to methods if ( userDataConstraintMetaData != null && userDataConstraintMetaData . getTransportGuarantee ( ) != null ) info . addTransport ( userDataConstraintMetaData . getTransportGuarantee ( ) . name ( ) , httpMethods ) ; } } } } } } JBossServletsMetaData servlets = jbossWebMetaData . getServlets ( ) ; List < ServletMappingMetaData > mappings = jbossWebMetaData . getServletMappings ( ) ; if ( servlets != null && mappings != null ) { Map < String , List < String > > servletMappingMap = new HashMap <> ( ) ; for ( ServletMappingMetaData mapping : mappings ) { List < String > list = servletMappingMap . get ( mapping . getServletName ( ) ) ; if ( list == null ) { servletMappingMap . put ( mapping . getServletName ( ) , list = new ArrayList <> ( ) ) ; } list . addAll ( mapping . getUrlPatterns ( ) ) ; } if ( ! jbossWebMetaData . isMetadataComplete ( ) ) { for ( JBossServletMetaData servlet : servlets ) { ServletSecurityMetaData security = servlet . getServletSecurity ( ) ; if ( security != null ) { List < String > servletMappings = servletMappingMap . get ( servlet . getServletName ( ) ) ; if ( servletMappings != null ) { if ( security . getHttpMethodConstraints ( ) != null ) { for ( HttpMethodConstraintMetaData s : security . getHttpMethodConstraints ( ) ) { if ( s . getRolesAllowed ( ) == null || s . getRolesAllowed ( ) . isEmpty ( ) ) { for ( String urlPattern : servletMappings ) { // Get the qualified url pattern PatternInfo info = patternMap . get ( urlPattern ) ; if ( info . descriptor ) { continue ; } // Add the excluded methods if ( s . getEmptyRoleSemantic ( ) == null || s . getEmptyRoleSemantic ( ) == EmptyRoleSemanticType . PERMIT ) { info . missingAuthConstraintMethods . add ( s . getMethod ( ) ) ; } else { info . addExcludedMethods ( Collections . singletonList ( s . getMethod ( ) ) ) ; } // Add the transport to methods if ( s . getTransportGuarantee ( ) != null ) info . addTransport ( s . getTransportGuarantee ( ) . name ( ) , Collections . singletonList ( s . getMethod ( ) ) ) ; } } else { for ( String urlPattern : servletMappings ) { // Get the qualified url pattern PatternInfo info = patternMap . get ( urlPattern ) ; if ( info . descriptor ) { continue ; } HashSet < String > mappedRoles = new HashSet < String > ( ) ; List < String > authRoles = s . getRolesAllowed ( ) ; for ( String role : authRoles ) { if ( "*" . equals ( role ) ) { // The wildcard ref maps to all declared security-role names mappedRoles . addAll ( jbossWebMetaData . getSecurityRoleNames ( ) ) ; } else { mappedRoles . add ( role ) ; } } info . addRoles ( mappedRoles , Collections . singletonList ( s . getMethod ( ) ) ) ; // Add the transport to methods if ( s . getTransportGuarantee ( ) != null ) info . addTransport ( s . getTransportGuarantee ( ) . name ( ) , Collections . singletonList ( s . getMethod ( ) ) ) ; } } } } if ( security . getRolesAllowed ( ) == null || security . getRolesAllowed ( ) . isEmpty ( ) ) { for ( String urlPattern : servletMappings ) { // Get the qualified url pattern PatternInfo info = patternMap . get ( urlPattern ) ; if ( info . descriptor ) { continue ; } // Add the excluded methods if ( security . getEmptyRoleSemantic ( ) == null || security . getEmptyRoleSemantic ( ) == EmptyRoleSemanticType . PERMIT ) { info . isMissingAuthConstraint = true ; } else { Set < String > methods = new HashSet <> ( WebResourceCollectionMetaData . ALL_HTTP_METHODS ) ; if ( security . getHttpMethodConstraints ( ) != null ) { for ( HttpMethodConstraintMetaData method : security . getHttpMethodConstraints ( ) ) { methods . remove ( method . getMethod ( ) ) ; } } info . addExcludedMethods ( new ArrayList <> ( methods ) ) ; } // Add the transport to methods if ( security . getTransportGuarantee ( ) != null ) info . addTransport ( security . getTransportGuarantee ( ) . name ( ) , Collections . emptyList ( ) ) ; } } else { for ( String urlPattern : servletMappings ) { // Get the qualified url pattern PatternInfo info = patternMap . get ( urlPattern ) ; if ( info . descriptor ) { continue ; } HashSet < String > mappedRoles = new HashSet < String > ( ) ; List < String > authRoles = security . getRolesAllowed ( ) ; for ( String role : authRoles ) { if ( "*" . equals ( role ) ) { // The wildcard ref maps to all declared security-role names mappedRoles . addAll ( jbossWebMetaData . getSecurityRoleNames ( ) ) ; } else { mappedRoles . add ( role ) ; } } info . addRoles ( mappedRoles , Collections . emptyList ( ) ) ; // Add the transport to methods if ( security . getTransportGuarantee ( ) != null ) info . addTransport ( security . getTransportGuarantee ( ) . name ( ) , Collections . emptyList ( ) ) ; } } } } } } } // Create the permissions for ( PatternInfo info : patternMap . values ( ) ) { String qurl = info . getQualifiedPattern ( ) ; if ( info . isOverridden ) { continue ; } // Create the excluded permissions String [ ] httpMethods = info . getExcludedMethods ( ) ; if ( httpMethods != null ) { // There were excluded security-constraints WebResourcePermission wrp = new WebResourcePermission ( qurl , httpMethods ) ; WebUserDataPermission wudp = new WebUserDataPermission ( qurl , httpMethods , null ) ; pc . addToExcludedPolicy ( wrp ) ; pc . addToExcludedPolicy ( wudp ) ; } // Create the role permissions Iterator < Map . Entry < String , Set < String > > > roles = info . getRoleMethods ( ) ; Set < String > seenMethods = new HashSet <> ( ) ; while ( roles . hasNext ( ) ) { Map . Entry < String , Set < String > > roleMethods = roles . next ( ) ; String role = roleMethods . getKey ( ) ; Set < String > methods = roleMethods . getValue ( ) ; seenMethods . addAll ( methods ) ; httpMethods = methods . toArray ( new String [ methods . size ( ) ] ) ; pc . addToRole ( role , new WebResourcePermission ( qurl , httpMethods ) ) ; } //there are totally 7 http methods from the jacc spec (See WebResourceCollectionMetaData.ALL_HTTP_METHOD_NAMES) final int NUMBER_OF_HTTP_METHODS = 7 ; // JACC 1.1: create !(httpmethods) in unchecked perms if ( jbossWebMetaData . getDenyUncoveredHttpMethods ( ) == null ) { if ( seenMethods . size ( ) != NUMBER_OF_HTTP_METHODS ) { WebResourcePermission wrpUnchecked = new WebResourcePermission ( qurl , "!" + getCommaSeparatedString ( seenMethods . toArray ( new String [ seenMethods . size ( ) ] ) ) ) ; pc . addToUncheckedPolicy ( wrpUnchecked ) ; } } if ( jbossWebMetaData . getDenyUncoveredHttpMethods ( ) == null ) { // Create the unchecked permissions String [ ] missingHttpMethods = info . getMissingMethods ( ) ; int length = missingHttpMethods . length ; roles = info . getRoleMethods ( ) ; if ( length > 0 && ! roles . hasNext ( ) ) { // Create the unchecked permissions WebResourcePermissions WebResourcePermission wrp = new WebResourcePermission ( qurl , missingHttpMethods ) ; pc . addToUncheckedPolicy ( wrp ) ; } else if ( ! roles . hasNext ( ) ) { pc . addToUncheckedPolicy ( new WebResourcePermission ( qurl , ( String ) null ) ) ; } // SECURITY-63: Missing auth-constraint needs unchecked policy if ( info . isMissingAuthConstraint ) { pc . addToUncheckedPolicy ( new WebResourcePermission ( qurl , ( String ) null ) ) ; } else if ( ! info . allMethods . containsAll ( WebResourceCollectionMetaData . ALL_HTTP_METHODS ) ) { List < String > methods = new ArrayList <> ( WebResourceCollectionMetaData . ALL_HTTP_METHODS ) ; methods . removeAll ( info . allMethods ) ; pc . addToUncheckedPolicy ( new WebResourcePermission ( qurl , methods . toArray ( new String [ methods . size ( ) ] ) ) ) ; } if ( ! info . missingAuthConstraintMethods . isEmpty ( ) ) { pc . addToUncheckedPolicy ( new WebResourcePermission ( qurl , info . missingAuthConstraintMethods . toArray ( new String [ info . missingAuthConstraintMethods . size ( ) ] ) ) ) ; } } // Create the unchecked permissions WebUserDataPermissions Iterator < Map . Entry < String , Set < String > > > transportConstraints = info . getTransportMethods ( ) ; while ( transportConstraints . hasNext ( ) ) { Map . Entry < String , Set < String > > transportMethods = transportConstraints . next ( ) ; String transport = transportMethods . getKey ( ) ; Set < String > methods = transportMethods . getValue ( ) ; httpMethods = new String [ methods . size ( ) ] ; methods . toArray ( httpMethods ) ; WebUserDataPermission wudp = new WebUserDataPermission ( qurl , httpMethods , transport ) ; pc . addToUncheckedPolicy ( wudp ) ; // If the transport is "NONE", then add an exclusive WebUserDataPermission // with the url pattern and null if ( "NONE" . equals ( transport ) ) { WebUserDataPermission wudp1 = new WebUserDataPermission ( qurl , null ) ; pc . addToUncheckedPolicy ( wudp1 ) ; } else { // JACC 1.1: Transport is CONFIDENTIAL/INTEGRAL, add a !(http methods) WebUserDataPermission wudpNonNull = new WebUserDataPermission ( qurl , "!" + getCommaSeparatedString ( httpMethods ) ) ; pc . addToUncheckedPolicy ( wudpNonNull ) ; } } } Set < String > declaredRoles = jbossWebMetaData . getSecurityRoleNames ( ) ; declaredRoles . add ( ANY_AUTHENTICATED_USER_ROLE ) ; /*
         * Create WebRoleRefPermissions for all servlet/security-role-refs along with all the cross product of servlets and
         * security-role elements that are not referenced via a security-role-ref as described in JACC section 3.1.3.2
         */ JBossServletsMetaData servletsMetaData = jbossWebMetaData . getServlets ( ) ; for ( JBossServletMetaData servletMetaData : servletsMetaData ) { Set < String > unrefRoles = new HashSet < String > ( declaredRoles ) ; String servletName = servletMetaData . getName ( ) ; SecurityRoleRefsMetaData roleRefsMetaData = servletMetaData . getSecurityRoleRefs ( ) ; // Perform the unreferenced roles processing for every servlet name if ( roleRefsMetaData != null ) { for ( SecurityRoleRefMetaData roleRefMetaData : roleRefsMetaData ) { String roleRef = roleRefMetaData . getRoleLink ( ) ; String roleName = roleRefMetaData . getRoleName ( ) ; WebRoleRefPermission wrrp = new WebRoleRefPermission ( servletName , roleName ) ; pc . addToRole ( roleRef , wrrp ) ; // Remove the role from the unreferencedRoles unrefRoles . remove ( roleName ) ; } } // Spec 3.1.3.2: For each servlet element in the deployment descriptor // a WebRoleRefPermission must be added to each security-role of the // application whose name does not appear as the rolename // in a security-role-ref within the servlet element. for ( String unrefRole : unrefRoles ) { WebRoleRefPermission unrefP = new WebRoleRefPermission ( servletName , unrefRole ) ; pc . addToRole ( unrefRole , unrefP ) ; } } // JACC 1.1:Spec 3.1.3.2: For each security-role defined in the deployment descriptor, an // additional WebRoleRefPermission must be added to the corresponding role by // calling the addToRole method on the PolicyConfiguration object. The // name of all such permissions must be the empty string, and the actions of each // such permission must be the role-name of the corresponding role. for ( String role : declaredRoles ) { WebRoleRefPermission wrrep = new WebRoleRefPermission ( "" , role ) ; pc . addToRole ( role , wrrep ) ; } }


Input: Determine the url - pattern type [CODESPLIT] static int getPatternType ( String urlPattern ) { int type = EXACT ; if ( urlPattern . startsWith ( "*." ) ) type = EXTENSION ; else if ( urlPattern . startsWith ( "/" ) && urlPattern . endsWith ( "/*" ) ) type = PREFIX ; else if ( urlPattern . equals ( "/" ) ) type = DEFAULT ; return type ; }


Input: JACC url pattern Qualified URL Pattern Names . [CODESPLIT] static HashMap < String , PatternInfo > qualifyURLPatterns ( JBossWebMetaData metaData ) { ArrayList < PatternInfo > prefixList = new ArrayList < PatternInfo > ( ) ; ArrayList < PatternInfo > extensionList = new ArrayList < PatternInfo > ( ) ; ArrayList < PatternInfo > exactList = new ArrayList < PatternInfo > ( ) ; HashMap < String , PatternInfo > patternMap = new HashMap < String , PatternInfo > ( ) ; PatternInfo defaultInfo = null ; List < SecurityConstraintMetaData > constraints = metaData . getSecurityConstraints ( ) ; if ( constraints != null ) { for ( SecurityConstraintMetaData constraint : constraints ) { WebResourceCollectionsMetaData resourceCollectionsMetaData = constraint . getResourceCollections ( ) ; if ( resourceCollectionsMetaData != null ) { for ( WebResourceCollectionMetaData resourceCollectionMetaData : resourceCollectionsMetaData ) { List < String > urlPatterns = resourceCollectionMetaData . getUrlPatterns ( ) ; for ( String url : urlPatterns ) { int type = getPatternType ( url ) ; PatternInfo info = patternMap . get ( url ) ; if ( info == null ) { info = new PatternInfo ( url , type ) ; patternMap . put ( url , info ) ; switch ( type ) { case PREFIX : prefixList . add ( info ) ; break ; case EXTENSION : extensionList . add ( info ) ; break ; case EXACT : exactList . add ( info ) ; break ; case DEFAULT : defaultInfo = info ; break ; } } } } } } } JBossServletsMetaData servlets = metaData . getServlets ( ) ; List < ServletMappingMetaData > mappings = metaData . getServletMappings ( ) ; if ( ! metaData . isMetadataComplete ( ) && servlets != null && mappings != null ) { Map < String , List < String > > servletMappingMap = new HashMap <> ( ) ; for ( ServletMappingMetaData mapping : mappings ) { List < String > list = servletMappingMap . get ( mapping . getServletName ( ) ) ; if ( list == null ) { servletMappingMap . put ( mapping . getServletName ( ) , list = new ArrayList <> ( ) ) ; } list . addAll ( mapping . getUrlPatterns ( ) ) ; } for ( JBossServletMetaData servlet : servlets ) { ServletSecurityMetaData security = servlet . getServletSecurity ( ) ; if ( security != null ) { List < String > servletMappings = servletMappingMap . get ( servlet . getServletName ( ) ) ; if ( servletMappings != null ) { for ( String url : servletMappings ) { int type = getPatternType ( url ) ; PatternInfo info = patternMap . get ( url ) ; if ( info == null ) { info = new PatternInfo ( url , type ) ; patternMap . put ( url , info ) ; switch ( type ) { case PREFIX : prefixList . add ( info ) ; break ; case EXTENSION : extensionList . add ( info ) ; break ; case EXACT : exactList . add ( info ) ; break ; case DEFAULT : defaultInfo = info ; break ; } } } } } } } // Qualify all prefix patterns for ( int i = 0 ; i < prefixList . size ( ) ; i ++ ) { PatternInfo info = prefixList . get ( i ) ; // Qualify by every other prefix pattern matching this pattern for ( int j = 0 ; j < prefixList . size ( ) ; j ++ ) { if ( i == j ) continue ; PatternInfo other = prefixList . get ( j ) ; if ( info . matches ( other ) ) info . addQualifier ( other ) ; } // Qualify by every exact pattern that is matched by this pattern for ( PatternInfo other : exactList ) { if ( info . matches ( other ) ) info . addQualifier ( other ) ; } } // Qualify all extension patterns for ( PatternInfo info : extensionList ) { // Qualify by every path prefix pattern for ( PatternInfo other : prefixList ) { // Any extension info . addQualifier ( other ) ; } // Qualify by every matching exact pattern for ( PatternInfo other : exactList ) { if ( info . isExtensionFor ( other ) ) info . addQualifier ( other ) ; } } // Qualify the default pattern if ( defaultInfo == null ) { defaultInfo = new PatternInfo ( "/" , DEFAULT ) ; patternMap . put ( "/" , defaultInfo ) ; } for ( PatternInfo info : patternMap . values ( ) ) { if ( info == defaultInfo ) continue ; defaultInfo . addQualifier ( info ) ; } return patternMap ; }


Input: Associate the extended persistence context with the current JTA transaction ( if one is found ) [CODESPLIT] public void internalAssociateWithJtaTx ( ) { isInTx = TransactionUtil . isInTx ( transactionManager ) ; // ensure that a different XPC (with same name) is not already present in the TX if ( isInTx ) { // 7.6.3.1 throw EJBException if a different persistence context is already joined to the // transaction (with the same puScopedName). EntityManager existing = TransactionUtil . getTransactionScopedEntityManager ( puScopedName , transactionSynchronizationRegistry ) ; if ( existing != null && existing != this ) { // should be enough to test if not the same object throw JpaLogger . ROOT_LOGGER . cannotUseExtendedPersistenceTransaction ( puScopedName , existing , this ) ; } else if ( existing == null ) { if ( SynchronizationType . SYNCHRONIZED . equals ( synchronizationType ) ) { // JPA 7.9.1 join the transaction if not already done for SynchronizationType.SYNCHRONIZED. underlyingEntityManager . joinTransaction ( ) ; } // associate the entity manager with the current transaction TransactionUtil . putEntityManagerInTransactionRegistry ( puScopedName , this , transactionSynchronizationRegistry ) ; } } }


Input: Return whether the definition targets an existing pooled connection factory or use a JCA - based ConnectionFactory . [CODESPLIT] static boolean targetsPooledConnectionFactory ( String server , String resourceAdapter , ServiceRegistry serviceRegistry ) { // if the resourceAdapter is not defined, the default behaviour is to create a pooled-connection-factory. if ( resourceAdapter == null || resourceAdapter . isEmpty ( ) ) { return true ; } ServiceName activeMQServiceName = MessagingServices . getActiveMQServiceName ( server ) ; ServiceName pcfName = JMSServices . getPooledConnectionFactoryBaseServiceName ( activeMQServiceName ) . append ( resourceAdapter ) ; return serviceRegistry . getServiceNames ( ) . contains ( pcfName ) ; }


Input: Return whether the definition targets an existing external pooled connection factory . [CODESPLIT] static boolean targetsExternalPooledConnectionFactory ( String resourceAdapter , ServiceRegistry serviceRegistry ) { // if the resourceAdapter is not defined, the default behaviour is to create a pooled-connection-factory. if ( resourceAdapter == null || resourceAdapter . isEmpty ( ) ) { return false ; } //let's look into the external-pooled-connection-factory ServiceName pcfName = JMSServices . getPooledConnectionFactoryBaseServiceName ( MessagingServices . getActiveMQServiceName ( "" ) ) . append ( resourceAdapter ) ; return serviceRegistry . getServiceNames ( ) . contains ( pcfName ) ; }


Input: The JMS connection factory can specify another server to deploy its destinations by passing a property server = &lt ; name of the server > . Otherwise default is used by default . [CODESPLIT] static String getActiveMQServerName ( Map < String , String > properties ) { return properties . getOrDefault ( SERVER , DEFAULT ) ; }


Input: / * When finding the default persistence unit the first persistence unit encountered is returned . [CODESPLIT] private static PersistenceUnitMetadata findWithinDeployment ( DeploymentUnit unit , String persistenceUnitName ) { if ( traceEnabled ) { ROOT_LOGGER . tracef ( "pu findWithinDeployment searching for %s" , persistenceUnitName ) ; } for ( ResourceRoot root : DeploymentUtils . allResourceRoots ( unit ) ) { PersistenceUnitMetadataHolder holder = root . getAttachment ( PersistenceUnitMetadataHolder . PERSISTENCE_UNITS ) ; if ( holder == null || holder . getPersistenceUnits ( ) == null ) { if ( traceEnabled ) { ROOT_LOGGER . tracef ( "pu findWithinDeployment skipping empty pu holder for %s" , persistenceUnitName ) ; } continue ; } ambiguousPUError ( unit , persistenceUnitName , holder ) ; persistenceUnitName = defaultPersistenceUnitName ( persistenceUnitName , holder ) ; for ( PersistenceUnitMetadata persistenceUnit : holder . getPersistenceUnits ( ) ) { if ( traceEnabled ) { ROOT_LOGGER . tracef ( "findWithinDeployment check '%s' against pu '%s'" , persistenceUnitName , persistenceUnit . getPersistenceUnitName ( ) ) ; } if ( persistenceUnitName == null || persistenceUnitName . length ( ) == 0 || persistenceUnit . getPersistenceUnitName ( ) . equals ( persistenceUnitName ) ) { if ( traceEnabled ) { ROOT_LOGGER . tracef ( "findWithinDeployment matched '%s' against pu '%s'" , persistenceUnitName , persistenceUnit . getPersistenceUnitName ( ) ) ; } return persistenceUnit ; } } } return null ; }


Input: if no persistence unit name is specified return name of default persistence unit [CODESPLIT] private static String defaultPersistenceUnitName ( String persistenceUnitName , PersistenceUnitMetadataHolder holder ) { if ( ( persistenceUnitName == null || persistenceUnitName . length ( ) == 0 ) ) { for ( PersistenceUnitMetadata persistenceUnit : holder . getPersistenceUnits ( ) ) { String defaultPU = persistenceUnit . getProperties ( ) . getProperty ( Configuration . JPA_DEFAULT_PERSISTENCE_UNIT ) ; if ( Boolean . TRUE . toString ( ) . equals ( defaultPU ) ) { persistenceUnitName = persistenceUnit . getPersistenceUnitName ( ) ; } } } return persistenceUnitName ; }