@ Override public DeployedAppInfo createDeployedAppInfo ( ApplicationInformation < DeployedAppInfo > appInfo ) throws UnableToAdaptException { String appPid = appInfo . getPid ( ) ; String appName = appInfo . getName ( ) ; String appPath = appInfo . getLocation ( ) ; File appFile = new File ( appPath ) ; Tr . debug ( _tc , "Create deployed application:" + " PID [ " + appPid + " ]" + " Name [ " + appName + " ]" + " Location [ " + appPath + " ]" ) ; Container appContainer = appInfo . getContainer ( ) ; Container originalAppContainer = null ; // If enabled by an attribute of the application manager configuration, // expand the application. // // Expansion is possible if the application file is not already a directory, and is // not loosely configuration. if ( applicationManager . getExpandApps ( ) && isArchive ( appFile , appPath ) ) { try { prepareExpansion ( ) ; WsResource expandedResource = resolveExpansion ( appName ) ; File expandedFile = expandedResource . asFile ( ) ; expand ( appName , appFile , expandedResource , expandedFile ) ; originalAppContainer = appContainer ; appContainer = deployedAppServices . setupContainer ( appPid , expandedFile ) ; } catch ( IOException e ) { Tr . error ( _tc , "warning.could.not.expand.application" , appName , e . getMessage ( ) ) ; } } Application applicationDD ; try { applicationDD = appContainer . adapt ( Application . class ) ; // throws UnableToAdaptException // Null when there is no application descriptor. } catch ( UnableToAdaptException e ) { // CWWKZ0113E: Application {0}: Parse error for application descriptor {1}: {2} Tr . error ( _tc , "error.application.parse.descriptor" , appName , "META-INF/application.xml" , e ) ; throw e ; } InterpretedContainer jeeContainer ; if ( appContainer instanceof InterpretedContainer ) { jeeContainer = ( InterpretedContainer ) appContainer ; } else { jeeContainer = appContainer . adapt ( InterpretedContainer . class ) ; } // Set a structure helper for modules that might be expanded inside // (e.g., x.ear/y.war or x.ear/y.jar/). if ( applicationDD == null ) { jeeContainer . setStructureHelper ( EARStructureHelper . getUnknownRootInstance ( ) ) ; } else { List < String > modulePaths = new ArrayList < String > ( ) ; for ( Module module : applicationDD . getModules ( ) ) { modulePaths . add ( module . getModulePath ( ) ) ; } jeeContainer . setStructureHelper ( EARStructureHelper . create ( modulePaths ) ) ; } appInfo . setContainer ( jeeContainer ) ; EARDeployedAppInfo deployedApp = new EARDeployedAppInfo ( appInfo , applicationDD , this , deployedAppServices , originalAppContainer ) ; appInfo . setHandlerInfo ( deployedApp ) ; return deployedApp ; }
Create deployment information for a java enterprise application .