From 275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 17:30:41 +0200 Subject: 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. --- .../lifecycle/instance/predefined/item/Erase.java | 40 +++++++++------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java') 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 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 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; -- cgit v1.2.3