net.sf.magicproject.database
Class DatabaseFactory

java.lang.Object
  extended by net.sf.magicproject.database.DatabaseFactory

public final class DatabaseFactory
extends java.lang.Object

Since:
0.90
Author:
Fabrice Daugan

Field Summary
static java.awt.Image backImage
          The common back picture of the cards of the selected turn based system.
static java.awt.Image blankImage
          A blank blacked-image.
static java.awt.Image damageImage
          The picture representing a damage for the selected turn based system.
static java.awt.Image damageScaledImage
          The picture representing a damage for the selected turn based system.
static Proxy[] dataProxies
          The loaded proxy configurations.
static Proxy[] pictureProxies
          The loaded proxy configurations.
static java.util.Map<java.lang.String,PropertyConfig> propertiesCacheConfig
          Available properties of current TBS for databases.
static java.awt.image.BufferedImage scaledBackImage
          The common scaled back picture of the cards of the selected turn based system.
 
Method Summary
static DatabaseCard getDatabase(java.lang.String pictureName, CardModel cardModel, java.util.Map<java.lang.String,java.lang.String> constraints)
          Return the DatabaseCard object from the given card name.
static Proxy getProxy(java.lang.String proxyName)
          Return the proxy object giving it's name.
static void init(java.io.InputStream dbStream)
          Init property confgurations from the dbStream.
static void saveCache()
          Save the cache into the database XML file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pictureProxies

public static Proxy[] pictureProxies
The loaded proxy configurations. The order determine prioriries.


dataProxies

public static Proxy[] dataProxies
The loaded proxy configurations. The order determine prioriries.


blankImage

public static java.awt.Image blankImage
A blank blacked-image.


propertiesCacheConfig

public static java.util.Map<java.lang.String,PropertyConfig> propertiesCacheConfig
Available properties of current TBS for databases.


backImage

public static java.awt.Image backImage
The common back picture of the cards of the selected turn based system. Is null while this factory has not been initalized.

See Also:
init(InputStream)

scaledBackImage

public static java.awt.image.BufferedImage scaledBackImage
The common scaled back picture of the cards of the selected turn based system. Is null while this factory has not been initalized.


damageImage

public static java.awt.Image damageImage
The picture representing a damage for the selected turn based system. Is null while this factory has not been initalized.

See Also:
init(InputStream)

damageScaledImage

public static java.awt.Image damageScaledImage
The picture representing a damage for the selected turn based system. Is null while this factory has not been initalized.

See Also:
init(InputStream)
Method Detail

getProxy

public static Proxy getProxy(java.lang.String proxyName)
Return the proxy object giving it's name.null value is returned if the proxy has not been found or if the proxyName was null, empty, or no proxy were loaded (occurs in initComponent() method calls).

Parameters:
proxyName - the poxy's name
Returns:
the proxy object if found, null otherwise.

init

public static void init(java.io.InputStream dbStream)
                 throws java.io.IOException
Init property confgurations from the dbStream. Existing proxies are also initialized.

Parameters:
dbStream - the mdb file containing rules
Throws:
java.io.IOException - error during the database configuration.

saveCache

public static void saveCache()
Save the cache into the database XML file.


getDatabase

public static DatabaseCard getDatabase(java.lang.String pictureName,
                                       CardModel cardModel,
                                       java.util.Map<java.lang.String,java.lang.String> constraints)
Return the DatabaseCard object from the given card name. This object is build from the cache or the available proxies if cache is empty for this card. If there is no available proxy or if all all failed, the null value is returned. In case of success, the cache is updated and further proxy call would be done.

Parameters:
pictureName - the picture name associated to the database object. May be null to use the picture associated to the given card instead.
cardModel - the card name (no translated one)
constraints - constraints set {key,value}. May be null.
Returns:
the DatabaseCard object from the given card name.


Copyright © 2003-2007 Magic-Project. All Rights Reserved.