net.sf.magicproject.database
Class Proxy

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

public class Proxy
extends java.lang.Object

Since:
0.90
Author:
Fabrice Daugan , Stefano "Kismet" Lenzi

Field Summary
 java.util.List<net.sf.magicproject.database.PictureConfiguration> pictures
          The pictures configuration of this stream.
 
Constructor Summary
Proxy(java.io.File xmlFile)
          Create a new instance of this class.
 
Method Summary
 DatabaseCard getDatabaseFromStream(CardModel cardModel, java.util.Map<java.lang.String,java.lang.String> constraints)
          Create a new DatabaseCard from the given CardModel.
 java.lang.String getEncoding()
          Return the encoding of stream retrieved from the proxy URL.
 java.lang.String getGlobalValueFromLocal(java.lang.String nameSpace, java.lang.String localValue)
          Return the referenced value of this proxy.
 java.lang.String getHome()
          Return the proxy web site providing the data.
 java.lang.String getLanguage()
          Return the language of this proxy.
 java.util.List<java.lang.String> getLocalPictures(CardModel cardModel, java.util.Map<java.lang.String,TranslatableData> data)
          Return a list of local picture paths considering proxy, properties and the given card.
 java.lang.String getLocalValueFromGlobal(java.lang.String nameSpace, java.lang.String localValue)
          Return the referenced value of this proxy.
 java.lang.String getName()
          The proxy's name as displayed in the GUI menus
 java.util.List<java.lang.String> getRemotePictures(CardModel cardModel, java.util.Map<java.lang.String,TranslatableData> data)
          Return a list of remote picture paths considering proxy, properties and the given card.
 java.lang.String getXmlName()
          Return the XML name of this proxy.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pictures

public java.util.List<net.sf.magicproject.database.PictureConfiguration> pictures
The pictures configuration of this stream.

Constructor Detail

Proxy

public Proxy(java.io.File xmlFile)
      throws java.io.IOException,
             org.xml.sax.SAXException
Create a new instance of this class.

Parameters:
xmlFile - the definition file of this proxy.
Throws:
java.io.IOException - If some other I/O error occurs
org.xml.sax.SAXException - If some XML parse error occurs
Method Detail

getName

public java.lang.String getName()
The proxy's name as displayed in the GUI menus

Returns:
The proxy's name as displayed in the GUI menus

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getXmlName

public java.lang.String getXmlName()
Return the XML name of this proxy. The name corresponds to the XML file definition of this proxy

Returns:
the XML name of this proxy.

getDatabaseFromStream

public DatabaseCard getDatabaseFromStream(CardModel cardModel,
                                          java.util.Map<java.lang.String,java.lang.String> constraints)
                                   throws java.io.IOException
Create a new DatabaseCard from the given CardModel. The best stream is determinated depending the given constraints. The assocaited picture is also will be downloaded and loaded only during the first display of this picture.

Parameters:
cardModel - the object containing the card name.
constraints - set of constraints
Returns:
a new DatabaseCard from the given CardModel.
Throws:
java.io.IOException - If some other I/O error occurs

getEncoding

public java.lang.String getEncoding()
Return the encoding of stream retrieved from the proxy URL.
Unreferenced method, but called with reflection.

Returns:
the encoding of stream retrieved from the proxy URL.

getHome

public java.lang.String getHome()
Return the proxy web site providing the data. Is only here for information purpose.
Unreferenced method, but called with reflection.

Returns:
the proxy web site providing the data.

getLanguage

public java.lang.String getLanguage()
Return the language of this proxy.
Unreferenced method, but called with reflection.

Returns:
the language of this proxy.

getGlobalValueFromLocal

public java.lang.String getGlobalValueFromLocal(java.lang.String nameSpace,
                                                java.lang.String localValue)
Return the referenced value of this proxy. If this proxy do not define the namaed alias, return the given localValue.

Parameters:
nameSpace - the name space (property)
localValue - the private-proxy value
Returns:
the referenced value of this proxy.

getLocalValueFromGlobal

public java.lang.String getLocalValueFromGlobal(java.lang.String nameSpace,
                                                java.lang.String localValue)
Return the referenced value of this proxy. If this proxy do not define the namaed alias, return the given localValue.

Parameters:
nameSpace -
localValue -
Returns:
the referenced value of this proxy.

getRemotePictures

public java.util.List<java.lang.String> getRemotePictures(CardModel cardModel,
                                                          java.util.Map<java.lang.String,TranslatableData> data)
Return a list of remote picture paths considering proxy, properties and the given card. The returned order corresponds to the priority.

Parameters:
cardModel - the card model.
data - the translated data.
Returns:
a list of remote picture paths.

getLocalPictures

public java.util.List<java.lang.String> getLocalPictures(CardModel cardModel,
                                                         java.util.Map<java.lang.String,TranslatableData> data)
Return a list of local picture paths considering proxy, properties and the given card. The returned order corresponds to the priority.

Parameters:
cardModel - the card model.
data - the translated data.
Returns:
a list of local picture paths.


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