Hi André,

Florent André schrieb:



            selector = (ServiceSelector)
this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager)
selector.select(pub.getSiteManagerHint());
            SiteStructure structure = siteManager.getSiteStructure(factory,
pub,
                    Publication.AUTHORING_AREA);

BTW, this can be achieved easier using

SiteStructure site = pub.getArea(Publication.AUTHORING_AREA).getSite();

[…]

And this "marvellous" :p) patchwork of code throw me a beautiful error that
I don't really understand :( :
stacktracejava.lang.RuntimeException: This session [unmodifiable] is not
modifiable!

You can only write to the Lenya repository in a transaction. For an example how to start a transaction, you could take a look at the AbstractUsecase class. Basically you have to create a new modifiable session:

Session session = RepositoryUtil.createSession(manager, identity, true);

After your operation is finished, you have to call session.commit(). But you have to be aware that this operation will throw a ConcurrentModificationException if someone else has modified the same resource in the meantime (optimistic offline lock). So you should expect this exception and handle it properly.

To avoid this, you'd have to check-out the repository node of the document before starting the transaction, but this could lead to blocked documents when an error occurs.

HTH,

-- Andreas


--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to