You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Volker Cordes <Mr...@gmx.de> on 2005/04/07 21:11:14 UTC
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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: Problems creating Objects
Posted by Volker Cordes <Mr...@gmx.de>.
-----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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: Problems creating Objects
Posted by Martin Kalén <mk...@apache.org>.
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.
Regards,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org