Java Code Examples for org.omg.CORBA.TCKind#_tk_any

The following examples show how to use org.omg.CORBA.TCKind#_tk_any . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynAnyBasicImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 2
Source File: DynAnyBasicImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 3
Source File: DynAnyBasicImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example 4
Source File: DynAnyBasicImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.Any get_any()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    return any.extract_any();
}
 
Example 5
Source File: DynAnyBasicImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.Any get_any()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    return any.extract_any();
}
 
Example 6
Source File: DynAnyBasicImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    any.insert_any(value.to_any());
}
 
Example 7
Source File: DynAnyBasicImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.Any get_any()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    return any.extract_any();
}
 
Example 8
Source File: DynAnyBasicImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void insert_any(org.omg.CORBA.Any value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    any.insert_any(value);
}
 
Example 9
Source File: DynAnyBasicImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    any.insert_any(value.to_any());
}
 
Example 10
Source File: DynAnyBasicImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void insert_any(org.omg.CORBA.Any value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    any.insert_any(value);
}
 
Example 11
Source File: TypeCodeImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private void printStream(PrintStream s, int level) {
    if (_kind == tk_indirect) {
        s.print("indirect " + _id);
        return;
    }

    switch (_kind) {
        case TCKind._tk_null:
        case TCKind._tk_void:
        case TCKind._tk_short:
        case TCKind._tk_long:
        case TCKind._tk_ushort:
        case TCKind._tk_ulong:
        case TCKind._tk_float:
        case TCKind._tk_double:
        case TCKind._tk_boolean:
        case TCKind._tk_char:
        case TCKind._tk_octet:
        case TCKind._tk_any:
        case TCKind._tk_TypeCode:
        case TCKind._tk_Principal:
        case TCKind._tk_objref:
        case TCKind._tk_longlong:
        case TCKind._tk_ulonglong:
        case TCKind._tk_longdouble:
        case TCKind._tk_wchar:
        case TCKind._tk_native:
            s.print(kindNames[_kind] + " " + _name);
            break;

        case TCKind._tk_struct:
        case TCKind._tk_except:
        case TCKind._tk_value:
            s.println(kindNames[_kind] + " " + _name + " = {");
            for(int i=0; i<_memberCount; i++) {
                // memberName might differ from the name of the member.
                s.print(indent(level + 1));
                if (_memberTypes[i] != null)
                    _memberTypes[i].printStream(s, level + 1);
                else
                    s.print("<unknown type>");
                s.println(" " + _memberNames[i] + ";");
            }
            s.print(indent(level) + "}");
            break;

        case TCKind._tk_union:
            s.print("union " + _name + "...");
            break;

        case TCKind._tk_enum:
            s.print("enum " + _name + "...");
            break;

        case TCKind._tk_string:
            if (_length == 0)
                s.print("unbounded string " + _name);
            else
                s.print("bounded string(" + _length + ") " + _name);
            break;

        case TCKind._tk_sequence:
        case TCKind._tk_array:
            s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {");
            s.print(indent(level + 1));
            if (lazy_content_type() != null) {
                lazy_content_type().printStream(s, level + 1);
            }
            s.println(indent(level) + "}");
            break;

        case TCKind._tk_alias:
            s.print("alias " + _name + " = " +
                (_contentType != null ? _contentType._name : "<unresolved>"));
            break;

        case TCKind._tk_wstring:
            s.print("wstring[" + _length + "] " + _name);
            break;

        case TCKind._tk_fixed:
            s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
            break;

        case TCKind._tk_value_box:
            s.print("valueBox " + _name + "...");
            break;

        case TCKind._tk_abstract_interface:
            s.print("abstractInterface " + _name + "...");
            break;

        default:
            s.print("<unknown type>");
            break;
    }
}
 
Example 12
Source File: TypeCodeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void printStream(PrintStream s, int level) {
    if (_kind == tk_indirect) {
        s.print("indirect " + _id);
        return;
    }

    switch (_kind) {
        case TCKind._tk_null:
        case TCKind._tk_void:
        case TCKind._tk_short:
        case TCKind._tk_long:
        case TCKind._tk_ushort:
        case TCKind._tk_ulong:
        case TCKind._tk_float:
        case TCKind._tk_double:
        case TCKind._tk_boolean:
        case TCKind._tk_char:
        case TCKind._tk_octet:
        case TCKind._tk_any:
        case TCKind._tk_TypeCode:
        case TCKind._tk_Principal:
        case TCKind._tk_objref:
        case TCKind._tk_longlong:
        case TCKind._tk_ulonglong:
        case TCKind._tk_longdouble:
        case TCKind._tk_wchar:
        case TCKind._tk_native:
            s.print(kindNames[_kind] + " " + _name);
            break;

        case TCKind._tk_struct:
        case TCKind._tk_except:
        case TCKind._tk_value:
            s.println(kindNames[_kind] + " " + _name + " = {");
            for(int i=0; i<_memberCount; i++) {
                // memberName might differ from the name of the member.
                s.print(indent(level + 1));
                if (_memberTypes[i] != null)
                    _memberTypes[i].printStream(s, level + 1);
                else
                    s.print("<unknown type>");
                s.println(" " + _memberNames[i] + ";");
            }
            s.print(indent(level) + "}");
            break;

        case TCKind._tk_union:
            s.print("union " + _name + "...");
            break;

        case TCKind._tk_enum:
            s.print("enum " + _name + "...");
            break;

        case TCKind._tk_string:
            if (_length == 0)
                s.print("unbounded string " + _name);
            else
                s.print("bounded string(" + _length + ") " + _name);
            break;

        case TCKind._tk_sequence:
        case TCKind._tk_array:
            s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {");
            s.print(indent(level + 1));
            if (lazy_content_type() != null) {
                lazy_content_type().printStream(s, level + 1);
            }
            s.println(indent(level) + "}");
            break;

        case TCKind._tk_alias:
            s.print("alias " + _name + " = " +
                (_contentType != null ? _contentType._name : "<unresolved>"));
            break;

        case TCKind._tk_wstring:
            s.print("wstring[" + _length + "] " + _name);
            break;

        case TCKind._tk_fixed:
            s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
            break;

        case TCKind._tk_value_box:
            s.print("valueBox " + _name + "...");
            break;

        case TCKind._tk_abstract_interface:
            s.print("abstractInterface " + _name + "...");
            break;

        default:
            s.print("<unknown type>");
            break;
    }
}
 
Example 13
Source File: CorbaObjectReader.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void read(CorbaObjectHandler obj) throws CorbaBindingException {
    switch (obj.getTypeCode().kind().value()) {
    case TCKind._tk_boolean:
        ((CorbaPrimitiveHandler)obj).setValue(this.readBoolean());
        break;
    case TCKind._tk_char:
        Character charValue = this.readChar();
        ((CorbaPrimitiveHandler)obj).setValue(charValue);
        break;
    case TCKind._tk_wchar:
        ((CorbaPrimitiveHandler)obj).setValue(this.readWChar());
        break;
    case TCKind._tk_octet:
        Byte octetValue = this.readOctet();
        ((CorbaPrimitiveHandler)obj).setValue(octetValue);
        break;
    case TCKind._tk_short:
        ((CorbaPrimitiveHandler)obj).setValue(this.readShort());
        break;
    case TCKind._tk_ushort:
        ((CorbaPrimitiveHandler)obj).setValue(this.readUShort());
        break;
    case TCKind._tk_long:
        ((CorbaPrimitiveHandler)obj).setValue(this.readLong());
        break;
    case TCKind._tk_ulong:
        ((CorbaPrimitiveHandler)obj).setValue(this.readULong());
        break;
    case TCKind._tk_longlong:
        ((CorbaPrimitiveHandler)obj).setValue(this.readLongLong());
        break;
    case TCKind._tk_ulonglong:
        ((CorbaPrimitiveHandler)obj).setValue(this.readULongLong());
        break;
    case TCKind._tk_float:
        ((CorbaPrimitiveHandler)obj).setValue(this.readFloat());
        break;
    case TCKind._tk_double:
        ((CorbaPrimitiveHandler)obj).setValue(this.readDouble());
        break;
    case TCKind._tk_string:
        ((CorbaPrimitiveHandler)obj).setValue(this.readString());
        break;
    case TCKind._tk_wstring:
        ((CorbaPrimitiveHandler)obj).setValue(this.readWString());
        break;
    case TCKind._tk_any:
        ((CorbaAnyHandler)obj).setValue(this.readAny());
        break;

    // Now for the complex types
    case TCKind._tk_array:
        this.readArray((CorbaArrayHandler)obj);
        break;
    case TCKind._tk_sequence:
        this.readSequence(obj);
        break;
    case TCKind._tk_struct:
        this.readStruct((CorbaStructHandler)obj);
        break;
    case TCKind._tk_enum:
        this.readEnum(obj);
        break;
    case TCKind._tk_except:
        this.readException((CorbaExceptionHandler)obj);
        break;
    case TCKind._tk_fixed:
        this.readFixed((CorbaFixedHandler)obj);
        break;
    case TCKind._tk_union:
        this.readUnion((CorbaUnionHandler)obj);
        break;
    case TCKind._tk_objref:
        this.readObjectReference((CorbaObjectReferenceHandler)obj);
        break;
    default:
        throw new CorbaBindingException("CorbaObjectReader: unhandled TypeCode.Kind: "
                                        + obj.getTypeCode().kind().value());
    }
}
 
Example 14
Source File: ORB.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected ORB()
{
    // Initialize logging first, since it is needed nearly
    // everywhere (for example, in TypeCodeImpl).
    wrapperMap = new ConcurrentHashMap();
    wrapper = ORBUtilSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;
    omgWrapper = OMGSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;

    typeCodeMap = new HashMap();

    primitiveTypeCodeConstants = new TypeCodeImpl[] {
        new TypeCodeImpl(this, TCKind._tk_null),
        new TypeCodeImpl(this, TCKind._tk_void),
        new TypeCodeImpl(this, TCKind._tk_short),
        new TypeCodeImpl(this, TCKind._tk_long),
        new TypeCodeImpl(this, TCKind._tk_ushort),
        new TypeCodeImpl(this, TCKind._tk_ulong),
        new TypeCodeImpl(this, TCKind._tk_float),
        new TypeCodeImpl(this, TCKind._tk_double),
        new TypeCodeImpl(this, TCKind._tk_boolean),
        new TypeCodeImpl(this, TCKind._tk_char),
        new TypeCodeImpl(this, TCKind._tk_octet),
        new TypeCodeImpl(this, TCKind._tk_any),
        new TypeCodeImpl(this, TCKind._tk_TypeCode),
        new TypeCodeImpl(this, TCKind._tk_Principal),
        new TypeCodeImpl(this, TCKind._tk_objref),
        null,       // tk_struct
        null,       // tk_union
        null,       // tk_enum
        new TypeCodeImpl(this, TCKind._tk_string),
        null,       // tk_sequence
        null,       // tk_array
        null,       // tk_alias
        null,       // tk_except
        new TypeCodeImpl(this, TCKind._tk_longlong),
        new TypeCodeImpl(this, TCKind._tk_ulonglong),
        new TypeCodeImpl(this, TCKind._tk_longdouble),
        new TypeCodeImpl(this, TCKind._tk_wchar),
        new TypeCodeImpl(this, TCKind._tk_wstring),
        new TypeCodeImpl(this, TCKind._tk_fixed),
        new TypeCodeImpl(this, TCKind._tk_value),
        new TypeCodeImpl(this, TCKind._tk_value_box),
        new TypeCodeImpl(this, TCKind._tk_native),
        new TypeCodeImpl(this, TCKind._tk_abstract_interface)
    } ;

    monitoringManager =
        MonitoringFactories.getMonitoringManagerFactory( ).
            createMonitoringManager(
            MonitoringConstants.DEFAULT_MONITORING_ROOT,
            MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION);
}
 
Example 15
Source File: TypeCodeImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void printStream(PrintStream s, int level) {
    if (_kind == tk_indirect) {
        s.print("indirect " + _id);
        return;
    }

    switch (_kind) {
        case TCKind._tk_null:
        case TCKind._tk_void:
        case TCKind._tk_short:
        case TCKind._tk_long:
        case TCKind._tk_ushort:
        case TCKind._tk_ulong:
        case TCKind._tk_float:
        case TCKind._tk_double:
        case TCKind._tk_boolean:
        case TCKind._tk_char:
        case TCKind._tk_octet:
        case TCKind._tk_any:
        case TCKind._tk_TypeCode:
        case TCKind._tk_Principal:
        case TCKind._tk_objref:
        case TCKind._tk_longlong:
        case TCKind._tk_ulonglong:
        case TCKind._tk_longdouble:
        case TCKind._tk_wchar:
        case TCKind._tk_native:
            s.print(kindNames[_kind] + " " + _name);
            break;

        case TCKind._tk_struct:
        case TCKind._tk_except:
        case TCKind._tk_value:
            s.println(kindNames[_kind] + " " + _name + " = {");
            for(int i=0; i<_memberCount; i++) {
                // memberName might differ from the name of the member.
                s.print(indent(level + 1));
                if (_memberTypes[i] != null)
                    _memberTypes[i].printStream(s, level + 1);
                else
                    s.print("<unknown type>");
                s.println(" " + _memberNames[i] + ";");
            }
            s.print(indent(level) + "}");
            break;

        case TCKind._tk_union:
            s.print("union " + _name + "...");
            break;

        case TCKind._tk_enum:
            s.print("enum " + _name + "...");
            break;

        case TCKind._tk_string:
            if (_length == 0)
                s.print("unbounded string " + _name);
            else
                s.print("bounded string(" + _length + ") " + _name);
            break;

        case TCKind._tk_sequence:
        case TCKind._tk_array:
            s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {");
            s.print(indent(level + 1));
            if (lazy_content_type() != null) {
                lazy_content_type().printStream(s, level + 1);
            }
            s.println(indent(level) + "}");
            break;

        case TCKind._tk_alias:
            s.print("alias " + _name + " = " +
                (_contentType != null ? _contentType._name : "<unresolved>"));
            break;

        case TCKind._tk_wstring:
            s.print("wstring[" + _length + "] " + _name);
            break;

        case TCKind._tk_fixed:
            s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
            break;

        case TCKind._tk_value_box:
            s.print("valueBox " + _name + "...");
            break;

        case TCKind._tk_abstract_interface:
            s.print("abstractInterface " + _name + "...");
            break;

        default:
            s.print("<unknown type>");
            break;
    }
}
 
Example 16
Source File: ORB.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected ORB()
{
    // Initialize logging first, since it is needed nearly
    // everywhere (for example, in TypeCodeImpl).
    wrapperMap = new ConcurrentHashMap();
    wrapper = ORBUtilSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;
    omgWrapper = OMGSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;

    typeCodeMap = new HashMap();

    primitiveTypeCodeConstants = new TypeCodeImpl[] {
        new TypeCodeImpl(this, TCKind._tk_null),
        new TypeCodeImpl(this, TCKind._tk_void),
        new TypeCodeImpl(this, TCKind._tk_short),
        new TypeCodeImpl(this, TCKind._tk_long),
        new TypeCodeImpl(this, TCKind._tk_ushort),
        new TypeCodeImpl(this, TCKind._tk_ulong),
        new TypeCodeImpl(this, TCKind._tk_float),
        new TypeCodeImpl(this, TCKind._tk_double),
        new TypeCodeImpl(this, TCKind._tk_boolean),
        new TypeCodeImpl(this, TCKind._tk_char),
        new TypeCodeImpl(this, TCKind._tk_octet),
        new TypeCodeImpl(this, TCKind._tk_any),
        new TypeCodeImpl(this, TCKind._tk_TypeCode),
        new TypeCodeImpl(this, TCKind._tk_Principal),
        new TypeCodeImpl(this, TCKind._tk_objref),
        null,       // tk_struct
        null,       // tk_union
        null,       // tk_enum
        new TypeCodeImpl(this, TCKind._tk_string),
        null,       // tk_sequence
        null,       // tk_array
        null,       // tk_alias
        null,       // tk_except
        new TypeCodeImpl(this, TCKind._tk_longlong),
        new TypeCodeImpl(this, TCKind._tk_ulonglong),
        new TypeCodeImpl(this, TCKind._tk_longdouble),
        new TypeCodeImpl(this, TCKind._tk_wchar),
        new TypeCodeImpl(this, TCKind._tk_wstring),
        new TypeCodeImpl(this, TCKind._tk_fixed),
        new TypeCodeImpl(this, TCKind._tk_value),
        new TypeCodeImpl(this, TCKind._tk_value_box),
        new TypeCodeImpl(this, TCKind._tk_native),
        new TypeCodeImpl(this, TCKind._tk_abstract_interface)
    } ;

    monitoringManager =
        MonitoringFactories.getMonitoringManagerFactory( ).
            createMonitoringManager(
            MonitoringConstants.DEFAULT_MONITORING_ROOT,
            MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION);
}
 
Example 17
Source File: CorbaHandlerUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 18
Source File: CorbaHandlerUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 19
Source File: ORB.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected ORB()
{
    // Initialize logging first, since it is needed nearly
    // everywhere (for example, in TypeCodeImpl).
    wrapperMap = new ConcurrentHashMap<>();
    wrapper = ORBUtilSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;
    omgWrapper = OMGSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;

    typeCodeMap = new HashMap<>();

    primitiveTypeCodeConstants = new TypeCodeImpl[] {
        new TypeCodeImpl(this, TCKind._tk_null),
        new TypeCodeImpl(this, TCKind._tk_void),
        new TypeCodeImpl(this, TCKind._tk_short),
        new TypeCodeImpl(this, TCKind._tk_long),
        new TypeCodeImpl(this, TCKind._tk_ushort),
        new TypeCodeImpl(this, TCKind._tk_ulong),
        new TypeCodeImpl(this, TCKind._tk_float),
        new TypeCodeImpl(this, TCKind._tk_double),
        new TypeCodeImpl(this, TCKind._tk_boolean),
        new TypeCodeImpl(this, TCKind._tk_char),
        new TypeCodeImpl(this, TCKind._tk_octet),
        new TypeCodeImpl(this, TCKind._tk_any),
        new TypeCodeImpl(this, TCKind._tk_TypeCode),
        new TypeCodeImpl(this, TCKind._tk_Principal),
        new TypeCodeImpl(this, TCKind._tk_objref),
        null,       // tk_struct
        null,       // tk_union
        null,       // tk_enum
        new TypeCodeImpl(this, TCKind._tk_string),
        null,       // tk_sequence
        null,       // tk_array
        null,       // tk_alias
        null,       // tk_except
        new TypeCodeImpl(this, TCKind._tk_longlong),
        new TypeCodeImpl(this, TCKind._tk_ulonglong),
        new TypeCodeImpl(this, TCKind._tk_longdouble),
        new TypeCodeImpl(this, TCKind._tk_wchar),
        new TypeCodeImpl(this, TCKind._tk_wstring),
        new TypeCodeImpl(this, TCKind._tk_fixed),
        new TypeCodeImpl(this, TCKind._tk_value),
        new TypeCodeImpl(this, TCKind._tk_value_box),
        new TypeCodeImpl(this, TCKind._tk_native),
        new TypeCodeImpl(this, TCKind._tk_abstract_interface)
    } ;

    monitoringManager =
        MonitoringFactories.getMonitoringManagerFactory( ).
            createMonitoringManager(
            MonitoringConstants.DEFAULT_MONITORING_ROOT,
            MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION);
}
 
Example 20
Source File: TypeCodeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private void printStream(PrintStream s, int level) {
    if (_kind == tk_indirect) {
        s.print("indirect " + _id);
        return;
    }

    switch (_kind) {
        case TCKind._tk_null:
        case TCKind._tk_void:
        case TCKind._tk_short:
        case TCKind._tk_long:
        case TCKind._tk_ushort:
        case TCKind._tk_ulong:
        case TCKind._tk_float:
        case TCKind._tk_double:
        case TCKind._tk_boolean:
        case TCKind._tk_char:
        case TCKind._tk_octet:
        case TCKind._tk_any:
        case TCKind._tk_TypeCode:
        case TCKind._tk_Principal:
        case TCKind._tk_objref:
        case TCKind._tk_longlong:
        case TCKind._tk_ulonglong:
        case TCKind._tk_longdouble:
        case TCKind._tk_wchar:
        case TCKind._tk_native:
            s.print(kindNames[_kind] + " " + _name);
            break;

        case TCKind._tk_struct:
        case TCKind._tk_except:
        case TCKind._tk_value:
            s.println(kindNames[_kind] + " " + _name + " = {");
            for(int i=0; i<_memberCount; i++) {
                // memberName might differ from the name of the member.
                s.print(indent(level + 1));
                if (_memberTypes[i] != null)
                    _memberTypes[i].printStream(s, level + 1);
                else
                    s.print("<unknown type>");
                s.println(" " + _memberNames[i] + ";");
            }
            s.print(indent(level) + "}");
            break;

        case TCKind._tk_union:
            s.print("union " + _name + "...");
            break;

        case TCKind._tk_enum:
            s.print("enum " + _name + "...");
            break;

        case TCKind._tk_string:
            if (_length == 0)
                s.print("unbounded string " + _name);
            else
                s.print("bounded string(" + _length + ") " + _name);
            break;

        case TCKind._tk_sequence:
        case TCKind._tk_array:
            s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {");
            s.print(indent(level + 1));
            if (lazy_content_type() != null) {
                lazy_content_type().printStream(s, level + 1);
            }
            s.println(indent(level) + "}");
            break;

        case TCKind._tk_alias:
            s.print("alias " + _name + " = " +
                (_contentType != null ? _contentType._name : "<unresolved>"));
            break;

        case TCKind._tk_wstring:
            s.print("wstring[" + _length + "] " + _name);
            break;

        case TCKind._tk_fixed:
            s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
            break;

        case TCKind._tk_value_box:
            s.print("valueBox " + _name + "...");
            break;

        case TCKind._tk_abstract_interface:
            s.print("abstractInterface " + _name + "...");
            break;

        default:
            s.print("<unknown type>");
            break;
    }
}