Problems creating Objects
Hello, I want to use slide without the webdav servlet. I wrote a little program to test the installation. But when creating new objects I only get Exceptions. I'm using this code (filedata is a byte-array passed as parameter): Domain.init("domain.xml"); token = Domain.accessNamespace(new SecurityToken(this), Domain.getDefaultNamespace()); if (token != null) { CredentialsToken credentials; credentials = new CredentialsToken(""); SlideToken slidetoken = new SlideTokenWrapper(new SlideTokenImpl(credentials)); slidetoken.setForceSecurity(false); Content content = token.getContentHelper(); token.begin(); // The following line throws the Exception token.getStructureHelper().create(slidetoken, new SubjectNode(), "/files/testfile.pdf"); NodeRevisionContent revisionContent = new NodeRevisionContent(); revisionContent.setContent(new ByteArrayInputStream(filedata)); NodeRevisionDescriptor revisionDesc = new NodeRevisionDescriptor(filedata.length); revisionDesc.setSource(""); revisionDesc.setResourceType(""); revisionDesc.setContentLanguage("de"); revisionDesc.setContentType("application/pdf"); revisionDesc.setLastModified(new Date()); revisionDesc.setCreationDate(new Date()); revisionDesc.setOwner("mrlogic"); revisionDesc.setCreationUser("mrlogic"); content.create(slidetoken, "/files/testfile.pdf", revisionDesc, revisionContent); token.commit(); } domain.xml is the example file published on the homepage. I'm getting the following Exception: 19:08:50,345 INFO [STDOUT] org.apache.slide.common.ServiceAccessException: Service TxXMLFileDescriptorsStore at /var/semrell/store/metadata working on /var/semrell/work/metadata access error : Conflict with uri /files. Cause is: no cause given 19:08:50,346 INFO [STDOUT] at org.apache.slide.store.txfile.AbstractTxFileStoreService.throwInternalError(AbstractTxFileStoreService.java:411) 19:08:50,346 INFO [STDOUT] at org.apache.slide.store.txfile.XMLResourceDescriptor.load(XMLResourceDescriptor.java:199) 19:08:50,346 INFO [STDOUT] at org.apache.slide.store.txfile.TxXMLFileDescriptorsStore.getFileDescriptor(TxXMLFileDescriptorsStore.java:578) 19:08:50,346 INFO [STDOUT] at org.apache.slide.store.txfile.TxXMLFileDescriptorsStore.storeObject(TxXMLFileDescriptorsStore.java:109) 19:08:50,347 INFO [STDOUT] at org.apache.slide.store.AbstractStore.storeObject(AbstractStore.java:639) 19:08:50,347 INFO [STDOUT] at org.apache.slide.store.ExtendedStore.storeObject(ExtendedStore.java:590) 19:08:50,347 INFO [STDOUT] at org.apache.slide.structure.StructureImpl.store(StructureImpl.java:493) 19:08:50,347 INFO [STDOUT] at org.apache.slide.structure.StructureImpl.create(StructureImpl.java:379) Thanks for any help, Volker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems creating Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin Kalén schrieb: | Volker Cordes wrote: | |> I want to use slide without the webdav servlet. I wrote a little |> program to test the installation. But when creating new objects I |> only get Exceptions. | | | We ran into similar problems. I don't know if it is a bug or | feature, but we decided to call it Slide evil-bit since it was so | "evil" to find out. ;-) | | Insert "evilBit();" call before this line (and anywhere before | starting TX with nat.begin if the transaction contains a structure | creation call): | |> token.begin(); | | | Function specification: | | private void evilBit() { /* From webdavservlet (mkCol) * "Prevent | dirty reads" */ m_slideToken.setForceStoreEnlistment(true); | | /* JavaDoc for above: * Force store enlistment flag mutator. * If | set to true, that will cause Slide to enlist the store * in the | current transaction for all operations, to be able * to prevent | dirty reads when doing complex updates. * That value should be set | to true only in some very specific * critical sections of the code, | as this would greatly decrease * the ability of Slide to handle | multiple concurrent requests. */ } | | NB: I am not a Slide developer! This is just something a colleague | of mine found out and that worked for us. | | I would be happy if someone else could explain this in detail or | comment if it is the endorsed "Slide kernel-way" of doing things. Hello, that helped, now it works. Thank you, Volker -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCVnhMzMGplDINzKMRAmzNAKCT34ZFcZEigURLSJdjGJ7G2HYDIgCfa9RE JjTxTgbWQ/eZL3YsiXFiWaA= =Wnhn -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Versioning
Hi, I encountered the following problem when trying to save a new revision of an existing document (I'm using the Slide-API): When saving a new revision of a document the create-method of the default ContentImpl only increases the minor version of the document. My problem is that I want to create a new major version. How do I do that? I tried to set the NodeRevisionNumber manually but that didn't work because it is ignored by the content handler. And if I create the RevisionDescriptor myself (by calling uri.getStore().createRevisionDescriptor()) the descriptor isn't added to the descriptors-list and I cannot do that because the methods are package-private. Is there any way to create a document with a new major version or do I have to change the Slide sourcecode? Thanks, Volker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]