1 package org.andromda.core.metafacade;
2
3 import java.util.Collection;
4
5 import org.andromda.core.configuration.Filters;
6
7
8 /***
9 * <p/>
10 * Provides access to a model loaded by a Repository and made available to be used to retrieve information about
11 * model elements and metafacades. </p>
12 * <p/>
13 * Models can be instances of any metamodel. The most common models will be UML models. This interface is an
14 * abstraction. Any model that implements this interface can be used with AndroMDA. </p>
15 * <p/>
16 * Design goal: This class should only contain the <b>minimum amount of methods </b> that will be needed such that the
17 * AndroMDA core can deal with it. All other stuff should be done in cartridge-specific classes!!! So, please don't make
18 * this class grow! </p>
19 *
20 * @author <a href="http://www.mbohlen.de">Matthias Bohlen </a>
21 * @author Chad Brandon
22 */
23 public interface ModelAccessFacade
24 {
25 /***
26 * Sets the object that represents the entire model.
27 *
28 * @param model the model to set.
29 */
30 public void setModel(Object model);
31
32 /***
33 * Returns an object that represents the entire model. Data type is defined by the implementor of this interface.
34 *
35 * @return the metaclass model.
36 */
37 public Object getModel();
38
39 /***
40 * Returns the name of a metafacade (whatever that means for a concrete model).
41 *
42 * @param metafacade the metafacade from which to retrieve the name.
43 * @return String containing the name
44 */
45 public String getName(Object metafacade);
46
47 /***
48 * Returns the package name of a model element (whatever that means for a concrete model).
49 *
50 * @param modelElement the model element
51 * @return String containing the name
52 */
53 public String getPackageName(Object modelElement);
54
55 /***
56 * Sets the model packages instance which contains the information about what
57 * packages should and should not be filtered out. The model access facade
58 * instance then uses this information to provide any filtering by package when
59 * calling {@link #getModelElements()} and {@link #findByStereotype(String)}.
60 *
61 * @param modelPackages the model packages by which to filter.
62 */
63 public void setPackageFilter(Filters modelPackages);
64
65 /***
66 * Returns a collection of stereotype names for a modelElement (whatever that means for a concrete model).
67 *
68 * @param modelElement the modelElement
69 * @return Collection of Strings with stereotype names
70 */
71 public Collection getStereotypeNames(Object modelElement);
72
73 /***
74 * Finds all the model elements that have the specified <code>stereotype</code> (with any filtering
75 * applied from the information provided by {@link #setPackageFilter(ModelPackages)}).
76 *
77 * @param stereotype the name of the stereotype, they are matched without regard to case.
78 * @return Collection of model elements having the given stereotype
79 */
80 public Collection findByStereotype(String stereotype);
81
82 /***
83 * Returns all elements from the model (with any filtering
84 * applied from the information provided by {@link #setPackageFilter(ModelPackages)}).
85 *
86 * @return Collection of all metafacades
87 */
88 public Collection getModelElements();
89 }