/*
 * This file is part of the OpenNMS(R) Application.
 *
 * OpenNMS(R) is Copyright (C) 2006 The OpenNMS Group, Inc.  All rights reserved.
 * OpenNMS(R) is a derivative work, containing both original code, included code and modified
 * code that was published under the GNU General Public License. Copyrights for modified
 * and included code are below.
 *
 * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
 *
 * Modifications:
 * 
 * Created: July 26, 2006
 *
 * Copyright (C) 2006 The OpenNMS Group, Inc.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * For more information contact:
 *      OpenNMS Licensing       <license@opennms.org>
 *      http://www.opennms.org/
 *      http://www.opennms.com/
 */

/**
 * 
 * @author <a href="mailto:brozow@opennms.org">Mathew Brozowski</a>
 * @author <a href="mailto:antonio@opennms.it">Antonio Russo</a>
 */
package org.opennms.netmgt.linkd.jmx;
/*
import java.beans.PropertyVetoException;
import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.sql.SQLException;

import org.apache.log4j.Category;

import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;

import org.opennms.core.utils.ThreadCategory;

import org.opennms.netmgt.config.DataSourceFactory;
import org.opennms.netmgt.config.LinkdConfigFactory;

import org.opennms.netmgt.eventd.EventIpcManager;
import org.opennms.netmgt.eventd.EventIpcManagerFactory;

import org.opennms.netmgt.linkd.DbEventWriter;

public class Linkd implements LinkdMBean {
   public final static String LOG4J_CATEGORY = "OpenNMS.Linkd";

   public void init() {
	   ThreadCategory.setPrefix(LOG4J_CATEGORY);
		// Initialize the Capsd configuration factory.
		//
		try {
			LinkdConfigFactory.init();
            DataSourceFactory.init();
		} catch (ClassNotFoundException ex) {
			log().error("init: Failed to load configuration file ", ex);
		} catch (MarshalException ex) {
			log().error("Failed to load configuration", ex);
			throw new UndeclaredThrowableException(ex);
		} catch (ValidationException ex) {
			log().error("Failed to load configuration", ex);
			throw new UndeclaredThrowableException(ex);
		} catch (IOException ex) {
			log().error("Failed to load configuration", ex);
			throw new UndeclaredThrowableException(ex);
	    } catch (PropertyVetoException pve) {
	        log().fatal("Property veto failure loading database config", pve);
	        throw new UndeclaredThrowableException(pve);
	    } catch (SQLException sqle) {
	    	log().fatal("SQL exception loading database config", sqle);
	        throw new UndeclaredThrowableException(sqle);
	    }

	    
	    EventIpcManagerFactory.init();
        EventIpcManager mgr = EventIpcManagerFactory.getIpcManager();
        
        org.opennms.netmgt.linkd.Linkd linkd = getLinkd();

        linkd.setEventMgr(mgr);
        linkd.setDbConnectionFactory(DataSourceFactory.getInstance());
        linkd.setLinkdConfig(LinkdConfigFactory.getInstance());
        linkd.setQueryManager(new DbEventWriter(DataSourceFactory.getDataSource()));
        
	    linkd.init();
	}
	public void start() {
		getLinkd().start();
	}
	public void stop() {
		getLinkd().stop();
	}
	public int getStatus() {
		return getLinkd().getStatus();
	}
	public String status() {
		return org.opennms.core.fiber.Fiber.STATUS_NAMES[getStatus()];
	}
	public String getStatusText() {
		return org.opennms.core.fiber.Fiber.STATUS_NAMES[getStatus()];
	}

	private Category log() {
	        return ThreadCategory.getInstance();
	}
	
	private org.opennms.netmgt.linkd.Linkd getLinkd() {
	        // Set the category prefix
	        ThreadCategory.setPrefix(LOG4J_CATEGORY);

	        return org.opennms.netmgt.linkd.Linkd.getInstance();
	}
}

*/
import org.opennms.netmgt.daemon.AbstractSpringContextJmxServiceDaemon;

public class Linkd extends AbstractSpringContextJmxServiceDaemon<org.opennms.netmgt.linkd.Linkd> implements LinkdMBean {

    @Override
    protected String getLoggingPrefix() {
        return "OpenNMS.Linkd";
    }

    @Override
    protected String getSpringContext() {
        return "linkdContext";
    }

}

