Source Code Cross Referenced for EMFUML2RepositoryFacade.java in  » UML » AndroMDA-3.2 » org » andromda » repositories » emf » uml2 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » AndroMDA 3.2 » org.andromda.repositories.emf.uml2 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.repositories.emf.uml2;
002:
003:        import java.util.Map;
004:
005:        import org.andromda.core.common.ComponentContainer;
006:        import org.andromda.core.metafacade.ModelAccessFacade;
007:        import org.andromda.core.repository.RepositoryFacadeException;
008:        import org.andromda.metafacades.emf.uml2.UMLModelAccessFacade;
009:        import org.andromda.repositories.emf.EMFRepositoryFacade;
010:        import org.apache.log4j.Logger;
011:        import org.eclipse.emf.ecore.EObject;
012:        import org.eclipse.emf.ecore.EcorePackage;
013:        import org.eclipse.emf.ecore.resource.Resource;
014:        import org.eclipse.emf.ecore.resource.ResourceSet;
015:        import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
016:        import org.eclipse.emf.ecore.util.EcoreUtil;
017:        import org.eclipse.emf.ecore.xmi.XMLResource;
018:        import org.eclipse.uml2.Model;
019:        import org.eclipse.uml2.UML2Package;
020:        import org.eclipse.uml2.util.UML2Resource;
021:
022:        /**
023:         * Implements an AndroMDA object model repository by using the <a href="http://www.eclipse.org/uml2/">Eclipse
024:         * UML2 API set </a>.
025:         *
026:         * @author Steve Jerman
027:         * @author Chad Brandon
028:         */
029:        public class EMFUML2RepositoryFacade extends EMFRepositoryFacade {
030:            /**
031:             * The logger instance.
032:             */
033:            private static Logger logger = Logger
034:                    .getLogger(EMFUML2RepositoryFacade.class);
035:
036:            /**
037:             * Perform required registrations for EMF/UML2.
038:             *
039:             * @see org.andromda.core.repository.RepositoryFacade#open()
040:             */
041:            protected ResourceSet createNewResourceSet() {
042:                if (logger.isDebugEnabled()) {
043:                    logger.debug("Registering resource factories");
044:                }
045:
046:                final ResourceSet resourceSet = new ResourceSetImpl();
047:                final Map extensionToFactoryMap = resourceSet
048:                        .getResourceFactoryRegistry()
049:                        .getExtensionToFactoryMap();
050:
051:                // - we need to perform these registrations in order to load a UML2 model into EMF
052:                //   see: http://dev.eclipse.org/viewcvs/indextools.cgi/%7Echeckout%7E/uml2-home/faq.html#6
053:                resourceSet.getPackageRegistry().put(UML2Package.eNS_URI,
054:                        UML2Package.eINSTANCE);
055:                extensionToFactoryMap.put(
056:                        Resource.Factory.Registry.DEFAULT_EXTENSION,
057:                        UML2Resource.Factory.INSTANCE);
058:
059:                // - populate the load options
060:                final Map loadOptions = this .getLoadOptions();
061:                loadOptions.put(UML2Resource.OPTION_DISABLE_NOTIFY,
062:                        Boolean.FALSE);
063:                loadOptions.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE,
064:                        Boolean.TRUE);
065:
066:                return resourceSet;
067:            }
068:
069:            /**
070:             * Overrridden to check that the model is of the correct type.
071:             * 
072:             * @see org.andromda.repositories.emf.EMFRepositoryFacade#readModel(java.lang.String)
073:             */
074:            protected void readModel(final String uri) {
075:                super .readModel(uri);
076:                // Just to be sure there is a valid "model" inside
077:                EObject modelPackage = (EObject) EcoreUtil.getObjectByType(
078:                        model.getContents(), EcorePackage.eINSTANCE
079:                                .getEObject());
080:                if (!(modelPackage instanceof  Model)) {
081:                    throw new RepositoryFacadeException("Model '" + uri
082:                            + "' is not a valid EMF UML2 model");
083:                }
084:            }
085:
086:            /**
087:             * @see org.andromda.core.repository.RepositoryFacade#getModel()
088:             */
089:            public ModelAccessFacade getModel() {
090:                if (this .modelFacade == null) {
091:                    try {
092:                        this .modelFacade = (ModelAccessFacade) ComponentContainer
093:                                .instance().newComponent(
094:                                        UMLModelAccessFacade.class,
095:                                        ModelAccessFacade.class);
096:                    } catch (final Throwable throwable) {
097:                        throw new RepositoryFacadeException(throwable);
098:                    }
099:                }
100:                if (this.model != null) {
101:                    this.modelFacade.setModel(this.model);
102:                } else {
103:                    this.modelFacade = null;
104:                }
105:                return this.modelFacade;
106:            }
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.