Source Code Cross Referenced for ModelRepository.java in  » UML » MetaBoss » com » metaboss » sdlctools » models » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » MetaBoss » com.metaboss.sdlctools.models 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.sdlctools.models;
016:
017:        import java.io.File;
018:        import java.io.InputStream;
019:        import java.net.URL;
020:        import java.util.Collection;
021:        import java.util.List;
022:        import java.util.Properties;
023:
024:        import javax.jmi.model.ModelPackage;
025:        import javax.jmi.model.MofPackage;
026:        import javax.jmi.reflect.RefBaseObject;
027:        import javax.jmi.reflect.RefObject;
028:        import javax.jmi.reflect.RefPackage;
029:
030:        /** Represents the generic interface to the jmi / mof model repository. */
031:        public interface ModelRepository {
032:            /** Naming URL of the component */
033:            public static final String COMPONENT_URL = "component:/com.metaboss.sdlctools.models.ModelRepository";
034:
035:            /** Reserved name of the UML MetaModel */
036:            public static final String METAMODEL_NAME_UML = "UMLMetaModel";
037:
038:            /** Reserved name of the MetaBoss MetaModel */
039:            public static final String METAMODEL_NAME_METABOSS = "MetaBossMetaModel";
040:
041:            /** Loads meta model from the specified URL to the model repository. After loading
042:             * meta model becomes available and models (i.e. instances of this metamodel) can be loaded. 
043:             * @param pMetaModelName the unique name caller wishes to refer to this metamodel in the future. Must be unique name not used before in this repository session.
044:             * @param pMetaModelFile the file where MOF definition of the MetaModel can be loaded from. Must refer to the xmi file containing MOF model (i.e. definition of this metamodel).
045:             * @param pDefaultModelStorageProperties model storage properties to use as default in case model specific properties are not supplied when model is loaded. null passed here
046:             * indicates that there is no default properties. This primarily indicates that model storage will not be partitioned by default.  
047:             * @return the package for newly loaded metamodel
048:             * @exception ModelRepositoryException thrown if there was a problem with the loading of the metamodel  */
049:            public void loadMetaModel(String pMetaModelName,
050:                    File pMetaModelFile, String pMetaModelRootPackageName,
051:                    Properties pDefaultModelStorageProperties)
052:                    throws ModelRepositoryException;
053:
054:            /** Loads meta model from the specified URL to the model repository. After loading
055:             * meta model becomes available and models (i.e. instances of this metamodel) can be loaded. 
056:             * @param pMetaModelName the unique name caller wishes to refer to this metamodel in the future. Must be unique name not used before in this repository session.
057:             * @param pMetaModelInputStream the input stream where MOF definition of the MetaModel can be read from. Must refer to the xmi file containing MOF model (i.e. definition of this metamodel).
058:             * @param pMetaModelURIString the unique URI string of the MOF definition of the MetaModel.
059:             * @param pDefaultModelStorageProperties model storage properties to use as default in case model specific properties are not supplied when model is loaded. null passed here
060:             * indicates that there is no default properties. This primarily indicates that model storage will not be partitioned by default.  
061:             * @return the package for newly loaded metamodel
062:             * @exception ModelRepositoryException thrown if there was a problem with the loading of the metamodel  */
063:            public void loadMetaModel(String pMetaModelName,
064:                    InputStream pMetaModelInputStream,
065:                    String pMetaModelURIString,
066:                    String pMetaModelRootPackageName,
067:                    Properties pDefaultModelStorageProperties)
068:                    throws ModelRepositoryException;
069:
070:            /** @param pMetaModelName the unique name of the MetaModel.
071:             * @return true if metamodel with the specified name is already loaded
072:             * @exception ModelRepositoryException thrown if there is a problem with answering the question */
073:            public boolean containsMetaModel(String pMetaModelName)
074:                    throws ModelRepositoryException;
075:
076:            /** Removes MetaModel with the specified name. Also removes all Models governed by this MetaModel
077:             * @param pMetaModelName the unique name of the MetaModel. MetaModel with this name must have been added previously to the repository.
078:             * @exception ModelRepositoryException thrown if there is a problem with the removing of the MetaModel */
079:            public void removeMetaModel(String pMetaModelName)
080:                    throws ModelRepositoryException;
081:
082:            /** Lists names of the loaded MetaModels.
083:             * @return array of strings containg the names of the loaded MetaModels. Can be zero length array if repository is empty.
084:             * @exception ModelRepositoryException thrown if there is a problem with obtaining the list of MetaModels */
085:            public String[] listMetaModelNames()
086:                    throws ModelRepositoryException;
087:
088:            /** Retrieves the ModelPackage representing the outermost package of the specified MetaModel. 
089:             * All MetaModel exploration and navigation can start from here.
090:             * @param pMetaModelName the unique name of the Model. Model with this name must have been opened or created previously in the repository.
091:             * @return the requested ModelPackage.
092:             * @exception ModelRepositoryException thrown if there is a problem with obtaining the extent */
093:            public ModelPackage getMetaModelExtent(String pMetaModelName)
094:                    throws ModelRepositoryException;
095:
096:            /** Adds the assistant to the metamodel. Supplied assistant will be assigned to
097:             * each model of this type. Assistants registered by this method will be installed in the 
098:             * order of registration, but after all assitants declared in configuration/
099:             * @param pMetaModelName - the name of metamodel to attach this assistant to
100:             * @param pAssistant - the asssitant itself
101:             * @throws ModelRepositoryException  thrown if there is a problem with registering the assistant */
102:            public void registerModelAssistant(String pMetaModelName,
103:                    ModelAssistant pAssistant) throws ModelRepositoryException;
104:
105:            /** Removes the assistant from the metamodel. First the assistant will
106:             * be disassociated from all models it is attached to. 
107:             * @param pMetaModelName - the name of metamodel to remove this assistant from
108:             * @param pAssistant - the asssitant itself
109:             * @throws ModelRepositoryException  thrown if there is a problem with unregistering the assistant */
110:            public void unregisterModelAssistant(String pMetaModelName,
111:                    ModelAssistant pAssistant) throws ModelRepositoryException;
112:
113:            /** Adds a listener object to the model. 
114:             * @param pModelName - the name of model to attach this listener to
115:             * @param pModelListener - the listener object to use
116:             * @throws ModelRepositoryException in case if there was a problem assigning the listener */
117:            public void registerModelListener(String pModelName,
118:                    ModelListener pModelListener)
119:                    throws ModelRepositoryException;
120:
121:            /** Removes a listener object from the metamodel.
122:             * @param pModelName - the name of model to remove this listener from
123:             * @param pModelListener - the listener object to remove
124:             * @throws ModelRepositoryException in case if there was a problem removing the listener */
125:            public void unregisterModelListener(String pModelName,
126:                    ModelListener pModelListener)
127:                    throws ModelRepositoryException;
128:
129:            /** @param pModelName the unique name of the Model given to it when it was opened or created.
130:             * @return true if model with the specified name is already loaded
131:             * @exception ModelRepositoryException thrown if there is a problem with answering the question */
132:            public boolean containsModel(String pModelName)
133:                    throws ModelRepositoryException;
134:
135:            /** Reads in existing model from the specified file location to the model repository.
136:             * The metamodel of the model must have been loaded prior to this call. The opened model can be
137:             * modified and results saved back if required.  
138:             * @param pModelName the unique name caller wishes to refer to this model in the future. Must be unique name not used before in this repository session.
139:             * @param pModelRootFile the file where definition of the Model can be loaded from. Must refer to the valid and existing xmi file containing the model (i.e. definition of this Model in XMI as per MetaModel).
140:             * If model storage is partitioned - this file must refer to the root file. Locations of all other
141:             * partitions are expected to be relative to this file.
142:             * @param pMetaModelName the unique name of the MetaModel. MetaModel with this name must have been added previously to the repository.
143:             * @exception ModelRepositoryException thrown if there was a problem with the loading of the Model  */
144:            public void openModel(String pModelName, File pModelRootFile,
145:                    String pMetaModelName) throws ModelRepositoryException;
146:
147:            /** Creates a new model in the model repository. This model is to be kept at the specified file location.
148:             * The metamodel of the model must have been loaded prior to this call. The created empty model can be
149:             * modified and results saved back if required.  
150:             * @param pModelName the unique name caller wishes to refer to this model in the future. Must be unique name not used before in this repository session.
151:             * @param pModelRootFile the file where definition of the Model shall be kept. Must refer to the non-existing xmi file in the existing
152:             * and accessible directory. If model storage is partitioned - this file must refer to the root file. Locations of all other
153:             * partitions are expected to be relative to this file. 
154:             * @param pMetaModelName the unique name of the MetaModel. MetaModel with this name must have been added previously to the repository.
155:             * @param pModelStorageProperties model storage properties to use. null passed here
156:             * indicates that default properties should be used (default properties are set when MetaModel is opened
157:             * via {@link #loadMetaModel(String, URL, String, Properties) loadMetaModel} method. If default properties 
158:             * are indicating partititoning and model being created is not partitioned - empty properties object must be specified.
159:             * @exception ModelRepositoryException thrown if there was a problem with the loading of the Model  */
160:            public void createModel(String pModelName, File pModelRootFile,
161:                    String pMetaModelName, Properties pModelStorageProperties)
162:                    throws ModelRepositoryException;
163:
164:            /** Saves model at the location specified at the time model was created or opened.
165:             *  Repository must not be in transaction at the time of this call. Only files modified since last save
166:             *  will be saved.   
167:             * @param pModelName the unique name of the model.
168:             * @param pValidateModel if set to true - model will be validated before saving and
169:             * in case if validation errors have been discovered - exception will be thrown and
170:             * model will not be saved.
171:             * @exception ModelRepositoryException thrown if there was a general problem with the saving the Model    
172:             * @exception ModelValidationException thrown if there was one or more validation problems.
173:             * Caller may use getExplanation() method offered by this exception to discover what is actually wrong */
174:            public void saveModel(String pModelName, boolean pValidateModel)
175:                    throws ModelRepositoryException, ModelValidationException;
176:
177:            /** Saves model at the location specified in this method call. The location is also
178:             *  changed for a future (similarly to the editor's saveAs commands).
179:             *  Repository must not be in transaction at the time of this call.
180:             *  All files will be saved will be saved.   
181:             * @param pModelName the unique name of the model.
182:             * @param pValidateModel if set to true - model will be validated before saving and
183:             * in case if validation errors have been discovered - exception will be thrown and
184:             * model will not be saved.
185:             * @param pNewModelRootFile the file where top level definition of the Model should be
186:             * saved to. If file exists it will be overwritten. If directory does not exist - 
187:             * it will be created. If model storage is partitioned - more files and subdirectories will be created as needed.
188:             * @param pNewModelStorageProperties model storage properties to use. null passed here
189:             * indicates that existing properties should be used. If it is desired to save model in
190:             * unpartitioned fashion - empty properties object must be specified.
191:             * @exception ModelRepositoryException thrown if there was a general problem with the saving the Model    
192:             * @exception ModelValidationException thrown if there was one or more validation problems.
193:             * Caller may use getExplanation() method offered by this exception to discover what is actually wrong */
194:            public void saveModelAs(String pModelName, boolean pValidateModel,
195:                    File pNewModelRootFile,
196:                    Properties pNewModelStorageProperties)
197:                    throws ModelRepositoryException, ModelValidationException;
198:
199:            /** Saves default model at the location specified at the time model was created or opened.
200:             *  Repository must not be in transaction at the time of this call. Only files modified since last save
201:             *  will be saved.   
202:             * @param pValidateModel if set to true - model will be validated before saving and
203:             * in case if validation errors have been discovered - exception will be thrown and
204:             * model will not be saved.
205:             * @exception ModelRepositoryException thrown if there was a general problem with the saving the Model    
206:             * @exception ModelValidationException thrown if there was one or more validation problems.
207:             * Caller may use getExplanation() method offered by this exception to discover what is actually wrong */
208:            public void saveDefaultModel(boolean pValidateModel)
209:                    throws ModelRepositoryException, ModelValidationException;
210:
211:            /** Saves default model at the location specified in this method call.
212:             * The location is also changed for a future (similarly to the editor's saveAs commands).
213:             *  Repository must not be in transaction at the time of this call.
214:             *  All files will be saved will be saved.   
215:             * @param pValidateModel if set to true - model will be validated before saving and
216:             * in case if validation errors have been discovered - exception will be thrown and
217:             * model will not be saved.
218:             * @param pNewModelRootFile the file where top level definition of the Model should be
219:             * saved to. If file exists it will be overwritten. If directory does not exist - 
220:             * it will be created. If model storage is partitioned - more files and subdirectories will be created as needed.
221:             * @param pNewModelStorageProperties model storage properties to use. null passed here
222:             * indicates that existing properties should be used. If it is desired to save model in
223:             * unpartitioned fashion - empty properties object must be specified.
224:             * @exception ModelRepositoryException thrown if there was a general problem with the saving the Model    
225:             * @exception ModelValidationException thrown if there was one or more validation problems.
226:             * Caller may use getExplanation() method offered by this exception to discover what is actually wrong */
227:            public void saveDefaultModelAs(boolean pValidateModel,
228:                    File pNewModelRootFile,
229:                    Properties pNewModelStorageProperties)
230:                    throws ModelRepositoryException, ModelValidationException;
231:
232:            /** Saves model at the location specified explicitly in this call.
233:             *  Repository must not be in transaction at the time of this call.
234:             *  All files will be saved as this is not an existing location.   
235:             * @param pModelName the unique name of the model.
236:             * @param pValidateModel if set to true - model will be validated before saving and
237:             * in case if validation errors have been discovered - exception will be thrown and
238:             * model will not be saved.
239:             * @param pModelRootFile the file where top level definition of the Model should be
240:             * saved to. If file exists it will be overwritten. If directory does not exist - 
241:             * it will be created. If model storage is partitioned - more files and subdirectories will be created as needed.
242:             * @param pModelStorageProperties model storage properties to use. null passed here
243:             * indicates that default properties should be used (default properties are set when MetaModel is opened
244:             * via {@link #loadMetaModel(String, URL, String, Properties) loadMetaModel} method.
245:             * If it is desired to save model in unpartitioned fashion - empty properties object must be specified.
246:             * @exception ModelRepositoryException thrown if there was a general problem with the saving the Model    
247:             * @exception ModelValidationException thrown if there was one or more validation problems.
248:             * Caller may use getExplanation() method offered by this exception to discover what is actually wrong */
249:            public void exportModel(String pModelName, boolean pValidateModel,
250:                    File pModelRootFile, Properties pModelStorageProperties)
251:                    throws ModelRepositoryException;
252:
253:            /** Checks if model has been modified and needs saving
254:             *  Repository must not be in transaction at the time of this call.
255:             *  Only files modified since last save will be considered.   
256:             * @param pModelName the unique name of the model.
257:             * @exception ModelRepositoryException thrown if there was a general problem with checking if model needs saving or not */
258:            public boolean isModelModified(String pModelName)
259:                    throws ModelRepositoryException;
260:
261:            /** Closes model in repository without saving any changes to the location specified at the time model was created or opened.
262:             *  Repository must not be in transaction at the time of this call.
263:             *  All modifications to the model will be lost
264:             * @param pModelName the unique name of the model.
265:             * @exception ModelRepositoryException thrown if there was a problem with the closing of the Model  */
266:            public void closeModel(String pModelName)
267:                    throws ModelRepositoryException;
268:
269:            /** Verifies model constraints on the given model.
270:             *  Repository must not be in transaction at the time of this call.
271:             * @param pModelName the unique name of the model which must be loaded into the repository prior to this call.
272:             * @exception ModelRepositoryException thrown if there was a general problem with accessing the model    
273:             * @exception ModelValidationException thrown if there was one or more validation problems.
274:             * Caller may use getExplanation() method offered by this exception to discover what is actually wrong    */
275:            public void validateModel(String pModelName)
276:                    throws ModelRepositoryException, ModelValidationException;
277:
278:            /** Attempts to correct the errors in the given model. 
279:             * Note that this is just an attempt which is not guaranteed to succeed.
280:             * Repository must not be in transaction at the time of this call.
281:             * validateModel() method can be called subsequently to this method in order
282:             * to find out whether the process has worked or not.  
283:             * @param pModelName the unique name of the model which must be loaded into the repository prior to this call.
284:             * @exception ModelRepositoryException thrown if there was a general problem with accessing the model. */
285:            public void rectifyModel(String pModelName)
286:                    throws ModelRepositoryException;
287:
288:            /** Lists names of the loaded Models.
289:             * @return array of strings containg the names of the loaded Models. Can be zero length array if repository has no models loaded.
290:             * @exception ModelRepositoryException thrown if there is a problem with obtaining the list of Models */
291:            public String[] listModelNames() throws ModelRepositoryException;
292:
293:            /** Retrieves the name of the MetaModel for this model
294:             * @param pModelName the unique name of the Model. Model with this name must have been opened or created previously in the repository.
295:             * @return the matching MetaModel name. */
296:            public String getMetaModelName(String pModelName)
297:                    throws ModelRepositoryException;
298:
299:            /** Retrieves the RefPackage representing the outermost package of the specified Model. All model exploration and navigation and editing can start from here
300:             * @param pModelName the unique name of the Model. Model with this name must have been opened or created previously in the repository.
301:             * @return the requested RefPackage. */
302:            public RefPackage getModelExtent(String pModelName)
303:                    throws ModelRepositoryException;
304:
305:            /** Retrieves the RefPackage representing the outermost package of the default Model.
306:             * The model is set as default by using setDefaultModel()
307:             * All model exploration and navigation and editing can start from here
308:             * @return the requested RefPackage. */
309:            public RefPackage getDefaultModelExtent()
310:                    throws ModelRepositoryException;
311:
312:            /** Sets the default model name. This repository has a few methods
313:             * dealing with the default model, which do not require the name of the model
314:             * @param pModelName the unique name of the Model. Model with this name must have been opened or created previously in the repository.
315:             * null can be passed to clear existing default model without setting a new one
316:             * @return the name of previous default model or null if there was no default model before
317:             * @exception ModelRepositoryException thrown if there is a problem with setting default model */
318:            public String setDefaultModel(String pModelName)
319:                    throws ModelRepositoryException;
320:
321:            /** @return the name of the default model or null if default model is not setup */
322:            public String getDefaultModelName() throws ModelRepositoryException;
323:
324:            /** @return the name of the metamodel of the default model or null if default model is not setup */
325:            public String getDefaultModelMetaModelName()
326:                    throws ModelRepositoryException;
327:
328:            /** Retrieves the RefPackage described by supplied package descriptor.
329:             * @param pModelName the unique name of the Model. Model with this name must have been opened or created previously in the repository.
330:             * @param pPackageDescriptor the descriptor of the package we are after.
331:             * @return the requested RefPackage.
332:             * @exception ModelRepositoryException thrown if there is a problem with obtaining the package from the model */
333:            public RefPackage getModelPackage(String pModelName,
334:                    MofPackage pPackageDescriptor)
335:                    throws ModelRepositoryException;
336:
337:            /** Retrieves the name of the model given object belongs to.
338:             * @param pModelObject the object from the model.
339:             * @return the name of the model
340:             * @exception ModelRepositoryException thrown if there is a problem with obtaining the name of the model */
341:            public String getOwnerModelName(RefBaseObject pModelObject)
342:                    throws ModelRepositoryException;
343:
344:            /** Retrieves the name of the metamodel given object belongs to.
345:             * @param pModelObject the object from the model.
346:             * @return the name of the metamodel
347:             * @exception ModelRepositoryException thrown if there is a problem with obtaining the name of the model */
348:            public String getOwnerMetaModelName(RefBaseObject pModelObject)
349:                    throws ModelRepositoryException;
350:
351:            /** Retrieves the RefBaseObject represented by the RepositoryId (MOF Id). All model exploration and navigation and editing can start from here
352:             * @param pRepositoryId the unique repository id of the object. Object with the same name must exist in the repository.
353:             * @return the requested RefBaseObject. */
354:            public RefBaseObject getModelObjectByRepositoryId(
355:                    String pRepositoryId) throws ModelRepositoryException;
356:
357:            /** Retrieves the collection of the Objects matching given XPath expression. This method is the same as
358:             * calling {@link #searchByXPath(RefBaseObject, String) searchByXPath(RefBaseObject pContextObject, String pXPathExpression)} with
359:             * the extent of the model as a context object. Please see {@link #searchByXPath(RefBaseObject, String) searchByXPath(RefBaseObject pContextObject, String pXPathExpression)}
360:             * for description of how XPath expressions are constructed. 
361:             * @param pContextModelName the unique name of the Model. Model with this name must have been opened or created previously in the repository.
362:             * @param pXPathExpression the xpath expression
363:             * @see #searchByXPath(RefBaseObject, String) searchByXPath(RefBaseObject pContextObject, String pXPathExpression) 
364:             * @return the list with matching zero or more Objects. Objects may be 
365:             * RefObjects if expression has matched model elements or plain java objects (eg. Strings) if expression has matched attributes */
366:            public List searchByXPath(String pContextModelName,
367:                    String pXPathExpression) throws ModelRepositoryException;
368:
369:            /** Retrieves the collection of the RefBaseObjects matching given XPath expression.
370:             * The XPath expression follows <a href="http://www.w3.org/TR/xpath">XPath 1.0</a> syntax with
371:             * following specific features:
372:             * <UL>
373:             * <LI>All instance objects in the model (ie. RefObject descendents) are deemed to be XPath element nodes.</LI> 
374:             * <LI>The XPath element node name is the value of the name attribute of the corresponding MOF ModelElement (the one
375:             * which describes RefObject instance). For example the XPath expression "//Package" will match all instances of the Package model element.</LI> 
376:             * <LI>All attributes of the RefObjects are deemed to be XPath attribute nodes. For example the XPath expression
377:             * "//Package[@name='system']" will match all instances of the Package model element with "name" having a value "system".</LI> 
378:             * <LI>The XPath Parent axis consists of immediate composite element of the given instance.</LI> 
379:             * <LI>The XPath Child axis consists of all instances directly contained by the given instance.
380:             *  For example the XPath expression "./Package[@name='system']" will match all immediately contained instances of the
381:             *  Package model element with "name" having a value "system".</LI> 
382:             * <LI>Additional XPath function is intoduced. Function reference() is taking one argument - the name of the reference.
383:             *  It returns a node-set with zero or more nodes referred to by current node (or nodes).
384:             *  For example the XPath expression "//Package[reference('stereotype')[@name='entity']]" will match
385:             *  all instances of the Package model element which has a 'stereotype' reference whose
386:             *  "name" attribute has value "entity".</LI> 
387:             * </UL>
388:             * @param pContextObject the object relative to which the given XPath expression should be executed.
389:             * @param pXPathExpression the xpath expression.   
390:             * @see #searchByXPath(String, String) searchByXPath(String pContextModelName, String pXPathExpression) 
391:             * @return the list with matching zero or more Objects. Objects may be 
392:             * RefObjects if expression has matched model elements or plain java objects (eg. Strings) if expression has matched attributes */
393:            public List searchByXPath(RefBaseObject pContextObject,
394:                    String pXPathExpression) throws ModelRepositoryException;
395:
396:            /** Retrieves the collection of the Objects matching given XPath expression. This method is the same as
397:             * calling {@link #searchByXPath(RefBaseObject, String) searchByXPath(RefBaseObject pContextObject, String pXPathExpression)} once per each
398:             * context object and combining results. Please see {@link #searchByXPath(RefBaseObject, String) searchByXPath(RefBaseObject pContextObject, String pXPathExpression)}
399:             * for description of how XPath expressions are constructed. 
400:             * @param pContextObjects the List of the RefBaseObjects to run XPath expression against.
401:             * @param pXPathExpression the xpath expression
402:             * @see #searchByXPath(RefBaseObject, String) searchByXPath(RefBaseObject pContextObject, String pXPathExpression) 
403:             * @return the list with matching zero or more Objects. Objects may be 
404:             * RefObjects if expression has matched model elements or plain java objects (eg. Strings) if expression has matched attributes */
405:            public List searchByXPath(Collection pContextObjects,
406:                    String pXPathExpression) throws ModelRepositoryException;
407:
408:            /** Retrieves the collection of the RefObjects which are at the top level
409:             * that is they are not owned by any other object.
410:             * @param pModelName the unique name of the Model. Model with this name must have been opened or created previously in the repository.
411:             * @return the list with zero or more RefObjects, which are not owned by any other object. */
412:            public List getTopLevelModelObjects(String pModelName)
413:                    throws ModelRepositoryException;
414:
415:            /** This method is part of repository transaction mangement suite of methods.
416:             * It creates new transaction.
417:             * @throws ModelRepositoryException if there is already current transaction in this repository or repository is closed */
418:            public void beginTransaction() throws ModelRepositoryException;
419:
420:            /** This method is part of repository transaction mangement suite of methods.
421:             * It returns true if repository is in transaction.
422:             * @throws ModelRepositoryException if repository is closed */
423:            public boolean isInTransaction() throws ModelRepositoryException;
424:
425:            /** This method is part of repository transaction mangement suite of methods.
426:             * It commits current transaction.
427:             * @throws ModelRepositoryException if there is no current transaction in this repository or repository is closed */
428:            public void commitTransaction() throws ModelRepositoryException;
429:
430:            /** This method is part of repository transaction mangement suite of methods.
431:             * It rolls back current transaction.
432:             * @throws ModelRepositoryException if there is no current transaction in this repository or repository is closed */
433:            public void rollbackTransaction() throws ModelRepositoryException;
434:
435:            /** Closes whole repository without saving any changes to any of the models.
436:             *  Repository must not be in transaction at the time of this call.
437:             *  All modifications to all the models will be lost
438:             * @exception ModelRepositoryException thrown if there was a problem with the closing of the repository */
439:            public void close() throws ModelRepositoryException;
440:
441:            /** This helper method duplicates given object in the same model and returns newly created object.
442:             *  The parent (ie. container) of the newly created ModelElement is not set 
443:             * @param pSourceObject the object to copy from.
444:             */
445:            public RefObject duplicateModelElement(RefObject pSourceObject)
446:                    throws ModelRepositoryException;
447:
448:            /** This helper method copies given object to different model and returns newly created object.
449:             * @param pSourceObject the object to copy from
450:             * @param pTargetModelName the model to copy. Must be different to the model which owns
451:             * source object and also must be of the same type (same metamodel)
452:             * @param pDeepCopy - if equals true - all contained objects are also copied. Associations within
453:             * copied hierarchy are copied. External associations are only copied if pExternalElementResolver is 
454:             * not null and its getMatchingModelElement() method has returned not null. Note that if not all external associations are 
455:             * copied - the model integrity may be compromised). */
456:            public RefObject copyModelElement(RefObject pSourceObject,
457:                    String pTargetModelName, boolean pDeepCopy,
458:                    ModelElementResolver pExternalElementResolver)
459:                    throws ModelRepositoryException;
460:
461:            /** This helper method changes all internals of the target object to be exactly the same as
462:             * the internals of the sample object. Similarly to the copyModelElement method the associations within copied hierarchy are copied,
463:             * but external associations are dropped if pExternalElementResolver is not given or has returned null   
464:             * (note that this may make newly copied object tree invalid).
465:             * @param pSampleObject the sample object to mirror all attributes and child elements from
466:             * @param pTargetObject the object which will get whole new content. Everything it has inside 
467:             * (Attributes and Contained objects) will be replaced. Objects must be of the same type and belong to the
468:             * model (same or different - does not matter). */
469:            public void retrofitModelElement(RefObject pSampleObject,
470:                    RefObject pTargetObject,
471:                    ModelElementResolver pExternalElementResolver)
472:                    throws ModelRepositoryException;
473:
474:            /** This helper method empties given model element, which means it deletes all
475:             * attributes and contained objects
476:             * @param pModelElement the model element to empty */
477:            public void emptyModelElement(RefObject pModelElement)
478:                    throws ModelRepositoryException;
479:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.