Re: MDR use problem

Martin Matula <[email protected]> Mon, 24 May 2004 19:37:37 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi,
the problem seems to be that you probably have not instantiated the 
Projects metamodel as in the example instructions. The page says:

If you want to run the example above (and also the code below), you 
first need to do two things:

    * Create a new instance of "Project" package in "Project model"
      extent and name it "Projects metadata" (so that
      repository.getExtent("Projects metadata") call in the example
      above does not return null).
    * Set the class to be run using internal execution (in case you are
      running it from NetBeans) - you can do this by selecting the file
      in NB explorer where the class is defined and setting Executor
      property in the Execution tab of property sheet for this file to
      Internal Execution.

The example supposes that you are using NetBeans to run it. In the 
standalone mode it would be more difficult. You would need to 
instantiate the metamodel programmatically. To see how it can be done 
you can try to look at sources from UML2MOF tool. I will try to update 
the example with the information on how to run it in a standalone mode 
as soon as I will have more time.
Regards,
Martin

sam adam wrote:

> Hi all,
>
> I have downloaded the MDR-standalone and copied the example “Projects 
> metadata”. When I compiled and run the ProjectCreationDemo (as it is), 
> I got the message: [Exception in thread "main" 
> java.lang.NullPointerException ] returned by the getExtent method. I 
> have noticed the files mdr.btd, mdr.btb and mdr.btx were though created.
>
> I have then tried to test on the nullity of the extent and I tried to 
> use the createExtent method as follows:
>
> [ if (extent==null)
>
> extent= (ProjectsPackage) repository.createExtent("Projects metadata"); ]
>
> but I got the error message [unreported exception 
> org.netbeans.api.mdr.CreationFailedException; must be caught or 
> declared to be thrown
>
> extent= (ProjectsPackage) repository.createExtent("Projects metadata");]
>
> I tried to run the ProjectRetrievalDemo (as the mdr files were 
> created) but I got the following error message after. Any help would 
> be appreciated. Thanks in advance.
>
> -----------------------------------------------------------------------------------------------------
>
> [org.netbeans.mdr.Logger] Property 
> org.netbeans.mdr.persistence.btreeimpl.filename not specified. Us
>
> ing default value: mdr
>
> [org.netbeans.mdr.Logger] INFORMATIONAL *********** Exception occurred 
> ************ at Fri May 21 17
>
> :21:15 GMT 2004
>
> org.netbeans.mdr.persistence.StorageBadRequestException: There is no 
> value for key "storageIds:mdr"
>
> at 
> org.netbeans.mdr.persistence.btreeimpl.btreestorage.NameIndex.getObj(NameIndex.java:56)
>
> at 
> org.netbeans.mdr.persistence.btreeimpl.btreestorage.MofidIndex.get(MofidIndex.java:44)
>
> at 
> org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeDatabase.fetchIndex(BtreeDatabas
>
> e.java:815)
>
> at 
> org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeStorage.getIndex(BtreeStorage.ja
>
> va:251)
>
> at 
> org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeStorage.getSinglevaluedIndex(Btr
>
> eeStorage.java:259)
>
> at 
> org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeStorage.open(BtreeStorage.java:1
>
> 62)
>
> at org.netbeans.mdr.storagemodel.MdrStorage.init(MdrStorage.java:422)
>
> at org.netbeans.mdr.storagemodel.MdrStorage.init(MdrStorage.java:378)
>
> at 
> org.netbeans.mdr.NBMDRepositoryImpl.initCheck(NBMDRepositoryImpl.java:635)
>
> at 
> org.netbeans.mdr.NBMDRepositoryImpl.getExtent(NBMDRepositoryImpl.java:267)
>
> at 
> org.netbeans.mdrdemo.ProjectRetrievalDemo.main(ProjectRetrievalDemo.java:15)
>
> Exception in thread "main" java.lang.NullPointerException
>
> at 
> org.netbeans.mdrdemo.ProjectRetrievalDemo.main(ProjectRetrievalDemo.java:18)
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger ! 
> <http://fr.rd.yahoo.com/messenger/mail_taglines/yahoofr/*http://fr.messenger.yahoo.com/downloadactivex/index.html> 
>
>