Updated to use new DatabaseException.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5347 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -25,8 +25,8 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
|
||||||
import com.samskivert.jdbc.WriteOnlyUnit;
|
import com.samskivert.jdbc.WriteOnlyUnit;
|
||||||
|
import com.samskivert.jdbc.depot.DatabaseException;
|
||||||
import com.samskivert.jdbc.depot.PersistenceContext;
|
import com.samskivert.jdbc.depot.PersistenceContext;
|
||||||
import com.samskivert.util.Invoker;
|
import com.samskivert.util.Invoker;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -55,7 +55,6 @@ public class DatabaseConfigRegistry extends ConfigRegistry
|
|||||||
* initialization) so as to avoid blocking the distributed object thread.
|
* initialization) so as to avoid blocking the distributed object thread.
|
||||||
*/
|
*/
|
||||||
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker)
|
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
this(ctx, invoker, false);
|
this(ctx, invoker, false);
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,6 @@ public class DatabaseConfigRegistry extends ConfigRegistry
|
|||||||
* @param transitioning if the values in the database need to be transitioned to a new format
|
* @param transitioning if the values in the database need to be transitioned to a new format
|
||||||
*/
|
*/
|
||||||
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker, boolean transitioning)
|
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker, boolean transitioning)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
this(ctx, invoker, "", transitioning);
|
this(ctx, invoker, "", transitioning);
|
||||||
}
|
}
|
||||||
@@ -84,7 +82,6 @@ public class DatabaseConfigRegistry extends ConfigRegistry
|
|||||||
* separate configs, then specify a node for each server
|
* separate configs, then specify a node for each server
|
||||||
*/
|
*/
|
||||||
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker, String node)
|
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker, String node)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
this(ctx, invoker, node, false);
|
this(ctx, invoker, node, false);
|
||||||
}
|
}
|
||||||
@@ -100,8 +97,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
|
|||||||
* @param transitioning if the values in the database need to be transitioned to a new format
|
* @param transitioning if the values in the database need to be transitioned to a new format
|
||||||
*/
|
*/
|
||||||
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker, String node,
|
public DatabaseConfigRegistry (PersistenceContext ctx, Invoker invoker, String node,
|
||||||
boolean transitioning)
|
boolean transitioning)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
super(transitioning);
|
super(transitioning);
|
||||||
_repo = new ConfigRepository(ctx);
|
_repo = new ConfigRepository(ctx);
|
||||||
@@ -133,7 +129,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
|
|||||||
// can predictably make use of the configuration information that we load
|
// can predictably make use of the configuration information that we load
|
||||||
try {
|
try {
|
||||||
_data = _repo.loadConfig(_node, _path);
|
_data = _repo.loadConfig(_node, _path);
|
||||||
} catch (PersistenceException pe) {
|
} catch (DatabaseException pe) {
|
||||||
log.warning("Failed to load object configuration [path=" + _path + "].", pe);
|
log.warning("Failed to load object configuration [path=" + _path + "].", pe);
|
||||||
_data = new HashMap<String, String>();
|
_data = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ package com.threerings.admin.server.persist;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
|
||||||
import com.samskivert.jdbc.depot.DepotRepository;
|
import com.samskivert.jdbc.depot.DepotRepository;
|
||||||
import com.samskivert.jdbc.depot.PersistenceContext;
|
import com.samskivert.jdbc.depot.PersistenceContext;
|
||||||
import com.samskivert.jdbc.depot.PersistentRecord;
|
import com.samskivert.jdbc.depot.PersistentRecord;
|
||||||
@@ -49,7 +48,6 @@ public class ConfigRepository extends DepotRepository
|
|||||||
* @return a map containing field/value pairs for all stored configuration data.
|
* @return a map containing field/value pairs for all stored configuration data.
|
||||||
*/
|
*/
|
||||||
public HashMap<String, String> loadConfig (String node, String object)
|
public HashMap<String, String> loadConfig (String node, String object)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
HashMap<String, String> data = new HashMap<String, String>();
|
HashMap<String, String> data = new HashMap<String, String>();
|
||||||
Where where = new Where(ConfigRecord.OBJECT_C, object, ConfigRecord.NODE_C, node);
|
Where where = new Where(ConfigRecord.OBJECT_C, object, ConfigRecord.NODE_C, node);
|
||||||
@@ -63,7 +61,6 @@ public class ConfigRepository extends DepotRepository
|
|||||||
* Updates the specified configuration datum.
|
* Updates the specified configuration datum.
|
||||||
*/
|
*/
|
||||||
public void updateConfig (String node, String object, String field, String value)
|
public void updateConfig (String node, String object, String field, String value)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
store(new ConfigRecord(node, object, field, value));
|
store(new ConfigRecord(node, object, field, value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import java.util.Set;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
|
||||||
import com.samskivert.jdbc.depot.DepotRepository;
|
import com.samskivert.jdbc.depot.DepotRepository;
|
||||||
import com.samskivert.jdbc.depot.PersistenceContext;
|
import com.samskivert.jdbc.depot.PersistenceContext;
|
||||||
import com.samskivert.jdbc.depot.PersistentRecord;
|
import com.samskivert.jdbc.depot.PersistentRecord;
|
||||||
@@ -51,7 +50,6 @@ public class NodeRepository extends DepotRepository
|
|||||||
* Returns a list of all nodes registered in the repository.
|
* Returns a list of all nodes registered in the repository.
|
||||||
*/
|
*/
|
||||||
public List<NodeRecord> loadNodes ()
|
public List<NodeRecord> loadNodes ()
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
return findAll(NodeRecord.class);
|
return findAll(NodeRecord.class);
|
||||||
}
|
}
|
||||||
@@ -60,7 +58,6 @@ public class NodeRepository extends DepotRepository
|
|||||||
* Updates the supplied node record, inserting it into the database if necessary.
|
* Updates the supplied node record, inserting it into the database if necessary.
|
||||||
*/
|
*/
|
||||||
public void updateNode (NodeRecord record)
|
public void updateNode (NodeRecord record)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
record.lastUpdated = new Timestamp(System.currentTimeMillis());
|
record.lastUpdated = new Timestamp(System.currentTimeMillis());
|
||||||
store(record);
|
store(record);
|
||||||
@@ -71,7 +68,6 @@ public class NodeRepository extends DepotRepository
|
|||||||
* alive and well.
|
* alive and well.
|
||||||
*/
|
*/
|
||||||
public void heartbeatNode (String nodeName)
|
public void heartbeatNode (String nodeName)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
updatePartial(NodeRecord.class, nodeName, new Object[] {
|
updatePartial(NodeRecord.class, nodeName, new Object[] {
|
||||||
NodeRecord.LAST_UPDATED, new Timestamp(System.currentTimeMillis())
|
NodeRecord.LAST_UPDATED, new Timestamp(System.currentTimeMillis())
|
||||||
@@ -82,7 +78,6 @@ public class NodeRepository extends DepotRepository
|
|||||||
* Deletes the identified node record.
|
* Deletes the identified node record.
|
||||||
*/
|
*/
|
||||||
public void deleteNode (String nodeName)
|
public void deleteNode (String nodeName)
|
||||||
throws PersistenceException
|
|
||||||
{
|
{
|
||||||
// INDEX: Full primary key.
|
// INDEX: Full primary key.
|
||||||
delete(NodeRecord.class, nodeName);
|
delete(NodeRecord.class, nodeName);
|
||||||
|
|||||||
Reference in New Issue
Block a user