1 5 package net.sf.panoptes.component.jmx.jelly; 6 7 import org.apache.commons.jelly.JellyTagException; 8 import org.apache.commons.jelly.TagSupport; 9 import org.apache.commons.jelly.XMLOutput; 10 11 17 public class ContextEntryTag extends TagSupport { 18 19 private String name = null; 20 private Object value = null; 21 22 public void doTag(XMLOutput output) throws JellyTagException { 23 24 NodeTag parent = (NodeTag) findAncestorWithClass(NodeTag.class); 25 if (parent == null) 26 throw new JellyTagException("This tag must be nested within <node> or descendant of <node>"); 27 28 if (name == null) throw new JellyTagException("Name is not set"); 29 if (value == null) throw new JellyTagException("Value is not set"); 30 parent.getNode().getContext().put(name, value); 31 getContext().setVariable(name, value); 32 33 } 34 35 public void setName(String name) { 36 this.name = name; 37 } 38 39 public void setValue(Object value) { 40 this.value = value; 41 } 42 43 } 44 | Popular Tags |