Package org.apache.ws.commons.om

Examples of org.apache.ws.commons.om.OMElement


        if (faultTo != null && !doNotSendFaultUsingFaultTo) {
            faultContext.setTo(processingContext.getFaultTo());
        } else
        if (!doNotSendFaultUsingFaultTo && processingContext.getEnvelope().getHeader() != null && processingContext.getEnvelope().getHeader().getFirstChildWithName(new QName("FaultTo")) != null)
        {
            OMElement faultToElement = processingContext.getEnvelope().getHeader().getFirstChildWithName(new QName("FaultTo"));
            faultTo = new EndpointReference("");
            faultTo.fromOM(faultToElement);
            faultContext.setTo(faultTo);
        } else if (processingContext.getReplyTo() != null) {
            faultContext.setTo(processingContext.getReplyTo());
View Full Code Here


    public OMElement processOMElementRef(String id) throws AxisFault {
        if(!filledTable){
            readallChildElements();
        }
        OMElement val = (OMElement)elementMap.get(id);
        if(val == null){
            throw new AxisFault("Invalid reference :" + id);
        } else {
            OMElement ele = processElementforRefs(val);
            OMElement cloneele = elementClone(ele);
            omElementMap.put(id,cloneele);
            return cloneele;
        }
    }
View Full Code Here

    }

    public OMElement processElementforRefs(OMElement elemnts) throws AxisFault {
        Iterator itr = elemnts.getChildElements();
        while (itr.hasNext()) {
            OMElement omElement = (OMElement) itr.next();
            OMAttribute attri = processRefAtt(omElement);
            if(attri != null){
                String ref = getAttvalue(attri);
                OMElement tempele = getOMElement(ref);
                if(tempele == null){
                    tempele = processOMElementRef(ref);
                }
                OMElement ele2 = elementClone(tempele);
                Iterator itrChild = ele2.getChildren();
                while (itrChild.hasNext()) {
                    Object obj = itrChild.next();
                    if(obj instanceof OMNode){
                        omElement.addChild((OMNode)obj);
                    }
View Full Code Here

    public Object processRef(Class javatype, String id) throws AxisFault {
        if(!filledTable){
            readallChildElements();
        }
        OMElement val = (OMElement)elementMap.get(id);
        if(val == null){
            throw new AxisFault("Invalid reference :" + id);
        } else {
            if(SimpleTypeMapper.isSimpleType(javatype)){
                /**
 
View Full Code Here

    }

    private void readallChildElements(){
        Iterator childs =  parent.getChildElements();
        while (childs.hasNext()) {
            OMElement omElement = (OMElement) childs.next();
            OMAttribute id =  omElement.getAttribute(new QName("id"));
            if(id !=null){
                omElement.build();
                elementMap.put(id.getAttributeValue(),omElement);
            }
        }
        filledTable =true;
    }
View Full Code Here

        try {
            if (beanClass.isArray()) {
                ArrayList valueList = new ArrayList();
                Class arrayClassType = beanClass.getComponentType();
                Iterator parts = beanElement.getChildElements();
                OMElement omElement;
                while (parts.hasNext()) {
                    Object objValue = parts.next();
                    if (objValue instanceof OMElement) {
                        omElement = (OMElement) objValue;
                        valueList.add(deserialize(arrayClassType, omElement));
                    }
                }
                return ConverterUtil.convertToArray(arrayClassType,
                        valueList);
            } else {
                if (SimpleTypeMapper.isSimpleType(beanClass)) {
                    return SimpleTypeMapper.getSimpleTypeObject(beanClass, beanElement);
                }
                HashMap properties = new HashMap();
                BeanInfo beanInfo = Introspector.getBeanInfo(beanClass);
                PropertyDescriptor [] propDescs = beanInfo.getPropertyDescriptors();
                for (int i = 0; i < propDescs.length; i++) {
                    PropertyDescriptor proprty = propDescs[i];
                    properties.put(proprty.getName(), proprty);
                }

                beanObj = beanClass.newInstance();
                Iterator elements = beanElement.getChildren();
                while (elements.hasNext()) {
                    OMElement parts;
                    Object objValue = elements.next();
                    if (objValue instanceof OMElement) {
                        parts = (OMElement) objValue;
                    } else {
                        continue;
                    }
                    // if parts/@href != null then need to find element with id and deserialize.
                    // before that first check whether we already have it in the hashtable
                    String partsLocalName = parts.getLocalName();
                    PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName);
                    if (prty != null) {
                        Class parameters = prty.getPropertyType();
                        if (prty.equals("class"))
                            continue;

                        Object partObj;
                        if (SimpleTypeMapper.isSimpleType(parameters)) {
                            partObj = SimpleTypeMapper.getSimpleTypeObject(parameters, parts);
                        } else if (SimpleTypeMapper.isArrayList(parameters)) {
                            //todo : Deepal , the array handling is completely wrong , this has to be
                            // improved
                            partObj = SimpleTypeMapper.getArrayList((OMElement) parts.getParent(), prty.getName());
                        } else {
                            partObj = deserialize(parameters, parts);
                        }
                        Object [] parms = new Object[]{partObj};
                        prty.getWriteMethod().invoke(beanObj, parms);
View Full Code Here

            beanObj = beanClass.newInstance();
            Iterator elements = beanElement.getChildren();
            while (elements.hasNext()) {
                Object child = elements.next();
                OMElement parts;
                if (child instanceof OMElement) {
                    parts = (OMElement) child;
                } else {
                    continue;
                }
                String partsLocalName = parts.getLocalName();
                PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName.toLowerCase());
                if (prty != null) {
                    Class parameters = prty.getPropertyType();
                    if (prty.equals("class"))
                        continue;
View Full Code Here

        // has to  get and add to the list
        Class classType;
        String currentLocalName;
        while (parts.hasNext() && count < length) {
            Object objValue = parts.next();
            OMElement omElement;
            if (objValue instanceof OMElement) {
                omElement = (OMElement) objValue;
            } else {
                continue;
            }
            currentLocalName = omElement.getLocalName();
            classType = (Class) javaTypes[count];
            if (classType.isArray()) {
                ArrayList valueList = new ArrayList();
                Class arrayClassType = classType.getComponentType();
                valueList.add(processObject(omElement, arrayClassType, helper));
                while (parts.hasNext()) {
                    objValue = parts.next();
                    if (objValue instanceof OMElement) {
                        omElement = (OMElement) objValue;
                    } else {
                        continue;
                    }
                    if (!currentLocalName.equals(omElement.getLocalName())) {
                        break;
                    }
                    valueList.add(processObject(omElement, arrayClassType,
                            helper));
                }
View Full Code Here

            hasRef = true;
            ref = MultirefHelper.getAttvalue(omatribute);
        }
        if (OMElement.class.isAssignableFrom(classType)) {
            if (hasRef) {
                OMElement elemnt = helper.getOMElement(ref);
                if (elemnt == null) {
                    return helper.processOMElementRef(ref);
                } else {
                    return omElement;
                }
View Full Code Here

                        objects.add(o.toString());
                    } else {
                        objects.add(new QName("item" + argCount));
                        if (o instanceof OMElement) {
                            OMFactory fac = OMAbstractFactory.getOMFactory();
                            OMElement wrappingElement;
                            if (partName == null) {
                                wrappingElement = fac.createOMElement("item" + argCount, null);
                                wrappingElement.addChild((OMElement) o);
                            } else {
                                wrappingElement = fac.createOMElement(partName, null);
                                wrappingElement.addChild((OMElement) o);
                            }
                            objects.add(wrappingElement);
                        } else {
                            objects.add(o);
                        }
                    }
                }
            } else {
                if (SimpleTypeMapper.isSimpleType(arg)) {
                    if (partName == null) {
                        objects.add("arg" + argCount);
                    } else {
                        objects.add(partName);
                    }
                    objects.add(arg.toString());
                } else {
                    if (partName == null) {
                        objects.add(new QName("arg" + argCount));
                    } else {
                        objects.add(new QName(partName));
                    }
                    if (arg instanceof OMElement) {
                        OMFactory fac = OMAbstractFactory.getOMFactory();
                        OMElement wrappingElement;
                        if (partName == null) {
                            wrappingElement = fac.createOMElement("arg" + argCount, null);
                            wrappingElement.addChild((OMElement) arg);
                        } else {
                            wrappingElement = fac.createOMElement(partName, null);
                            wrappingElement.addChild((OMElement) arg);
                        }
                        objects.add(wrappingElement);
                    } else {
                        objects.add(arg);
                    }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.om.OMElement

Copyright © 2018 www.massapicom. 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.