/** * LibreSource * Copyright (C) 2004-2007 Artenum SARL / INRIA * http://www.libresource.org - contact@libresource.org * * This software is free software; you can redistribute it and/or * modify it under the terms of QPL. See licenses details in QPL.txt * * Initial authors : * * Guillaume Bort / INRIA * Francois Charoy / Universite Nancy 2 * Julien Forest / Artenum * Claude Godart / Universite Henry Poincare * Florent Jouille / INRIA * Sebastien Jourdain / INRIA / Artenum * Yves Lerumeur / Artenum * Pascal Molli / Universite Henry Poincare * Gerald Oster / INRIA * Mariarosa Penzi / Artenum * Gerard Sookahet / Artenum * Raphael Tani / INRIA * * Contributors : * * Stephane Bagnier / Artenum * Amadou Dia / Artenum-IUP Blois * georgy * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ package org.libresource.subversion; import org.libresource.Libresource; import org.libresource.subversion.ejb.model.SubversionRepositoryResourceValue; import org.libresource.subversion.interfaces.LibresourceSubversionService; import org.libresource.xml.ImportExportLogger; import org.libresource.xml.LibresourceExportHandler; import org.libresource.xml.XmlDumpAttributes; import org.libresource.xml.XmlDumpHelper; import org.xml.sax.ContentHandler; import java.net.URI; /** * LibreSource * Export d'une ressource Subversion en XML * format : * * @author georgy (gdf) */ public class SubversionExportHandler extends LibresourceExportHandler { private URI uri; public SubversionExportHandler(URI uri) { this.uri = uri; } public void export(ContentHandler handler, ImportExportLogger logger) throws Exception { LibresourceSubversionService subversionService = (LibresourceSubversionService) Libresource.getService(SubversionConstants.SERVICE); SubversionRepositoryResourceValue repositoryResourceValue = subversionService.getRepository(uri); XmlDumpAttributes attributes = new XmlDumpAttributes(); attributes.put("id", repositoryResourceValue.getId()); attributes.put("repertoryName", repositoryResourceValue.getSvnName()); XmlDumpHelper.beginElement("libresource", "subversion", XmlDumpHelper.generateAttributesSet(attributes), handler); XmlDumpHelper.outputElementWithContent("subversion", "name", repositoryResourceValue.getName(), XmlDumpHelper.getEmptyAttributesSet(), handler); XmlDumpHelper.outputElementWithContent("subversion", "description", repositoryResourceValue.getDescription(), XmlDumpHelper.getEmptyAttributesSet(), handler); XmlDumpHelper.outputElementWithContent("subversion", "commiters", repositoryResourceValue.getCommiters(), XmlDumpHelper.getEmptyAttributesSet(), handler); XmlDumpHelper.outputElementWithContent("subversion", "readers", repositoryResourceValue.getReaders(), XmlDumpHelper.getEmptyAttributesSet(), handler); XmlDumpHelper.endElement("libresource", "subversion", handler); } }