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 ( workCo...
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 ) workC...
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 ) workConte...
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 nul...
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 ) ...
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 DistributableConte...
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 ) { i...
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 , InboundReso...
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 . n...
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 . getManagedCo...
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 . getAdm...
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 ( ) . getConne...
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...
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 . cl...
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 = ( Res...
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 . getResourcead...
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 ....
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 . s...
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 ( ) !=...
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 . getIniti...
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 )...
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 . s...
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 . getMessageadapt...
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 ...
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 = ...
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 ( ) . toLo...
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 ) { error...
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 resetXAResourceTime...
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 { newStri...
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 && at...
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 . in...
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 ( "${"...
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 ( Co...
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 ...
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_LIS...
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 ||...
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 ( t...
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 . get...
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 ( )...
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_LI...
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_INTERLEAVI...
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 < Interactio...
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 ( ' ' ) ; } el...
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_LIST...
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 ( ) == Trace...
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 . getMeth...
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 ] ; ...
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 , "/** MBe...
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 ) . getMethod...
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" ) ; writeWith...
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 ) ...
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>" ) ; write...
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 . ...
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 ) ...
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 + ".....
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 . exist...
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 . set...
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 . initC...
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 ( ":" ) ...
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 ;...
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 )...
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...
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 , i...
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" ) ; wr...
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 , " */...
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 ( workman...
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 ) ...
Set the default work manager
116
5