idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
14,800
void generateRaXml ( Definition def , String outputDir ) { if ( ! def . isUseAnnotation ( ) ) { try { outputDir = outputDir + File . separatorChar + "src" + File . separatorChar + "main" + File . separatorChar + "resources" ; FileWriter rafw = Utils . createFile ( "ra.xml" , outputDir + File . separatorChar + "META-INF...
generate ra . xml
14,801
void generateIronjacamarXml ( Definition def , String outputDir ) { try { String resourceDir = outputDir + File . separatorChar + "src" + File . separatorChar + "main" + File . separatorChar + "resources" ; writeIronjacamarXml ( def , resourceDir ) ; if ( def . getBuild ( ) . equals ( "maven" ) ) { String rarDir = outp...
generate ant ironjacamar . xml
14,802
void generateMbeanXml ( Definition def , String outputDir ) { String mbeanName = def . getDefaultValue ( ) . toLowerCase ( Locale . US ) ; if ( def . getRaPackage ( ) != null && ! def . getRaPackage ( ) . equals ( "" ) ) { if ( def . getRaPackage ( ) . indexOf ( '.' ) >= 0 ) { mbeanName = def . getRaPackage ( ) . subst...
generate mbean deployment xml
14,803
void generatePackageInfo ( Definition def , String outputDir , String subDir ) { try { FileWriter fw ; PackageInfoGen phGen ; if ( outputDir . equals ( "test" ) ) { fw = Utils . createTestFile ( "package-info.java" , def . getRaPackage ( ) , def . getOutputDir ( ) ) ; phGen = new PackageInfoGen ( ) ; } else { if ( subD...
generate package . html
14,804
void generateEisCode ( Definition def ) { try { String clazzName = this . getClass ( ) . getPackage ( ) . getName ( ) + ".code.TestEisCodeGen" ; String javaFile = def . getDefaultValue ( ) + "Handler.java" ; FileWriter fw = Utils . createTestFile ( javaFile , def . getRaPackage ( ) , def . getOutputDir ( ) ) ; Class < ...
generate Eis test server
14,805
static void setThreadContextClassLoader ( final ClassLoader cl ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; return null ; } } ) ; }
Set the thread context class loader
14,806
static void closeURLClassLoader ( final URLClassLoader cl ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { if ( cl != null ) { try { cl . close ( ) ; } catch ( IOException ioe ) { } } return null ; } } ) ; }
Close an URLClassLoader
14,807
private static void outputRaDesc ( RaImpl raImpl , PrintStream out ) throws ParserConfigurationException , SAXException , IOException , TransformerFactoryConfigurationError , TransformerConfigurationException , TransformerException { String raString = "<resource-adapters>" + raImpl . toString ( ) + "</resource-adapters...
Output Resource Adapter XML description
14,808
private static boolean scanArchive ( Connector cmd ) { if ( cmd == null ) return true ; if ( cmd . getVersion ( ) == Version . V_16 || cmd . getVersion ( ) == Version . V_17 ) { if ( ! cmd . isMetadataComplete ( ) ) return true ; } return false ; }
Should the archive be scanned for annotations
14,809
private static Map < String , String > getIntrospectedProperties ( String clz , URLClassLoader cl , PrintStream error ) { Map < String , String > result = null ; try { Class < ? > c = Class . forName ( clz , true , cl ) ; result = new TreeMap < String , String > ( ) ; Method [ ] methods = c . getMethods ( ) ; for ( Met...
Get the introspected properties for a class
14,810
private static void removeIntrospectedValue ( Map < String , String > m , String name ) { if ( m != null ) { m . remove ( name ) ; if ( name . length ( ) == 1 ) { name = name . toUpperCase ( Locale . US ) ; } else { name = name . substring ( 0 , 1 ) . toUpperCase ( Locale . US ) + name . substring ( 1 ) ; } m . remove ...
Remove introspected value
14,811
private static String getValueString ( XsdString value ) { if ( value == null || value == XsdString . NULL_XSDSTRING ) return "" ; else return value . getValue ( ) ; }
get correct value string
14,812
public static synchronized void getConnectionListener ( String poolName , Object mcp , Object cl , boolean pooled , boolean interleaving , Throwable callstack ) { if ( ! interleaving ) { if ( pooled ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , Trace...
Get connection listener
14,813
public static synchronized void returnConnectionListener ( String poolName , Object mcp , Object cl , boolean kill , boolean interleaving , Throwable callstack ) { if ( ! interleaving ) { if ( ! kill ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , Trac...
Return connection listener
14,814
public static synchronized void clearConnectionListener ( String poolName , Object mcp , Object cl ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CLEAR_CONNECTION_LISTENER , Integer . toHexString ( System . identityHashCode ( cl ) ) ) ) ;...
Clear connection listener
14,815
public static synchronized void enlistConnectionListener ( String poolName , Object mcp , Object cl , String tx , boolean success , boolean interleaving ) { if ( ! interleaving ) { if ( success ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent...
Enlist connection listener
14,816
public static synchronized void delistConnectionListener ( String poolName , Object mcp , Object cl , String tx , boolean success , boolean rollbacked , boolean interleaving ) { if ( ! rollbacked ) { if ( ! interleaving ) { if ( success ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( Syste...
Delist connection listener
14,817
public static synchronized void createConnectionListener ( String poolName , Object mcp , Object cl , Object mc , boolean get , boolean prefill , boolean incrementer , Throwable callstack ) { if ( get ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , Tra...
Create connection listener
14,818
public static synchronized void destroyConnectionListener ( String poolName , Object mcp , Object cl , boolean ret , boolean idle , boolean invalid , boolean flush , boolean error , boolean prefill , boolean incrementer , Throwable callstack ) { if ( ret ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . t...
Destroy connection listener
14,819
public static synchronized void createManagedConnectionPool ( String poolName , Object mcp ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . MANAGED_CONNECTION_POOL_CREATE , "NONE" ) ) ; }
Create managed connection pool
14,820
public static synchronized void destroyManagedConnectionPool ( String poolName , Object mcp ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . MANAGED_CONNECTION_POOL_DESTROY , "NONE" ) ) ; }
Destroy managed connection pool
14,821
public static synchronized void pushCCMContext ( String key , Throwable callstack ) { log . tracef ( "%s" , new TraceEvent ( "CachedConnectionManager" , "NONE" , TraceEvent . PUSH_CCM_CONTEXT , "NONE" , key , callstack != null ? toString ( callstack ) : "" ) ) ; }
Push CCM context
14,822
public static synchronized void popCCMContext ( String key , Throwable callstack ) { log . tracef ( "%s" , new TraceEvent ( "CachedConnectionManager" , "NONE" , TraceEvent . POP_CCM_CONTEXT , "NONE" , key , callstack != null ? toString ( callstack ) : "" ) ) ; }
Pop CCM context
14,823
public static synchronized void registerCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . REGISTER_CCM_CONNECTION , Integer . toHexString ( System . id...
Register CCM connection
14,824
public static synchronized void unregisterCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . UNREGISTER_CCM_CONNECTION , Integer . toHexString ( System ...
Unregister CCM connection
14,825
public static synchronized void unknownCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . UNKNOWN_CCM_CONNECTION , Integer . toHexString ( System . iden...
Unknown CCM connection
14,826
public static synchronized void closeCCMConnection ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CLOSE_CCM_CONNECTION , Integer . toHexString ( System . identity...
Close CCM connection
14,827
public static synchronized void ccmUserTransaction ( String poolName , Object mcp , Object cl , Object connection , String key ) { log . tracef ( "%s" , new TraceEvent ( poolName , Integer . toHexString ( System . identityHashCode ( mcp ) ) , TraceEvent . CCM_USER_TRANSACTION , Integer . toHexString ( System . identity...
CCM user transaction
14,828
public < T > T lookup ( String name , Class < T > expectedType ) throws Throwable { if ( name == null ) throw new IllegalArgumentException ( "Name is null" ) ; if ( expectedType == null ) throw new IllegalArgumentException ( "ExpectedType is null" ) ; if ( ! started ) throw new IllegalStateException ( "Container not st...
Lookup a bean
14,829
private void removeDeployment ( File deployment ) throws IOException { if ( deployment == null ) throw new IllegalArgumentException ( "Deployment is null" ) ; if ( deployment . exists ( ) || ( shrinkwrapDeployments != null && shrinkwrapDeployments . contains ( deployment ) ) ) { shrinkwrapDeployments . remove ( deploym...
Remove ShrinkWrap deployment
14,830
public String getValue ( ) { return StringUtils . isEmptyTrimmed ( resolvedValue ) ? ( StringUtils . isEmptyTrimmed ( defaultValue ) ? "" : defaultValue ) : resolvedValue ; }
Resolves the expression
14,831
private Context currentContext ( ) { LinkedList < Context > stack = threadContexts . get ( ) ; if ( stack != null && ! stack . isEmpty ( ) ) { return stack . getLast ( ) ; } return null ; }
Look at the current context
14,832
private boolean closeAll ( Context context ) { boolean unclosed = false ; CloseConnectionSynchronization ccs = getCloseConnectionSynchronization ( true ) ; for ( org . ironjacamar . core . connectionmanager . ConnectionManager cm : context . getConnectionManagers ( ) ) { for ( org . ironjacamar . core . connectionmanag...
Close all connections for a context
14,833
private CloseConnectionSynchronization getCloseConnectionSynchronization ( boolean createIfNotFound ) { try { Transaction tx = null ; if ( transactionIntegration != null ) tx = transactionIntegration . getTransactionManager ( ) . getTransaction ( ) ; if ( tx != null && TxUtils . isActive ( tx ) ) { CloseConnectionSynch...
Get the CloseConnectionSynchronization instance
14,834
private void closeConnection ( Object connectionHandle ) { try { Throwable exception = null ; synchronized ( connectionStackTraces ) { exception = connectionStackTraces . remove ( connectionHandle ) ; } Method m = SecurityActions . getMethod ( connectionHandle . getClass ( ) , "close" , new Class [ ] { } ) ; try { if (...
Close connection handle
14,835
public static boolean isActive ( Transaction tx ) { if ( tx == null ) return false ; try { int status = tx . getStatus ( ) ; return status == Status . STATUS_ACTIVE ; } catch ( SystemException error ) { throw new RuntimeException ( "Error during isActive()" , error ) ; } }
Is the transaction active
14,836
public static boolean isUncommitted ( Transaction tx ) { if ( tx == null ) return false ; try { int status = tx . getStatus ( ) ; return status == Status . STATUS_ACTIVE || status == Status . STATUS_MARKED_ROLLBACK ; } catch ( SystemException error ) { throw new RuntimeException ( "Error during isUncommitted()" , error...
Is the transaction uncommitted
14,837
public static boolean isCompleted ( Transaction tx ) { if ( tx == null ) return true ; try { int status = tx . getStatus ( ) ; return status == Status . STATUS_COMMITTED || status == Status . STATUS_ROLLEDBACK || status == Status . STATUS_NO_TRANSACTION ; } catch ( SystemException error ) { throw new RuntimeException (...
Is the transaction completed
14,838
public static String getStatusAsString ( int status ) { if ( status >= Status . STATUS_ACTIVE && status <= Status . STATUS_ROLLING_BACK ) { return TX_STATUS_STRINGS [ status ] ; } else { return "STATUS_INVALID(" + status + ")" ; } }
Converts a transaction status to a text representation
14,839
public void store ( Activations metadata , XMLStreamWriter writer ) throws Exception { if ( metadata != null && writer != null ) { writer . writeStartElement ( XML . ELEMENT_RESOURCE_ADAPTERS ) ; for ( Activation a : metadata . getActivations ( ) ) { writer . writeStartElement ( XML . ELEMENT_RESOURCE_ADAPTER ) ; if ( ...
Store a - ra . xml file
14,840
public int compareTo ( Object o ) { MBeanData md = ( MBeanData ) o ; String d1 = objectName . getDomain ( ) ; String d2 = md . objectName . getDomain ( ) ; int compare = d1 . compareTo ( d2 ) ; if ( compare == 0 ) { String p1 = objectName . getCanonicalKeyPropertyListString ( ) ; String p2 = md . objectName . getCanoni...
Compares MBeanData based on the ObjectName domain name and canonical key properties
14,841
public static ConnectionManager createConnectionManager ( TransactionSupportEnum tse , ManagedConnectionFactory mcf , CachedConnectionManager ccm , ConnectionManagerConfiguration cmc , TransactionIntegration ti ) { if ( tse == TransactionSupportEnum . NoTransaction ) { return new NoTransactionConnectionManager ( mcf , ...
Create a connection manager
14,842
public static MBeanServer getMBeanServer ( String domain ) { try { ArrayList < MBeanServer > l = MBeanServerFactory . findMBeanServer ( null ) ; if ( l != null ) { for ( MBeanServer ms : l ) { String [ ] domains = ms . getDomains ( ) ; if ( domains != null ) { for ( String d : domains ) { if ( domain . equals ( d ) ) {...
Get the MBeanServer instance
14,843
public static MBeanData getMBeanData ( String name ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; MBeanInfo info = server . getMBeanInfo ( objName ) ; return new MBeanData ( objName , info ) ; }
Get MBean data
14,844
public static Object getMBeanAttributeObject ( String name , String attrName ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; return server . getAttribute ( objName , attrName ) ; }
Get MBean attribute object
14,845
public static String getMBeanAttribute ( String name , String attrName ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; String value = null ; try { Object attr = server . getAttribute ( objName , attrName ) ; if ( attr != null ) value = attr . toString ( ) ...
Get MBean attribute
14,846
public static AttrResultInfo getMBeanAttributeResultInfo ( String name , MBeanAttributeInfo attrInfo ) throws JMException { ClassLoader loader = SecurityActions . getThreadContextClassLoader ( ) ; MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; String attrName = attrInfo . getNa...
Get MBean attribute result info
14,847
public static AttributeList setAttributes ( String name , HashMap attributes ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; MBeanInfo info = server . getMBeanInfo ( objName ) ; MBeanAttributeInfo [ ] attributesInfo = info . getAttributes ( ) ; AttributeLi...
Set MBean attributes
14,848
public static OpResultInfo invokeOp ( String name , int index , String [ ] args ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; MBeanInfo info = server . getMBeanInfo ( objName ) ; MBeanOperationInfo [ ] opInfo = info . getOperations ( ) ; MBeanOperationIn...
Invoke an operation
14,849
public static OpResultInfo invokeOpByName ( String name , String opName , String [ ] argTypes , String [ ] args ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; int length = argTypes != null ? argTypes . length : 0 ; Object [ ] typedArgs = new Object [ leng...
Invoke an operation by name
14,850
public List < ConnectionDefinition > getConnectionDefinitions ( ) { if ( connectionDefinitions == null ) return null ; return Collections . unmodifiableList ( connectionDefinitions ) ; }
Get the connectionFactories .
14,851
public List < AdminObject > getAdminObjects ( ) { return adminObjects == null ? null : Collections . unmodifiableList ( adminObjects ) ; }
Get the adminObjects .
14,852
public Map < String , String > getConfigProperties ( ) { return configProperties == null ? null : Collections . unmodifiableMap ( configProperties ) ; }
Get the configProperties .
14,853
public List < String > getBeanValidationGroups ( ) { return beanValidationGroups == null ? null : Collections . unmodifiableList ( beanValidationGroups ) ; }
Get the beanValidationGroups .
14,854
public void addProvider ( UserTransactionProvider provider ) { UserTransactionProviderImpl impl = new UserTransactionProviderImpl ( provider ) ; delegator . addProvider ( impl ) ; providers . put ( provider , impl ) ; }
Add a provider
14,855
public void removeProvider ( UserTransactionProvider provider ) { UserTransactionProviderImpl impl = providers . get ( provider ) ; if ( impl != null ) { delegator . removeProvider ( impl ) ; providers . remove ( provider ) ; } }
Remove a provider
14,856
public void setDefaultGroups ( String [ ] value ) { if ( value != null ) { defaultGroups = Arrays . copyOf ( value , value . length ) ; } else { defaultGroups = null ; } }
Set the default groups
14,857
public static org . ironjacamar . core . connectionmanager . pool . Capacity create ( org . ironjacamar . common . api . metadata . common . Capacity metadata , ClassLoaderPlugin classLoaderPlugin ) { if ( metadata == null ) return DefaultCapacity . INSTANCE ; CapacityIncrementer incrementer = null ; CapacityDecremente...
Create a capacity instance based on the metadata
14,858
private static CapacityIncrementer loadIncrementer ( Extension incrementer , ClassLoaderPlugin classLoaderPlugin ) { Object result = loadExtension ( incrementer , classLoaderPlugin ) ; if ( result != null && result instanceof CapacityIncrementer ) { return ( CapacityIncrementer ) result ; } log . debugf ( "%s wasn't a ...
Load the incrementer
14,859
private static CapacityDecrementer loadDecrementer ( Extension decrementer , ClassLoaderPlugin classLoaderPlugin ) { Object result = loadExtension ( decrementer , classLoaderPlugin ) ; if ( result != null && result instanceof CapacityDecrementer ) { return ( CapacityDecrementer ) result ; } log . debugf ( "%s wasn't a ...
Load the decrementer
14,860
private static Object loadExtension ( Extension extension , ClassLoaderPlugin classLoaderPlugin ) { try { Class < ? > c = classLoaderPlugin . loadClass ( extension . getClassName ( ) , extension . getModuleName ( ) , extension . getModuleSlot ( ) ) ; return c . newInstance ( ) ; } catch ( Throwable t ) { log . tracef (...
Load the class
14,861
private void getPropsString ( StringBuilder strProps , List < ConfigPropType > propsList , int indent ) { for ( ConfigPropType props : propsList ) { for ( int i = 0 ; i < indent ; i ++ ) strProps . append ( " " ) ; strProps . append ( "<config-property name=\"" ) ; strProps . append ( props . getName ( ) ) ; strProps ....
generate properties String
14,862
public static TransactionIsolation forName ( String v ) { if ( v != null && ! v . trim ( ) . equals ( "" ) ) { if ( "TRANSACTION_READ_UNCOMMITTED" . equalsIgnoreCase ( v ) || "1" . equalsIgnoreCase ( v ) ) { return TRANSACTION_READ_UNCOMMITTED ; } else if ( "TRANSACTION_READ_COMMITTED" . equalsIgnoreCase ( v ) || "2" ....
Static method to get an instance
14,863
public boolean start ( String home , File options ) { File homeDirectory = new File ( home ) ; if ( ! homeDirectory . exists ( ) ) return false ; stop ( home ) ; try { List < String > command = new ArrayList < String > ( ) ; command . add ( java ) ; command . add ( "-Dironjacamar.home=" + home ) ; if ( options != null ...
Start an instance
14,864
public int stop ( String home ) { Process p = instances . get ( home ) ; if ( p != null ) { try { p . destroy ( ) ; return p . exitValue ( ) ; } catch ( Throwable t ) { return - 1 ; } finally { instances . remove ( home ) ; } } return 0 ; }
Stop an instance
14,865
public void registerBootstrapContext ( CloneableBootstrapContext bc ) { if ( bc != null ) { if ( bc . getName ( ) == null || bc . getName ( ) . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The name of BootstrapContext is invalid: " + bc ) ; if ( ! bootstrapContexts . keySet ( ) . contains ( bc . get...
Register bootstrap context
14,866
public void unregisterBootstrapContext ( CloneableBootstrapContext bc ) { if ( bc != null ) { if ( bc . getName ( ) == null || bc . getName ( ) . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The name of BootstrapContext is invalid: " + bc ) ; if ( bootstrapContexts . keySet ( ) . contains ( bc . get...
Unregister boostrap context
14,867
public void setDefaultBootstrapContext ( CloneableBootstrapContext bc ) { if ( trace ) log . tracef ( "Default BootstrapContext: %s" , bc ) ; String currentName = null ; if ( defaultBootstrapContext != null ) currentName = defaultBootstrapContext . getName ( ) ; defaultBootstrapContext = bc ; if ( bc != null ) { bootst...
Set the default bootstrap context
14,868
public synchronized CloneableBootstrapContext createBootstrapContext ( String id , String name ) { if ( id == null || id . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The id of BootstrapContext is invalid: " + id ) ; if ( activeBootstrapContexts . keySet ( ) . contains ( id ) ) { Integer i = refCou...
Get a bootstrap context
14,869
public synchronized void removeBootstrapContext ( String id ) { if ( id == null || id . trim ( ) . equals ( "" ) ) throw new IllegalArgumentException ( "The id of BootstrapContext is invalid: " + id ) ; Integer i = refCountBootstrapContexts . get ( id ) ; if ( i != null ) { int newValue = i . intValue ( ) - 1 ; if ( ne...
Remove a bootstrap context
14,870
public static Janitor createJanitor ( String type ) { if ( type == null || type . equals ( "" ) ) return new MinimalJanitor ( ) ; type = type . toLowerCase ( Locale . US ) ; switch ( type ) { case "minimal" : return new MinimalJanitor ( ) ; case "full" : return new FullJanitor ( ) ; default : { return new MinimalJanito...
Create a janitor
14,871
static Properties getSystemProperties ( ) { return ( Properties ) AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { return System . getProperties ( ) ; } } ) ; }
Get the system properties
14,872
static URLClassLoader createURLCLassLoader ( final URL [ ] urls , final ClassLoader parent ) { return ( URLClassLoader ) AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { return new URLClassLoader ( urls , parent ) ; } } ) ; }
Create an URLClassLoader
14,873
private static String readStreamIntoString ( Reader reader ) throws IOException { StringBuilder s = new StringBuilder ( ) ; char a [ ] = new char [ 0x10000 ] ; while ( true ) { int l = reader . read ( a ) ; if ( l == - 1 ) break ; if ( l <= 0 ) throw new IOException ( ) ; s . append ( a , 0 , l ) ; } return s . toStrin...
Reads the contents of a stream into a string variable .
14,874
public static FileWriter createSrcFile ( String name , String packageName , String outDir ) throws IOException { String directory = "src" + File . separatorChar + "main" + File . separatorChar + "java" ; return createPackageFile ( name , packageName , directory , outDir ) ; }
Create source file
14,875
private static FileWriter createPackageFile ( String name , String packageName , String directory , String outDir ) throws IOException { if ( packageName != null && ! packageName . trim ( ) . equals ( "" ) ) { directory = directory + File . separatorChar + packageName . replace ( '.' , File . separatorChar ) ; } File p...
Create file in the package
14,876
public Set < Address > getAddresses ( T physicalAddress ) { Set < Address > result = new HashSet < Address > ( ) ; for ( Entry < Address , T > entry : nodes . entrySet ( ) ) { if ( entry . getValue ( ) == null || entry . getValue ( ) . equals ( physicalAddress ) ) { result . add ( entry . getKey ( ) ) ; } } if ( trace ...
Get the addresses
14,877
public void localDeltaDoWorkAccepted ( Address address ) { if ( trace ) log . tracef ( "LOCAL_DELTA_DOWORK_ACCEPTED(%s)" , address ) ; DistributedWorkManager dwm = workManagerCoordinator . resolveDistributedWorkManager ( address ) ; if ( dwm != null ) { Collection < NotificationListener > copy = new ArrayList < Notific...
Local delta doWork accepted
14,878
private void done ( ) { if ( longThreadPool != null && isLong ) { transport . updateLongRunningFree ( address , longThreadPool . getNumberOfFreeThreads ( ) + 1 ) ; } else { transport . updateShortRunningFree ( address , shortThreadPool . getNumberOfFreeThreads ( ) + 1 ) ; } }
Send the done signal to other nodes We are adding 1 to the result since the thread officially has been released yet but will be shortly
14,879
private Subject getSubject ( ) { return AccessController . doPrivileged ( new PrivilegedAction < Subject > ( ) { public Subject run ( ) { try { String domain = recoverSecurityDomain ; if ( domain != null && subjectFactory != null ) { Subject subject = SecurityActions . createSubject ( subjectFactory , domain ) ; Set < ...
This method provide the Subject used for the XA Resource Recovery integration with the XAResourceRecoveryRegistry .
14,880
@ SuppressWarnings ( "unchecked" ) private ManagedConnection open ( Subject s ) throws ResourceException { log . debugf ( "Open managed connection (%s)" , s ) ; if ( recoverMC == null ) recoverMC = mcf . createManagedConnection ( s , null ) ; if ( plugin == null ) { try { ValidatingManagedConnectionFactory vmcf = ( Val...
Open a managed connection
14,881
private void close ( ManagedConnection mc ) { log . debugf ( "Closing managed connection for recovery (%s)" , mc ) ; if ( mc != null ) { try { mc . cleanup ( ) ; } catch ( ResourceException ire ) { log . debugf ( "Error during recovery cleanup" , ire ) ; } } if ( mc != null ) { try { mc . destroy ( ) ; } catch ( Resour...
Close a managed connection
14,882
private Object openConnection ( ManagedConnection mc , Subject s ) throws ResourceException { if ( plugin == null ) return null ; log . debugf ( "Open connection (%s, %s)" , mc , s ) ; return mc . getConnection ( s , null ) ; }
Open a connection
14,883
private boolean closeConnection ( Object c ) { if ( plugin == null ) return false ; log . debugf ( "Closing connection for recovery check (%s)" , c ) ; boolean forceClose = false ; if ( c != null ) { try { forceClose = ! plugin . isValid ( c ) ; } catch ( ResourceException re ) { log . debugf ( "Error during recovery p...
Close a connection
14,884
protected boolean isCommandAvailable ( String command ) throws Throwable { Socket socket = null ; try { socket = new Socket ( host , port ) ; ObjectOutputStream output = new ObjectOutputStream ( socket . getOutputStream ( ) ) ; output . writeUTF ( "getcommand" ) ; output . writeInt ( 1 ) ; output . writeUTF ( command )...
Is a command available
14,885
void registerConnection ( ConnectionManager cm , ConnectionListener cl , Object c ) { if ( cmToCl == null ) cmToCl = new HashMap < ConnectionManager , List < ConnectionListener > > ( ) ; List < ConnectionListener > l = cmToCl . get ( cm ) ; if ( l == null ) l = new ArrayList < ConnectionListener > ( 1 ) ; l . add ( cl ...
Register a connection
14,886
boolean unregisterConnection ( ConnectionManager cm , ConnectionListener cl , Object c ) { if ( clToC != null && clToC . get ( cl ) != null ) { List < Object > l = clToC . get ( cl ) ; return l . remove ( c ) ; } return false ; }
Unregister a connection
14,887
Set < ConnectionManager > getConnectionManagers ( ) { if ( cmToCl == null ) return Collections . unmodifiableSet ( Collections . emptySet ( ) ) ; return Collections . unmodifiableSet ( cmToCl . keySet ( ) ) ; }
Get the connection managers
14,888
List < ConnectionListener > getConnectionListeners ( ConnectionManager cm ) { if ( cmToCl == null ) return Collections . unmodifiableList ( Collections . emptyList ( ) ) ; List < ConnectionListener > l = cmToCl . get ( cm ) ; if ( l == null ) l = Collections . emptyList ( ) ; return Collections . unmodifiableList ( l )...
Get the connection listeners for a connection manager
14,889
List < Object > getConnections ( ConnectionListener cl ) { List < Object > l = null ; if ( clToC != null ) l = clToC . get ( cl ) ; if ( l == null ) l = Collections . emptyList ( ) ; return Collections . unmodifiableList ( l ) ; }
Get the connections for a connection listener
14,890
void switchConnectionListener ( Object c , ConnectionListener from , ConnectionListener to ) { if ( clToC != null && clToC . get ( from ) != null && clToC . get ( to ) != null ) { clToC . get ( from ) . remove ( c ) ; clToC . get ( to ) . add ( c ) ; } }
Switch the connection listener for a connection
14,891
void removeConnectionListener ( ConnectionManager cm , ConnectionListener cl ) { if ( cmToCl != null && cmToCl . get ( cm ) != null ) { cmToCl . get ( cm ) . remove ( cl ) ; clToC . remove ( cl ) ; } }
Remove a connection listener
14,892
public synchronized void forceConfigProperties ( List < ConfigProperty > newContents ) { if ( newContents != null ) { this . configProperties = new ArrayList < ConfigProperty > ( newContents ) ; } else { this . configProperties = new ArrayList < ConfigProperty > ( 0 ) ; } }
Force configProperties with new content . This method is thread safe
14,893
public String getMessage ( ) { String msg = super . getMessage ( ) ; String ec = getErrorCode ( ) ; if ( ( msg == null ) && ( ec == null ) ) { return null ; } if ( ( msg != null ) && ( ec != null ) ) { return ( msg + ", error code: " + ec ) ; } return ( ( msg != null ) ? msg : ( "error code: " + ec ) ) ; }
Returns a detailed message string describing this exception .
14,894
void writeClassComment ( Definition def , Writer out ) throws IOException { out . write ( "/**\n" ) ; out . write ( " * " + getClassName ( def ) ) ; writeEol ( out ) ; out . write ( " *\n" ) ; out . write ( " * @version $Revision: $\n" ) ; out . write ( " */\n" ) ; }
Output class comment
14,895
protected void writeSimpleMethodSignature ( Writer out , int indent , String javadoc , String signature ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeIndent ( out , indent ) ; out . write ( javadoc ) ; writeEol ( out ) ; writeWithIndent ( out , indent , " */\n" ) ; writeIndent ( out , indent ...
write a simple method signature
14,896
protected void writeMethodSignature ( Writer out , int indent , MethodForConnection method ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * " + method . getMethodName ( ) ) ; writeEol ( out ) ; for ( MethodParam param : method . getParams ( ) ) { writeIndent ( out...
Write method signature for given
14,897
void writeLeftCurlyBracket ( Writer out , int indent ) throws IOException { writeEol ( out ) ; writeWithIndent ( out , indent , "{\n" ) ; }
Output left curly bracket
14,898
void writeRightCurlyBracket ( Writer out , int indent ) throws IOException { writeEol ( out ) ; writeWithIndent ( out , indent , "}\n" ) ; }
Output right curly bracket
14,899
void writeDefaultConstructor ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * Default constructor\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public " + getClassName ( def ) + "()...
Output Default Constructor