de.jadv.server.manager
Class ObjectManager

java.lang.Object
  |
  +--de.jadv.server.manager.ObjectManager

public class ObjectManager
extends java.lang.Object

This is the manager of all GameObjects!

Author:
neitzel

Field Summary
private  SavedObject _AUTOSTART
           
private  java.util.LinkedList _ChangedObjects
           
private  java.lang.ClassLoader _classloader
           
private  DatabaseManager _DM
           
private  SavedObject _FIRST
           
private  long _higestID
           
private  SavedObject _LAST
           
private  java.util.Collection _races
           
private  java.util.HashMap _StoredObjects
           
 
Constructor Summary
ObjectManager()
           
 
Method Summary
 void addAutoStart(java.lang.String id)
          Add an object to the AutoStart-Object!
 void changedObject(SavedObject obj)
          changedObject(obj) Mark an Object as changed
 void checkForRace(java.lang.String id)
          Adds the race to the list of races if id is a race!
 void checkMemory()
          checkMemory() Print some information about available Memory
 void debugList()
          debugList() Prints all available Objects - Is really really long when some objects exists!
 void delAutoStart(java.lang.String id)
          Delete an object from the AutoStart-Object!
 void destroyObject(SavedObject obj)
          destroyObject(obj) An Object out of the game should be deleted
 SavedObject getObject(java.lang.String id)
          getObject(id) Get an Object from it's id.
 java.util.Collection getRaces()
          Get the available Races
 void initialize()
          initialize Initializes everything.
 void removeObjectFromList(SavedObject obj)
          removeObjectFromList(obj) Remove the given object from the main double-linked list
 void save(SavedObject obj)
          save(obj) Save the given SavedObject inside the database.
 void saveChanged()
          saveChanged() Save all changed Objects
 void shutdown()
          shutdown() Used to shut down the ObjectManager This also closes the Database!
private  void storeObjectInList(SavedObject obj)
          storeObjectInList(obj) Stores the given object inside the main double-linked list
 void swapOut(SavedObject obj)
          swapOut(obj) Swap the given Object out of memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_AUTOSTART

private SavedObject _AUTOSTART

_FIRST

private SavedObject _FIRST

_LAST

private SavedObject _LAST

_StoredObjects

private java.util.HashMap _StoredObjects

_ChangedObjects

private java.util.LinkedList _ChangedObjects

_higestID

private long _higestID

_DM

private DatabaseManager _DM

_classloader

private java.lang.ClassLoader _classloader

_races

private java.util.Collection _races
Constructor Detail

ObjectManager

public ObjectManager()
Method Detail

addAutoStart

public void addAutoStart(java.lang.String id)
Add an object to the AutoStart-Object!

Parameters:
id - - id to add

changedObject

public void changedObject(SavedObject obj)
changedObject(obj) Mark an Object as changed

Parameters:
obj -

checkForRace

public void checkForRace(java.lang.String id)
Adds the race to the list of races if id is a race!

Parameters:
id - - if of the object to check

checkMemory

public void checkMemory()
checkMemory() Print some information about available Memory


debugList

public void debugList()
debugList() Prints all available Objects - Is really really long when some objects exists!


delAutoStart

public void delAutoStart(java.lang.String id)
Delete an object from the AutoStart-Object!

Parameters:
id - - id to delete

destroyObject

public void destroyObject(SavedObject obj)
destroyObject(obj) An Object out of the game should be deleted

Parameters:
obj -

getObject

public SavedObject getObject(java.lang.String id)
getObject(id) Get an Object from it's id.

Parameters:
id -
Returns:
SavedObject

getRaces

public java.util.Collection getRaces()
Get the available Races

Returns:
Collection with all Races

initialize

public void initialize()
initialize Initializes everything. In the moment, only the tables inside the database are created.


removeObjectFromList

public void removeObjectFromList(SavedObject obj)
removeObjectFromList(obj) Remove the given object from the main double-linked list

Parameters:
obj -

save

public void save(SavedObject obj)
save(obj) Save the given SavedObject inside the database.

Parameters:
obj -

saveChanged

public void saveChanged()
saveChanged() Save all changed Objects


shutdown

public void shutdown()
shutdown() Used to shut down the ObjectManager This also closes the Database!


storeObjectInList

private void storeObjectInList(SavedObject obj)
storeObjectInList(obj) Stores the given object inside the main double-linked list

Parameters:
obj -

swapOut

public void swapOut(SavedObject obj)
swapOut(obj) Swap the given Object out of memory. Please do not call this function directly. Instead call: obj.swapOut()

Parameters:
obj -