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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3. AN APPLICATION RECONFIGURATION FRAMEWORK 3.5. Modifying the Configuration File<br />

3.5 Modifying the Configuration File<br />

Despite not being part of this work, some possible ways to <strong>de</strong>al with the configuration file<br />

modification th<strong>em</strong>e were i<strong>de</strong>ntified.<br />

In the presence of a configuration file, structured in an XML document, one can either man-<br />

ually modify it, using a regular text editor or a similar XML editor, or automatically modify it,<br />

<strong>em</strong>ploying an XML script which applies the changes to a configuration file without the need<br />

for any user intervention.<br />

The first way does not ask for any special requir<strong>em</strong>ent, other than having a text editor at<br />

hand, and therefore, consists on the easiest way to modify a configuration file in XML. On the<br />

other hand, the second way requires a script to be previously built. This script may, neverthe-<br />

less, be reusable and also allows for a completely automatic application configuration process.<br />

However, one must first know how the generic syntax is structured in or<strong>de</strong>r to build a script<br />

that operates on it.<br />

Therefore, it is very important that all the files in generic syntax follow the same structure<br />

and nomenclature, regardless of their original format. For example, assuming there is a script<br />

which goes through an entire configuration file searching for the block “Network” to change<br />

the “address” parameter value to “192.168.0.100”, it is vital that every file in generic syntax rep-<br />

resents block parameter patterns in the same way (i.e., a generic syntax el<strong>em</strong>ent called “Block”<br />

with a “value” el<strong>em</strong>ent assigned to it) so that the script recognizes those patterns when it sees<br />

th<strong>em</strong>. The same goes for anyone who wants to manually make that change. The person who<br />

applies the modification should not be obliged to know multiple generic syntaxes for various<br />

configuration file languages, but rather a homogeneous syntax which might slightly diverge<br />

from language to language, <strong>de</strong>pending on that language idiosyncrasies.<br />

3.6 External Parser Addition<br />

In response to the non-functional requir<strong>em</strong>ent in Section 3.1 which says that the user must be<br />

able to add parsers built outsi<strong>de</strong> the tool, Section 3.3.1 indicates that the Parser Repository<br />

impl<strong>em</strong>ents the importParser method. This utility is especially useful when the user wants<br />

to configure applications whose configuration files cannot be parsed by parsers created by<br />

the chosen parser generator (e.g., binary files) or if the user already possesses a parser for a<br />

configuration file.<br />

Nevertheless, in or<strong>de</strong>r for an external parser to be ad<strong>de</strong>d to the tool, it must impl<strong>em</strong>ent<br />

the interface <strong>de</strong>fined in Listing 3.8. This interface solely <strong>de</strong>fines one method, which is the one<br />

called by the Configuration File Parser when parsing a file with an external parser.<br />

Furthermore, the method must return the parsing statistics and the parsed blocks in generic<br />

syntax.<br />

34

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

Saved successfully!

Ooh no, something went wrong!