|
|
 |  |  |  |
 |
| Frequently Asked Questions |  |
 |  |  |
 |
|
What is XMI? Why does iQgen use it?
|
 |
 |
 |
|
XMI is the XML Metamodel Interchange format defined by the OMG. While the latest version available is 1.2, most CASE tools only support version 1.0 and/or version 1.1. iQgen itself supports these two versions.
Using XMI as the integration interface between CASE tool and iQgen provides a loose coupling between them. To integrate based on the artifacts is an open, extensible and flexible way to do it. It ensures a long term productive use of the generative approach, independent from any specific product.
|
|
How can I change the target generation path and file name for a file to generate, if I don't want to have all files in the same
location?
|
 |
 |
 |
|
In each template, you can specify the file name via a function called getFilename(). for example:
<%! public String getFilename() {
return getDirectory() + File.separator + MetaModel.getName(element)+ "Impl.java";
} %> |
|
|
How can I generate a single file, which is constantly appended to (e.g. all classnames of a model)?
|
 |
 |
 |
|
You cannot specify the same filename in multiple templates - the second template applied would merge the results
with the existing file, which is most likely not what you want. You can generate information based on the complete
model very easily though using the postProcessModel hook. Here is the simple example that list all classes in a model. First,
you define two lists - CLASSES and INTERFACES - that you append to when the model is processed:
<%! public String[] getTemplates(MBase element) {
String name = getMetaModel().getName(element);
if (getMetaModel().isClass(element)) {
addToPart("CLASSES",element);
} else if (getMetaModel().isInterface(element)) {
addToPart("INTERFACES",element);
}
%>
<%! public String[] getPostprocessTemplates() {
return new String[] {"class_list.jsp" };
}
%> |
As you have registered class_list.jsp as the template to be executed during post-processing, you need to define it:
<%@ page import="java.util.Collection,
ru.novsoft.uml.MBase,
com.innoq.generator.StringHelper"%>
<%
Collection classes = (Collection)request.getAttribute("CLASSES");
Collection interfaces = (Collection)request.getAttribute("INTERFACES");
%>
<iqgen:foreach group="<%=classes.iterator()%>" item="element" type="ru.novosoft.uml.MBase">
<% String className = getMetaModel().getName(element); %>
Class: <%= className %>
</iqgen:foreach>
<iqgen:foreach group="<%=interfaces.iterator()%>" item="element" type="ru.novosoft.uml.MBase">
<% String interfaceName = getMetaModel().getName(element); %>
Class: <%= interfaceName%>
</iqgen:foreach>
<%! public String getFilename() {
return "ClassList.txt";
}
%> |
|
|
What is my home directory on Windows NT/2k/XP? Which files are located there?
|
 |
 |
 |
|
On Windows NT your user home directory is supposed to be in %WINDOWS-DIR%\Profiles\<username>\ - e.g.:
C:\Windows\Profiles\phillip.
On Windows 2k and XP you can figure out the location of your user-home by typing echo %USERPROFILE% in a shell.
On Unix systems your home directory is - well, your home directory, e.g. /home/username or /export/home/username.
|
|
Do I have access to use case or interaction diagrams in my templates, or am I limited to class diagrams?
|
 |
 |
 |
|
You can access everything that is in your model, as long as you know how to handle it. By default, iQgen will expect you to handle
classes and interfaces (which can of course have special meaning due to their stereotype). If you want to generate code for other
model elements, you need to override the method canBeGenerated in your main.jsp:
<%!
public boolean canBeGenerated(MBase pElem) {
return getMetaModel().isClass(pElem) || metaModel.isInterface(pElem)
|| getMetaModel().isXXX();
}
%> |
where 'XXX' stands for the model element type you want to use.
|
|  |
|
|  |  |
 |  |  |  |
|