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

WSDDUndeployment

public class WSDDUndeployment extends WSDDElement implements WSDDTypeMappingContainer
WSDD deployment element
author
James Snell

Fields Summary
private Vector
handlers
private Vector
chains
private Vector
services
private Vector
transports
private Vector
typeMappings
Constructors Summary
public WSDDUndeployment()
Default constructor

    
public WSDDUndeployment(Element e)
Constructor - build an undeployment from a DOM Element.

param
e the DOM Element to initialize from
throws
WSDDException if there is a problem

        super(e);
        
        Element [] elements = getChildElements(e, ELEM_WSDD_HANDLER);
        int i;

        for (i = 0; i < elements.length; i++) {
            addHandler(getQName(elements[i]));
        }

        elements = getChildElements(e, ELEM_WSDD_CHAIN);
        for (i = 0; i < elements.length; i++) {
            addChain(getQName(elements[i]));
        }
        
        elements = getChildElements(e, ELEM_WSDD_TRANSPORT);
        for (i = 0; i < elements.length; i++) {
            addTransport(getQName(elements[i]));
        }
        
        elements = getChildElements(e, ELEM_WSDD_SERVICE);
        for (i = 0; i < elements.length; i++) {
            addService(getQName(elements[i]));
        }

        /*
        // How to deal with undeploying mappings?

        elements = getChildElements(e, ELEM_WSDD_TYPEMAPPING);
        for (i = 0; i < elements.length; i++) {
            WSDDTypeMapping mapping = new WSDDTypeMapping(elements[i]);
            addTypeMapping(mapping);
        }

        elements = getChildElements(e, ELEM_WSDD_BEANMAPPING);
        for (i = 0; i < elements.length; i++) {
            WSDDBeanMapping mapping = new WSDDBeanMapping(elements[i]);
            addTypeMapping(mapping);
        }
        */
    
Methods Summary
public voidaddChain(javax.xml.namespace.QName chain)

        chains.add(chain);
    
public voidaddHandler(javax.xml.namespace.QName handler)


       
    
        handlers.add(handler);
    
public voidaddService(javax.xml.namespace.QName service)

        services.add(service);
    
public voidaddTransport(javax.xml.namespace.QName transport)

        transports.add(transport);
    
public voiddeployTypeMapping(WSDDTypeMapping typeMapping)

        typeMappings.add(typeMapping);
    
protected javax.xml.namespace.QNamegetElementName()

        return QNAME_UNDEPLOY;
    
private javax.xml.namespace.QNamegetQName(org.w3c.dom.Element el)

        String attr = el.getAttribute(ATTR_NAME);
        if (attr == null || "".equals(attr))
            throw new WSDDException(Messages.getMessage("badNameAttr00"));
        return new QName("", attr);
    
public WSDDTypeMapping[]getTypeMappings()

return
XXX

        WSDDTypeMapping[] t = new WSDDTypeMapping[typeMappings.size()];
        typeMappings.toArray(t);
        return t;
    
public voidundeployFromRegistry(WSDDDeployment registry)

        QName qname;
        for (int n = 0; n < handlers.size(); n++) {
            qname = (QName)handlers.get(n);
            registry.undeployHandler(qname);
        }

        for (int n = 0; n < chains.size(); n++) {
            qname = (QName)chains.get(n);
            registry.undeployHandler(qname);
        }

        for (int n = 0; n < transports.size(); n++) {
            qname = (QName)transports.get(n);
            registry.undeployTransport(qname);
        }

        for (int n = 0; n < services.size(); n++) {
            qname = (QName)services.get(n);
 
            try {
                String sname = qname.getLocalPart();
                MessageContext messageContext = MessageContext.getCurrentContext();
                if (messageContext != null) {
                    SOAPService service = messageContext.getAxisEngine()
                            .getService(sname);
                    if ( service != null ) service.clearSessions();
                }
            } catch(Exception exp) {
                throw new ConfigurationException(exp);
            }
            registry.undeployService(qname);
        }
    
private voidwriteElement(org.apache.axis.encoding.SerializationContext context, javax.xml.namespace.QName elementQName, javax.xml.namespace.QName qname)

        AttributesImpl attrs = new org.xml.sax.helpers.AttributesImpl();
        attrs.addAttribute("", ATTR_NAME, ATTR_NAME, "CDATA",
                           context.qName2String(qname));
         
        context.startElement(elementQName, attrs);
        context.endElement();
    
public voidwriteToContext(org.apache.axis.encoding.SerializationContext context)

        context.registerPrefixForURI(NS_PREFIX_WSDD, URI_WSDD);
        context.startElement(WSDDConstants.QNAME_UNDEPLOY, null);
        
        Iterator i = handlers.iterator();
        QName qname;
        while (i.hasNext()) {
            qname = (QName)i.next();
            writeElement(context, QNAME_HANDLER, qname);
        }
        
        i = chains.iterator();
        while (i.hasNext()) {
            qname = (QName)i.next();
            writeElement(context, QNAME_CHAIN, qname);
        }

        i = services.iterator();
        while (i.hasNext()) {
            qname = (QName)i.next();
            writeElement(context, QNAME_SERVICE, qname);
        }
        
        i = transports.iterator();
        while (i.hasNext()) {
            qname = (QName)i.next();
            writeElement(context, QNAME_TRANSPORT, qname);
        }
        
        i = typeMappings.iterator();
        while (i.hasNext()) {
            WSDDTypeMapping mapping = (WSDDTypeMapping)i.next();
            mapping.writeToContext(context);
        }

        context.endElement();