svn commit: r12903 - trunk/src_new/org/argouml/application/Main.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-06-24 05:54:30-0700
New Revision: 12903

Modified:
   trunk/src_new/org/argouml/application/Main.java

Log:
Shorten the Main.main() method. 

There is no reason the org.argouml.application package should know about a ModelImplementation; 

now it is just a string we hand to the org.argouml.model subsystem.

Modified: trunk/src_new/org/argouml/application/Main.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/Main.java?view=diff&rev=12903&p1=trunk/src_new/org/argouml/application/Main.java&p2=trunk/src_new/org/argouml/application/Main.java&r1=12902&r2=12903
==============================================================================
--- trunk/src_new/org/argouml/application/Main.java	(original)
+++ trunk/src_new/org/argouml/application/Main.java	2007-06-24 05:54:30-0700
@@ -64,7 +64,6 @@
 import org.argouml.kernel.ProjectManager;
 import org.argouml.language.java.generator.GeneratorJava;
 import org.argouml.model.Model;
-import org.argouml.model.ModelImplementation;
 import org.argouml.moduleloader.InitModuleLoader;
 import org.argouml.moduleloader.ModuleLoader2;
 import org.argouml.notation.InitNotation;
@@ -269,35 +268,7 @@
         // Initialize the Model subsystem
         st.mark("initialize model subsystem");
 
-        {
-            String className =
-                System.getProperty(
-                        "argouml.model.implementation",
-                        DEFAULT_MODEL_IMPLEMENTATION);
-
-            ModelImplementation impl = null;
-            try {
-                Class implType = Class.forName(className);
-                impl = (ModelImplementation) implType.newInstance();
-            } catch (ClassNotFoundException e) {
-                reportError(e);
-            } catch (NoClassDefFoundError e) {
-                reportError(e);
-            } catch (InstantiationException e) {
-                reportError(e);
-            } catch (IllegalAccessException e) {
-                reportError(e);
-            }
-
-            if (impl == null) {
-                System.err.println(className
-                        + " is not a working Model implementation.");
-                System.exit(1);
-                return;
-            }
-            
-            Model.setImplementation(impl);
-        }
+        initModel();
         
         updateProgress(splash, 5, "statusmsg.bar.model-subsystem");
 
@@ -454,12 +425,21 @@
         //ToolTipManager.sharedInstance().setInitialDelay(500);
         ToolTipManager.sharedInstance().setDismissDelay(50000000);
     }
-    
+
     /**
-     * @param e The exception to be logged.
+     * Initialise the UMl model repository.
      */
-    private static void reportError(Throwable e) {
-        LOG.fatal("Model component not correctly initialized.", e);
+    private static void initModel() {
+        String className = System.getProperty(
+                "argouml.model.implementation",
+                DEFAULT_MODEL_IMPLEMENTATION);
+        Throwable ret = Model.initialise(className);
+        if (ret != null) {
+            LOG.fatal("Model component not correctly initialized.", ret);
+            System.err.println(className
+                    + " is not a working Model implementation.");
+            System.exit(1);
+        }
     }
 
     /**
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.