|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openbandy.io.db.DatabaseSerializerImpl
public class DatabaseSerializerImpl
The Database Serializer provides a service to load and
store serializable objects to respectively from a JDBC compliant
database.
Thus, in order to store a Serializable object, the
DatabaseSerializerImpl creates a new DatabaseValueContainer
object and passes it to the object that needs to be serialized,
i.e., stored in the database. This object will fill the container
as described in 3.2.2. Subsequently, the DatabaseSerializerImpl
tests, if the given object already exists in the database,
using the DatabaseStorage’s existsInStorage() method described below.
Accordingly, it will either create an INSERT or an UPDATE statement
from the container object, using the SqlStatement class. Finally,
the DatabaseSerializerImpl invokes the DatabaseConnection instance,
it got from the DatabaseStorage, to execute this statement. In all
cases, the DatabaseSerializerImpl will update the Serializable object’s
numeric identifier to the actual values used in the database.
To load an object from the database, the DatabaseSerializerImpl must
create the corresponding SELECT statement, again using the SqlStatement
class. The resulting ResultSet is subsequently encapsulated in a
DatabaseValueContainer object, which will be passed to the serializable
object for deserialization.
Every object gets stored in the database in its own table, whereas
must hold:
classname = tablename
attributename = fieldname
(c) Copyright Philipp Bolliger 2007, ALL RIGHTS RESERVED.
Field Summary |
---|
Fields inherited from interface org.openbandy.io.Serializer |
---|
MODE_DATABASE, MODE_DEFAULT, MODE_RMS, MODE_STREAM |
Constructor Summary | |
---|---|
DatabaseSerializerImpl()
|
Method Summary | |
---|---|
void |
deserializeObject(Serializable serializable,
SerializationBuffer serializationBuffer)
TODO comment! |
Storage |
getStorage()
TODO describe purpose an usage |
boolean |
load(Serializable serializable,
int id)
Load an object that has been serialized before, refernced by the object's ID. |
void |
serializeObject(Serializable serializable,
SerializationBuffer serializationBuffer)
TODO comment! |
void |
store(Serializable serializable)
TODO describe purpose an usage |
void |
updateReferences(ObjectEntry objectEntry)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatabaseSerializerImpl()
Method Detail |
---|
public Storage getStorage()
StorageSerializer
getStorage
in interface StorageSerializer
public void store(Serializable serializable)
StorageSerializer
store
in interface StorageSerializer
public boolean load(Serializable serializable, int id)
load
in interface StorageSerializer
public void serializeObject(Serializable serializable, SerializationBuffer serializationBuffer)
Serializer
serializeObject
in interface Serializer
public void deserializeObject(Serializable serializable, SerializationBuffer serializationBuffer)
Serializer
deserializeObject
in interface Serializer
public void updateReferences(ObjectEntry objectEntry)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |