svn commit: r14178 - trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: euluis
Date: 2008-03-04 16:56:01-0800
New Revision: 14178

Modified:
   trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java

Log:
issue 4946: solved part of the problem with user defined profiles; added some launch configurations to facilitate tests in eclipse

Modified: trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java?view=diff&rev=14178&p1=trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java&p2=trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java&r1=14177&r2=14178
==============================================================================
--- trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java	(original)
+++ trunk/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java	2008-03-04 16:56:01-0800
@@ -80,6 +80,9 @@
         "/org/argouml/profile/profiles/";
     private static final String PROFILE_BASE_URL = 
         "http://argouml.org/profiles/uml14";
+
+    private static final String USER_PROFILE_BASE_URL = 
+        "http://argouml.org/user-profiles/";
     
     private Map<String, Object> idToObjects = 
         Collections.synchronizedMap(new HashMap<String, Object>());
@@ -182,7 +185,8 @@
             if (systemId.contains(PROFILE_RESOURCE_PATH))
                 systemId = PROFILE_BASE_URL + getSuffix(systemId);
             else if (systemId.contains("file:/")) {
-                // user defined profile - systemId is OK
+                // user defined profile - replace path with corresponding label
+                systemId = USER_PROFILE_BASE_URL + modelPublicId;
             } else 
                 systemId = PROFILE_BASE_URL + modelPublicId;
         } else if (systemId == topSystemId) {
@@ -273,7 +277,7 @@
         // Several tries to construct a URL that really exists.
         if (modelUrl == null) {
             // If systemId is a valid URL, simply use it
-            modelUrl = this.getValidURL(fixupURL(systemId));
+            modelUrl = getValidURL(fixupURL(systemId));
             if (modelUrl == null) {
                 // Try to find suffix in module list.
                 String modelUrlAsString = findModuleURL(suffix);
@@ -283,7 +287,7 @@
                 }
                 if (modelUrl == null) {
                     // search the classpath
-                    modelUrl = this.findModelUrlOnClasspath(systemId);
+                    modelUrl = findModelUrlOnClasspath(systemId);
                 }
                 if (modelUrl == null) {
                     // Give up and let superclass deal with it.
@@ -358,6 +362,13 @@
                 return fixupURL(urlString);
             }
         }
+        if (modelsPublicIds.contains(moduleName)) {
+            if (LOG.isDebugEnabled())
+                LOG.debug("Couldn't find user model (\"" + moduleName 
+                    + "\") in modulesPath, attempt " 
+                    + "to use a model stored within the zargo file.");
+            return moduleName;
+        }
         return null;
     }
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.