protected Xpp3Dom createSREConfiguration ( ) throws MojoExecutionException , MojoFailureException { final Xpp3Dom xmlConfiguration = new Xpp3Dom ( "configuration" ) ; //$NON-NLS-1$ final Xpp3Dom xmlArchive = new Xpp3Dom ( "archive" ) ; //$NON-NLS-1$ xmlConfiguration . addChild ( xmlArchive ) ; final String mainClass = getMainClass ( ) ; if ( mainClass . isEmpty ( ) ) { throw new MojoFailureException ( "the main class of the SRE is missed" ) ; //$NON-NLS-1$ } final Xpp3Dom xmlManifest = new Xpp3Dom ( "manifest" ) ; //$NON-NLS-1$ xmlArchive . addChild ( xmlManifest ) ; final Xpp3Dom xmlManifestMainClass = new Xpp3Dom ( "mainClass" ) ; //$NON-NLS-1$ xmlManifestMainClass . setValue ( mainClass ) ; xmlManifest . addChild ( xmlManifestMainClass ) ; final Xpp3Dom xmlSections = new Xpp3Dom ( "manifestSections" ) ; //$NON-NLS-1$ xmlArchive . addChild ( xmlSections ) ; final Xpp3Dom xmlSection = new Xpp3Dom ( "manifestSection" ) ; //$NON-NLS-1$ xmlSections . addChild ( xmlSection ) ; final Xpp3Dom xmlSectionName = new Xpp3Dom ( "name" ) ; //$NON-NLS-1$ xmlSectionName . setValue ( SREConstants . MANIFEST_SECTION_SRE ) ; xmlSection . addChild ( xmlSectionName ) ; final Xpp3Dom xmlManifestEntries = new Xpp3Dom ( "manifestEntries" ) ; //$NON-NLS-1$ xmlSection . addChild ( xmlManifestEntries ) ; ManifestUpdater updater = getManifestUpdater ( ) ; if ( updater == null ) { updater = new ManifestUpdater ( ) { @ Override public void addSREAttribute ( String name , String value ) { assert name != null && ! name . isEmpty ( ) ; if ( value != null && ! value . isEmpty ( ) ) { getLog ( ) . debug ( "Adding to SRE manifest: " + name + " = " + value ) ; //$NON-NLS-1$//$NON-NLS-2$ final Xpp3Dom xmlManifestEntry = new Xpp3Dom ( name ) ; xmlManifestEntry . setValue ( value ) ; xmlManifestEntries . addChild ( xmlManifestEntry ) ; } } @ Override public void addMainAttribute ( String name , String value ) { // } } ; } buildManifest ( updater , mainClass ) ; return xmlConfiguration ; }
Create the configuration of the SRE with the maven archive format .