summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-10-03 17:30:41 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-10-03 17:30:41 +0200
commit275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 (patch)
treeddcc6b14077d90d1b970b67829f07120547dbb62 /src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java
parenta139f95bfeca603333b8c0310ae09c6805e58584 (diff)
Huge exception overhaul: Merged ClusterStorageException with
PersistencyException. Replaced MembershipException with InvalidCollectionModification CORBA Exception. Made all predef steps throw more accurate exceptions when they go wrong, and let more exceptions bubble through from underneath.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java')
-rw-r--r--src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java
index 8245c4a..f96bc08 100644
--- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java
+++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java
@@ -24,7 +24,11 @@ package com.c2kernel.lifecycle.instance.predefined.item;
import java.util.Iterator;
-import com.c2kernel.common.InvalidDataException;
+import com.c2kernel.common.CannotManage;
+import com.c2kernel.common.InvalidData;
+import com.c2kernel.common.ObjectCannotBeUpdated;
+import com.c2kernel.common.ObjectNotFound;
+import com.c2kernel.common.PersistencyException;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
@@ -50,33 +54,23 @@ public class Erase extends PredefinedStep
//requestdata is xmlstring
@Override
protected String runActivityLogic(AgentPath agent, ItemPath item,
- int transitionID, String requestData) throws InvalidDataException {
+ int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage, PersistencyException {
Logger.msg(1, "Erase::request() - Starting.");
- try
- {
- // get all domain paths
- Iterator<Path> domPaths = Gateway.getLookup().searchAliases(item);
- while (domPaths.hasNext()) {
- DomainPath path = (DomainPath)domPaths.next();
- // delete them
- if (path.getItemPath().equals(item))
- Gateway.getLookupManager().delete(path);
- }
-
- //clear out all storages
- Gateway.getStorage().removeCluster(item, "", null);
-
- //remove entity path
- Gateway.getLookupManager().delete(item);
+ Iterator<Path> domPaths = Gateway.getLookup().searchAliases(item);
+ while (domPaths.hasNext()) {
+ DomainPath path = (DomainPath)domPaths.next();
+ // delete them
+ if (path.getItemPath().equals(item))
+ Gateway.getLookupManager().delete(path);
}
- catch( Exception ex )
- {
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
+ //clear out all storages
+ Gateway.getStorage().removeCluster(item, "", null);
+
+ //remove entity path
+ Gateway.getLookupManager().delete(item);
Logger.msg(1, "Erase::request() - DONE.");
return requestData;