public boolean accepts ( URL deployableUnitURL , String deployableUnitName ) { DeployableUnitWrapper du = new DeployableUnitWrapper ( deployableUnitURL , deployableUnitName ) ; URL url = du . getUrl ( ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Method accepts called for " + url + " [DU: " + deployableUnitName + "]" ) ; } try { String fullPath = url . getFile ( ) ; String fileName = fullPath . substring ( fullPath . lastIndexOf ( ' ' ) + 1 , fullPath . length ( ) ) ; // Is it in the toAccept list ? Direct accept. if ( toAccept . containsKey ( fileName ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Accepting " + url . toString ( ) + "." ) ; } return true ; } // If not it the accept list but it's a jar might be a DU jar... else if ( fileName . endsWith ( ".jar" ) ) { JarFile duJarFile = null ; try { // Try to obtain the DU descriptor, if we got it, we're // accepting it! if ( du . getEntry ( "META-INF/deployable-unit.xml" ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Accepting " + url . toString ( ) + "." ) ; } return true ; } } finally { // Clean up! if ( duJarFile != null ) { try { duJarFile . close ( ) ; } catch ( IOException ignore ) { } finally { duJarFile = null ; } } } } } catch ( Exception ignore ) { // Ignore.. will reject. } // Uh-oh.. looks like it will stay outside. return false ; }
Method for deciding whether or not to accept the file .