Author: tfmorris
Date: 2008-08-26 15:12:42-0700
New Revision: 15615
Modified:
trunk/src/argouml-app/src/org/argouml/persistence/ProfileConfigurationFilePersister.java
trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
Log:
Issue 5346: Allow reading projects saved with previous version of profile code
Modified: trunk/src/argouml-app/src/org/argouml/persistence/ProfileConfigurationFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/ProfileConfigurationFilePersister.java?view=diff&rev=15615&p1=trunk/src/argouml-app/src/org/argouml/persistence/ProfileConfigurationFilePersister.java&p2=trunk/src/argouml-app/src/org/argouml/persistence/ProfileConfigurationFilePersister.java&r1=15614&r2=15615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/persistence/ProfileConfigurationFilePersister.java (original)
+++ trunk/src/argouml-app/src/org/argouml/persistence/ProfileConfigurationFilePersister.java 2008-08-26 15:12:42-0700
@@ -127,10 +127,11 @@
String className = br.readLine().trim();
profile = ProfileFacade.getManager().getProfileForClass(
className);
- if (profile == null)
+ if (profile == null) {
throw new OpenException(
"Plugin profile \"" + className
+ "\" is not available in installation.", null);
+ }
return profile;
}
@@ -197,11 +198,12 @@
writer.close();
LOG.info("Wrote user defined profile \"" + profileFile
+ "\", with size " + xmi.length() + ".");
- if (isSomeProfileDirectoryConfigured(profileManager))
+ if (isSomeProfileDirectoryConfigured(profileManager)) {
profileManager.refreshRegisteredProfiles();
- else
+ } else {
profileManager.addSearchPathDirectory(
profilesDirectory.getAbsolutePath());
+ }
}
private static Profile getMatchingUserDefinedProfile(String fileName,
@@ -290,6 +292,7 @@
w.println("\t\t</userDefined>");
} else {
w.println("\t\t<plugin>");
+ // TODO: Don't persist our internal implementation names
w.println("\t\t\t" + profile.getClass().getName());
w.println("\t\t</plugin>");
}
Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java?view=diff&rev=15615&p1=trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java&p2=trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java&r1=15614&r2=15615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java (original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java 2008-08-26 15:12:42-0700
@@ -251,8 +251,23 @@
}
+ private static final String OLD_PROFILE_PACKAGE = "org.argouml.uml.profile";
+
+ private static final String NEW_PROFILE_PACKAGE =
+ "org.argouml.profile.internal";
+
public Profile getProfileForClass(String profileClass) {
Profile found = null;
+
+ // If we found an old-style name, update it to the new package name
+ if (profileClass.startsWith(OLD_PROFILE_PACKAGE)) {
+ profileClass = profileClass.replace(OLD_PROFILE_PACKAGE,
+ NEW_PROFILE_PACKAGE);
+ }
+
+ // Make sure the names didn't change again
+ assert profileUML.getClass().getName().startsWith(NEW_PROFILE_PACKAGE);
+
for (Profile p : profiles) {
if (p.getClass().getName().equals(profileClass)) {
found = p;
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.