org.omg.CORBA.Any类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(233)

本文整理了Java中org.omg.CORBA.Any类的一些代码示例,展示了Any类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Any类的具体详情如下:
包路径:org.omg.CORBA.Any
类名称:Any

Any介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * Returns the transaction associated with the transaction propagation
 * context that arrived in the current IIOP request.
 */
public static Transaction getCurrentTransaction() {
  Transaction tx = null;
  if (piCurrent != null) {
    // A non-null piCurrent means that a TxServerInterceptor was
    // installed: check if there is a transaction propagation context
    try {
      Any any = piCurrent.get_slot(slotId);
      if (any.type().kind().value() != TCKind._tk_null) {
        // Yes, there is a TPC: add the foreign transaction marker
        tx = ForeignTransaction.INSTANCE;
      }
    } catch (InvalidSlot e) {
      throw IIOPLogger.ROOT_LOGGER.errorGettingSlotInTxInterceptor(e);
    }
  }
  return tx;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Insert a java primitive into an Any.
 * The primitive is assumed to be wrapped in one of the primitive
 * wrapper classes.
 */
public static void insertAnyPrimitive(Any any, Object primitive) {
  Class type = primitive.getClass();
  if (type == Boolean.class)
    any.insert_boolean(((Boolean) primitive).booleanValue());
  else if (type == Character.class)
    any.insert_wchar(((Character) primitive).charValue());
  else if (type == Byte.class)
    any.insert_octet(((Byte) primitive).byteValue());
  else if (type == Short.class)
    any.insert_short(((Short) primitive).shortValue());
  else if (type == Integer.class)
    any.insert_long(((Integer) primitive).intValue());
  else if (type == Long.class)
    any.insert_longlong(((Long) primitive).longValue());
  else if (type == Float.class)
    any.insert_float(((Float) primitive).floatValue());
  else if (type == Double.class)
    any.insert_double(((Double) primitive).doubleValue());
  else
    throw IIOPLogger.ROOT_LOGGER.notAPrimitive(type.getName());
}

代码示例来源:origin: wildfly/wildfly

@Override
  public Policy create_policy(int type, Any value) throws PolicyError {
    if (type != CSIv2Policy.TYPE) {
      throw new PolicyError();
    }

    // stored as java.io.Serializable - is this a hack?
    IORSecurityConfigMetaData metadata = (IORSecurityConfigMetaData) value.extract_Value();
    return new CSIv2Policy(metadata, codec);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public static void insert(org.omg.CORBA.Any a, org.eclipse.persistence.internal.sessions.coordination.corba.sun.SunCORBAConnection that) {
  org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
  a.type(type());
  write(out, that);
  a.read_value(out.create_input_stream(), type());
}

代码示例来源:origin: org.apache.yoko/yoko-spec-corba

public static Contained
extract(org.omg.CORBA.Any any)
{
  if(any.type().equivalent(type()))
    return narrow(any.extract_Object());
  throw new org.omg.CORBA.BAD_OPERATION();
}

代码示例来源:origin: org.apache.yoko/yoko-spec-corba

public static short
extract(org.omg.CORBA.Any any)
{
  if(any.type().equivalent(type()))
    return read(any.create_input_stream());
  else
    throw new org.omg.CORBA.BAD_OPERATION();
}

代码示例来源:origin: org.apache.yoko/yoko-spec-corba

public static DecayPolicy
extract(org.omg.CORBA.Any any)
{
  if(any.type().equivalent(type()))
  {
    java.io.Serializable _ob_v = any.extract_Value();
    if(_ob_v == null || _ob_v instanceof DecayPolicy)
      return (DecayPolicy)_ob_v;
  }
  throw new org.omg.CORBA.BAD_OPERATION();
}

代码示例来源:origin: org.jacorb/jacorb

public static org.jacorb.imr.HostInfo[] extract (final org.omg.CORBA.Any any)
{
  if ( any.type().kind() == org.omg.CORBA.TCKind.tk_null)
  {
    throw new org.omg.CORBA.BAD_OPERATION ("Can't extract from Any with null type.");
  }
  return read (any.create_input_stream ());
}

代码示例来源:origin: org.jboss.spec.javax.rmi/jboss-rmi-api_1.0_spec

public static SystemException extractSystemException(Any any)
{
  InputStream in = any.create_input_stream();
  ORB orb = (ORB) (in.orb());
  if (!isSystemExceptionTypeCode(any.type(), orb))
  {
    throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE);
  }
  return ORBUtility.readSystemException(in);
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public String get_string()
  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_string)
    throw new TypeMismatch();
  return any.extract_string();
}

代码示例来源:origin: org.jacorb/jacorb-services

public Integer find_ulong_param( String key ) throws ParameterInvalid {
  int i = find_param_idx( key );
  if ( i == -1 ) {
    return null;
  }
  if( param[i].value.type().kind().value() != TCKind._tk_ulong ){
    throw new ParameterInvalid( i, "Invalid parameter type" );
  }
  return new Integer(param[i].value.extract_ulong());
};
public Operations find_operations_param( String key ) throws ParameterInvalid {

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public void insert_short(short 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_short)
    throw new TypeMismatch();
  any.insert_short(value);
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public void insert_reference(org.omg.CORBA.Object 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_objref)
    throw new TypeMismatch();
  any.insert_Object(value);
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public org.omg.CORBA.Object get_reference()
  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_objref)
    throw new TypeMismatch();
  return any.extract_Object();
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public short get_short()
  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_short)
    throw new TypeMismatch();
  return any.extract_short();
}

代码示例来源:origin: org.glassfish.main.transaction/jts

public void send_exception(ServerRequestInfo ri) throws ForwardRequest {
  Any any = ri.sending_exception();
  InputStream strm = any.create_input_stream();
  strm.read_string(); // repId
  strm.read_long(); // minorCode
  CompletionStatus completionStatus =
    CompletionStatus.from_int(strm.read_long());
  processServerSendPoint(ri, completionStatus);
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public void insert_long(int 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_long)
    throw new TypeMismatch();
  any.insert_long(value);
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public boolean get_boolean()
  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_boolean)
    throw new TypeMismatch();
  return any.extract_boolean();
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public int get_long()
  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_long)
    throw new TypeMismatch();
  return any.extract_long();
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public long get_ulonglong()
  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_ulonglong)
    throw new TypeMismatch();
  return any.extract_ulonglong();
}

相关文章