org.crosswire.jsword.book.install
Class InstallManager

java.lang.Object
  extended by org.crosswire.jsword.book.install.InstallManager

public class InstallManager
extends Object

A manager to abstract out the non-view specific module installation tasks.

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 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.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: InstallManager.java,v 1.14 2005/02/15 04:32:34 dmsmith Exp $
Author:
Joe Walker [joe at eireneh dot com]
See Also:
Licence

Field Summary
private  Map factories
          The map of installer factories
private  Map installers
          The list of discovered installers
private static EventListenerList listeners
          The list of listeners
private static Logger log
          The log stream
 
Constructor Summary
InstallManager()
          Simple ctor
 
Method Summary
 void addInstaller(String name, Installer installer)
          Add an installer to our list of installers
 void addInstallerListener(InstallerListener li)
          Remove a BibleListener from our list of listeners
protected  void fireInstallersChanged(Object source, Installer installer, boolean added)
          Kick of an event sequence
 String getFactoryNameForInstaller(Installer installer)
          Find the registered name of the InstallerFactory that created the given installer.
 Installer getInstaller(String name)
          Find an installer by name
 InstallerFactory getInstallerFactory(String name)
          Find the InstallerFactory associated with the given name.
 Set getInstallerFactoryNames()
          The names of all the known InstallerFactories
 String getInstallerNameForInstaller(Installer installer)
          Find the registered name of the Installer.
 Map getInstallers()
          Accessor for the known installers
private  void internalAdd(String name, Installer installer)
          InstallManager is a Map, however we demand that both names and installers are unique (so we can lookup a name from an installer)
 void removeBooksListener(InstallerListener li)
          Add a BibleListener to our list of listeners
 void removeInstaller(String name)
          Remove an installer from our list
 void save()
          Save all properties to the user's local area.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factories

private Map factories
The map of installer factories


log

private static final Logger log
The log stream


installers

private Map installers
The list of discovered installers


listeners

private static EventListenerList listeners
The list of listeners

Constructor Detail

InstallManager

public InstallManager()
Simple ctor

Method Detail

save

public void save()
Save all properties to the user's local area. Uses the same property name so as to override it.


getInstallerFactoryNames

public Set getInstallerFactoryNames()
The names of all the known InstallerFactories


getFactoryNameForInstaller

public String getFactoryNameForInstaller(Installer installer)
Find the registered name of the InstallerFactory that created the given installer. There isn't a nice way to do this right now so we just do a trawl through all the known factories looking!


getInstallerNameForInstaller

public String getInstallerNameForInstaller(Installer installer)
Find the registered name of the Installer. There isn't a nice way to do this right now so we just do a trawl through all the known factories looking!


getInstallerFactory

public InstallerFactory getInstallerFactory(String name)
Find the InstallerFactory associated with the given name.

Parameters:
name - The InstallerFactory name to look-up
Returns:
The found InstallerFactory or null if the name was not found

getInstallers

public Map getInstallers()
Accessor for the known installers


getInstaller

public Installer getInstaller(String name)
Find an installer by name

Parameters:
name - The name of the installer to find
Returns:
The installer or null if none was found by the given name

addInstaller

public void addInstaller(String name,
                         Installer installer)
Add an installer to our list of installers

Parameters:
name - The name by which we reference the installer
installer - The installer to add

internalAdd

private void internalAdd(String name,
                         Installer installer)
InstallManager is a Map, however we demand that both names and installers are unique (so we can lookup a name from an installer)

Parameters:
name - The name of the new installer
installer - The installer to associate with the given name

removeInstaller

public void removeInstaller(String name)
Remove an installer from our list

Parameters:
name - The name by which this installer is referenced

addInstallerListener

public void addInstallerListener(InstallerListener li)
Remove a BibleListener from our list of listeners

Parameters:
li - The old listener

removeBooksListener

public void removeBooksListener(InstallerListener li)
Add a BibleListener to our list of listeners

Parameters:
li - The new listener

fireInstallersChanged

protected void fireInstallersChanged(Object source,
                                     Installer installer,
                                     boolean added)
Kick of an event sequence

Parameters:
source - The event source
installer - The meta-data of the changed Bible
added - Is it added?

Copyright ? 2003-2004