|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ks.client.gamefactory.PluginFactory
This class is responsible for instantiating objects from the Jar files that store plugins on the client side.
Each plugin is stored in a jar file with the name "author_Game.jar", and this factory will extract the class of package "author.Game" from within this Jar file and instantiate it. Note: author.Game must be a subclass of the Solitaire class.
The loadPluginList(String dir)
will load up a list of local
plugins that have already been registered with the indexFile in the given
directory. registerPlugin (String dir, String jarName)
verifies that that given jarName is a valid Solitaire plugin and then appends
the plugin to the index file.
instantiatePlugin(String dir, String plugin)
will attempt to
instantiate the given plugin for play.
appendPluginList(String dir, String
jarName)
and
removePluginList(String dir, String jarName)
update the index
file accordingly.
The Format of the index file is:
jarName:jarName:entry
where entry is any string needed to be stored with the plugin file.
Creation date: (12/8/01 12:04:58 AM)
Field Summary | |
protected java.util.Hashtable |
knownPlugins
The known plugins. |
Constructor Summary | |
PluginFactory(ILoader loader)
Direct PluginFactory to use given Loader for loading Jar files. |
Method Summary | |
boolean |
appendPluginList(java.lang.String directory,
java.lang.String entry)
Append entry to end of Plugin Index. |
java.lang.String |
getEntry(java.lang.String directory,
java.lang.String name)
Returns entry for the given plugin. |
Solitaire |
instantiatePlugin(java.lang.String directory,
java.lang.String solitaireName)
Instantiate the given plugin, or return null if not found. |
boolean |
loadPluginList(java.lang.String directory)
Load list of initial Plugins available on client. |
java.util.Enumeration |
plugins(java.lang.String directory)
Returns Enumeration of Strings for local Plugins. |
boolean |
registerPlugin(java.lang.String directory,
java.lang.String solitaireName)
Register with PluginFactory that the given plugin is now available. |
boolean |
removePluginList(java.lang.String directory,
java.lang.String pluginName)
Remove plugin with given name from client repository. |
boolean |
setEntry(java.lang.String directory,
java.lang.String name,
java.lang.String entry)
Set entry for the given plugin. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Hashtable knownPlugins
Constructor Detail |
public PluginFactory(ILoader loader)
loader
- Method Detail |
public boolean appendPluginList(java.lang.String directory, java.lang.String entry)
Within the directory is a file named IClientPluginManager.indexFile, whose format is described in the IClientPluginManager class. Based upon information from this file, this method appends a new entry to the file.
Creation date: (12/8/01 12:15:17 AM)
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]entry
- java.lang.String the EXACT entry (perfect formatting) to be
appended.
public java.lang.String getEntry(java.lang.String directory, java.lang.String name)
The parameter "name" refers to the JarFile resident on the client's computer, and it must be of the form "user_Game.jar"; this method attempts to add a String entry to the plugin.idx file.
This method is called by the ClientPluginManager who may need to retrieve additional information with each plugin. If no entry exists, then "" is returned.
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]
public Solitaire instantiatePlugin(java.lang.String directory, java.lang.String solitaireName)
The parameter "name" refers to the JarFile resident on the client's computer, and it must be of the form "user_Game.jar"; this method attempts to instantiate an object of class "user.Game".
Creation date: (12/8/01 12:15:17 AM)
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]solitaireName
- java.lang.String name of solitaire plugin [user_Game.jar]
public boolean loadPluginList(java.lang.String directory)
Within the directory is a file named IClientPluginManager.indexFile, whose format is described in the IClientPluginManager class. Based upon information from this file, this method loads up the set of available plug ins.
NOTE: An instance is only created when asked.
This method is called when client is initialized.
Creation date: (12/8/01 12:15:17 AM)
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]
public java.util.Enumeration plugins(java.lang.String directory)
This method first invokes loadPluginList() to ensure accurate information Creation date: (12/8/01 12:15:17 AM)
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]
public boolean registerPlugin(java.lang.String directory, java.lang.String solitaireName)
The parameter "name" refers to the JarFile resident on the client's computer, and it must be of the form "user_Game.jar"; this method attempts to instantiate an object of class "user.Game".
This method is called by the ClientPluginManager upon successful download of the .jar file from the server.
Creation date: (12/8/01 12:15:17 AM)
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]solitaireName
- java.lang.String name of solitaire plugin [user_Game.jar]
public boolean removePluginList(java.lang.String directory, java.lang.String pluginName)
Within the directory is a file named IClientPluginManager.indexFile, whose format is described in the IClientPluginManager class. Based upon information from this file, this method removes the entry with the given name AND deletes the JAR file
NOTE: An instance is only created when asked.
This method is called when client is initialized.
Creation date: (12/8/01 12:15:17 AM)
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]pluginName
- java.lang.String name of plug in [user_Game.jar]
public boolean setEntry(java.lang.String directory, java.lang.String name, java.lang.String entry)
The parameter "name" refers to the JarFile resident on the client's computer, and it must be of the form "user_Game.jar"; this method attempts to add a String entry to the plugin.idx file.
This method is called by the ClientPluginManager who may need to store additional information with each plugin.
directory
- java.lang.String where jar files are stored [NO SLASHES IN
NAME]
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |