1 5 package net.sf.panoptes.component.jmx.jelly; 6 7 import javax.management.ObjectName ; 8 import javax.management.QueryExp ; 9 10 import net.sf.panoptes.component.jmx.model.MBeanLinkNode; 11 import net.sf.panoptes.component.jndi.JNDIRootNode; 12 import net.sf.panoptes.model.node.NodeDescriptor; 13 import net.sf.panoptes.model.node.NodeSupport; 14 15 import org.apache.commons.jelly.JellyTagException; 16 import org.apache.commons.jelly.MissingAttributeException; 17 import org.apache.commons.jelly.XMLOutput; 18 19 25 public class JNDITag extends NodeTag { 26 27 28 29 private XMLOutput output; 30 31 private String contextFactoryName = "com.sun.jndi.rmi.registry.RegistryContextFactory"; 32 private String providerURL = "rmi://localhost:1099"; 33 34 37 public void doTag(XMLOutput output) throws JellyTagException { 38 super.doTag(output); 39 40 if (contextFactoryName == null) { 41 throw new MissingAttributeException("contextFactory"); 42 } 43 44 if (providerURL == null) { 45 throw new MissingAttributeException("providerURL"); 46 } 47 48 try { 49 JNDIRootNode node = null; 50 node = new JNDIRootNode(getParentNode()); 51 node.setContextFactoryName(contextFactoryName); 52 node.setProviderURL(providerURL); 53 NodeDescriptor desc = node.getConfigDescriptor(); 54 desc.setName(getName()); 55 desc.setDescription(getDescription()); 56 doDefault(node); 57 getParentNode().addChild(node); 58 node.connect(); 59 this.output = output; 60 } catch (Exception e) { 61 throw new JellyTagException("Unable to create node", e); 62 } 63 } 64 65 public String getContextFactory() { 66 return contextFactoryName; 67 } 68 69 public void setContextFactory(String contextFactoryName) { 70 this.contextFactoryName = contextFactoryName; 71 } 72 73 74 public String getProviderURL() { 75 return providerURL; 76 } 77 78 public void setProviderURL(String providerURL) { 79 this.providerURL = providerURL; 80 } 81 82 } 83 | Popular Tags |