Java Code Examples for org.omg.CORBA.Any
The following examples show how to use
org.omg.CORBA.Any. These examples are extracted from open source projects.
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 Project: TencentKona-8 Source File: DynAnyImpl.java License: GNU General Public License v2.0 | 6 votes |
public void from_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 != null) && (! any.type().equal(value.type()))) { throw new TypeMismatch(); } // If the passed Any does not contain a legal value // (such as a null string), the operation raises InvalidValue. Any tempAny = null; try { tempAny = DynAnyUtil.copy(value, orb); } catch (Exception e) { throw new InvalidValue(); } if ( ! DynAnyUtil.isInitialized(tempAny)) { throw new InvalidValue(); } any = tempAny; }
Example 2
Source Project: jdk8u60 Source File: PIHandlerImpl.java License: GNU General Public License v2.0 | 6 votes |
/** This is the implementation of standard API defined in org.omg.CORBA.ORB * class. This method finds the Policy Factory for the given Policy Type * and instantiates the Policy object from the Factory. It will throw * PolicyError exception, If the PolicyFactory for the given type is * not registered. * _REVISIT_, Once Policy Framework work is completed, Reorganize * this method to com.sun.corba.se.spi.orb.ORB. */ public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError { if( val == null ) { nullParam( ); } if( policyFactoryTable == null ) { throw new org.omg.CORBA.PolicyError( "There is no PolicyFactory Registered for type " + type, BAD_POLICY.value ); } PolicyFactory factory = (PolicyFactory)policyFactoryTable.get( new Integer(type) ); if( factory == null ) { throw new org.omg.CORBA.PolicyError( " Could Not Find PolicyFactory for the Type " + type, BAD_POLICY.value); } org.omg.CORBA.Policy policy = factory.create_policy( type, val ); return policy; }
Example 3
Source Project: openjdk-jdk8u Source File: PIHandlerImpl.java License: GNU General Public License v2.0 | 6 votes |
/** This is the implementation of standard API defined in org.omg.CORBA.ORB * class. This method finds the Policy Factory for the given Policy Type * and instantiates the Policy object from the Factory. It will throw * PolicyError exception, If the PolicyFactory for the given type is * not registered. * _REVISIT_, Once Policy Framework work is completed, Reorganize * this method to com.sun.corba.se.spi.orb.ORB. */ public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError { if( val == null ) { nullParam( ); } if( policyFactoryTable == null ) { throw new org.omg.CORBA.PolicyError( "There is no PolicyFactory Registered for type " + type, BAD_POLICY.value ); } PolicyFactory factory = (PolicyFactory)policyFactoryTable.get( new Integer(type) ); if( factory == null ) { throw new org.omg.CORBA.PolicyError( " Could Not Find PolicyFactory for the Type " + type, BAD_POLICY.value); } org.omg.CORBA.Policy policy = factory.create_policy( type, val ); return policy; }
Example 4
Source Project: openjdk-8 Source File: DynUnionImpl.java License: GNU General Public License v2.0 | 6 votes |
public void set_to_no_active_member () throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch { if (status == STATUS_DESTROYED) { throw wrapper.dynAnyDestroyed() ; } // _REVISIT_ How does one check for "entire range of discriminator values"? if (defaultIndex() != -1) { throw new TypeMismatch(); } checkInitComponents(); Any discriminatorAny = getAny(discriminator); // erase the discriminators value so that it does not correspond // to any of the unions case labels discriminatorAny.type(discriminatorAny.type()); index = 0; currentMemberIndex = NO_INDEX; // Necessary to guarantee OBJECT_NOT_EXIST in member() currentMember.destroy(); currentMember = null; components[0] = discriminator; representations = REPRESENTATION_COMPONENTS; }
Example 5
Source Project: TencentKona-8 Source File: ORBImpl.java License: GNU General Public License v2.0 | 5 votes |
public synchronized org.omg.CORBA.Policy create_policy( int type, org.omg.CORBA.Any val ) throws org.omg.CORBA.PolicyError { checkShutdownState() ; return pihandler.create_policy( type, val ) ; }
Example 6
Source Project: openjdk-jdk9 Source File: DynSequenceImpl.java License: GNU General Public License v2.0 | 5 votes |
protected boolean initializeComponentsFromAny() { // This typeCode is of kind tk_sequence. TypeCode typeCode = any.type(); int length; TypeCode contentType = getContentType(); InputStream input; try { input = any.create_input_stream(); } catch (BAD_OPERATION e) { return false; } length = input.read_long(); components = new DynAny[length]; anys = new Any[length]; for (int i=0; i<length; i++) { // _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency // but only for primitive types anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb); try { // Creates the appropriate subtype without copying the Any components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false); } catch (InconsistentTypeCode itc) { // impossible } } return true; }
Example 7
Source Project: TencentKona-8 Source File: CDREncapsCodec.java License: GNU General Public License v2.0 | 5 votes |
/** * Convert the given any into a CDR encapsulated octet sequence. Only * the data is stored. The type code is not. */ public byte[] encode_value( Any data ) throws InvalidTypeForEncoding { if( data == null ) throw wrapper.nullParam() ; return encodeImpl( data, false ); }
Example 8
Source Project: TencentKona-8 Source File: CDROutputStream_1_0.java License: GNU General Public License v2.0 | 5 votes |
public void write_any(Any any) { if ( any == null ) throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); write_TypeCode(any.type()); any.write_value(parent); }
Example 9
Source Project: hottub Source File: RequestImpl.java License: GNU General Public License v2.0 | 5 votes |
public void unmarshalReply(InputStream is) { // First unmarshal the return value if it is not void if ( _result != null ) { Any returnAny = _result.value(); TypeCode returnType = returnAny.type(); if ( returnType.kind().value() != TCKind._tk_void ) returnAny.read_value(is, returnType); } // Now unmarshal the out/inout args try { for ( int i=0; i<_arguments.count() ; i++) { NamedValue nv = _arguments.item(i); switch( nv.flags() ) { case ARG_IN.value: break; case ARG_OUT.value: case ARG_INOUT.value: Any any = nv.value(); any.read_value(is, any.type()); break; } } } catch ( org.omg.CORBA.Bounds ex ) { // Cannot happen since we only iterate till _arguments.count() } }
Example 10
Source Project: openjdk-jdk8u-backup Source File: DynValueBoxImpl.java License: GNU General Public License v2.0 | 5 votes |
public Any get_boxed_value() throws org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (isNull) { throw new InvalidValue(); } checkInitAny(); return any; }
Example 11
Source Project: hottub Source File: DynAnyBasicImpl.java License: GNU General Public License v2.0 | 5 votes |
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 12
Source Project: jdk1.8-source-analysis Source File: AnyImpl.java License: Apache License 2.0 | 5 votes |
static AnyImpl convertToNative(ORB orb, Any any) { if (any instanceof AnyImpl) { return (AnyImpl)any; } else { AnyImpl anyImpl = new AnyImpl(orb, any); anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode); return anyImpl; } }
Example 13
Source Project: jdk1.8-source-analysis Source File: AnyImpl.java License: Apache License 2.0 | 5 votes |
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_any(Any a) { //debug.log ("insert_any"); typeCode = orb.get_primitive_tc(TCKind._tk_any); object = a; stream = null; isInitialized = true; }
Example 14
Source Project: openjdk-8 Source File: DynUnionImpl.java License: GNU General Public License v2.0 | 5 votes |
private int currentUnionMemberIndex(Any discriminatorValue) { int memberCount = memberCount(); Any memberLabel; for (int i=0; i<memberCount; i++) { memberLabel = memberLabel(i); if (memberLabel.equal(discriminatorValue)) { return i; } } if (defaultIndex() != -1) { return defaultIndex(); } return NO_INDEX; }
Example 15
Source Project: openjdk-jdk8u-backup Source File: PIHandlerImpl.java License: GNU General Public License v2.0 | 5 votes |
public void setServerPIExceptionInfo( Any exception ) { if( !hasServerInterceptors ) return; ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); info.setDSIException( exception ); }
Example 16
Source Project: jdk8u60 Source File: AnyImpl.java License: GNU General Public License v2.0 | 5 votes |
static AnyImpl convertToNative(ORB orb, Any any) { if (any instanceof AnyImpl) { return (AnyImpl)any; } else { AnyImpl anyImpl = new AnyImpl(orb, any); anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode); return anyImpl; } }
Example 17
Source Project: jdk1.8-source-analysis Source File: ServerRequestImpl.java License: Apache License 2.0 | 5 votes |
public void set_exception(Any exc) { // except can be called by the DIR at any time (CORBA 2.2 section 6.3). if ( exc == null ) throw _wrapper.setExceptionCalledNullArgs() ; // Ensure that the Any contains a SystemException or a // UserException. If the UserException is not a declared exception, // the client will get an UNKNOWN exception. TCKind kind = exc.type().kind(); if ( kind != TCKind.tk_except ) throw _wrapper.setExceptionCalledBadType() ; _exception = exc; // Inform Portable interceptors of the exception that was set // so sending_exception can return the right value. _orb.getPIHandler().setServerPIExceptionInfo( _exception ); // The user can only call arguments once and not at all after // set_exception. (internal flags ensure this). However, the user // can call set_exception multiple times. Therefore, we only // invoke receive_request the first time set_exception is // called (if they haven't already called arguments). if( !_exceptionSet && !_paramsCalled ) { // We need to invoke intermediate points here. _orb.getPIHandler().invokeServerPIIntermediatePoint(); } _exceptionSet = true; // actual marshaling of the reply msg header and exception takes place // after the DSI returns control to the ORB. }
Example 18
Source Project: openjdk-jdk8u Source File: SlotTable.java License: GNU General Public License v2.0 | 5 votes |
/** * This method sets the slot data at the given slot id (index). */ public void set_slot( int id, Any data ) throws InvalidSlot { // First check whether the slot is allocated // If not, raise the invalid slot exception if( id >= theSlotData.length ) { throw new InvalidSlot(); } dirtyFlag = true; theSlotData[id] = data; }
Example 19
Source Project: hottub Source File: DynAnyUtil.java License: GNU General Public License v2.0 | 5 votes |
static DynAny createMostDerivedDynAny(Any any, ORB orb, boolean copyValue) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode { if (any == null || ! DynAnyUtil.isConsistentType(any.type())) throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode(); switch (any.type().kind().value()) { case TCKind._tk_sequence: return new DynSequenceImpl(orb, any, copyValue); case TCKind._tk_struct: return new DynStructImpl(orb, any, copyValue); case TCKind._tk_array: return new DynArrayImpl(orb, any, copyValue); case TCKind._tk_union: return new DynUnionImpl(orb, any, copyValue); case TCKind._tk_enum: return new DynEnumImpl(orb, any, copyValue); case TCKind._tk_fixed: return new DynFixedImpl(orb, any, copyValue); case TCKind._tk_value: return new DynValueImpl(orb, any, copyValue); case TCKind._tk_value_box: return new DynValueBoxImpl(orb, any, copyValue); default: return new DynAnyBasicImpl(orb, any, copyValue); } }
Example 20
Source Project: openjdk-jdk8u Source File: AnyImpl.java License: GNU General Public License v2.0 | 5 votes |
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public Any extract_any() { //debug.log ("extract_any"); checkExtractBadOperation( TCKind._tk_any ) ; return (Any)object; }
Example 21
Source Project: openjdk-jdk8u-backup Source File: DynAnyComplexImpl.java License: GNU General Public License v2.0 | 5 votes |
private void addComponent(int i, String memberName, Any memberAny, DynAny memberDynAny) { components[i] = memberDynAny; names[i] = (memberName != null ? memberName : ""); nameValuePairs[i].id = memberName; nameValuePairs[i].value = memberAny; nameDynAnyPairs[i].id = memberName; nameDynAnyPairs[i].value = memberDynAny; if (memberDynAny instanceof DynAnyImpl) ((DynAnyImpl)memberDynAny).setStatus(STATUS_UNDESTROYABLE); }
Example 22
Source Project: jdk1.8-source-analysis Source File: DynAnyConstructedImpl.java License: Apache License 2.0 | 5 votes |
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 (index == NO_INDEX) throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue(); DynAny currentComponent = current_component(); if (DynAnyUtil.isConstructedDynAny(currentComponent)) throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch(); currentComponent.insert_any(value); }
Example 23
Source Project: openjdk-jdk8u-backup Source File: ORBUtility.java License: GNU General Public License v2.0 | 5 votes |
/** * Static method for writing a CORBA standard exception to an Any. * @param any The Any to write the SystemException into. */ public static void insertSystemException(SystemException ex, Any any) { OutputStream out = any.create_output_stream(); ORB orb = (ORB)(out.orb()); String name = ex.getClass().getName(); String repID = ORBUtility.repositoryIdOf(name); out.write_string(repID); out.write_long(ex.minor); out.write_long(ex.completed.value()); any.read_value(out.create_input_stream(), getSystemExceptionTypeCode(orb, repID, name)); }
Example 24
Source Project: openjdk-jdk8u Source File: DynAnyConstructedImpl.java License: GNU General Public License v2.0 | 5 votes |
public void from_any (org.omg.CORBA.Any value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { throw wrapper.dynAnyDestroyed() ; } clearData(); super.from_any(value); representations = REPRESENTATION_ANY; index = 0; }
Example 25
Source Project: openjdk-8-source Source File: ServerRequestImpl.java License: GNU General Public License v2.0 | 5 votes |
/** This is called from the ORB after the DynamicImplementation.invoke * returns. Here we set the result if result() has not already been called. * @return the exception if there is one (then ORB will not call * marshalReplyParams()) otherwise return null. */ public Any checkResultCalled() { // Two things to be checked (CORBA 2.2 spec, section 6.3): // 1. Unless it calls set_exception(), the DIR must call arguments() // exactly once, even if the operation signature contains // no parameters. // 2. Unless set_exception() is called, if the invoked operation has a // non-void result type, set_result() must be called exactly once // before the DIR returns. if ( _paramsCalled && _resultSet ) // normal invocation return return null; else if ( _paramsCalled && !_resultSet && !_exceptionSet ) { try { // Neither a result nor an exception has been set. // Assume that the return type is void. If this is not so, // the client will throw a MARSHAL exception while // unmarshaling the return value. TypeCode result_tc = _orb.get_primitive_tc( org.omg.CORBA.TCKind.tk_void); _resultAny = _orb.create_any(); _resultAny.type(result_tc); _resultSet = true; return null; } catch ( Exception ex ) { throw _wrapper.dsiResultException( CompletionStatus.COMPLETED_MAYBE, ex ) ; } } else if ( _exceptionSet ) return _exception; else { throw _wrapper.dsimethodNotcalled( CompletionStatus.COMPLETED_MAYBE ) ; } }
Example 26
Source Project: openjdk-jdk8u Source File: DynValueBoxImpl.java License: GNU General Public License v2.0 | 5 votes |
public Any get_boxed_value() throws org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (isNull) { throw new InvalidValue(); } checkInitAny(); return any; }
Example 27
Source Project: TencentKona-8 Source File: CDREncapsCodec.java License: GNU General Public License v2.0 | 5 votes |
/** * Decode the given octet sequence into an any based on a CDR * encapsulated octet sequence. The type code is expected not to appear * in the octet sequence, and the given type code is used instead. */ public Any decode_value( byte[] data, TypeCode tc ) throws FormatMismatch, TypeMismatch { if( data == null ) throw wrapper.nullParam() ; if( tc == null ) throw wrapper.nullParam() ; return decodeImpl( data, tc ); }
Example 28
Source Project: cxf Source File: CorbaAnyHelper.java License: Apache License 2.0 | 5 votes |
public static Any createAny(ORB orb) { Any value = orb.create_any(); if ("com.sun.corba.se.impl.corba.AnyImpl".equals(value.getClass().getName())) { value = createFixedAny(orb, value); } return value; }
Example 29
Source Project: TencentKona-8 Source File: SlotTable.java License: GNU General Public License v2.0 | 5 votes |
/** * This method sets the slot data at the given slot id (index). */ public void set_slot( int id, Any data ) throws InvalidSlot { // First check whether the slot is allocated // If not, raise the invalid slot exception if( id >= theSlotData.length ) { throw new InvalidSlot(); } dirtyFlag = true; theSlotData[id] = data; }
Example 30
Source Project: openjdk-jdk8u-backup Source File: DynAnyCollectionImpl.java License: GNU General Public License v2.0 | 5 votes |
public void set_elements (org.omg.CORBA.Any[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { throw wrapper.dynAnyDestroyed() ; } checkValue(value); components = new DynAny[value.length]; anys = value; // We know that this is of kind tk_sequence or tk_array TypeCode expectedTypeCode = getContentType(); for (int i=0; i<value.length; i++) { if (value[i] != null) { if (! value[i].type().equal(expectedTypeCode)) { clearData(); // _REVISIT_ More info throw new TypeMismatch(); } try { // Creates the appropriate subtype without copying the Any components[i] = DynAnyUtil.createMostDerivedDynAny(value[i], orb, false); //System.out.println(this + " created component " + components[i]); } catch (InconsistentTypeCode itc) { throw new InvalidValue(); } } else { clearData(); // _REVISIT_ More info throw new InvalidValue(); } } index = (value.length == 0 ? NO_INDEX : 0); // Other representations are invalidated by this operation representations = REPRESENTATION_COMPONENTS; }