- Timestamp:
- 06/10/11 10:27:05 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/ReplayGenerator.java
r44 r58 13 13 14 14 public class ReplayGenerator { 15 15 16 private IReplayDecorator decorator = null; 17 16 18 public void createLogfileMultipleSessions(List<List<ReplayableEvent<?>>> sequences, String filename) { 17 19 OutputStreamWriter writer = openReplayFile(filename); 18 20 if( writer!=null ) { 19 21 try { 20 writer.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 21 writer.write("<log>" + StringTools.ENDLINE); 22 22 decorator = sequences.get(0).get(0).getReplayDecorator(); 23 if( decorator!=null ) { 24 writer.write(decorator.getHeader()); 25 } 23 26 for( List<ReplayableEvent<?>> actions : sequences ) { 24 27 writeSession(actions, writer); 25 28 } 26 27 writer.write("</log>" + StringTools.ENDLINE); 29 if( decorator!=null ) { 30 writer.write(decorator.getFooter()); 31 } 32 decorator = null; 28 33 writer.close(); 29 34 } catch (IOException e) { … … 37 42 if( writer!=null ) { 38 43 try { 39 writer.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 40 writer.write("<log>" + StringTools.ENDLINE); 41 44 actions.get(0).getReplayDecorator(); 45 if( decorator!=null ) { 46 writer.write(decorator.getHeader()); 47 } 42 48 writeSession(actions, writer); 43 44 writer.write("</log>" + StringTools.ENDLINE); 49 if( decorator!=null ) { 50 writer.write(decorator.getFooter()); 51 } 52 decorator = null; 45 53 writer.close(); 46 54 } catch (IOException e) { … … 76 84 private void writeSession(List<ReplayableEvent<?>> actions, OutputStreamWriter writer) 77 85 throws IOException { 78 writer.write(" <session>" + StringTools.ENDLINE); 86 if( decorator!=null ) { 87 writer.write(decorator.getSessionHeader()); 88 } 79 89 for( ReplayableEvent<?> currentAction : actions ) { 80 90 … … 82 92 for( IReplayable replayble : replayables ) { 83 93 writer.write(replayble.getReplayXml()+StringTools.ENDLINE); 94 writer.flush(); 84 95 } 85 96 } 86 writer.write(" </session>" + StringTools.ENDLINE); 97 if( decorator!=null ) { 98 writer.write(decorator.getSessionFooter()); 99 } 87 100 } 88 101
Note: See TracChangeset
for help on using the changeset viewer.