Search in sources :

Example 11 with CorbaBindingException

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

the class CorbaBindingHelper method getDefaultORB.

public static synchronized ORB getDefaultORB(OrbConfig config) {
    if (defaultORB == null) {
        Properties props = System.getProperties();
        Properties configSpecifiedOrbProperties = config.getOrbProperties();
        props.putAll(configSpecifiedOrbProperties);
        if (config.getOrbClass() != null) {
            props.put("org.omg.CORBA.ORBClass", config.getOrbClass());
        }
        if (config.getOrbSingletonClass() != null) {
            props.put("org.omg.CORBA.ORBSingletonClass", config.getOrbSingletonClass());
        }
        List<String> orbArgs = config.getOrbArgs();
        defaultORB = ORB.init(orbArgs.toArray(new String[orbArgs.size()]), props);
        if (defaultORB == null) {
            LOG.severe("Could not create instance of the ORB");
            throw new CorbaBindingException("Could not create instance of the ORB");
        }
    }
    return defaultORB;
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) Properties(java.util.Properties)

Example 12 with CorbaBindingException

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

the class CorbaUtils method getTypeCode.

public static TypeCode getTypeCode(ORB orb, QName type, CorbaType obj, CorbaTypeMap typeMap, Stack<QName> seenTypes) {
    if (type == null) {
        throw new CorbaBindingException("corba:typemap type or elemtype information required" + (obj == null ? "" : " for " + obj) + (seenTypes.empty() ? "" : ", Enclosing type: " + seenTypes.elementAt(0)));
    }
    TypeCode tc = null;
    // first see if it is a primitive
    tc = getPrimitiveTypeCode(orb, type);
    if (tc == null && type.equals(CorbaConstants.NT_CORBA_ANY)) {
        // Anys are handled in a special way
        tc = orb.get_primitive_tc(TCKind.from_int(TCKind._tk_any));
    } else if (tc == null) {
        if (typeMap == null) {
            throw new CorbaBindingException("Unable to locate typemap for namespace \"" + type.getNamespaceURI() + "\"");
        }
        tc = typeMap.getTypeCode(type);
        if (tc == null) {
            if (obj == null) {
                obj = typeMap.getType(type.getLocalPart());
                if (obj == null) {
                    throw new CorbaBindingException("Unable to locate object definition");
                }
            }
            tc = getComplexTypeCode(orb, type, obj, typeMap, seenTypes);
            if (tc != null) {
                typeMap.addTypeCode(type, tc);
            }
        }
    }
    if (tc == null) {
        throw new CorbaBindingException("Corba type node with qname " + type + " is not supported");
    }
    return tc;
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) TypeCode(org.omg.CORBA.TypeCode)

Example 13 with CorbaBindingException

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

the class OrbConfig method exportObjectReferenceToCorbaloc.

public void exportObjectReferenceToCorbaloc(ORB orb, org.omg.CORBA.Object object, String location) {
    int keyIndex = location.indexOf('/');
    String key = location.substring(keyIndex + 1);
    try {
        Class<?> bootMgrHelperClass = Class.forName("org.apache.yoko.orb.OB.BootManagerHelper");
        Class<?> bootMgrClass = Class.forName("org.apache.yoko.orb.OB.BootManager");
        Method narrowMethod = bootMgrHelperClass.getMethod("narrow", org.omg.CORBA.Object.class);
        java.lang.Object bootMgr = narrowMethod.invoke(null, orb.resolve_initial_references("BootManager"));
        Method addBindingMethod = bootMgrClass.getMethod("add_binding", byte[].class, org.omg.CORBA.Object.class);
        addBindingMethod.invoke(bootMgr, key.getBytes(), object);
    } catch (ClassNotFoundException ex) {
    // Not supported by the orb. skip it.
    } catch (java.lang.reflect.InvocationTargetException ex) {
    // Not supported by the orb. skip it.
    } catch (java.lang.Exception ex) {
        throw new CorbaBindingException(ex.getMessage(), ex);
    }
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) Method(java.lang.reflect.Method)

Example 14 with CorbaBindingException

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

the class OrbConfig method exportObjectReferenceToNamingService.

public void exportObjectReferenceToNamingService(ORB orb, org.omg.CORBA.Object ref, String location) {
    int idx = location.indexOf("#");
    String name = location.substring(idx + 1);
    // Register in NameService
    try {
        org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
        NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
        NameComponent[] nc = rootContext.to_name(name);
        rootContext.rebind(nc, ref);
    } catch (Exception ex) {
        throw new CorbaBindingException(ex);
    }
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) NameComponent(org.omg.CosNaming.NameComponent) NamingContextExt(org.omg.CosNaming.NamingContextExt) URISyntaxException(java.net.URISyntaxException) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException) CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException)

Example 15 with CorbaBindingException

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

the class CorbaStreamFaultInInterceptor method getDataReader.

protected DataReader<XMLStreamReader> getDataReader(CorbaMessage message) {
    Service serviceModel = ServiceModelUtil.getService(message.getExchange());
    DataReader<XMLStreamReader> dataReader = serviceModel.getDataBinding().createReader(XMLStreamReader.class);
    if (dataReader == null) {
        throw new CorbaBindingException("Couldn't create data reader for incoming fault message");
    }
    return dataReader;
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) XMLStreamReader(javax.xml.stream.XMLStreamReader) Service(org.apache.cxf.service.Service)

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