Input: Process a deployment for a Connector . Will install a { @Code JBossService } for this ResourceAdapter . [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ConnectorXmlDescriptor connectorXmlDescriptor = deploymentUnit . getAttachment ( ConnectorXmlDescriptor . ATTACHMENT_KEY ) ; final ManagementResourceRegistration registration ; final ManagementResourceRegistration baseRegistration = deploymentUnit . getAttachment ( DeploymentModelUtils . MUTABLE_REGISTRATION_ATTACHMENT ) ; final Resource deploymentResource = deploymentUnit . getAttachment ( DeploymentModelUtils . DEPLOYMENT_RESOURCE ) ; final CapabilityServiceSupport support = deploymentUnit . getAttachment ( Attachments . CAPABILITY_SERVICE_SUPPORT ) ; if ( connectorXmlDescriptor == null ) { return ; } final ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; if ( deploymentUnit . getParent ( ) != null ) { registration = baseRegistration . getSubModel ( PathAddress . pathAddress ( PathElement . pathElement ( "subdeployment" ) ) ) ; } else { registration = baseRegistration ; } final IronJacamarXmlDescriptor ironJacamarXmlDescriptor = deploymentUnit . getAttachment ( IronJacamarXmlDescriptor . ATTACHMENT_KEY ) ; final Module module = deploymentUnit . getAttachment ( Attachments . MODULE ) ; DEPLOYMENT_CONNECTOR_LOGGER . debugf ( "ParsedRaDeploymentProcessor: Processing=%s" , deploymentUnit ) ; final ClassLoader classLoader = module . getClassLoader ( ) ; Map < ResourceRoot , Index > annotationIndexes = AnnotationIndexUtils . getAnnotationIndexes ( deploymentUnit ) ; ServiceBuilder builder = process ( connectorXmlDescriptor , ironJacamarXmlDescriptor , classLoader , serviceTarget , annotationIndexes , deploymentUnit . getServiceName ( ) , registration , deploymentResource , support ) ; if ( builder != null ) { String bootstrapCtx = null ; if ( ironJacamarXmlDescriptor != null && ironJacamarXmlDescriptor . getIronJacamar ( ) != null && ironJacamarXmlDescriptor . getIronJacamar ( ) . getBootstrapContext ( ) != null ) bootstrapCtx = ironJacamarXmlDescriptor . getIronJacamar ( ) . getBootstrapContext ( ) ; if ( bootstrapCtx == null ) bootstrapCtx = "default" ; builder . requires ( ConnectorServices . BOOTSTRAP_CONTEXT_SERVICE . append ( bootstrapCtx ) ) ; //Register an empty override model regardless of we're enabled or not - the statistics listener will add the relevant childresources if ( registration . isAllowsOverride ( ) && registration . getOverrideModel ( deploymentUnit . getName ( ) ) == null ) { registration . registerOverrideModel ( deploymentUnit . getName ( ) , new OverrideDescriptionProvider ( ) { @ Override public Map < String , ModelNode > getAttributeOverrideDescriptions ( Locale locale ) { return Collections . emptyMap ( ) ; } @ Override public Map < String , ModelNode > getChildTypeOverrideDescriptions ( Locale locale ) { return Collections . emptyMap ( ) ; } } ) ; } builder . setInitialMode ( Mode . ACTIVE ) . install ( ) ; } }


Input: A simple implementation of the { @link org . jboss . weld . resources . spi . AnnotationDiscovery#containsAnnotation ( Class Class ) } contract . This implementation uses reflection . [CODESPLIT] public static boolean containsAnnotation ( Class < ? > javaClass , Class < ? extends Annotation > requiredAnnotation ) { for ( Class < ? > clazz = javaClass ; clazz != null && clazz != Object . class ; clazz = clazz . getSuperclass ( ) ) { // class level annotations if ( clazz == javaClass || requiredAnnotation . isAnnotationPresent ( Inherited . class ) ) { if ( containsAnnotations ( clazz . getAnnotations ( ) , requiredAnnotation ) ) { return true ; } } // fields for ( Field field : clazz . getDeclaredFields ( ) ) { if ( containsAnnotations ( field . getAnnotations ( ) , requiredAnnotation ) ) { return true ; } } // constructors for ( Constructor < ? > constructor : clazz . getConstructors ( ) ) { if ( containsAnnotations ( constructor . getAnnotations ( ) , requiredAnnotation ) ) { return true ; } for ( Annotation [ ] parameterAnnotations : constructor . getParameterAnnotations ( ) ) { if ( containsAnnotations ( parameterAnnotations , requiredAnnotation ) ) { return true ; } } } // methods for ( Method method : clazz . getDeclaredMethods ( ) ) { if ( containsAnnotations ( method . getAnnotations ( ) , requiredAnnotation ) ) { return true ; } for ( Annotation [ ] parameterAnnotations : method . getParameterAnnotations ( ) ) { if ( containsAnnotations ( parameterAnnotations , requiredAnnotation ) ) { return true ; } } } } return false ; }


Input: Starts the service . Registers server activity sets transaction listener on local transaction context and creates and installs deployment controller service . [CODESPLIT] public void start ( StartContext context ) { final SuspendController suspendController = suspendControllerInjectedValue . getValue ( ) ; suspendController . registerActivity ( this ) ; final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue . getValue ( ) ; localTransactionContext . registerCreationListener ( this ) ; }


Input: Stops the service . Unregisters service activity and clears transaction listener . [CODESPLIT] public void stop ( StopContext context ) { final SuspendController suspendController = suspendControllerInjectedValue . getValue ( ) ; suspendController . unRegisterActivity ( this ) ; final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue . getValue ( ) ; localTransactionContext . removeCreationListener ( this ) ; }


Input: Notifies local transaction context that server is suspended and only completes suspension if there are no active invocations nor transactions . [CODESPLIT] @ Override public void suspended ( ServerActivityCallback listener ) { this . suspended = true ; listenerUpdater . set ( this , listener ) ; localTransactionContextInjectedValue . getValue ( ) . suspendRequests ( ) ; final int activeInvocationCount = activeInvocationCountUpdater . get ( this ) ; if ( activeInvocationCount == 0 ) { if ( gracefulTxnShutdown ) { if ( activeTransactionCountUpdater . get ( this ) == 0 ) { this . doneSuspended ( ) ; } else { EjbLogger . ROOT_LOGGER . suspensionWaitingActiveTransactions ( activeInvocationCount ) ; } } else { this . doneSuspended ( ) ; } } }


Input: Notifies local transaction context that server is resumed and restarts deployment controller . [CODESPLIT] @ Override public void resume ( ) { this . suspended = false ; localTransactionContextInjectedValue . getValue ( ) . resumeRequests ( ) ; ServerActivityCallback listener = listenerUpdater . get ( this ) ; if ( listener != null ) { listenerUpdater . compareAndSet ( this , listener , null ) ; } deploymentRepositoryInjectedValue . getValue ( ) . resume ( ) ; }


Input: Indicates if a invocation should be accepted : which will happen only if server is not suspended or if the invocation involves a still active transaction . [CODESPLIT] public boolean acceptInvocation ( InterceptorContext context ) throws SystemException { if ( suspended ) { if ( ! gracefulTxnShutdown ) return false ; // a null listener means that we are done suspending; if ( listenerUpdater . get ( this ) == null || activeTransactionCountUpdater . get ( this ) == 0 ) return false ; // retrieve attachment only when we are not entirely suspended, meaning we are mid-suspension if ( ! context . hasTransaction ( ) ) { // all requests with no transaction must be rejected at this point // we need also to block requests with new transactions, which is not being done here. Instead, // we are relying on a future call to getTransaction in the same thread, before the invocation is executed; // this call will throw an exception if the transaction is new, because this suspend handler // has invoked clientTransactionContext.suspendRequests return false ; } } activeInvocationCountUpdater . incrementAndGet ( this ) ; return true ; }


Input: Notifies handler that an active invocation is complete . [CODESPLIT] public void invocationComplete ( ) { int activeInvocations = activeInvocationCountUpdater . decrementAndGet ( this ) ; if ( suspended && activeInvocations == 0 && ( ! gracefulTxnShutdown || ( activeTransactionCountUpdater . get ( this ) == 0 ) ) ) { doneSuspended ( ) ; } }


Input: Notifies handler that a new transaction has been created . [CODESPLIT] @ Override public void transactionCreated ( AbstractTransaction transaction , CreatedBy createdBy ) { activeTransactionCountUpdater . incrementAndGet ( this ) ; try { transaction . registerSynchronization ( this ) ; } catch ( RollbackException | IllegalStateException e ) { // it means the transaction is marked for rollback, or is prepared for commit, at this point we cannot register synchronization decrementTransactionCount ( ) ; } catch ( SystemException e ) { decrementTransactionCount ( ) ; EjbLogger . ROOT_LOGGER . debug ( "Unexpected exception" , e ) ; throw new RuntimeException ( e ) ; } }


Input: Completes suspension : stop deployment controller . [CODESPLIT] private void doneSuspended ( ) { final ServerActivityCallback oldListener = listener ; if ( oldListener != null && listenerUpdater . compareAndSet ( this , oldListener , null ) ) { deploymentRepositoryInjectedValue . getValue ( ) . suspend ( ) ; oldListener . done ( ) ; EjbLogger . ROOT_LOGGER . suspensionComplete ( ) ; } }


Input: Releases the service returns <code > true< / code > if the service is removed as a result or false otherwise [CODESPLIT] public boolean release ( ) { if ( refcnt != null && refcnt . decrementAndGet ( ) <= 0 && controller != null ) { controller . setMode ( ServiceController . Mode . REMOVE ) ; return true ; } return false ; }


Input: Bind the entry into the injected context . [CODESPLIT] public void start ( StartContext context ) throws StartException { final ServiceBasedNamingStore namingStore = namingStoreValue . getValue ( ) ; controller = context . getController ( ) ; namingStore . add ( controller . getName ( ) ) ; ROOT_LOGGER . tracef ( "Bound resource %s into naming store %s (service name %s)" , name , namingStore , controller . getName ( ) ) ; }


Input: Unbind the entry from the injected context . [CODESPLIT] public void stop ( StopContext context ) { final ServiceBasedNamingStore namingStore = namingStoreValue . getValue ( ) ; namingStore . remove ( controller . getName ( ) ) ; ROOT_LOGGER . tracef ( "Unbound resource %s into naming store %s (service name %s)" , name , namingStore , context . getController ( ) . getName ( ) ) ; }


Input: Determines a ServiceName from a capability name . Only supported for use by services installed by this subsystem ; will not function reliably until the subsystem has begun adding runtime services . [CODESPLIT] public static ServiceName getCapabilityServiceName ( String capabilityBaseName , String ... dynamicParts ) { if ( capabilityServiceSupport == null ) { throw new IllegalStateException ( ) ; } if ( dynamicParts == null || dynamicParts . length == 0 ) { return capabilityServiceSupport . getCapabilityServiceName ( capabilityBaseName ) ; } return capabilityServiceSupport . getCapabilityServiceName ( capabilityBaseName , dynamicParts ) ; }


Input: Create the resource roots for a . war deployment [CODESPLIT] private List < ResourceRoot > createResourceRoots ( final VirtualFile deploymentRoot , final DeploymentUnit deploymentUnit ) throws IOException , DeploymentUnitProcessingException { final List < ResourceRoot > entries = new ArrayList < ResourceRoot > ( ) ; // WEB-INF classes final VirtualFile webinfClasses = deploymentRoot . getChild ( WEB_INF_CLASSES ) ; if ( webinfClasses . exists ( ) ) { final ResourceRoot webInfClassesRoot = new ResourceRoot ( webinfClasses . getName ( ) , webinfClasses , null ) ; ModuleRootMarker . mark ( webInfClassesRoot ) ; entries . add ( webInfClassesRoot ) ; } // WEB-INF lib Map < String , MountedDeploymentOverlay > overlays = deploymentUnit . getAttachment ( Attachments . DEPLOYMENT_OVERLAY_LOCATIONS ) ; final VirtualFile webinfLib = deploymentRoot . getChild ( WEB_INF_LIB ) ; if ( webinfLib . exists ( ) ) { final List < VirtualFile > archives = webinfLib . getChildren ( DEFAULT_WEB_INF_LIB_FILTER ) ; for ( final VirtualFile archive : archives ) { try { String relativeName = archive . getPathNameRelativeTo ( deploymentRoot ) ; MountedDeploymentOverlay overlay = overlays . get ( relativeName ) ; Closeable closable = null ; if ( overlay != null ) { overlay . remountAsZip ( false ) ; } else if ( archive . isFile ( ) ) { closable = VFS . mountZip ( archive , archive , TempFileProviderService . provider ( ) ) ; } else { closable = null ; } final ResourceRoot webInfArchiveRoot = new ResourceRoot ( archive . getName ( ) , archive , new MountHandle ( closable ) ) ; ModuleRootMarker . mark ( webInfArchiveRoot ) ; entries . add ( webInfArchiveRoot ) ; } catch ( IOException e ) { throw new DeploymentUnitProcessingException ( UndertowLogger . ROOT_LOGGER . failToProcessWebInfLib ( archive ) , e ) ; } } } return entries ; }


Input: { [CODESPLIT] @ Override public void initialize ( ExtensionContext context ) { final SubsystemRegistration subsystem = context . registerSubsystem ( SUBSYSTEM_NAME , CURRENT_MODEL_VERSION ) ; final ManagementResourceRegistration registration = subsystem . registerSubsystemModel ( new NamingSubsystemRootResourceDefinition ( ) ) ; registration . registerOperationHandler ( GenericSubsystemDescribeHandler . DEFINITION , GenericSubsystemDescribeHandler . INSTANCE ) ; registration . registerSubModel ( NamingBindingResourceDefinition . INSTANCE ) ; registration . registerSubModel ( RemoteNamingResourceDefinition . INSTANCE ) ; if ( context . isRuntimeOnlyRegistrationValid ( ) ) { registration . registerOperationHandler ( NamingSubsystemRootResourceDefinition . JNDI_VIEW , JndiViewOperation . INSTANCE , false ) ; } subsystem . registerXMLElementWriter ( NamingSubsystemXMLPersister . INSTANCE ) ; }


Input: { [CODESPLIT] @ Override public void initializeParsers ( ExtensionParsingContext context ) { context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_0 , ( ) -> new NamingSubsystem10Parser ( context . getProcessType ( ) == ProcessType . APPLICATION_CLIENT ) ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_1 , NamingSubsystem11Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_2 , NamingSubsystem12Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_3 , NamingSubsystem13Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_4 , NamingSubsystem14Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_2_0 , NamingSubsystem20Parser :: new ) ; }


Input: used by TransactionScopedEntityManager to detach entities loaded by a query in a non - jta invocation . [CODESPLIT] protected Query detachQueryNonTxInvocation ( EntityManager underlyingEntityManager , Query underLyingQuery ) { if ( ! this . isExtendedPersistenceContext ( ) && ! this . isInTx ( ) ) { return new QueryNonTxInvocationDetacher ( underlyingEntityManager , underLyingQuery ) ; } return underLyingQuery ; }


Input: used by TransactionScopedEntityManager to detach entities loaded by a query in a non - jta invocation . [CODESPLIT] protected < T > TypedQuery < T > detachTypedQueryNonTxInvocation ( EntityManager underlyingEntityManager , TypedQuery < T > underLyingQuery ) { if ( ! this . isExtendedPersistenceContext ( ) && ! this . isInTx ( ) ) { return new TypedQueryNonTxInvocationDetacher <> ( underlyingEntityManager , underLyingQuery ) ; } return underLyingQuery ; }


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


Input: { [CODESPLIT] @ Override public void initialize ( final ExtensionContext context ) { JAXRS_LOGGER . debug ( "Activating JAX-RS Extension" ) ; final SubsystemRegistration subsystem = context . registerSubsystem ( SUBSYSTEM_NAME , CURRENT_MODEL_VERSION ) ; final ManagementResourceRegistration registration = subsystem . registerSubsystemModel ( JaxrsSubsystemDefinition . INSTANCE ) ; registration . registerOperationHandler ( GenericSubsystemDescribeHandler . DEFINITION , GenericSubsystemDescribeHandler . INSTANCE ) ; ManagementResourceRegistration jaxrsResReg = subsystem . registerDeploymentModel ( JaxrsDeploymentDefinition . INSTANCE ) ; jaxrsResReg . registerSubModel ( DeploymentRestResourcesDefintion . INSTANCE ) ; subsystem . registerXMLElementWriter ( parser ) ; }


Input: { [CODESPLIT] @ Override public void initializeParsers ( final ExtensionParsingContext context ) { context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , JaxrsExtension . NAMESPACE , ( ) -> parser ) ; }


Input: Processes the session bean for remote and local views and updates the { @link SessionBeanComponentDescription } accordingly [CODESPLIT] private void processViewAnnotations ( final DeploymentUnit deploymentUnit , final Class < ? > sessionBeanClass , final SessionBeanComponentDescription sessionBeanComponentDescription ) throws DeploymentUnitProcessingException { final Collection < Class < ? > > remoteBusinessInterfaces = this . getRemoteBusinessInterfaces ( deploymentUnit , sessionBeanClass ) ; if ( remoteBusinessInterfaces != null && ! remoteBusinessInterfaces . isEmpty ( ) ) { sessionBeanComponentDescription . addRemoteBusinessInterfaceViews ( this . toString ( remoteBusinessInterfaces ) ) ; } // fetch the local business interfaces of the bean Collection < Class < ? > > localBusinessInterfaces = this . getLocalBusinessInterfaces ( deploymentUnit , sessionBeanClass ) ; if ( localBusinessInterfaces != null && ! localBusinessInterfaces . isEmpty ( ) ) { sessionBeanComponentDescription . addLocalBusinessInterfaceViews ( this . toString ( localBusinessInterfaces ) ) ; } if ( hasNoInterfaceView ( sessionBeanClass ) ) { sessionBeanComponentDescription . addNoInterfaceView ( ) ; } // EJB 3.1 FR 4.9.7 & 4.9.8, if the bean exposes no views if ( hasNoViews ( sessionBeanComponentDescription ) ) { final Set < Class < ? > > potentialBusinessInterfaces = getPotentialBusinessInterfaces ( sessionBeanClass ) ; if ( potentialBusinessInterfaces . isEmpty ( ) ) { sessionBeanComponentDescription . addNoInterfaceView ( ) ; } else if ( potentialBusinessInterfaces . size ( ) == 1 ) { sessionBeanComponentDescription . addLocalBusinessInterfaceViews ( potentialBusinessInterfaces . iterator ( ) . next ( ) . getName ( ) ) ; } else if ( isEjbVersionGreaterThanOrEqualTo32 ( deploymentUnit ) ) { // EJB 3.2 spec states (section 4.9.7): // ... or if the bean class is annotated with neither the Local nor the Remote annotation, all implemented interfaces (excluding the interfaces listed above) // are assumed to be local business interfaces of the bean sessionBeanComponentDescription . addLocalBusinessInterfaceViews ( toString ( potentialBusinessInterfaces ) ) ; } } }


Input: { [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final EEModuleDescription eeModuleDescription = deploymentUnit . getAttachment ( Attachments . EE_MODULE_DESCRIPTION ) ; final Collection < ComponentDescription > componentConfigurations = eeModuleDescription . getComponentDescriptions ( ) ; if ( componentConfigurations == null || componentConfigurations . isEmpty ( ) ) { return ; } for ( ComponentDescription componentConfiguration : componentConfigurations ) { final CompositeIndex index = deploymentUnit . getAttachment ( org . jboss . as . server . deployment . Attachments . COMPOSITE_ANNOTATION_INDEX ) ; if ( index != null ) { processComponentConfig ( deploymentUnit , phaseContext , index , componentConfiguration ) ; } } }


Input: returns the toplevel deployment module classloader and all subdeployment classloaders [CODESPLIT] private static Set < ClassLoader > allDeploymentModuleClassLoaders ( DeploymentUnit deploymentUnit ) { Set < ClassLoader > deploymentClassLoaders = new HashSet < ClassLoader > ( ) ; final DeploymentUnit topDeploymentUnit = DeploymentUtils . getTopDeploymentUnit ( deploymentUnit ) ; final Module toplevelModule = topDeploymentUnit . getAttachment ( Attachments . MODULE ) ; if ( toplevelModule != null ) { deploymentClassLoaders . add ( toplevelModule . getClassLoader ( ) ) ; final List < DeploymentUnit > subDeployments = topDeploymentUnit . getAttachmentList ( Attachments . SUB_DEPLOYMENTS ) ; for ( DeploymentUnit subDeploymentUnit : subDeployments ) { final Module subDeploymentModule = subDeploymentUnit . getAttachment ( Attachments . MODULE ) ; if ( subDeploymentModule != null ) { deploymentClassLoaders . add ( subDeploymentModule . getClassLoader ( ) ) ; } } } return deploymentClassLoaders ; }


Input: Determine if class file transformer is needed for the specified persistence unit [CODESPLIT] public static boolean needClassFileTransformer ( PersistenceUnitMetadata pu ) { boolean result = true ; String provider = pu . getPersistenceProviderClassName ( ) ; if ( pu . getProperties ( ) . containsKey ( Configuration . JPA_CONTAINER_CLASS_TRANSFORMER ) ) { result = Boolean . parseBoolean ( pu . getProperties ( ) . getProperty ( Configuration . JPA_CONTAINER_CLASS_TRANSFORMER ) ) ; } else if ( isHibernateProvider ( provider ) ) { result = ( Boolean . TRUE . toString ( ) . equals ( pu . getProperties ( ) . getProperty ( HIBERNATE_USE_CLASS_ENHANCER ) ) || Boolean . TRUE . toString ( ) . equals ( pu . getProperties ( ) . getProperty ( HIBERNATE_ENABLE_DIRTY_TRACKING ) ) || Boolean . TRUE . toString ( ) . equals ( pu . getProperties ( ) . getProperty ( HIBERNATE_ENABLE_LAZY_INITIALIZATION ) ) || Boolean . TRUE . toString ( ) . equals ( pu . getProperties ( ) . getProperty ( HIBERNATE_ENABLE_ASSOCIATION_MANAGEMENT ) ) ) ; } return result ; }


Input: Determine if two phase persistence unit start is allowed [CODESPLIT] public static boolean allowTwoPhaseBootstrap ( PersistenceUnitMetadata pu ) { boolean result = true ; if ( EE_DEFAULT_DATASOURCE . equals ( pu . getJtaDataSourceName ( ) ) ) { result = false ; } if ( pu . getProperties ( ) . containsKey ( Configuration . JPA_ALLOW_TWO_PHASE_BOOTSTRAP ) ) { result = Boolean . parseBoolean ( pu . getProperties ( ) . getProperty ( Configuration . JPA_ALLOW_TWO_PHASE_BOOTSTRAP ) ) ; } return result ; }


Input: Determine if the default data - source should be used [CODESPLIT] public static boolean allowDefaultDataSourceUse ( PersistenceUnitMetadata pu ) { boolean result = true ; if ( pu . getProperties ( ) . containsKey ( Configuration . JPA_ALLOW_DEFAULT_DATA_SOURCE_USE ) ) { result = Boolean . parseBoolean ( pu . getProperties ( ) . getProperty ( Configuration . JPA_ALLOW_DEFAULT_DATA_SOURCE_USE ) ) ; } return result ; }


Input: Return true if detaching of managed entities should be deferred until the entity manager is closed . Note : only applies to transaction scoped entity managers used without an active JTA transaction . [CODESPLIT] public static boolean deferEntityDetachUntilClose ( final Map < String , Object > properties ) { boolean result = false ; if ( properties . containsKey ( JPA_DEFER_DETACH ) ) result = Boolean . parseBoolean ( ( String ) properties . get ( JPA_DEFER_DETACH ) ) ; return result ; }


Input: Allow the mixed synchronization checking to be skipped for backward compatibility with WildFly 10 . 1 . 0 [CODESPLIT] public static boolean skipMixedSynchronizationTypeCheck ( EntityManagerFactory emf , Map targetEntityManagerProperties ) { boolean result = false ; // EntityManager properties will take priority over persistence.xml level (emf) properties if ( targetEntityManagerProperties != null && targetEntityManagerProperties . containsKey ( SKIPMIXEDSYNCTYPECHECKING ) ) { result = Boolean . parseBoolean ( ( String ) targetEntityManagerProperties . get ( SKIPMIXEDSYNCTYPECHECKING ) ) ; } else if ( emf . getProperties ( ) != null && emf . getProperties ( ) . containsKey ( SKIPMIXEDSYNCTYPECHECKING ) ) { result = Boolean . parseBoolean ( ( String ) emf . getProperties ( ) . get ( SKIPMIXEDSYNCTYPECHECKING ) ) ; } return result ; }


Input: Allow an unsynchronized persistence context that is joined to the transaction be treated the same as a synchronized persistence context with respect to the checking for mixed unsync / sync types . [CODESPLIT] public static boolean allowJoinedUnsyncPersistenceContext ( EntityManagerFactory emf , Map targetEntityManagerProperties ) { boolean result = false ; // EntityManager properties will take priority over persistence.xml (emf) properties if ( targetEntityManagerProperties != null && targetEntityManagerProperties . containsKey ( ALLOWJOINEDUNSYNCPC ) ) { result = Boolean . parseBoolean ( ( String ) targetEntityManagerProperties . get ( ALLOWJOINEDUNSYNCPC ) ) ; } else if ( emf . getProperties ( ) != null && emf . getProperties ( ) . containsKey ( ALLOWJOINEDUNSYNCPC ) ) { result = Boolean . parseBoolean ( ( String ) emf . getProperties ( ) . get ( ALLOWJOINEDUNSYNCPC ) ) ; } return result ; }


Input: Populate the <code > strictMaxPoolModel< / code > from the <code > operation< / code > [CODESPLIT] @ Override protected void populateModel ( ModelNode operation , ModelNode strictMaxPoolModel ) throws OperationFailedException { for ( AttributeDefinition attr : StrictMaxPoolResourceDefinition . ATTRIBUTES . values ( ) ) { attr . validateAndSet ( operation , strictMaxPoolModel ) ; } }


Input: Returns the CORBA object reference associated with a Remote object by using the javax . rmi . CORBA package . <p / > Use reflection to avoid hard dependencies on javax . rmi . CORBA package . This method effective does the following : <blockquote > <pre > java . lang . Object stub ; try { stub = PortableRemoteObject . toStub ( remoteObj ) ; } catch ( Exception e ) { throw new ConfigurationException ( Object not exported or not found ) ; } if ( ! ( stub instanceof javax . rmi . CORBA . Stub )) { return null ; // JRMP impl or JRMP stub } try { (( javax . rmi . CORBA . Stub ) stub ) . connect ( orb ) ; // try to connect IIOP stub } catch ( RemoteException e ) { // ignore already connected error } return ( javax . rmi . CORBA . Stub ) stub ; [CODESPLIT] public static org . omg . CORBA . Object remoteToCorba ( Remote remoteObj , ORB orb ) throws ClassNotFoundException , ConfigurationException { synchronized ( CorbaUtils . class ) { if ( toStubMethod == null ) { initMethodHandles ( ) ; } } // First, get remoteObj's stub // javax.rmi.CORBA.Stub stub = PortableRemoteObject.toStub(remoteObj); java . lang . Object stub ; try { stub = toStubMethod . invoke ( null , new java . lang . Object [ ] { remoteObj } ) ; } catch ( InvocationTargetException e ) { Throwable realException = e . getTargetException ( ) ; // realException.printStackTrace(); ConfigurationException ce = IIOPLogger . ROOT_LOGGER . problemInvokingPortableRemoteObjectToStub ( ) ; ce . setRootCause ( realException ) ; throw ce ; } catch ( IllegalAccessException e ) { ConfigurationException ce = IIOPLogger . ROOT_LOGGER . cannotInvokePortableRemoteObjectToStub ( ) ; ce . setRootCause ( e ) ; throw ce ; } // Next, make sure that the stub is javax.rmi.CORBA.Stub if ( ! corbaStubClass . isInstance ( stub ) ) { return null ; // JRMP implementation or JRMP stub } // Next, make sure that the stub is connected // Invoke stub.connect(orb) try { connectMethod . invoke ( stub , new java . lang . Object [ ] { orb } ) ; } catch ( InvocationTargetException e ) { Throwable realException = e . getTargetException ( ) ; // realException.printStackTrace(); if ( ! ( realException instanceof java . rmi . RemoteException ) ) { ConfigurationException ce = IIOPLogger . ROOT_LOGGER . problemInvokingStubConnect ( ) ; ce . setRootCause ( realException ) ; throw ce ; } // ignore RemoteException because stub might have already // been connected } catch ( IllegalAccessException e ) { ConfigurationException ce = IIOPLogger . ROOT_LOGGER . cannotInvokeStubConnect ( ) ; ce . setRootCause ( e ) ; throw ce ; } // Finally, return stub return ( org . omg . CORBA . Object ) stub ; }


Input: Get ORB using given server and port number and properties from environment . [CODESPLIT] public static ORB getOrb ( String server , int port , Hashtable env ) { // See if we can get info from environment Properties orbProp ; // Extract any org.omg.CORBA properties from environment if ( env != null ) { // Get all String properties orbProp = new Properties ( ) ; final Enumeration envProp = env . keys ( ) ; while ( envProp . hasMoreElements ( ) ) { String key = ( String ) envProp . nextElement ( ) ; Object val = env . get ( key ) ; if ( val instanceof String ) { orbProp . put ( key , val ) ; } } final Enumeration mainProps = orbProperties . keys ( ) ; while ( mainProps . hasMoreElements ( ) ) { String key = ( String ) mainProps . nextElement ( ) ; Object val = orbProperties . get ( key ) ; if ( val instanceof String ) { orbProp . put ( key , val ) ; } } } else { orbProp = orbProperties ; } if ( server != null ) { orbProp . put ( "org.omg.CORBA.ORBInitialHost" , server ) ; } if ( port >= 0 ) { orbProp . put ( "org.omg.CORBA.ORBInitialPort" , "" + port ) ; } // Get Applet from environment if ( env != null ) { Object applet = env . get ( Context . APPLET ) ; if ( applet != null ) { // Create ORBs for an applet return initAppletORB ( applet , orbProp ) ; } } // Create ORBs using orbProp for a standalone application return ORB . init ( new String [ 0 ] , orbProp ) ; }


Input: This method returns a new ORB instance for the given applet without creating a static dependency on java . applet . [CODESPLIT] private static ORB initAppletORB ( Object applet , Properties orbProp ) { try { Class < ? > appletClass = Class . forName ( "java.applet.Applet" , true , null ) ; if ( ! appletClass . isInstance ( applet ) ) { throw new ClassCastException ( applet . getClass ( ) . getName ( ) ) ; } // invoke the static method ORB.init(applet, orbProp); Method method = ORB . class . getMethod ( "init" , appletClass , Properties . class ) ; return ( ORB ) method . invoke ( null , applet , orbProp ) ; } catch ( ClassNotFoundException e ) { // java.applet.Applet doesn't exist and the applet parameter is // non-null; so throw CCE throw new ClassCastException ( applet . getClass ( ) . getName ( ) ) ; } catch ( NoSuchMethodException e ) { throw new AssertionError ( e ) ; } catch ( InvocationTargetException e ) { Throwable cause = e . getCause ( ) ; if ( cause instanceof RuntimeException ) { throw ( RuntimeException ) cause ; } else if ( cause instanceof Error ) { throw ( Error ) cause ; } throw new AssertionError ( e ) ; } catch ( IllegalAccessException iae ) { throw new AssertionError ( iae ) ; } }


Input: Initializes reflection method handles for RMI - IIOP . [CODESPLIT] private static void initMethodHandles ( ) throws ClassNotFoundException { // Get javax.rmi.CORBA.Stub class corbaStubClass = Class . forName ( "javax.rmi.CORBA.Stub" ) ; // Get javax.rmi.CORBA.Stub.connect(org.omg.CORBA.ORB) method try { connectMethod = corbaStubClass . getMethod ( "connect" , new Class [ ] { org . omg . CORBA . ORB . class } ) ; } catch ( NoSuchMethodException e ) { throw IIOPLogger . ROOT_LOGGER . noMethodDefForStubConnect ( ) ; } // Get javax.rmi.PortableRemoteObject method Class proClass = Class . forName ( "javax.rmi.PortableRemoteObject" ) ; // Get javax.rmi.PortableRemoteObject(java.rmi.Remote) method try { toStubMethod = proClass . getMethod ( "toStub" , new Class [ ] { java . rmi . Remote . class } ) ; } catch ( NoSuchMethodException e ) { throw IIOPLogger . ROOT_LOGGER . noMethodDefForPortableRemoteObjectToStub ( ) ; } }


Input: Set the active naming store [CODESPLIT] public static void setActiveNamingStore ( final NamingStore namingStore ) { if ( WildFlySecurityManager . isChecking ( ) ) { System . getSecurityManager ( ) . checkPermission ( SET_ACTIVE_NAMING_STORE ) ; } ACTIVE_NAMING_STORE = namingStore ; }


Input: Initialize the naming components required by { [CODESPLIT] public static void initializeNamingManager ( ) { // Setup naming environment final String property = WildFlySecurityManager . getPropertyPrivileged ( Context . URL_PKG_PREFIXES , null ) ; if ( property == null || property . isEmpty ( ) ) { WildFlySecurityManager . setPropertyPrivileged ( Context . URL_PKG_PREFIXES , PACKAGE_PREFIXES ) ; } else if ( ! Arrays . asList ( property . split ( ":" ) ) . contains ( PACKAGE_PREFIXES ) ) { WildFlySecurityManager . setPropertyPrivileged ( Context . URL_PKG_PREFIXES , PACKAGE_PREFIXES + ":" + property ) ; } try { //If we are reusing the JVM. e.g. in tests we should not set this again if ( ! NamingManager . hasInitialContextFactoryBuilder ( ) ) NamingManager . setInitialContextFactoryBuilder ( new InitialContextFactoryBuilder ( ) ) ; } catch ( NamingException e ) { ROOT_LOGGER . failedToSet ( e , "InitialContextFactoryBuilder" ) ; } }


Input: { [CODESPLIT] public void bind ( final Name name , final Object object ) throws NamingException { check ( name , JndiPermission . ACTION_BIND ) ; if ( namingStore instanceof WritableNamingStore ) { final Name absoluteName = getAbsoluteName ( name ) ; final Object value ; if ( object instanceof Referenceable ) { value = ( ( Referenceable ) object ) . getReference ( ) ; } else { value = object ; } if ( System . getSecurityManager ( ) == null ) { getWritableNamingStore ( ) . bind ( absoluteName , value ) ; } else { // The permissions check has already happened for the binding further permissions should be allowed final NamingException e = AccessController . doPrivileged ( new PrivilegedAction < NamingException > ( ) { @ Override public NamingException run ( ) { try { getWritableNamingStore ( ) . bind ( absoluteName , value ) ; } catch ( NamingException e ) { return e ; } return null ; } } ) ; // Check that a NamingException wasn't thrown during the bind if ( e != null ) { throw e ; } } } else { throw NamingLogger . ROOT_LOGGER . readOnlyNamingContext ( ) ; } }


Input: { [CODESPLIT] public void bind ( final String name , final Object obj ) throws NamingException { bind ( parseName ( name ) , obj ) ; }


Input: { [CODESPLIT] public void rebind ( final Name name , Object object ) throws NamingException { check ( name , JndiPermission . ACTION_REBIND ) ; if ( namingStore instanceof WritableNamingStore ) { final Name absoluteName = getAbsoluteName ( name ) ; if ( object instanceof Referenceable ) { object = ( ( Referenceable ) object ) . getReference ( ) ; } getWritableNamingStore ( ) . rebind ( absoluteName , object ) ; } else { throw NamingLogger . ROOT_LOGGER . readOnlyNamingContext ( ) ; } }


Input: { [CODESPLIT] public void rebind ( final String name , final Object object ) throws NamingException { rebind ( parseName ( name ) , object ) ; }


Input: { [CODESPLIT] public void unbind ( final Name name ) throws NamingException { check ( name , JndiPermission . ACTION_UNBIND ) ; if ( namingStore instanceof WritableNamingStore ) { final Name absoluteName = getAbsoluteName ( name ) ; getWritableNamingStore ( ) . unbind ( absoluteName ) ; } else { throw NamingLogger . ROOT_LOGGER . readOnlyNamingContext ( ) ; } }


Input: { [CODESPLIT] public void rename ( final Name oldName , final Name newName ) throws NamingException { //check for appropriate permissions first so that no other info leaks from this context //in case of insufficient perms (like the fact if it is readonly or not) check ( oldName , JndiPermission . ACTION_LOOKUP | JndiPermission . ACTION_UNBIND ) ; check ( newName , JndiPermission . ACTION_BIND ) ; if ( namingStore instanceof WritableNamingStore ) { bind ( newName , lookup ( oldName ) ) ; unbind ( oldName ) ; } else { throw NamingLogger . ROOT_LOGGER . readOnlyNamingContext ( ) ; } }


Input: { [CODESPLIT] public void rename ( final String oldName , final String newName ) throws NamingException { rename ( parseName ( oldName ) , parseName ( newName ) ) ; }


Input: { [CODESPLIT] public NamingEnumeration < NameClassPair > list ( final Name name ) throws NamingException { check ( name , JndiPermission . ACTION_LIST ) ; try { return namingEnumeration ( namingStore . list ( getAbsoluteName ( name ) ) ) ; } catch ( CannotProceedException cpe ) { final Context continuationContext = NamingManager . getContinuationContext ( cpe ) ; return continuationContext . list ( cpe . getRemainingName ( ) ) ; } catch ( RequireResolveException r ) { final Object o = lookup ( r . getResolve ( ) ) ; if ( o instanceof Context ) { return ( ( Context ) o ) . list ( name . getSuffix ( r . getResolve ( ) . size ( ) ) ) ; } throw notAContextException ( r . getResolve ( ) ) ; } }


Input: { [CODESPLIT] public void destroySubcontext ( final Name name ) throws NamingException { check ( name , JndiPermission . ACTION_DESTROY_SUBCONTEXT ) ; if ( ! ( namingStore instanceof WritableNamingStore ) ) { throw NamingLogger . ROOT_LOGGER . readOnlyNamingContext ( ) ; } }


Input: { [CODESPLIT] public Context createSubcontext ( Name name ) throws NamingException { check ( name , JndiPermission . ACTION_CREATE_SUBCONTEXT ) ; if ( namingStore instanceof WritableNamingStore ) { final Name absoluteName = getAbsoluteName ( name ) ; return getWritableNamingStore ( ) . createSubcontext ( absoluteName ) ; } else { throw NamingLogger . ROOT_LOGGER . readOnlyNamingContext ( ) ; } }


Input: { [CODESPLIT] public Object lookupLink ( Name name ) throws NamingException { check ( name , JndiPermission . ACTION_LOOKUP ) ; if ( name . isEmpty ( ) ) { return lookup ( name ) ; } try { final Name absoluteName = getAbsoluteName ( name ) ; Object link = namingStore . lookup ( absoluteName ) ; if ( ! ( link instanceof LinkRef ) && link instanceof Reference ) { link = getObjectInstance ( link , name , null ) ; } return link ; } catch ( Exception e ) { throw namingException ( NamingLogger . ROOT_LOGGER . cannotLookupLink ( ) , e , name ) ; } }


Input: { [CODESPLIT] public Name composeName ( Name name , Name prefix ) throws NamingException { final Name result = ( Name ) prefix . clone ( ) ; if ( name instanceof CompositeName ) { if ( name . size ( ) == 1 ) { // name could be a nested name final String firstComponent = name . get ( 0 ) ; result . addAll ( parseName ( firstComponent ) ) ; } else { result . addAll ( name ) ; } } else { result . addAll ( new CompositeName ( name . toString ( ) ) ) ; } return result ; }


Input: { [CODESPLIT] public String composeName ( String name , String prefix ) throws NamingException { return composeName ( parseName ( name ) , parseName ( prefix ) ) . toString ( ) ; }


Input: { [CODESPLIT] public Object addToEnvironment ( String propName , Object propVal ) throws NamingException { final Object existing = environment . get ( propName ) ; environment . put ( propName , propVal ) ; return existing ; }


Input: { [CODESPLIT] public void addNamingListener ( final Name target , final int scope , final NamingListener listener ) throws NamingException { check ( target , JndiPermission . ACTION_ADD_NAMING_LISTENER ) ; namingStore . addNamingListener ( target , scope , listener ) ; }


Input: { [CODESPLIT] public void addNamingListener ( final String target , final int scope , final NamingListener listener ) throws NamingException { addNamingListener ( parseName ( target ) , scope , listener ) ; }


Input: { [CODESPLIT] public void configure ( final DeploymentPhaseContext context , final ComponentDescription description , final ComponentConfiguration configuration ) throws DeploymentUnitProcessingException { final ComponentNamingMode namingMode = description . getNamingMode ( ) ; final InjectedEENamespaceContextSelector selector = new InjectedEENamespaceContextSelector ( ) ; final String applicationName = configuration . getApplicationName ( ) ; final String moduleName = configuration . getModuleName ( ) ; final String compName = configuration . getComponentName ( ) ; final ServiceName appContextServiceName = ContextNames . contextServiceNameOfApplication ( applicationName ) ; final ServiceName moduleContextServiceName = ContextNames . contextServiceNameOfModule ( applicationName , moduleName ) ; final ServiceName compContextServiceName = ContextNames . contextServiceNameOfComponent ( applicationName , moduleName , compName ) ; final Injector < NamingStore > appInjector = selector . getAppContextInjector ( ) ; final Injector < NamingStore > moduleInjector = selector . getModuleContextInjector ( ) ; final Injector < NamingStore > compInjector = selector . getCompContextInjector ( ) ; final Injector < NamingStore > jbossInjector = selector . getJbossContextInjector ( ) ; final Injector < NamingStore > globalInjector = selector . getGlobalContextInjector ( ) ; final Injector < NamingStore > exportedInjector = selector . getExportedContextInjector ( ) ; configuration . getStartDependencies ( ) . add ( new DependencyConfigurator < ComponentStartService > ( ) { public void configureDependency ( final ServiceBuilder < ? > serviceBuilder , ComponentStartService service ) { serviceBuilder . addDependency ( appContextServiceName , NamingStore . class , appInjector ) ; serviceBuilder . addDependency ( moduleContextServiceName , NamingStore . class , moduleInjector ) ; if ( namingMode == ComponentNamingMode . CREATE ) { serviceBuilder . addDependency ( compContextServiceName , NamingStore . class , compInjector ) ; } else if ( namingMode == ComponentNamingMode . USE_MODULE ) { serviceBuilder . addDependency ( moduleContextServiceName , NamingStore . class , compInjector ) ; } serviceBuilder . addDependency ( ContextNames . GLOBAL_CONTEXT_SERVICE_NAME , NamingStore . class , globalInjector ) ; serviceBuilder . addDependency ( ContextNames . JBOSS_CONTEXT_SERVICE_NAME , NamingStore . class , jbossInjector ) ; serviceBuilder . addDependency ( ContextNames . EXPORTED_CONTEXT_SERVICE_NAME , NamingStore . class , exportedInjector ) ; } } ) ; final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory ( new NamespaceContextInterceptor ( selector , context . getDeploymentUnit ( ) . getServiceName ( ) ) ) ; configuration . addPostConstructInterceptor ( interceptorFactory , InterceptorOrder . ComponentPostConstruct . JNDI_NAMESPACE_INTERCEPTOR ) ; configuration . addPreDestroyInterceptor ( interceptorFactory , InterceptorOrder . ComponentPreDestroy . JNDI_NAMESPACE_INTERCEPTOR ) ; if ( description . isPassivationApplicable ( ) ) { configuration . addPrePassivateInterceptor ( interceptorFactory , InterceptorOrder . ComponentPassivation . JNDI_NAMESPACE_INTERCEPTOR ) ; configuration . addPostActivateInterceptor ( interceptorFactory , InterceptorOrder . ComponentPassivation . JNDI_NAMESPACE_INTERCEPTOR ) ; } configuration . setNamespaceContextInterceptorFactory ( interceptorFactory ) ; configuration . setNamespaceContextSelector ( selector ) ; }


Input: { [CODESPLIT] @ Override public void registerOperations ( ManagementResourceRegistration container ) { super . registerOperations ( container ) ; container . registerOperationHandler ( ADD_MIME , MimeMappingAdd . INSTANCE ) ; container . registerOperationHandler ( REMOVE_MIME , MimeMappingRemove . INSTANCE ) ; }


Input: Process all parameter DefaulValue objects . Flag all parameters with missing and invalid converters . [CODESPLIT] private void validateDefaultValues ( List < ParamDetail > detailList , HashMap < String , List < Validator > > paramConverterMap ) throws DeploymentUnitProcessingException { for ( ParamDetail detail : detailList ) { // check param converter for specific return type List < Validator > validators = paramConverterMap . get ( detail . parameter . getName ( ) ) ; if ( validators == null ) { // check for paramConverterProvider validators = paramConverterMap . get ( Object . class . getName ( ) ) ; } boolean isCheckClazzMethods = true ; if ( validators != null ) { for ( Validator v : validators ) { if ( ! v . isLazyLoad ( ) ) { try { Object obj = v . verify ( detail ) ; if ( obj != null ) { isCheckClazzMethods = false ; break ; } } catch ( Exception e ) { JAXRS_LOGGER . paramConverterFailed ( detail . defaultValue . value ( ) , detail . parameter . getSimpleName ( ) , detail . method . toString ( ) , v . toString ( ) , e . getClass ( ) . getName ( ) , e . getMessage ( ) ) ; } } } } if ( isCheckClazzMethods ) { Class baseType = detail . parameter ; Method valueOf = null ; // constructor rule try { Constructor < ? > ctor = baseType . getConstructor ( String . class ) ; if ( Modifier . isPublic ( ctor . getModifiers ( ) ) ) { continue ; // success move to next detail } } catch ( NoSuchMethodException ignored ) { } // method fromValue(String.class) rule try { Method fromValue = baseType . getDeclaredMethod ( "fromValue" , String . class ) ; if ( Modifier . isPublic ( fromValue . getModifiers ( ) ) ) { for ( Annotation ann : baseType . getAnnotations ( ) ) { if ( ann . annotationType ( ) . getName ( ) . equals ( "javax.xml.bind.annotation.XmlEnum" ) ) { valueOf = fromValue ; } } validateBaseType ( fromValue , detail . defaultValue . value ( ) , detail ) ; continue ; // success move to next detail } } catch ( NoSuchMethodException ignoredA ) { } // method fromString(String.class) rule Method fromString = null ; try { fromString = baseType . getDeclaredMethod ( "fromString" , String . class ) ; if ( Modifier . isStatic ( fromString . getModifiers ( ) ) ) { validateBaseType ( fromString , detail . defaultValue . value ( ) , detail ) ; continue ; // success move to next detail } } catch ( NoSuchMethodException ignoredB ) { } // method valueof(String.class) rule try { valueOf = baseType . getDeclaredMethod ( "valueOf" , String . class ) ; if ( Modifier . isStatic ( valueOf . getModifiers ( ) ) ) { validateBaseType ( valueOf , detail . defaultValue . value ( ) , detail ) ; continue ; // success move to next detail } } catch ( NoSuchMethodException ignored ) { } } } }


Input: Create a list of ParamConverters and ParamConverterProviders present in the application . [CODESPLIT] private HashMap < String , List < Validator > > getParamConverters ( final CompositeIndex index , final ClassLoader classLoader , Set < String > knownProviderClasses , boolean isFromUnitTest ) { HashMap < String , List < Validator > > paramConverterMap = new HashMap <> ( ) ; List < Validator > converterProviderList = new ArrayList <> ( ) ; paramConverterMap . put ( Object . class . getName ( ) , converterProviderList ) ; Set < ClassInfo > paramConverterSet = new HashSet < ClassInfo > ( ) ; if ( isFromUnitTest ) { Indexer indexer = new Indexer ( ) ; for ( String className : knownProviderClasses ) { try { String pathName = className . replace ( "." , File . separator ) ; InputStream stream = classLoader . getResourceAsStream ( pathName + ".class" ) ; indexer . index ( stream ) ; stream . close ( ) ; } catch ( IOException e ) { JAXRS_LOGGER . classIntrospectionFailure ( e . getClass ( ) . getName ( ) , e . getMessage ( ) ) ; } } List < ClassInfo > paramConverterList = indexer . complete ( ) . getKnownDirectImplementors ( PARAM_CONVERTER_DOTNAME ) ; List < ClassInfo > paramConverterProviderList = indexer . complete ( ) . getKnownDirectImplementors ( PARAM_CONVERTER_PROVIDER_DOTNAME ) ; paramConverterSet . addAll ( paramConverterList ) ; paramConverterSet . addAll ( paramConverterProviderList ) ; } else { for ( String clazzName : knownProviderClasses ) { ClassInfo classInfo = index . getClassByName ( DotName . createSimple ( clazzName ) ) ; if ( classInfo != null ) { List < DotName > intfNamesList = classInfo . interfaceNames ( ) ; for ( DotName dotName : intfNamesList ) { if ( dotName . compareTo ( PARAM_CONVERTER_DOTNAME ) == 0 || dotName . compareTo ( PARAM_CONVERTER_PROVIDER_DOTNAME ) == 0 ) { paramConverterSet . add ( classInfo ) ; break ; } } } } } for ( ClassInfo classInfo : paramConverterSet ) { Class < ? > clazz = null ; Method method = null ; try { String clazzName = classInfo . name ( ) . toString ( ) ; if ( clazzName . endsWith ( "$1" ) ) { clazzName = clazzName . substring ( 0 , clazzName . length ( ) - 2 ) ; } clazz = classLoader . loadClass ( clazzName ) ; Constructor < ? > ctor = clazz . getConstructor ( ) ; Object object = ctor . newInstance ( ) ; List < AnnotationInstance > lazyLoadAnnotations = classInfo . annotations ( ) . get ( PARAM_CONVERTER_LAZY_DOTNAME ) ; if ( object instanceof ParamConverterProvider ) { ParamConverterProvider pcpObj = ( ParamConverterProvider ) object ; method = pcpObj . getClass ( ) . getMethod ( "getConverter" , Class . class , Type . class , Annotation [ ] . class ) ; converterProviderList . add ( new ConverterProvider ( pcpObj , method , lazyLoadAnnotations ) ) ; } if ( object instanceof ParamConverter ) { ParamConverter pc = ( ParamConverter ) object ; method = getFromStringMethod ( pc . getClass ( ) ) ; Class < ? > returnClazz = method . getReturnType ( ) ; List < Validator > verifiers = paramConverterMap . get ( returnClazz . getName ( ) ) ; PConverter pConverter = new PConverter ( pc , method , lazyLoadAnnotations ) ; if ( verifiers == null ) { List < Validator > vList = new ArrayList <> ( ) ; vList . add ( pConverter ) ; paramConverterMap . put ( returnClazz . getName ( ) , vList ) ; } else { verifiers . add ( pConverter ) ; } } } catch ( NoSuchMethodException nsne ) { JAXRS_LOGGER . classIntrospectionFailure ( nsne . getClass ( ) . getName ( ) , nsne . getMessage ( ) ) ; } catch ( Exception e ) { JAXRS_LOGGER . classIntrospectionFailure ( e . getClass ( ) . getName ( ) , e . getMessage ( ) ) ; } } return paramConverterMap ; }


Input: Create list of objects that represents resource method parameters with a DefaultValue annontation assigned to it . [CODESPLIT] private ArrayList < ParamDetail > getResouceClasses ( final CompositeIndex index , final ClassLoader classLoader , Set < String > knownResourceClasses , boolean isFromUnitTest ) { ArrayList < ParamDetail > detailList = new ArrayList <> ( ) ; ArrayList < String > classNameArr = new ArrayList <> ( ) ; if ( isFromUnitTest ) { Indexer indexer = new Indexer ( ) ; for ( String className : knownResourceClasses ) { try { String pathName = className . replace ( "." , File . separator ) ; InputStream stream = classLoader . getResourceAsStream ( pathName + ".class" ) ; ClassInfo classInfo = indexer . index ( stream ) ; List < AnnotationInstance > defaultValuesList = classInfo . annotations ( ) . get ( DEFAULT_VALUE_DOTNAME ) ; if ( ! defaultValuesList . isEmpty ( ) ) { classNameArr . add ( ( classInfo ) . name ( ) . toString ( ) ) ; } stream . close ( ) ; } catch ( IOException e ) { JAXRS_LOGGER . classIntrospectionFailure ( e . getClass ( ) . getName ( ) , e . getMessage ( ) ) ; } } } else { for ( String clazzName : knownResourceClasses ) { ClassInfo classInfo = index . getClassByName ( DotName . createSimple ( clazzName ) ) ; if ( classInfo != null ) { Map < DotName , List < AnnotationInstance > > annotationsMap = classInfo . annotations ( ) ; if ( annotationsMap != null && ! annotationsMap . isEmpty ( ) ) { List < AnnotationInstance > xInstance = annotationsMap . get ( JaxrsAnnotations . PATH . getDotName ( ) ) ; List < AnnotationInstance > xdefaultValuesList = annotationsMap . get ( DEFAULT_VALUE_DOTNAME ) ; if ( ( xInstance != null && ! xInstance . isEmpty ( ) ) && ( xdefaultValuesList != null && ! xdefaultValuesList . isEmpty ( ) ) ) { classNameArr . add ( ( classInfo ) . name ( ) . toString ( ) ) ; } } } } } // resource classes with @DefaultValue // find methods and method params with @DefaultValue for ( String className : classNameArr ) { Class < ? > clazz = null ; try { clazz = classLoader . loadClass ( className ) ; for ( Method method : clazz . getMethods ( ) ) { if ( clazz == method . getDeclaringClass ( ) ) { Type [ ] genParamTypeArr = method . getGenericParameterTypes ( ) ; Annotation [ ] [ ] annotationMatrix = method . getParameterAnnotations ( ) ; for ( int j = 0 ; j < genParamTypeArr . length ; j ++ ) { DefaultValue defaultValue = lookupDefaultValueAnn ( annotationMatrix [ j ] ) ; if ( defaultValue != null ) { Class paramClazz = checkParamType ( genParamTypeArr [ j ] , method , j , classLoader ) ; if ( paramClazz != null ) { detailList . add ( new ParamDetail ( method , defaultValue , paramClazz , annotationMatrix [ j ] ) ) ; } } } } } } catch ( ClassNotFoundException e ) { JAXRS_LOGGER . classIntrospectionFailure ( e . getClass ( ) . getName ( ) , e . getMessage ( ) ) ; } } return detailList ; }


Input: Take steps to properly identify the parameter s data type [CODESPLIT] private Class checkParamType ( Type genParamType , final Method method , final int paramPos , final ClassLoader classLoader ) { Class paramClazz = null ; if ( genParamType instanceof ParameterizedType ) { ParameterizedType pType = ( ParameterizedType ) genParamType ; Type [ ] actualTypeArgs = pType . getActualTypeArguments ( ) ; // skip Map types. Don't know how to set default value for these if ( actualTypeArgs . length == 1 ) { try { paramClazz = classLoader . loadClass ( actualTypeArgs [ 0 ] . getTypeName ( ) ) ; } catch ( Exception ee ) { JAXRS_LOGGER . classIntrospectionFailure ( ee . getClass ( ) . getName ( ) , ee . getMessage ( ) ) ; } } } else { Class < ? > [ ] paramArr = method . getParameterTypes ( ) ; if ( paramArr [ paramPos ] . isArray ( ) ) { Class compClazz = paramArr [ paramPos ] . getComponentType ( ) ; if ( ! compClazz . isPrimitive ( ) ) { paramClazz = compClazz ; } } else { if ( ! paramArr [ paramPos ] . isPrimitive ( ) ) { paramClazz = paramArr [ paramPos ] ; } } } return paramClazz ; }


Input: Extract a DefaultValue annotation from the list of parameter annotations [CODESPLIT] private DefaultValue lookupDefaultValueAnn ( Annotation [ ] annotationArr ) { for ( Annotation ann : annotationArr ) { if ( ann instanceof DefaultValue ) { return ( DefaultValue ) ann ; } } return null ; }


Input: Confirm the method can handle the default value without throwing and exception . [CODESPLIT] private void validateBaseType ( Method method , String defaultValue , ParamDetail detail ) throws DeploymentUnitProcessingException { if ( defaultValue != null ) { try { method . invoke ( method . getDeclaringClass ( ) , defaultValue ) ; } catch ( Exception e ) { JAXRS_LOGGER . baseTypeMethodFailed ( defaultValue , detail . parameter . getSimpleName ( ) , detail . method . toString ( ) , method . toString ( ) , e . getClass ( ) . getName ( ) , e . getMessage ( ) ) ; } } }


Input: { [CODESPLIT] @ Override public void initialize ( ExtensionContext context ) { final boolean registerRuntimeOnly = context . isRuntimeOnlyRegistrationValid ( ) ; final SubsystemRegistration subsystem = context . registerSubsystem ( SUBSYSTEM_NAME , CURRENT_MODEL_VERSION ) ; subsystem . registerXMLElementWriter ( EJB3SubsystemXMLPersister . INSTANCE ) ; PathManager pathManager = context . getProcessType ( ) . isServer ( ) ? context . getPathManager ( ) : null ; subsystem . registerSubsystemModel ( new EJB3SubsystemRootResourceDefinition ( registerRuntimeOnly , pathManager ) ) ; if ( registerRuntimeOnly ) { ResourceDefinition deploymentsDef = new SimpleResourceDefinition ( new Parameters ( PathElement . pathElement ( ModelDescriptionConstants . SUBSYSTEM , SUBSYSTEM_NAME ) , getResourceDescriptionResolver ( "deployed" ) ) . setFeature ( false ) ) ; final ManagementResourceRegistration deploymentsRegistration = subsystem . registerDeploymentModel ( deploymentsDef ) ; deploymentsRegistration . registerSubModel ( MessageDrivenBeanResourceDefinition . INSTANCE ) ; deploymentsRegistration . registerSubModel ( SingletonBeanDeploymentResourceDefinition . INSTANCE ) ; deploymentsRegistration . registerSubModel ( StatelessSessionBeanDeploymentResourceDefinition . INSTANCE ) ; deploymentsRegistration . registerSubModel ( StatefulSessionBeanDeploymentResourceDefinition . INSTANCE ) ; } }


Input: { [CODESPLIT] @ Override public void initializeParsers ( ExtensionParsingContext context ) { context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_0 , EJB3Subsystem10Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_1 , EJB3Subsystem11Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_2 , EJB3Subsystem12Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_3 , EJB3Subsystem13Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_4 , EJB3Subsystem14Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_1_5 , EJB3Subsystem15Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_2_0 , EJB3Subsystem20Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_3_0 , EJB3Subsystem30Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_4_0 , EJB3Subsystem40Parser :: new ) ; context . setSubsystemXmlMapping ( SUBSYSTEM_NAME , NAMESPACE_5_0 , EJB3Subsystem50Parser :: new ) ; }


Input: At injection time of a XPC register the XPC ( step 1 of 2 ) finishRegistrationOfPersistenceContext is step 2 [CODESPLIT] public static void registerPersistenceContext ( ExtendedEntityManager xpc ) { if ( xpc == null ) { throw JpaLogger . ROOT_LOGGER . nullParameter ( "SFSBXPCMap.RegisterPersistenceContext" , "EntityManager" ) ; } final List < ExtendedEntityManager > store = deferToPostConstruct . get ( ) ; store . add ( xpc ) ; }


Input: Called by postconstruct interceptor [CODESPLIT] public static ExtendedEntityManager [ ] getDeferredEntityManagers ( ) { List < ExtendedEntityManager > store = deferToPostConstruct . get ( ) ; try { if ( store . isEmpty ( ) ) { return EMPTY ; } else { return store . toArray ( new ExtendedEntityManager [ store . size ( ) ] ) ; } } finally { store . clear ( ) ; } }


Input: Converts a tx Status index to a String [CODESPLIT] public static String statusAsString ( int status ) { if ( status >= Status . STATUS_ACTIVE && status <= Status . STATUS_ROLLING_BACK ) { return TxStatusStrings [ status ] ; } else { return "STATUS_INVALID(" + status + ")" ; } }


Input: / * Check that none of the attrs are defined or log a warning . [CODESPLIT] private void checkNoAttributesIsDefined ( String definedAttributeName , PathAddress address , ModelNode model , AttributeDefinition ... attrs ) throws OperationFailedException { List < String > definedAttributes = new ArrayList <> ( ) ; for ( AttributeDefinition attr : attrs ) { if ( model . get ( attr . getName ( ) ) . isDefined ( ) ) { definedAttributes . add ( attr . getName ( ) ) ; } } if ( ! definedAttributes . isEmpty ( ) ) { MessagingLogger . ROOT_LOGGER . invalidConfiguration ( address , definedAttributeName , definedAttributes ) ; } }


Input: called before call to PersistenceProvider . createContainerEntityManagerFactory ( PersistenceUnit Map ) [CODESPLIT] public static void beforeEntityManagerFactoryCreate ( Classification cacheType , PersistenceUnitMetadata persistenceUnitMetadata ) { for ( EventListener eventListener : eventListeners ) { eventListener . beforeEntityManagerFactoryCreate ( cacheType , persistenceUnitMetadata ) ; } }


Input: called after call to PersistenceProvider . createContainerEntityManagerFactory ( PersistenceUnit Map ) [CODESPLIT] public static void afterEntityManagerFactoryCreate ( Classification cacheType , PersistenceUnitMetadata persistenceUnitMetadata ) { for ( EventListener eventListener : eventListeners ) { eventListener . afterEntityManagerFactoryCreate ( cacheType , persistenceUnitMetadata ) ; } }


Input: start cache [CODESPLIT] public static Wrapper startCache ( Classification cacheType , Properties properties ) throws Exception { Wrapper result = null ; for ( EventListener eventListener : eventListeners ) { Wrapper value = eventListener . startCache ( cacheType , properties ) ; if ( value != null && result == null ) { result = value ; // return the first non-null wrapper value returned from a listener } } return result ; }


Input: add cache dependencies [CODESPLIT] public static void addCacheDependencies ( Classification cacheType , Properties properties ) { for ( EventListener eventListener : eventListeners ) { eventListener . addCacheDependencies ( cacheType , properties ) ; } }


Input: Stop cache [CODESPLIT] public static void stopCache ( Classification cacheType , Wrapper wrapper ) { for ( EventListener eventListener : eventListeners ) { eventListener . stopCache ( cacheType , wrapper ) ; } }


Input: { [CODESPLIT] @ Override public void writeContent ( XMLExtendedStreamWriter writer , SubsystemMarshallingContext context ) throws XMLStreamException { context . startSubsystemElement ( Namespace . CURRENT . getUriString ( ) , false ) ; ModelNode node = context . getModelNode ( ) ; writer . writeStartElement ( Element . CORE_ENVIRONMENT . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . NODE_IDENTIFIER . marshallAsAttribute ( node , writer ) ; writeProcessId ( writer , node ) ; writer . writeEndElement ( ) ; if ( TransactionSubsystemRootResourceDefinition . BINDING . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . STATUS_BINDING . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . RECOVERY_LISTENER . isMarshallable ( node ) ) { writer . writeStartElement ( Element . RECOVERY_ENVIRONMENT . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . BINDING . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . STATUS_BINDING . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . RECOVERY_LISTENER . marshallAsAttribute ( node , writer ) ; writer . writeEndElement ( ) ; } if ( TransactionSubsystemRootResourceDefinition . STATISTICS_ENABLED . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . ENABLE_TSM_STATUS . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . DEFAULT_TIMEOUT . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . MAXIMUM_TIMEOUT . isMarshallable ( node ) ) { writer . writeStartElement ( Element . COORDINATOR_ENVIRONMENT . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . STATISTICS_ENABLED . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . ENABLE_TSM_STATUS . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . DEFAULT_TIMEOUT . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . MAXIMUM_TIMEOUT . marshallAsAttribute ( node , writer ) ; writer . writeEndElement ( ) ; } if ( TransactionSubsystemRootResourceDefinition . OBJECT_STORE_RELATIVE_TO . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . OBJECT_STORE_PATH . isMarshallable ( node ) ) { writer . writeStartElement ( Element . OBJECT_STORE . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . OBJECT_STORE_PATH . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . OBJECT_STORE_RELATIVE_TO . marshallAsAttribute ( node , writer ) ; writer . writeEndElement ( ) ; } if ( node . hasDefined ( CommonAttributes . JTS ) && node . get ( CommonAttributes . JTS ) . asBoolean ( ) ) { writer . writeStartElement ( Element . JTS . getLocalName ( ) ) ; writer . writeEndElement ( ) ; } if ( node . hasDefined ( CommonAttributes . USE_JOURNAL_STORE ) && node . get ( CommonAttributes . USE_JOURNAL_STORE ) . asBoolean ( ) ) { writer . writeStartElement ( Element . USE_JOURNAL_STORE . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . JOURNAL_STORE_ENABLE_ASYNC_IO . marshallAsAttribute ( node , writer ) ; writer . writeEndElement ( ) ; } if ( node . hasDefined ( CommonAttributes . USE_JDBC_STORE ) && node . get ( CommonAttributes . USE_JDBC_STORE ) . asBoolean ( ) ) { writer . writeStartElement ( Element . JDBC_STORE . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . JDBC_STORE_DATASOURCE . marshallAsAttribute ( node , writer ) ; if ( TransactionSubsystemRootResourceDefinition . JDBC_ACTION_STORE_TABLE_PREFIX . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . JDBC_ACTION_STORE_DROP_TABLE . isMarshallable ( node ) ) { writer . writeEmptyElement ( Element . JDBC_ACTION_STORE . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . JDBC_ACTION_STORE_TABLE_PREFIX . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . JDBC_ACTION_STORE_DROP_TABLE . marshallAsAttribute ( node , writer ) ; } if ( TransactionSubsystemRootResourceDefinition . JDBC_COMMUNICATION_STORE_TABLE_PREFIX . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . JDBC_COMMUNICATION_STORE_DROP_TABLE . isMarshallable ( node ) ) { writer . writeEmptyElement ( Element . JDBC_COMMUNICATION_STORE . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . JDBC_COMMUNICATION_STORE_TABLE_PREFIX . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . JDBC_COMMUNICATION_STORE_DROP_TABLE . marshallAsAttribute ( node , writer ) ; } if ( TransactionSubsystemRootResourceDefinition . JDBC_STATE_STORE_TABLE_PREFIX . isMarshallable ( node ) || TransactionSubsystemRootResourceDefinition . JDBC_STATE_STORE_DROP_TABLE . isMarshallable ( node ) ) { writer . writeEmptyElement ( Element . JDBC_STATE_STORE . getLocalName ( ) ) ; TransactionSubsystemRootResourceDefinition . JDBC_STATE_STORE_TABLE_PREFIX . marshallAsAttribute ( node , writer ) ; TransactionSubsystemRootResourceDefinition . JDBC_STATE_STORE_DROP_TABLE . marshallAsAttribute ( node , writer ) ; } writer . writeEndElement ( ) ; } if ( node . hasDefined ( CommonAttributes . CM_RESOURCE ) && node . get ( CommonAttributes . CM_RESOURCE ) . asList ( ) . size ( ) > 0 ) { writer . writeStartElement ( Element . CM_RESOURCES . getLocalName ( ) ) ; for ( Property cmr : node . get ( CommonAttributes . CM_RESOURCE ) . asPropertyList ( ) ) { writer . writeStartElement ( CommonAttributes . CM_RESOURCE ) ; writer . writeAttribute ( Attribute . JNDI_NAME . getLocalName ( ) , cmr . getName ( ) ) ; if ( cmr . getValue ( ) . hasDefined ( CMResourceResourceDefinition . CM_TABLE_NAME . getName ( ) ) || cmr . getValue ( ) . hasDefined ( CMResourceResourceDefinition . CM_TABLE_BATCH_SIZE . getName ( ) ) || cmr . getValue ( ) . hasDefined ( CMResourceResourceDefinition . CM_TABLE_IMMEDIATE_CLEANUP . getName ( ) ) ) { writer . writeStartElement ( Element . CM_TABLE . getLocalName ( ) ) ; CMResourceResourceDefinition . CM_TABLE_NAME . marshallAsAttribute ( cmr . getValue ( ) , writer ) ; CMResourceResourceDefinition . CM_TABLE_BATCH_SIZE . marshallAsAttribute ( cmr . getValue ( ) , writer ) ; CMResourceResourceDefinition . CM_TABLE_IMMEDIATE_CLEANUP . marshallAsAttribute ( cmr . getValue ( ) , writer ) ; writer . writeEndElement ( ) ; } writer . writeEndElement ( ) ; } writer . writeEndElement ( ) ; } writer . writeEndElement ( ) ; }


Input: Read the properties from the timer - sql and extract the database dialects . [CODESPLIT] private void extractDialects ( ) { for ( Object prop : sql . keySet ( ) ) { int dot = ( ( String ) prop ) . indexOf ( ' ' ) ; if ( dot > 0 ) { databaseDialects . add ( ( ( String ) prop ) . substring ( dot + 1 ) ) ; } } }


Input: Check the connection MetaData and driver name to guess which database dialect to use . [CODESPLIT] private void investigateDialect ( ) { Connection connection = null ; if ( database == null ) { // no database dialect from configuration guessing from MetaData try { connection = dataSource . getConnection ( ) ; DatabaseMetaData metaData = connection . getMetaData ( ) ; String dbProduct = metaData . getDatabaseProductName ( ) ; database = identifyDialect ( dbProduct ) ; if ( database == null ) { EjbLogger . EJB3_TIMER_LOGGER . debug ( "Attempting to guess on driver name." ) ; database = identifyDialect ( metaData . getDriverName ( ) ) ; } } catch ( Exception e ) { EjbLogger . EJB3_TIMER_LOGGER . debug ( "Unable to read JDBC metadata." , e ) ; } finally { safeClose ( connection ) ; } if ( database == null ) { EjbLogger . EJB3_TIMER_LOGGER . jdbcDatabaseDialectDetectionFailed ( databaseDialects . toString ( ) ) ; } else { EjbLogger . EJB3_TIMER_LOGGER . debugf ( "Detect database dialect as '%s'.  If this is incorrect, please specify the correct dialect using the 'database' attribute in your configuration.  Supported database dialect strings are %s" , database , databaseDialects ) ; } } else { EjbLogger . EJB3_TIMER_LOGGER . debugf ( "Database dialect '%s' read from configuration, adjusting it to match the final database valid value." , database ) ; database = identifyDialect ( database ) ; EjbLogger . EJB3_TIMER_LOGGER . debugf ( "New Database dialect is '%s'." , database ) ; } }


Input: Use the given name and check for different database types to have a unified identifier for the dialect [CODESPLIT] private String identifyDialect ( String name ) { String unified = null ; if ( name != null ) { if ( name . toLowerCase ( ) . contains ( "postgres" ) ) { unified = "postgresql" ; } else if ( name . toLowerCase ( ) . contains ( "mysql" ) ) { unified = "mysql" ; } else if ( name . toLowerCase ( ) . contains ( "mariadb" ) ) { unified = "mariadb" ; } else if ( name . toLowerCase ( ) . contains ( "db2" ) ) { unified = "db2" ; } else if ( name . toLowerCase ( ) . contains ( "hsql" ) || name . toLowerCase ( ) . contains ( "hypersonic" ) ) { unified = "hsql" ; } else if ( name . toLowerCase ( ) . contains ( "h2" ) ) { unified = "h2" ; } else if ( name . toLowerCase ( ) . contains ( "oracle" ) ) { unified = "oracle" ; } else if ( name . toLowerCase ( ) . contains ( "microsoft" ) ) { unified = "mssql" ; } else if ( name . toLowerCase ( ) . contains ( "jconnect" ) ) { unified = "sybase" ; } } EjbLogger . EJB3_TIMER_LOGGER . debugf ( "Check dialect for '%s', result is '%s'" , name , unified ) ; return unified ; }


Input: Checks whether the database transaction configuration is appropriate and create the timer table if necessary . [CODESPLIT] private void checkDatabase ( ) { String loadTimer = sql ( LOAD_TIMER ) ; Connection connection = null ; Statement statement = null ; PreparedStatement preparedStatement = null ; ResultSet resultSet = null ; try { //test for the existence of the table by running the load timer query connection = dataSource . getConnection ( ) ; if ( connection . getTransactionIsolation ( ) < Connection . TRANSACTION_READ_COMMITTED ) { EjbLogger . EJB3_TIMER_LOGGER . wrongTransactionIsolationConfiguredForTimer ( ) ; } preparedStatement = connection . prepareStatement ( loadTimer ) ; preparedStatement . setString ( 1 , "NON-EXISTENT" ) ; preparedStatement . setString ( 2 , "NON-EXISTENT" ) ; preparedStatement . setString ( 3 , "NON-EXISTENT" ) ; resultSet = preparedStatement . executeQuery ( ) ; } catch ( SQLException e ) { //the query failed, assume it is because the table does not exist if ( connection != null ) { try { String createTable = sql ( CREATE_TABLE ) ; String [ ] statements = createTable . split ( ";" ) ; for ( final String sql : statements ) { try { statement = connection . createStatement ( ) ; statement . executeUpdate ( sql ) ; } finally { safeClose ( statement ) ; } } } catch ( SQLException e1 ) { EjbLogger . EJB3_TIMER_LOGGER . couldNotCreateTable ( e1 ) ; } } else { EjbLogger . EJB3_TIMER_LOGGER . couldNotCreateTable ( e ) ; } } finally { safeClose ( resultSet ) ; safeClose ( preparedStatement ) ; safeClose ( statement ) ; safeClose ( connection ) ; } }


Input: Convert the stored date - string from database back to Date [CODESPLIT] private Date stringAsSchedulerDate ( final String date , final String timerId ) { if ( date == null ) { return null ; } try { return new SimpleDateFormat ( SCHEDULER_DATE_FORMAT ) . parse ( date ) ; } catch ( ParseException e ) { EjbLogger . EJB3_TIMER_LOGGER . scheduleExpressionDateFromTimerPersistenceInvalid ( timerId , e . getMessage ( ) ) ; return null ; } }


Input: Set the node name for persistence if the state is IN_TIMEOUT or RETRY_TIMEOUT to show which node is current active for the timer . [CODESPLIT] private void setNodeName ( final TimerState timerState , PreparedStatement statement , int paramIndex ) throws SQLException { if ( timerState == TimerState . IN_TIMEOUT || timerState == TimerState . RETRY_TIMEOUT ) { statement . setString ( paramIndex , nodeName ) ; } else { statement . setNull ( paramIndex , Types . VARCHAR ) ; } }


Input: Mark this deployment and the top level deployment as being a weld deployment . [CODESPLIT] public static void mark ( DeploymentUnit unit ) { unit . putAttachment ( MARKER , Boolean . TRUE ) ; if ( unit . getParent ( ) != null ) { mark ( unit . getParent ( ) ) ; } }


Input: returns true if the { [CODESPLIT] public static boolean isPartOfWeldDeployment ( DeploymentUnit unit ) { if ( unit . getParent ( ) == null ) { return unit . getAttachment ( MARKER ) != null ; } else { return unit . getParent ( ) . getAttachment ( MARKER ) != null ; } }


Input: Unmarshals the sequence of method parameters from an input stream . [CODESPLIT] public Object [ ] readParams ( InputStream in ) { int len = paramReaders . length ; Object [ ] params = new Object [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { params [ i ] = paramReaders [ i ] . read ( in ) ; } return params ; }


Input: Marshals into an output stream the return value of the method . [CODESPLIT] public void writeRetval ( OutputStream out , Object retVal ) { retvalWriter . write ( out , RemoteObjectSubstitutionManager . writeReplaceRemote ( retVal ) ) ; }


Input: Marshals into an output stream an exception thrown by the method . [CODESPLIT] public void writeException ( OutputStream out , Throwable e ) { int len = excepWriters . length ; for ( int i = 0 ; i < len ; i ++ ) { if ( excepWriters [ i ] . getExceptionClass ( ) . isInstance ( e ) ) { excepWriters [ i ] . write ( out , e ) ; return ; } } throw new UnknownException ( e ) ; }


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


Input: ContainedImpl implementation ---------------------------------- [CODESPLIT] public Description describe ( ) { String defined_in_id = "IR" ; if ( defined_in instanceof ContainedOperations ) defined_in_id = ( ( ContainedOperations ) defined_in ) . id ( ) ; ExceptionDescription [ ] exds ; exds = new ExceptionDescription [ exceptions . length ] ; for ( int i = 0 ; i < exceptions . length ; ++ i ) { Description d = exceptions [ i ] . describe ( ) ; exds [ i ] = ExceptionDescriptionHelper . extract ( d . value ) ; } OperationDescription od ; od = new OperationDescription ( name , id , defined_in_id , version , typeCode , mode ( ) , contexts ( ) , params ( ) , exds ) ; Any any = getORB ( ) . create_any ( ) ; OperationDescriptionHelper . insert ( any , od ) ; return new Description ( DefinitionKind . dk_Operation , any ) ; }


Input: { [CODESPLIT] public void readElement ( XMLExtendedStreamReader reader , List < ModelNode > list ) throws XMLStreamException { final PathAddress address = PathAddress . pathAddress ( MailExtension . SUBSYSTEM_PATH ) ; list . add ( Util . createAddOperation ( address ) ) ; while ( reader . hasNext ( ) && reader . nextTag ( ) != END_ELEMENT ) { switch ( Namespace . forUri ( reader . getNamespaceURI ( ) ) ) { case MAIL_1_0 : case MAIL_1_1 : case MAIL_1_2 : { final String element = reader . getLocalName ( ) ; switch ( element ) { case MAIL_SESSION : { parseMailSession ( reader , list , address ) ; break ; } default : { reader . handleAny ( list ) ; break ; } } break ; } default : { throw unexpectedElement ( reader ) ; } } } }


Input: Do lazy lookup . [CODESPLIT] protected < U > U lookup ( Lookup < U > lookup , int start , int depth ) { int size ; synchronized ( indexes ) { size = indexes . size ( ) ; for ( int i = start ; i < depth && i < size ; i ++ ) { U result = lookup . lookup ( indexes . get ( i ) ) ; if ( result != null ) return result ; } } if ( currentClass == null ) return null ; synchronized ( indexes ) { ClassReflectionIndex cri = index . getClassIndex ( currentClass ) ; indexes . add ( cri ) ; currentClass = currentClass . getSuperclass ( ) ; } return lookup ( lookup , size , depth ) ; }


Input: --- // [CODESPLIT] @ Override public void getResourceValue ( ResolutionContext context , ServiceBuilder < ? > serviceBuilder , DeploymentPhaseContext phaseContext , Injector < ManagedReferenceFactory > injector ) throws DeploymentUnitProcessingException { AgroalConnectionFactoryConfigurationSupplier connectionFactoryConfiguration = new AgroalConnectionFactoryConfigurationSupplier ( ) ; try { Class < ? > providerClass = phaseContext . getDeploymentUnit ( ) . getAttachment ( MODULE ) . getClassLoader ( ) . loadClass ( className ) ; if ( providerClass != null && ! DataSource . class . isAssignableFrom ( providerClass ) && ! Driver . class . isAssignableFrom ( providerClass ) ) { throw AgroalLogger . SERVICE_LOGGER . invalidDeploymentConnectionProvider ( ) ; } connectionFactoryConfiguration . connectionProviderClass ( providerClass ) ; } catch ( ClassNotFoundException e ) { throw AgroalLogger . SERVICE_LOGGER . loadClassDeploymentException ( e , className ) ; } for ( Map . Entry < String , String > property : properties . entrySet ( ) ) { connectionFactoryConfiguration . jdbcProperty ( property . getKey ( ) , property . getValue ( ) ) ; } if ( databaseName != null && ! databaseName . isEmpty ( ) ) { connectionFactoryConfiguration . jdbcProperty ( DATABASE_NAME_PROP , databaseName ) ; } if ( description != null && ! description . isEmpty ( ) ) { connectionFactoryConfiguration . jdbcProperty ( DESCRIPTION_PROP , description ) ; } if ( serverName != null && ! serverName . isEmpty ( ) ) { connectionFactoryConfiguration . jdbcProperty ( SERVER_NAME_PROP , serverName ) ; } if ( portNumber >= 0 ) { connectionFactoryConfiguration . jdbcProperty ( PORT_NUMBER_PROP , Integer . toString ( portNumber ) ) ; } if ( loginTimeout >= 0 ) { connectionFactoryConfiguration . jdbcProperty ( LOGIN_TIMEOUT_PROP , Integer . toString ( loginTimeout ) ) ; } if ( maxStatements >= 0 ) { connectionFactoryConfiguration . jdbcProperty ( MAX_STATEMENTS_PROP , Integer . toString ( maxStatements ) ) ; } if ( url != null && ! url . isEmpty ( ) ) { connectionFactoryConfiguration . jdbcUrl ( url ) ; } if ( user != null && ! user . isEmpty ( ) ) { connectionFactoryConfiguration . principal ( new NamePrincipal ( user ) ) ; } if ( password != null && ! password . isEmpty ( ) ) { connectionFactoryConfiguration . credential ( new SimplePassword ( password ) ) ; } connectionFactoryConfiguration . jdbcTransactionIsolation ( AgroalConnectionFactoryConfiguration . TransactionIsolation . fromLevel ( isolationLevel ) ) ; AgroalConnectionPoolConfigurationSupplier connectionPoolConfiguration = new AgroalConnectionPoolConfigurationSupplier ( ) ; connectionPoolConfiguration . connectionFactoryConfiguration ( connectionFactoryConfiguration ) ; if ( initialPoolSize >= 0 ) { connectionPoolConfiguration . initialSize ( initialPoolSize ) ; } if ( minPoolSize >= 0 ) { connectionPoolConfiguration . minSize ( minPoolSize ) ; } if ( maxPoolSize >= 0 ) { connectionPoolConfiguration . maxSize ( maxPoolSize ) ; } if ( maxIdleTime >= 0 ) { connectionPoolConfiguration . reapTimeout ( Duration . ofSeconds ( maxIdleTime ) ) ; } AgroalDataSourceConfigurationSupplier dataSourceConfiguration = new AgroalDataSourceConfigurationSupplier ( ) ; dataSourceConfiguration . connectionPoolConfiguration ( connectionPoolConfiguration ) ; ContextNames . BindInfo bindInfo = ContextNames . bindInfoForEnvEntry ( context . getApplicationName ( ) , context . getModuleName ( ) , context . getComponentName ( ) , ! context . isCompUsesModule ( ) , jndiName ) ; ServiceName dataSourceServiceName = DATASOURCE_DEFINITION_SERVICE_PREFIX . append ( bindInfo . getBinderServiceName ( ) . getCanonicalName ( ) ) ; // This is the service responsible for the JNDI binding, with a dependency on the datasource service that acts as a ManagedReferenceFactory and is used as the injection source BinderService binderService = new BinderService ( bindInfo . getBindName ( ) , this ) ; phaseContext . getServiceTarget ( ) . addService ( bindInfo . getBinderServiceName ( ) , binderService ) . addDependency ( dataSourceServiceName , ManagedReferenceFactory . class , binderService . getManagedObjectInjector ( ) ) . addDependency ( bindInfo . getParentContextServiceName ( ) , ServiceBasedNamingStore . class , binderService . getNamingStoreInjector ( ) ) . install ( ) ; ServiceBuilder svcBuilder = phaseContext . getServiceTarget ( ) . addService ( dataSourceServiceName ) ; Supplier < TransactionSynchronizationRegistry > tsrSupplier = null ; if ( transactional ) { CapabilityServiceSupport css = phaseContext . getDeploymentUnit ( ) . getAttachment ( Attachments . CAPABILITY_SERVICE_SUPPORT ) ; ServiceName tsrName = css . getCapabilityServiceName ( "org.wildfly.transactions.transaction-synchronization-registry" ) ; //noinspection unchecked tsrSupplier = ( Supplier < TransactionSynchronizationRegistry > ) svcBuilder . requires ( tsrName ) ; } DataSourceDefinitionService dataSourceService = new DataSourceDefinitionService ( bindInfo , transactional , dataSourceConfiguration , tsrSupplier ) ; svcBuilder . setInstance ( dataSourceService ) . install ( ) ; serviceBuilder . requires ( bindInfo . getBinderServiceName ( ) ) ; serviceBuilder . addDependency ( dataSourceServiceName , ManagedReferenceFactory . class , injector ) ; }


Input: called from SFSBPreCreateInterceptor before bean creation [CODESPLIT] public static void beginSfsbCreation ( ) { SFSBCallStackThreadData data = CURRENT . get ( ) ; int no = data . creationBeanNestingLevel ; if ( no == 0 ) { data . creationTimeXPCRegistration = new HashMap < String , ExtendedEntityManager > ( ) ; // create new tracking structure (passing in parent levels tracking structure or null if toplevel) data . creationTimeInjectedXPCs = new SFSBInjectedXPCs ( data . creationTimeInjectedXPCs , null ) ; } else { // create new tracking structure (passing in parent levels tracking structure or null if toplevel) SFSBInjectedXPCs parent = data . creationTimeInjectedXPCs ; data . creationTimeInjectedXPCs = new SFSBInjectedXPCs ( parent , parent . getTopLevel ( ) ) ; } data . creationBeanNestingLevel ++ ; }


Input: called from SFSBPreCreateInterceptor after bean creation [CODESPLIT] public static void endSfsbCreation ( ) { SFSBCallStackThreadData data = CURRENT . get ( ) ; int no = data . creationBeanNestingLevel ; no -- ; data . creationBeanNestingLevel = no ; if ( no == 0 ) { // Completed creating top level bean, remove 'xpc creation tracking' thread local data . creationTimeXPCRegistration = null ; data . creationTimeInjectedXPCs = null ; } else { // finished creating a sub-bean, switch to parent level 'xpc creation tracking' data . creationTimeInjectedXPCs = data . creationTimeInjectedXPCs . getParent ( ) ; } }


Input: return for just the current entity manager invocation [CODESPLIT] public static Map < String , ExtendedEntityManager > currentSFSBCallStackInvocation ( ) { ArrayList < Map < String , ExtendedEntityManager > > stack = CURRENT . get ( ) . invocationStack ; if ( stack != null && stack . size ( ) > 0 ) { return stack . get ( stack . size ( ) - 1 ) ; } return null ; }


Input:
Push the passed SFSB context handle onto the invocation call stack [CODESPLIT] public static void pushCall ( Map < String , ExtendedEntityManager > entityManagers ) { currentSFSBCallStack ( ) . add ( entityManagers ) ; if ( entityManagers != null ) { /**
             * JPA 2.0 spec section 7.9.1 Container Responsibilities:
             * "When a business method of the stateful session bean is invoked,
             *  if the stateful session bean uses container managed transaction demarcation,
             *  and the entity manager is not already associated with the current JTA transaction,
             *  the container associates the entity manager with the current JTA transaction and
             *  calls EntityManager.joinTransaction.
             *  "
             */ for ( ExtendedEntityManager extendedEntityManager : entityManagers . values ( ) ) { extendedEntityManager . internalAssociateWithJtaTx ( ) ; } } }


Input: Pops the current SFSB invocation off the invocation call stack [CODESPLIT] public static Map < String , ExtendedEntityManager > popCall ( ) { ArrayList < Map < String , ExtendedEntityManager > > stack = currentSFSBCallStack ( ) ; Map < String , ExtendedEntityManager > result = stack . remove ( stack . size ( ) - 1 ) ; stack . trimToSize ( ) ; return result ; }


Input: gets the current SFSB invocation off the invocation call stack [CODESPLIT] static Map < String , ExtendedEntityManager > getCurrentCall ( ) { ArrayList < Map < String , ExtendedEntityManager > > stack = currentSFSBCallStack ( ) ; Map < String , ExtendedEntityManager > result = null ; if ( stack != null ) { result = stack . get ( stack . size ( ) - 1 ) ; } return result ; }


Input: Add dependencies for modules required for weld deployments if managed weld configurations are attached to the deployment [CODESPLIT] public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ModuleSpecification moduleSpecification = deploymentUnit . getAttachment ( Attachments . MODULE_SPECIFICATION ) ; final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; addDependency ( moduleSpecification , moduleLoader , JAVAX_ENTERPRISE_API ) ; addDependency ( moduleSpecification , moduleLoader , JAVAX_INJECT_API ) ; if ( ! WeldDeploymentMarker . isPartOfWeldDeployment ( deploymentUnit ) ) { return ; // Skip if there are no beans.xml files in the deployment } addDependency ( moduleSpecification , moduleLoader , JAVAX_PERSISTENCE_API_ID ) ; addDependency ( moduleSpecification , moduleLoader , WELD_CORE_ID ) ; addDependency ( moduleSpecification , moduleLoader , WELD_PROBE_ID , true ) ; addDependency ( moduleSpecification , moduleLoader , WELD_API_ID ) ; addDependency ( moduleSpecification , moduleLoader , WELD_SPI_ID ) ; ModuleDependency weldSubsystemDependency = new ModuleDependency ( moduleLoader , JBOSS_AS_WELD_ID , false , false , false , false ) ; weldSubsystemDependency . addImportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; weldSubsystemDependency . addImportFilter ( PathFilters . is ( "org/jboss/as/weld/injection" ) , true ) ; weldSubsystemDependency . addImportFilter ( PathFilters . acceptAll ( ) , false ) ; weldSubsystemDependency . addExportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; moduleSpecification . addSystemDependency ( weldSubsystemDependency ) ; // Due to serialization of EJBs ModuleDependency weldEjbDependency = new ModuleDependency ( moduleLoader , JBOSS_AS_WELD_EJB_ID , true , false , false , false ) ; weldEjbDependency . addImportFilter ( PathFilters . is ( "org/jboss/as/weld/ejb" ) , true ) ; weldEjbDependency . addImportFilter ( PathFilters . acceptAll ( ) , false ) ; moduleSpecification . addSystemDependency ( weldEjbDependency ) ; }


Input: Parse the faces config files looking for managed bean classes . The parser is quite simplistic as the only information we need is the managed - bean - class element [CODESPLIT] private void processXmlManagedBeans ( final DeploymentUnit deploymentUnit , final Set < String > managedBeanClasses ) { for ( final VirtualFile facesConfig : getConfigurationFiles ( deploymentUnit ) ) { InputStream is = null ; try { is = facesConfig . openStream ( ) ; final XMLInputFactory inputFactory = XMLInputFactory . newInstance ( ) ; inputFactory . setXMLResolver ( NoopXMLResolver . create ( ) ) ; XMLStreamReader parser = inputFactory . createXMLStreamReader ( is ) ; StringBuilder className = null ; int indent = 0 ; boolean managedBean = false ; boolean managedBeanClass = false ; while ( true ) { int event = parser . next ( ) ; if ( event == XMLStreamConstants . END_DOCUMENT ) { parser . close ( ) ; break ; } if ( event == XMLStreamConstants . START_ELEMENT ) { indent ++ ; if ( indent == 2 ) { if ( parser . getLocalName ( ) . equals ( MANAGED_BEAN ) ) { managedBean = true ; } } else if ( indent == 3 && managedBean ) { if ( parser . getLocalName ( ) . equals ( MANAGED_BEAN_CLASS ) ) { managedBeanClass = true ; className = new StringBuilder ( ) ; } } } else if ( event == XMLStreamConstants . END_ELEMENT ) { indent -- ; managedBeanClass = false ; if ( indent == 1 ) { managedBean = false ; } if ( className != null ) { managedBeanClasses . add ( className . toString ( ) . trim ( ) ) ; className = null ; } } else if ( managedBeanClass && event == XMLStreamConstants . CHARACTERS ) { className . append ( parser . getText ( ) ) ; } } } catch ( Exception e ) { JSFLogger . ROOT_LOGGER . managedBeansConfigParseFailed ( facesConfig ) ; } finally { try { if ( is != null ) { is . close ( ) ; } } catch ( IOException e ) { // Ignore } } } }


Input: WFLY - 6617 According to JSF 2 . 2 spec it should be possible to inject beans using [CODESPLIT] private void processPhaseListeners ( final DeploymentUnit deploymentUnit , final Set < String > managedBeanClasses ) { for ( final VirtualFile facesConfig : getConfigurationFiles ( deploymentUnit ) ) { InputStream is = null ; try { is = facesConfig . openStream ( ) ; final XMLInputFactory inputFactory = XMLInputFactory . newInstance ( ) ; inputFactory . setXMLResolver ( NoopXMLResolver . create ( ) ) ; XMLStreamReader parser = inputFactory . createXMLStreamReader ( is ) ; StringBuilder phaseListenerName = null ; int indent = 0 ; boolean lifecycle = false ; boolean phaseListener = false ; while ( true ) { int event = parser . next ( ) ; if ( event == XMLStreamConstants . END_DOCUMENT ) { parser . close ( ) ; break ; } if ( event == XMLStreamConstants . START_ELEMENT ) { indent ++ ; if ( indent == 2 ) { if ( parser . getLocalName ( ) . equals ( LIFECYCLE ) ) { lifecycle = true ; } } else if ( indent == 3 && lifecycle ) { if ( parser . getLocalName ( ) . equals ( PHASE_LISTENER ) ) { phaseListener = true ; phaseListenerName = new StringBuilder ( ) ; } } } else if ( event == XMLStreamConstants . END_ELEMENT ) { indent -- ; phaseListener = false ; if ( indent == 1 ) { lifecycle = false ; } if ( phaseListenerName != null ) { managedBeanClasses . add ( phaseListenerName . toString ( ) . trim ( ) ) ; phaseListenerName = null ; } } else if ( phaseListener && event == XMLStreamConstants . CHARACTERS ) { phaseListenerName . append ( parser . getText ( ) ) ; } } } catch ( Exception e ) { JSFLogger . ROOT_LOGGER . phaseListenersConfigParseFailed ( facesConfig ) ; } finally { try { if ( is != null ) { is . close ( ) ; } } catch ( IOException e ) { // Ignore } } } }


Input: Return the IDL type name for the given class . Here we use the mapping for parameter types and return values . [CODESPLIT] public static String getTypeIDLName ( Class cls ) throws RMIIIOPViolationException { if ( cls . isPrimitive ( ) ) return PrimitiveAnalysis . getPrimitiveAnalysis ( cls ) . getIDLName ( ) ; if ( cls . isArray ( ) ) { // boxedRMI 1.3.6 Class componentClass = cls ; int sequence = 0 ; while ( componentClass . isArray ( ) ) { componentClass = componentClass . getComponentType ( ) ; ++ sequence ; } String idlName = getTypeIDLName ( componentClass ) ; int idx = idlName . lastIndexOf ( "::" ) ; String idlModule = idlName . substring ( 0 , idx + 2 ) ; String baseName = idlName . substring ( idx + 2 ) ; return "::org::omg::boxedRMI" + idlModule + "seq" + sequence + "_" + baseName ; } // special classes if ( cls == java . lang . String . class ) return "::CORBA::WStringValue" ; if ( cls == java . lang . Object . class ) return "::java::lang::_Object" ; if ( cls == java . lang . Class . class ) return "::javax::rmi::CORBA::ClassDesc" ; if ( cls == java . io . Serializable . class ) return "::java::io::Serializable" ; if ( cls == java . io . Externalizable . class ) return "::java::io::Externalizable" ; if ( cls == java . rmi . Remote . class ) return "::java::rmi::Remote" ; if ( cls == org . omg . CORBA . Object . class ) return "::CORBA::Object" ; // remote interface? if ( cls . isInterface ( ) && java . rmi . Remote . class . isAssignableFrom ( cls ) ) { InterfaceAnalysis ia = InterfaceAnalysis . getInterfaceAnalysis ( cls ) ; return ia . getIDLModuleName ( ) + "::" + ia . getIDLName ( ) ; } // IDL interface? if ( cls . isInterface ( ) && org . omg . CORBA . Object . class . isAssignableFrom ( cls ) && org . omg . CORBA . portable . IDLEntity . class . isAssignableFrom ( cls ) ) { InterfaceAnalysis ia = InterfaceAnalysis . getInterfaceAnalysis ( cls ) ; return ia . getIDLModuleName ( ) + "::" + ia . getIDLName ( ) ; } // exception? if ( Throwable . class . isAssignableFrom ( cls ) ) { if ( Exception . class . isAssignableFrom ( cls ) && ! RuntimeException . class . isAssignableFrom ( cls ) ) { ExceptionAnalysis ea = ExceptionAnalysis . getExceptionAnalysis ( cls ) ; return ea . getIDLModuleName ( ) + "::" + ea . getIDLName ( ) ; } } // got to be value ValueAnalysis va = ValueAnalysis . getValueAnalysis ( cls ) ; return va . getIDLModuleName ( ) + "::" + va . getIDLName ( ) ; }


Input: Check if this class is valid for RMI / IIOP mapping . This method will either throw an exception or return true . [CODESPLIT] public static boolean isValidRMIIIOP ( Class cls ) throws RMIIIOPViolationException { if ( cls . isPrimitive ( ) ) return true ; if ( cls . isArray ( ) ) return isValidRMIIIOP ( cls . getComponentType ( ) ) ; // special interfaces if ( cls == Serializable . class || cls == Externalizable . class ) return true ; // interface? if ( cls . isInterface ( ) && java . rmi . Remote . class . isAssignableFrom ( cls ) ) { InterfaceAnalysis . getInterfaceAnalysis ( cls ) ; return true ; } // exception? if ( Throwable . class . isAssignableFrom ( cls ) ) { if ( Exception . class . isAssignableFrom ( cls ) && ! RuntimeException . class . isAssignableFrom ( cls ) ) { ExceptionAnalysis . getExceptionAnalysis ( cls ) ; } return true ; } // special values if ( cls == Object . class || cls == String . class || cls == Class . class ) return true ; // got to be value ValueAnalysis . getValueAnalysis ( cls ) ; return true ; }


Input: Insert a java primitive into an Any . The primitive is assumed to be wrapped in one of the primitive wrapper classes . [CODESPLIT] public static void insertAnyPrimitive ( Any any , Object primitive ) { Class type = primitive . getClass ( ) ; if ( type == Boolean . class ) any . insert_boolean ( ( ( Boolean ) primitive ) . booleanValue ( ) ) ; else if ( type == Character . class ) any . insert_wchar ( ( ( Character ) primitive ) . charValue ( ) ) ; else if ( type == Byte . class ) any . insert_octet ( ( ( Byte ) primitive ) . byteValue ( ) ) ; else if ( type == Short . class ) any . insert_short ( ( ( Short ) primitive ) . shortValue ( ) ) ; else if ( type == Integer . class ) any . insert_long ( ( ( Integer ) primitive ) . intValue ( ) ) ; else if ( type == Long . class ) any . insert_longlong ( ( ( Long ) primitive ) . longValue ( ) ) ; else if ( type == Float . class ) any . insert_float ( ( ( Float ) primitive ) . floatValue ( ) ) ; else if ( type == Double . class ) any . insert_double ( ( ( Double ) primitive ) . doubleValue ( ) ) ; else throw IIOPLogger . ROOT_LOGGER . notAPrimitive ( type . getName ( ) ) ; }


Input: Map Java name to IDL name as per sections 1 . 3 . 2 . 3 1 . 3 . 2 . 4 and 1 . 3 . 2 . 2 . This only works for a single name component without a qualifying dot . [CODESPLIT] public static String javaToIDLName ( String name ) { if ( name == null || "" . equals ( name ) || name . indexOf ( ' ' ) != - 1 ) throw IIOPLogger . ROOT_LOGGER . nameCannotBeNullEmptyOrQualified ( ) ; StringBuffer res = new StringBuffer ( name . length ( ) ) ; if ( name . charAt ( 0 ) == ' ' ) res . append ( ' ' ) ; // 1.3.2.3 for ( int i = 0 ; i < name . length ( ) ; ++ i ) { char c = name . charAt ( i ) ; if ( isLegalIDLIdentifierChar ( c ) ) res . append ( c ) ; else // 1.3.2.4 res . append ( ' ' ) . append ( toHexString ( ( int ) c ) ) ; } String s = res . toString ( ) ; if ( isReservedIDLKeyword ( s ) ) return "_" + s ; else return s ; }


Input: Return the IR global ID of the given class or interface . This is described in section 1 . 3 . 5 . 7 . The returned string is in the RMI hashed format like RMI : java . util . Hashtable : C03324C0EA357270 : 13BB0F25214AE4B8 . [CODESPLIT] public static String getIRIdentifierOfClass ( Class cls ) { if ( cls . isPrimitive ( ) ) throw IIOPLogger . ROOT_LOGGER . primitivesHaveNoIRIds ( ) ; String result = ( String ) classIRIdentifierCache . get ( cls ) ; if ( result != null ) return result ; String name = cls . getName ( ) ; StringBuffer b = new StringBuffer ( "RMI:" ) ; for ( int i = 0 ; i < name . length ( ) ; ++ i ) { char c = name . charAt ( i ) ; if ( c < 256 ) b . append ( c ) ; else b . append ( "\\U" ) . append ( toHexString ( ( int ) c ) ) ; } long clsHash = getClassHashCode ( cls ) ; b . append ( ' ' ) . append ( toHexString ( clsHash ) ) ; ObjectStreamClass osClass = ObjectStreamClass . lookup ( cls ) ; if ( osClass != null ) { long serialVersionUID = osClass . getSerialVersionUID ( ) ; if ( clsHash != serialVersionUID ) b . append ( ' ' ) . append ( toHexString ( serialVersionUID ) ) ; } result = b . toString ( ) ; classIRIdentifierCache . put ( cls , result ) ; return result ; }


Input: Determine if the argument is a reserved IDL keyword . [CODESPLIT] private static boolean isReservedIDLKeyword ( String s ) { // TODO: faster lookup for ( int i = 0 ; i < reservedIDLKeywords . length ; ++ i ) if ( reservedIDLKeywords [ i ] . equals ( s ) ) return true ; return false ; }


Input: Determine if a <code > char< / code > is a legal IDL identifier character . [CODESPLIT] private static boolean isLegalIDLIdentifierChar ( char c ) { if ( c >= 0x61 && c <= 0x7a ) return true ; // lower case letter if ( c >= 0x30 && c <= 0x39 ) return true ; // digit if ( c >= 0x41 && c <= 0x5a ) return true ; // upper case letter if ( c == ' ' ) return true ; // underscore return false ; }