View Javadoc
1   package org.andromda.repositories.emf.uml22;
2   
3   import java.net.URL;
4   import java.util.HashMap;
5   import java.util.Map;
6   import org.andromda.core.common.ComponentContainer;
7   import org.andromda.core.metafacade.ModelAccessFacade;
8   import org.andromda.core.repository.RepositoryFacadeException;
9   import org.andromda.metafacades.emf.uml22.UMLModelAccessFacade;
10  import org.andromda.metafacades.emf.uml22.UmlUtilities;
11  import org.andromda.repositories.emf.EMFRepositoryFacade;
12  import org.apache.commons.lang.StringUtils;
13  import org.apache.log4j.Logger;
14  import org.eclipse.emf.common.util.URI;
15  import org.eclipse.emf.ecore.EObject;
16  import org.eclipse.emf.ecore.EPackage;
17  import org.eclipse.emf.ecore.EcorePackage;
18  import org.eclipse.emf.ecore.EPackage.Registry;
19  import org.eclipse.emf.ecore.resource.Resource;
20  import org.eclipse.emf.ecore.resource.ResourceSet;
21  import org.eclipse.emf.ecore.resource.URIConverter;
22  import org.eclipse.emf.ecore.util.EcoreUtil;
23  import org.eclipse.emf.ecore.xmi.XMLResource;
24  import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
25  import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl;
26  import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage;
27  import org.eclipse.uml2.types.TypesPackage;
28  import org.eclipse.uml2.uml.Model;
29  import org.eclipse.uml2.uml.UMLPackage;
30  import org.eclipse.uml2.uml.profile.standard.StandardPackage;
31  import org.eclipse.uml2.uml.resource.UML22UMLExtendedMetaData;
32  import org.eclipse.uml2.uml.resource.UML22UMLResource;
33  import org.eclipse.uml2.uml.resource.UMLResource;
34  import org.eclipse.uml2.uml.resource.XMI2UMLResource;
35  
36  /**
37   * Implements an AndroMDA object model repository by using the <a
38   * href="http://www.eclipse.org/uml2/">Eclipse UML2 API set </a>.
39   *
40   * @author Steve Jerman
41   * @author Chad Brandon
42   * @author Matthias Bohlen (native IBM RSM file reading)
43   * @author Bob Fields (Multiple model support, RSM Profiles)
44   */
45  public class EMFUML2RepositoryFacade extends EMFRepositoryFacade
46  {
47      /**
48       * The logger instance.
49       */
50      private static final Logger logger = Logger.getLogger(EMFUML2RepositoryFacade.class);
51  
52      /**
53       * Perform required registrations for EMF/UML2.
54       *
55       * @see org.andromda.core.repository.RepositoryFacade#open()
56       */
57      @Override
58      public ResourceSet createNewResourceSet()
59      {
60          if (logger.isDebugEnabled())
61          {
62              logger.debug("Registering resource factories");
63          }
64  
65          // Use our own proxy resolver which extends the standard UML2 resolver, to load moduleSearchLocations URLs
66          final ResourceSet proxyResourceSet = new EMXProxyResolvingResourceSet();
67  
68          // - we need to perform these registrations in order to load a UML model into EMF
69          //   see: http://dev.eclipse.org/viewcvs/indextools.cgi/%7Echeckout%7E/uml2-home/faq.html#6 OR http://wiki.eclipse.org/MDT/UML2/FAQ
70          Registry packageRegistry = proxyResourceSet.getPackageRegistry();
71          // EcorePackage.eNS_URI=http://www.eclipse.org/emf/2002/Ecore
72          packageRegistry.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
73          // UMLPackage.eNS_URI=http://www.eclipse.org/uml2/2.1.0/UML
74          // This gives a ConnectException when loading the model unless 2.0.0 namespace is also registered
75          packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
76          //packageRegistry.put("http://www.eclipse.org/uml2/2.1.0/UML", UMLPackage.eINSTANCE);
77          // register the UML package from org.eclipse.uml2
78          packageRegistry.put("http://www.eclipse.org/uml2/1.0.0/UML", UMLPackage.eINSTANCE);
79          packageRegistry.put("http://www.eclipse.org/uml2/2.0.0/UML", UMLPackage.eINSTANCE);
80          packageRegistry.put("http://www.eclipse.org/uml2/2.1.0/UML", UMLPackage.eINSTANCE);
81          packageRegistry.put("http://www.eclipse.org/uml2/2.2.0/UML", UMLPackage.eINSTANCE);
82          packageRegistry.put("http://www.eclipse.org/uml2/2.3.0/UML", UMLPackage.eINSTANCE);
83          packageRegistry.put("http://www.eclipse.org/uml2/3.0.0/UML", UMLPackage.eINSTANCE);
84          packageRegistry.put("http://www.eclipse.org/uml2/3.1.0/UML", UMLPackage.eINSTANCE);
85          packageRegistry.put("http://www.eclipse.org/uml2/4.0.0/UML", UMLPackage.eINSTANCE);
86          packageRegistry.put("http://www.eclipse.org/uml2/5.0.0/UML", UMLPackage.eINSTANCE);
87          packageRegistry.put("http://www.eclipse.org/uml2/4.0.0/Types", TypesPackage.eINSTANCE);
88          packageRegistry.put("http://www.eclipse.org/uml2/5.0.0/Types", TypesPackage.eINSTANCE);
89          packageRegistry.put("http://www.eclipse.org/uml2/4.0.0/UML/Profile/L2", StandardPackage.eINSTANCE);
90          packageRegistry.put("http://www.eclipse.org/uml2/4.0.0/UML/Profile/L3", StandardPackage.eINSTANCE);
91          packageRegistry.put("http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard", StandardPackage.eINSTANCE);
92          packageRegistry.put(Ecore2XMLPackage.eNS_URI, Ecore2XMLPackage.eINSTANCE);
93          packageRegistry.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
94          // register the UML2 schema against the standard UML namespace for UML 2.0 and 2.1
95          // see: http://dev.eclipse.org/newslists/news.eclipse.tools.uml2/msg03392.html
96          packageRegistry.put("http://schema.omg.org/spec/XMI/2.0", UMLPackage.eINSTANCE);
97          packageRegistry.put("http://schema.omg.org/spec/XMI/2.0.1", UMLPackage.eINSTANCE);
98          packageRegistry.put("http://schema.omg.org/spec/XMI/2.1", UMLPackage.eINSTANCE);
99          packageRegistry.put("http://schema.omg.org/spec/XMI/2.1.1", UMLPackage.eINSTANCE);
100         packageRegistry.put("http://schema.omg.org/spec/XMI/2.1.2", UMLPackage.eINSTANCE);
101         packageRegistry.put("http://schema.omg.org/spec/XMI/2.2", UMLPackage.eINSTANCE);
102         packageRegistry.put("http://schema.omg.org/spec/XMI/2.3", UMLPackage.eINSTANCE);
103         packageRegistry.put("http://schema.omg.org/spec/XMI/2.4", UMLPackage.eINSTANCE);
104         packageRegistry.put("http://schema.omg.org/spec/XMI/2.4.1", UMLPackage.eINSTANCE);
105         packageRegistry.put("http://schema.omg.org/spec/UML/2.0", UMLPackage.eINSTANCE);
106         packageRegistry.put("http://schema.omg.org/spec/UML/2.1", UMLPackage.eINSTANCE);
107         packageRegistry.put("http://schema.omg.org/spec/UML/2.1.1", UMLPackage.eINSTANCE);
108         packageRegistry.put("http://schema.omg.org/spec/UML/2.1.2", UMLPackage.eINSTANCE);
109         packageRegistry.put("http://schema.omg.org/spec/UML/2.2", UMLPackage.eINSTANCE);
110         packageRegistry.put("http://schema.omg.org/spec/UML/2.3", UMLPackage.eINSTANCE);
111         packageRegistry.put("http://schema.omg.org/spec/UML/2.4", UMLPackage.eINSTANCE);
112         packageRegistry.put("http://schema.omg.org/spec/UML/2.4.1", UMLPackage.eINSTANCE);
113         packageRegistry.put("http://schema.omg.org/spec/UML/2.5", UMLPackage.eINSTANCE);
114 
115         // Maps from file extension to resource for XML deserialization
116         final Map<String, Object> extensionToFactoryMap = proxyResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap();
117         //Map extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
118         // Register all files with all extensions as .uml resources, for loading purposes
119         //extensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, UMLResource.Factory.INSTANCE);
120         // register known file extensions:
121         // - *.uml -> native Eclipse/UML2 2.x 3.x 4.x resource
122         // - *.uml2 -> native Eclipse/UML2 1.x resource
123         // - *.xmi, *.xml -> OMG XMI UML2 resource
124         // - *.emx, *.epx -> IBM Rational Modeler UML2 model and profile resource
125         extensionToFactoryMap.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
126         extensionToFactoryMap.put("emx", UMLResource.Factory.INSTANCE);
127         extensionToFactoryMap.put("epx", UMLResource.Factory.INSTANCE);
128         // Allow loading the old .uml2 UML2 1.x files with UML2 2.x libraries
129         extensionToFactoryMap.put("uml2", UML22UMLResource.Factory.INSTANCE);
130         //extensionToFactoryMap.put(XMI2UMLResource.FILE_EXTENSION, XMI2UMLResource.Factory.INSTANCE);
131         extensionToFactoryMap.put(XMI2UMLResource.FILE_EXTENSION, new XMIResourceFactoryImpl());
132         // Allow reading MagicDraw .xml files inside .xml.zip, which are really xmi files.
133         extensionToFactoryMap.put("xml", new XMIResourceFactoryImpl());
134 
135         // if IBM's metamodel jars are on the classpath, we can register the package factories.
136         // This appears to have no effect, emx models are processed anyway.
137         //boolean registered =
138             registerOptionalRsmMetamodels(proxyResourceSet.getPackageRegistry());
139         // RSM profiles Default and Deployment.epx are dependencies referred to by com/ibm/rsm/7.5/pom.
140         // UML2 Standard resources are located under org/eclipse/uml2/uml/resources, referred to by metafacade dependency so it is in the plugin classpath.
141         // Eclipse examples show URI.create with a hard-coded jar file location like jar:file:/C:/eclipse/plugins/org.eclipse.uml2.uml.resources_2.0.0.v200606221411.jar!/
142         // Find the UML2 resources on the plugin classpath and set proxy URI based on actual found location.
143         // Classloader changed in maven3, see: https://cwiki.apache.org/MAVEN/maven-3x-class-loading.html. getClassLoader() no longer works.
144         URL url = this.getClass().getResource("/libraries/UMLPrimitiveTypes.library.uml");
145         // ResourceUtils.getResource, getContextClassLoader does not work for the plugin classloader dependencies in maven3
146         if (url!=null)
147         {
148             // Need to create a pathmap location map for UML2 Resources, to load standard profiles.
149             String path = url.getPath().substring(0, url.getPath().indexOf("libraries"));
150             URI uri = URI.createURI("jar:" + path);
151 
152             // URI umlResourcePluginURI = URI.createURI("jar:file:/" + umlResourcePath + "!/");
153             // UML_LIBRARIES referenced by model, UML_METAMODELS referenced by profiles
154             // = UMLResource.LIBRARIES_PATHMAP=pathmap://UML_LIBRARIES/
155             // UML Resources are loaded from maven org/eclipse/uml2/uml/resources
156             URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
157                 uri.appendSegment("libraries").appendSegment(""));
158             // UMLResource.METAMODELS_PATHMAP=pathmap://UML_LIBRARIES/
159             URIConverter.URI_MAP.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
160                 uri.appendSegment("metamodels").appendSegment(""));
161             // UMLResource.PROFILES_PATHMAP=UMLResource.PROFILES_PATHMAP
162             URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
163                 uri.appendSegment("profiles").appendSegment(""));
164         }
165         else
166         {
167             logger.error("Could not load UML2 org.eclipse.uml2.resources jar from classpath");
168         }
169         // Local implementation which delegates to the global map, so registrations are local
170         Map<URI, URI> uriMap = proxyResourceSet.getURIConverter().getURIMap();
171         uriMap.putAll(UML22UMLExtendedMetaData.getURIMap());
172         // TODO: Map from UML/2.0 etc to UML later versions. uriMap typically contains pathmap:// values.
173         //uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.0"),
174         //    URI.createURI("http://www.eclipse.org/uml2/1.0.0/UML"));
175         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.0"),
176                 URI.createURI(UMLPackage.eNS_URI));
177         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.1"),
178                 URI.createURI(UMLPackage.eNS_URI));
179         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.1.1"),
180                 URI.createURI(UMLPackage.eNS_URI));
181         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.1.2"),
182                 URI.createURI(UMLPackage.eNS_URI));
183         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.2"),
184                 URI.createURI(UMLPackage.eNS_URI));
185         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.3"),
186                 URI.createURI(UMLPackage.eNS_URI));
187         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.4"),
188                 URI.createURI(UMLPackage.eNS_URI));
189         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.4.1"),
190                 URI.createURI(UMLPackage.eNS_URI));
191         uriMap.put(URI.createURI("http://schema.omg.org/spec/UML/2.5"),
192                 URI.createURI(UMLPackage.eNS_URI));
193         uriMap.put(URI.createURI("http://www.eclipse.org/uml2/4.0.0/Types"),
194                 URI.createURI(TypesPackage.eNS_URI));
195         // Add pathmap for RSM UML2_MSL_PROFILES in com/ibm/xtools/uml/msl/7.10.500/msl-7.10.500.jar
196         url = this.getClass().getResource("/profiles/Default.epx");
197         if (url!=null)
198         {
199             // Need to create a pathmap location map for UML2_MSL_PROFILES, to load additional RSM profiles.
200             String path = url.getPath().substring(0, url.getPath().indexOf("profiles"));
201             URI uri = URI.createURI("jar:" + path);
202             //URI uri = URI.createURI("jar:file:/C:/Programs/IBM/SDP70Shared/plugins/com.ibm.xtools.uml.msl_7.5.0.v20080731_1905.jar!/");
203             //URIConverter.URI_MAP.put(URI.createURI("pathmap://UML2_MSL_PROFILES/"), uri.appendSegment("profiles").appendSegment(""));
204             // UML2_MSL_PROFILES are used in IBM RSM models.
205             URIConverter.URI_MAP.put(URI.createURI("pathmap://UML2_MSL_PROFILES/"), uri.appendSegment("profiles").appendSegment(""));
206         }
207         // Add pathmap for RUP_PROFILES in com/ibm/xtools/modeler/ui/templates/7.5.500/templates-7.5.500.jar
208         url = this.getClass().getResource("/profiles/RUPAnalysis.epx");
209         if (url!=null)
210         {
211             String path = url.getPath().substring(0, url.getPath().indexOf("profiles"));
212             URI uri = URI.createURI("jar:" + path);
213             //URIConverter.URI_MAP.put(URI.createURI("pathmap://UML2_MSL_PROFILES/"), uri.appendSegment("profiles").appendSegment(""));
214             // UML2_MSL_PROFILES are used in IBM RSM models.
215             URIConverter.URI_MAP.put(URI.createURI("pathmap://RUP_PROFILES/"), uri.appendSegment("profiles").appendSegment(""));
216         }
217 
218         //TODO This doesn't seem to help to resolve the pathmap.
219         // moduleSearchLocations values must still be added to andromda.xml
220         //TODO Enable <pathmaps><pathmap name= value=/> in andromda.xml configuration
221         // pathmap://m2repository is used in starter models to reference profiles deployed in maven local repository
222         String m2repository = System.getenv("M2_REPO");
223         if (m2repository!=null)
224         {
225             URI uri = URI.createURI("file:" + m2repository.replace("\\", "/") + '/');
226             // This doesn't seem to load the pathmap resources from the m2repository.
227             URIConverter.URI_MAP.put(URI.createURI("pathmap://m2repository/"), uri.appendSegment(""));
228             // m2repository conflicts with pathmap variable added by Sonatype eclipse plugin, use M2_REPO instead.
229             URIConverter.URI_MAP.put(URI.createURI("pathmap://M2_REPO/"), uri.appendSegment(""));
230         }
231 
232         // - populate the load options
233         final Map<String, Object> loadOptions = this.getLoadOptions();
234         // Enable notifications during load. Profiles not found do not generate a notification
235         // See http://sdqweb.ipd.kit.edu/wiki/EMF_Model_Loading_Performance_Tweaks
236         loadOptions.put(XMLResource.OPTION_DISABLE_NOTIFY, Boolean.FALSE);
237         loadOptions.put(XMLResource.OPTION_DOM_USE_NAMESPACES_IN_SCOPE, Boolean.TRUE);
238         loadOptions.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
239         loadOptions.put(XMLResource.OPTION_DEFER_ATTACHMENT, Boolean.TRUE);
240         loadOptions.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);
241         loadOptions.put(XMLResource.OPTION_PROCESS_DANGLING_HREF_RECORD, Boolean.TRUE);
242         loadOptions.put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.TRUE);
243         loadOptions.put(XMLResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl());
244         loadOptions.put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap());
245 
246         return proxyResourceSet;
247     }
248 
249     /**
250      * To read IBM Rational Software Modeler (RSM) files (*.emx, *.epx, ...) directly,
251      * we need to register two additional metamodels for annotation elements
252      * which are referenced inside the UML2 models created by IBM RSM.
253      *
254      * @param registry the registry in which metamodels should be registered
255      * @return
256      */
257     private boolean registerOptionalRsmMetamodels(EPackage.Registry registry)
258     {
259         // RSM6 uses xtools NotationPackage, RSM7 uses gmf NotationPackage
260         //boolean registered = registerOptionalMetamodel(registry, "com.ibm.xtools.notation.NotationPackage");
261         boolean registered = registerOptionalMetamodel(registry, "com.ibm.xtools.umlnotation.UmlnotationPackage");
262         //registered = registerOptionalMetamodel(registry, "com.ibm.xtools.topic.Topic");
263         registered = registerOptionalMetamodel(registry, "org.eclipse.gmf.runtime.notation.NotationPackage");
264         return registered;
265     }
266 
267     /**
268      * Register a metamodel in EMF so that models based on that metamodel can
269      * be loaded correctly. This appears to have no effect on model processing.
270      *
271      * @param registry EMF package registry
272      * @param ePackageClassName the class name of the package to be registered
273      */
274     private boolean registerOptionalMetamodel(EPackage.Registry registry, String ePackageClassName)
275     {
276         boolean registered = false;
277         try
278         {
279             //Including the additional model dependencies in the project pom.xml does not make the class visible to the classloader.
280             // Need to include the dependency with repository emf-uml22.
281             Class ePackageClass = Class.forName(ePackageClassName);
282             if (ePackageClass != null)
283             {
284                 // get those two famous static fields
285                 String nsURI = (String) ePackageClass.getField("eNS_URI").get(null);
286                 Object eInstance = ePackageClass.getField("eINSTANCE").get(null);
287                 registry.put(nsURI, eInstance);
288                 if (logger.isDebugEnabled())
289                 {
290                     logger.debug("Optional metamodel registered: " + nsURI);
291                 }
292                 registered = true;
293             }
294         }
295         catch (Exception e)
296         {
297             // do nothing when metamodels are not present -- they are entirely optional.
298         }
299         return registered;
300     }
301 
302     /**
303      * Read all models, clear UMLUtilities model list
304      * @see org.andromda.core.repository.RepositoryFacade#readModel(String[], String[])
305      */
306     public final void readModel(
307         String[] modelUris,
308         String[] moduleSearchPaths)
309     {
310         super.readModel(modelUris, moduleSearchPaths);
311     }
312 
313     /**
314      * Overridden to check that the model is of the correct type: UML2 top level Model element can also be Package.
315      *
316      * @see org.andromda.repositories.emf.EMFRepositoryFacade#readModel(String)
317      */
318     @Override
319     public void readModel(final String uri)
320     {
321         UmlUtilities.getModels().clear();
322         super.readModel(uri);
323         // Just to be sure there is a valid "model" inside
324         for (Resource modelResource : this.model)
325         {
326             //EObject modelPackage = modelResource.getEObject(modelResource.getURI().toString());
327             /*Collection<EObject> modelPackages = EcoreUtil.getObjectsByType(
328                 modelResource.getContents(), EcorePackage.eINSTANCE.getEObject());
329             // UML2 Model is a Package
330             for (EObject modelPkg : modelPackages )
331             {
332                 System.out.println("Model '" + uri + "' package " + modelPkg);
333             }*/
334             EObject modelPackage = (EObject) EcoreUtil.getObjectByType(
335                 modelResource.getContents(), EcorePackage.eINSTANCE.getEObject());
336             if (modelPackage==null)
337             {
338                 throw new RepositoryFacadeException("Model '" + uri + "' is not a valid EMF UML2 model: Model element not found");
339             }
340             /*else if (modelPackage instanceof org.eclipse.uml2.uml.Package)
341             {
342                 throw new RepositoryFacadeException("Model '" + uri + "' package " + modelPackage + " is not a valid EMF UML2 model: top level Package must be a Model, not a Package.");
343             }*/
344             // UML2 model top level element can be either a Model or Package. Package messes up processing because metafacades assume Model is at the top.
345             else if (!(modelPackage instanceof Model) && !(modelPackage instanceof org.eclipse.uml2.uml.Package))
346             {
347                 throw new RepositoryFacadeException("Model '" + uri + "' package " + modelPackage + " is not a valid EMF UML2 model");
348             }
349             // Save a reference to all models in the UML22 metafacades, except for profile references
350             if (!uri.contains("profile.") && !uri.contains("_Profile."))
351             {
352                 org.eclipse.uml2.uml.Package pkg = (org.eclipse.uml2.uml.Package)modelPackage;
353                 if (!UmlUtilities.getModels().contains(pkg))
354                 {
355                     UmlUtilities.getModels().add(pkg);
356                 }
357             }
358         }
359     }
360 
361     /**
362      * @see org.andromda.core.repository.RepositoryFacade#getModel()
363      */
364     public ModelAccessFacade getModel()
365     {
366         return this.getModel(null);
367     }
368 
369     /**
370      * @param uri
371      * @return this.modelFacade
372      * @see org.andromda.core.repository.RepositoryFacade#getModel()
373      */
374     public ModelAccessFacade getModel(String uri)
375     {
376         if (this.modelFacade == null)
377         {
378             try
379             {
380                 this.modelFacade = (ModelAccessFacade) ComponentContainer.instance().newComponent(
381                         UMLModelAccessFacade.class, ModelAccessFacade.class);
382             }
383             catch (final Throwable throwable)
384             {
385                 throw new RepositoryFacadeException(throwable);
386             }
387         }
388         if (StringUtils.isNotBlank(uri))
389         {
390             URI resource = URI.createURI(uri);
391             Resource uriModel = this.resourceSet.getResource(resource, true);
392             this.modelFacade.setModel(uriModel);
393         }
394         if (this.model != null)
395         {
396             this.modelFacade.setModel(this.model);
397         }
398         else
399         {
400             this.modelFacade = null;
401         }
402         return this.modelFacade;
403     }
404 
405     /**
406      * @see org.andromda.repositories.emf.EMFRepositoryFacade#close()
407      */
408     @Override
409     public void close()
410     {
411         // Ignore error
412     }
413 }