|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Using transient storageI'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 |
|
|
Re: Using transient storageHi,
Why do you need to throw away the complete repository? Shouldn't it be enough to delete the extents? This way you could reuse any generated JMI stuff etc. Ciao, Steffen Frank Finger wrote: > 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 -- Dipl.-Inf. Steffen Zschaler Research Assistant Technische Universität Dresden Department of Computer Science Phone +49 351 463 38555 Fax +49 351 463 38459 Email Steffen.Zschaler@... WWW http://www.steffen-zschaler.de.vu/ |
|
|
Re: Using transient storageTry using different storage ids. Anyway, deleting the extents would save
more memory, since otherwise the repository is not garbage collected unless the application ends. Martin Frank Finger wrote: > 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 |
|
|
Re: Using transient storageHi 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 > |
| Free Forum Powered by Nabble | Forum Help |