From b086f57f56bf0eb9dab9cf321a0f69aaaae84347 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 30 May 2012 08:37:45 +0200 Subject: Initial Maven Conversion --- .../com/c2kernel/collection/AggregationMember.java | 161 --------------------- 1 file changed, 161 deletions(-) delete mode 100644 source/com/c2kernel/collection/AggregationMember.java (limited to 'source/com/c2kernel/collection/AggregationMember.java') diff --git a/source/com/c2kernel/collection/AggregationMember.java b/source/com/c2kernel/collection/AggregationMember.java deleted file mode 100644 index e3b213e..0000000 --- a/source/com/c2kernel/collection/AggregationMember.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.c2kernel.collection; - -import java.awt.Image; -import java.util.StringTokenizer; - -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.entity.proxy.EntityProxy; -import com.c2kernel.graph.model.GraphableVertex; -import com.c2kernel.lookup.EntityPath; -import com.c2kernel.lookup.InvalidEntityPathException; -import com.c2kernel.persistency.ClusterStorage; -import com.c2kernel.process.Gateway; -import com.c2kernel.property.Property; -import com.c2kernel.utils.Logger; -import com.c2kernel.utils.Resource; - -/** -* @version $Revision: 1.11 $ $Date: 2005/12/01 14:23:15 $ -* @author $Author: abranson $ -*/ - - -//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 -{ - - private int mEntityKey = -1; - private EntityProxy mEntity = null; - private Aggregation mCollection = null; - private String mClassProps = null; - String entityName; - Image image; - - - /************************************************************************** - * - **************************************************************************/ - public AggregationMember() - { - super(); - mEntityKey = -1; - mCollection = null; - } - - @Override - public void setEntityKey(int entityKey) { - mEntityKey = entityKey; - entityName = null; - } - - public void setCollection(Aggregation aggregation) - { - mCollection = aggregation; - } - - @Override - public void setClassProps(String props) - { - mClassProps = props; - } - - @Override - public int getEntityKey() - { - return mEntityKey; - } - - public Aggregation getCollection() - { - return mCollection; - } - - @Override - public String getClassProps() - { - return mClassProps; - } - - @Override - public void assignEntity(int entityKey) throws MembershipException - { - if (entityKey > -1) { - if (mClassProps == null || getProperties() == null) - throw new MembershipException("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, ","); - while (sub.hasMoreTokens()) - { - String aClassProp = sub.nextToken(); - try { - String memberValue = (String)getProperties().get(aClassProp); - Property entityProperty = (Property)Gateway.getStorage().get(entityKey, ClusterStorage.PROPERTY+"/"+aClassProp, null); - if (entityProperty == null) - throw new MembershipException("Property "+aClassProp+ " does not exist for entityKey=" + entityKey ); - if (entityProperty.getValue() == null || !entityProperty.getValue().equalsIgnoreCase(memberValue)) - throw new MembershipException("Value of mandatory prop "+aClassProp+" does not match: " + entityProperty.getValue()+"!="+memberValue); - } - catch (MembershipException ex) { - throw ex; - } - catch (Exception ex) - { - Logger.error(ex); - throw new MembershipException("Error checking properties"); - } - } - } - - mEntityKey = entityKey; - mEntity = null; - entityName = null; - } - - @Override - public void clearEntity() { - mEntityKey = -1; - mEntity = null; - } - - @Override - public EntityProxy resolveEntity() throws ObjectNotFoundException { - if (mEntity == null) { - try { - EntityPath path = new EntityPath(mEntityKey); - mEntity = Gateway.getProxyManager().getProxy(path); - } catch (InvalidEntityPathException ex) { - throw new ObjectNotFoundException("No member defined", ""); - } - } - return mEntity; - - } - - public Image getImage() { - if (image == null) { - image = Resource.findImage("typeicons/"+getProperties().get("Type")+"_16.png").getImage(); - } - return image; - } - - public String getEntityName() { - if (entityName == null) { - if (mEntityKey > -1) { - try { - entityName = resolveEntity().getName(); - } catch (ObjectNotFoundException ex) { - Logger.error(ex); - entityName = "Error ("+mEntityKey+")"; - } - } - else - entityName = "Empty"; - } - - return entityName; - } - -} -- cgit v1.2.3