|
|
(2 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
− | {{MoDiscoTabs|JEE/WebApp|{{MoDiscoTab|JEE/WebApp|Documentation|0.9}}{{MoDiscoTab|JEE/WebApp|Architecture|0.9}}}}
| + | #REDIRECT [[MoDisco/Moved To Help Center]] |
− | == Web XML Discoverer ==
| + | |
− | | + | |
− | The goal of the Generic Web Xml Discoverer plug-in is to allow generic extractions of information from a Web.xml file, without the need for a metamodel dedicated to a conforming Document Type Definition(DTD) or XML Schema Description (XSD).
| + | |
− | | + | |
− | === Details ===
| + | |
− | | + | |
− | Considering Web.xml files conforming to a DTD or XSD, it would be more convenient to have dedicated metamodels to manipulate the information. However, the generic XML Discoverer is an alternative for miscellaneous XML files.
| + | |
− | | + | |
− | This plug-in aims at analyzing any Web.xml file by providing a model describing the information found. The supported versions are JEE 1.2, 1.3, 1.4, 5 and 6.
| + | |
− | | + | |
− | Moreover, it allows to serialize the xml file back from the model. Thus, some M2M transformation might be used jointly to upgrade some xml files.
| + | |
− |
| + | |
− | | + | |
− | === User manual ===
| + | |
− | | + | |
− | ==== Discovering and browsing from contextual menu ====
| + | |
− | | + | |
− | The plug-in provides the user a contextual menu to easily create models.
| + | |
− | | + | |
− | To discover a Web XML configuration file, right-click on it in the Eclipse '''Package Explorer''' view, and select '''Discovery > Discoverers > Discover JEE web.xml''':
| + | |
− | | + | |
− | [[Image:MoDisco_Discover_WebXML_menu.png|frame|center|Menu to discover a Web XML file]] | + | |
− | | + | |
− | A discovery parameters dialog opens to let you specify the parameters of the discovery:
| + | |
− | | + | |
− | [[Image:MoDisco_Launching_discovery_org.eclipse.modisco.jee.webapp.discoverer.png|frame|center|Web XML discoverer parameters dialog]]
| + | |
− | | + | |
− | * Set '''SERIALIZE_TARGET''' to true if you want to save the model to a file
| + | |
− | * You can define '''TARGET_URI''' to the location of a file in your workspace. If it is not defined and SERIALIZE_TARGET is true, a model file will be created in the project.<br>'''Beware: the file will be overwritten if it already exists!'''
| + | |
− | | + | |
− | Once launched, a progress dialog will appear as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete:
| + | |
− | | + | |
− | [[Image:MoDisco_discoverer_org.eclipse.modisco.jee.webapp.discoverer_in_progress.png|frame|center|Progress dialog during model creation]]
| + | |
− | | + | |
− | At the end of the process, the newly created model file is added to the root of your project if you set SERIALIZE_TARGET to true:
| + | |
− | | + | |
− | [[Image:MoDisco_WebApp_Model_inWorkspaceProject.png|frame|center|Web XML model in the Package Explorer]]
| + | |
− | | + | |
− | And the model is opened in the default model browser if you selected '''Open model in editor after discovery''':
| + | |
− | | + | |
− | [[Image:MoDisco_WebXML_inModelBrowser.png|frame|center|Web XML model in the MoDisco model browser]]
| + | |
− | | + | |
− | The Web XML XMI files (with a filename ending in ".xml_webapp.xmi" by convention) can be opened in any model browser:
| + | |
− | | + | |
− | [[Image:MoDisco_WebXML_OpenWith.png|frame|center|Opening a Web XML model]]
| + | |
− | | + | |
− | ===Discoverer API===
| + | |
− | | + | |
− | Each MoDisco discoverer responds to a normalized interface and can be called programmatically (see org.eclipse.modisco.infra.discovery.core.IDiscoverer<T>).
| + | |
− | | + | |
− | First, add the following plug-in dependencies to your project ('''Require-Bundle''' in your Manifest.MF):
| + | |
− | * org.eclipse.modisco.jee.webapp
| + | |
− | * org.eclipse.modisco.jee.webapp.discoverer
| + | |
− | * org.eclipse.modisco.infra.discovery.core
| + | |
− | | + | |
− | You can easily discover a JSP model programmatically. For example, to discover a JSP model from a Java project:
| + | |
− | <source lang="java">
| + | |
− | WebXmlDiscoverer2 discoverer = new WebXmlDiscoverer2();
| + | |
− | discoverer.discoverElement(xmlFile, new NullProgressMonitor());
| + | |
− | Resource webXmlResource = discoverer.getTargetModel();
| + | |
− | </source>
| + | |
− | | + | |
− | To have a monitor to pass to the <code>discoverElement</code> method, you can either call the discoverer in an Eclipse Job, or pass a new NullProgressMonitor if you don't need progress reporting. | + | |
− | | + | |
− | As an example, you may checkout the code from project org.eclipse.modisco.jee.webapp.discoverer.tests.
| + | |
− | | + | |
− | == Source Repository ==
| + | |
− | | + | |
− | All the source code is stored in the Eclipse public source repository:
| + | |
− | | + | |
− | * metamodel : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.webapp/
| + | |
− | * discoverer : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.webapp.discoverer/
| + | |
− | | + | |
− | [[Category:MoDisco]]
| + | |
− | {{MoDisco}}
| + | |