package javazoom.Util;
import java.io.*;
import java.util.*;
/**
* This class implements Config feature.
*
* @author E.B from JavaZOOM
*
* Homepage : http://www.javazoom.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., 675 Mass Ave, Cambridge, MA 02139, USA.
*----------------------------------------------------------------------
*/
/**
* This class provides all parameters for jlGui coming from a file.
*/
public class Config
{
private static Config _instance = null;
private String _lastUrl = "http://66.9.50.199:8000/";
private String _defaultSkin = "skins/baseskin.wsz";
private String _playlist = "javazoom.jlGui.playlist.BasePlaylist";
private String _playlistFilename = "default.m3u";
private String _proxyServer = null;
private String _proxyLogin = null;
private String _proxyPassword = null;
private int _proxyPort = -1;
private Config()
{}
/**
* Returns Config instance.
*/
public synchronized static Config getInstance()
{
if (_instance == null)
{
_instance = new Config();
}
return _instance;
}
/**
* Returns playlist filename.
*/
public String getPlaylistFilename()
{
return _playlistFilename;
}
/**
* Returns last URL.
*/
public String getLastURL()
{
return _lastUrl;
}
/**
* Returns proxy server.
*/
public String getProxyServer()
{
return _proxyServer;
}
/**
* Returns proxy port.
*/
public int getProxyPort()
{
return _proxyPort;
}
/**
* Sets last URL.
*/
public void setLastURL(String url)
{
_lastUrl = url;
}
/**
* Sets Proxy info.
*/
public void setProxy(String url, int port, String login, String password)
{
_proxyServer = url;
_proxyPort = port;
_proxyLogin = login;
_proxyPassword = password;
}
/**
* Enables Proxy.
*/
public boolean enableProxy()
{
if ((_proxyServer != null) && (!_proxyServer.equals("")))
{
System.getProperties().put( "proxySet", "true" );
System.getProperties().put( "proxyHost", _proxyServer );
System.getProperties().put( "proxyPort", ""+_proxyPort );
return true;
}
else return false;
}
/**
* Returns default skin.
*/
public String getDefaultSkin()
{
return _defaultSkin;
}
/**
* Returns default skin.
*/
public String getPlaylistClassName()
{
return _playlist;
}
}