idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
14,900
public void addWorkContext ( Class < ? extends WorkContext > workContextClass , WorkContext workContext ) { if ( workContextClass == null ) { throw new IllegalArgumentException ( "Work context class is null" ) ; } if ( workContext == null ) { throw new IllegalArgumentException ( "Work context is null" ) ; } if ( workContexts == null ) { workContexts = new HashMap < Class < ? extends WorkContext > , WorkContext > ( 1 ) ; } if ( trace ) log . tracef ( "Adding work context %s for %s" , workContextClass , this ) ; workContexts . put ( workContextClass , workContext ) ; }
Adds new work context .
148
5
14,901
private void fireWorkContextSetupComplete ( Object workContext ) { if ( workContext != null && workContext instanceof WorkContextLifecycleListener ) { if ( trace ) log . tracef ( "WorkContextSetupComplete(%s) for %s" , workContext , this ) ; WorkContextLifecycleListener listener = ( WorkContextLifecycleListener ) workContext ; listener . contextSetupComplete ( ) ; } }
Calls listener after work context is setted up .
90
11
14,902
private void fireWorkContextSetupFailed ( Object workContext ) { if ( workContext != null && workContext instanceof WorkContextLifecycleListener ) { if ( trace ) log . tracef ( "WorkContextSetupFailed(%s) for %s" , workContext , this ) ; WorkContextLifecycleListener listener = ( WorkContextLifecycleListener ) workContext ; listener . contextSetupFailed ( WorkContextErrorCodes . CONTEXT_SETUP_FAILED ) ; } }
Calls listener if setup failed
108
6
14,903
@ SuppressWarnings ( "unchecked" ) public void inject ( Object object , String propertyName , Object propertyValue , String propertyType , boolean includeFields ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { if ( object == null ) throw new IllegalArgumentException ( "Object is null" ) ; if ( propertyName == null || propertyName . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "PropertyName is undefined" ) ; String methodName = "set" + propertyName . substring ( 0 , 1 ) . toUpperCase ( Locale . US ) ; if ( propertyName . length ( ) > 1 ) { methodName += propertyName . substring ( 1 ) ; } Method method = findMethod ( object . getClass ( ) , methodName , propertyType ) ; if ( method != null ) { Class < ? > parameterClass = method . getParameterTypes ( ) [ 0 ] ; Object parameterValue = null ; try { parameterValue = getValue ( propertyName , parameterClass , propertyValue , SecurityActions . getClassLoader ( object . getClass ( ) ) ) ; } catch ( Throwable t ) { throw new InvocationTargetException ( t , t . getMessage ( ) ) ; } if ( ! parameterClass . isPrimitive ( ) || parameterValue != null ) method . invoke ( object , new Object [ ] { parameterValue } ) ; } else { if ( ! includeFields ) throw new NoSuchMethodException ( "Method " + methodName + " not found" ) ; // Ok, we didn't find a method - assume field Field field = findField ( object . getClass ( ) , propertyName , propertyType ) ; if ( field != null ) { Class < ? > fieldClass = field . getType ( ) ; Object fieldValue = null ; try { fieldValue = getValue ( propertyName , fieldClass , propertyValue , SecurityActions . getClassLoader ( object . getClass ( ) ) ) ; } catch ( Throwable t ) { throw new InvocationTargetException ( t , t . getMessage ( ) ) ; } field . set ( object , fieldValue ) ; } else { throw new NoSuchMethodException ( "Field " + propertyName + " not found" ) ; } } }
Inject a value into an object property
489
8
14,904
protected String getSubstitutionValue ( String input ) { if ( input == null || input . trim ( ) . equals ( "" ) ) return input ; while ( input . indexOf ( "${" ) != - 1 ) { int from = input . indexOf ( "${" ) ; int to = input . indexOf ( "}" ) ; int dv = input . indexOf ( ":" , from + 2 ) ; if ( dv != - 1 && dv > to ) { dv = - 1 ; } String systemProperty = "" ; String defaultValue = "" ; if ( dv == - 1 ) { String s = input . substring ( from + 2 , to ) ; if ( "/" . equals ( s ) ) { systemProperty = File . separator ; } else if ( ":" . equals ( s ) ) { systemProperty = File . pathSeparator ; } else { systemProperty = SecurityActions . getSystemProperty ( s ) ; } } else { systemProperty = SecurityActions . getSystemProperty ( input . substring ( from + 2 , dv ) ) ; defaultValue = input . substring ( dv + 1 , to ) ; } String prefix = "" ; String postfix = "" ; if ( from != 0 ) { prefix = input . substring ( 0 , from ) ; } if ( to + 1 < input . length ( ) - 1 ) { postfix = input . substring ( to + 1 ) ; } if ( systemProperty != null && ! systemProperty . trim ( ) . equals ( "" ) ) { input = prefix + systemProperty + postfix ; } else if ( ! defaultValue . trim ( ) . equals ( "" ) ) { input = prefix + defaultValue + postfix ; } else { input = prefix + postfix ; } } return input ; }
System property substitution
385
3
14,905
public static Boolean getShouldDistribute ( DistributableWork work ) { if ( work != null && work instanceof WorkContextProvider ) { List < WorkContext > contexts = ( ( WorkContextProvider ) work ) . getWorkContexts ( ) ; if ( contexts != null ) { for ( WorkContext wc : contexts ) { if ( wc instanceof DistributableContext ) { DistributableContext dc = ( DistributableContext ) wc ; return dc . getDistribute ( ) ; } else if ( wc instanceof HintsContext ) { HintsContext hc = ( HintsContext ) wc ; if ( hc . getHints ( ) . keySet ( ) . contains ( DistributableContext . DISTRIBUTE ) ) { Serializable value = hc . getHints ( ) . get ( DistributableContext . DISTRIBUTE ) ; if ( value != null && value instanceof Boolean ) { return ( Boolean ) value ; } } } } } } return null ; }
Get should distribute override
208
4
14,906
private Xid convertXid ( Xid xid ) { if ( xid instanceof XidWrapper ) return xid ; else return new XidWrapperImpl ( xid , pad , jndiName ) ; }
Return wrapper for given xid .
49
7
14,907
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { in . defaultReadObject ( ) ; validatorFactory = BeanValidationImpl . createValidatorFactory ( ) ; }
Read the object - Nothing is read as the validator factory is transient . A new instance is created
44
20
14,908
public void setExecutorService ( ExecutorService v ) { if ( v != null ) { executorService = v ; isExternal = true ; } else { executorService = null ; isExternal = false ; } }
Set the executor service
47
5
14,909
public void registerPool ( ManagedConnectionPool mcp , long mcpInterval ) { try { lock . lock ( ) ; synchronized ( registeredPools ) { registeredPools . put ( new Key ( System . identityHashCode ( mcp ) , System . currentTimeMillis ( ) , mcpInterval ) , mcp ) ; } if ( mcpInterval > 1 && mcpInterval / 2 < interval ) { interval = interval / 2 ; long maybeNext = System . currentTimeMillis ( ) + interval ; if ( next > maybeNext && maybeNext > 0 ) { next = maybeNext ; condition . signal ( ) ; } } } finally { lock . unlock ( ) ; } }
Register pool for idle connection cleanup
150
6
14,910
public void unregisterPool ( ManagedConnectionPool mcp ) { synchronized ( registeredPools ) { registeredPools . values ( ) . remove ( mcp ) ; if ( registeredPools . isEmpty ( ) ) interval = Long . MAX_VALUE ; } }
Unregister pool instance for idle connection cleanup
56
8
14,911
public Metadata registerMetadata ( String name , Connector c , File archive ) { Metadata md = new MetadataImpl ( name , c , archive ) ; metadataRepository . registerMetadata ( md ) ; return md ; }
Register a metadata instance with the repository
49
7
14,912
protected void createResourceAdapter ( DeploymentBuilder builder , String raClz , Collection < org . ironjacamar . common . api . metadata . spec . ConfigProperty > configProperties , Map < String , String > overrides , TransactionSupportEnum transactionSupport , String productName , String productVersion , InboundResourceAdapter ira , CloneableBootstrapContext bootstrapContext ) throws DeployException { try { Class < ? > clz = Class . forName ( raClz , true , builder . getClassLoader ( ) ) ; javax . resource . spi . ResourceAdapter resourceAdapter = ( javax . resource . spi . ResourceAdapter ) clz . newInstance ( ) ; validationObj . add ( new ValidateClass ( Key . RESOURCE_ADAPTER , clz , configProperties ) ) ; Collection < org . ironjacamar . core . api . deploymentrepository . ConfigProperty > dcps = injectConfigProperties ( resourceAdapter , configProperties , overrides , builder . getClassLoader ( ) ) ; org . ironjacamar . core . spi . statistics . StatisticsPlugin statisticsPlugin = null ; if ( resourceAdapter instanceof org . ironjacamar . core . spi . statistics . Statistics ) statisticsPlugin = ( ( org . ironjacamar . core . spi . statistics . Statistics ) resourceAdapter ) . getStatistics ( ) ; TransactionIntegration ti = null ; if ( isXA ( transactionSupport ) ) { ti = transactionIntegration ; } bootstrapContext . setResourceAdapter ( resourceAdapter ) ; builder . resourceAdapter ( new ResourceAdapterImpl ( resourceAdapter , bootstrapContext , dcps , statisticsPlugin , productName , productVersion , createInboundMapping ( ira , builder . getClassLoader ( ) ) , is16 ( builder . getMetadata ( ) ) , beanValidation , builder . getActivation ( ) . getBeanValidationGroups ( ) , ti ) ) ; } catch ( Throwable t ) { throw new DeployException ( bundle . unableToCreateResourceAdapter ( raClz ) , t ) ; } }
Create resource adapter instance
444
4
14,913
protected void createAdminObject ( DeploymentBuilder builder , Connector connector , AdminObject ao ) throws DeployException { try { String aoClass = findAdminObject ( ao . getClassName ( ) , connector ) ; Class < ? > clz = Class . forName ( aoClass , true , builder . getClassLoader ( ) ) ; Object adminObject = clz . newInstance ( ) ; Collection < org . ironjacamar . common . api . metadata . spec . ConfigProperty > configProperties = findConfigProperties ( aoClass , connector ) ; Collection < org . ironjacamar . core . api . deploymentrepository . ConfigProperty > dcps = injectConfigProperties ( adminObject , configProperties , ao . getConfigProperties ( ) , builder . getClassLoader ( ) ) ; validationObj . add ( new ValidateClass ( Key . ADMIN_OBJECT , clz , configProperties ) ) ; org . ironjacamar . core . spi . statistics . StatisticsPlugin statisticsPlugin = null ; if ( adminObject instanceof org . ironjacamar . core . spi . statistics . Statistics ) statisticsPlugin = ( ( org . ironjacamar . core . spi . statistics . Statistics ) adminObject ) . getStatistics ( ) ; if ( builder . getResourceAdapter ( ) != null ) associateResourceAdapter ( builder . getResourceAdapter ( ) . getResourceAdapter ( ) , adminObject ) ; builder . adminObject ( new AdminObjectImpl ( ao . getJndiName ( ) , adminObject , dcps , ao , statisticsPlugin , jndiStrategy ) ) ; } catch ( Throwable t ) { throw new DeployException ( bundle . unableToCreateAdminObject ( ao . getId ( ) , ao . getJndiName ( ) ) , t ) ; } }
Create admin object instance
393
4
14,914
private String findManagedConnectionFactory ( String className , Connector connector ) { for ( org . ironjacamar . common . api . metadata . spec . ConnectionDefinition cd : connector . getResourceadapter ( ) . getOutboundResourceadapter ( ) . getConnectionDefinitions ( ) ) { if ( className . equals ( cd . getManagedConnectionFactoryClass ( ) . getValue ( ) ) || className . equals ( cd . getConnectionFactoryInterface ( ) . getValue ( ) ) ) return cd . getManagedConnectionFactoryClass ( ) . getValue ( ) ; } return className ; }
Find the ManagedConnectionFactory class
130
7
14,915
private String findAdminObject ( String className , Connector connector ) { for ( org . ironjacamar . common . api . metadata . spec . AdminObject ao : connector . getResourceadapter ( ) . getAdminObjects ( ) ) { if ( className . equals ( ao . getAdminobjectClass ( ) . getValue ( ) ) || className . equals ( ao . getAdminobjectInterface ( ) . getValue ( ) ) ) return ao . getAdminobjectClass ( ) . getValue ( ) ; } return className ; }
Find the AdminObject class
119
5
14,916
private Collection < org . ironjacamar . common . api . metadata . spec . ConfigProperty > findConfigProperties ( String className , Connector connector ) { for ( org . ironjacamar . common . api . metadata . spec . ConnectionDefinition cd : connector . getResourceadapter ( ) . getOutboundResourceadapter ( ) . getConnectionDefinitions ( ) ) { if ( className . equals ( cd . getManagedConnectionFactoryClass ( ) . getValue ( ) ) || className . equals ( cd . getConnectionFactoryInterface ( ) . getValue ( ) ) ) return cd . getConfigProperties ( ) ; } return null ; }
Find the config properties for the class
139
7
14,917
private Class < ? > convertType ( Class < ? > old ) { if ( Boolean . class . equals ( old ) ) { return boolean . class ; } else if ( boolean . class . equals ( old ) ) { return Boolean . class ; } else if ( Byte . class . equals ( old ) ) { return byte . class ; } else if ( byte . class . equals ( old ) ) { return Byte . class ; } else if ( Short . class . equals ( old ) ) { return short . class ; } else if ( short . class . equals ( old ) ) { return Short . class ; } else if ( Integer . class . equals ( old ) ) { return int . class ; } else if ( int . class . equals ( old ) ) { return Integer . class ; } else if ( Long . class . equals ( old ) ) { return long . class ; } else if ( long . class . equals ( old ) ) { return Long . class ; } else if ( Float . class . equals ( old ) ) { return float . class ; } else if ( float . class . equals ( old ) ) { return Float . class ; } else if ( Double . class . equals ( old ) ) { return double . class ; } else if ( double . class . equals ( old ) ) { return Double . class ; } else if ( Character . class . equals ( old ) ) { return char . class ; } else if ( char . class . equals ( old ) ) { return Character . class ; } return null ; }
Convert type if possible
322
5
14,918
private boolean isSupported ( Class < ? > t ) { if ( Boolean . class . equals ( t ) || boolean . class . equals ( t ) || Byte . class . equals ( t ) || byte . class . equals ( t ) || Short . class . equals ( t ) || short . class . equals ( t ) || Integer . class . equals ( t ) || int . class . equals ( t ) || Long . class . equals ( t ) || long . class . equals ( t ) || Float . class . equals ( t ) || float . class . equals ( t ) || Double . class . equals ( t ) || double . class . equals ( t ) || Character . class . equals ( t ) || char . class . equals ( t ) || String . class . equals ( t ) ) return true ; return false ; }
Is a support type
174
4
14,919
@ SuppressWarnings ( "unchecked" ) protected void associateResourceAdapter ( javax . resource . spi . ResourceAdapter resourceAdapter , Object object ) throws DeployException { if ( resourceAdapter != null && object != null && object instanceof ResourceAdapterAssociation ) { try { ResourceAdapterAssociation raa = ( ResourceAdapterAssociation ) object ; raa . setResourceAdapter ( resourceAdapter ) ; } catch ( Throwable t ) { throw new DeployException ( bundle . unableToAssociate ( object . getClass ( ) . getName ( ) ) , t ) ; } } }
Associate resource adapter with the object if it implements ResourceAdapterAssociation
126
14
14,920
private TransactionSupportEnum getTransactionSupport ( Connector connector , Activation activation ) { if ( activation . getTransactionSupport ( ) != null ) return activation . getTransactionSupport ( ) ; if ( connector . getResourceadapter ( ) . getOutboundResourceadapter ( ) != null ) return connector . getResourceadapter ( ) . getOutboundResourceadapter ( ) . getTransactionSupport ( ) ; // We have to assume XA for pure inbound, overrides is done with activation return TransactionSupportEnum . XATransaction ; }
Get the transaction support level
116
5
14,921
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . resourceadapter . ConnectionDefinition cd ) { if ( cd . getJndiName ( ) != null ) cmc . setJndiName ( cd . getJndiName ( ) ) ; if ( cd . isSharable ( ) != null ) cmc . setSharable ( cd . isSharable ( ) ) ; if ( cd . isEnlistment ( ) != null ) cmc . setEnlistment ( cd . isEnlistment ( ) ) ; if ( cd . isConnectable ( ) != null ) cmc . setConnectable ( cd . isConnectable ( ) ) ; if ( cd . isTracking ( ) != null ) cmc . setTracking ( cd . isTracking ( ) ) ; }
Apply connection definition to connection manager configuration
184
7
14,922
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . common . Security s ) { if ( s != null && s . getSecurityDomain ( ) != null ) { cmc . setSecurityDomain ( s . getSecurityDomain ( ) ) ; } }
Apply security to connection manager configuration
66
6
14,923
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . common . XaPool xp ) { if ( xp != null ) { if ( xp . isIsSameRmOverride ( ) != null ) cmc . setIsSameRMOverride ( xp . isIsSameRmOverride ( ) ) ; if ( xp . isPadXid ( ) != null ) cmc . setPadXid ( xp . isPadXid ( ) ) ; if ( xp . isWrapXaResource ( ) != null ) cmc . setWrapXAResource ( xp . isWrapXaResource ( ) ) ; } }
Apply xa - pool to connection manager configuration
147
9
14,924
private void applyConnectionManagerConfiguration ( ConnectionManagerConfiguration cmc , org . ironjacamar . common . api . metadata . common . Timeout t ) { if ( t != null ) { if ( t . getAllocationRetry ( ) != null ) cmc . setAllocationRetry ( t . getAllocationRetry ( ) ) ; if ( t . getAllocationRetryWaitMillis ( ) != null ) cmc . setAllocationRetryWaitMillis ( t . getAllocationRetryWaitMillis ( ) ) ; if ( t . getXaResourceTimeout ( ) != null ) cmc . setXAResourceTimeout ( t . getXaResourceTimeout ( ) ) ; } }
Apply timeout to connection manager configuration
153
6
14,925
private void applyPoolConfiguration ( PoolConfiguration pc , org . ironjacamar . common . api . metadata . common . Pool p ) { if ( p != null ) { if ( p . getMinPoolSize ( ) != null ) pc . setMinSize ( p . getMinPoolSize ( ) . intValue ( ) ) ; if ( p . getInitialPoolSize ( ) != null ) pc . setInitialSize ( p . getInitialPoolSize ( ) . intValue ( ) ) ; if ( p . getMaxPoolSize ( ) != null ) pc . setMaxSize ( p . getMaxPoolSize ( ) . intValue ( ) ) ; if ( p . isPrefill ( ) != null ) pc . setPrefill ( p . isPrefill ( ) . booleanValue ( ) ) ; if ( p . getFlushStrategy ( ) != null ) pc . setFlushStrategy ( p . getFlushStrategy ( ) ) ; } }
Apply pool to pool configuration
204
5
14,926
private void applyPoolConfiguration ( PoolConfiguration pc , org . ironjacamar . common . api . metadata . common . Timeout t ) { if ( t != null ) { if ( t . getBlockingTimeoutMillis ( ) != null ) pc . setBlockingTimeout ( t . getBlockingTimeoutMillis ( ) . longValue ( ) ) ; if ( t . getIdleTimeoutMinutes ( ) != null ) pc . setIdleTimeoutMinutes ( t . getIdleTimeoutMinutes ( ) . intValue ( ) ) ; } }
Apply timeout to pool configuration
118
5
14,927
private void applyPoolConfiguration ( PoolConfiguration pc , org . ironjacamar . common . api . metadata . common . Validation v ) { if ( v != null ) { if ( v . isValidateOnMatch ( ) != null ) pc . setValidateOnMatch ( v . isValidateOnMatch ( ) . booleanValue ( ) ) ; if ( v . isBackgroundValidation ( ) != null ) pc . setBackgroundValidation ( v . isBackgroundValidation ( ) . booleanValue ( ) ) ; if ( v . getBackgroundValidationMillis ( ) != null ) pc . setBackgroundValidationMillis ( v . getBackgroundValidationMillis ( ) . longValue ( ) ) ; if ( v . isUseFastFail ( ) != null ) pc . setUseFastFail ( v . isUseFastFail ( ) . booleanValue ( ) ) ; } }
Apply validation to pool configuration
187
5
14,928
private Map < String , ActivationSpecImpl > createInboundMapping ( InboundResourceAdapter ira , ClassLoader cl ) throws Exception { if ( ira != null ) { Map < String , ActivationSpecImpl > result = new HashMap <> ( ) ; for ( org . ironjacamar . common . api . metadata . spec . MessageListener ml : ira . getMessageadapter ( ) . getMessagelisteners ( ) ) { String type = ml . getMessagelistenerType ( ) . getValue ( ) ; org . ironjacamar . common . api . metadata . spec . Activationspec as = ml . getActivationspec ( ) ; String clzName = as . getActivationspecClass ( ) . getValue ( ) ; Class < ? > clz = Class . forName ( clzName , true , cl ) ; Map < String , Class < ? > > configProperties = createPropertyMap ( clz ) ; Set < String > requiredConfigProperties = new HashSet <> ( ) ; if ( as . getRequiredConfigProperties ( ) != null ) { for ( org . ironjacamar . common . api . metadata . spec . RequiredConfigProperty rcp : as . getRequiredConfigProperties ( ) ) { requiredConfigProperties . add ( rcp . getConfigPropertyName ( ) . getValue ( ) ) ; } } validationObj . add ( new ValidateClass ( Key . ACTIVATION_SPEC , clz , as . getConfigProperties ( ) ) ) ; ActivationSpecImpl asi = new ActivationSpecImpl ( clzName , configProperties , requiredConfigProperties ) ; if ( ! result . containsKey ( type ) ) result . put ( type , asi ) ; } return result ; } return null ; }
Create an inbound mapping
384
5
14,929
private Map < String , Class < ? > > createPropertyMap ( Class < ? > clz ) throws Exception { Map < String , Class < ? > > result = new HashMap <> ( ) ; for ( Method m : clz . getMethods ( ) ) { if ( m . getName ( ) . startsWith ( "set" ) ) { if ( m . getReturnType ( ) . equals ( Void . TYPE ) && m . getParameterCount ( ) == 1 && isSupported ( m . getParameterTypes ( ) [ 0 ] ) ) result . put ( m . getName ( ) . substring ( 3 ) , m . getParameterTypes ( ) [ 0 ] ) ; } } return result ; }
Get property map
152
3
14,930
private String getProductName ( Connector raXml ) { if ( raXml != null && ! XsdString . isNull ( raXml . getEisType ( ) ) ) return raXml . getEisType ( ) . getValue ( ) ; return "" ; }
Get the product name for the resource adapter
62
8
14,931
private String getProductVersion ( Connector raXml ) { if ( raXml != null && ! XsdString . isNull ( raXml . getResourceadapterVersion ( ) ) ) return raXml . getResourceadapterVersion ( ) . getValue ( ) ; return "" ; }
Get the product version for the resource adapter
64
8
14,932
private boolean is16 ( Connector connector ) { if ( connector == null || connector . getVersion ( ) == Connector . Version . V_16 || connector . getVersion ( ) == Connector . Version . V_17 ) return true ; return false ; }
Is a 1 . 6 + deployment
55
7
14,933
@ SuppressWarnings ( "unchecked" ) private void verifyBeanValidation ( Deployment deployment ) throws DeployException { if ( beanValidation != null ) { ValidatorFactory vf = null ; try { vf = beanValidation . getValidatorFactory ( ) ; javax . validation . Validator v = vf . getValidator ( ) ; Collection < String > l = deployment . getActivation ( ) . getBeanValidationGroups ( ) ; if ( l == null || l . isEmpty ( ) ) l = Arrays . asList ( javax . validation . groups . Default . class . getName ( ) ) ; Collection < Class < ? > > groups = new ArrayList <> ( ) ; for ( String clz : l ) { try { groups . add ( Class . forName ( clz , true , deployment . getClassLoader ( ) ) ) ; } catch ( ClassNotFoundException e ) { throw new DeployException ( bundle . unableToLoadBeanValidationGroup ( clz , deployment . getIdentifier ( ) ) , e ) ; } } Set failures = new HashSet ( ) ; if ( deployment . getResourceAdapter ( ) != null ) { Set f = v . validate ( deployment . getResourceAdapter ( ) . getResourceAdapter ( ) , groups . toArray ( new Class < ? > [ groups . size ( ) ] ) ) ; if ( ! f . isEmpty ( ) ) failures . addAll ( f ) ; } if ( deployment . getConnectionFactories ( ) != null ) { for ( org . ironjacamar . core . api . deploymentrepository . ConnectionFactory cf : deployment . getConnectionFactories ( ) ) { Set f = v . validate ( cf . getConnectionFactory ( ) , groups . toArray ( new Class < ? > [ groups . size ( ) ] ) ) ; if ( ! f . isEmpty ( ) ) failures . addAll ( f ) ; } } if ( deployment . getAdminObjects ( ) != null ) { for ( org . ironjacamar . core . api . deploymentrepository . AdminObject ao : deployment . getAdminObjects ( ) ) { Set f = v . validate ( ao . getAdminObject ( ) , groups . toArray ( new Class < ? > [ groups . size ( ) ] ) ) ; if ( ! f . isEmpty ( ) ) failures . addAll ( f ) ; } } if ( ! failures . isEmpty ( ) ) { throw new DeployException ( bundle . violationOfValidationRule ( deployment . getIdentifier ( ) ) , new ConstraintViolationException ( failures ) ) ; } } finally { if ( vf != null ) vf . close ( ) ; } } }
Verify deployment against bean validation
588
6
14,934
private void loadNativeLibraries ( File root ) { if ( root != null && root . exists ( ) ) { List < String > libs = new ArrayList < String > ( ) ; if ( root . isDirectory ( ) ) { if ( root . listFiles ( ) != null ) { for ( File f : root . listFiles ( ) ) { if ( f . isFile ( ) ) { String fileName = f . getName ( ) . toLowerCase ( Locale . US ) ; if ( fileName . endsWith ( ".a" ) || fileName . endsWith ( ".so" ) || fileName . endsWith ( ".dll" ) ) { libs . add ( f . getAbsolutePath ( ) ) ; } } } } else { log . debugf ( "Root is a directory, but there were an I/O error: %s" , root . getAbsolutePath ( ) ) ; } } if ( libs . size ( ) > 0 ) { for ( String lib : libs ) { try { SecurityActions . load ( lib ) ; log . debugf ( "Loaded library: %s" , lib ) ; } catch ( Throwable t ) { log . debugf ( "Unable to load library: %s" , lib ) ; } } } else { log . debugf ( "No native libraries for %s" , root . getAbsolutePath ( ) ) ; } } }
Load native libraries
307
3
14,935
protected boolean hasFailuresLevel ( Collection < Failure > failures , int severity ) { if ( failures != null ) { for ( Failure failure : failures ) { if ( failure . getSeverity ( ) == severity ) { return true ; } } } return false ; }
Check for failures at a certain level
56
7
14,936
public String printFailuresLog ( Validator validator , Collection < Failure > failures , FailureHelper ... fhInput ) { String errorText = "" ; FailureHelper fh = null ; if ( fhInput . length == 0 ) fh = new FailureHelper ( failures ) ; else fh = fhInput [ 0 ] ; if ( failures != null && failures . size ( ) > 0 ) { errorText = fh . asText ( validator . getResourceBundle ( ) ) ; } return errorText ; }
print Failures into Log files .
111
7
14,937
private void resetXAResourceTimeout ( ) { // Do a reset of the underlying XAResource timeout if ( ! ( xaResource instanceof LocalXAResource ) && xaResourceTimeout > 0 ) { try { xaResource . setTransactionTimeout ( xaResourceTimeout ) ; } catch ( XAException e ) { log . debugf ( e , "Exception during resetXAResourceTimeout for %s" , this ) ; } } }
Reset XAResource timeout
99
7
14,938
@ Override public void process ( Map < String , String > varMap , Writer out ) { try { if ( templateText == null ) { templateText = Utils . readFileIntoString ( input ) ; } String replacedString = replace ( varMap ) ; out . write ( replacedString ) ; out . flush ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Processes the template
89
4
14,939
public String replace ( Map < String , String > varMap ) { StringBuilder newString = new StringBuilder ( ) ; int p = 0 ; int p0 = 0 ; while ( true ) { p = templateText . indexOf ( "${" , p ) ; if ( p == - 1 ) { newString . append ( templateText . substring ( p0 , templateText . length ( ) ) ) ; break ; } else { newString . append ( templateText . substring ( p0 , p ) ) ; } p0 = p ; p = templateText . indexOf ( "}" , p ) ; if ( p != - 1 ) { String varName = templateText . substring ( p0 + 2 , p ) . trim ( ) ; if ( varMap . containsKey ( varName ) ) { newString . append ( varMap . get ( varName ) ) ; p0 = p + 1 ; } } } return newString . toString ( ) ; }
Replace string in the template text
207
7
14,940
public Collection < ConnectionFactory > getConnectionFactories ( ) { if ( connectionFactories == null ) return Collections . emptyList ( ) ; return Collections . unmodifiableCollection ( connectionFactories ) ; }
Get connection factories
43
3
14,941
public DeploymentBuilder connectionFactory ( ConnectionFactory v ) { if ( connectionFactories == null ) connectionFactories = new ArrayList < ConnectionFactory > ( ) ; connectionFactories . add ( v ) ; return this ; }
Add connection factory
47
3
14,942
public Collection < AdminObject > getAdminObjects ( ) { if ( adminObjects == null ) return Collections . emptyList ( ) ; return Collections . unmodifiableCollection ( adminObjects ) ; }
Get admin objects
43
3
14,943
public DeploymentBuilder adminObject ( AdminObject v ) { if ( adminObjects == null ) adminObjects = new ArrayList < AdminObject > ( ) ; adminObjects . add ( v ) ; return this ; }
Add admin object
47
3
14,944
protected Boolean attributeAsBoolean ( XMLStreamReader reader , String attributeName , Boolean defaultValue , Map < String , String > expressions ) throws XMLStreamException , ParserException { String attributeString = rawAttributeText ( reader , attributeName ) ; if ( attributeName != null && expressions != null && attributeString != null && attributeString . indexOf ( "${" ) != - 1 ) expressions . put ( attributeName , attributeString ) ; String stringValue = getSubstitutionValue ( attributeString ) ; if ( StringUtils . isEmpty ( stringValue ) || stringValue . trim ( ) . equalsIgnoreCase ( "true" ) || stringValue . trim ( ) . equalsIgnoreCase ( "false" ) ) { return StringUtils . isEmpty ( stringValue ) ? defaultValue : Boolean . valueOf ( stringValue . trim ( ) ) ; } else { throw new ParserException ( bundle . attributeAsBoolean ( attributeString , reader . getLocalName ( ) ) ) ; } }
convert an xml attribute in boolean value . Empty elements results in default value
212
15
14,945
private String rawAttributeText ( XMLStreamReader reader , String attributeName ) { String attributeString = reader . getAttributeValue ( "" , attributeName ) ; if ( attributeString == null ) return null ; return attributeString . trim ( ) ; }
Read the raw attribute
51
4
14,946
protected Integer elementAsInteger ( XMLStreamReader reader , String key , Map < String , String > expressions ) throws XMLStreamException , ParserException { Integer integerValue = null ; String elementtext = rawElementText ( reader ) ; if ( key != null && expressions != null && elementtext != null && elementtext . indexOf ( "${" ) != - 1 ) expressions . put ( key , elementtext ) ; try { integerValue = Integer . valueOf ( getSubstitutionValue ( elementtext ) ) ; } catch ( NumberFormatException nfe ) { throw new ParserException ( bundle . notValidNumber ( elementtext , reader . getLocalName ( ) ) ) ; } return integerValue ; }
convert an xml element in Integer value
148
8
14,947
protected Long elementAsLong ( XMLStreamReader reader , String key , Map < String , String > expressions ) throws XMLStreamException , ParserException { Long longValue = null ; String elementtext = rawElementText ( reader ) ; if ( key != null && expressions != null && elementtext != null && elementtext . indexOf ( "${" ) != - 1 ) expressions . put ( key , elementtext ) ; try { longValue = Long . valueOf ( getSubstitutionValue ( elementtext ) ) ; } catch ( NumberFormatException nfe ) { throw new ParserException ( bundle . notValidNumber ( elementtext , reader . getLocalName ( ) ) ) ; } return longValue ; }
convert an xml element in Long value
148
8
14,948
protected FlushStrategy elementAsFlushStrategy ( XMLStreamReader reader , Map < String , String > expressions ) throws XMLStreamException , ParserException { String elementtext = rawElementText ( reader ) ; if ( expressions != null && elementtext != null && elementtext . indexOf ( "${" ) != - 1 ) expressions . put ( CommonXML . ELEMENT_FLUSH_STRATEGY , elementtext ) ; FlushStrategy result = FlushStrategy . forName ( getSubstitutionValue ( elementtext ) ) ; if ( result != FlushStrategy . UNKNOWN ) return result ; throw new ParserException ( bundle . notValidFlushStrategy ( elementtext ) ) ; }
convert an xml element in FlushStrategy value
152
11
14,949
protected Capacity parseCapacity ( XMLStreamReader reader ) throws XMLStreamException , ParserException , ValidateException { Extension incrementer = null ; Extension decrementer = null ; while ( reader . hasNext ( ) ) { switch ( reader . nextTag ( ) ) { case END_ELEMENT : { switch ( reader . getLocalName ( ) ) { case CommonXML . ELEMENT_CAPACITY : return new CapacityImpl ( incrementer , decrementer ) ; default : break ; } } case START_ELEMENT : { switch ( reader . getLocalName ( ) ) { case CommonXML . ELEMENT_INCREMENTER : { incrementer = parseExtension ( reader , CommonXML . ELEMENT_INCREMENTER ) ; break ; } case CommonXML . ELEMENT_DECREMENTER : { decrementer = parseExtension ( reader , CommonXML . ELEMENT_DECREMENTER ) ; break ; } default : // Nothing } break ; } default : throw new ParserException ( bundle . unexpectedElement ( reader . getLocalName ( ) ) ) ; } } throw new ParserException ( bundle . unexpectedEndOfDocument ( ) ) ; }
Parse capacity tag
255
4
14,950
public static List < TraceEvent > filterPoolEvents ( List < TraceEvent > data ) throws Exception { List < TraceEvent > result = new ArrayList < TraceEvent > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_GET || te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_PREFILL || te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_INCREMENTER || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_RETURN || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_IDLE || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_INVALID || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_FLUSH || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_ERROR || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_PREFILL || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_INCREMENTER || te . getType ( ) == TraceEvent . MANAGED_CONNECTION_POOL_CREATE || te . getType ( ) == TraceEvent . MANAGED_CONNECTION_POOL_DESTROY || te . getType ( ) == TraceEvent . PUSH_CCM_CONTEXT || te . getType ( ) == TraceEvent . POP_CCM_CONTEXT || te . getType ( ) == TraceEvent . REGISTER_CCM_CONNECTION || te . getType ( ) == TraceEvent . UNREGISTER_CCM_CONNECTION || te . getType ( ) == TraceEvent . CCM_USER_TRANSACTION || te . getType ( ) == TraceEvent . UNKNOWN_CCM_CONNECTION || te . getType ( ) == TraceEvent . CLOSE_CCM_CONNECTION || te . getType ( ) == TraceEvent . VERSION ) continue ; result . add ( te ) ; } return result ; }
Filter the pool events
514
4
14,951
public static Map < String , List < TraceEvent > > filterLifecycleEvents ( List < TraceEvent > data ) throws Exception { Map < String , List < TraceEvent > > result = new TreeMap < String , List < TraceEvent > > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_GET || te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_PREFILL || te . getType ( ) == TraceEvent . CREATE_CONNECTION_LISTENER_INCREMENTER || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_RETURN || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_IDLE || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_INVALID || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_FLUSH || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_ERROR || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_PREFILL || te . getType ( ) == TraceEvent . DESTROY_CONNECTION_LISTENER_INCREMENTER || te . getType ( ) == TraceEvent . MANAGED_CONNECTION_POOL_CREATE || te . getType ( ) == TraceEvent . MANAGED_CONNECTION_POOL_DESTROY ) { List < TraceEvent > l = result . get ( te . getPool ( ) ) ; if ( l == null ) l = new ArrayList < TraceEvent > ( ) ; l . add ( te ) ; result . put ( te . getPool ( ) , l ) ; } } return result ; }
Filter the lifecycle events
432
5
14,952
public static List < TraceEvent > filterCCMEvents ( List < TraceEvent > data ) throws Exception { List < TraceEvent > result = new ArrayList < TraceEvent > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . PUSH_CCM_CONTEXT || te . getType ( ) == TraceEvent . POP_CCM_CONTEXT ) { result . add ( te ) ; } } return result ; }
Filter the CCM events
102
5
14,953
public static Map < String , List < TraceEvent > > filterCCMPoolEvents ( List < TraceEvent > data ) throws Exception { Map < String , List < TraceEvent > > result = new TreeMap < String , List < TraceEvent > > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . REGISTER_CCM_CONNECTION || te . getType ( ) == TraceEvent . UNREGISTER_CCM_CONNECTION || te . getType ( ) == TraceEvent . CCM_USER_TRANSACTION || te . getType ( ) == TraceEvent . UNKNOWN_CCM_CONNECTION || te . getType ( ) == TraceEvent . CLOSE_CCM_CONNECTION ) { List < TraceEvent > l = result . get ( te . getPool ( ) ) ; if ( l == null ) l = new ArrayList < TraceEvent > ( ) ; l . add ( te ) ; result . put ( te . getPool ( ) , l ) ; } } return result ; }
Filter the CCM pool events
231
6
14,954
public static Map < String , Set < String > > poolManagedConnectionPools ( List < TraceEvent > data ) throws Exception { Map < String , Set < String > > result = new TreeMap < String , Set < String > > ( ) ; for ( TraceEvent te : data ) { if ( te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER_NEW || te . getType ( ) == TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER_NEW ) { Set < String > s = result . get ( te . getPool ( ) ) ; if ( s == null ) s = new TreeSet < String > ( ) ; s . add ( te . getManagedConnectionPool ( ) ) ; result . put ( te . getPool ( ) , s ) ; } } return result ; }
Pool to Managed Connection Pools mapping
229
8
14,955
public static List < TraceEvent > getEvents ( FileReader fr , File directory ) throws Exception { return getEvents ( getData ( fr , directory ) ) ; }
Get the events
34
3
14,956
public static boolean isStartState ( TraceEvent te ) { if ( te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . GET_CONNECTION_LISTENER_NEW || te . getType ( ) == TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER_NEW || te . getType ( ) == TraceEvent . CLEAR_CONNECTION_LISTENER ) return true ; return false ; }
Is start state
136
3
14,957
public static boolean isEndState ( TraceEvent te ) { if ( te . getType ( ) == TraceEvent . RETURN_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . RETURN_CONNECTION_LISTENER_WITH_KILL || te . getType ( ) == TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER || te . getType ( ) == TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL || te . getType ( ) == TraceEvent . CLEAR_CONNECTION_LISTENER ) return true ; return false ; }
Is end state
148
3
14,958
public static Map < String , List < Interaction > > getConnectionListenerData ( List < Interaction > data ) { Map < String , List < Interaction > > result = new TreeMap < String , List < Interaction > > ( ) ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { Interaction interaction = data . get ( i ) ; List < Interaction > l = result . get ( interaction . getConnectionListener ( ) ) ; if ( l == null ) l = new ArrayList < Interaction > ( ) ; l . add ( interaction ) ; result . put ( interaction . getConnectionListener ( ) , l ) ; } return result ; }
Get a connection listener map
147
5
14,959
public static boolean hasException ( List < TraceEvent > events ) { for ( TraceEvent te : events ) { if ( te . getType ( ) == TraceEvent . EXCEPTION ) return true ; } return false ; }
Has an exception event
47
4
14,960
public static String exceptionDescription ( String encoded ) { char [ ] data = encoded . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < data . length ; i ++ ) { char c = data [ i ] ; if ( c == ' ' ) { sb = sb . append ( ' ' ) ; } else if ( c == ' ' ) { sb = sb . append ( ' ' ) ; } else if ( c == ' ' ) { sb = sb . append ( ' ' ) ; } else if ( c == ' ' ) { sb = sb . append ( ' ' ) ; } else { sb = sb . append ( c ) ; } } return sb . toString ( ) ; }
Get exception description
171
3
14,961
public static String prettyPrint ( TraceEvent te ) { if ( te . getType ( ) != TraceEvent . GET_CONNECTION_LISTENER && te . getType ( ) != TraceEvent . GET_CONNECTION_LISTENER_NEW && te . getType ( ) != TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER && te . getType ( ) != TraceEvent . GET_INTERLEAVING_CONNECTION_LISTENER_NEW && te . getType ( ) != TraceEvent . RETURN_CONNECTION_LISTENER && te . getType ( ) != TraceEvent . RETURN_CONNECTION_LISTENER_WITH_KILL && te . getType ( ) != TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER && te . getType ( ) != TraceEvent . RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL && te . getType ( ) != TraceEvent . CREATE_CONNECTION_LISTENER_GET && te . getType ( ) != TraceEvent . CREATE_CONNECTION_LISTENER_PREFILL && te . getType ( ) != TraceEvent . CREATE_CONNECTION_LISTENER_INCREMENTER && te . getType ( ) != TraceEvent . DESTROY_CONNECTION_LISTENER_RETURN && te . getType ( ) != TraceEvent . DESTROY_CONNECTION_LISTENER_IDLE && te . getType ( ) != TraceEvent . DESTROY_CONNECTION_LISTENER_INVALID && te . getType ( ) != TraceEvent . DESTROY_CONNECTION_LISTENER_FLUSH && te . getType ( ) != TraceEvent . DESTROY_CONNECTION_LISTENER_ERROR && te . getType ( ) != TraceEvent . DESTROY_CONNECTION_LISTENER_PREFILL && te . getType ( ) != TraceEvent . DESTROY_CONNECTION_LISTENER_INCREMENTER && te . getType ( ) != TraceEvent . EXCEPTION && te . getType ( ) != TraceEvent . PUSH_CCM_CONTEXT && te . getType ( ) != TraceEvent . POP_CCM_CONTEXT ) return te . toString ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "IJTRACER" ) ; sb . append ( "-" ) ; sb . append ( te . getPool ( ) ) ; sb . append ( "-" ) ; sb . append ( te . getManagedConnectionPool ( ) ) ; sb . append ( "-" ) ; sb . append ( te . getThreadId ( ) ) ; sb . append ( "-" ) ; sb . append ( te . getType ( ) ) ; sb . append ( "-" ) ; sb . append ( te . getTimestamp ( ) ) ; sb . append ( "-" ) ; sb . append ( te . getConnectionListener ( ) ) ; sb . append ( "-" ) ; sb . append ( "DATA" ) ; return sb . toString ( ) ; }
Pretty print event
715
3
14,962
public static TraceEvent getVersion ( List < TraceEvent > events ) { for ( TraceEvent te : events ) { if ( te . getType ( ) == TraceEvent . VERSION ) return te ; } return null ; }
Get the version
47
3
14,963
static boolean hasMoreApplicationEvents ( List < TraceEvent > events , int index ) { if ( index < 0 || index >= events . size ( ) ) return false ; for ( int j = index ; j < events . size ( ) ; j ++ ) { TraceEvent te = events . get ( j ) ; if ( te . getType ( ) == TraceEvent . GET_CONNECTION || te . getType ( ) == TraceEvent . RETURN_CONNECTION ) return true ; } return false ; }
Has more application events
108
4
14,964
private Collection < FrameworkMethod > filterAndSort ( List < FrameworkMethod > fms , boolean isStatic ) throws Exception { SortedMap < Integer , FrameworkMethod > m = new TreeMap <> ( ) ; for ( FrameworkMethod fm : fms ) { SecurityActions . setAccessible ( fm . getMethod ( ) ) ; if ( Modifier . isStatic ( fm . getMethod ( ) . getModifiers ( ) ) == isStatic ) { Deployment deployment = ( Deployment ) fm . getAnnotation ( Deployment . class ) ; int order = deployment . order ( ) ; if ( order <= 0 || m . containsKey ( Integer . valueOf ( order ) ) ) throw new Exception ( "Incorrect order definition '" + order + "' on " + fm . getDeclaringClass ( ) . getName ( ) + "#" + fm . getName ( ) ) ; m . put ( Integer . valueOf ( order ) , fm ) ; } } return m . values ( ) ; }
Filter and sort
220
3
14,965
private Object [ ] getParameters ( FrameworkMethod fm ) { Method m = fm . getMethod ( ) ; SecurityActions . setAccessible ( m ) ; Class < ? > [ ] parameters = m . getParameterTypes ( ) ; Annotation [ ] [ ] parameterAnnotations = m . getParameterAnnotations ( ) ; Object [ ] result = new Object [ parameters . length ] ; for ( int i = 0 ; i < parameters . length ; i ++ ) { Annotation [ ] parameterAnnotation = parameterAnnotations [ i ] ; boolean inject = false ; String name = null ; for ( int j = 0 ; j < parameterAnnotation . length ; j ++ ) { Annotation a = parameterAnnotation [ j ] ; if ( javax . inject . Inject . class . equals ( a . annotationType ( ) ) ) { inject = true ; } else if ( javax . inject . Named . class . equals ( a . annotationType ( ) ) ) { name = ( ( javax . inject . Named ) a ) . value ( ) ; } } if ( inject ) { result [ i ] = resolveBean ( name != null ? name : parameters [ i ] . getSimpleName ( ) , parameters [ i ] ) ; } else { result [ i ] = null ; } } return result ; }
Get parameter values for a method
282
6
14,966
private Object resolveBean ( String name , Class < ? > type ) { try { return embedded . lookup ( name , type ) ; } catch ( Throwable t ) { return null ; } }
Resolve a bean
41
4
14,967
static void setAccessible ( final Method m , final boolean value ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { m . setAccessible ( value ) ; return null ; } } ) ; }
Invoke setAccessible on a method
55
8
14,968
private void writeVars ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/** JNDI name */\n" ) ; writeWithIndent ( out , indent , "private static final String JNDI_NAME = \"java:/eis/" + def . getDefaultValue ( ) + "\";\n\n" ) ; writeWithIndent ( out , indent , "/** MBeanServer instance */\n" ) ; writeWithIndent ( out , indent , "private MBeanServer mbeanServer;\n\n" ) ; writeWithIndent ( out , indent , "/** Object Name */\n" ) ; writeWithIndent ( out , indent , "private String objectName;\n\n" ) ; writeWithIndent ( out , indent , "/** The actual ObjectName instance */\n" ) ; writeWithIndent ( out , indent , "private ObjectName on;\n\n" ) ; writeWithIndent ( out , indent , "/** Registered */\n" ) ; writeWithIndent ( out , indent , "private boolean registered;\n\n" ) ; }
Output class vars
258
4
14,969
private void writeMethods ( Definition def , Writer out , int indent ) throws IOException { if ( def . getMcfDefs ( ) . get ( 0 ) . isDefineMethodInConnection ( ) ) { if ( def . getMcfDefs ( ) . get ( 0 ) . getMethods ( ) . size ( ) > 0 ) { for ( MethodForConnection method : def . getMcfDefs ( ) . get ( 0 ) . getMethods ( ) ) { writeMethodSignature ( out , indent , method ) ; writeLeftCurlyBracket ( out , indent ) ; writeIndent ( out , indent + 1 ) ; if ( ! method . getReturnType ( ) . equals ( "void" ) ) { out . write ( "return " ) ; } out . write ( "getConnection()." + method . getMethodName ( ) + "(" ) ; int paramSize = method . getParams ( ) . size ( ) ; for ( int i = 0 ; i < paramSize ; i ++ ) { MethodParam param = method . getParams ( ) . get ( i ) ; out . write ( param . getName ( ) ) ; if ( i + 1 < paramSize ) out . write ( ", " ) ; } out . write ( ");\n" ) ; writeRightCurlyBracket ( out , indent ) ; } } } else { writeSimpleMethodSignature ( out , indent , " * Call me" , "public void callMe()" ) ; writeLeftCurlyBracket ( out , indent ) ; writeWithIndent ( out , indent + 1 , "try" ) ; writeLeftCurlyBracket ( out , indent + 1 ) ; writeWithIndent ( out , indent + 2 , "getConnection().callMe();" ) ; writeRightCurlyBracket ( out , indent + 1 ) ; writeWithIndent ( out , indent + 1 , "catch (Exception e)" ) ; writeLeftCurlyBracket ( out , indent + 1 ) ; writeRightCurlyBracket ( out , indent + 1 ) ; writeRightCurlyBracket ( out , indent ) ; } }
Output defined methods
458
3
14,970
private void writeGetConnection ( Definition def , Writer out , int indent ) throws IOException { String connInterface = def . getMcfDefs ( ) . get ( 0 ) . getConnInterfaceClass ( ) ; String cfInterface = def . getMcfDefs ( ) . get ( 0 ) . getCfInterfaceClass ( ) ; writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * GetConnection\n" ) ; writeWithIndent ( out , indent , " * @return " + connInterface ) ; writeEol ( out ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "private " + connInterface + " getConnection() throws Exception" ) ; writeLeftCurlyBracket ( out , indent ) ; writeWithIndent ( out , indent + 1 , "InitialContext context = new InitialContext();\n" ) ; writeIndent ( out , indent + 1 ) ; out . write ( cfInterface + " factory = (" + cfInterface + ")context.lookup(JNDI_NAME);\n" ) ; writeIndent ( out , indent + 1 ) ; out . write ( connInterface + " conn = factory.getConnection();\n" ) ; writeWithIndent ( out , indent + 1 , "if (conn == null)" ) ; writeLeftCurlyBracket ( out , indent + 1 ) ; writeIndent ( out , indent + 2 ) ; out . write ( "throw new RuntimeException(\"No connection\");" ) ; writeRightCurlyBracket ( out , indent + 1 ) ; writeWithIndent ( out , indent + 1 , "return conn;" ) ; writeRightCurlyBracket ( out , indent ) ; }
Output getConnection method
392
4
14,971
public Timer createTimer ( ) { Timer t = new Timer ( true ) ; if ( timers == null ) timers = new ArrayList < Timer > ( ) ; timers . add ( t ) ; return t ; }
Create a timer
48
3
14,972
public boolean isContextSupported ( Class < ? extends WorkContext > workContextClass ) { if ( workContextClass == null ) return false ; return supportedContexts . contains ( workContextClass ) ; }
Is the work context supported ?
42
6
14,973
void writeConfigPropsXml ( List < ConfigPropType > props , Writer out , int indent ) throws IOException { if ( props == null || props . size ( ) == 0 ) return ; for ( ConfigPropType prop : props ) { writeIndent ( out , indent ) ; out . write ( "<config-property>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 1 ) ; out . write ( "<config-property-name>" + prop . getName ( ) + "</config-property-name>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 1 ) ; out . write ( "<config-property-type>java.lang." + prop . getType ( ) + "</config-property-type>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 1 ) ; out . write ( "<config-property-value>" + prop . getValue ( ) + "</config-property-value>" ) ; writeEol ( out ) ; writeIndent ( out , indent ) ; out . write ( "</config-property>" ) ; writeEol ( out ) ; writeEol ( out ) ; } }
Output config props xml part
261
5
14,974
void writeRequireConfigPropsXml ( List < ConfigPropType > props , Writer out , int indent ) throws IOException { if ( props == null || props . size ( ) == 0 ) return ; for ( ConfigPropType prop : props ) { if ( prop . isRequired ( ) ) { writeIndent ( out , indent ) ; out . write ( "<required-config-property>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 1 ) ; out . write ( "<config-property-name>" + prop . getName ( ) + "</config-property-name>" ) ; writeEol ( out ) ; writeIndent ( out , indent ) ; out . write ( "</required-config-property>" ) ; writeEol ( out ) ; } } writeEol ( out ) ; }
Output required config props xml part
180
6
14,975
private void writeInbound ( Definition def , Writer out , int indent ) throws IOException { writeIndent ( out , indent ) ; out . write ( "<inbound-resourceadapter>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 1 ) ; out . write ( "<messageadapter>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 2 ) ; out . write ( "<messagelistener>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 3 ) ; if ( ! def . isDefaultPackageInbound ( ) ) { out . write ( "<messagelistener-type>" + def . getMlClass ( ) + "</messagelistener-type>" ) ; } else { out . write ( "<messagelistener-type>" + def . getRaPackage ( ) + ".inflow." + def . getMlClass ( ) + "</messagelistener-type>" ) ; } writeEol ( out ) ; writeIndent ( out , indent + 3 ) ; out . write ( "<activationspec>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 4 ) ; out . write ( "<activationspec-class>" + def . getRaPackage ( ) + ".inflow." + def . getAsClass ( ) + "</activationspec-class>" ) ; writeEol ( out ) ; writeAsConfigPropsXml ( def . getAsConfigProps ( ) , out , indent + 4 ) ; writeIndent ( out , indent + 3 ) ; out . write ( "</activationspec>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 2 ) ; out . write ( "</messagelistener>" ) ; writeEol ( out ) ; writeIndent ( out , indent + 1 ) ; out . write ( "</messageadapter>" ) ; writeEol ( out ) ; writeIndent ( out , indent ) ; out . write ( "</inbound-resourceadapter>" ) ; writeEol ( out ) ; }
Output inbound xml part
461
5
14,976
public static void main ( String [ ] args ) { String outputDir = "out" ; //default output directory String defxml = null ; int arg = 0 ; if ( args . length > 0 ) { while ( args . length > arg + 1 ) { if ( args [ arg ] . startsWith ( "-" ) ) { if ( args [ arg ] . equals ( "-o" ) ) { arg ++ ; if ( arg >= args . length ) { usage ( ) ; System . exit ( OTHER ) ; } outputDir = args [ arg ] ; } else if ( args [ arg ] . equals ( "-f" ) ) { arg ++ ; if ( arg >= args . length ) { usage ( ) ; System . exit ( OTHER ) ; } defxml = args [ arg ] ; } } else { usage ( ) ; System . exit ( OTHER ) ; } arg ++ ; } } try { File out = new File ( outputDir ) ; Utils . recursiveDelete ( out ) ; Definition def ; if ( defxml == null ) def = inputFromCommandLine ( ) ; else def = inputFromXml ( defxml ) ; if ( def == null ) System . exit ( ERROR ) ; def . setOutputDir ( outputDir ) ; Profile profile ; switch ( def . getVersion ( ) ) { case "1.7" : profile = new JCA17Profile ( ) ; break ; case "1.6" : profile = new JCA16Profile ( ) ; break ; case "1.5" : profile = new JCA15Profile ( ) ; break ; default : profile = new JCA10Profile ( ) ; break ; } profile . generate ( def ) ; if ( def . getBuild ( ) . equals ( "ant" ) ) copyAllJars ( outputDir ) ; System . out . println ( rb . getString ( "code.wrote" ) ) ; System . exit ( SUCCESS ) ; } catch ( IOException | JAXBException e ) { e . printStackTrace ( ) ; } }
Code generator stand alone tool
431
5
14,977
private static Definition inputFromXml ( String defxml ) throws IOException , JAXBException { JAXBContext context = JAXBContext . newInstance ( "org.ironjacamar.codegenerator" ) ; Unmarshaller unmarshaller = context . createUnmarshaller ( ) ; return ( Definition ) unmarshaller . unmarshal ( new File ( defxml ) ) ; }
input from xml file
93
4
14,978
private static void setDefaultValue ( Definition def , String className , String stringValue ) { if ( className . endsWith ( stringValue ) ) def . setDefaultValue ( className . substring ( 0 , className . length ( ) - stringValue . length ( ) ) ) ; }
check defalut value and set it
62
8
14,979
private static void copyAllJars ( String outputDir ) throws IOException { File out = new File ( outputDir ) ; String targetPath = out . getAbsolutePath ( ) + File . separatorChar + "lib" ; File current = new File ( "." ) ; String path = current . getCanonicalPath ( ) ; String libPath = path + File . separatorChar + ".." + File . separatorChar + ".." + File . separatorChar + "lib" ; Utils . copyFolder ( libPath , targetPath , "jar" , false ) ; }
copy all jars
128
3
14,980
private static Properties loadProperties ( ) { Properties properties = new Properties ( ) ; boolean loaded = false ; String sysProperty = SecurityActions . getSystemProperty ( "ironjacamar.options" ) ; if ( sysProperty != null && ! sysProperty . equals ( "" ) ) { File file = new File ( sysProperty ) ; if ( file . exists ( ) ) { FileInputStream fis = null ; try { fis = new FileInputStream ( file ) ; properties . load ( fis ) ; loaded = true ; } catch ( Throwable t ) { // Ignore } finally { if ( fis != null ) { try { fis . close ( ) ; } catch ( IOException ioe ) { //No op } } } } } if ( ! loaded ) { File file = new File ( IRONJACAMAR_PROPERTIES ) ; if ( file . exists ( ) ) { FileInputStream fis = null ; try { fis = new FileInputStream ( file ) ; properties . load ( fis ) ; loaded = true ; } catch ( Throwable t ) { // Ignore } finally { if ( fis != null ) { try { fis . close ( ) ; } catch ( IOException ioe ) { //No op } } } } } if ( ! loaded ) { InputStream is = null ; try { ClassLoader cl = Main . class . getClassLoader ( ) ; is = cl . getResourceAsStream ( IRONJACAMAR_PROPERTIES ) ; properties . load ( is ) ; loaded = true ; } catch ( Throwable t ) { // Ignore } finally { if ( is != null ) { try { is . close ( ) ; } catch ( IOException ioe ) { // Nothing to do } } } } return properties ; }
Load configuration values specified from either a file or the classloader
383
12
14,981
private static String configurationString ( Properties properties , String key , String defaultValue ) { if ( properties != null ) { return properties . getProperty ( key , defaultValue ) ; } return defaultValue ; }
Get configuration string
42
3
14,982
private static boolean configurationBoolean ( Properties properties , String key , boolean defaultValue ) { if ( properties != null ) { if ( properties . containsKey ( key ) ) return Boolean . valueOf ( properties . getProperty ( key ) ) ; } return defaultValue ; }
Get configuration boolean
56
3
14,983
private static int configurationInteger ( Properties properties , String key , int defaultValue ) { if ( properties != null ) { if ( properties . containsKey ( key ) ) return Integer . valueOf ( properties . getProperty ( key ) ) ; } return defaultValue ; }
Get configuration integer
55
3
14,984
private static void applySystemProperties ( Properties properties ) { if ( properties != null ) { for ( Map . Entry < Object , Object > entry : properties . entrySet ( ) ) { String key = ( String ) entry . getKey ( ) ; if ( key . startsWith ( "system.property." ) ) { key = key . substring ( 16 ) ; SecurityActions . setSystemProperty ( key , ( String ) entry . getValue ( ) ) ; } } } }
Apply any defined system properties
102
5
14,985
public void setResourceAdapterClassLoader ( ResourceAdapterClassLoader v ) { if ( trace ) log . tracef ( "%s: setResourceAdapterClassLoader(%s)" , Integer . toHexString ( System . identityHashCode ( this ) ) , v ) ; resourceAdapterClassLoader = v ; }
Set the resource adapter class loader
65
6
14,986
private static void bind ( Context ctx , Name name , Object value ) throws NamingException { int size = name . size ( ) ; String atom = name . get ( size - 1 ) ; Context parentCtx = createSubcontext ( ctx , name . getPrefix ( size - 1 ) ) ; parentCtx . bind ( atom , value ) ; }
Bind val to name in ctx and make sure that all intermediate contexts exist
77
15
14,987
public void startTransaction ( ) { Long key = Long . valueOf ( Thread . currentThread ( ) . getId ( ) ) ; TransactionImpl tx = txs . get ( key ) ; if ( tx == null ) { TransactionImpl newTx = new TransactionImpl ( key ) ; tx = txs . putIfAbsent ( key , newTx ) ; if ( tx == null ) tx = newTx ; } tx . active ( ) ; }
Start a transaction
94
3
14,988
public void commitTransaction ( ) throws SystemException { Long key = Long . valueOf ( Thread . currentThread ( ) . getId ( ) ) ; TransactionImpl tx = txs . get ( key ) ; if ( tx != null ) { try { tx . commit ( ) ; } catch ( Throwable t ) { SystemException se = new SystemException ( "Error during commit" ) ; se . initCause ( t ) ; throw se ; } } else { throw new IllegalStateException ( "No transaction to commit" ) ; } }
Commit a transaction
112
4
14,989
public void assignTransaction ( TransactionImpl v ) { txs . put ( Long . valueOf ( Thread . currentThread ( ) . getId ( ) ) , v ) ; }
Assign a transaction
37
4
14,990
public static ClassLoader getClassLoader ( final Class < ? > c ) { if ( System . getSecurityManager ( ) == null ) return c . getClassLoader ( ) ; return AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { public ClassLoader run ( ) { return c . getClassLoader ( ) ; } } ) ; }
Get the classloader .
77
5
14,991
public static String restoreExpression ( Map < String , String > m , String key , String subkey , String v ) { String k = key ; if ( subkey != null ) { if ( ! isIncorrectExpression ( subkey ) && subkey . startsWith ( "${" ) ) { subkey = subkey . substring ( 2 , subkey . length ( ) - 1 ) ; if ( subkey . indexOf ( ":" ) != - 1 ) subkey = subkey . substring ( 0 , subkey . indexOf ( ":" ) ) ; } k += "|" + subkey ; } return substituteValueInExpression ( m . get ( k ) , v ) ; }
Restores expression with substituted default value
150
7
14,992
public static String substituteValueInExpression ( String expression , String newValue ) { ExpressionTemplate t = new ExpressionTemplate ( expression ) ; if ( newValue != null && ( getExpressionKey ( t . getTemplate ( ) ) == null || ( t . isComplex ( ) && ! newValue . equals ( t . getValue ( ) ) ) ) ) return newValue ; String result = t . getSubstitution ( ) ; if ( ! t . isComplex ( ) && newValue != null ) { int start = result . lastIndexOf ( ":$" ) ; start = result . indexOf ( ":" , start + 1 ) ; int end = result . indexOf ( "}" , start + 1 ) ; if ( start < 0 || end < 0 || start == result . lastIndexOf ( "${:}" ) + 2 ) return result ; result = result . substring ( 0 , start + 1 ) + newValue + result . substring ( end ) ; } return result ; }
Substitutes a default value in expression by a new one
214
12
14,993
public static String getExpressionKey ( String result ) { if ( result == null ) return null ; try { int from = result . indexOf ( startTag ) ; int to = result . indexOf ( endTag , from ) ; Integer . parseInt ( result . substring ( from + 5 , to ) ) ; return result . substring ( from , to + 5 ) ; } catch ( Exception e ) { return null ; } }
Get an entities map key from the string
92
8
14,994
private void writeXAResource ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * This method is called by the application server during crash recovery.\n" ) ; writeWithIndent ( out , indent , " *\n" ) ; writeWithIndent ( out , indent , " * @param specs An array of ActivationSpec JavaBeans \n" ) ; writeWithIndent ( out , indent , " * @throws ResourceException generic exception \n" ) ; writeWithIndent ( out , indent , " * @return An array of XAResource objects\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public XAResource[] getXAResources(ActivationSpec[] specs)\n" ) ; writeWithIndent ( out , indent + 1 , "throws ResourceException" ) ; writeLeftCurlyBracket ( out , indent ) ; writeLogging ( def , out , indent + 1 , "trace" , "getXAResources" , "specs.toString()" ) ; writeWithIndent ( out , indent + 1 , "return null;" ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; }
Output getXAResources method
308
7
14,995
private void writeEndpointLifecycle ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * This is called during the activation of a message endpoint.\n" ) ; writeWithIndent ( out , indent , " *\n" ) ; writeWithIndent ( out , indent , " * @param endpointFactory A message endpoint factory instance.\n" ) ; writeWithIndent ( out , indent , " * @param spec An activation spec JavaBean instance.\n" ) ; writeWithIndent ( out , indent , " * @throws ResourceException generic exception \n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public void endpointActivation(MessageEndpointFactory endpointFactory,\n" ) ; writeWithIndent ( out , indent + 1 , "ActivationSpec spec) throws ResourceException" ) ; writeLeftCurlyBracket ( out , indent ) ; if ( def . isSupportInbound ( ) ) { writeIndent ( out , indent + 1 ) ; out . write ( def . getActivationClass ( ) + " activation = new " + def . getActivationClass ( ) + "(this, endpointFactory, (" + def . getAsClass ( ) + ")spec);\n" ) ; writeWithIndent ( out , indent + 1 , "activations.put((" + def . getAsClass ( ) + ")spec, activation);\n" ) ; writeWithIndent ( out , indent + 1 , "activation.start();\n\n" ) ; } writeLogging ( def , out , indent + 1 , "trace" , "endpointActivation" , "endpointFactory" , "spec" ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * This is called when a message endpoint is deactivated. \n" ) ; writeWithIndent ( out , indent , " *\n" ) ; writeWithIndent ( out , indent , " * @param endpointFactory A message endpoint factory instance.\n" ) ; writeWithIndent ( out , indent , " * @param spec An activation spec JavaBean instance.\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public void endpointDeactivation(MessageEndpointFactory endpointFactory,\n" ) ; writeWithIndent ( out , indent + 1 , "ActivationSpec spec)" ) ; writeLeftCurlyBracket ( out , indent ) ; if ( def . isSupportInbound ( ) ) { writeIndent ( out , indent + 1 ) ; out . write ( def . getActivationClass ( ) + " activation = activations.remove(spec);\n" ) ; writeWithIndent ( out , indent + 1 , "if (activation != null)\n" ) ; writeWithIndent ( out , indent + 2 , "activation.stop();\n\n" ) ; } writeLogging ( def , out , indent + 1 , "trace" , "endpointDeactivation" , "endpointFactory" ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; }
Output EndpointLifecycle method
761
7
14,996
private void writeGetAs ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * Get activation spec class\n" ) ; writeWithIndent ( out , indent , " * @return Activation spec\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public " + def . getAsClass ( ) + " getActivationSpec()" ) ; writeLeftCurlyBracket ( out , indent ) ; writeWithIndent ( out , indent + 1 , "return spec;" ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; }
Output get activation spec method
171
5
14,997
private void writeMef ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * Get message endpoint factory\n" ) ; writeWithIndent ( out , indent , " * @return Message endpoint factory\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public MessageEndpointFactory getMessageEndpointFactory()" ) ; writeLeftCurlyBracket ( out , indent ) ; writeWithIndent ( out , indent + 1 , "return endpointFactory;" ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; }
Output message endpoint factory method
166
5
14,998
public void unregisterWorkManager ( WorkManager wm ) { if ( wm != null ) { if ( wm . getName ( ) == null || wm . getName ( ) . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The name of WorkManager is invalid: " + wm ) ; if ( trace ) log . tracef ( "Unregistering WorkManager: %s" , wm ) ; if ( workmanagers . keySet ( ) . contains ( wm . getName ( ) ) ) { workmanagers . remove ( wm . getName ( ) ) ; // Clear any events if ( wm instanceof DistributedWorkManager ) { WorkManagerEventQueue wmeq = WorkManagerEventQueue . getInstance ( ) ; List < WorkManagerEvent > events = wmeq . getEvents ( wm . getName ( ) ) ; events . clear ( ) ; } } } }
Unregister work manager
202
4
14,999
public void setDefaultWorkManager ( WorkManager wm ) { if ( trace ) log . tracef ( "Default WorkManager: %s" , wm ) ; String currentName = null ; if ( defaultWorkManager != null ) currentName = defaultWorkManager . getName ( ) ; defaultWorkManager = wm ; if ( wm != null ) { workmanagers . put ( wm . getName ( ) , wm ) ; } else if ( currentName != null ) { workmanagers . remove ( currentName ) ; } }
Set the default work manager
116
5