/*
* Gamers Own Instant Messenger
* Copyright (C) 2005-2006 Herbert Poul (kahless@sphene.net)
* http://goim.sphene.net
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package net.sphene.goim.components.stats;
import galena.addins.modules.database.DB;
import galena.message.Message;
import net.sphene.galena.addins.AddinImplementationDefinition;
import net.sphene.galena.addins.AddinInterfaceDefinition;
import net.sphene.galena.addins.GalenaViewAddin;
import net.sphene.goim.components.ExternalComponentManagerAddin;
@AddinInterfaceDefinition(
defaultcommandprefix = "jabberexternal stats",
internalUseOnly = true
)
@AddinImplementationDefinition(
author = "Herbert Poul",
requirements = { "net.sphene.goim.components.ExternalComponentManagerAddin","galena.addins.modules.database.PgSQL" }
)
public class StatsAddin extends GalenaViewAddin {
int port = -1;
private DB db;
@SuppressWarnings("unused")
private StatsComponent statsComponent;
@Override
public void init(Object[] requirements) {
this.db = (DB)requirements[1];
ExternalComponentManagerAddin manager = (ExternalComponentManagerAddin)requirements[0];
if(port < 0)
manager.addComponent(StatsComponent.SUBDOMAIN,null,statsComponent = new StatsComponent(manager,db,this));
else
manager.addComponent(StatsComponent.SUBDOMAIN,null,statsComponent = new StatsComponent(manager,db,this),port);
}
@Override
public void beforeInit(Message msg) {
super.beforeInit(msg);
if(msg.getOption("port") != null) port = Integer.parseInt(msg.getOption("port"));
}
}