001/*
002 * #%L
003 * Netarchivesuite - harvester
004 * %%
005 * Copyright (C) 2005 - 2014 The Royal Danish Library, the Danish State and University Library,
006 *             the National Library of France and the Austrian National Library.
007 * %%
008 * This program is free software: you can redistribute it and/or modify
009 * it under the terms of the GNU Lesser General Public License as
010 * published by the Free Software Foundation, either version 2.1 of the
011 * License, or (at your option) any later version.
012 * 
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Lesser Public License for more details.
017 * 
018 * You should have received a copy of the GNU General Lesser Public
019 * License along with this program.  If not, see
020 * <http://www.gnu.org/licenses/lgpl-2.1.html>.
021 * #L%
022 */
023
024package dk.netarkivet.harvester.webinterface;
025
026import org.slf4j.Logger;
027import org.slf4j.LoggerFactory;
028
029import dk.netarkivet.common.exceptions.UnknownID;
030import dk.netarkivet.common.webinterface.SiteSection;
031import dk.netarkivet.harvester.datamodel.HarvestChannelDAO;
032import dk.netarkivet.harvester.datamodel.HarvestDBConnection;
033import dk.netarkivet.harvester.datamodel.HarvestDefinitionDAO;
034
035/**
036 * Site section that creates the menu for harvest channel and mappings.
037 */
038@SuppressWarnings({"unused"})
039public class HarvestChannelSiteSection extends SiteSection {
040    /** Logger for this class. */
041    //private Log log = LogFactory.getLog(getClass().getName());
042    private static final Logger log = LoggerFactory.getLogger(HarvestChannelSiteSection.class);
043    /** number of pages visible in the left menu. */
044    private static final int PAGES_VISIBLE_IN_MENU = 2;
045
046    /**
047     * Create a new definition SiteSection object.
048     */
049    public HarvestChannelSiteSection() {
050        super("sitesection;HarvestChannel", "HarvestChannel", PAGES_VISIBLE_IN_MENU, new String[][] {
051                {"edit-harvest-mappings", "pagetitle;edit.harvest.mappings"},
052                {"edit-harvest-channels", "pagetitle;edit.harvest.channels"}
053        // The pages listed below are not visible in the left menu
054                }, "HarvestChannel", dk.netarkivet.harvester.Constants.TRANSLATIONS_BUNDLE);
055    }
056
057    /**
058     * Initialise the site section.
059     *
060     * @throws UnknownID If the default order.xml does not exist.
061     */
062    public void initialize() {
063        HarvestDefinitionDAO.getInstance();
064        HarvestChannelDAO.getInstance();
065    }
066
067    /** Release DB resources. */
068    public void close() {
069        HarvestDBConnection.cleanup();
070    }
071}