001package org.andromda.core.metafacade; 002 003import java.util.Collection; 004import org.andromda.core.configuration.Filters; 005 006/** 007 * <p> 008 * Provides access to a model loaded by a Repository and made available to be used to retrieve information about 009 * model elements and metafacades. </p> 010 * <p> 011 * Models can be instances of any metamodel. The most common models will be UML models. This interface is an 012 * abstraction. Any model that implements this interface can be used with AndroMDA. </p> 013 * <p> 014 * Design goal: This class should only contain the <b>minimum amount of methods </b> that will be needed such that the 015 * AndroMDA core can deal with it. All other stuff should be done in cartridge-specific classes!!! So, please don't make 016 * this class grow! </p> 017 * 018 * @author <a href="http://www.mbohlen.de">Matthias Bohlen </a> 019 * @author Chad Brandon 020 * @author Bob Fields 021 */ 022public interface ModelAccessFacade 023{ 024 /** 025 * Sets the object that represents the entire model. 026 * 027 * @param model the model to set. 028 */ 029 public void setModel(Object model); 030 031 /** 032 * Returns an object that represents the entire model. Data type is defined by the implementor of this interface. 033 * 034 * @return the metaclass model. 035 */ 036 public Object getModel(); 037 038 /** 039 * Returns the name of a metafacade (whatever that means for a concrete model). 040 * 041 * @param metafacade the metafacade from which to retrieve the name. 042 * @return String containing the name 043 */ 044 public String getName(Object metafacade); 045 046 /** 047 * Returns the package name of a model element (whatever that means for a concrete model). 048 * 049 * @param modelElement the model element 050 * @return String containing the name 051 */ 052 public String getPackageName(Object modelElement); 053 054 /** 055 * Sets the model packages instance which contains the information about what 056 * packages should and should not be filtered out. The model access facade 057 * instance then uses this information to provide any filtering by package when 058 * calling {@link #getModelElements()} and {@link #findByStereotype(String)}. 059 * 060 * @param modelPackages the model packages by which to filter. 061 */ 062 public void setPackageFilter(Filters modelPackages); 063 064 /** 065 * Returns a collection of stereotype names for a modelElement (whatever that means for a concrete model). 066 * 067 * @param modelElement the modelElement 068 * @return Collection of Strings with stereotype names 069 */ 070 public Collection<String> getStereotypeNames(Object modelElement); 071 072 // TODO Add typesafe Collection type 073 /** 074 * Finds all the model elements that have the specified <code>stereotype</code> (with any filtering 075 * applied from the information provided by {@link #setPackageFilter(Filters)}). 076 * 077 * @param stereotype the name of the stereotype, they are matched without regard to case. 078 * @return Collection of model elements having the given stereotype 079 */ 080 public Collection<MetafacadeBase> findByStereotype(String stereotype); 081 082 // TODO Add typesafe Collection type 083 /** 084 * Returns all elements from the model (with any filtering 085 * applied from the information provided by {@link #setPackageFilter(Filters)}). 086 * 087 * @return Collection of all metafacades 088 */ 089 public Collection<MetafacadeBase> getModelElements(); 090}