18.04.2013 Views

Dissertaç ˜ao de Mestrado Mestrado em Engenharia Informática Jo ...

Dissertaç ˜ao de Mestrado Mestrado em Engenharia Informática Jo ...

Dissertaç ˜ao de Mestrado Mestrado em Engenharia Informática Jo ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3. AN APPLICATION RECONFIGURATION FRAMEWORK 3.3. Original to Generic syntax Converter<br />

Listing 3.6: Tentative Grammar Repository proposed interface<br />

interface TentativeGrammarRepository {<br />

Grammar store(GrammarID grammarID, byte[] grammar);<br />

Grammar next();<br />

Grammar prev();<br />

Grammar get(int grammarNumber);<br />

void discard(int grammarNumber);<br />

void discardAll();<br />

void saveState();<br />

}<br />

Tentative Grammar Repository<br />

To respond to the architectural non-functional requir<strong>em</strong>ent which says that the user must be<br />

able to iterate through the previsouly tested grammars, the Tentative Grammar Repository<br />

(TGR, Listing 3.6) was conceived. TGR is a database which maintains a list of the grammars,<br />

functional or not, created by the user so far, in the process of building a new parser. Each<br />

grammar in the database knows what grammar was built before and after it.<br />

To store a grammar, the store method receives a GrammarID with the grammar name and<br />

a byte array containing the grammar <strong>de</strong>claration.<br />

The grammars are retrievable in two ways. The user can obtain grammars on an undo/redo<br />

fashion using the next and prev methods, which return the grammar built immediately be-<br />

fore or after. However, if the user <strong>de</strong>sires to get a specific grammar in time, it can be obtained<br />

using the grammar serial number which is unique to each grammar.<br />

The discard and discardAll methods <strong>de</strong>lete grammars from the database. The discard<br />

method discards a grammar and those based on it, while the discardAll method discards<br />

every grammar in the database.<br />

Finally, the state of the database can be saved, with the saveState, whenever the tool ex-<br />

ecution is halted.<br />

3.3.2 Original to Generic Syntax Converter Operation Scenarios<br />

Depending on whether a parser for a configuration file exists in the Parser Repository,<br />

OGC may have two different execution scenarios. For a clearer perception of the architecture<br />

and to give a better insight on the interactions between components, both scenarios are now<br />

briefly summarized.<br />

Consi<strong>de</strong>ring that there is a parser for a given configuration file in the database, the original<br />

to generic conversion unfolds as follows (Figure 3.4):<br />

1. The User Interface calls the Configuration File Parser to parse the configu-<br />

ration file;<br />

31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!