Re: Repository Shutdown

Martin Matula <[email protected]> Wed, 12 Oct 2005 13:01:00 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Jorg,
shutdownAll() should be called only when the whole application ends. The 
best way to delete a previously loaded model is to delete the whole 
extent containing the model (using refDelete()) and recreating the 
extent again.
So, your loadModel() method could do something like this:

RefPackage modelExtent = repository.getExtent("modelExtent");
if (modelExtent != null) {
     // delete the extent if it already exists
     modelExtent.refDelete();
}
modelExtent = repository.createExtent("modelExtent", ...);
... // load model into the modelExtent

Hopefully this helps.
Martin

Jörg Schütz wrote:
> Hi there,
> 
>  
> 
> I am developing an plugin for Eclipse that is supposed to read in an UML 
> file and then do something with the model defined there. To achieve 
> this, I am using the Netbeans libraries and the Uml2Mof tool. Being a 
> plugin, it is also desired that a user can run the tool several times 
> within the same Eclipse instance (i.e. read in the first model with the 
> tool, then read in another one).
> 
> When executing the tool several times, the model previously read in is 
> still in the MDRepository and the new model is simply added, which is 
> undesirable because only the model defined in the file read in is to be 
> processed. This is the case because I did not shut the Repository down 
> with the MDRManager.getDefault().shutdownAll() command.
> 
> However, if this command is executed at the end, upon the next 
> invocation an Exception is thrown (see bellow). Any idea how this can be 
> solved?
> 
> Thanks
> 
>  
> 
> Jörg
>