Search in sources :

Example 41 with TypeCode

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;
}
Also used : TypeCode(org.omg.CORBA.TypeCode) IDLType(org.omg.CORBA.IDLType) StructMember(org.omg.CORBA.StructMember)

Example 42 with TypeCode

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);
    }
}
Also used : TypeCode(org.omg.CORBA.TypeCode) ExceptionAnalysis(org.wildfly.iiop.openjdk.rmi.ExceptionAnalysis) OperationAnalysis(org.wildfly.iiop.openjdk.rmi.OperationAnalysis) ParameterAnalysis(org.wildfly.iiop.openjdk.rmi.ParameterAnalysis) ExceptionDef(org.omg.CORBA.ExceptionDef) ParameterDescription(org.omg.CORBA.ParameterDescription)

Example 43 with TypeCode

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;
}
Also used : TypeCode(org.omg.CORBA.TypeCode) ValueAnalysis(org.wildfly.iiop.openjdk.rmi.ValueAnalysis) ValueMemberAnalysis(org.wildfly.iiop.openjdk.rmi.ValueMemberAnalysis)

Example 44 with TypeCode

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;
}
Also used : TypeCode(org.omg.CORBA.TypeCode)

Example 45 with TypeCode

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);
    }
}
Also used : TypeCode(org.omg.CORBA.TypeCode) ConstantAnalysis(org.wildfly.iiop.openjdk.rmi.ConstantAnalysis) Any(org.omg.CORBA.Any)

Aggregations

TypeCode (org.omg.CORBA.TypeCode)69 QName (javax.xml.namespace.QName)49 Test (org.junit.Test)44 CorbaPrimitiveHandler (org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler)18 InputStream (org.omg.CORBA.portable.InputStream)15 OutputStream (org.omg.CORBA.portable.OutputStream)14 StructMember (org.omg.CORBA.StructMember)9 CorbaBindingException (org.apache.cxf.binding.corba.CorbaBindingException)6 MemberType (org.apache.cxf.binding.corba.wsdl.MemberType)6 Any (org.omg.CORBA.Any)6 NVList (org.omg.CORBA.NVList)6 CorbaStreamable (org.apache.cxf.binding.corba.CorbaStreamable)5 CorbaObjectHandler (org.apache.cxf.binding.corba.types.CorbaObjectHandler)4 Array (org.apache.cxf.binding.corba.wsdl.Array)4 Enum (org.apache.cxf.binding.corba.wsdl.Enum)4 Enumerator (org.apache.cxf.binding.corba.wsdl.Enumerator)4 Sequence (org.apache.cxf.binding.corba.wsdl.Sequence)4 Struct (org.apache.cxf.binding.corba.wsdl.Struct)4 IOException (java.io.IOException)3 Alias (org.apache.cxf.binding.corba.wsdl.Alias)3