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 wildfly by wildfly.
the class InterfaceRepository method addOperations.
/**
* Add a set of operations to a container (interface or value class).
*/
private void addOperations(LocalContainer container, ContainerAnalysis ca) throws RMIIIOPViolationException, IRConstructionException {
OperationAnalysis[] ops = ca.getOperations();
for (int i = 0; i < ops.length; ++i) {
OperationDefImpl oDef;
String oName = ops[i].getIDLName();
String oid = ca.getMemberRepositoryId(oName);
Class cls = ops[i].getReturnType();
TypeCode typeCode = getTypeCode(cls);
ParameterAnalysis[] ps = ops[i].getParameters();
ParameterDescription[] params = new ParameterDescription[ps.length];
for (int j = 0; j < ps.length; ++j) {
params[j] = new ParameterDescription(ps[j].getIDLName(), getTypeCode(ps[j].getCls()), // filled in later
null, ParameterMode.PARAM_IN);
}
ExceptionAnalysis[] exc = ops[i].getMappedExceptions();
ExceptionDef[] exceptions = new ExceptionDef[exc.length];
for (int j = 0; j < exc.length; ++j) {
ExceptionDefImpl e = addException(exc[j]);
exceptions[j] = ExceptionDefHelper.narrow(e.getReference());
}
oDef = new OperationDefImpl(oid, oName, "1.0", container, typeCode, params, exceptions, impl);
container.add(oName, oDef);
}
}
use of org.omg.CORBA.TypeCode in project wildfly by wildfly.
the class InterfaceRepository method addValue.
/**
* Add a value type.
*/
private ValueDefImpl addValue(ValueAnalysis va) throws RMIIIOPViolationException, IRConstructionException {
ValueDefImpl vDef;
Class cls = va.getCls();
// Lookup: Has it already been added?
vDef = (ValueDefImpl) valueMap.get(cls);
if (vDef != null)
// Yes, just return it.
return vDef;
// Get module to add value to.
ModuleDefImpl m = ensurePackageExists(cls.getPackage().getName());
// Add implemented interfaces
String[] supported_interfaces = addInterfaces(va);
// Add abstract base valuetypes
String[] abstract_base_valuetypes = addAbstractBaseValuetypes(va);
// Add superclass
ValueDefImpl superValue = null;
ValueAnalysis superAnalysis = va.getSuperAnalysis();
if (superAnalysis != null)
superValue = addValue(superAnalysis);
// Create the value
String base = cls.getName();
base = base.substring(base.lastIndexOf('.') + 1);
base = Util.javaToIDLName(base);
TypeCode baseTypeCode;
if (superValue == null)
baseTypeCode = orb.get_primitive_tc(TCKind.tk_null);
else
baseTypeCode = superValue.type();
vDef = new ValueDefImpl(va.getRepositoryId(), base, "1.0", m, va.isAbstractValue(), va.isCustom(), supported_interfaces, abstract_base_valuetypes, baseTypeCode, impl);
addTypeCode(cls, vDef.type());
m.add(base, vDef);
// Remember we mapped this.
valueMap.put(cls, vDef);
// Fill in constants.
addConstants(vDef, va);
// Add value members
ValueMemberAnalysis[] vmas = va.getMembers();
for (int i = 0; i < vmas.length; ++i) {
ValueMemberDefImpl vmDef;
String vmid = va.getMemberRepositoryId(vmas[i].getJavaName());
String vmName = vmas[i].getIDLName();
Class vmCls = vmas[i].getCls();
TypeCode typeCode = getTypeCode(vmCls);
boolean vmPublic = vmas[i].isPublic();
vmDef = new ValueMemberDefImpl(vmid, vmName, "1.0", typeCode, vmPublic, vDef, impl);
vDef.add(vmName, vmDef);
}
// Add attributes
addAttributes(vDef, va);
return vDef;
}
use of org.omg.CORBA.TypeCode in project wildfly by wildfly.
the class InterfaceRepository method getJavaLang_Object.
/**
* Get a reference to the special case mapping for java.lang.Object.
* This is according to "Java(TM) Language to IDL Mapping Specification",
* section 1.3.10.2
*/
private AliasDefImpl getJavaLang_Object() throws IRConstructionException {
if (javaLang_Object == null) {
final String id = "IDL:java/lang/_Object:1.0";
final String name = "_Object";
final String version = "1.0";
// Get module to add typedef to.
ModuleDefImpl m = ensurePackageExists("java.lang");
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));
javaLang_Object = new AliasDefImpl(id, name, version, m, typeCode, impl);
m.add(name, javaLang_Object);
}
return javaLang_Object;
}
use of org.omg.CORBA.TypeCode in project wildfly by wildfly.
the class InterfaceRepository method addConstants.
/**
* Add a set of constants to a container (interface or value class).
*/
private void addConstants(LocalContainer container, ContainerAnalysis ca) throws RMIIIOPViolationException, IRConstructionException {
ConstantAnalysis[] consts = ca.getConstants();
for (int i = 0; i < consts.length; ++i) {
ConstantDefImpl cDef;
String cid = ca.getMemberRepositoryId(consts[i].getJavaName());
String cName = consts[i].getIDLName();
Class cls = consts[i].getType();
TypeCode typeCode = getConstantTypeCode(cls);
Any value = orb.create_any();
consts[i].insertValue(value);
cDef = new ConstantDefImpl(cid, cName, "1.0", typeCode, value, container, impl);
container.add(cName, cDef);
}
}
Aggregations