public AnyImpl(ORB orb, Any obj) {
this(orb);
if ((obj instanceof AnyImpl)) {
AnyImpl objImpl = (AnyImpl)obj;
typeCode = objImpl.typeCode;
value = objImpl.value;
object = objImpl.object;
isInitialized = objImpl.isInitialized;
if (objImpl.stream != null)
stream = objImpl.stream.dup();
} else {
read_value(obj.create_input_stream(), obj.type());
}
}
java类org.omg.CORBA.Any的实例源码
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
DynUnionImpl.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
public void set_to_default_member ()
throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
{
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed() ;
}
int defaultIndex = defaultIndex();
if (defaultIndex == -1) {
throw new TypeMismatch();
}
try {
clearData();
index = 1;
currentMemberIndex = defaultIndex;
currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
components = new DynAny[] {discriminator, currentMember};
Any discriminatorAny = orb.create_any();
discriminatorAny.insert_octet((byte)0);
discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
representations = REPRESENTATION_COMPONENTS;
} catch (InconsistentTypeCode ictc) {}
}
Util.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
/**
* When using our own ORB and Any implementations, we need to get
* the ORB version and create the type code appropriately. This is
* to overcome a bug in which the JDK 1.3.x ORBs used a tk_char
* rather than a tk_wchar to describe a Java char field.
*
* This only works in RMI-IIOP with Util.writeAny since we actually
* know what ORB and stream we're writing with when we insert
* the value.
*
* Returns null if it wasn't possible to create the TypeCode (means
* it wasn't our ORB or Any implementation).
*
* This does not handle null objs.
*/
private TypeCode createTypeCode(Serializable obj,
org.omg.CORBA.Any any,
org.omg.CORBA.ORB orb) {
if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
orb instanceof ORB) {
com.sun.corba.se.impl.corba.AnyImpl anyImpl
= (com.sun.corba.se.impl.corba.AnyImpl)any;
ORB ourORB = (ORB)orb;
return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);
} else
return null;
}
ClientRequestInfoImpl.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
/**
* See RequestInfoImpl for javadoc.
*/
public Any result (){
checkAccess( MID_RESULT );
if( cachedResult == null ) {
if( request == null ) {
throw stdWrapper.piOperationNotSupported5() ;
}
// Get the result from the DII request data.
NamedValue nvResult = request.result( );
if( nvResult == null ) {
throw wrapper.piDiiResultIsNull() ;
}
cachedResult = nvResult.value();
}
// Good citizen: In the interest of efficiency, we assume that
// interceptors will not modify the contents of the result Any.
// Otherwise, we would need to create a deep copy of the Any.
return cachedResult;
}
DynUnionImpl.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
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;
}
PIHandlerImpl.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
/** 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;
}
DynAnyBasicImpl.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
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() ;
}
super.from_any(value);
index = NO_INDEX;
}
DynUnionImpl.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
protected boolean initializeComponentsFromAny() {
try {
InputStream input = any.create_input_stream();
Any discriminatorAny = DynAnyUtil.extractAnyFromStream(discriminatorType(), input, orb);
discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
currentMemberIndex = currentUnionMemberIndex(discriminatorAny);
Any memberAny = DynAnyUtil.extractAnyFromStream(memberType(currentMemberIndex), input, orb);
currentMember = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
components = new DynAny[] {discriminator, currentMember};
} catch (InconsistentTypeCode ictc) { // impossible
}
return true;
}
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
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;
}
}
ORBUtility.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
/**
* 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));
}
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
/**
* 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;
}
CDREncapsCodec.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
/**
* Convert the given any into a CDR encapsulated octet sequence.
* If sendTypeCode is true, the type code is sent with the message, as in
* a standard encapsulation. If it is false, only the data is sent.
* Either way, the endian type is sent as the first part of the message.
*/
private byte[] encodeImpl( Any data, boolean sendTypeCode )
throws InvalidTypeForEncoding
{
if( data == null )
throw wrapper.nullParam() ;
// _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
// the body of this method. This is due to the fact that CDR*Stream
// will never throw an exception if the encoding is invalid. To
// fix this, the CDROutputStream must know the version of GIOP it
// is encoding for and it must check to ensure that, for example,
// wstring cannot be encoded in GIOP 1.0.
//
// As part of the GIOP 1.2 work, the CDRInput and OutputStream will
// be versioned. This can be handled once this work is complete.
// Create output stream with default endianness.
EncapsOutputStream cdrOut =
sun.corba.OutputStreamFactory.newEncapsOutputStream(
(com.sun.corba.se.spi.orb.ORB)orb, giopVersion );
// This is an encapsulation, so put out the endian:
cdrOut.putEndian();
// Sometimes encode type code:
if( sendTypeCode ) {
cdrOut.write_TypeCode( data.type() );
}
// Encode value and return.
data.write_value( cdrOut );
return cdrOut.toByteArray();
}
ORBImpl.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
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 ) ;
}
SlotTable.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
/**
* 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;
}
ClientRequestInfoImpl.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
/**
* Contains the exception to be returned to the client.
*/
public Any received_exception (){
checkAccess( MID_RECEIVED_EXCEPTION );
if( cachedReceivedException == null ) {
cachedReceivedException = exceptionToAny( exception );
}
// Good citizen: In the interest of efficiency, we assume interceptors
// will not modify the returned Any in any way so we need
// not make a deep copy of it.
return cachedReceivedException;
}
ServerRequestImpl.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
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.
}
DynAnyConstructedImpl.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
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;
}
CDREncapsCodec.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
/**
* 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 );
}
DynAnyConstructedImpl.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
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;
}
DynAnyConstructedImpl.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
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);
}
CorbaServerRequestDispatcherImpl.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
protected CorbaMessageMediator handleDynamicResult(
ServerRequestImpl sreq,
CorbaMessageMediator req)
{
try {
if (orb.subcontractDebugFlag) {
dprint(".handleDynamicResult->: " + opAndId(req));
}
CorbaMessageMediator response = null ;
// Check if ServerRequestImpl.result() has been called
Any excany = sreq.checkResultCalled();
if (excany == null) { // normal return
if (orb.subcontractDebugFlag) {
dprint(".handleDynamicResult: " + opAndId(req)
+ ": handling normal result");
}
// Marshal out/inout/return parameters into the ReplyMessage
response = sendingReply(req);
OutputStream os = (OutputStream) response.getOutputObject();
sreq.marshalReplyParams(os);
} else {
if (orb.subcontractDebugFlag) {
dprint(".handleDynamicResult: " + opAndId(req)
+ ": handling error");
}
response = sendingReply(req, excany);
}
return response ;
} finally {
if (orb.subcontractDebugFlag) {
dprint(".handleDynamicResult<-: " + opAndId(req));
}
}
}
NamedValueImpl.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
public NamedValueImpl(ORB orb,
String name,
Any value,
int flags)
{
// Note: This orb could be an instanceof ORBSingleton or ORB
_orb = orb;
_name = name;
_value = value;
_flags = flags;
}
IDLJavaSerializationInputStream.java 文件源码
项目:openjdk-jdk10
阅读 19
收藏 0
点赞 0
评论 0
public Any read_any() {
Any any = orb.create_any();
TypeCodeImpl tc = new TypeCodeImpl(orb);
// read off the typecode
// REVISIT We could avoid this try-catch if we could peek the typecode
// kind off this stream and see if it is a tk_value.
// Looking at the code we know that for tk_value the Any.read_value()
// below ignores the tc argument anyway (except for the kind field).
// But still we would need to make sure that the whole typecode,
// including encapsulations, is read off.
try {
tc.read_value(parent);
} catch (org.omg.CORBA.MARSHAL ex) {
if (tc.kind().value() != org.omg.CORBA.TCKind._tk_value) {
throw ex;
}
// We can be sure that the whole typecode encapsulation has been
// read off.
ex.printStackTrace();
}
// read off the value of the any.
any.read_value(parent, tc);
return any;
}
Util.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
/**
* Reads a java.lang.Object as a CORBA any.
* @param in the stream from which to read the any.
* @return the object read from the stream.
*/
public Object readAny(InputStream in)
{
Any any = in.read_any();
if ( any.type().kind().value() == TCKind._tk_objref )
return any.extract_Object ();
else
return any.extract_Value();
}
ORBImpl.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
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 ) ;
}
PIHandlerImpl.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
public void setServerPIExceptionInfo( Any exception )
{
if( !hasServerInterceptors ) return;
ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
info.setDSIException( exception );
}
DynUnionImpl.java 文件源码
项目:OpenJSharp
阅读 30
收藏 0
点赞 0
评论 0
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;
}
CDREncapsCodec.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
/**
* Convert the given any into a CDR encapsulated octet sequence
*/
public byte[] encode( Any data )
throws InvalidTypeForEncoding
{
if ( data == null )
throw wrapper.nullParam() ;
return encodeImpl( data, true );
}
DynValueBoxImpl.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
public Any get_boxed_value()
throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
if (isNull) {
throw new InvalidValue();
}
checkInitAny();
return any;
}
RequestInfoImpl.java 文件源码
项目:OpenJSharp
阅读 26
收藏 0
点赞 0
评论 0
/**
* Returns the data from the given slot of the PortableInterceptor::Current
* that is in the scope of the request.
* <p>
* If the given slot has not been set, then an any containing a type code
* with a TCKind value of tk_null is returned.
* <p>
* If the ID does not define an allocated slot, InvalidSlot is raised.
*/
public Any get_slot (int id)
throws InvalidSlot
{
// access is currently valid for all states:
//checkAccess( MID_GET_SLOT );
// Delegate the call to the slotTable which was set when RequestInfo was
// created.
return slotTable.get_slot( id );
}