Search in sources :

Example 6 with TypeEntry

use of org.apache.axis.wsdl.symbolTable.TypeEntry in project Lucee by lucee.

the class AxisCaster method _initPojo.

private static void _initPojo(PageContext pc, TypeEntry typeEntry, QName type, Pojo pojo, Property[] props, Struct sct, Component comp, TypeMapping tm, Set<Object> done) throws PageException {
    Property p;
    Object v;
    Collection.Key k;
    CFMLExpressionInterpreter interpreter = new CFMLExpressionInterpreter(false);
    for (int i = 0; i < props.length; i++) {
        p = props[i];
        k = Caster.toKey(p.getName());
        // value
        v = sct.get(k, null);
        if (v == null && comp != null)
            v = comp.get(k, null);
        if (v != null)
            v = Caster.castTo(pc, p.getType(), v, false);
        else {
            if (!StringUtil.isEmpty(p.getDefault())) {
                try {
                    v = Caster.castTo(pc, p.getType(), p.getDefault(), false);
                } catch (PageException pe) {
                    try {
                        v = interpreter.interpret(pc, p.getDefault());
                        v = Caster.castTo(pc, p.getType(), v, false);
                    } catch (PageException pe2) {
                        throw new ExpressionException("can not use default value [" + p.getDefault() + "] for property [" + p.getName() + "] with type [" + p.getType() + "]");
                    }
                }
            }
        }
        // set or throw
        if (v == null) {
            if (p.isRequired())
                throw new ExpressionException("required property [" + p.getName() + "] is not defined");
        } else {
            TypeEntry childTE = null;
            QName childT = null;
            if (typeEntry != null) {
                childTE = AxisUtil.getContainedElement(typeEntry, p.getName(), null);
                if (childTE != null)
                    childT = childTE.getQName();
            }
            Reflector.callSetter(pojo, p.getName().toLowerCase(), _toAxisType(tm, null, childTE, childT, null, v, done));
        }
    }
}
Also used : Key(lucee.runtime.type.Collection.Key) PageException(lucee.runtime.exp.PageException) QName(javax.xml.namespace.QName) Collection(lucee.runtime.type.Collection) CFMLExpressionInterpreter(lucee.runtime.interpreter.CFMLExpressionInterpreter) Property(lucee.runtime.component.Property) ExpressionException(lucee.runtime.exp.ExpressionException) TypeEntry(org.apache.axis.wsdl.symbolTable.TypeEntry)

Example 7 with TypeEntry

use of org.apache.axis.wsdl.symbolTable.TypeEntry in project Lucee by lucee.

the class Axis1Client method map.

private Class map(PageContext pc, SymbolTable symbolTable, Config secondChanceConfig, org.apache.axis.encoding.TypeMapping tm, TypeEntry type) throws PageException {
    TypeEntry ref = type.getRefType();
    if (ref != null && ref != type) {
        map(pc, symbolTable, secondChanceConfig, tm, ref);
    }
    // Simple Type
    if (type.getContainedElements() == null)
        return null;
    // is class already registered!
    // Class clazz=tm.getClassForQName(type.getQName());
    // if(clazz!=null && clazz.getName().equals(getClientClassName(type))) return clazz;
    Class clazz = mapComplex(pc, symbolTable, secondChanceConfig, tm, type);
    // TODO make a better impl; this is not the fastest way to make sure all pojos use the same classloader
    if (clazz != null && getClassLoader(pc, secondChanceConfig) != clazz.getClassLoader()) {
        clazz = mapComplex(pc, symbolTable, secondChanceConfig, tm, type);
    }
    return clazz;
}
Also used : TypeEntry(org.apache.axis.wsdl.symbolTable.TypeEntry)

Example 8 with TypeEntry

use of org.apache.axis.wsdl.symbolTable.TypeEntry in project Lucee by lucee.

the class Axis1Client method mapComplex.

private Class mapComplex(PageContext pc, SymbolTable symbolTable, Config secondChanceConfig, org.apache.axis.encoding.TypeMapping tm, TypeEntry type) throws PageException {
    TypeEntry ref = type.getRefType();
    if (ref == null)
        return _mapComplex(pc, symbolTable, secondChanceConfig, tm, type);
    // Array
    if (ref.getContainedElements() == null)
        return null;
    Class clazz = mapComplex(pc, symbolTable, secondChanceConfig, tm, ref);
    if (clazz == null)
        return null;
    Class arr = ClassUtil.toArrayClass(clazz);
    TypeMappingUtil.registerBeanTypeMapping(tm, arr, type.getQName());
    return arr;
}
Also used : TypeEntry(org.apache.axis.wsdl.symbolTable.TypeEntry)

Aggregations

TypeEntry (org.apache.axis.wsdl.symbolTable.TypeEntry)8 QName (javax.xml.namespace.QName)4 ArrayList (java.util.ArrayList)3 Key (lucee.runtime.type.Collection.Key)3 Entry (java.util.Map.Entry)2 Vector (java.util.Vector)2 Property (lucee.runtime.component.Property)2 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 TimeZone (java.util.TimeZone)1 Binding (javax.wsdl.Binding)1 Operation (javax.wsdl.Operation)1 Port (javax.wsdl.Port)1 Deserializer (javax.xml.rpc.encoding.Deserializer)1 DeserializerFactory (javax.xml.rpc.encoding.DeserializerFactory)1 TypeMapping (javax.xml.rpc.encoding.TypeMapping)1 ClassException (lucee.commons.lang.ClassException)1 PhysicalClassLoader (lucee.commons.lang.PhysicalClassLoader)1