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