Author: maurelio1234
Date: 2008-05-13 08:04:31-0700
New Revision: 14722
Added:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingPluginProfile.java
- copied, changed from r14720,
/branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingProfile.java
Removed:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingProfile.java
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/CoreProfileReference.java
branches/gsoc2008_maurelio1234_profiles/profile/FileModelLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/Profile.java
branches/gsoc2008_maurelio1234_profiles/profile/ProfileFacade.java
branches/gsoc2008_maurelio1234_profiles/profile/ProfileModelLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/ReaderModelLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/ResourceModelLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/StreamModelLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/URLModelLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/UserDefinedProfile.java
branches/gsoc2008_maurelio1234_profiles/profile/ZipModelLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/internal/ProfileManagerImpl.java
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfile.java
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoader.java
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoaderImpl.java
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileModule.java
Log:
comments & merge with trunk
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/CoreProfileReference.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/CoreProfileReference.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/CoreProfileReference.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/CoreProfileReference.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/CoreProfileReference.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/CoreProfileReference.java
2008-05-13 08:04:31-0700
@@ -35,7 +35,7 @@
public class CoreProfileReference extends ProfileReference {
static final String PROFILES_RESOURCE_PATH =
- "/org/argouml/profile/profiles/";
+ "/org/argouml/profile/profiles/uml14/";
static final String PROFILES_BASE_URL =
"http://argouml.org/profiles/uml14/";
@@ -56,5 +56,7 @@
new URL(PROFILES_BASE_URL + fileName));
assert fileName != null
: "null isn't acceptable as the profile file name.";
+ assert !"".equals(fileName)
+ : "the empty string isn't acceptable as the profile file name.";
}
}
Modified: branches/gsoc2008_maurelio1234_profiles/profile/FileModelLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/FileModelLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/FileModelLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/FileModelLoader.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/FileModelLoader.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/FileModelLoader.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -40,24 +40,6 @@
private static final Logger LOG = Logger.getLogger(FileModelLoader.class);
- @Deprecated
- public Collection loadModel(String modelFilename) throws ProfileException {
- LOG.info("Loading profile from file'" + modelFilename + "'");
- try {
- File modelFile = new File(modelFilename);
- URL url = modelFile.toURI().toURL();
- URL url2 = null;
- try {
- url2 = new URL(modelFile.getName());
- } catch (MalformedURLException e) {
- LOG.error("Exception", e);
- }
- return super.loadModel(url, url2);
- } catch (MalformedURLException e) {
- throw new ProfileException("Model file not found!");
- }
- }
-
public Collection loadModel(ProfileReference reference)
throws ProfileException {
LOG.info("Loading profile from file'" + reference.getPath() + "'");
@@ -66,7 +48,7 @@
URL url = modelFile.toURI().toURL();
return super.loadModel(url, reference.getPublicReference());
} catch (MalformedURLException e) {
- throw new ProfileException("Model file not found!");
+ throw new ProfileException("Model file not found!", e);
}
}
Modified: branches/gsoc2008_maurelio1234_profiles/profile/Profile.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/Profile.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/Profile.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/Profile.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/Profile.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/Profile.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -26,26 +26,18 @@
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
+ * @author Marcos Aur�lio
*/
public abstract class Profile {
- /**
- * Base directory/resource path to use for searching for profiles
- */
- public static final String PROFILE_DIR = "/org/argouml/profile/profiles/";
-
private Set<Profile> importedProfiles = new HashSet<Profile>();
private Set<Profile> importingProfiles = new HashSet<Profile>();
@@ -86,25 +78,6 @@
public abstract String getDisplayName();
/**
- * @return the UML Model that contains the profile model
- * @deprecated by maurelio1234. Use [EMAIL PROTECTED]
#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.
*/
@@ -129,76 +102,6 @@
}
/**
- * 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
- * [EMAIL PROTECTED] #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
- * [EMAIL PROTECTED] #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 [EMAIL PROTECTED]
#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
@@ -207,32 +110,6 @@
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
Modified: branches/gsoc2008_maurelio1234_profiles/profile/ProfileFacade.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/ProfileFacade.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/ProfileFacade.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/ProfileFacade.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/ProfileFacade.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/ProfileFacade.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/ProfileModelLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/ProfileModelLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/ProfileModelLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/ProfileModelLoader.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/ProfileModelLoader.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/ProfileModelLoader.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -33,28 +33,15 @@
*/
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
- * @deprecated for 0.25.5 by euluis.
- * Use [EMAIL PROTECTED] #loadModel(ProfileReference)} instead.
- */
- @Deprecated
- Collection loadModel(String path) throws ProfileException;
/**
* Load a model from the specified path.
*
- * @param reference the reference to the profile file, which contains the
- * path where the profile file can be found.
+ * @param reference the reference to the profile file, which contains the
+ * path where the profile file can be found.
* @return the set of defined packages.
* @throws ProfileException if the profile could not be loaded for some
- * reason.
+ * reason.
*/
Collection loadModel(ProfileReference reference) throws ProfileException;
}
Modified: branches/gsoc2008_maurelio1234_profiles/profile/ReaderModelLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/ReaderModelLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/ReaderModelLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/ReaderModelLoader.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/ReaderModelLoader.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/ReaderModelLoader.java
2008-05-13 08:04:31-0700
@@ -56,48 +56,29 @@
this.reader = theReader;
}
- /*
- * @see ProfileModelLoader#loadModel(String)
- */
- @SuppressWarnings("deprecation")
- @Deprecated
- public Collection loadModel(final String path) throws ProfileException {
- if (reader != null) {
- try {
- XmiReader xmiReader = Model.getXmiReader();
- InputSource inputSource = new InputSource(reader);
- inputSource.setSystemId(path);
- 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!");
- }
/*
* @see ProfileModelLoader#loadModel(ProfileReference)
*/
public Collection loadModel(ProfileReference reference)
throws ProfileException {
- if (reader != null) {
- try {
- XmiReader xmiReader = Model.getXmiReader();
- InputSource inputSource = new InputSource(reader);
- inputSource.setSystemId(reference.getPath());
- inputSource.setPublicId(
- reference.getPublicReference().toString());
- Collection elements = xmiReader.parse(inputSource, true);
- return elements;
- } catch (UmlException e) {
- throw new ProfileException("Invalid XMI data!", e);
- }
+
+ if (reader == null) {
+ LOG.error("Profile not found");
+ throw new ProfileException("Profile not found!");
+ }
+
+ try {
+ XmiReader xmiReader = Model.getXmiReader();
+ InputSource inputSource = new InputSource(reader);
+ inputSource.setSystemId(reference.getPath());
+ inputSource.setPublicId(
+ reference.getPublicReference().toString());
+ Collection elements = xmiReader.parse(inputSource, true);
+ return elements;
+ } catch (UmlException e) {
+ throw new ProfileException("Invalid XMI data!", e);
}
- LOG.error("Profile not found");
- throw new ProfileException("Profile not found!");
}
}
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/ResourceModelLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/ResourceModelLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/ResourceModelLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/ResourceModelLoader.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/ResourceModelLoader.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/ResourceModelLoader.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -24,8 +24,6 @@
package org.argouml.profile;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Collection;
import org.apache.log4j.Logger;
@@ -62,20 +60,6 @@
clazz = c;
}
- /*
- * @see org.argouml.profile.ProfileModelLoader#loadModel(java.lang.String)
- */
- @Deprecated
- public Collection loadModel(String path) throws ProfileException {
- LOG.info("Loading profile from resource'" + path + "'");
- URL url = null;
- try {
- url = new URL(path);
- } catch (MalformedURLException e) {
- LOG.error("Exception", e);
- }
- return super.loadModel(clazz.getResource(path), url);
- }
public Collection loadModel(ProfileReference reference)
throws ProfileException {
Modified: branches/gsoc2008_maurelio1234_profiles/profile/StreamModelLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/StreamModelLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/StreamModelLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/StreamModelLoader.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/StreamModelLoader.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/StreamModelLoader.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -37,59 +37,37 @@
/**
* Abstract ProfileModelLoader which loads models from an InputStream.
*
- * @author Marcos Aurélio
+ * @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
- */
- @Deprecated
- public 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!");
- }
+
/**
* @param inputStream the stream from where the model should be loaded
- * @param publicReference the URL to be used as the public reference of
- * the profile that will be loaded.
+ * @param publicReference the URL to be used as the public reference of the
+ * profile that will be loaded.
* @return the model
* @throws ProfileException if the XMIReader couldn't read the input stream
*/
public Collection loadModel(InputStream inputStream, URL publicReference)
throws ProfileException {
- if (inputStream != null) {
- try {
- XmiReader xmiReader = Model.getXmiReader();
- InputSource inputSource = new InputSource(inputStream);
- inputSource.setPublicId(publicReference.toString());
- Collection elements = xmiReader.parse(inputSource, true);
- return elements;
- } catch (UmlException e) {
- LOG.error("Exception while loading profile ", e);
- throw new ProfileException("Invalid XMI data!");
- }
+ if (inputStream == null) {
+ LOG.error("Profile not found");
+ throw new ProfileException("Profile not found!");
+ }
+
+ try {
+ XmiReader xmiReader = Model.getXmiReader();
+ InputSource inputSource = new InputSource(inputStream);
+ inputSource.setPublicId(publicReference.toString());
+ Collection elements = xmiReader.parse(inputSource, true);
+ return elements;
+ } catch (UmlException e) {
+ throw new ProfileException("Invalid XMI data!", e);
}
- LOG.error("Profile not found");
- throw new ProfileException("Profile not found!");
}
}
Modified: branches/gsoc2008_maurelio1234_profiles/profile/URLModelLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/URLModelLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/URLModelLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/URLModelLoader.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/URLModelLoader.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/URLModelLoader.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -61,8 +61,7 @@
Collection elements = xmiReader.parse(inputSource, true);
return elements;
} catch (UmlException e) {
- LOG.error("Exception while loading profile ", e);
- throw new ProfileException("Invalid XMI data!");
+ throw new ProfileException("Invalid XMI data!", e);
}
}
}
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/UserDefinedProfile.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/UserDefinedProfile.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/UserDefinedProfile.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/UserDefinedProfile.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/UserDefinedProfile.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/UserDefinedProfile.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -32,7 +32,7 @@
/**
* Represents a profile defined by the user
*
- * @author Marcos Aurélio
+ * @author Marcos Aur�lio
*/
public class UserDefinedProfile extends Profile {
Modified: branches/gsoc2008_maurelio1234_profiles/profile/ZipModelLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/ZipModelLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/ZipModelLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/ZipModelLoader.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/ZipModelLoader.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/ZipModelLoader.java
2008-05-13 08:04:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -44,82 +44,46 @@
private static final Logger LOG = Logger.getLogger(ZipModelLoader.class);
- @Deprecated
- 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!");
- }
-
+
public Collection loadModel(ProfileReference reference)
throws ProfileException {
LOG.info("Loading profile from ZIP '" + reference.getPath() + "'");
+
+ if (!reference.getPath().endsWith("zip")) {
+ throw new ProfileException("Profile could not be loaded!");
+ }
InputStream is = null;
File modelFile = new File(reference.getPath());
// 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 (reference.getPath().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 '" +
reference.getPath()
- + "'", e);
- throw new ProfileException(e);
- } catch (IOException e) {
- LOG.error("Exception while loading profile '" +
reference.getPath()
- + "'", e);
- throw new ProfileException(e);
- }
-
- if (is != null) {
- return super.loadModel(is, reference.getPublicReference());
- }
+ 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 '"
+ + reference.getPath() + "'", e);
+ throw new ProfileException(e);
+ } catch (IOException e) {
+ LOG.error("Exception while loading profile '"
+ + reference.getPath() + "'", e);
+ throw new ProfileException(e);
+ }
+
+ if (is == null) {
+ throw new ProfileException("Profile could not be loaded!");
}
- throw new ProfileException("Profile could not be loaded!");
+ return super.loadModel(is, reference.getPublicReference());
}
/**
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/internal/ProfileManagerImpl.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/internal/ProfileManagerImpl.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/internal/ProfileManagerImpl.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/internal/ProfileManagerImpl.java&r1=14721&r2=14722
==============================================================================
---
branches/gsoc2008_maurelio1234_profiles/profile/internal/ProfileManagerImpl.java
(original)
+++
branches/gsoc2008_maurelio1234_profiles/profile/internal/ProfileManagerImpl.java
2008-05-13 08:04:31-0700
@@ -43,7 +43,7 @@
/**
* Default <code>ProfileManager</code> implementation
*
- * @author Marcos Aurélio
+ * @author Marcos Aur�lio
*/
public class ProfileManagerImpl implements ProfileManager {
@@ -282,6 +282,8 @@
registerProfile(udp);
} catch (ProfileException e) {
// if an exception is raised file is unusable
+ LOG.warn("Failed to load user defined profile "
+ + file.getAbsolutePath() + ".", e);
}
}
}
Copied:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingPluginProfile.java
(from r14720,
/branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingProfile.java)
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingPluginProfile.java?view=diff&rev=14722&p1=/branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingProfile.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingPluginProfile.java&r1=14720&r2=14722
==============================================================================
---
/branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingProfile.java
(original)
+++
branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingPluginProfile.java
2008-05-13 08:04:31-0700
@@ -1,21 +1,39 @@
package org.argouml.profile.plugin;
+/**
+ * Excepton raised when loading profile from plugin
+ *
+ * @author maas
+ */
@SuppressWarnings("serial")
-public class ErrorLoadingProfile extends Exception {
+public class ErrorLoadingPluginProfile extends Exception {
- public ErrorLoadingProfile() {
+ /**
+ * Default constructor
+ */
+ public ErrorLoadingPluginProfile() {
super();
}
- public ErrorLoadingProfile(String message, Throwable cause) {
+ /**
+ * @param message message
+ * @param cause cause
+ */
+ public ErrorLoadingPluginProfile(String message, Throwable cause) {
super(message, cause);
}
- public ErrorLoadingProfile(String message) {
+ /**
+ * @param message message
+ */
+ public ErrorLoadingPluginProfile(String message) {
super(message);
}
- public ErrorLoadingProfile(Throwable cause) {
+ /**
+ * @param cause cause
+ */
+ public ErrorLoadingPluginProfile(Throwable cause) {
super(cause);
}
Removed:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingProfile.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/plugin/ErrorLoadingProfile.java?view=auto&rev=14721
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfile.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfile.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfile.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfile.java&r1=14721&r2=14722
==============================================================================
--- branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfile.java
(original)
+++ branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfile.java
2008-05-13 08:04:31-0700
@@ -36,6 +36,9 @@
*/
String getName();
+ /**
+ * @return the profile object
+ */
Profile getProfile();
}
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoader.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoader.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoader.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoader.java&r1=14721&r2=14722
==============================================================================
---
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoader.java
(original)
+++
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoader.java
2008-05-13 08:04:31-0700
@@ -12,7 +12,7 @@
*
* @param cl the reference class (used in order to find the needed
resources)
* @return the profile descriptor
- * @throws ErrorLoadingProfile
+ * @throws ErrorLoadingPluginProfile
*/
- PluginProfile loadProfile(Class cl) throws ErrorLoadingProfile;
+ PluginProfile loadProfile(Class cl) throws ErrorLoadingPluginProfile;
}
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoaderImpl.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoaderImpl.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoaderImpl.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoaderImpl.java&r1=14721&r2=14722
==============================================================================
---
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoaderImpl.java
(original)
+++
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileLoaderImpl.java
2008-05-13 08:04:31-0700
@@ -24,7 +24,6 @@
import org.argouml.profile.ProfileReference;
import org.argouml.profile.ResourceModelLoader;
import org.argouml.uml.cognitive.critics.CrProfile;
-import org.argouml.uml.cognitive.critics.CrUML;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -155,7 +154,17 @@
}
- public PluginProfile loadProfile(Class cl) throws ErrorLoadingProfile {
+ /**
+ * Reads the profile plugin from an XML file <code>profile.xml</code>
+ * in the root directory (relatively to <code>cl</code>
+ *
+ * @param cl the class
+ * @return the plugin profile
+ * @throws ErrorLoadingPluginProfile error reading XML
+ *
+ * @see
org.argouml.profile.plugin.PluginProfileLoader#loadProfile(java.lang.Class)
+ */
+ public PluginProfile loadProfile(Class cl) throws
ErrorLoadingPluginProfile {
try {
this.referenceClass = cl;
@@ -168,18 +177,24 @@
.getResourceAsStream("profile.xml"))));
} catch (SAXException e) {
- throw new ErrorLoadingProfile(e);
+ throw new ErrorLoadingPluginProfile(e);
} catch (IOException e) {
- throw new ErrorLoadingProfile(e);
+ throw new ErrorLoadingPluginProfile(e);
}
return plugin;
}
+ /**
+ * @see org.xml.sax.helpers.DefaultHandler#startDocument()
+ */
public void startDocument() {
plugin = new PluginProfileImpl();
}
+ /**
+ * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
public void startElement(String uri, String name, String qName,
Attributes atts) {
@@ -317,6 +332,9 @@
}
}
+ /**
+ * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
java.lang.String, java.lang.String)
+ */
public void endElement(String uri, String name, String qName) {
if (name.equalsIgnoreCase(Tags.PROFILE)) {
plugin.setProfile(profile);
@@ -325,6 +343,9 @@
private static PluginProfileLoaderImpl instance = null;
+ /**
+ * @return the unique instance for this loader
+ */
public static PluginProfileLoader getInstance() {
if (instance == null) {
instance = new PluginProfileLoaderImpl();
Modified:
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileModule.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileModule.java?view=diff&rev=14722&p1=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileModule.java&p2=branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileModule.java&r1=14721&r2=14722
==============================================================================
---
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileModule.java
(original)
+++
branches/gsoc2008_maurelio1234_profiles/profile/plugin/PluginProfileModule.java
2008-05-13 08:04:31-0700
@@ -28,26 +28,35 @@
registerProfile(this.getClass());
}
- protected void registerProfile(Class cl) {
+ private void registerProfile(Class cl) {
try {
PluginProfileLoader loader =
PluginProfileLoaderImpl.getInstance();
profile = loader.loadProfile(cl);
- } catch (ErrorLoadingProfile e) {
+ } catch (ErrorLoadingPluginProfile e) {
LOG.error("Error loading profile", e);
}
}
+ /**
+ * @see org.argouml.moduleloader.ModuleInterface#disable()
+ */
public boolean disable() {
ProfileFacade.getManager().removeProfile(profile.getProfile());
return true;
}
+ /**
+ * @see org.argouml.moduleloader.ModuleInterface#enable()
+ */
public boolean enable() {
ProfileFacade.getManager().registerProfile(profile.getProfile());
return true;
}
+ /**
+ * @see org.argouml.moduleloader.ModuleInterface#getInfo(int)
+ */
public String getInfo(int type) {
if (profile == null) {
LOG.debug("Empty Plugin Profile detected!");
@@ -69,6 +78,9 @@
}
}
+ /**
+ * @see org.argouml.moduleloader.ModuleInterface#getName()
+ */
public String getName() {
String ret = null;
if (profile == null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]