Search in sources :

Example 6 with CorbaBindingException

use of org.apache.cxf.binding.corba.CorbaBindingException in project cxf by apache.

the class CorbaStreamableImpl method _write.

public void _write(OutputStream ostream) {
    try {
        CorbaObjectWriter writer = new CorbaObjectWriter(ostream);
        writer.write(value);
    } catch (java.lang.Exception ex) {
        throw new CorbaBindingException("Error writing streamable value", ex);
    }
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException)

Example 7 with CorbaBindingException

use of org.apache.cxf.binding.corba.CorbaBindingException in project cxf by apache.

the class CorbaStreamableImpl method _read.

public void _read(InputStream istream) {
    try {
        CorbaObjectReader reader = new CorbaObjectReader(istream);
        reader.read(value);
    } catch (java.lang.Exception ex) {
        throw new CorbaBindingException("Error reading streamable value", ex);
    }
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException)

Example 8 with CorbaBindingException

use of org.apache.cxf.binding.corba.CorbaBindingException in project cxf by apache.

the class CorbaHandlerUtils method getTypeListener.

public static CorbaTypeListener getTypeListener(QName name, QName idlType, CorbaTypeMap typeMap, ORB orb, ServiceInfo serviceInfo) throws CorbaBindingException {
    CorbaObjectHandler handler = null;
    TypeCode tc = CorbaUtils.getTypeCode(orb, idlType, typeMap);
    try {
        while (tc.kind().value() == TCKind._tk_alias) {
            Alias alias = (Alias) CorbaUtils.getCorbaType(idlType, typeMap);
            if (alias == null) {
                throw new CorbaBindingException("Couldn't find corba alias type: " + idlType);
            }
            tc = tc.content_type();
            idlType = alias.getBasetype();
        }
    } catch (Throwable ex) {
        throw new CorbaBindingException(ex);
    }
    CorbaTypeListener result = null;
    if (CorbaUtils.isPrimitiveIdlType(idlType)) {
        handler = new CorbaPrimitiveHandler(name, idlType, tc, null);
        result = new CorbaPrimitiveListener(handler);
    } else {
        CorbaType type = CorbaUtils.getCorbaType(idlType, typeMap);
        switch(tc.kind().value()) {
            case TCKind._tk_any:
                handler = new CorbaAnyHandler(name, idlType, tc, type);
                ((CorbaAnyHandler) handler).setTypeMap(typeMap);
                result = new CorbaAnyListener(handler, typeMap, orb, serviceInfo);
                break;
            case TCKind._tk_array:
                handler = new CorbaArrayHandler(name, idlType, tc, type);
                result = new CorbaArrayListener(handler, typeMap, orb, serviceInfo);
                break;
            case TCKind._tk_enum:
                handler = new CorbaEnumHandler(name, idlType, tc, type);
                result = new CorbaEnumListener(handler);
                break;
            case TCKind._tk_except:
                handler = new CorbaExceptionHandler(name, idlType, tc, type);
                result = new CorbaExceptionListener(handler, typeMap, orb, serviceInfo);
                break;
            case TCKind._tk_fixed:
                handler = new CorbaFixedHandler(name, idlType, tc, type);
                result = new CorbaFixedListener(handler);
                break;
            case TCKind._tk_sequence:
                if (isOctets(type)) {
                    handler = new CorbaOctetSequenceHandler(name, idlType, tc, type);
                    result = new CorbaOctetSequenceListener(handler);
                } else {
                    handler = new CorbaSequenceHandler(name, idlType, tc, type);
                    result = new CorbaSequenceListener(handler, typeMap, orb, serviceInfo);
                }
                break;
            case TCKind._tk_string:
            case TCKind._tk_wstring:
                // These can be handled just like regular strings
                handler = new CorbaPrimitiveHandler(name, idlType, tc, type);
                result = new CorbaPrimitiveListener(handler);
                break;
            case TCKind._tk_struct:
                handler = new CorbaStructHandler(name, idlType, tc, type);
                result = new CorbaStructListener(handler, typeMap, orb, serviceInfo);
                break;
            case TCKind._tk_union:
                handler = new CorbaUnionHandler(name, idlType, tc, type);
                result = new CorbaUnionListener(handler, typeMap, orb, serviceInfo);
                break;
            case TCKind._tk_objref:
                handler = new CorbaObjectReferenceHandler(name, idlType, tc, type);
                result = new CorbaObjectReferenceListener(handler, orb);
                break;
            default:
                throw new CorbaBindingException("Unsupported complex type " + idlType);
        }
    }
    return result;
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) TypeCode(org.omg.CORBA.TypeCode) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Alias(org.apache.cxf.binding.corba.wsdl.Alias)

Example 9 with CorbaBindingException

use of org.apache.cxf.binding.corba.CorbaBindingException in project cxf by apache.

the class CorbaHandlerUtils method getTypeEventProducer.

