public Archive createDefaultDeployment ( ) { try { Iterator < DefaultDeploymentFactory > providerIter = Module . getBootModuleLoader ( ) . loadModule ( ModuleIdentifier . create ( "swarm.application" ) ) . loadService ( DefaultDeploymentFactory . class ) . iterator ( ) ; if ( ! providerIter . hasNext ( ) ) { providerIter = ServiceLoader . load ( DefaultDeploymentFactory . class , ClassLoader . getSystemClassLoader ( ) ) . iterator ( ) ; } final Map < String , DefaultDeploymentFactory > factories = new HashMap <> ( ) ; while ( providerIter . hasNext ( ) ) { final DefaultDeploymentFactory factory = providerIter . next ( ) ; final DefaultDeploymentFactory current = factories . get ( factory . getType ( ) ) ; if ( current == null ) { factories . put ( factory . getType ( ) , factory ) ; } else { // if this one is high priority than the previously-seen // factory, replace it. if ( factory . getPriority ( ) > current . getPriority ( ) ) { factories . put ( factory . getType ( ) , factory ) ; } } } final DefaultDeploymentFactory factory = factories . get ( determineDeploymentType ( ) ) ; return factory != null ? factory . create ( ) : ShrinkWrap . create ( JARArchive . class ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Provides access to the default ShrinkWrap deployment .