private void exportChannel ( final By by , final OutputStream stream ) throws IOException { final ZipOutputStream zos = new ZipOutputStream ( stream ) ; initExportFile ( zos ) ; this . channelService . accessRun ( by , ReadableChannel . class , channel -> { putDataEntry ( zos , "names" , makeNames ( channel . getId ( ) ) ) ; putDataEntry ( zos , "description" , channel . getId ( ) . getDescription ( ) ) ; putDirEntry ( zos , "artifacts" ) ; putProperties ( zos , "properties.xml" , channel . getContext ( ) . getProvidedMetaData ( ) ) ; putAspects ( zos , channel . getContext ( ) . getAspectStates ( ) . keySet ( ) ) ; // the first run receives all artifacts and filters for the root elements putArtifacts ( zos , "artifacts/" , channel , channel . getArtifacts ( ) , true ) ; } ) ; this . channelService . accessRun ( by , TriggeredChannel . class , channel -> { putTriggers ( zos , channel ) ; } ) ; zos . finish ( ) ; // don't close stream, since there might be other channels following }
Export the content of a channel