From: <jt...@hy...> - 2008-04-17 06:47:47
|
Author: jtravis Date: 2008-04-16 23:47:42 -0700 (Wed, 16 Apr 2008) New Revision: 8973 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=8973 Modified: trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritter.java trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritterType.java trunk/src/org/hyperic/hq/grouping/critters/ResourceNameCritterType.java Log: Implement new critterType methods Modified: trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritter.java =================================================================== --- trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritter.java 2008-04-17 05:43:36 UTC (rev 8972) +++ trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritter.java 2008-04-17 06:47:42 UTC (rev 8973) @@ -32,16 +32,20 @@ import org.hibernate.Query; import org.hyperic.hq.authz.server.session.Resource; import org.hyperic.hq.grouping.Critter; +import org.hyperic.hq.grouping.CritterType; import org.hyperic.hq.grouping.prop.ResourceCritterProp; class DescendantProtoCritter implements Critter { - private final Resource _root; - private final Resource _proto; - private final List _props; + private final Resource _root; + private final Resource _proto; + private final List _props; + private final DescendantProtoCritterType _type; - DescendantProtoCritter(Resource root, Resource proto) { + DescendantProtoCritter(Resource root, Resource proto, + DescendantProtoCritterType type) + { _root = root; _proto = proto; @@ -49,6 +53,7 @@ c.add(new ResourceCritterProp(root)); c.add(new ResourceCritterProp(proto)); _props = Collections.unmodifiableList(c); + _type = type; } public List getProps() { @@ -70,4 +75,8 @@ q.setParameter("protoId", _proto.getId()); q.setParameter("rootId", _root.getId()); } + + public CritterType getCritterType() { + return _type; + } } Modified: trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritterType.java =================================================================== --- trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritterType.java 2008-04-17 05:43:36 UTC (rev 8972) +++ trunk/src/org/hyperic/hq/grouping/critters/DescendantProtoCritterType.java 2008-04-17 06:47:42 UTC (rev 8973) @@ -78,6 +78,16 @@ ResourceCritterProp root = (ResourceCritterProp) critterProps.get(0); ProtoCritterProp proto = (ProtoCritterProp) critterProps.get(1); return new DescendantProtoCritter(root.getResource(), - proto.getProtoType()); + proto.getProtoType(), this); } + + public Critter compose(CritterDump dump) throws GroupException { + throw new GroupException("compose from dump not supported"); + } + + public void decompose(Critter critter, CritterDump dump) + throws GroupException + { + throw new GroupException("decompose not supported"); + } } Modified: trunk/src/org/hyperic/hq/grouping/critters/ResourceNameCritterType.java =================================================================== --- trunk/src/org/hyperic/hq/grouping/critters/ResourceNameCritterType.java 2008-04-17 05:43:36 UTC (rev 8972) +++ trunk/src/org/hyperic/hq/grouping/critters/ResourceNameCritterType.java 2008-04-17 06:47:42 UTC (rev 8973) @@ -68,10 +68,12 @@ } public void decompose(Critter critter, CritterDump dump) - throws GroupException { + throws GroupException + { // verify that critter is of the right type if (!(critter instanceof ResourceNameCritter)) - throw new GroupException("Critter is not of valid type ResourceNameCritter"); + throw new GroupException("Critter is not of valid type " + + "ResourceNameCritter"); ResourceNameCritter resourceCritter = (ResourceNameCritter)critter; dump.setStringProp(resourceCritter.getNameRegex()); |