LenyaDocWritingTransformer Hi all,
Because I like how works the cocoon sourceWritingTransformer (http://cocoon.apache.org/2.1/userdocs/sourcewriting-transformer.html), I would like to do a transformer that write Lenya document (and not file). So first, I copy-paste the SourceWritingTransformer.java, change his name to LenyaDocWritingTransformer and create the adequate transformer in sitemap and It's work ! (cool but not very hard ! :) In second, I read some code in the Lenya source, and I try to code the creation of a test doc in my transformer... and now It's hard !! :) This is my code : ----------------------------------------------------- public class LenyaDocWritingTransformer extends AbstractSAXTransformer { ... //just a function test place for now public void endTransformingElement(String uri, String name, String raw) //Session session = RepositoryUtil.getSession(this.manager, this.request); //Session session = RepositoryUtil.getSession(this.manager, request); Session session = RepositoryUtil.getSession(manager, request); //DocumentFactory factory = DocumentUtil.createDocumentFactory(getManager(), session); DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session); Publication pub = factory.getPublication("dev"); DocumentManager docManager = null; ServiceSelector selector = null; SiteManager siteManager = null; ServiceSelector resourceTypeSelector = null; selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector"); siteManager = (SiteManager) selector.select(pub.getSiteManagerHint()); SiteStructure structure = siteManager.getSiteStructure(factory, pub, Publication.AUTHORING_AREA); docManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE); resourceTypeSelector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector"); ResourceType type = (ResourceType) resourceTypeSelector.select("entry"); String contentSourceUri = "context://sitemap.xmap"; org.apache.lenya.cms.publication.Document doc = docManager.add(factory, type, contentSourceUri, pub, Publication.AUTHORING_AREA, "en", "xml"); --------------------------------------- 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! at org.apache.lenya.cms.repository.SessionImpl.getUnitOfWork(SessionImpl.java:120) at org.apache.lenya.cms.repository.SessionImpl.createLock(SessionImpl.java:239) at org.apache.lenya.cms.repository.SourceNode.lock(SourceNode.java:256) ... Can you help me pleeeeeease ? Have a good day --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
