Refactored odb system (read extended), added implementation of Dynamic World Spawns

ODB no longer uses DPL layer of Berkeley DB, persistent classes have to
implement the Serializable interface, annotations are no longer used,
use transient modifier for variables that should not be persistent.
Entity reference errors will no longer occur, however it is better to
use ids if the entity that is being referenced is stored in the db too!
(or you will have two different objects). DB is cached for 5 minutes
then it will write its log/cache to disk, transactions are no longer
used.
This commit is contained in:
Light2
2014-05-01 20:33:38 +02:00
parent 97743da840
commit 7d457101f3
68 changed files with 650 additions and 375 deletions
@@ -22,6 +22,7 @@
package resources.objects.tangible;
import java.io.ByteArrayOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -55,8 +56,9 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=12)
public class TangibleObject extends SWGObject {
public class TangibleObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
// TODO: Thread safety
protected int incapTimer = 10;
@@ -72,9 +74,9 @@ public class TangibleObject extends SWGObject {
protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason
protected int factionStatus = 0;
@NotPersistent
private Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
private transient Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
@NotPersistent
private TangibleMessageBuilder messageBuilder;
private transient TangibleMessageBuilder messageBuilder;
private int respawnTime = 0;
private Point3D spawnCoordinates = new Point3D(0, 0, 0);
@@ -83,13 +85,13 @@ public class TangibleObject extends SWGObject {
private List<LootGroup> lootGroups = new ArrayList<LootGroup>();
@NotPersistent
private boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart
private transient boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart
@NotPersistent
private boolean lootLock = false;
private transient boolean lootLock = false;
@NotPersistent
private boolean creditRelieved = false;
private transient boolean creditRelieved = false;
@NotPersistent
private boolean lootItem = false;
private transient boolean lootItem = false;
private boolean stackable = false;
private int stackCount = 1;
@@ -101,7 +103,7 @@ public class TangibleObject extends SWGObject {
private String serialNumber;
@NotPersistent
private TangibleObject killer = null;
private transient TangibleObject killer = null;
public TangibleObject(long objectID, Planet planet, String template) {
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template);