games.strategy.engine.random
Class PropertiesDiceRoller

java.lang.Object
  extended by games.strategy.engine.random.PropertiesDiceRoller
All Implemented Interfaces:
IRemoteDiceServer

public class PropertiesDiceRoller
extends java.lang.Object
implements IRemoteDiceServer

A pbem dice roller that reads its configuration from a properties file

Author:
sgb

Constructor Summary
PropertiesDiceRoller(java.util.Properties props)
           
 
Method Summary
 int[] getDice(java.lang.String string, int count)
          Given the html page returned from postRequest, return the dice [] throw an InvocationTargetException to indicate an error message to be returned
 java.lang.String getName()
          Get the display name for this dice server
 java.lang.String getWebText()
           
 java.lang.String postRequest(java.lang.String player1, java.lang.String player2, int max, int numDice, java.lang.String text, java.lang.String gameID, java.lang.String gameUUID)
          Post a request to the dice server, and return the resulting html page as a string
 boolean sendsEmail()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertiesDiceRoller

public PropertiesDiceRoller(java.util.Properties props)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: IRemoteDiceServer
Get the display name for this dice server

Specified by:
getName in interface IRemoteDiceServer

toString

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

sendsEmail

public boolean sendsEmail()

postRequest

public java.lang.String postRequest(java.lang.String player1,
                                    java.lang.String player2,
                                    int max,
                                    int numDice,
                                    java.lang.String text,
                                    java.lang.String gameID,
                                    java.lang.String gameUUID)
                             throws java.io.IOException
Description copied from interface: IRemoteDiceServer
Post a request to the dice server, and return the resulting html page as a string

Specified by:
postRequest in interface IRemoteDiceServer
Throws:
java.io.IOException

getWebText

public java.lang.String getWebText()

getDice

public int[] getDice(java.lang.String string,
                     int count)
              throws java.io.IOException,
                     java.lang.reflect.InvocationTargetException
Description copied from interface: IRemoteDiceServer
Given the html page returned from postRequest, return the dice [] throw an InvocationTargetException to indicate an error message to be returned

Specified by:
getDice in interface IRemoteDiceServer
Throws:
java.io.IOException - if there was an error parsing the string
java.lang.reflect.InvocationTargetException