01: package org.andromda.core.configuration;
02:
03: import java.io.Serializable;
04:
05: import java.util.ArrayList;
06: import java.util.Collection;
07:
08: /**
09: * Stores the repository information for each model that AndroMDA will process.
10: *
11: * @author Chad Brandon
12: */
13: public class Repository implements Serializable {
14: /**
15: * Stores the unique name of this repository.
16: */
17: private String name;
18:
19: /**
20: * Sets the unique (among other repositories)
21: * name.
22: *
23: * @param name the unique name of this repository.
24: */
25: public void setName(final String name) {
26: this .name = name;
27: }
28:
29: /**
30: * Gets the unique name of this repository.
31: *
32: * @return the repository name.
33: */
34: public String getName() {
35: return this .name;
36: }
37:
38: /**
39: * The models loaded by this repository.
40: */
41: private final Collection models = new ArrayList();
42:
43: /**
44: * Adds a model that this repository will load.
45: *
46: * @param model the model to load.
47: */
48: public void addModel(final Model model) {
49: model.setRepository(this );
50: this .models.add(model);
51: }
52:
53: /**
54: * Gets the model instances belonging to this repository.
55: *
56: * @return the of model instances.
57: */
58: public Model[] getModels() {
59: return (Model[]) this .models.toArray(new Model[0]);
60: }
61: }
|