@@ -1603,2858 +1603,8 @@
 mx;%0A
-/*%0Aimport java.beans.PropertyVetoException;%0Aimport java.io.IOException;%0Aimport java.lang.reflect.UndeclaredThrowableException;%0Aimport java.sql.SQLException;%0A%0Aimport org.apache.log4j.Category;%0A%0Aimport org.exolab.castor.xml.MarshalException;%0Aimport org.exolab.castor.xml.ValidationException;%0A%0Aimport org.opennms.core.utils.ThreadCategory;%0A%0Aimport org.opennms.netmgt.config.DataSourceFactory;%0Aimport org.opennms.netmgt.config.LinkdConfigFactory;%0A%0Aimport org.opennms.netmgt.eventd.EventIpcManager;%0Aimport org.opennms.netmgt.eventd.EventIpcManagerFactory;%0A%0Aimport org.opennms.netmgt.linkd.DbEventWriter;%0A%0Apublic class Linkd implements LinkdMBean %7B%0A   public final static String LOG4J_CATEGORY = %22OpenNMS.Linkd%22;%0A%0A   public void init() %7B%0A%09   ThreadCategory.setPrefix(LOG4J_CATEGORY);%0A%09%09// Initialize the Capsd configuration factory.%0A%09%09//%0A%09%09try %7B%0A%09%09%09LinkdConfigFactory.init();%0A            DataSourceFactory.init();%0A%09%09%7D catch (ClassNotFoundException ex) %7B%0A%09%09%09log().error(%22init: Failed to load configuration file %22, ex);%0A%09%09%7D catch (MarshalException ex) %7B%0A%09%09%09log().error(%22Failed to load configuration%22, ex);%0A%09%09%09throw new UndeclaredThrowableException(ex);%0A%09%09%7D catch (ValidationException ex) %7B%0A%09%09%09log().error(%22Failed to load configuration%22, ex);%0A%09%09%09throw new UndeclaredThrowableException(ex);%0A%09%09%7D catch (IOException ex) %7B%0A%09%09%09log().error(%22Failed to load configuration%22, ex);%0A%09%09%09throw new UndeclaredThrowableException(ex);%0A%09    %7D catch (PropertyVetoException pve) %7B%0A%09        log().fatal(%22Property veto failure loading database config%22, pve);%0A%09        throw new UndeclaredThrowableException(pve);%0A%09    %7D catch (SQLException sqle) %7B%0A%09    %09log().fatal(%22SQL exception loading database config%22, sqle);%0A%09        throw new UndeclaredThrowableException(sqle);%0A%09    %7D%0A%0A%09    %0A%09    EventIpcManagerFactory.init();%0A        EventIpcManager mgr = EventIpcManagerFactory.getIpcManager();%0A        %0A        org.opennms.netmgt.linkd.Linkd linkd = getLinkd();%0A%0A        linkd.setEventMgr(mgr);%0A        linkd.setDbConnectionFactory(DataSourceFactory.getInstance());%0A        linkd.setLinkdConfig(LinkdConfigFactory.getInstance());%0A        linkd.setQueryManager(new DbEventWriter(DataSourceFactory.getDataSource()));%0A        %0A%09    linkd.init();%0A%09%7D%0A%09public void start() %7B%0A%09%09getLinkd().start();%0A%09%7D%0A%09public void stop() %7B%0A%09%09getLinkd().stop();%0A%09%7D%0A%09public int getStatus() %7B%0A%09%09return getLinkd().getStatus();%0A%09%7D%0A%09public String status() %7B%0A%09%09return org.opennms.core.fiber.Fiber.STATUS_NAMES%5BgetStatus()%5D;%0A%09%7D%0A%09public String getStatusText() %7B%0A%09%09return org.opennms.core.fiber.Fiber.STATUS_NAMES%5BgetStatus()%5D;%0A%09%7D%0A%0A%09private Category log() %7B%0A%09        return ThreadCategory.getInstance();%0A%09%7D%0A%09%0A%09private org.opennms.netmgt.linkd.Linkd getLinkd() %7B%0A%09        // Set the category prefix%0A%09        ThreadCategory.setPrefix(LOG4J_CATEGORY);%0A%0A%09        return org.opennms.netmgt.linkd.Linkd.getInstance();%0A%09%7D%0A%7D%0A%0A*/
 %0Aimp

Clean up of old commented out methods