FileDocCategorySizeDatePackage
WSDDChain.javaAPI DocApache Axis 1.44926Sat Apr 22 18:57:28 BST 2006org.apache.axis.deployment.wsdd

WSDDChain

public class WSDDChain extends WSDDHandler
WSDD chain element

Fields Summary
private Vector
handlers
Constructors Summary
public WSDDChain()
Default constructor

    
            
     
    
    
public WSDDChain(Element e)

param
e (Element) XXX
throws
WSDDException XXX

        super(e);
        
        // If we're simply a reference to an existing chain, return.
        // !!! should check to make sure it's a valid chain?
        if (type != null)
            return;
        
        Element [] elements = getChildElements(e, ELEM_WSDD_HANDLER);
        if (elements.length != 0) {
            for (int i = 0; i < elements.length; i++) {
                WSDDHandler handler = new WSDDHandler(elements[i]);
                addHandler(handler);
            }
        }
        
        elements = getChildElements(e, ELEM_WSDD_CHAIN);
        if (elements.length != 0) {
            for (int i = 0; i < elements.length; i++) {
                WSDDChain chain = new WSDDChain(elements[i]);
                addHandler(chain);
            }
        }

    
Methods Summary
public voidaddHandler(WSDDHandler handler)
Add a Handler to the chain (at the end)

        handlers.add(handler);
    
public voiddeployToRegistry(WSDDDeployment registry)

        if (getQName() != null)
            registry.addHandler(this);
        
        for (int n = 0; n < handlers.size(); n++) {
            WSDDHandler handler = (WSDDHandler)handlers.get(n);
            if (handler.getQName() != null)
                handler.deployToRegistry(registry);
        }         
    
protected javax.xml.namespace.QNamegetElementName()

        return WSDDConstants.QNAME_CHAIN;
    
public java.util.VectorgetHandlers()
Obtain our handler list

return
a Vector containing our Handlers

        return handlers;
    
public org.apache.axis.HandlermakeNewInstance(org.apache.axis.EngineConfiguration registry)
Creates a new instance of this Chain

param
registry XXX
return
XXX
throws
ConfigurationException XXX

        Chain c = new org.apache.axis.SimpleChain();
        
        for (int n = 0; n < handlers.size(); n++) {
            WSDDHandler handler = (WSDDHandler)handlers.get(n); 
            Handler h = handler.getInstance(registry);
            if ( h != null )
              c.addHandler(h);
            else
              throw new ConfigurationException("Can't find handler name:'" +
                                               handler.getQName() + "' type:'"+
                                               handler.getType() +
                                               "' in the registry");
        }
        
        return c;
    
public voidremoveHandler(WSDDHandler victim)
Remove a Handler from the chain

        handlers.remove(victim);
    
public voidwriteToContext(org.apache.axis.encoding.SerializationContext context)
Write this element out to a SerializationContext

        AttributesImpl attrs = new AttributesImpl();
        QName name = getQName();
        if (name != null) {
            attrs.addAttribute("", ATTR_NAME, ATTR_NAME,
                               "CDATA", context.qName2String(name));
        }
        if (getType() != null) {
            attrs.addAttribute("", ATTR_TYPE, ATTR_TYPE,
                           "CDATA", context.qName2String(getType()));
        }
        
        context.startElement(getElementName(), attrs);
        for (int n = 0; n < handlers.size(); n++) {
            WSDDHandler handler = (WSDDHandler)handlers.get(n); 
            handler.writeToContext(context);
        } 
        context.endElement();