Re: [mdr-users] Using transient storage
Leonardo Gresta Paulino Murta <[email protected]> Mon, 13 Mar 2006 10:48:42 -0300
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Frank,
We have exactly the same scenario. What we do in each iteration is
to create a RefPackage, perform the translation, and then delete the
RefPackage. In this way we do not need to (re)initialize the whole
repository (load metamodel, etc.) time and again.
Leo
PS.: Our repository is an in memory repository. We start it using the
following code:
Map<String,String> properties = new HashMap<String,String>();
properties.put("storage",
"org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl");
properties.put(StorageFactoryImpl.STORAGE_ID,
String.valueOf(System.currentTimeMillis()));
repository = new NBMDRepositoryImpl(properties);
Frank Finger escreveu:
> I'm using Netbeans MDR to transform a proprietary model format to UML
> XMI (standalone). In every run of the transformation, I want to build
> the model from scratch, export it, and throw the repository away
> afterwards. That's why I thought that ...memoryimpl.StorageFactoryImpl
> would be the storage implementation to use.
> A single export works fine, but when exporting twice I run into
> exceptions. The same exceptions can be produced by the piece of source
> code below.
> From a quick look at ...mdr.persistence.memoryimpl.StorageImpl, I
> thought that not assigning STORAGE_ID values would lead to independent
> repositories.
>
>
> public static void main( String[] args ) throws Exception
> {
> Map properties = new HashMap();
> properties.put(
> "storage",
> "org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl"
> );
> // I'm not setting the STORAGE_ID.
> // properties.put( StorageFactoryImpl.STORAGE_ID, ... );
>
> MDRepository firstRepository = new NBMDRepositoryImpl( properties );
> System.out.println(
> "firstRepository extents: "+
> Arrays.asList( firstRepository.getExtentNames() )
> );
> MDRepository secondRepository = new NBMDRepositoryImpl( properties );
> // following line throws exception:
> System.out.println(
> "secondRepository extents: "+
> Arrays.asList( secondRepository.getExtentNames() )
> );
> }
>
> The stack trace of the exception is:
> org.netbeans.mdr.util.DebugException: Missing storage files or
> different storage version.
> at ...storagemodel.MdrStorage.initializeIndexes(MdrStorage.java:507)
> at ...storagemodel.MdrStorage.rollback(MdrStorage.java:554)
> at ...util.TransactionMutex.end(TransactionMutex.java:73)
> at ...util.MultipleReadersMutex.leave(MultipleReadersMutex.java:173)
> at ...NBMDRepositoryImpl.endTrans(NBMDRepositoryImpl.java:249)
> at ...NBMDRepositoryImpl.boot(NBMDRepositoryImpl.java:1331)
> at ...NBMDRepositoryImpl.initCheck(NBMDRepositoryImpl.java:758)
> at ...NBMDRepositoryImpl.getExtentNames(NBMDRepositoryImpl.java:347)
> at Main.main(Main.java:58) /* ="secondRepository.getExtentNames()" */
>
>
> Can anybody tell me what I'm doing wrong?
>
> Thanks in advance,
> Frank
>