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;
}
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;
}
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);
}
}
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);
}
}
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;
}
Aggregations