01: package org.andromda.core.repository;
02:
03: import java.io.InputStream;
04:
05: import org.andromda.core.metafacade.ModelAccessFacade;
06:
07: /**
08: * An interface for objects responsible for being a repository into which an object model can be loaded.
09: * <p/>
10: * AndroMDA does code generation from an object model. There must exist a repository in which the model can be loaded.
11: * The repository must be able to load the object model given a URL. Any repository that supports this API can be used
12: * by AndroMDA. </p>
13: *
14: * @author <A HREF="http://www.amowers.com">Anthony Mowers </A>
15: * @author Chad Brandon
16: */
17: public interface RepositoryFacade {
18: /**
19: * Opens and initialize the repository.
20: */
21: public void open();
22:
23: /**
24: * Closes the repository and reclaims all resources.
25: */
26: public void close();
27:
28: /**
29: * <p>
30: * Reads the object model into the repository from one or more model URIs. If uris is
31: * <strong>null </strong> or zero length, then an empty model will be created in the repository
32: * and can be retrieved from {@link #getModel()}.
33: * </p>
34: *
35: * @param modelUrls a list of modelUrls from which to load each URL of the model.
36: * @param moduleSearchPath a list of paths from which to search for module models (i.e. models that can be referenced from
37: * within other models).
38: */
39: public void readModel(String[] uris, String[] moduleSearchPath);
40:
41: /**
42: * Reads the object model into the repository from the given model streams. If the streams is
43: * <strong>null </strong> then an empty model will be created in the repository and can be retrieved from {@link #getModel()}.
44: * <p/>
45: *
46: * @param streams a list of InputStream instances containing a model.
47: * @param uris a list of URIs from which each stream in the <code>streams</code> parameter was loaded (note that the size
48: * and order of this list must match the order of the streams list).
49: * @param moduleSearchPath a list of paths from which to search for module models (i.e. models that can be referenced from
50: * within other models).
51: */
52: public void readModel(InputStream[] streams, String[] uris,
53: String[] moduleSearchPath);
54:
55: /**
56: * Writes the given <code>model</code> to the specified <code>outputLocation</code>.
57: *
58: * @param model the <code>model</code> to write.
59: * @param outputLocation the location to write the model file.
60: * @param version the <code>version</code> of the model to be written (i.e. could be XMI version if the
61: * repository writes XMI files).
62: * @param encoding the encoding of the file to be written.
63: */
64: public void writeModel(Object model, String outputLocation,
65: String version, String encoding);
66:
67: /**
68: * Writes the given <code>model</code> to the specified <code>outputLocation</code> using the default encoding
69: * provided by the model writer.
70: *
71: * @param model the <code>model</code> to write.
72: * @param outputLocation the location to write the model file.
73: * @param version the <code>version</code> of the model to be written (i.e. could be XMI version if the
74: * repository writes XMI files).
75: */
76: public void writeModel(Object model, String outputLocation,
77: String version);
78:
79: /**
80: * Returns the facade as the given <code>type</code> for the top-level model object from the repository. This model object
81: * contains all models <code>read</code> into the repository. If the type is not specified, the default model access
82: * facade will be used.
83: *
84: * @param type the type of the model facade.
85: * @return the model value (or <code>null</code> if no models exist in the repository).
86: */
87: public ModelAccessFacade getModel();
88:
89: /**
90: * Clears the repository of any model(s)
91: * (without shutting it down).
92: */
93: public void clear();
94: }
|