jondo
Class Controller

java.lang.Object
  extended by jondo.Controller

public class Controller
extends java.lang.Object

The Controller is the central interface for controlling the JonDonym software. It can be used stand-alone in your own Java application. jondo.console.JonDoConsole is a reference implementation for using the Controller interface.

FOR DEVELOPERS OF THE CONTROLLER ITSELF: If you change the Controller methods, keep in mind that no references to anonlib classes (anon.*) are allowed for the Controller interface. These references should be hidden from a user of the Controller, so that changes inside the anonlib do not affect external development projects. For the same reason, you should not change existing Controller methods if there is not clear benefit. (you might keep the old method, and declare it as deprecated).

The only exceptions for Controller interface references to the anonlib are:

But remember: also these references should only be exceptions. Do not use these references in the Controller interface if they are not absolutely needed for implementing a good code structure. Create wrapper classes around anonlib objects wherever possible. TODO documentation

Author:
Rolf Wendolsky

Nested Class Summary
static class Controller.EnumAnonymousProxyConnection
           
static class Controller.ForcePremiumIfAccountAvailableAttribute
           
 
Field Summary
static java.lang.String VERSION
           
static java.lang.String XML_ELEMENT_NAME
           
 
Constructor Summary
Controller()
           
 
Method Summary
static boolean activateCoupon(java.lang.String a_code)
          Call this method always before validation of the coupon code with "null" as argument.
static boolean addToBlacklist(MixServiceInfo a_cascade)
           
static boolean areServicesAutoSwitched()
           
static boolean changeAccountPassword(char[] a_oldPassword, char[] a_newPassword)
           
static boolean createCustomService(java.lang.String a_customServiceHost, int a_customServicePort)
           
static void deleteAccount(PremiumAccount a_account)
           
static void enableHTTPFilter(boolean a_bEnable)
           
static java.lang.String exportAccounts()
           
static org.w3c.dom.Element exportAccounts(org.w3c.dom.Document a_doc)
           
static void exportAccounts(java.io.File a_file)
           
static java.util.Vector<PremiumAccount> getAccounts()
           
static PremiumAccount getActiveAccount()
           
static PaymentInstance getActivePaymentInstance()
           
static java.util.Vector<MixServiceInfo> getAvailableServices()
           
static java.util.Vector<MixServiceInfo> getAvailableServices(MixServiceFilter a_filter)
           
static long getCurrentCredit()
          Returns the current credit in bytes.
static MixServiceInfo getCurrentService()
           
static MixServiceFilter getCurrentServiceFilter()
           
static MixServiceInfo getDummyService()
           
static IForwardingServerStatistics getForwardingServerStatistics()
           
static long getInactiveAccountsCurrentCredit()
           
static Controller.EnumAnonymousProxyConnection getInfoServiceAnonymousProxyConnecion()
           
static java.net.InetAddress getListenerAddress()
           
static int getListenerPort()
           
static java.util.Locale getLocale()
           
static Logger getLogger()
           
static Controller.EnumAnonymousProxyConnection getPaymentAnonymousProxyConnecion()
           
static java.util.Vector<PaymentInstance> getPaymentInstances()
           
static java.util.Vector<MixServiceFilter> getServiceFilters()
           
static java.util.Vector<MixServiceInfo> getServices()
           
static boolean haveAccounts()
           
static boolean importAccounts(java.io.File a_accountFile)
           
static boolean importAccounts(java.lang.String a_accountData)
           
static void init(logging.ILog a_logger, IConfiguration a_configuration)
           
static void init(org.apache.log4j.Logger a_logger, IConfiguration a_configuration)
           
static boolean isConnected()
           
static boolean isHTTPFilterEnabled()
           
static boolean isInitialized()
           
static boolean isRunning()
           
static boolean reloadDataFromInfoService()
           
static boolean removeFromBlacklist(MixServiceInfo a_cascade)
           
static void setActiveAccount(PremiumAccount a_account)
           
static void setActivePaymentInstance(PaymentInstance a_pi)
           
static void setConfigurationListener(IConfigurationListener a_listener)
           
static void setForwardingListener(IForwardingListener a_listener)
           
static void setInfoServiceAnonymousProxyConnecion(Controller.EnumAnonymousProxyConnection a_iAnonymousProxyConnection)
           
static void setLocale(java.util.Locale a_locale)
           
static void setPaymentAnonymousProxyConnecion(Controller.EnumAnonymousProxyConnection a_iAnonymousProxyConnection)
           
static void setPaymentListener(IPaymentEventListener a_eventListener)
           
static void setServiceFilter(MixServiceFilter a_filter)
           
static void setServiceListener(IServiceEventListener a_listener)
           
static void setServicesAutoSwitched(boolean a_bAutoSwitch)
           
static boolean shouldRecharge()
          Returns whether the user should recharge.
static boolean start()
           
static void stop()
           
static void stop(boolean a_bBlocking)
           
static void switchService()
           
static void switchService(MixServiceInfo a_cascade)
           
static boolean validateCoupon(java.lang.String a_code)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

XML_ELEMENT_NAME

public static final java.lang.String XML_ELEMENT_NAME
See Also:
Constant Field Values
Constructor Detail

Controller

public Controller()
Method Detail

isInitialized

public static boolean isInitialized()

init

