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. --- .../com/c2kernel/collection/AggregationMember.java | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/main/java/com/c2kernel/collection/AggregationMember.java') diff --git a/src/main/java/com/c2kernel/collection/AggregationMember.java b/src/main/java/com/c2kernel/collection/AggregationMember.java index 067bb46..4a5b8db 100644 --- a/src/main/java/com/c2kernel/collection/AggregationMember.java +++ b/src/main/java/com/c2kernel/collection/AggregationMember.java @@ -22,7 +22,8 @@ package com.c2kernel.collection; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.InvalidCollectionModification; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.graph.model.GraphableVertex; import com.c2kernel.lookup.InvalidItemPathException; @@ -33,14 +34,12 @@ import com.c2kernel.property.Property; import com.c2kernel.utils.Logger; /** -* @version $Revision: 1.11 $ $Date: 2005/12/01 14:23:15 $ -* @author $Author: abranson $ +* A CollectionMember, or slot, of an Aggregation instance or description. +* Verifies type information of Items during assignment based on +* PropertyDescription information stored in slot properties and listed as +* ClassProps. */ - -//this extends Vertex for inherit the graph visualization -//this does not implement MemberObject anylonger. it is a java object. -//eventually the member object corba interface will be phased out. public class AggregationMember extends GraphableVertex implements CollectionMember { @@ -87,11 +86,11 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb } @Override - public void assignItem(ItemPath itemPath) throws MembershipException + public void assignItem(ItemPath itemPath) throws InvalidCollectionModification { if (itemPath != null) { if (mClassProps == null || getProperties() == null) - throw new MembershipException("ClassProps not yet set. Cannot check membership validity."); + throw new InvalidCollectionModification("ClassProps not yet set. Cannot check membership validity."); //for each mandatory prop check if its in the member property and has the matching value StringTokenizer sub = new StringTokenizer(mClassProps, ","); @@ -102,17 +101,17 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb String memberValue = (String)getProperties().get(aClassProp); Property ItemProperty = (Property)Gateway.getStorage().get(itemPath, ClusterStorage.PROPERTY+"/"+aClassProp, null); if (ItemProperty == null) - throw new MembershipException("Property "+aClassProp+ " does not exist for item " + itemPath ); + throw new InvalidCollectionModification("Property "+aClassProp+ " does not exist for item " + itemPath ); if (ItemProperty.getValue() == null || !ItemProperty.getValue().equalsIgnoreCase(memberValue)) - throw new MembershipException("Value of mandatory prop "+aClassProp+" does not match: " + ItemProperty.getValue()+"!="+memberValue); + throw new InvalidCollectionModification("Value of mandatory prop "+aClassProp+" does not match: " + ItemProperty.getValue()+"!="+memberValue); } - catch (MembershipException ex) { + catch (InvalidCollectionModification ex) { throw ex; } catch (Exception ex) { Logger.error(ex); - throw new MembershipException("Error checking properties"); + throw new InvalidCollectionModification("Error checking properties"); } } } @@ -130,7 +129,7 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb } @Override - public ItemProxy resolveItem() throws ObjectNotFoundException { + public ItemProxy resolveItem() throws ObjectNotFound { if (mItem == null && mItemPath != null) { mItem = Gateway.getProxyManager().getProxy(mItemPath); } @@ -143,7 +142,7 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb if (mItemPath != null) { try { mItemName = resolveItem().getName(); - } catch (ObjectNotFoundException ex) { + } catch (ObjectNotFound ex) { Logger.error(ex); mItemName = "Error ("+mItemPath+")"; } @@ -155,7 +154,7 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb return mItemName; } - public void setChildUUID(String uuid) throws MembershipException, InvalidItemPathException { + public void setChildUUID(String uuid) throws InvalidCollectionModification, InvalidItemPathException { mItemPath = new ItemPath(uuid); mItemName = null; } -- cgit v1.2.3