15.01.2015 Views

4th International Conference on Principles and Practices ... - MADOC

4th International Conference on Principles and Practices ... - MADOC

4th International Conference on Principles and Practices ... - MADOC

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.

Therefore, in Figure 6, all views have an Access attribute, which is<br />

used to store, which roles are allowed to access that particular<br />

view. In Figure 10, LibraryView <strong>and</strong> AdminView make use of the<br />

Access attribute to provide access informati<strong>on</strong>. For example,<br />

LibraryView may <strong>on</strong>ly be accessed by those who have either the<br />

role Subscriber or the role Admin, because <strong>on</strong>ly these roles are<br />

specified as string values in the Access attribute.<br />

The role of a user is stored in the sessi<strong>on</strong> informati<strong>on</strong>. Instances of<br />

the metaelement Sessi<strong>on</strong>Info represent an access point to all<br />

elements c<strong>on</strong>taining sessi<strong>on</strong> data. For this purpose, at the<br />

technical level, a reference to zero or more DataSets is allowed. If<br />

any of these is an SDataSet, the SecurityRoles associated with it<br />

are available to the user whose Sessi<strong>on</strong>Info c<strong>on</strong>tains the SDataSet.<br />

In our example model (Figure 10), the <strong>on</strong>ly SDataSet associated<br />

with the Sessi<strong>on</strong>Info instance is User. It c<strong>on</strong>tains two attributes<br />

that are instance of Role: IsSubscriber <strong>and</strong> IsAdmin. If the value<br />

of either of these is true, that user bel<strong>on</strong>gs to the respective group.<br />

As you can see, a subscriber would be able to access the<br />

LibraryView but not the AdminView.<br />

5. CODE GENERATION PROCESS<br />

So far we have described the basic principles of the OMEGA<br />

approach <strong>and</strong> the metamodel hierarchies used to illustrate it. In<br />

this secti<strong>on</strong> we will provide an overview of the architecture of the<br />

code generator.<br />

The code generator backend is intended to perform a<br />

transformati<strong>on</strong> of a set of static <strong>and</strong> dynamic OMEGA models into<br />

the resources c<strong>on</strong>stituting the modeled system, such as source<br />

code files <strong>and</strong> deployment descriptors. In comparis<strong>on</strong> with open<br />

source tools for model-to-code transformati<strong>on</strong>, such as<br />

OpenArchitectureWare 4 or AndroMDA 5 , the OMEGA generator<br />

is able to leverage the advantages provided by the hierarchical<br />

nature of the underlying metamodels. For our implementati<strong>on</strong> we<br />

have chosen a template-based model-to-code approach (cf. [13]).<br />

The generator uses source code templates that c<strong>on</strong>tain the target<br />

text <strong>and</strong> code to access the input models, therefore the templates<br />

closely resemble the target source code. Errors in the output of the<br />

generator can easily be traced back <strong>and</strong> be fixed at the template<br />

level. Additi<strong>on</strong>ally, due to the similarity between source code<br />

templates <strong>and</strong> the output in the target language, templates can be<br />

Figure 9 - The Dynamic Business Metamodel (Excerpt)<br />

derived from a reference implementati<strong>on</strong>, a prototypical example<br />

representing all relevant architectural aspects of a target system<br />

(cf. [13]).<br />

The template engine that has been used in the implementati<strong>on</strong>,<br />

Apache Velocity, provides an untyped, interpreted language that<br />

c<strong>on</strong>tains basic c<strong>on</strong>trol structures <strong>and</strong> the means to access Java<br />

objects but lacks advanced language features such as excepti<strong>on</strong><br />

h<strong>and</strong>ling.<br />

An overview of the steps of the code generati<strong>on</strong> process is shown<br />

in Figure 3. In the OMEGA editor plugin, UML-compatible input<br />

models are designed by the modeler (see upper left corner). These<br />

class <strong>and</strong> statechart diagrams are passed to the code generati<strong>on</strong><br />

plugin.<br />

As a first step, these models are transformed into the generator<br />

model, which has a format more suited to a template-based code<br />

generator (as shown in the upper right corner). Problematic<br />

aspects of the source model include the n<strong>on</strong>-existence of opti<strong>on</strong>al<br />

4 http://www.openarchitectureware.org<br />

Figure 10 - Actual Static Model<br />

5 http://www.<strong>and</strong>romda.org<br />

221

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

Saved successfully!

Ooh no, something went wrong!