Author: euluis
Date: 2007-11-05 19:59:04-0800
New Revision: 13728
Added:
trunk/src_new/org/argouml/profile/
trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/DefaultTypeStrategy.java
trunk/src_new/org/argouml/profile/FigNodeStrategy.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/FigNodeStrategy.java
trunk/src_new/org/argouml/profile/FormatingStrategy.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/FormatingStrategy.java
trunk/src_new/org/argouml/profile/InitProfileSubsystem.java (contents, props changed)
trunk/src_new/org/argouml/profile/Profile.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/Profile.java
trunk/src_new/org/argouml/profile/ProfileException.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileException.java
trunk/src_new/org/argouml/profile/ProfileFacade.java (contents, props changed)
trunk/src_new/org/argouml/profile/ProfileManager.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileManager.java
trunk/src_new/org/argouml/profile/internal/
trunk/src_new/org/argouml/profile/internal/FileModelLoader.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/FileModelLoader.java
trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/JavaFormatingStrategy.java
trunk/src_new/org/argouml/profile/internal/ModelUtils.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ModelUtils.java
trunk/src_new/org/argouml/profile/internal/ProfileJava.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileJava.java
trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
trunk/src_new/org/argouml/profile/internal/ProfileModelLoader.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileModelLoader.java
trunk/src_new/org/argouml/profile/internal/ProfileUML.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileUML.java
trunk/src_new/org/argouml/profile/internal/ResourceModelLoader.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/ResourceModelLoader.java
trunk/src_new/org/argouml/profile/internal/StreamModelLoader.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/StreamModelLoader.java
trunk/src_new/org/argouml/profile/internal/UserDefinedProfile.java
- copied, changed from r13687, /trunk/src_new/org/argouml/uml/profile/UserDefinedProfile.java
Log:
Issue #4885: first commit of the org.argouml.profile work, based (i.e. copied and slightly adapted from) org.argouml.uml.profile. Shows sub-system init and Facade as well as hides some of the details to other classes.
Copied: trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java (from r13687, /trunk/src_new/org/argouml/uml/profile/DefaultTypeStrategy.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/DefaultTypeStrategy.java&p2=trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/DefaultTypeStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile;
/**
* Using this strategy profiles can provide the default used when creating new
Copied: trunk/src_new/org/argouml/profile/FigNodeStrategy.java (from r13687, /trunk/src_new/org/argouml/uml/profile/FigNodeStrategy.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/FigNodeStrategy.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/FigNodeStrategy.java&p2=trunk/src_new/org/argouml/profile/FigNodeStrategy.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/FigNodeStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/FigNodeStrategy.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile;
import java.awt.Image;
Copied: trunk/src_new/org/argouml/profile/FormatingStrategy.java (from r13687, /trunk/src_new/org/argouml/uml/profile/FormatingStrategy.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/FormatingStrategy.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/FormatingStrategy.java&p2=trunk/src_new/org/argouml/profile/FormatingStrategy.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/FormatingStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/FormatingStrategy.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile;
import java.util.Iterator;
Added: trunk/src_new/org/argouml/profile/InitProfileSubsystem.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/InitProfileSubsystem.java?view=auto&rev=13728
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/profile/InitProfileSubsystem.java 2007-11-05 19:59:04-0800
@@ -0,0 +1,79 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.profile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.argouml.application.api.GUISettingsTabInterface;
+import org.argouml.application.api.InitSubsystem;
+
+/**
+ *
+ * @author Luis Sergio Oliveira (euluis)
+ */
+public class InitProfileSubsystem implements InitSubsystem {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = Logger.getLogger(
+ InitProfileSubsystem.class);
+
+ private static String profileManagerClass =
+ "org.argouml.profile.internal.ProfileManagerImpl";
+
+ /*
+ * @see org.argouml.application.api.InitSubsystem#getProjectSettingsTabs()
+ */
+ public List<GUISettingsTabInterface> getProjectSettingsTabs() {
+ return new ArrayList<GUISettingsTabInterface>();
+ }
+
+ /*
+ * @see org.argouml.application.api.InitSubsystem#getSettingsTabs()
+ */
+ public List<GUISettingsTabInterface> getSettingsTabs() {
+ return new ArrayList<GUISettingsTabInterface>();
+ }
+
+ /*
+ * @see org.argouml.application.api.InitSubsystem#init()
+ */
+ public void init() {
+ try {
+ Class implType = Class.forName(profileManagerClass);
+ ProfileManager profileManager =
+ (ProfileManager) implType.newInstance();
+ ProfileFacade.setManager(profileManager);
+ } catch (Exception e) {
+ LOG.error("Failed to initialize ProfileManager implementation!",
+ e);
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Copied: trunk/src_new/org/argouml/profile/Profile.java (from r13687, /trunk/src_new/org/argouml/uml/profile/Profile.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/Profile.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/Profile.java&p2=trunk/src_new/org/argouml/profile/Profile.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/Profile.java (original)
+++ trunk/src_new/org/argouml/profile/Profile.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile;
import java.util.Collection;
import java.util.HashSet;
Copied: trunk/src_new/org/argouml/profile/ProfileException.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileException.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ProfileException.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ProfileException.java&p2=trunk/src_new/org/argouml/profile/ProfileException.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ProfileException.java (original)
+++ trunk/src_new/org/argouml/profile/ProfileException.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile;
/**
* An exception to be thrown during failure of a opening
Added: trunk/src_new/org/argouml/profile/ProfileFacade.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ProfileFacade.java?view=auto&rev=13728
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/profile/ProfileFacade.java 2007-11-05 19:59:04-0800
@@ -0,0 +1,66 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.profile;
+
+/**
+ * The <a href="http://en.wikipedia.org/wiki/Facade_pattern">Facade</a> of the
+ * profile subsystem.
+ * It provides a simplified interface to the subsystem, and access to objects
+ * of the subsystem when the methods it provides directly aren't enough.
+ *
+ * @author Luis Sergio Oliveira (euluis)
+ * @since 0.25.4
+ */
+public class ProfileFacade {
+
+ public static void register(Profile profile) {
+ getManager().registerProfile(profile);
+ }
+
+ public static void remove(Profile profile) {
+ getManager().removeProfile(profile);
+ }
+
+ public static ProfileManager getManager() {
+ if (manager == null)
+ notInitialized("manager");
+ return manager;
+ }
+
+ private static void notInitialized(String string) {
+ throw new RuntimeException("ProfileFacade's " + string
+ + " isn't initialized!");
+ }
+
+ static void setManager(ProfileManager profileManager) {
+ manager = profileManager;
+ }
+
+ static void reset() {
+ manager = null;
+ }
+
+ private static ProfileManager manager;
+}
Copied: trunk/src_new/org/argouml/profile/ProfileManager.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileManager.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ProfileManager.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ProfileManager.java&p2=trunk/src_new/org/argouml/profile/ProfileManager.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ProfileManager.java (original)
+++ trunk/src_new/org/argouml/profile/ProfileManager.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile;
import java.util.List;
@@ -103,4 +103,10 @@
* them as user defined profiles.
*/
void refreshRegisteredProfiles();
+
+ /**
+ * @return the Profile for UML, i.e., the base UML profile as defined by
+ * the standard.
+ */
+ Profile getUMLProfile();
}
Copied: trunk/src_new/org/argouml/profile/internal/FileModelLoader.java (from r13687, /trunk/src_new/org/argouml/uml/profile/FileModelLoader.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/FileModelLoader.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/FileModelLoader.java&p2=trunk/src_new/org/argouml/profile/internal/FileModelLoader.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/FileModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/internal/FileModelLoader.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.io.File;
import java.io.FileInputStream;
@@ -31,6 +31,7 @@
import java.util.Collection;
import org.apache.log4j.Logger;
+import org.argouml.profile.ProfileException;
/**
* An implementation for the ProfileModelLoader that loads profiles from file
@@ -48,7 +49,7 @@
/**
* @param modelFilename the model to be loaded
* @return the profile model
- * @throws ProfileException
+ * @throws ProfileException if the model file can't be read or found.
* @see org.argouml.uml.profile.StreamModelLoader#loadModel(java.lang.String)
*/
public Collection loadModel(String modelFilename) throws ProfileException {
Copied: trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java (from r13687, /trunk/src_new/org/argouml/uml/profile/JavaFormatingStrategy.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/JavaFormatingStrategy.java&p2=trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/JavaFormatingStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java 2007-11-05 19:59:04-0800
@@ -22,11 +22,12 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.util.Iterator;
import org.argouml.model.Model;
+import org.argouml.profile.FormatingStrategy;
/**
* The Formating Strategy based on Java naming conventions
@@ -34,7 +35,7 @@
* @author Marcos Aurélio
*/
public class JavaFormatingStrategy implements FormatingStrategy {
-
+
/**
* @param element the element to be formated
* @param namespace the element's namespace
Copied: trunk/src_new/org/argouml/profile/internal/ModelUtils.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ModelUtils.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ModelUtils.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ModelUtils.java&p2=trunk/src_new/org/argouml/profile/internal/ModelUtils.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ModelUtils.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ModelUtils.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.util.Collection;
Copied: trunk/src_new/org/argouml/profile/internal/ProfileJava.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileJava.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ProfileJava.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ProfileJava.java&p2=trunk/src_new/org/argouml/profile/internal/ProfileJava.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ProfileJava.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ProfileJava.java 2007-11-05 19:59:04-0800
@@ -22,13 +22,16 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.util.ArrayList;
import java.util.Collection;
-import org.apache.log4j.Logger;
import org.argouml.model.Model;
+import org.argouml.profile.DefaultTypeStrategy;
+import org.argouml.profile.Profile;
+import org.argouml.profile.ProfileException;
+import org.argouml.profile.ProfileFacade;
/**
* This class represents the Java default Profile
@@ -37,36 +40,16 @@
*/
public class ProfileJava extends Profile {
- /**
- * Logger.
- */
- private static final Logger LOG = Logger.getLogger(ProfileJava.class);
-
+ static final String NAME = "Java";
private ProfileModelLoader profileModelLoader;
private Collection model;
- private static ProfileJava instance;
-
- /**
- * @return the unique instance for this profile
- */
- public static ProfileJava getInstance() {
- if (instance == null) {
- try {
- instance = new ProfileJava();
- } catch (ProfileException e) {
- LOG.error("Exception", e);
- instance = null;
- }
- }
- return instance;
- }
/**
* The default constructor for this class
* @throws ProfileException
*/
@SuppressWarnings("unchecked")
- private ProfileJava() throws ProfileException {
+ ProfileJava(Profile uml) throws ProfileException {
profileModelLoader = new ResourceModelLoader();
model = profileModelLoader
.loadModel("/org/argouml/default-java.xmi");
@@ -76,15 +59,20 @@
model.add(Model.getModelManagementFactory().createModel());
}
- addProfileDependency(ProfileUML.getInstance());
+ addProfileDependency(uml);
}
+ ProfileJava() throws ProfileException {
+ this(ProfileFacade.getManager().getProfileForClass(
+ ProfileUML.class.getName()));
+ }
+
/*
* @return "Java"
* @see org.argouml.uml.profile.Profile#getDisplayName()
*/
public String getDisplayName() {
- return "Java";
+ return NAME;
}
/*
Copied: trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&p2=trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.io.File;
import java.util.ArrayList;
@@ -33,6 +33,9 @@
import org.argouml.configuration.Configuration;
import org.argouml.configuration.ConfigurationKey;
+import org.argouml.profile.Profile;
+import org.argouml.profile.ProfileException;
+import org.argouml.profile.ProfileManager;
/**
* Default <code>ProfileManager</code> implementation
@@ -53,8 +56,6 @@
public static final ConfigurationKey KEY_DEFAULT_DIRECTORIES = Configuration
.makeKey("profiles", "directories");
- private static ProfileManager instance = null;
-
/**
* Avoids recursive configuration update when loading configuration
*/
@@ -66,12 +67,15 @@
private List<String> searchDirectories = new ArrayList<String>();
- private ProfileManagerImpl() {
- defaultProfiles.add(ProfileUML.getInstance());
-
- registerProfile(ProfileUML.getInstance());
- registerProfile(ProfileJava.getInstance());
- registerProfile(ProfileCpp.getInstance());
+ public ProfileManagerImpl() {
+ try {
+ Profile uml = new ProfileUML();
+ defaultProfiles.add(uml);
+ registerProfile(uml);
+ registerProfile(new ProfileJava(uml));
+ } catch (ProfileException e) {
+ throw new RuntimeException(e);
+ }
loadDirectoriesFromConfiguration();
@@ -111,7 +115,6 @@
StringBuffer buf = new StringBuffer();
for (Profile p : defaultProfiles) {
-
if (p instanceof UserDefinedProfile) {
buf.append("U"
+ ((UserDefinedProfile) p).getModelFile()
@@ -152,17 +155,6 @@
}
}
- /**
- * @return the unique instance for this class
- */
- public static ProfileManager getInstance() {
- if (instance == null) {
- instance = new ProfileManagerImpl();
- }
- return instance;
- }
-
-
public List<Profile> getRegisteredProfiles() {
return profiles;
}
@@ -290,4 +282,18 @@
return null;
}
+ public Profile getUMLProfile() {
+ for (Profile p : getRegisteredProfiles())
+ if (p.getDisplayName() != null
+ && p.getDisplayName().contains("UML"))
+ return p;
+ Profile p = null;
+ try {
+ p = new ProfileUML();
+ } catch (ProfileException e) {
+ throw new RuntimeException(e);
+ }
+ return p;
+ }
+
}
Copied: trunk/src_new/org/argouml/profile/internal/ProfileModelLoader.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileModelLoader.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ProfileModelLoader.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ProfileModelLoader.java&p2=trunk/src_new/org/argouml/profile/internal/ProfileModelLoader.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ProfileModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ProfileModelLoader.java 2007-11-05 19:59:04-0800
@@ -22,10 +22,12 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.util.Collection;
+import org.argouml.profile.ProfileException;
+
/**
* Objects implementing this class are responsible for loading profile models
*
@@ -38,7 +40,8 @@
* @param path the path where the profile can be found. <b>
* The expected string format is implementation specific!
* @return the set of defined packages
- * @throws ProfileException if the profile could not be loaded for some reason
+ * @throws ProfileException if the profile could not be loaded for some
+ * reason
*/
Collection loadModel(String path) throws ProfileException;
}
Copied: trunk/src_new/org/argouml/profile/internal/ProfileUML.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ProfileUML.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ProfileUML.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ProfileUML.java&p2=trunk/src_new/org/argouml/profile/internal/ProfileUML.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ProfileUML.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ProfileUML.java 2007-11-05 19:59:04-0800
@@ -22,13 +22,16 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.util.ArrayList;
import java.util.Collection;
-import org.apache.log4j.Logger;
import org.argouml.model.Model;
+import org.argouml.profile.DefaultTypeStrategy;
+import org.argouml.profile.FormatingStrategy;
+import org.argouml.profile.Profile;
+import org.argouml.profile.ProfileException;
/**
* This class represents the default UML profile
@@ -36,40 +39,21 @@
* @author Marcos Aurélio
*/
public class ProfileUML extends Profile {
-
- /**
- * Logger.
- */
- private static final Logger LOG = Logger.getLogger(ProfileUML.class);
private static final String PROFILE_FILE = "/org/argouml/default-uml14.xmi";
+
+ static final String NAME = "UML 1.4";
private FormatingStrategy formatingStrategy;
private ProfileModelLoader profileModelLoader;
private Collection model;
- private static ProfileUML instance;
-
- /**
- * @return the unique instance for this profile
- */
- public static ProfileUML getInstance() {
- if (instance == null) {
- try {
- instance = new ProfileUML();
- } catch (ProfileException e) {
- LOG.error("Exception", e);
- instance = null;
- }
- }
- return instance;
- }
/**
* The default constructor for this class
* @throws ProfileException
*/
@SuppressWarnings("unchecked")
- private ProfileUML() throws ProfileException {
+ ProfileUML() throws ProfileException {
formatingStrategy = new JavaFormatingStrategy();
profileModelLoader = new ResourceModelLoader();
model = profileModelLoader
@@ -95,7 +79,7 @@
* @see org.argouml.uml.profile.Profile#getDisplayName()
*/
public String getDisplayName() {
- return "UML 1.4";
+ return NAME;
}
/*
Copied: trunk/src_new/org/argouml/profile/internal/ResourceModelLoader.java (from r13687, /trunk/src_new/org/argouml/uml/profile/ResourceModelLoader.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ResourceModelLoader.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/ResourceModelLoader.java&p2=trunk/src_new/org/argouml/profile/internal/ResourceModelLoader.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/ResourceModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ResourceModelLoader.java 2007-11-05 19:59:04-0800
@@ -22,14 +22,15 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.util.Collection;
import org.apache.log4j.Logger;
+import org.argouml.profile.ProfileException;
/**
- * Loads models using the default class loader or a provided one.
+ * Loads models using the default ClassLoader or a provided one.
*
* @author maurelio1234
*/
@@ -41,23 +42,23 @@
private static final Logger LOG = Logger
.getLogger(ResourceModelLoader.class);
- private Class classloader;
+ private Class clazz;
/**
* The default constructor for this class. Loads resources from the same
- * classloader that loaded this class.
+ * ClassLoader that loaded this class.
*/
public ResourceModelLoader() {
- this.classloader = this.getClass();
+ this.clazz = this.getClass();
}
/**
- * Loads resources from the classloader that loaded the given class
+ * Loads resources from the ClassLoader that loaded the given class
*
* @param c the reference class
*/
public ResourceModelLoader(Class c) {
- this.classloader = c;
+ clazz = c;
}
/**
@@ -68,7 +69,7 @@
*/
public Collection loadModel(String path) throws ProfileException {
LOG.info("Loading profile from resource'" + path + "'");
- return super.loadModel(this.classloader.getResourceAsStream(path));
+ return super.loadModel(clazz.getResourceAsStream(path));
}
}
Copied: trunk/src_new/org/argouml/profile/internal/StreamModelLoader.java (from r13687, /trunk/src_new/org/argouml/uml/profile/StreamModelLoader.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/StreamModelLoader.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/StreamModelLoader.java&p2=trunk/src_new/org/argouml/profile/internal/StreamModelLoader.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/StreamModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/internal/StreamModelLoader.java 2007-11-05 19:59:04-0800
@@ -22,7 +22,7 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.io.InputStream;
import java.util.Collection;
@@ -31,6 +31,7 @@
import org.argouml.model.Model;
import org.argouml.model.UmlException;
import org.argouml.model.XmiReader;
+import org.argouml.profile.ProfileException;
import org.xml.sax.InputSource;
/**
@@ -45,14 +46,6 @@
private static final Logger LOG = Logger.getLogger(StreamModelLoader.class);
/**
- * @param path the path of the model
- * @return the loaded model
- * @throws ProfileException
- * @see org.argouml.uml.profile.ProfileModelLoader#loadModel(java.lang.String)
- */
- public abstract Collection loadModel(String path) throws ProfileException;
-
- /**
* @param is the stream from where the model should be loaded
* @return the model
* @throws ProfileException if the XMIReader couldn't read the input stream
Copied: trunk/src_new/org/argouml/profile/internal/UserDefinedProfile.java (from r13687, /trunk/src_new/org/argouml/uml/profile/UserDefinedProfile.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/UserDefinedProfile.java?view=diff&rev=13728&p1=/trunk/src_new/org/argouml/uml/profile/UserDefinedProfile.java&p2=trunk/src_new/org/argouml/profile/internal/UserDefinedProfile.java&r1=13687&r2=13728
==============================================================================
--- /trunk/src_new/org/argouml/uml/profile/UserDefinedProfile.java (original)
+++ trunk/src_new/org/argouml/profile/internal/UserDefinedProfile.java 2007-11-05 19:59:04-0800
@@ -22,11 +22,16 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-package org.argouml.uml.profile;
+package org.argouml.profile.internal;
import java.io.File;
import java.util.Collection;
+import org.argouml.profile.FigNodeStrategy;
+import org.argouml.profile.FormatingStrategy;
+import org.argouml.profile.Profile;
+import org.argouml.profile.ProfileException;
+
/**
* Represents a profile defined by the user
*
@@ -57,12 +62,12 @@
* when loading an user defined profile from a zargo file.
*
* @param fileName the fake file name
- * @param model the model loaded from the zargo file
+ * @param theModel the model loaded from the zargo file
*/
- public UserDefinedProfile(String fileName, Collection model) {
+ public UserDefinedProfile(String fileName, Collection<Object> theModel) {
this.displayName = fileName;
this.modelFile = new File(fileName);
- this.model = model;
+ this.model = theModel;
this.fromZargo = true;
}
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.