1 package org.ocltf.model.repository;
2
3 import java.io.InputStream;
4 import java.net.URL;
5
6 /***
7 * An interface for objects responsible for being a repository into which an object model can
8 * be loaded.
9 *
10 * <p> OCLTF does code generation from an object model. There must exist a repository in which
11 * the model can be loaded. The repository must be able to load the object model
12 * given a URL. Any Repository that supports this API can be used by OCLTF. </p>
13 *
14 * @see org.ocltf.model.ModelFacade
15 */
16 public interface Repository {
17
18 /***
19 * Initialize the repository.
20 */
21 public void init();
22
23 /***
24 * Perform any cleanup required.
25 */
26 public void cleanup();
27
28 /***
29 * Loads the object model into the repository from the given URL.
30 *
31 * <p> An URLs can be used to point to files on the filesystem,
32 * a file in a jar file, a file from a website, data from a database, etc... </p>
33 *
34 * @param modelUri the URI of model
35 * @throws RepositoryException thrown if anything happesn during read.
36 */
37 public void loadModel(URL modelUri)
38 throws RepositoryException;
39
40 /***
41 * read the object model into the repository from the given stream.
42 *
43 * <p> An URLs can be used to point to files on the filesystem,
44 * a file in a jar file, a file from a website, data from a database, etc... </p>
45 *
46 * @param modelStream Input stream to be used for reading an XMI document (if
47 * <code>null</code> is passed, will try to open a connection to the
48 * spefified modelUri.
49 * @param modelUri URI of the XMI document to be read from. If set to <code>null</code>,
50 * Repository will not be able to resolve relative hrefs.
51 * @throws RepositoryException thrown if anything happesn during read.
52 */
53 public void loadModel(InputStream modelStream, URL modelUri)
54 throws RepositoryException;
55
56 /***
57 * Returns the date and time of when the model was last modified
58 *
59 *@return the lastModified time
60 */
61 public long getLastModified();
62
63 /***
64 * returns the top-level model object from the repository
65 *
66 *@return Object The model object.
67 */
68 public Object getModel();
69
70 }