/**
* LibreSource
* Copyright (C) 2004-2008 Artenum SARL / INRIA
* http://www.libresource.org - contact@artenum.com
*
* This file is part of the LibreSource software,
* which can be used and distributed under license conditions.
* The license conditions are provided in the LICENSE.TXT file
* at the root path of the packaging that enclose this file.
* More information can be found at
* - http://dev.libresource.org/home/license
*
* 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
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
package org.libresource.files;
import org.libresource.Libresource;
import org.libresource.files.ejb.model.RepositoryResourceValue;
import org.libresource.files.interfaces.LibresourceFilesService;
import org.libresource.xml.ImportExportLogger;
import org.libresource.xml.LibresourceExportHandler;
import org.libresource.xml.XmlDumpHelper;
import org.xml.sax.ContentHandler;
import java.net.URI;
/**
* LibreSource
* @author <a href="mailto:bort@loria.fr">Guillaume Bort</a> - <a href="http://www.inria.fr">INRIA Lorraine</a>
*/
public class RepositoryExportHandler extends LibresourceExportHandler {
private URI uri;
public RepositoryExportHandler(URI uri) {
this.uri = uri;
}
public void export(ContentHandler handler, ImportExportLogger logger)
throws Exception {
LibresourceFilesService filesService = (LibresourceFilesService) Libresource.getService("LibresourceFiles");
RepositoryResourceValue repositoryResourceValue = filesService.getRepository(uri);
XmlDumpHelper.beginElement("files", "repository", XmlDumpHelper.getEmptyAttributesSet(), handler);
XmlDumpHelper.outputElementWithContent("repository", "name", repositoryResourceValue.getName(), XmlDumpHelper.getEmptyAttributesSet(), handler);
XmlDumpHelper.outputElementWithContent("repository", "description", repositoryResourceValue.getDescription(), XmlDumpHelper.getEmptyAttributesSet(),
handler);
XmlDumpHelper.endElement("files", "repository", handler);
}
}
|