use of org.omg.CORBA.TypeCode in project wildfly by wildfly.
the class InterfaceRepository method addTypeCode.
/**
* Add a new IDL TypeCode for a mapped class.
*
* @param cls The Java class denoting the java type.
* @param typeCode The IDL type code of the mapped java class.
*/
private void addTypeCode(Class cls, TypeCode typeCode) throws IRConstructionException {
if (cls == null)
throw IIOPLogger.ROOT_LOGGER.invalidNullClass();
TypeCode tc = (TypeCode) typeCodeMap.get(cls);
if (tc != null)
throw IIOPLogger.ROOT_LOGGER.duplicateTypeCodeForClass(cls.getName());
typeCodeMap.put(cls, typeCode);
}
use of org.omg.CORBA.TypeCode in project wildfly by wildfly.
the class InterfaceRepository method getJavaIoSerializable.
/**
* Get a reference to the special case mapping for java.io.Serializable.
* This is according to "Java(TM) Language to IDL Mapping Specification",
* section 1.3.10.1
*/
private AliasDefImpl getJavaIoSerializable() throws IRConstructionException {
if (javaIoSerializable == null) {
final String id = "IDL:java/io/Serializable:1.0";
final String name = "Serializable";
final String version = "1.0";
// Get module to add typedef to.
ModuleDefImpl m = ensurePackageExists("java.io");
TypeCode typeCode = orb.create_alias_tc(id, name, orb.get_primitive_tc(TCKind.tk_any));
// TypeCode typeCode = new TypeCodeImpl(TCKind._tk_alias, id, name,
// new TypeCodeImpl(TCKind.tk_any));
javaIoSerializable = new AliasDefImpl(id, name, version, m, typeCode, impl);
m.add(name, javaIoSerializable);
}
return javaIoSerializable;
}
use of org.omg.CORBA.TypeCode in project wildfly by wildfly.
the class InterfaceRepository method getTypeCode.
/**
* Returns the TypeCode IDL TypeCodes for parameter, result, attribute
* and value member types.
* This may provoke a mapping of the class argument.
* <p/>
* Exception classes map to both values and exceptions. For these, this
* method returns the typecode for the value, and you can use the
* <code>getExceptionTypeCode</code> TODO method to get the typecode for the
* mapping to exception.
*
* @param cls The Java class denoting the java type.
*/
private TypeCode getTypeCode(Class cls) throws IRConstructionException, RMIIIOPViolationException {
if (cls == null)
throw IIOPLogger.ROOT_LOGGER.invalidNullClass();
TypeCode ret = (TypeCode) typeCodeMap.get(cls);
if (ret == null) {
if (cls == java.lang.String.class)
ret = getJavaLangString().type();
else if (cls == java.lang.Object.class)
ret = getJavaLang_Object().type();
else if (cls == java.lang.Class.class)
ret = getJavaxRmiCORBAClassDesc().type();
else if (cls == java.io.Serializable.class)
ret = getJavaIoSerializable().type();
else if (cls == java.io.Externalizable.class)
ret = getJavaIoExternalizable().type();
else {
// Try adding a mapping of the the class to the IR
addClass(cls);
// Lookup again, it should be there now.
ret = (TypeCode) typeCodeMap.get(cls);
if (ret == null)
throw IIOPLogger.ROOT_LOGGER.unknownTypeCodeForClass(cls.getName());
else
return ret;
}
typeCodeMap.put(cls, ret);
}
return ret;
}
use of org.omg.CORBA.TypeCode in project wildfly by wildfly.
the class ExceptionDefImpl method members.
public StructMember[] members() {
if (members == null) {
TypeCode type = vDef.type();
LocalIDLType localTypeDef = IDLTypeImpl.getIDLType(type, repository);
IDLType type_def = IDLTypeHelper.narrow(localTypeDef.getReference());
members = new StructMember[1];
members[0] = new StructMember("value", type, type_def);
}
return members;
}
use of org.omg.CORBA.TypeCode in project cxf by apache.
the class CorbaObjectReader method readFixed.
public void readFixed(CorbaFixedHandler fixedHandler) throws CorbaBindingException {
long scale = fixedHandler.getScale();
try {
java.math.BigDecimal fixedValue = stream.read_fixed().movePointLeft((int) scale);
fixedHandler.setValue(fixedValue);
} catch (NO_IMPLEMENT ex) {
// Some of them have a "read_fixed(TypeCode)" method, we'll try that
try {
Method m = stream.getClass().getMethod("read_fixed", new Class[] { TypeCode.class });
BigDecimal fixedValue = (BigDecimal) m.invoke(stream, new Object[] { fixedHandler.getTypeCode() });
fixedHandler.setValue(fixedValue);
} catch (Throwable e1) {
throw ex;
}
}
}
Aggregations