public static CorbaTypeEventProducer getTypeEventProducer(CorbaObjectHandler handler, ServiceInfo serviceInfo, ORB orb) throws CorbaBindingException {
    QName idlType = handler.getIdlType();
    TypeCode tc = handler.getTypeCode();
    CorbaTypeEventProducer result = null;
    if (CorbaUtils.isPrimitiveIdlType(idlType)) {
        result = new CorbaPrimitiveTypeEventProducer(handler);
    } else {
        switch(tc.kind().value()) {
            case TCKind._tk_any:
                result = new CorbaAnyEventProducer(handler, serviceInfo, orb);
                break;
            case TCKind._tk_array:
                result = new CorbaArrayEventProducer(handler, serviceInfo, orb);
                break;
            case TCKind._tk_enum:
                result = new CorbaEnumEventProducer(handler);
                break;
            case TCKind._tk_except:
                result = new CorbaExceptionEventProducer(handler, serviceInfo, orb);
                break;
            case TCKind._tk_fixed:
                result = new CorbaFixedEventProducer(handler);
                break;
            case TCKind._tk_sequence:
                if (isOctets(handler.getType())) {
                    result = new CorbaOctetSequenceEventProducer(handler);
                } else {
                    result = new CorbaSequenceEventProducer(handler, serviceInfo, orb);
                }
                break;
            case TCKind._tk_string:
            case TCKind._tk_wstring:
                // These can be handled just like regular strings
                result = new CorbaPrimitiveTypeEventProducer(handler);
                break;
            case TCKind._tk_struct:
                if (handler.isAnonymousType()) {
                    result = new CorbaAnonStructEventProducer(handler, serviceInfo, orb);
                } else {
                    result = new CorbaStructEventProducer(handler, serviceInfo, orb);
                }
                break;
            case TCKind._tk_union:
                result = new CorbaUnionEventProducer(handler, serviceInfo, orb);
                break;
            case TCKind._tk_objref:
                result = new CorbaObjectReferenceEventProducer(handler, serviceInfo, orb);
                break;
            default:
                throw new CorbaBindingException("Unsupported complex type " + idlType);
        }
    }
    return result;
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) TypeCode(org.omg.CORBA.TypeCode) QName(javax.xml.namespace.QName)

Example 10 with CorbaBindingException

use of org.apache.cxf.binding.corba.CorbaBindingException in project cxf by apache.

the class CorbaHandlerUtils method createTypeHandler.

public static CorbaObjectHandler createTypeHandler(ORB orb, QName name, QName idlType, CorbaTypeMap typeMap) {
    CorbaObjectHandler handler = null;
    TypeCode tc = CorbaUtils.getTypeCode(orb, idlType, typeMap);
    try {
        while (tc.kind().value() == TCKind._tk_alias) {
            Alias alias = (Alias) CorbaUtils.getCorbaType(idlType, typeMap);
            if (alias == null) {
                throw new CorbaBindingException("Couldn't find corba alias type: " + idlType);
            }
            tc = tc.content_type();
            idlType = alias.getBasetype();
        }
    } catch (Throwable ex) {
        throw new CorbaBindingException(ex);
    }
    if (CorbaUtils.isPrimitiveIdlType(idlType)) {
        handler = new CorbaPrimitiveHandler(name, idlType, tc, null);
    } else if (tc.kind().value() == TCKind._tk_any) {
        // Any is a special kind of primitive so it gets its own handler
        handler = new CorbaAnyHandler(name, idlType, tc, null);
        ((CorbaAnyHandler) handler).setTypeMap(typeMap);
    } else {
        CorbaType type = CorbaUtils.getCorbaType(idlType, typeMap);
        switch(tc.kind().value()) {
            case TCKind._tk_array:
                handler = new CorbaArrayHandler(name, idlType, tc, type);
                break;
            case TCKind._tk_enum:
                handler = new CorbaEnumHandler(name, idlType, tc, type);
                break;
            case TCKind._tk_except:
                handler = new CorbaExceptionHandler(name, idlType, tc, type);
                break;
            case TCKind._tk_fixed:
                handler = new CorbaFixedHandler(name, idlType, tc, type);
                break;
            case TCKind._tk_sequence:
                if (isOctets(type)) {
                    handler = new CorbaOctetSequenceHandler(name, idlType, tc, type);
                } else {
                    handler = new CorbaSequenceHandler(name, idlType, tc, type);
                }
                break;
            case TCKind._tk_struct:
                handler = new CorbaStructHandler(name, idlType, tc, type);
                break;
            case TCKind._tk_union:
                handler = new CorbaUnionHandler(name, idlType, tc, type);
                break;
            case TCKind._tk_string:
            case TCKind._tk_wstring:
                // These need to be here to catch the anonymous string types.
                handler = new CorbaPrimitiveHandler(name, idlType, tc, type);
                break;
            case TCKind._tk_objref:
                handler = new CorbaObjectReferenceHandler(name, idlType, tc, type);
                break;
            default:
                handler = new CorbaObjectHandler(name, idlType, tc, type);
        }
    }
    return handler;
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) TypeCode(org.omg.CORBA.TypeCode) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Alias(org.apache.cxf.binding.corba.wsdl.Alias)

Aggregations

CorbaBindingException (org.apache.cxf.binding.corba.CorbaBindingException)25 QName (javax.xml.namespace.QName)8 TypeCode (org.omg.CORBA.TypeCode)5 URISyntaxException (java.net.URISyntaxException)4 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)4 CorbaMessage (org.apache.cxf.binding.corba.CorbaMessage)3 CorbaObjectHandler (org.apache.cxf.binding.corba.types.CorbaObjectHandler)3 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)3 SystemException (org.omg.CORBA.SystemException)3 Method (java.lang.reflect.Method)2 URI (java.net.URI)2 XMLStreamReader (javax.xml.stream.XMLStreamReader)2 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)2 CorbaStreamable (org.apache.cxf.binding.corba.CorbaStreamable)2 Alias (org.apache.cxf.binding.corba.wsdl.Alias)2 Enum (org.apache.cxf.binding.corba.wsdl.Enum)2 Enumerator (org.apache.cxf.binding.corba.wsdl.Enumerator)2 OperationType (org.apache.cxf.binding.corba.wsdl.OperationType)2 Fault (org.apache.cxf.interceptor.Fault)2 Exchange (org.apache.cxf.message.Exchange)2