View Javadoc
1   package org.andromda.core.configuration;
2   
3   import java.io.Serializable;
4   import java.util.ArrayList;
5   import java.util.Collection;
6   
7   /**
8    * Stores the repository information for each model that AndroMDA will process.
9    *
10   * @author Chad Brandon
11   */
12  public class Repository
13      implements Serializable
14  {
15      private static final long serialVersionUID = 34L;
16  
17      /**
18       * Stores the unique name of this repository.
19       */
20      private String name;
21  
22      /**
23       * Sets the unique (among other repositories)
24       * name.
25       *
26       * @param name the unique name of this repository.
27       */
28      public void setName(final String name)
29      {
30          this.name = name;
31      }
32  
33      /**
34       * Gets the unique name of this repository.
35       *
36       * @return the repository name.
37       */
38      public String getName()
39      {
40          return this.name;
41      }
42  
43      /**
44       * The models loaded by this repository.
45       */
46      private final Collection<Model> models = new ArrayList<Model>();
47  
48      /**
49       * Adds a model that this repository will load.
50       *
51       * @param model the model to load.
52       */
53      public void addModel(final Model model)
54      {
55          model.setRepository(this);
56          this.models.add(model);
57      }
58  
59      /**
60       * Gets the model instances belonging to this repository.
61       *
62       * @return the of model instances.
63       */
64      public Model[] getModels()
65      {
66          return this.models.toArray(new Model[this.models.size()]);
67      }
68  }