From: Chad B. <cwb...@us...> - 2005-05-31 16:38:44
|
User: cwbrandon Date: 05/05/31 09:38:37 Modified: lib/andromda-bootstrap/jars andromda-core-bootstrap.jar src/java/org/andromda/core/configuration Namespaces.java Configuration.java Log: namespace properties weren't initialized at the correct time Revision Changes Path 1.81 +218 -209 productbuild/lib/andromda-bootstrap/jars/andromda-core-bootstrap.jar <<Binary file>> 1.8 +17 -0 andromda/src/java/org/andromda/core/configuration/Namespaces.java Index: Namespaces.java =================================================================== RCS file: /cvsroot/andromda/andromda/src/java/org/andromda/core/configuration/Namespaces.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- Namespaces.java 27 May 2005 04:34:56 -0000 1.7 +++ Namespaces.java 31 May 2005 16:38:37 -0000 1.8 @@ -77,6 +77,23 @@ } /** + * Adds all <code>namespaces</code> to this instance. + * + * @param namespaces the array of namespaces to add. + */ + public void addNamespaces(final Namespace[] namespaces) + { + if (namespaces != null && namespaces.length > 0) + { + final int namespaceNumber = namespaces.length; + for (int ctr = 0; ctr < namespaceNumber; ctr++) + { + addNamespace(namespaces[ctr]); + } + } + } + + /** * Finds the Namespace with the corresponding <code>namespaceName</code>. * * @param namespaceName 1.8 +27 -2 andromda/src/java/org/andromda/core/configuration/Configuration.java Index: Configuration.java =================================================================== RCS file: /cvsroot/andromda/andromda/src/java/org/andromda/core/configuration/Configuration.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- Configuration.java 29 May 2005 00:36:36 -0000 1.7 +++ Configuration.java 31 May 2005 16:38:37 -0000 1.8 @@ -64,6 +64,7 @@ */ public void initialize() { + this.initializeNamespaces(); this.initializeMappings(); } @@ -110,7 +111,7 @@ /** * Gets the transformations belonging to this configuration. * - * @return the collection of {@link Transformation} instances. + * @return the array of {@link Transformation} instances. */ public Transformation[] getTransformations() { @@ -118,13 +119,28 @@ } /** + * Stores the configuration namespaces. + */ + private final Collection namespaces = new ArrayList(); + + /** * Adds a namespace to this configuration. * * @param namespace the configured namespace to add. */ public void addNamespace(final Namespace namespace) { - Namespaces.instance().addNamespace(namespace); + this.namespaces.add(namespace); + } + + /** + * Gets the configuration namespaces. + * + * @return the array of {@link Namespace} instances. + */ + private Namespace[] getNamespaces() + { + return (Namespace[])this.namespaces.toArray(new Namespace[0]); } /** @@ -210,6 +226,15 @@ } /** + * Initializes the namespaces with the namespaces from + * this configuration. + */ + private final void initializeNamespaces() + { + Namespaces.instance().addNamespaces(this.getNamespaces()); + } + + /** * Loads all mappings from the specified mapping search locations If the location points to a directory the directory * contents will be loaded, otherwise just the mapping itself will be loaded. */ |