summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/events/History.java
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/events/History.java
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (diff)
More code cleanup:
Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class
Diffstat (limited to 'source/com/c2kernel/events/History.java')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/events/History.java32
1 files changed, 15 insertions, 17 deletions
diff --git a/source/com/c2kernel/events/History.java b/source/com/c2kernel/events/History.java
index bc806dd..a964a72 100755..100644
--- a/source/com/c2kernel/events/History.java
+++ b/source/com/c2kernel/events/History.java
@@ -1,8 +1,6 @@
package com.c2kernel.events;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.lookup.InvalidEntityPathException;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.RemoteMap;
import com.c2kernel.utils.Logger;
@@ -14,19 +12,18 @@ import com.c2kernel.utils.Logger;
* $Date: 2004/07/21 09:55:11 $
*
* Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
+ * All rights reserved.
*/
-public class History extends RemoteMap {
-
+public class History extends RemoteMap<Event> {
+
int lastID = -1;
- public History(int sysKey, Object locker)
- throws ObjectNotFoundException, InvalidEntityPathException {
+ public History(int sysKey, Object locker) {
super(sysKey, ClusterStorage.HISTORY, locker);
}
- public Event addEvent(String agentName, String agentRole,
+ public Event addEvent(String agentName, String agentRole,
int stepTransitionId,
String stepName,
String stepPath,
@@ -45,8 +42,8 @@ public class History extends RemoteMap {
newEvent.setTimeStamp(Event.getGMT());
return storeNewEvent(newEvent);
}
-
- public Event addEvent(String agentName, String agentRole,
+
+ public Event addEvent(String agentName, String agentRole,
int stepTransitionId,
String stepName,
String stepPath,
@@ -66,27 +63,28 @@ public class History extends RemoteMap {
newEvent.setTimeString(timeString);
return storeNewEvent(newEvent);
}
-
+
private Event storeNewEvent(Event newEvent) {
synchronized (this) {
int newEventID = getLastId()+1;
newEvent.setID(newEventID);
if (put(newEvent.getName(), newEvent) != null) {
lastID = newEventID;
- return newEvent;
+ return newEvent;
}
else {
Logger.error("History.addEvent() - Event storage failed!");
return null;
}
- }
+ }
}
-
+
public Event getEvent(int id) {
- return (Event)get(String.valueOf(id));
+ return get(String.valueOf(id));
}
-
- public Object remove(Object key) {
+
+ @Override
+ public Event remove(Object key) {
// forbidden
return null;
}