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