Class RPObjectDAO

java.lang.Object
marauroa.server.game.db.RPObjectDAO

public class RPObjectDAO extends Object
data access object for RPObjects
Author:
miguel, hendrik
  • Field Details

    • factory

      protected RPObjectFactory factory
      factory for creating object instances
  • Constructor Details

    • RPObjectDAO

      protected RPObjectDAO(RPObjectFactory factory)
      creates a new RPObjectDAO
      Parameters:
      factory - factory for creating object instances
  • Method Details

    • loadRPObject

      public RPObject loadRPObject(DBTransaction transaction, int objectid) throws SQLException, IOException
      loads an RPObject form the database, using the factory to create the correct subclass
      Parameters:
      transaction - DBTransaction
      objectid - database-id of the RPObject
      Returns:
      RPObject
      Throws:
      IOException - in case of an input/output error
      SQLException - in case of an database error
    • loadRPObject

      public RPObject loadRPObject(DBTransaction transaction, int objectid, boolean transform) throws SQLException, IOException
      loads an RPObject form the database
      Parameters:
      transaction - DBTransaction
      objectid - database-id of the RPObject
      transform - use the factory to create a subclass of RPObject
      Returns:
      RPObject
      Throws:
      IOException - in case of an input/output error
      SQLException - in case of an database error
    • readRPObject

      public RPObject readRPObject(int objectid, byte[] data, int protocolVersion, boolean transform) throws SQLException, IOException
      reads an RPObject that has already been loaded from the database
      Parameters:
      objectid - object_id of RPObject
      data - blob data
      protocolVersion - version of serialization protocol
      transform - should it be transformed using the RPObjectFactory
      Returns:
      RPBobject
      Throws:
      IOException - in case of an input/output error
      SQLException - in case of an database error
    • removeRPObject

      public int removeRPObject(DBTransaction transaction, int objectid) throws SQLException
      deletes an RPObject from the database
      Parameters:
      transaction - DBTransaction
      objectid - database-id of the RPObject
      Returns:
      objectid
      Throws:
      SQLException - in case of an database error
    • hasRPObject

      public boolean hasRPObject(DBTransaction transaction, int objectid) throws SQLException
      does the rpobject with the specified database id exist?
      Parameters:
      transaction - DBTransaction
      objectid - database-id of the RPObject
      Returns:
      true, if it exists; false otherwise
      Throws:
      SQLException - in case of an database error
    • storeRPObject

      public int storeRPObject(DBTransaction transaction, RPObject object) throws IOException, SQLException
      saves an RPObject to the database
      Parameters:
      transaction - DBTransaction
      object - RPObject to save
      Returns:
      objectid
      Throws:
      IOException - in case of an input/output error
      SQLException - in case of an database error
    • loadRPObject

      @Deprecated public RPObject loadRPObject(int objectid, boolean transform) throws SQLException, IOException
      Deprecated.
      loads an RPObject form the database, using the factory to create the correct subclass
      Parameters:
      objectid - database-id of the RPObject
      transform - use the factory to create a subclass of RPObject
      Returns:
      RPObject
      Throws:
      IOException - in case of an input/output error
      SQLException - in case of an database error
    • loadRPObject

      @Deprecated public RPObject loadRPObject(int objectid) throws SQLException, IOException
      Deprecated.
      loads an RPObject form the database
      Parameters:
      objectid - database-id of the RPObject
      Returns:
      RPObject
      Throws:
      IOException - in case of an input/output error
      SQLException - in case of an database error
    • removeRPObject

      @Deprecated public int removeRPObject(int objectid) throws SQLException
      Deprecated.
      deletes an RPObject from the database
      Parameters:
      objectid - database-id of the RPObject
      Returns:
      objectid
      Throws:
      SQLException - in case of an database error
    • hasRPObject

      @Deprecated public boolean hasRPObject(int objectid) throws SQLException
      Deprecated.
      does the rpobject with the specified database id exist?
      Parameters:
      objectid - database-id of the RPObject
      Returns:
      true, if it exists; false otherwise
      Throws:
      SQLException - in case of an database error
    • storeRPObject

      @Deprecated public int storeRPObject(RPObject object) throws IOException, SQLException
      Deprecated.
      saves an RPObject to the database
      Parameters:
      object - RPObject to save
      Returns:
      objectid
      Throws:
      IOException - in case of an input/output error
      SQLException - in case of an database error