Skip to content

Package: MigrationFileAdapter

MigrationFileAdapter

nameinstructionbranchcomplexitylinemethod
MigrationFileAdapter()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
function(String, ProcessedDiffFile, String)
M: 58 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package migration;
2:
3: import java.io.FileInputStream;
4: import java.io.FileNotFoundException;
5: import java.io.IOException;
6:
7: import basic.Buffer;
8: import migration.processeddifffile.ProcessedDiffFile;
9: import migration.processeddifffile.VariableDefinitionChange;
10: import model.RouterSoftware;
11: import model.definition.DefinitionFile;
12: import model.type.TypeDoesNotExistException;
13: import model.type.TypeExceptions;
14: import model.type.ValueNotInRangeOfTypeException;
15: import parser.DefinitionFileParser;
16: import parser.ParserException;
17: import scanner.DefinitionFileScanner;
18: import scanner.ScannerException;
19: import symbols.AbstractSymbol;
20:
21: /**
22: *
23: * @author Justin Holze
24: *
25: */
26: public class MigrationFileAdapter {
27:
28:         /**
29:          *
30:          *
31:          *
32:          * @param newOriginFile
33:          * Das neue AssignementFile. Dies soll angepasst werden
34:          *
35:          * @param endProcessedFile
36:          * Das Ergebnis des Processors. Informationen zu Variablenänderungen/umbenennungen
37:          * sind hier gespeichert
38:          *
39:          * @param oldAdaptedFile
40:          * Das vom Benutzer angepasste AssignmentFile.
41:          * @return a migrited assignment file.
42:          * @throws InterruptedException
43:          * from the buffer.
44:          * @throws ParserException
45:          * if there is any problem during the pars.
46:          * @throws FileNotFoundException
47:          * if a file was not found.
48:          * @throws ScannerException
49:          * if there is any problem during the scan.
50:          * @throws IOException
51:          * if an IO error occurs.
52:          * @throws IllegalArgumentException
53:          * when an Illegal argument occurs.
54:          * @throws ValueNotInRangeOfTypeException
55:          * if the value is not in the range of the type.
56:          * @throws TypeDoesNotExistException
57:          * TypeDoesNotExistException
58:          * @throws TypeExceptions
59:          * if an error occurs in a type.
60:          */
61:         public DefinitionFile function(final String newOriginFile,
62:                         final ProcessedDiffFile endProcessedFile, final String oldAdaptedFile)
63:                         throws InterruptedException, ParserException, FileNotFoundException, ScannerException,
64:                         IOException, IllegalArgumentException, ValueNotInRangeOfTypeException,
65:                         TypeDoesNotExistException, TypeExceptions {
66:
67:                 // Scan and parse the new fli4l version
68:                 final Buffer<AbstractSymbol> definitionBuffer = new Buffer<AbstractSymbol>(10000000);
69:                 DefinitionFileScanner.toSymbolSequence(new FileInputStream(newOriginFile), newOriginFile,
70:                                 definitionBuffer);
71:                 final DefinitionFile newDF =
72:                                 new DefinitionFileParser(new RouterSoftware(), definitionBuffer)
73:                                                 .getDefinitionFile();
74:
75:                 final Buffer<AbstractSymbol> assignmentBuffer2 = new Buffer<AbstractSymbol>(10000000);
76:                 DefinitionFileScanner.toSymbolSequence(new FileInputStream(oldAdaptedFile),
77:                                 oldAdaptedFile, assignmentBuffer2);
78:                 final DefinitionFile oldDF =
79:                                 new DefinitionFileParser(new RouterSoftware(), assignmentBuffer2)
80:                                                 .getDefinitionFile();
81:
82:                 // Durch die Synopsen des endProcessedFile wird durch iteriert und es werden die
83:                 // Variablenwerte zwischen
84:                 // angepasste Datei und Orginal verglichen. Je nachdem wird dann der Value in der zu
85:                 // migrierenden Datei angepasst.
86:                 // TODO: Hier muss die Regeltabelle angewandt und implementiert werden (siehe Konzept)
87:                 // TODO: Datentyp für Benutzerabfragen integrieren
88:
89:•                for (VariableDefinitionChange synopsis : endProcessedFile.getChanges()) {
90:                         // System.out.println("old Definition: " + synopsis.getOldDefinition().toString());
91:                         // System.out.println("new Definition: " + synopsis.getNewDefinition().toString());
92:
93:                 }
94:                 return oldDF;
95:
96:         }
97: }