Author: tfmorris
Date: 2007-12-01 17:03:27-0800
New Revision: 13850
Modified:
trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java (contents, props changed)
trunk/src_new/org/argouml/profile/FigNodeStrategy.java (contents, props changed)
trunk/src_new/org/argouml/profile/FileModelLoader.java (contents, props changed)
trunk/src_new/org/argouml/profile/FormatingStrategy.java (contents, props changed)
trunk/src_new/org/argouml/profile/InitProfileSubsystem.java
trunk/src_new/org/argouml/profile/Profile.java (contents, props changed)
trunk/src_new/org/argouml/profile/ProfileException.java (contents, props changed)
trunk/src_new/org/argouml/profile/ProfileManager.java (contents, props changed)
trunk/src_new/org/argouml/profile/ProfileModelLoader.java (contents, props changed)
trunk/src_new/org/argouml/profile/ResourceModelLoader.java (contents, props changed)
trunk/src_new/org/argouml/profile/StreamModelLoader.java (contents, props changed)
trunk/src_new/org/argouml/profile/UserDefinedProfile.java (contents, props changed)
trunk/src_new/org/argouml/profile/ZipModelLoader.java (contents, props changed)
trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java (contents, props changed)
trunk/src_new/org/argouml/profile/internal/ModelUtils.java (contents, props changed)
trunk/src_new/org/argouml/profile/internal/ProfileJava.java (contents, props changed)
trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java (contents, props changed)
trunk/src_new/org/argouml/profile/internal/ProfileUML.java (contents, props changed)
trunk/src_new/org/argouml/profile/package.html (contents, props changed)
Log:
Add SVN properties for $Id replacement & eol-style
Convert tab based indentation to spaces.
Eliminate redundant Javadoc (but hoist eulis' improved version to superclases and interfaces from implementation classes)
Fix Javadoc that suffers from cloning disease
Modified: trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java&p2=trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/DefaultTypeStrategy.java 2007-12-01 17:03:27-0800
@@ -1,48 +1,48 @@
-// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
-// 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;
-
-/**
- * Using this strategy profiles can provide the default used when creating new
- * parameters, operations and attributes.
- *
- * @author maurelio1234
- */
-public interface DefaultTypeStrategy {
- /**
- * @return the default type used in new attributes
- */
- public Object getDefaultAttributeType();
-
- /**
- * @return the default type used in new parameters
- */
- public Object getDefaultParameterType();
-
- /**
- * @return the default type used in new operations
- */
- public Object getDefaultReturnType();
-}
+// $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;
+
+/**
+ * Using this strategy profiles can provide the default used when creating new
+ * parameters, operations and attributes.
+ *
+ * @author maurelio1234
+ */
+public interface DefaultTypeStrategy {
+ /**
+ * @return the default type used in new attributes
+ */
+ public Object getDefaultAttributeType();
+
+ /**
+ * @return the default type used in new parameters
+ */
+ public Object getDefaultParameterType();
+
+ /**
+ * @return the default type used in new operations
+ */
+ public Object getDefaultReturnType();
+}
Modified: trunk/src_new/org/argouml/profile/FigNodeStrategy.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/FigNodeStrategy.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/FigNodeStrategy.java&p2=trunk/src_new/org/argouml/profile/FigNodeStrategy.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/FigNodeStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/FigNodeStrategy.java 2007-12-01 17:03:27-0800
@@ -1,46 +1,46 @@
-// $Id: FigNodeStrategy.java 13040 2007-07-10 20:00:25Z linus $
-// 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.awt.Image;
-
-/**
- * Using this strategy profiles can provide icons to replace the default
- * visualization of stereotyped node according to UML 2.0 specification.
- *
- * @author maurelio1234
- */
-public interface FigNodeStrategy {
-
- /**
- * Returns the image of the icon that should replace the model elements
- * having this stereotype
- *
- * @param stereotype the stereotype model element
- * @return the icon or <code>null</code> if the stereotype has no icon
- */
- Image getIconForStereotype(Object stereotype);
-
-}
+// $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.awt.Image;
+
+/**
+ * Using this strategy profiles can provide icons to replace the default
+ * visualization of stereotyped node according to UML 2.0 specification.
+ *
+ * @author maurelio1234
+ */
+public interface FigNodeStrategy {
+
+ /**
+ * Returns the image of the icon that should replace the model elements
+ * having this stereotype
+ *
+ * @param stereotype the stereotype model element
+ * @return the icon or <code>null</code> if the stereotype has no icon
+ */
+ Image getIconForStereotype(Object stereotype);
+
+}
Modified: trunk/src_new/org/argouml/profile/FileModelLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/FileModelLoader.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/FileModelLoader.java&p2=trunk/src_new/org/argouml/profile/FileModelLoader.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/FileModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/FileModelLoader.java 2007-12-01 17:03:27-0800
@@ -1,68 +1,61 @@
-// $Id: FileModelLoader.java 13040 2007-07-10 20:00:25Z linus $
-// 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.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Collection;
-
-import org.apache.log4j.Logger;
-
-/**
- * An implementation for the ProfileModelLoader that loads profiles from files.
- *
- * @author maurelio1234
- */
-public class FileModelLoader extends StreamModelLoader {
- /**
- * Logger.
- */
- private static final Logger LOG = Logger.getLogger(FileModelLoader.class);
-
- /**
- * @param modelFilename the model to be loaded
- * @return the profile model
- * @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 {
- LOG.info("Loading profile from file'" + modelFilename + "'");
- InputStream is = null;
- //
- // try to find a file with that name
- //
- try {
- File modelFile = new File(modelFilename);
- is = new FileInputStream(modelFile);
-
- return super.loadModel(is);
- } catch (FileNotFoundException ex) {
- throw new ProfileException("Model file not found!");
- }
- }
-
-}
+// $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.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+
+/**
+ * An implementation for the ProfileModelLoader that loads profiles from files.
+ *
+ * @author maurelio1234
+ */
+public class FileModelLoader extends StreamModelLoader {
+
+ private static final Logger LOG = Logger.getLogger(FileModelLoader.class);
+
+
+ public Collection loadModel(String modelFilename) throws ProfileException {
+ LOG.info("Loading profile from file'" + modelFilename + "'");
+ InputStream is = null;
+ //
+ // try to find a file with that name
+ //
+ try {
+ File modelFile = new File(modelFilename);
+ is = new FileInputStream(modelFile);
+
+ return super.loadModel(is);
+ } catch (FileNotFoundException ex) {
+ throw new ProfileException("Model file not found!");
+ }
+ }
+
+}
Modified: trunk/src_new/org/argouml/profile/FormatingStrategy.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/FormatingStrategy.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/FormatingStrategy.java&p2=trunk/src_new/org/argouml/profile/FormatingStrategy.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/FormatingStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/FormatingStrategy.java 2007-12-01 17:03:27-0800
@@ -1,54 +1,60 @@
-// $Id: FormatingStrategy.java 13040 2007-07-10 20:00:25Z linus $
-// 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.Iterator;
-
-/**
- * Represents the formating strategy to be used when formating
- * model element names
- *
- * @author Marcos Aurélio
- */
-public interface FormatingStrategy {
- /**
- * This method produces a string that represents the specific
- * model element in the context of the specified namespace.
- * @param element element to represent.
- * @param namespace context namespace (may be null).
- * @return a string representing the model element
- */
- public abstract String formatElement(Object element,
- Object namespace);
- /**
- * This method produces a string the represents the collection
- * of model elements in the context of the specified namespace.
- * @param iter iterator over collection
- * @param namespace context namespace (may be null).
- * @return a string representing the collection
- */
- public abstract String formatCollection(Iterator iter,
- Object namespace);
-}
+// $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.Iterator;
+
+/**
+ * Interface for the formating strategy to be used when formating model element
+ * names.
+ *
+ * @author Marcos Aurélio
+ */
+public interface FormatingStrategy {
+
+ /**
+ * Produce a string that represents the specific model element in the
+ * context of the specified namespace.
+ *
+ * @param element
+ * element to represent.
+ * @param namespace
+ * context namespace (may be null).
+ * @return a string representing the model element
+ */
+ public abstract String formatElement(Object element, Object namespace);
+
+ /**
+ * Produce a string the represents the collection of model elements in the
+ * context of the specified namespace.
+ *
+ * @param iter
+ * iterator over collection
+ * @param namespace
+ * context namespace (may be null).
+ * @return a string representing the collection
+ */
+ public abstract String formatCollection(Iterator iter, Object namespace);
+}
Modified: 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=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/InitProfileSubsystem.java&p2=trunk/src_new/org/argouml/profile/InitProfileSubsystem.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/InitProfileSubsystem.java (original)
+++ trunk/src_new/org/argouml/profile/InitProfileSubsystem.java 2007-12-01 17:03:27-0800
@@ -31,32 +31,20 @@
import org.argouml.application.api.InitSubsystem;
/**
- *
+ * Initializer class for the Profile subsystem.
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class InitProfileSubsystem implements InitSubsystem {
- /**
- * @see org.argouml.application.api.InitSubsystem#getProjectSettingsTabs()
- *
- * @return the settings for this subsystem
- */
public List<GUISettingsTabInterface> getProjectSettingsTabs() {
return new ArrayList<GUISettingsTabInterface>();
}
- /**
- * @see org.argouml.application.api.InitSubsystem#getSettingsTabs()
- *
- * @return the settings for this subsystem
- */
public List<GUISettingsTabInterface> getSettingsTabs() {
return new ArrayList<GUISettingsTabInterface>();
}
- /**
- * @see org.argouml.application.api.InitSubsystem#init()
- */
public void init() {
ProfileFacade.setManager(
new org.argouml.profile.internal.ProfileManagerImpl());
Modified: trunk/src_new/org/argouml/profile/Profile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/Profile.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/Profile.java&p2=trunk/src_new/org/argouml/profile/Profile.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/Profile.java (original)
+++ trunk/src_new/org/argouml/profile/Profile.java 2007-12-01 17:03:27-0800
@@ -1,233 +1,237 @@
-// $Id: Profile.java 13298 2007-08-12 19:40:57Z maurelio1234 $
-// 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.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.argouml.model.Model;
-
-
-/**
- * Represents a Profile
- *
- * @author Marcos Aurélio
- */
-public abstract class Profile {
-
- private Set<Profile> importedProfiles = new HashSet<Profile>();
- private Set<Profile> importingProfiles = new HashSet<Profile>();
-
- /**
- * Add a dependency on the given profile from this profile.
- *
- * @param p
- * the profile
- * @throws IllegalArgumentException
- * if there is some cycle on the dependency graph
- */
- protected final void addProfileDependency(Profile p)
- throws IllegalArgumentException {
-
- if (importingProfiles.contains(p)) {
- throw new IllegalArgumentException("This profile causes a cycle "
- + "in the profile dependency graph!");
- } else {
- importedProfiles.add(p);
- importedProfiles.addAll(p.importedProfiles);
-
- for (Profile importedProfile : importedProfiles) {
- importedProfile.importingProfiles.add(this);
- }
- }
- }
-
- /**
- * @return the dependencies
- */
- public final Set<Profile> getDependencies() {
- return importedProfiles;
- }
-
- /**
- * @return the name for this profile
- */
- public abstract String getDisplayName();
-
- /**
- * @return the UML Model that contains the profile model
- * @deprecated by maurelio1234. Use {@link #getProfilePackages()} instead.
- */
- @Deprecated
- public Object getModel() {
- Collection c = null;
- try {
- c = getProfilePackages();
- } catch (ProfileException e) {
- }
-
- if (c != null) {
- return c.iterator().next();
- } else {
- return null;
- }
- }
-
- /**
- * @return the formating strategy offered by this profile, if any. <br>
- * <b>null</b> if this profile has no formating strategy.
- */
- public FormatingStrategy getFormatingStrategy() {
- return null;
- }
-
- /**
- * @return the FigNodeStrategy offered by this profile, if any. <br>
- * <b>null</b> if this profile has no FigNodeStrategy.
- */
- public FigNodeStrategy getFigureStrategy() {
- return null;
- }
-
- /**
- * @return the DefaultTypeStrategy offered by this profile, if any. <br>
- * <b>null</b> if this profile has no DefaultTypeStrategy.
- */
- public DefaultTypeStrategy getDefaultTypeStrategy() {
- return null;
- }
-
- /**
- * This method produces a string that represents the specific model element
- * in the context of the specified namespace.
- *
- * @param element
- * element to represent.
- * @param namespace
- * context namespace (may be null).
- * @return a string representing the model element
- *
- * @deprecated for 0.25.4 by maurelio1234. Use
- * {@link #getFormatingStrategy()} instead.
- */
- @Deprecated
- public String formatElement(Object element,
- Object namespace) {
- FormatingStrategy fs = getFormatingStrategy();
- if (fs != null) {
- return fs.formatElement(element, namespace);
- } else {
- return null;
- }
- }
-
- /**
- * This method produces a string the represents the collection of model
- * elements in the context of the specified namespace.
- *
- * @param iter
- * iterator over collection
- * @param namespace
- * context namespace (may be null).
- * @return a string representing the collection
- *
- * @deprecated for 0.25.4 by maurelio1234. Use
- * {@link #getFormatingStrategy()} instead.
- */
- @Deprecated
- public String formatCollection(Iterator iter,
- Object namespace) {
- FormatingStrategy fs = getFormatingStrategy();
- if (fs != null) {
- return fs.formatCollection(iter, namespace);
- } else {
- return null;
- }
- }
- /**
- * @return the UML Model that contains the profile model
- * @throws ProfileException if failed to get profile.
- * @deprecated for 0.25.4 by tfmorris. Use {@link #getProfilePackages()}.
- */
- @Deprecated
- public Object getProfileModel() throws ProfileException {
- if (getModel() == null) {
- Object profileModel = null;
- for (Object pkg : getProfilePackages()) {
- if (Model.getFacade().isAPackage(pkg)) {
- profileModel = pkg;
- return profileModel;
- }
- }
- profileModel = getProfilePackages().iterator().next();
-
- return profileModel;
- } else {
- return getModel();
- }
- }
-
- /**
- * @return the UML Model that contains the profile model
- * @throws ProfileException if failed to get profile.
- */
- public abstract Collection getProfilePackages() throws ProfileException;
-
- /**
- * Set the filename to load the profile model from. This will be
- * remembered and used as the file for all future loads.
- * @param filename file name of XMI file containing model to use as profile
- *
- * @throws ProfileException if the given file isn't a valid profile
- * @deprecated by maurelio1234
- */
- @SuppressWarnings("unused")
- @Deprecated
- public void setProfileModelFilename(String filename)
- throws ProfileException {
-
- }
-
- /**
- * Return the filename that was or will be used to load the profile/default
- * model.
- * @return the filename
- * @deprecated by maurelio1234
- */
- @Deprecated
- public String getProfileModelFilename() {
- return "";
- }
-
- /**
- * @return the display name
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getDisplayName();
- }
-}
+// $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.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.argouml.model.Model;
+
+
+/**
+ * Abstract class representing a Profile. It contains default types and
+ * presentation characteristics that can be tailored to various modeling
+ * environments.
+ *
+ * @author Marcos Aurélio
+ */
+public abstract class Profile {
+
+ private Set<Profile> importedProfiles = new HashSet<Profile>();
+ private Set<Profile> importingProfiles = new HashSet<Profile>();
+
+ /**
+ * Add a dependency on the given profile from this profile.
+ *
+ * @param p
+ * the profile
+ * @throws IllegalArgumentException
+ * if there is some cycle on the dependency graph
+ */
+ protected final void addProfileDependency(Profile p)
+ throws IllegalArgumentException {
+
+ if (importingProfiles.contains(p)) {
+ throw new IllegalArgumentException("This profile causes a cycle "
+ + "in the profile dependency graph!");
+ } else {
+ importedProfiles.add(p);
+ importedProfiles.addAll(p.importedProfiles);
+
+ for (Profile importedProfile : importedProfiles) {
+ importedProfile.importingProfiles.add(this);
+ }
+ }
+ }
+
+ /**
+ * @return the dependencies
+ */
+ public final Set<Profile> getDependencies() {
+ return importedProfiles;
+ }
+
+ /**
+ * @return the name for this profile
+ */
+ public abstract String getDisplayName();
+
+ /**
+ * @return the UML Model that contains the profile model
+ * @deprecated by maurelio1234. Use {@link #getProfilePackages()} instead.
+ */
+ @Deprecated
+ public Object getModel() {
+ Collection c = null;
+ try {
+ c = getProfilePackages();
+ } catch (ProfileException e) {
+ }
+
+ if (c != null) {
+ return c.iterator().next();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @return the formating strategy offered by this profile, if any. Returns
+ * <code>null</code> if this profile has no formating strategy.
+ */
+ public FormatingStrategy getFormatingStrategy() {
+ return null;
+ }
+
+ /**
+ * @return the FigNodeStrategy offered by this profile, if any. Returns
+ * <code>null</code> if this profile has no FigNodeStrategy.
+ */
+ public FigNodeStrategy getFigureStrategy() {
+ return null;
+ }
+
+ /**
+ * @return the DefaultTypeStrategy offered by this profile, if any. Returns
+ * <code>null</code> if this profile has no DefaultTypeStrategy.
+ */
+ public DefaultTypeStrategy getDefaultTypeStrategy() {
+ return null;
+ }
+
+ /**
+ * This method produces a string that represents the specific model element
+ * in the context of the specified namespace.
+ *
+ * @param element
+ * element to represent.
+ * @param namespace
+ * context namespace (may be null).
+ * @return a string representing the model element
+ *
+ * @deprecated for 0.25.4 by maurelio1234. Use
+ * {@link #getFormatingStrategy()} instead.
+ */
+ @Deprecated
+ public String formatElement(Object element,
+ Object namespace) {
+ FormatingStrategy fs = getFormatingStrategy();
+ if (fs != null) {
+ return fs.formatElement(element, namespace);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * This method produces a string the represents the collection of model
+ * elements in the context of the specified namespace.
+ *
+ * @param iter
+ * iterator over collection
+ * @param namespace
+ * context namespace (may be null).
+ * @return a string representing the collection
+ *
+ * @deprecated for 0.25.4 by maurelio1234. Use
+ * {@link #getFormatingStrategy()} instead.
+ */
+ @Deprecated
+ public String formatCollection(Iterator iter,
+ Object namespace) {
+ FormatingStrategy fs = getFormatingStrategy();
+ if (fs != null) {
+ return fs.formatCollection(iter, namespace);
+ } else {
+ return null;
+ }
+ }
+ /**
+ * @return the UML Model that contains the profile model
+ * @throws ProfileException if failed to get profile.
+ * @deprecated for 0.25.4 by tfmorris. Use {@link #getProfilePackages()}.
+ */
+ @Deprecated
+ public Object getProfileModel() throws ProfileException {
+ if (getModel() == null) {
+ Object profileModel = null;
+ for (Object pkg : getProfilePackages()) {
+ if (Model.getFacade().isAPackage(pkg)) {
+ profileModel = pkg;
+ return profileModel;
+ }
+ }
+ profileModel = getProfilePackages().iterator().next();
+
+ return profileModel;
+ } else {
+ return getModel();
+ }
+ }
+
+ /**
+ * @return a collection of the top level UML Packages containing the
+ * profile.
+ * @throws ProfileException
+ * if failed to get profile.
+ */
+ public abstract Collection getProfilePackages() throws ProfileException;
+
+ /**
+ * Set the filename to load the profile model from. This will be
+ * remembered and used as the file for all future loads.
+ * @param filename file name of XMI file containing model to use as profile
+ *
+ * @throws ProfileException if the given file isn't a valid profile
+ * @deprecated by maurelio1234
+ */
+ @SuppressWarnings("unused")
+ @Deprecated
+ public void setProfileModelFilename(String filename)
+ throws ProfileException {
+
+ }
+
+ /**
+ * Return the filename that was or will be used to load the profile/default
+ * model.
+ * @return the filename
+ * @deprecated by maurelio1234
+ */
+ @Deprecated
+ public String getProfileModelFilename() {
+ return "";
+ }
+
+ /**
+ * @return the display name
+ */
+ @Override
+ public String toString() {
+ return getDisplayName();
+ }
+}
Modified: trunk/src_new/org/argouml/profile/ProfileException.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ProfileException.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/ProfileException.java&p2=trunk/src_new/org/argouml/profile/ProfileException.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/ProfileException.java (original)
+++ trunk/src_new/org/argouml/profile/ProfileException.java 2007-12-01 17:03:27-0800
@@ -1,62 +1,64 @@
-// $Id: ProfileException.java 13040 2007-07-10 20:00:25Z linus $
-// Copyright (c) 1996-2006 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;
-
-/**
- * An exception to be thrown during failure of a opening
- * and reading some storage medium.
- * @author Bob Tarling
- */
-public class ProfileException extends Exception {
-
- /**
- * The constructor.
- *
- * @param message the message to show
- */
- public ProfileException(String message) {
- super(message);
- }
-
- /**
- * The constructor.
- *
- * @param message the message to show
- * @param theCause the cause for the exception
- */
- public ProfileException(String message, Throwable theCause) {
- super(message, theCause);
- }
-
- /**
- * The constructor.
- *
- * @param theCause the cause for the exception
- */
- public ProfileException(Throwable theCause) {
- super(theCause);
- }
-}
-
+// $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;
+
+/**
+ * An exception to be thrown during failure in the Profile subsystem.
+ * This will typically be a wrapped exception containing the exception
+ * representing the underlying failure cause.
+ *
+ * @author Marcus Aurelio (maurelio1234)
+ */
+public class ProfileException extends Exception {
+
+ /**
+ * The constructor.
+ *
+ * @param message the message to show
+ */
+ public ProfileException(String message) {
+ super(message);
+ }
+
+ /**
+ * The constructor.
+ *
+ * @param message the message to show
+ * @param theCause the cause for the exception
+ */
+ public ProfileException(String message, Throwable theCause) {
+ super(message, theCause);
+ }
+
+ /**
+ * The constructor.
+ *
+ * @param theCause the cause for the exception
+ */
+ public ProfileException(Throwable theCause) {
+ super(theCause);
+ }
+}
+
Modified: trunk/src_new/org/argouml/profile/ProfileManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ProfileManager.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/ProfileManager.java&p2=trunk/src_new/org/argouml/profile/ProfileManager.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/ProfileManager.java (original)
+++ trunk/src_new/org/argouml/profile/ProfileManager.java 2007-12-01 17:03:27-0800
@@ -1,112 +1,116 @@
-// $Id: ProfileManager.java 13090 2007-07-16 12:37:40Z maurelio1234 $
-// 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.List;
-
-/**
- * Manages the global set of registered profiles.
- *
- * @author maurelio1234
- */
-public interface ProfileManager {
-
- /**
- * Register a new profile.
- *
- * @param p the profile
- */
- void registerProfile(Profile p);
-
- /**
- * Remove a profile from the list.
- *
- * @param p the profile
- */
- void removeProfile(Profile p);
-
- /**
- * @return the list of registered profiles
- */
- List<Profile> getRegisteredProfiles();
-
- /**
- * TODO: Add better Javadoc here.
- *
- * @return the profile instance for the class or null if there is none.
- * @param className the name of the class for which to get the profile
- */
- Profile getProfileForClass(String className);
-
- /**
- * @return the default set of profiles
- */
- List<Profile> getDefaultProfiles();
-
- /**
- * Add a profile to the default list.
- *
- * @param p profile to add
- */
- void addToDefaultProfiles(Profile p);
-
- /**
- * Remove a profile from the default list.
- *
- * @param p the profile to be removed
- */
- void removeFromDefaultProfiles(Profile p);
-
- /**
- * Add a new directory to the directory list.
- *
- * @param path user defined directory
- */
- void addSearchPathDirectory(String path);
-
- /**
- * Remove a directory from the directory list.
- *
- * @param path the directory path to be removed.
- */
- void removeSearchPathDirectory(String path);
-
- /**
- * @return the current directory list
- */
- List<String> getSearchPathDirectories();
-
- /**
- * Look for XMI files at the current directory list and registers
- * 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();
-}
+// $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.List;
+
+/**
+ * Interface to the manager for the global set of registered profiles.
+ *
+ * @author maurelio1234
+ */
+public interface ProfileManager {
+
+ /**
+ * Register a new profile.
+ *
+ * @param profile A profile to be registered so that it is available to the
+ * users.
+ */
+ void registerProfile(Profile profile);
+
+ /**
+ * Remove a profile from the list of registered profiles.
+ *
+ * @param profile the profile to unregister. It will no longer be available
+ * for selection by users
+ */
+ void removeProfile(Profile profile);
+
+ /**
+ * @return the list of registered profiles
+ */
+ List<Profile> getRegisteredProfiles();
+
+ /**
+ * Search for a Profile with the given Java classname.
+ *
+ * @return the profile instance for the class or null if there is none.
+ * @param className the name of the Java class to search for.
+ */
+ Profile getProfileForClass(String className);
+
+ /**
+ * @return the default list of profiles
+ */
+ List<Profile> getDefaultProfiles();
+
+ /**
+ * Add a profile to the default list.
+ *
+ * @param profile profile to be added to the default application profiles.
+ * New models will reference it by default
+ */
+ void addToDefaultProfiles(Profile profile);
+
+ /**
+ * Remove a profile from the default list.
+ *
+ * @param profile the profile to be removed
+ */
+ void removeFromDefaultProfiles(Profile profile);
+
+ /**
+ * Add a new directory to the directory list.
+ *
+ * @param path a directory name where the manager will try to look for
+ * user defined profiles as XMI files
+ */
+ void addSearchPathDirectory(String path);
+
+ /**
+ * Remove a directory from the directory list.
+ *
+ * @param path the directory path to be removed.
+ */
+ void removeSearchPathDirectory(String path);
+
+ /**
+ * @return the current directory list
+ */
+ List<String> getSearchPathDirectories();
+
+ /**
+ * Look for XMI files at the current directory list and registers
+ * 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();
+}
Modified: trunk/src_new/org/argouml/profile/ProfileModelLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ProfileModelLoader.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/ProfileModelLoader.java&p2=trunk/src_new/org/argouml/profile/ProfileModelLoader.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/ProfileModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/ProfileModelLoader.java 2007-12-01 17:03:27-0800
@@ -1,45 +1,46 @@
-// $Id: ProfileModelLoader.java 13040 2007-07-10 20:00:25Z linus $
-// 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.Collection;
-
-/**
- * Objects implementing this class are responsible for loading profile models
- *
- * @author maurelio1234
- */
-public interface ProfileModelLoader {
- /**
- * Tries to load a model from the specified path
- *
- * @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
- */
- Collection loadModel(String path) throws ProfileException;
-}
+// $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.Collection;
+
+/**
+ * Interface to be implemented by profile model loaders.
+ *
+ * @author maurelio1234
+ */
+public interface ProfileModelLoader {
+
+ /**
+ * Load a model from the specified path.
+ *
+ * @param path the path where the profile can be found. <em>Note:</em>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
+ */
+ Collection loadModel(String path) throws ProfileException;
+}
Modified: trunk/src_new/org/argouml/profile/ResourceModelLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ResourceModelLoader.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/ResourceModelLoader.java&p2=trunk/src_new/org/argouml/profile/ResourceModelLoader.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/ResourceModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/ResourceModelLoader.java 2007-12-01 17:03:27-0800
@@ -1,74 +1,69 @@
-// $Id: ResourceModelLoader.java 13040 2007-07-10 20:00:25Z linus $
-// 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.Collection;
-
-import org.apache.log4j.Logger;
-
-/**
- * Loads models using the default ClassLoader or a provided one.
- *
- * @author maurelio1234
- */
-public class ResourceModelLoader extends StreamModelLoader {
-
- /**
- * Logger.
- */
- private static final Logger LOG = Logger
- .getLogger(ResourceModelLoader.class);
-
- private Class clazz;
-
- /**
- * The default constructor for this class. Loads resources from the same
- * ClassLoader that loaded this class.
- */
- public ResourceModelLoader() {
- this.clazz = this.getClass();
- }
-
- /**
- * Loads resources from the ClassLoader that loaded the given class
- *
- * @param c the reference class
- */
- public ResourceModelLoader(Class c) {
- clazz = c;
- }
-
- /**
- * @param path the model path
- * @return the model
- * @throws ProfileException if the profile could not be loaded
- * @see org.argouml.uml.profile.StreamModelLoader#loadModel(java.lang.String)
- */
- public Collection loadModel(String path) throws ProfileException {
- LOG.info("Loading profile from resource'" + path + "'");
- return super.loadModel(clazz.getResourceAsStream(path));
- }
-
-}
+// $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.Collection;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Loads models using the default ClassLoader or a provided one.
+ *
+ * @author maurelio1234
+ */
+public class ResourceModelLoader extends StreamModelLoader {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = Logger
+ .getLogger(ResourceModelLoader.class);
+
+ private Class clazz;
+
+ /**
+ * The default constructor for this class. Loads resources from the same
+ * ClassLoader that loaded this class.
+ */
+ public ResourceModelLoader() {
+ this.clazz = this.getClass();
+ }
+
+ /**
+ * Loads resources from the ClassLoader that loaded the given class
+ *
+ * @param c the reference class
+ */
+ public ResourceModelLoader(Class c) {
+ clazz = c;
+ }
+
+
+ public Collection loadModel(String path) throws ProfileException {
+ LOG.info("Loading profile from resource'" + path + "'");
+ return super.loadModel(clazz.getResourceAsStream(path));
+ }
+
+}
Modified: trunk/src_new/org/argouml/profile/StreamModelLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/StreamModelLoader.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/StreamModelLoader.java&p2=trunk/src_new/org/argouml/profile/StreamModelLoader.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/StreamModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/StreamModelLoader.java 2007-12-01 17:03:27-0800
@@ -1,67 +1,67 @@
-// $Id: StreamModelLoader.java 13040 2007-07-10 20:00:25Z linus $
-// 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.io.InputStream;
-import java.util.Collection;
-
-import org.apache.log4j.Logger;
-import org.argouml.model.Model;
-import org.argouml.model.UmlException;
-import org.argouml.model.XmiReader;
-import org.xml.sax.InputSource;
-
-/**
- * Loads models from a given InputStream
- *
- * @author Marcos Aurélio
- */
-public abstract class StreamModelLoader implements ProfileModelLoader {
- /**
- * Logger.
- */
- private static final Logger LOG = Logger.getLogger(StreamModelLoader.class);
-
- /**
- * @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
- */
- protected Collection loadModel(InputStream is) throws ProfileException {
- if (is != null) {
- try {
- XmiReader xmiReader = Model.getXmiReader();
- InputSource inputSource = new InputSource(is);
- Collection elements = xmiReader.parse(inputSource, true);
- return elements;
- } catch (UmlException e) {
- LOG.error("Exception while loading profile ", e);
- throw new ProfileException("Invalid XMI data!");
- }
- }
- LOG.error("Profile not found");
- throw new ProfileException("Profile not found!");
- }
-}
+// $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.io.InputStream;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+import org.argouml.model.Model;
+import org.argouml.model.UmlException;
+import org.argouml.model.XmiReader;
+import org.xml.sax.InputSource;
+
+/**
+ * Abstract ProfileModelLoader which loads models from an InputStream.
+ *
+ * @author Marcos Aurélio
+ */
+public abstract class StreamModelLoader implements ProfileModelLoader {
+
+ private static final Logger LOG = Logger.getLogger(StreamModelLoader.class);
+
+ /**
+ * @param inputStream the stream from where the model should be loaded
+ * @return the model
+ * @throws ProfileException if the XMIReader couldn't read the input stream
+ */
+ protected Collection loadModel(InputStream inputStream)
+ throws ProfileException {
+
+ if (inputStream != null) {
+ try {
+ XmiReader xmiReader = Model.getXmiReader();
+ InputSource inputSource = new InputSource(inputStream);
+ Collection elements = xmiReader.parse(inputSource, true);
+ return elements;
+ } catch (UmlException e) {
+ LOG.error("Exception while loading profile ", e);
+ throw new ProfileException("Invalid XMI data!");
+ }
+ }
+ LOG.error("Profile not found");
+ throw new ProfileException("Profile not found!");
+ }
+}
Modified: trunk/src_new/org/argouml/profile/UserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/UserDefinedProfile.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/UserDefinedProfile.java&p2=trunk/src_new/org/argouml/profile/UserDefinedProfile.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/UserDefinedProfile.java (original)
+++ trunk/src_new/org/argouml/profile/UserDefinedProfile.java 2007-12-01 17:03:27-0800
@@ -1,123 +1,118 @@
-// $Id: UserDefinedProfile.java 13094 2007-07-18 11:44:08Z maurelio1234 $
-// 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.io.File;
-import java.util.Collection;
-
-/**
- * Represents a profile defined by the user
- *
- * @author Marcos Aurélio
- */
-public class UserDefinedProfile extends Profile {
-
- private String displayName;
- private File modelFile;
- private Collection model;
- private boolean fromZargo;
-
- /**
- * The default constructor for this class
- *
- * @param file the file from where the model should be read
- * @throws ProfileException if the profile could not be loaded
- */
- public UserDefinedProfile(File file) throws ProfileException {
- this.displayName = file.getName();
- this.modelFile = file;
- this.model = new FileModelLoader().loadModel(modelFile.getPath());
- this.fromZargo = false;
- }
-
- /**
- * This constructor is used by the persitence subsystem
- * when loading an user defined profile from a zargo file.
- *
- * @param fileName the fake file name
- * @param theModel the model loaded from the zargo file
- */
- public UserDefinedProfile(String fileName, Collection<Object> theModel) {
- this.displayName = fileName;
- this.modelFile = new File(fileName);
- this.model = theModel;
- this.fromZargo = true;
- }
-
- /**
- * @return the string that should represent this profile in the GUI. An
- * start (*) is placed on it if it comes from the currently opened
- * zargo file.
- *
- * @see org.argouml.uml.profile.Profile#getDisplayName()
- */
- public String getDisplayName() {
- return displayName + (fromZargo ? "*" : "");
- }
-
-
- /**
- * @return null
- * @see org.argouml.profile.Profile#getFormatingStrategy()
- */
- @Override
- public FormatingStrategy getFormatingStrategy() {
- return null;
- }
-
- /**
- * @return null
- * @see org.argouml.profile.Profile#getFigureStrategy()
- */
- @Override
- public FigNodeStrategy getFigureStrategy() {
- return null;
- }
-
- /**
- * @return the file passed at the constructor
- */
- public File getModelFile() {
- return modelFile;
- }
-
- /**
- * @return the name of the model and the file name
- * @see org.argouml.profile.Profile#toString()
- */
- @Override
- public String toString() {
- return super.toString() + " [" + getModelFile() + "]";
- }
-
- /**
- * @return the container that contains the model
- * @see org.argouml.profile.Profile#getProfilePackages()
- */
- @Override
- public Collection getProfilePackages() {
- return model;
- }
-}
+// $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.io.File;
+import java.util.Collection;
+
+/**
+ * Represents a profile defined by the user
+ *
+ * @author Marcos Aurélio
+ */
+public class UserDefinedProfile extends Profile {
+
+ private String displayName;
+ private File modelFile;
+ private Collection model;
+ private boolean fromZargo;
+
+ /**
+ * The default constructor for this class
+ *
+ * @param file the file from where the model should be read
+ * @throws ProfileException if the profile could not be loaded
+ */
+ public UserDefinedProfile(File file) throws ProfileException {
+ this.displayName = file.getName();
+ this.modelFile = file;
+ this.model = new FileModelLoader().loadModel(modelFile.getPath());
+ this.fromZargo = false;
+ }
+
+ /**
+ * This constructor is used by the persitence subsystem
+ * when loading an user defined profile from a zargo file.
+ *
+ * @param fileName the fake file name
+ * @param theModel the model loaded from the zargo file
+ */
+ public UserDefinedProfile(String fileName, Collection<Object> theModel) {
+ this.displayName = fileName;
+ this.modelFile = new File(fileName);
+ this.model = theModel;
+ this.fromZargo = true;
+ }
+
+ /**
+ * @return the string that should represent this profile in the GUI. An
+ * start (*) is placed on it if it comes from the currently opened
+ * zargo file.
+ */
+ public String getDisplayName() {
+ return displayName + (fromZargo ? "*" : "");
+ }
+
+
+ /**
+ * Returns null. This profile has no formatting strategy.
+ * @return null.
+ */
+ @Override
+ public FormatingStrategy getFormatingStrategy() {
+ return null;
+ }
+
+ /**
+ * Returns null. This profile has no figure strategy.
+ * @return null.
+ */
+ @Override
+ public FigNodeStrategy getFigureStrategy() {
+ return null;
+ }
+
+ /**
+ * @return the file passed at the constructor
+ */
+ public File getModelFile() {
+ return modelFile;
+ }
+
+ /**
+ * @return the name of the model and the file name
+ */
+ @Override
+ public String toString() {
+ // TODO: I18N
+ return super.toString() + " [" + getModelFile() + "]";
+ }
+
+
+ @Override
+ public Collection getProfilePackages() {
+ return model;
+ }
+}
Modified: trunk/src_new/org/argouml/profile/ZipModelLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/ZipModelLoader.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/ZipModelLoader.java&p2=trunk/src_new/org/argouml/profile/ZipModelLoader.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/ZipModelLoader.java (original)
+++ trunk/src_new/org/argouml/profile/ZipModelLoader.java 2007-12-01 17:03:27-0800
@@ -1,118 +1,110 @@
-// $Id: ZipModelLoader.java 13040 2007-07-10 20:00:25Z linus $
-// 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.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.apache.log4j.Logger;
-
-/**
- * Loads model data from a Zip file
- *
- * @author maurelio1234
- */
-public class ZipModelLoader extends StreamModelLoader {
- /**
- * Logger.
- */
- private static final Logger LOG = Logger
- .getLogger(ZipModelLoader.class);
-
- /**
- * @param modelFilename the zip file
- * @return the loaded model
- * @throws ProfileException if the profile could not be loaded
- * @see org.argouml.uml.profile.StreamModelLoader#loadModel(java.lang.String)
- */
- public Collection loadModel(String modelFilename) throws ProfileException {
- LOG.info("Loading profile from ZIP '" + modelFilename + "'");
-
- InputStream is = null;
- File modelFile = new File(modelFilename);
- // TODO: This is in the wrong place. It's not profile specific.
- // It needs to be moved to main XMI reading code. - tfm 20060326
- if (modelFilename.endsWith("zip")) {
- String filename = modelFile.getName();
- String extension = filename.substring(filename.indexOf('.'),
- filename.lastIndexOf('.'));
- String path = modelFile.getParent();
- // Add the path of the model to the search path, so we can
- // read dependent models
- if (path != null) {
- System.setProperty("org.argouml.model.modules_search_path",
- path);
- }
- try {
- is = openZipStreamAt(modelFile.toURI().toURL(), extension);
- } catch (MalformedURLException e) {
- LOG.error("Exception while loading profile '" + modelFilename
- + "'", e);
- throw new ProfileException(e);
- } catch (IOException e) {
- LOG.error("Exception while loading profile '" + modelFilename
- + "'", e);
- throw new ProfileException(e);
- }
-
- if (is != null) {
- return super.loadModel(is);
- }
- }
-
- throw new ProfileException("Profile could not be loaded!");
- }
-
- /**
- * Open a ZipInputStream to the first file found with a given extension.
- *
- * TODO: Remove since this is a duplicate of ZipFilePersister method
- * when we have refactored the Persister subsystem.
- *
- * @param url
- * The URL of the zip file.
- * @param ext
- * The required extension.
- * @return the zip stream positioned at the required location.
- * @throws IOException
- * if there is a problem opening the file.
- */
- private ZipInputStream openZipStreamAt(URL url, String ext)
- throws IOException {
- ZipInputStream zis = new ZipInputStream(url.openStream());
- ZipEntry entry = zis.getNextEntry();
- while (entry != null && !entry.getName().endsWith(ext)) {
- entry = zis.getNextEntry();
- }
- return zis;
- }
-
-}
+// $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.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Loads model data from a Zip file
+ *
+ * @author maurelio1234
+ */
+public class ZipModelLoader extends StreamModelLoader {
+
+ private static final Logger LOG = Logger.getLogger(ZipModelLoader.class);
+
+
+ public Collection loadModel(String modelFilename) throws ProfileException {
+ LOG.info("Loading profile from ZIP '" + modelFilename + "'");
+
+ InputStream is = null;
+ File modelFile = new File(modelFilename);
+ // TODO: This is in the wrong place. It's not profile specific.
+ // It needs to be moved to main XMI reading code. - tfm 20060326
+ if (modelFilename.endsWith("zip")) {
+ String filename = modelFile.getName();
+ String extension = filename.substring(filename.indexOf('.'),
+ filename.lastIndexOf('.'));
+ String path = modelFile.getParent();
+ // Add the path of the model to the search path, so we can
+ // read dependent models
+ if (path != null) {
+ System.setProperty("org.argouml.model.modules_search_path",
+ path);
+ }
+ try {
+ is = openZipStreamAt(modelFile.toURI().toURL(), extension);
+ } catch (MalformedURLException e) {
+ LOG.error("Exception while loading profile '" + modelFilename
+ + "'", e);
+ throw new ProfileException(e);
+ } catch (IOException e) {
+ LOG.error("Exception while loading profile '" + modelFilename
+ + "'", e);
+ throw new ProfileException(e);
+ }
+
+ if (is != null) {
+ return super.loadModel(is);
+ }
+ }
+
+ throw new ProfileException("Profile could not be loaded!");
+ }
+
+ /**
+ * Open a ZipInputStream to the first file found with a given extension.
+ *
+ * TODO: Remove since this is a duplicate of ZipFilePersister method
+ * when we have refactored the Persister subsystem.
+ *
+ * @param url
+ * The URL of the zip file.
+ * @param ext
+ * The required extension.
+ * @return the zip stream positioned at the required location.
+ * @throws IOException
+ * if there is a problem opening the file.
+ */
+ private ZipInputStream openZipStreamAt(URL url, String ext)
+ throws IOException {
+ ZipInputStream zis = new ZipInputStream(url.openStream());
+ ZipEntry entry = zis.getNextEntry();
+ while (entry != null && !entry.getName().endsWith(ext)) {
+ entry = zis.getNextEntry();
+ }
+ return zis;
+ }
+
+}
Modified: trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java&p2=trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java (original)
+++ trunk/src_new/org/argouml/profile/internal/JavaFormatingStrategy.java 2007-12-01 17:03:27-0800
@@ -1,237 +1,227 @@
-// $Id: JavaFormatingStrategy.java 13040 2007-07-10 20:00:25Z linus $
-// 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.internal;
-
-import java.util.Iterator;
-
-import org.argouml.model.Model;
-import org.argouml.profile.FormatingStrategy;
-
-/**
- * The Formating Strategy based on Java naming conventions
- *
- * @author Marcos Aurélio
- */
-public class JavaFormatingStrategy implements FormatingStrategy {
-
- /**
- * @param element the element to be formated
- * @param namespace the element's namespace
- * @return the formated string
- * @see org.argouml.uml.profile.FormatingStrategy#formatElement(java.lang.Object, java.lang.Object)
- */
- public String formatElement(Object element, Object namespace) {
- String value = null;
- if (element == null) {
- value = "";
- } else {
- Object elementNs = Model.getFacade().getNamespace(element);
- //
- // if element is an AssociationEnd use
- // the namespace of containing association
- //
- if (Model.getFacade().isAAssociationEnd(element)) {
- Object assoc = Model.getFacade().getAssociation(element);
- if (assoc != null) {
- elementNs = Model.getFacade().getNamespace(assoc);
- }
- }
- if (elementNs == namespace) {
- value = Model.getFacade().getName(element);
- if (value == null || value.length() == 0) {
- value = defaultName(element, namespace);
- }
- } else {
- StringBuffer buffer = new StringBuffer();
- String pathSep = getPathSeparator();
- buildPath(buffer, element, pathSep);
- value = buffer.toString();
- }
- }
- return value;
- }
-
- /**
- * @param assocEnd the given association end name
- * @param namespace the namespace
- * @return the default name for the given associationend
- */
- protected String defaultAssocEndName(Object assocEnd,
- Object namespace) {
- String name = null;
- Object type = Model.getFacade().getType(assocEnd);
- if (type != null) {
- name = formatElement(type, namespace);
- } else {
- name = "unknown type";
- }
- Object mult = Model.getFacade().getMultiplicity(assocEnd);
- if (mult != null) {
- StringBuffer buf = new StringBuffer(name);
- buf.append("[");
- buf.append(Integer.toString(Model.getFacade().getLower(mult)));
- buf.append("..");
- int upper = Model.getFacade().getUpper(mult);
- if (upper >= 0) {
- buf.append(Integer.toString(upper));
- } else {
- buf.append("*");
- }
- buf.append("]");
- name = buf.toString();
- }
- return name;
- }
-
- /**
- * This function creates a default association name from its ends.
- *
- * @param assoc the given association
- * @param ns the namespace
- * @return the default association name
- */
- protected String defaultAssocName(Object assoc, Object ns) {
- StringBuffer buf = new StringBuffer();
- Iterator iter = Model.getFacade().getConnections(assoc).iterator();
- for (int i = 0; iter.hasNext(); i++) {
- if (i != 0) {
- buf.append("-");
- }
- buf.append(defaultAssocEndName(iter.next(), ns));
- }
- return buf.toString();
- }
-
- /**
- * @param gen the given Generalization
- * @param namespace the namespace
- * @return the default generalization name
- */
- protected String defaultGeneralizationName(Object gen, Object namespace) {
- Object child = Model.getFacade().getSpecific(gen);
- Object parent = Model.getFacade().getGeneral(gen);
- StringBuffer buf = new StringBuffer();
- buf.append(formatElement(child, namespace));
- buf.append(" extends ");
- buf.append(formatElement(parent, namespace));
- return buf.toString();
- }
-
- /**
- * @param element the given modelelement
- * @param namespace the namespace
- * @return a default name for this modelelement
- */
- protected String defaultName(Object element, Object namespace) {
- String name = null;
- if (Model.getFacade().isAAssociationEnd(element)) {
- name = defaultAssocEndName(element, namespace);
- } else {
- if (Model.getFacade().isAAssociation(element)) {
- name = defaultAssocName(element, namespace);
- }
- if (Model.getFacade().isAGeneralization(element)) {
- name = defaultGeneralizationName(element, namespace);
- }
- }
- if (name == null) {
- name = "anon";
- }
- return name;
- }
-
- /**
- * @return the path separator (currently ".")
- */
- protected String getPathSeparator() {
- return ".";
- }
-
- /**
- * @param buffer (out) the buffer that will contain the path build
- * @param element the given modelelement
- * @param pathSep the path separator character(s)
- */
- private void buildPath(StringBuffer buffer, Object element,
- String pathSep) {
- if (element != null) {
- Object parent = Model.getFacade().getNamespace(element);
- if (parent != null && parent != element) {
- buildPath(buffer, parent, pathSep);
- buffer.append(pathSep);
- }
- String name = Model.getFacade().getName(element);
- if (name == null || name.length() == 0) {
- name = defaultName(element, null);
- }
- buffer.append(name);
- }
- }
-
- /**
- * @return the string that separates elements
- */
- protected String getElementSeparator() {
- return ", ";
- }
-
- /**
- * @return the string that represents an empty collection
- */
- protected String getEmptyCollection() {
- return "[empty]";
- }
-
- /**
- * @param iter the iterator of the collection
- * @param namespace the namespace to be applied on the elements
- * @return the formated string
- * @see org.argouml.uml.profile.FormatingStrategy#formatCollection(java.util.Iterator, java.lang.Object)
- */
- public String formatCollection(Iterator iter, Object namespace) {
- String value = null;
- if (iter.hasNext()) {
- StringBuffer buffer = new StringBuffer();
- String elementSep = getElementSeparator();
- Object obj = null;
- for (int i = 0; iter.hasNext(); i++) {
- if (i > 0) {
- buffer.append(elementSep);
- }
- obj = iter.next();
- if (Model.getFacade().isAModelElement(obj)) {
- buffer.append(formatElement(obj, namespace));
- } else {
- buffer.append(obj.toString());
- }
- }
- value = buffer.toString();
- } else {
- value = getEmptyCollection();
- }
- return value;
- }
-
-}
+// $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.internal;
+
+import java.util.Iterator;
+
+import org.argouml.model.Model;
+import org.argouml.profile.FormatingStrategy;
+
+/**
+ * The Formating Strategy based on Java naming conventions.
+ *
+ * @author Marcos Aurélio
+ */
+public class JavaFormatingStrategy implements FormatingStrategy {
+
+
+ public String formatElement(Object element, Object namespace) {
+ String value = null;
+ if (element == null) {
+ value = "";
+ } else {
+ Object elementNs = Model.getFacade().getNamespace(element);
+ //
+ // if element is an AssociationEnd use
+ // the namespace of containing association
+ //
+ if (Model.getFacade().isAAssociationEnd(element)) {
+ Object assoc = Model.getFacade().getAssociation(element);
+ if (assoc != null) {
+ elementNs = Model.getFacade().getNamespace(assoc);
+ }
+ }
+ if (elementNs == namespace) {
+ value = Model.getFacade().getName(element);
+ if (value == null || value.length() == 0) {
+ value = defaultName(element, namespace);
+ }
+ } else {
+ StringBuffer buffer = new StringBuffer();
+ String pathSep = getPathSeparator();
+ buildPath(buffer, element, pathSep);
+ value = buffer.toString();
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @param assocEnd the given association end name
+ * @param namespace the namespace
+ * @return the default name for the given associationend
+ */
+ protected String defaultAssocEndName(Object assocEnd,
+ Object namespace) {
+ String name = null;
+ Object type = Model.getFacade().getType(assocEnd);
+ if (type != null) {
+ name = formatElement(type, namespace);
+ } else {
+ name = "unknown type";
+ }
+ Object mult = Model.getFacade().getMultiplicity(assocEnd);
+ if (mult != null) {
+ StringBuffer buf = new StringBuffer(name);
+ buf.append("[");
+ buf.append(Integer.toString(Model.getFacade().getLower(mult)));
+ buf.append("..");
+ int upper = Model.getFacade().getUpper(mult);
+ if (upper >= 0) {
+ buf.append(Integer.toString(upper));
+ } else {
+ buf.append("*");
+ }
+ buf.append("]");
+ name = buf.toString();
+ }
+ return name;
+ }
+
+ /**
+ * Create a default association name from its ends.
+ *
+ * @param assoc the given association
+ * @param ns the namespace
+ * @return the default association name
+ */
+ protected String defaultAssocName(Object assoc, Object ns) {
+ StringBuffer buf = new StringBuffer();
+ Iterator iter = Model.getFacade().getConnections(assoc).iterator();
+ for (int i = 0; iter.hasNext(); i++) {
+ if (i != 0) {
+ buf.append("-");
+ }
+ buf.append(defaultAssocEndName(iter.next(), ns));
+ }
+ return buf.toString();
+ }
+
+ /**
+ * @param gen the given Generalization
+ * @param namespace the namespace
+ * @return the default generalization name
+ */
+ protected String defaultGeneralizationName(Object gen, Object namespace) {
+ Object child = Model.getFacade().getSpecific(gen);
+ Object parent = Model.getFacade().getGeneral(gen);
+ StringBuffer buf = new StringBuffer();
+ buf.append(formatElement(child, namespace));
+ buf.append(" extends ");
+ buf.append(formatElement(parent, namespace));
+ return buf.toString();
+ }
+
+ /**
+ * @param element the given modelelement
+ * @param namespace the namespace
+ * @return a default name for this modelelement
+ */
+ protected String defaultName(Object element, Object namespace) {
+ String name = null;
+ if (Model.getFacade().isAAssociationEnd(element)) {
+ name = defaultAssocEndName(element, namespace);
+ } else {
+ if (Model.getFacade().isAAssociation(element)) {
+ name = defaultAssocName(element, namespace);
+ }
+ if (Model.getFacade().isAGeneralization(element)) {
+ name = defaultGeneralizationName(element, namespace);
+ }
+ }
+ if (name == null) {
+ name = "anon";
+ }
+ return name;
+ }
+
+ /**
+ * @return the path separator (currently ".")
+ */
+ protected String getPathSeparator() {
+ return ".";
+ }
+
+ /**
+ * @param buffer (out) the buffer that will contain the path build
+ * @param element the given modelelement
+ * @param pathSep the path separator character(s)
+ */
+ private void buildPath(StringBuffer buffer, Object element,
+ String pathSep) {
+ if (element != null) {
+ Object parent = Model.getFacade().getNamespace(element);
+ if (parent != null && parent != element) {
+ buildPath(buffer, parent, pathSep);
+ buffer.append(pathSep);
+ }
+ String name = Model.getFacade().getName(element);
+ if (name == null || name.length() == 0) {
+ name = defaultName(element, null);
+ }
+ buffer.append(name);
+ }
+ }
+
+ /**
+ * @return the string that separates elements
+ */
+ protected String getElementSeparator() {
+ return ", ";
+ }
+
+ /**
+ * @return the string that represents an empty collection
+ */
+ protected String getEmptyCollection() {
+ return "[empty]";
+ }
+
+
+ public String formatCollection(Iterator iter, Object namespace) {
+ String value = null;
+ if (iter.hasNext()) {
+ StringBuffer buffer = new StringBuffer();
+ String elementSep = getElementSeparator();
+ Object obj = null;
+ for (int i = 0; iter.hasNext(); i++) {
+ if (i > 0) {
+ buffer.append(elementSep);
+ }
+ obj = iter.next();
+ if (Model.getFacade().isAModelElement(obj)) {
+ buffer.append(formatElement(obj, namespace));
+ } else {
+ buffer.append(obj.toString());
+ }
+ }
+ value = buffer.toString();
+ } else {
+ value = getEmptyCollection();
+ }
+ return value;
+ }
+
+}
Modified: trunk/src_new/org/argouml/profile/internal/ModelUtils.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ModelUtils.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/internal/ModelUtils.java&p2=trunk/src_new/org/argouml/profile/internal/ModelUtils.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/internal/ModelUtils.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ModelUtils.java 2007-12-01 17:03:27-0800
@@ -1,73 +1,68 @@
-// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
-// 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.internal;
-
-import java.util.Collection;
-
-import org.argouml.model.Model;
-
-/**
- * Contains helper methods
- *
- * @author maurelio1234
- */
-public class ModelUtils {
- /**
- * Finds a type in a model by name
- *
- * @param s the type name
- * @param model the model
- * @return the type or <code>null</code> if the type has not been found.
- */
- public static Object findTypeInModel(String s, Object model) {
-
- if (!Model.getFacade().isANamespace(model)) {
- throw new IllegalArgumentException(
- "Looking for the classifier " + s
- + " in a non-namespace object of " + model
- + ". A namespace was expected.");
- }
-
- Collection allClassifiers =
- Model.getModelManagementHelper()
- .getAllModelElementsOfKind(model,
- Model.getMetaTypes().getClassifier());
-
- Object[] classifiers = allClassifiers.toArray();
- Object classifier = null;
-
- for (int i = 0; i < classifiers.length; i++) {
-
- classifier = classifiers[i];
- if (Model.getFacade().getName(classifier) != null
- && Model.getFacade().getName(classifier).equals(s)) {
- return classifier;
- }
- }
-
- return null;
- }
-
-}
+// $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.internal;
+
+import java.util.Collection;
+
+import org.argouml.model.Model;
+
+/**
+ * Helper utility methods for searching the model.
+ *
+ * @author maurelio1234
+ */
+public class ModelUtils {
+ /**
+ * Finds a type in a model by name
+ *
+ * @param s the type name
+ * @param model the model
+ * @return the type or <code>null</code> if the type has not been found.
+ */
+ public static Object findTypeInModel(String s, Object model) {
+
+ if (!Model.getFacade().isANamespace(model)) {
+ throw new IllegalArgumentException(
+ "Looking for the classifier " + s
+ + " in a non-namespace object of " + model
+ + ". A namespace was expected.");
+ }
+
+ Collection allClassifiers =
+ Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(model,
+ Model.getMetaTypes().getClassifier());
+
+ for (Object classifier : allClassifiers) {
+ if (Model.getFacade().getName(classifier) != null
+ && Model.getFacade().getName(classifier).equals(s)) {
+ return classifier;
+ }
+ }
+
+ return null;
+ }
+
+}
Modified: trunk/src_new/org/argouml/profile/internal/ProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ProfileJava.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/internal/ProfileJava.java&p2=trunk/src_new/org/argouml/profile/internal/ProfileJava.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/internal/ProfileJava.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ProfileJava.java 2007-12-01 17:03:27-0800
@@ -1,113 +1,103 @@
-// $Id: ProfileJava.java 13298 2007-08-12 19:40:57Z euluis $
-// Copyright (c) 1996-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.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-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;
-import org.argouml.profile.ProfileModelLoader;
-import org.argouml.profile.ResourceModelLoader;
-
-/**
- * This class represents the Java default Profile
- *
- * @author Marcos Aurélio
- */
-public class ProfileJava extends Profile {
-
- static final String NAME = "Java";
- private ProfileModelLoader profileModelLoader;
- private Collection model;
-
- /**
- * The default constructor for this class
- * @throws ProfileException
- */
- @SuppressWarnings("unchecked")
- ProfileJava(Profile uml) throws ProfileException {
- profileModelLoader = new ResourceModelLoader();
- model = profileModelLoader
- .loadModel("/org/argouml/default-java.xmi");
-
- if (model == null) {
- model = new ArrayList();
- model.add(Model.getModelManagementFactory().createModel());
- }
-
- 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 NAME;
- }
-
- /**
- * @return the Collection containing the profile model
- * @see org.argouml.uml.profile.Profile#getProfilePackages()
- */
- @Override
- public Collection getProfilePackages() {
- return model;
- }
-
- /**
- * @return the default type strategy
- * @see org.argouml.uml.profile.Profile#getDefaultTypeStrategy()
- */
- @Override
- public DefaultTypeStrategy getDefaultTypeStrategy() {
- return new DefaultTypeStrategy() {
- public Object getDefaultAttributeType() {
- return ModelUtils.findTypeInModel("int", model.iterator()
- .next());
- }
-
- public Object getDefaultParameterType() {
- return ModelUtils.findTypeInModel("int", model.iterator()
- .next());
- }
-
- public Object getDefaultReturnType() {
- return ModelUtils.findTypeInModel("void", model.iterator()
- .next());
- }
-
- };
- }
-}
+// $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.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+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;
+import org.argouml.profile.ProfileModelLoader;
+import org.argouml.profile.ResourceModelLoader;
+
+/**
+ * This class represents the Java default Profile
+ *
+ * @author Marcos Aurélio
+ */
+public class ProfileJava extends Profile {
+
+ static final String NAME = "Java";
+ private ProfileModelLoader profileModelLoader;
+ private Collection model;
+
+ /**
+ * The default constructor for this class
+ * @throws ProfileException
+ */
+ @SuppressWarnings("unchecked")
+ ProfileJava(Profile uml) throws ProfileException {
+ profileModelLoader = new ResourceModelLoader();
+ model = profileModelLoader.loadModel("/org/argouml/default-java.xmi");
+
+ if (model == null) {
+ model = new ArrayList();
+ model.add(Model.getModelManagementFactory().createModel());
+ }
+
+ addProfileDependency(uml);
+ }
+
+ ProfileJava() throws ProfileException {
+ this(ProfileFacade.getManager().getProfileForClass(
+ ProfileUML.class.getName()));
+ }
+
+
+ public String getDisplayName() {
+ return NAME;
+ }
+
+
+ @Override
+ public Collection getProfilePackages() {
+ return model;
+ }
+
+
+ @Override
+ public DefaultTypeStrategy getDefaultTypeStrategy() {
+ return new DefaultTypeStrategy() {
+ public Object getDefaultAttributeType() {
+ return ModelUtils.findTypeInModel("int", model.iterator()
+ .next());
+ }
+
+ public Object getDefaultParameterType() {
+ return ModelUtils.findTypeInModel("int", model.iterator()
+ .next());
+ }
+
+ public Object getDefaultReturnType() {
+ return ModelUtils.findTypeInModel("void", model.iterator()
+ .next());
+ }
+
+ };
+ }
+}
Modified: trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java&p2=trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ProfileManagerImpl.java 2007-12-01 17:03:27-0800
@@ -1,348 +1,304 @@
-// $Id: ProfileManagerImpl.java 13298 2007-11-30 19:40:57Z euluis $
-// 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.internal;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-
-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;
-import org.argouml.profile.UserDefinedProfile;
-
-/**
- * Default <code>ProfileManager</code> implementation
- *
- * @author Marcos Aurélio
- */
-public class ProfileManagerImpl implements ProfileManager {
-
- /**
- * The configuration key for the default profiles.
- */
- public static final ConfigurationKey KEY_DEFAULT_PROFILES = Configuration
- .makeKey("profiles", "default");
-
- /**
- * The configuration key for the search directories.
- */
- public static final ConfigurationKey KEY_DEFAULT_DIRECTORIES = Configuration
- .makeKey("profiles", "directories");
-
- /**
- * Avoids recursive configuration update when loading configuration
- */
- private boolean disableConfigurationUpdate = false;
-
- private List<Profile> profiles = new ArrayList<Profile>();
-
- private List<Profile> defaultProfiles = new ArrayList<Profile>();
-
- private List<String> searchDirectories = new ArrayList<String>();
-
- /**
- * Constructor - includes initialization of built-in default profiles.
- */
- public ProfileManagerImpl() {
- try {
- Profile uml = new ProfileUML();
- defaultProfiles.add(uml);
- registerProfile(uml);
- registerProfile(new ProfileJava(uml));
- } catch (ProfileException e) {
- throw new RuntimeException(e);
- }
-
- loadDirectoriesFromConfiguration();
-
- refreshRegisteredProfiles();
-
- loadDefaultProfilesfromConfiguration();
- }
-
- private void loadDefaultProfilesfromConfiguration() {
- disableConfigurationUpdate = true;
-
- StringTokenizer tokenizer = new StringTokenizer(Configuration
- .getString(KEY_DEFAULT_PROFILES), "*", false);
-
- while (tokenizer.hasMoreTokens()) {
- String desc = tokenizer.nextToken();
- Profile p = null;
-
- if (desc.charAt(0) == 'U') {
- String fileName = desc.substring(1);
- p = findUserDefinedProfile(new File(fileName));
- } else if (desc.charAt(0) == 'C') {
- String className = desc.substring(1);
- p = getProfileForClass(className);
- }
-
- if (p != null) {
- addToDefaultProfiles(p);
- }
- }
-
- disableConfigurationUpdate = false;
- }
-
- private void updateDefaultProfilesConfiguration() {
- if (!disableConfigurationUpdate) {
- StringBuffer buf = new StringBuffer();
-
- for (Profile p : defaultProfiles) {
- if (p instanceof UserDefinedProfile) {
- buf.append("U"
- + ((UserDefinedProfile) p).getModelFile()
- .getAbsolutePath());
- } else {
- buf.append("C" + p.getClass().getName());
- }
-
- buf.append("*");
- }
-
- Configuration.setString(KEY_DEFAULT_PROFILES, buf.toString());
- }
- }
-
- private void loadDirectoriesFromConfiguration() {
- disableConfigurationUpdate = true;
-
- StringTokenizer tokenizer = new StringTokenizer(Configuration
- .getString(KEY_DEFAULT_DIRECTORIES), "*", false);
-
- while (tokenizer.hasMoreTokens()) {
- searchDirectories.add(tokenizer.nextToken());
- }
-
- disableConfigurationUpdate = false;
- }
-
- private void updateSearchDirectoriesConfiguration() {
- if (!disableConfigurationUpdate) {
- StringBuffer buf = new StringBuffer();
-
- for (String s : searchDirectories) {
- buf.append(s + "*");
- }
-
- Configuration.setString(KEY_DEFAULT_DIRECTORIES, buf.toString());
- }
- }
-
- /**
- * @return the list of registered profiles
- * @see org.argouml.profile.ProfileManager#getRegisteredProfiles()
- */
- public List<Profile> getRegisteredProfiles() {
- return profiles;
- }
-
- /**
- * @param p a profile to be registered so that it is available to the users
- * @see org.argouml.profile.ProfileManager#registerProfile(org.argouml.profile.Profile)
- */
- public void registerProfile(Profile p) {
- if (p != null && !profiles.contains(p)) {
- if (p instanceof UserDefinedProfile
- || getProfileForClass(p.getClass().getName()) == null) {
- profiles.add(p);
-
- // this profile could have not been loaded when
- // the default profile configuration
- // was loaded at first, so we need to do it again
- loadDefaultProfilesfromConfiguration();
- }
- }
- }
-
- /**
- * @param p the profile to unregister - it will no longer be available for
- * selection by users
- * @see org.argouml.profile.ProfileManager#removeProfile(org.argouml.profile.Profile)
- */
- public void removeProfile(Profile p) {
- if (p != null) {
- profiles.remove(p);
- defaultProfiles.remove(p);
- }
- }
-
- /**
- * @param profileClass a string with the profile class name
- * @return the profile if found, null otherwise
- * @see org.argouml.profile.ProfileManager#getProfileForClass(java.lang.String)
- */
- public Profile getProfileForClass(String profileClass) {
- Iterator it = profiles.iterator();
- Profile found = null;
-
- while (it.hasNext()) {
- Profile p = (Profile) it.next();
- if (p.getClass().getName().equals(profileClass)) {
- found = p;
- break;
- }
- }
- return found;
- }
-
- /**
- * @param p profile to be added to the default application profiles - new
- * models will reference it by default
- * @see org.argouml.profile.ProfileManager#addToDefaultProfiles(org.argouml.profile.Profile)
- */
- public void addToDefaultProfiles(Profile p) {
- if (p != null && profiles.contains(p) && !defaultProfiles.contains(p)) {
- defaultProfiles.add(p);
- updateDefaultProfilesConfiguration();
- }
- }
-
- /**
- * @return the list of default profiles
- * @see org.argouml.profile.ProfileManager#getDefaultProfiles()
- */
- public List<Profile> getDefaultProfiles() {
- return Collections.unmodifiableList(defaultProfiles);
- }
-
- /**
- * @param p the profile to remove from the default profiles
- * @see org.argouml.profile.ProfileManager#removeFromDefaultProfiles(org.argouml.profile.Profile)
- */
- public void removeFromDefaultProfiles(Profile p) {
- if (p != null && profiles.contains(p)) {
- defaultProfiles.remove(p);
- updateDefaultProfilesConfiguration();
- }
- }
-
- /**
- * @param path a directory name where the manager will try to look for
- * user defined profiles as XMI files
- * @see org.argouml.profile.ProfileManager#addSearchPathDirectory(java.lang.String)
- */
- public void addSearchPathDirectory(String path) {
- if (path != null && !searchDirectories.contains(path)) {
- searchDirectories.add(path);
- updateSearchDirectoriesConfiguration();
- }
- }
-
-
- /**
- * @return the list of search directories
- * @see org.argouml.profile.ProfileManager#getSearchPathDirectories()
- */
- public List<String> getSearchPathDirectories() {
- return Collections.unmodifiableList(searchDirectories);
- }
-
-
- /**
- * @param path the directory to remove
- * @see org.argouml.profile.ProfileManager#removeSearchPathDirectory(java.lang.String)
- */
- public void removeSearchPathDirectory(String path) {
- if (path != null) {
- searchDirectories.remove(path);
- updateSearchDirectoriesConfiguration();
- }
- }
-
-
- /**
- * @see org.argouml.profile.ProfileManager#refreshRegisteredProfiles()
- */
- public void refreshRegisteredProfiles() {
-
- for (String dirName : searchDirectories) {
- File dir = new File(dirName);
-
- if (dir.exists()) {
- for (File file : dir.listFiles()) {
- // TODO: Allow .zargo as profile as well?
- if (file.getName().toLowerCase().endsWith(".xmi")) {
-
- boolean found =
- findUserDefinedProfile(file) != null;
-
- if (!found) {
- UserDefinedProfile udp = null;
- try {
- udp = new UserDefinedProfile(file);
- registerProfile(udp);
- } catch (ProfileException e) {
- // if an exception is raised file is unusable
- }
- }
- }
- }
- }
- }
- }
-
- private Profile findUserDefinedProfile(File file) {
-
- for (Profile p : profiles) {
- if (p instanceof UserDefinedProfile) {
- UserDefinedProfile udp = (UserDefinedProfile) p;
-
- if (udp.getModelFile().equals(file)) {
- return udp;
- }
- }
- }
- return null;
- }
-
- /**
- * @return the UML profile
- * @see org.argouml.profile.ProfileManager#getUMLProfile()
- */
- 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;
- }
-
-}
+// $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.internal;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+
+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;
+import org.argouml.profile.UserDefinedProfile;
+
+/**
+ * Default <code>ProfileManager</code> implementation
+ *
+ * @author Marcos Aurélio
+ */
+public class ProfileManagerImpl implements ProfileManager {
+
+ private static final String DIRECTORY_SEPARATOR = "*";
+
+ /**
+ * The configuration key for the default profiles.
+ */
+ public static final ConfigurationKey KEY_DEFAULT_PROFILES = Configuration
+ .makeKey("profiles", "default");
+
+ /**
+ * The configuration key for the search directories.
+ */
+ public static final ConfigurationKey KEY_DEFAULT_DIRECTORIES = Configuration
+ .makeKey("profiles", "directories");
+
+ /**
+ * Avoids recursive configuration update when loading configuration
+ */
+ private boolean disableConfigurationUpdate = false;
+
+ private List<Profile> profiles = new ArrayList<Profile>();
+
+ private List<Profile> defaultProfiles = new ArrayList<Profile>();
+
+ private List<String> searchDirectories = new ArrayList<String>();
+
+ /**
+ * Constructor - includes initialization of built-in default profiles.
+ */
+ public ProfileManagerImpl() {
+ try {
+ Profile uml = new ProfileUML();
+ defaultProfiles.add(uml);
+ registerProfile(uml);
+ registerProfile(new ProfileJava(uml));
+ } catch (ProfileException e) {
+ throw new RuntimeException(e);
+ }
+
+ loadDirectoriesFromConfiguration();
+
+ refreshRegisteredProfiles();
+
+ loadDefaultProfilesfromConfiguration();
+ }
+
+ private void loadDefaultProfilesfromConfiguration() {
+ disableConfigurationUpdate = true;
+
+ StringTokenizer tokenizer = new StringTokenizer(Configuration
+ .getString(KEY_DEFAULT_PROFILES), DIRECTORY_SEPARATOR, false);
+
+ while (tokenizer.hasMoreTokens()) {
+ String desc = tokenizer.nextToken();
+ Profile p = null;
+
+ if (desc.charAt(0) == 'U') {
+ String fileName = desc.substring(1);
+ p = findUserDefinedProfile(new File(fileName));
+ } else if (desc.charAt(0) == 'C') {
+ String className = desc.substring(1);
+ p = getProfileForClass(className);
+ }
+
+ if (p != null) {
+ addToDefaultProfiles(p);
+ }
+ }
+
+ disableConfigurationUpdate = false;
+ }
+
+ private void updateDefaultProfilesConfiguration() {
+ if (!disableConfigurationUpdate) {
+ StringBuffer buf = new StringBuffer();
+
+ for (Profile p : defaultProfiles) {
+ if (p instanceof UserDefinedProfile) {
+ buf.append("U"
+ + ((UserDefinedProfile) p).getModelFile()
+ .getAbsolutePath());
+ } else {
+ buf.append("C" + p.getClass().getName());
+ }
+
+ buf.append(DIRECTORY_SEPARATOR);
+ }
+
+ Configuration.setString(KEY_DEFAULT_PROFILES, buf.toString());
+ }
+ }
+
+ private void loadDirectoriesFromConfiguration() {
+ disableConfigurationUpdate = true;
+
+ StringTokenizer tokenizer = new StringTokenizer(Configuration
+ .getString(KEY_DEFAULT_DIRECTORIES), DIRECTORY_SEPARATOR, false);
+
+ while (tokenizer.hasMoreTokens()) {
+ searchDirectories.add(tokenizer.nextToken());
+ }
+
+ disableConfigurationUpdate = false;
+ }
+
+ private void updateSearchDirectoriesConfiguration() {
+ if (!disableConfigurationUpdate) {
+ StringBuffer buf = new StringBuffer();
+
+ for (String s : searchDirectories) {
+ buf.append(s).append(DIRECTORY_SEPARATOR);
+ }
+
+ Configuration.setString(KEY_DEFAULT_DIRECTORIES, buf.toString());
+ }
+ }
+
+
+ public List<Profile> getRegisteredProfiles() {
+ return profiles;
+ }
+
+
+ public void registerProfile(Profile p) {
+ if (p != null && !profiles.contains(p)) {
+ if (p instanceof UserDefinedProfile
+ || getProfileForClass(p.getClass().getName()) == null) {
+ profiles.add(p);
+
+ // this profile could have not been loaded when
+ // the default profile configuration
+ // was loaded at first, so we need to do it again
+ loadDefaultProfilesfromConfiguration();
+ }
+ }
+ }
+
+
+ public void removeProfile(Profile p) {
+ if (p != null) {
+ profiles.remove(p);
+ defaultProfiles.remove(p);
+ }
+ }
+
+
+ public Profile getProfileForClass(String profileClass) {
+ Profile found = null;
+ for (Profile p : profiles) {
+ if (p.getClass().getName().equals(profileClass)) {
+ found = p;
+ break;
+ }
+ }
+ return found;
+ }
+
+
+ public void addToDefaultProfiles(Profile p) {
+ if (p != null && profiles.contains(p)
+ && !defaultProfiles.contains(p)) {
+ defaultProfiles.add(p);
+ updateDefaultProfilesConfiguration();
+ }
+ }
+
+
+ public List<Profile> getDefaultProfiles() {
+ return Collections.unmodifiableList(defaultProfiles);
+ }
+
+
+ public void removeFromDefaultProfiles(Profile p) {
+ if (p != null && profiles.contains(p)) {
+ defaultProfiles.remove(p);
+ updateDefaultProfilesConfiguration();
+ }
+ }
+
+
+ public void addSearchPathDirectory(String path) {
+ if (path != null && !searchDirectories.contains(path)) {
+ searchDirectories.add(path);
+ updateSearchDirectoriesConfiguration();
+ }
+ }
+
+
+ public List<String> getSearchPathDirectories() {
+ return Collections.unmodifiableList(searchDirectories);
+ }
+
+
+ public void removeSearchPathDirectory(String path) {
+ if (path != null) {
+ searchDirectories.remove(path);
+ updateSearchDirectoriesConfiguration();
+ }
+ }
+
+
+ public void refreshRegisteredProfiles() {
+
+ for (String dirName : searchDirectories) {
+ File dir = new File(dirName);
+
+ if (dir.exists()) {
+ for (File file : dir.listFiles()) {
+ // TODO: Allow .zargo as profile as well?
+ if (file.getName().toLowerCase().endsWith(".xmi")) {
+
+ boolean found =
+ findUserDefinedProfile(file) != null;
+
+ if (!found) {
+ UserDefinedProfile udp = null;
+ try {
+ udp = new UserDefinedProfile(file);
+ registerProfile(udp);
+ } catch (ProfileException e) {
+ // if an exception is raised file is unusable
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private Profile findUserDefinedProfile(File file) {
+
+ for (Profile p : profiles) {
+ if (p instanceof UserDefinedProfile) {
+ UserDefinedProfile udp = (UserDefinedProfile) p;
+
+ if (udp.getModelFile().equals(file)) {
+ return udp;
+ }
+ }
+ }
+ 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;
+ }
+
+}
Modified: trunk/src_new/org/argouml/profile/internal/ProfileUML.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/internal/ProfileUML.java?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/internal/ProfileUML.java&p2=trunk/src_new/org/argouml/profile/internal/ProfileUML.java&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/internal/ProfileUML.java (original)
+++ trunk/src_new/org/argouml/profile/internal/ProfileUML.java 2007-12-01 17:03:27-0800
@@ -1,119 +1,106 @@
-// $Id: ProfileUML.java 13040 2007-07-10 20:00:25Z linus $
-// Copyright (c) 1996-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.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-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;
-import org.argouml.profile.ProfileModelLoader;
-import org.argouml.profile.ResourceModelLoader;
-
-/**
- * This class represents the default UML profile
- *
- * @author Marcos Aurélio
- */
-public class ProfileUML extends Profile {
-
- 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;
-
- /**
- * The default constructor for this class
- * @throws ProfileException
- */
- @SuppressWarnings("unchecked")
- ProfileUML() throws ProfileException {
- formatingStrategy = new JavaFormatingStrategy();
- profileModelLoader = new ResourceModelLoader();
- model = profileModelLoader
- .loadModel(PROFILE_FILE);
-
- if (model == null) {
- model = new ArrayList();
- model.add(Model.getModelManagementFactory().createModel());
- }
- }
-
-
- /**
- * @return the Java formating strategy
- * @see org.argouml.uml.profile.Profile#getFormatingStrategy()
- */
- public FormatingStrategy getFormatingStrategy() {
- return formatingStrategy;
- }
-
- /**
- * @return "UML 1.4"
- * @see org.argouml.uml.profile.Profile#getDisplayName()
- */
- public String getDisplayName() {
- return NAME;
- }
-
- /**
- * @return the container which contains the profile model(s).
- * @see org.argouml.uml.profile.Profile#getProfilePackages()
- */
- @Override
- public Collection getProfilePackages() {
- return model;
- }
-
- /**
- * @return the type strategy
- * @see org.argouml.uml.profile.Profile#getDefaultTypeStrategy()
- */
- @Override
- public DefaultTypeStrategy getDefaultTypeStrategy() {
- return new DefaultTypeStrategy() {
- public Object getDefaultAttributeType() {
- return ModelUtils.findTypeInModel("Integer", model.iterator()
- .next());
- }
-
- public Object getDefaultParameterType() {
- return ModelUtils.findTypeInModel("Integer", model.iterator()
- .next());
- }
-
- public Object getDefaultReturnType() {
- return null;
- }
-
- };
- }
-}
+// $Id$
+// Copyright (c) 1996-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.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+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;
+import org.argouml.profile.ProfileModelLoader;
+import org.argouml.profile.ResourceModelLoader;
+
+/**
+ * This class represents the default UML profile
+ *
+ * @author Marcos Aurélio
+ */
+public class ProfileUML extends Profile {
+
+ 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;
+
+ /**
+ * Construct a Profile for UML modeling.
+ * @throws ProfileException
+ */
+ @SuppressWarnings("unchecked")
+ ProfileUML() throws ProfileException {
+ formatingStrategy = new JavaFormatingStrategy();
+ profileModelLoader = new ResourceModelLoader();
+ model = profileModelLoader
+ .loadModel(PROFILE_FILE);
+
+ if (model == null) {
+ model = new ArrayList();
+ model.add(Model.getModelManagementFactory().createModel());
+ }
+ }
+
+ @Override
+ public FormatingStrategy getFormatingStrategy() {
+ return formatingStrategy;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return NAME;
+ }
+
+
+ @Override
+ public Collection getProfilePackages() {
+ return model;
+ }
+
+
+ @Override
+ public DefaultTypeStrategy getDefaultTypeStrategy() {
+ return new DefaultTypeStrategy() {
+ public Object getDefaultAttributeType() {
+ return ModelUtils.findTypeInModel("Integer", model.iterator()
+ .next());
+ }
+
+ public Object getDefaultParameterType() {
+ return ModelUtils.findTypeInModel("Integer", model.iterator()
+ .next());
+ }
+
+ public Object getDefaultReturnType() {
+ return null;
+ }
+
+ };
+ }
+}
Modified: trunk/src_new/org/argouml/profile/package.html
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/profile/package.html?view=diff&rev=13850&p1=trunk/src_new/org/argouml/profile/package.html&p2=trunk/src_new/org/argouml/profile/package.html&r1=13849&r2=13850
==============================================================================
--- trunk/src_new/org/argouml/profile/package.html (original)
+++ trunk/src_new/org/argouml/profile/package.html 2007-12-01 17:03:27-0800
@@ -1,45 +1,45 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<title>org.argouml.profile package</title>
-<!--
- 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.
--->
-</head>
-<body bgcolor="white">
-
-
-<p>Contains support for UML profiles.</P>
-
-<h2>Package Specification</h2>
-
- (none)
-
-
-<h2>Related Documentation </h2>
-
- (none)
-
-</body>
-</html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<title>org.argouml.profile package</title>
+<!--
+ 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.
+-->
+</head>
+<body bgcolor="white">
+
+
+<p>Contains support for UML profiles.</P>
+
+<h2>Package Specification</h2>
+
+ (none)
+
+
+<h2>Related Documentation </h2>
+
+ (none)
+
+</body>
+</html>
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.