Package org.jboss.kernel.plugins.deployment.xml

Source Code of org.jboss.kernel.plugins.deployment.xml.DependencyHandler

/*    */ package org.jboss.kernel.plugins.deployment.xml;
/*    */
/*    */ import javax.xml.namespace.NamespaceContext;
/*    */ import javax.xml.namespace.QName;
/*    */ import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
/*    */ import org.jboss.dependency.spi.ControllerState;
/*    */ import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
/*    */ import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
/*    */ import org.xml.sax.Attributes;
/*    */
/*    */ public class DependencyHandler extends DefaultElementHandler
/*    */ {
/* 42 */   public static final DependencyHandler HANDLER = new DependencyHandler();
/*    */
/*    */   public Object startElement(Object parent, QName name, ElementBinding element)
/*    */   {
/* 46 */     return new AbstractDependencyValueMetaData();
/*    */   }
/*    */
/*    */   public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
/*    */   {
/* 51 */     AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)o;
/* 52 */     for (int i = 0; i < attrs.getLength(); i++)
/*    */     {
/* 54 */       String localName = attrs.getLocalName(i);
/* 55 */       if ("bean".equals(localName))
/* 56 */         dependency.setValue(attrs.getValue(i));
/* 57 */       else if ("property".equals(localName))
/* 58 */         dependency.setProperty(attrs.getValue(i));
/* 59 */       else if ("state".equals(localName))
/* 60 */         dependency.setDependentState(new ControllerState(attrs.getValue(i)));
/* 61 */       else if ("whenRequired".equals(localName))
/* 62 */         dependency.setWhenRequiredState(new ControllerState(attrs.getValue(i)));
/*    */     }
/*    */   }
/*    */
/*    */   public Object endElement(Object o, QName qName, ElementBinding element)
/*    */   {
/* 68 */     AbstractDependencyValueMetaData x = (AbstractDependencyValueMetaData)o;
/* 69 */     String name = (String)x.getUnderlyingValue();
/* 70 */     if ((name == null) || (name.trim().length() == 0))
/* 71 */       throw new IllegalArgumentException("Null or empty bean in injection.");
/* 72 */     return o;
/*    */   }
/*    */ }

/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
* Qualified Name:     org.jboss.kernel.plugins.deployment.xml.DependencyHandler
* JD-Core Version:    0.6.0
*/
TOP

Related Classes of org.jboss.kernel.plugins.deployment.xml.DependencyHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.