org.alliance.core
Class CoreSubsystem

java.lang.Object
  extended by org.alliance.core.CoreSubsystem
All Implemented Interfaces:
Subsystem

public class CoreSubsystem
extends java.lang.Object
implements Subsystem

This is the core of the entire Alliance system. Theres not too much code here, it's more of a hub for the entire Core subsystem. Has a instance of FriendManager, FileManager, NetworkManager, InvitatationManager and the UICallback.

This class contains the oh-so-important invokeLater method that HAS to be used when code in the Core subsystem need to be run from another thread than the Core thread. Very much like SwingUtilities.invokeLater().

There's also a que of NeedsUserInteractions. This is an interface that is used when something happens in the Core subsystem that the user need to interact to. Examples are: chat message received, invitation code received etc.. These things are queued by the Core subsystem and fethed by the UI subsystem Created by IntelliJ IDEA. User: maciek Date: 2005-dec-30 Time: 16:38:25


Field Summary
static boolean ALLOW_TO_SEND_UPGRADE_TO_FRIENDS
           
static int BLOCK_SIZE
           
static java.lang.String ERROR_URL
           
static long GB
           
static int KB
           
static int MB
           
(package private)  java.util.ArrayList<NeedsUserInteraction> userInternactionQue
           
 
Constructor Summary
CoreSubsystem()
           
 
Method Summary
 NeedsUserInteraction fetchUserInteraction()
           
 FileManager getFileManager()
           
 FriendManager getFriendManager()
           
 InvitaitonManager getInvitaitonManager()
           
 NetworkManager getNetworkManager()
           
 com.stendahls.resourceloader.ResourceLoader getRl()
           
 Settings getSettings()
           
 ShareManager getShareManager()
           
 UICallback getUICallback()
           
 void increaseGULCounter()
          Temporary stuff needed to figure out a serious bug.
 void init(com.stendahls.resourceloader.ResourceLoader rl, java.lang.Object... params)
           
 void invokeLater(java.lang.Runnable runnable)
          The core package is not thread safe.
 void loadState()
           
 void logError(java.lang.Object error)
           
 void logTrace(int level, java.lang.Object message)
           
 void propagateTraceMessage(int level, java.lang.String message, java.lang.Exception e)
           
 void queNeedsUserInteraction(NeedsUserInteraction ui)
           
 void refreshFriendInfo()
           
 void reportError(java.lang.Throwable e, java.lang.Object source)
           
 void restartProgram(boolean openWithUI)
           
 void saveSettings()
           
 void saveState()
           
 void setUiCallback(UICallback uiCallback)
           
 void shutdown()
           
 void softRestart()
           
 void uiToFront()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_TO_SEND_UPGRADE_TO_FRIENDS

public static final boolean ALLOW_TO_SEND_UPGRADE_TO_FRIENDS
See Also:
Constant Field Values

KB

public static final int KB
See Also:
Constant Field Values

MB

public static final int MB
See Also:
Constant Field Values

GB

public static final long GB
See Also:
Constant Field Values

BLOCK_SIZE

public static final int BLOCK_SIZE
See Also:
Constant Field Values

ERROR_URL

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

userInternactionQue

java.util.ArrayList<NeedsUserInteraction> userInternactionQue
Constructor Detail

CoreSubsystem

public CoreSubsystem()
Method Detail

init

public void init(com.stendahls.resourceloader.ResourceLoader rl,
                 java.lang.Object... params)
          throws java.lang.Exception
Specified by:
init in interface Subsystem
Throws:
java.lang.Exception

logTrace

public void logTrace(int level,
                     java.lang.Object message)

logError

public void logError(java.lang.Object error)

saveState

public void saveState()
               throws java.io.IOException
Throws:
java.io.IOException

loadState

public void loadState()
               throws java.lang.Exception
Throws:
java.lang.Exception

saveSettings

public void saveSettings()
                  throws java.lang.Exception
Throws:
java.lang.Exception

getRl

public com.stendahls.resourceloader.ResourceLoader getRl()

getFriendManager

public FriendManager getFriendManager()

shutdown

public void shutdown()
Specified by:
shutdown in interface Subsystem

getSettings

public Settings getSettings()

getShareManager

public ShareManager getShareManager()

getNetworkManager

public NetworkManager getNetworkManager()

propagateTraceMessage

public void propagateTraceMessage(int level,
                                  java.lang.String message,
                                  java.lang.Exception e)

getUICallback

public UICallback getUICallback()

setUiCallback

public void setUiCallback(UICallback uiCallback)

getFileManager

public FileManager getFileManager()

invokeLater

public void invokeLater(java.lang.Runnable runnable)
The core package is not thread safe. It all runs in one thread. If another threads want to invoke something in core it should use this method. Same design pattern as SwingUtilities.invokeLater

Parameters:
runnable -

reportError

public void reportError(java.lang.Throwable e,
                        java.lang.Object source)

restartProgram

public void restartProgram(boolean openWithUI)
                    throws java.io.IOException
Throws:
java.io.IOException

uiToFront

public void uiToFront()

getInvitaitonManager

public InvitaitonManager getInvitaitonManager()

queNeedsUserInteraction

public void queNeedsUserInteraction(NeedsUserInteraction ui)

fetchUserInteraction

public NeedsUserInteraction fetchUserInteraction()

refreshFriendInfo

public void refreshFriendInfo()
                       throws java.io.IOException
Throws:
java.io.IOException

softRestart

public void softRestart()
                 throws java.io.IOException
Throws:
java.io.IOException

increaseGULCounter

public void increaseGULCounter()
Temporary stuff needed to figure out a serious bug.