001 // This file is part of AceWiki. 002 // Copyright 2008-2012, AceWiki developers. 003 // 004 // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU 005 // Lesser General Public License as published by the Free Software Foundation, either version 3 of 006 // the License, or (at your option) any later version. 007 // 008 // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 010 // Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If 013 // not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.acewiki.core; 016 017 import java.util.ArrayList; 018 import java.util.List; 019 020 /** 021 * This class organizes a collection of ontology exporters. 022 * 023 * @author Tobias Kuhn 024 */ 025 public class OntologyExportManager { 026 027 private List<OntologyExporter> exporters = new ArrayList<OntologyExporter>(); 028 private Ontology ontology; 029 030 /** 031 * Creates a new ontology export manager for the given ontology. 032 * 033 * @param ontology The ontology. 034 */ 035 public OntologyExportManager(Ontology ontology) { 036 this.ontology = ontology; 037 } 038 039 /** 040 * Adds an ontology exporter. 041 * 042 * @param exporter The ontolgy exporter to be added. 043 */ 044 public void addExporter(OntologyExporter exporter) { 045 exporter.init(ontology); 046 if (exporter.isApplicable()) { 047 exporters.add(exporter); 048 } else { 049 System.err.println("Ignoring non-applicable exporter: " + exporter.getName()); 050 } 051 } 052 053 /** 054 * Removes an ontology exporter. 055 * 056 * @param exporter The ontolgy exporter to be removed. 057 */ 058 public void removeExporter(OntologyExporter exporter) { 059 exporters.remove(exporter); 060 } 061 062 /** 063 * Removes all ontology exporters. 064 */ 065 public void removeAllExporters() { 066 exporters.clear(); 067 } 068 069 /** 070 * Returns all ontology exporters. 071 * 072 * @return All ontology exporters. 073 */ 074 public List<OntologyExporter> getExporters() { 075 return new ArrayList<OntologyExporter>(exporters); 076 } 077 078 }