FreewayPlugin.java
| Index Score | ||
|---|---|---|
![]() |
![]() |
org.xnap.plugin.freeway |
![]() |
![]() |
XNap 3 |
View: Reasons, Metrics, Source Code
These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.
| Metric | Description | |
|---|---|---|
/*
* XNap - A P2P framework and client.
*
* See the file AUTHORS for copyright information.
*
* 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.
*
* 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
*/
package org.xnap.plugin.freeway;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.security.Security;
import java.util.logging.Level;
import javax.swing.Icon;
import org.apache.log4j.Logger;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.gnu.freeway.Application;
import org.gnu.freeway.DaemonSocket;
import org.gnu.freeway.Prefs;
import org.gnu.freeway.protocol.afs.esed2.NNode;
import org.gnu.freeway.protocol.afs.esed2.Policy;
import org.gnu.freeway.protocol.afs.swing.SController;
import org.gnu.freeway.util.ConfigurationService;
import org.gnu.freeway.util.LoggingService;
import org.gnu.freeway.util.Service;
import org.gnu.freeway.util.ServiceManager;
import org.gnu.freeway.util.StarFormatter;
import org.gnu.freeway.util.ui.UIResources;
import org.xnap.XNap;
import org.xnap.gui.Dialogs;
import org.xnap.gui.XNapFrame;
import org.xnap.gui.util.IconHelper;
import org.xnap.plugin.AbstractPlugin;
import org.xnap.search.MediaType;
import org.xnap.search.Search;
import org.xnap.search.SearchFilter;
import org.xnap.search.SearchManager;
import org.xnap.search.SearchProvider;
/**
*
*
*/
public class FreewayPlugin extends AbstractPlugin
implements SController, SearchProvider
{
private static FreewayPlugin instance = null;
private ConfigurationService config;
private UIResources resources;
private ServiceManager services;
private Prefs preferences;
private Policy policy;
private static Logger logger = Logger.getLogger(FreewayPlugin.class);
public static final String ICON_FILENAME = "emacs.png";
public static final Icon ICON_16 = IconHelper.getIcon(ICON_FILENAME, 16, false);
private FreewayPanel freewayPanel;
public static FreewayPlugin getInstance()
{
return instance;
}
/*
* @see org.gnu.freeway.util.ui.Controller#getApplication()
*/
public Application getApplication()
{
// TODO Auto-generated method stub
return null;
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#getCache()
*/
public File getCache()
{
return preferences.getSystemCache();
}
public String getName()
{
return getInfo().getName();
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#getPolicy()
*/
public Policy getPolicy()
{
return policy;
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#getPreferences()
*/
public Prefs getPreferences()
{
return preferences;
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#getResources()
*/
public UIResources getResources()
{
return resources;
}
/*
* @see org.xnap.search.SearchProvider#getSupportedMediaTypes()
*/
public MediaType[] getSupportedMediaTypes()
{
return new MediaType[] { SearchManager.MEDIA_ANYTHING };
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#addPropertyChangeListener(java.beans.PropertyChangeListener)
*/
public void addPropertyChangeListener(PropertyChangeListener arg0)
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
*/
public void addPropertyChangeListener(String arg0,
PropertyChangeListener arg1)
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#connect()
*/
public DaemonSocket connect()
{
// TODO Auto-generated method stub
return null;
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#displayDirectory(java.lang.String, org.gnu.freeway.protocol.afs.esed2.NNode)
*/
public void displayDirectory(String arg0, NNode arg1)
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#download(org.gnu.freeway.protocol.afs.esed2.NNode)
*/
public void download(NNode arg0)
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#enterCritical()
*/
public void enterCritical()
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#err(java.lang.String, java.lang.Throwable)
*/
public void err(String arg0, Throwable arg1)
{
logger.error(arg0, arg1);
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#guiMessage(java.lang.String)
*/
public void guiMessage(String arg0)
{
Dialogs.showNotification(XNapFrame.getInstance(), "freewayNotification",
XNap.tr("XNap GNUnet notification"), arg0);
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#infoMessage(boolean, java.lang.String)
*/
public void infoMessage(boolean arg0, String arg1)
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#leaveCritical()
*/
public void leaveCritical()
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#log(java.util.logging.Level, java.lang.String)
*/
public void log(Level arg0, String arg1) {}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#refreshMenus()
*/
public void refreshMenus()
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#removePropertyChangeListener(java.beans.PropertyChangeListener)
*/
public void removePropertyChangeListener(PropertyChangeListener arg0)
{
// TODO Auto-generated method stub
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
*/
public void removePropertyChangeListener(String arg0,
PropertyChangeListener arg1)
{
// TODO Auto-generated method stub
}
/*
* @see org.xnap.search.SearchProvider#search(org.xnap.search.SearchFilter)
*/
public Search search(SearchFilter filter)
{
return new FreewaySearch(filter, this);
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#service(java.lang.Class)
*/
public Service service(Class c)
{
return services.service(c);
}
/*
* @see org.gnu.freeway.protocol.afs.swing.SController#showStats()
*/
public void showStats()
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.xnap.plugin.Plugin#start()
*/
public void start() throws Exception
{
instance = this;
try {
Security.insertProviderAt(new BouncyCastleProvider(), 0);
}
catch (SecurityException se) {
logger.error("Could not add Provider");
}
LoggingService.configureLoggingToConsole(new StarFormatter());
Prefs.ensureInitialized();
services = ServiceManager.getInstance();
services.start();
preferences = new Prefs();
config = (ConfigurationService)service(ConfigurationService.class);
config.readConfiguration(preferences);
resources = new UIResources("main.xml", getCache());
resources.setGlobalTarget(this);
policy = new Policy(config, preferences);
policy.initAnonymityPolicy(null);
SearchManager.getInstance().add(this);
}
/* (non-Javadoc)
* @see org.xnap.plugin.Plugin#startGUI()
*/
public void startGUI()
{
freewayPanel = new FreewayPanel(this);
XNapFrame.getInstance().insertTab
(getInfo().getName(), IconHelper.getListIcon(ICON_FILENAME),
freewayPanel);
}
/* (non-Javadoc)
* @see org.xnap.plugin.Plugin#stop()
*/
public void stop()
{
policy.doneAnonymityPolicy();
services.stop();
SearchManager.getInstance().remove(this);
}
/* (non-Javadoc)
* @see org.xnap.plugin.Plugin#stopGUI()
*/
public void stopGUI()
{
XNapFrame.getInstance().removeTab(freewayPanel);
freewayPanel = null;
}
}
The table below shows all metrics for FreewayPlugin.java.
| Metric | Value | Description | |
|---|---|---|---|