public static void init(org.apache.log4j.Logger a_logger,
                        IConfiguration a_configuration)
                 throws java.lang.Exception
Throws:
java.lang.Exception

init

public static void init(logging.ILog a_logger,
                        IConfiguration a_configuration)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getListenerAddress

public static java.net.InetAddress getListenerAddress()

getListenerPort

public static int getListenerPort()

changeAccountPassword

public static boolean changeAccountPassword(char[] a_oldPassword,
                                            char[] a_newPassword)

getLogger

public static Logger getLogger()

setLocale

public static void setLocale(java.util.Locale a_locale)

getLocale

public static java.util.Locale getLocale()

setPaymentAnonymousProxyConnecion

public static void setPaymentAnonymousProxyConnecion(Controller.EnumAnonymousProxyConnection a_iAnonymousProxyConnection)

getPaymentAnonymousProxyConnecion

public static Controller.EnumAnonymousProxyConnection getPaymentAnonymousProxyConnecion()

setForwardingListener

public static void setForwardingListener(IForwardingListener a_listener)

setPaymentListener

public static void setPaymentListener(IPaymentEventListener a_eventListener)

setConfigurationListener

public static void setConfigurationListener(IConfigurationListener a_listener)

setServiceListener

public static void setServiceListener(IServiceEventListener a_listener)

setInfoServiceAnonymousProxyConnecion

public static void setInfoServiceAnonymousProxyConnecion(Controller.EnumAnonymousProxyConnection a_iAnonymousProxyConnection)

getInfoServiceAnonymousProxyConnecion

public static Controller.EnumAnonymousProxyConnection getInfoServiceAnonymousProxyConnecion()

stop

public static void stop(boolean a_bBlocking)

stop

public static void stop()

setServiceFilter

public static void setServiceFilter(MixServiceFilter a_filter)

getCurrentServiceFilter

public static MixServiceFilter getCurrentServiceFilter()

getServiceFilters

public static java.util.Vector<MixServiceFilter> getServiceFilters()

switchService

public static void switchService()

switchService

public static void switchService(MixServiceInfo a_cascade)

setServicesAutoSwitched

public static void setServicesAutoSwitched(boolean a_bAutoSwitch)

getForwardingServerStatistics

public static IForwardingServerStatistics getForwardingServerStatistics()

removeFromBlacklist

public static boolean removeFromBlacklist(MixServiceInfo a_cascade)

addToBlacklist

public static boolean addToBlacklist(MixServiceInfo a_cascade)

areServicesAutoSwitched

public static boolean areServicesAutoSwitched()

getServices

public static java.util.Vector<MixServiceInfo> getServices()

getAvailableServices

public static java.util.Vector<MixServiceInfo> getAvailableServices()

getAvailableServices

public static java.util.Vector<MixServiceInfo> getAvailableServices(MixServiceFilter a_filter)

getActiveAccount

public static PremiumAccount getActiveAccount()

getDummyService

public static MixServiceInfo getDummyService()

getCurrentService

public static MixServiceInfo getCurrentService()

isRunning

public static boolean isRunning()

isConnected

public static boolean isConnected()

enableHTTPFilter

public static void enableHTTPFilter(boolean a_bEnable)

isHTTPFilterEnabled

public static boolean isHTTPFilterEnabled()

getPaymentInstances

public static java.util.Vector<PaymentInstance> getPaymentInstances()

getActivePaymentInstance

public static PaymentInstance getActivePaymentInstance()

setActivePaymentInstance

public static void setActivePaymentInstance(PaymentInstance a_pi)

validateCoupon

public static boolean validateCoupon(java.lang.String a_code)
                              throws java.lang.Exception
Parameters:
a_code -
Returns:
Throws:
java.lang.Exception - if the account could not be created

shouldRecharge

public static boolean shouldRecharge()
Returns whether the user should recharge.

Returns:
whether the user should recharge

getCurrentCredit

public static long getCurrentCredit()
Returns the current credit in bytes.

Returns:

getInactiveAccountsCurrentCredit

public static long getInactiveAccountsCurrentCredit()

activateCoupon

public static boolean activateCoupon(java.lang.String a_code)
                              throws java.lang.Exception
Call this method always before validation of the coupon code with "null" as argument. Then execute validateCoupon until the user gives up or the coupon code works. Then you may call this method again. If it succeeds, no further validation is needed, as the account has been activated successfully.

Parameters:
a_code -
Returns:
Throws:
java.lang.Exception

reloadDataFromInfoService

public static boolean reloadDataFromInfoService()

deleteAccount

public static void deleteAccount(PremiumAccount a_account)

setActiveAccount

public static void setActiveAccount(PremiumAccount a_account)

haveAccounts

public static boolean haveAccounts()

getAccounts

public static java.util.Vector<PremiumAccount> getAccounts()

exportAccounts

public static org.w3c.dom.Element exportAccounts(org.w3c.dom.Document a_doc)

exportAccounts

public static void exportAccounts(java.io.File a_file)
                           throws java.io.IOException
Throws:
java.io.IOException

exportAccounts

public static java.lang.String exportAccounts()

importAccounts

public static boolean importAccounts(java.io.File a_accountFile)

importAccounts

public static boolean importAccounts(java.lang.String a_accountData)

createCustomService

public static boolean createCustomService(java.lang.String a_customServiceHost,
                                          int a_customServicePort)

start

public static boolean start()