Java 类org.omg.CORBA.portable.Streamable 实例源码

项目:javify    文件:Vio.java   
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
项目:jvm-stm    文件:Vio.java   
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
项目:JamVM-PH    文件:Vio.java   
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
项目:classpath    文件:Vio.java   
/**
 * Try to write value supposing that it implements self-streamable interfaces.
 * Return false if it does not or true on success.
 */
static boolean writeSelf(OutputStream output, Serializable value)
{
  // User defined write method is present.
  if (value instanceof CustomMarshal)
    {
      ((CustomMarshal) value).marshal((DataOutputStream) output);
      return true;
    }
  else if (value instanceof Streamable)
    {
      ((Streamable) value)._write(output);
      return true;
    }
  return false;
}
项目:TIDorbJ    文件:DynUnionImpl.java   
public void _write(org.omg.CORBA.portable.OutputStream out)
{
    if (m_destroyed)
        throw new OBJECT_NOT_EXIST("DynAny destroyed", 0,
                                   CompletionStatus.COMPLETED_NO);

    if (m_component_count == 1)
        throw new BAD_OPERATION("Uncompleted union.");

    try {
        ((Streamable) get_discriminator())._write(out);
        ((Streamable) member())._write(out);
    }
    catch (InvalidValue iv) {
        throw new INTERNAL(iv.toString());
    }
}
项目:OpenJSharp    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:openjdk-jdk10    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:openjdk9    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:lookaside_java-1.8.0-openjdk    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:jdk8u_corba    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:javify    文件:_BindingIteratorImplBase.java   
/**
 * The obsolete invocation using server request. Implemented for
 * compatibility reasons, but is it more effectinve to use
 * {@link #_invoke}.
 *
 * @param request a server request.
 */
public void invoke(ServerRequest request)
{
  // "destroy" has a void return type, the two other methods - boolean.
  Streamable result =
    request.operation().equals("destroy") ? null : new BooleanHolder();
  gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
}
项目:javify    文件:RecordAny.java   
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable sHolder = HolderLocator.createHolder(official_type);

      Class sHolderClass = sHolder.getClass();
      Field sHolderValue = sHolderClass.getField("value");
      Class sClass = sHolderValue.getType();

      Object structure = sClass.newInstance();
      Object member;
      Any am;
      Field vread;
      Field vwrite;
      Streamable memberHolder;

      for (int i = 0; i < array.length; i++)
        {
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          vwrite = structure.getClass().getField(final_type.member_name(i));
          vread = memberHolder.getClass().getField("value");
          member = vread.get(memberHolder);
          vwrite.set(structure, member);
        }

      Any g = createAny();
      sHolderValue.set(sHolder, structure);
      g.insert_Streamable(sHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
项目:javify    文件:gnuDynAny.java   
/**
 * Create DynAny providing the holder.
 *
 * @param a_holder
 */
public gnuDynAny(Streamable aHolder, TypeCode oType, TypeCode aType,
  gnuDynAnyFactory aFactory, ORB anOrb
)
{
  super(oType, aType, aFactory, anOrb);
  holder = aHolder;
}
项目:javify    文件:gnuDynAny.java   
/**
 * Create a copy of this {@link DynAny} via buffer read/write.
 */
public DynAny copy()
{
  if (holder != null)
    {
      BufferedCdrOutput buffer = new BufferedCdrOutput();
      holder._write(buffer);

      gnuDynAny other;
      try
        {
          other =
            new gnuDynAny((Streamable) (holder.getClass().newInstance()),
              official_type, final_type, factory, orb
            );
        }
      catch (Exception e)
        {
          // Holder must have parameterless constructor.
          throw new Unexpected(e);
        }
      other.holder._read(buffer.create_input_stream());
      return other;
    }
  else
    {
      return new gnuDynAny(null, official_type, final_type, factory, orb);
    }
}
项目:javify    文件:gnuDynValueBox.java   
/** @inheritDoc */
public void from_any(Any an_any)
              throws TypeMismatch, InvalidValue
{
  checkType(official_type, an_any.type());
  try
    {
      if (!an_any.type().content_type().equal(content))
        throw new InvalidValue(CONTENT);
    }
  catch (BadKind e)
    {
      TypeMismatch t = new TypeMismatch("Not a box");
      t.initCause(e);
      throw t;
    }

  Serializable s = an_any.extract_Value();
  if (s == null)
    set_to_null();
  else
    {
      try
        {
          Streamable holder = HolderLocator.createHolder(content);
          Field v = holder.getClass().getField("value");
          v.set(holder, s);

          Any cont = createAny();
          cont.insert_Streamable(holder);

          array = new DynAny[] { factory.create_dyn_any(cont) };
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  valueChanged();
}
项目:javify    文件:gnuDynValueBox.java   
/** @inheritDoc */
public Any to_any()
{
  Any a = createAny();

  if (!is_null())
    {
      try
        {
          Streamable holder;
          if (array [ 0 ] instanceof gnuDynAny)
            holder = ((gnuDynAny) array [ 0 ]).holder;
          else
            {
              Any uan = array [ 0 ].to_any();
              holder = uan.extract_Streamable();
            }

          Field v = holder.getClass().getField("value");
          Serializable value = (Serializable) v.get(holder);
          a.type(official_type);
          a.insert_Value(value, content);
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  else
    a.type(orb.get_primitive_tc(TCKind.tk_null));
  return a;
}
项目:javify    文件:AbstractCdrOutput.java   
/**
 * Writes an instance of the CORBA {@link Any}.
 * This method writes the typecode, followed
 * by value itself. In Any contains null
 * (value not set), the {@link TCKind#tk_null}
 * is written.
 *
 * @param x the {@link Any} to write.
 */
public void write_any(Any x)
{
  Streamable value = x.extract_Streamable();
  if (value != null)
    {
      write_TypeCode(x.type());
      value._write(this);
    }
  else
    {
      PrimitiveTypeCode p = new PrimitiveTypeCode(TCKind.tk_null);
      write_TypeCode(p);
    }
}
项目:jvm-stm    文件:_BindingIteratorImplBase.java   
/**
 * The obsolete invocation using server request. Implemented for
 * compatibility reasons, but is it more effectinve to use
 * {@link #_invoke}.
 *
 * @param request a server request.
 */
public void invoke(ServerRequest request)
{
  // "destroy" has a void return type, the two other methods - boolean.
  Streamable result =
    request.operation().equals("destroy") ? null : new BooleanHolder();
  gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
}
项目:jvm-stm    文件:RecordAny.java   
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable sHolder = HolderLocator.createHolder(official_type);

      Class sHolderClass = sHolder.getClass();
      Field sHolderValue = sHolderClass.getField("value");
      Class sClass = sHolderValue.getType();

      Object structure = sClass.newInstance();
      Object member;
      Any am;
      Field vread;
      Field vwrite;
      Streamable memberHolder;

      for (int i = 0; i < array.length; i++)
        {
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          vwrite = structure.getClass().getField(final_type.member_name(i));
          vread = memberHolder.getClass().getField("value");
          member = vread.get(memberHolder);
          vwrite.set(structure, member);
        }

      Any g = createAny();
      sHolderValue.set(sHolder, structure);
      g.insert_Streamable(sHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
项目:jvm-stm    文件:gnuDynAny.java   
/**
 * Create DynAny providing the holder.
 *
 * @param a_holder
 */
public gnuDynAny(Streamable aHolder, TypeCode oType, TypeCode aType,
  gnuDynAnyFactory aFactory, ORB anOrb
)
{
  super(oType, aType, aFactory, anOrb);
  holder = aHolder;
}
项目:jvm-stm    文件:gnuDynAny.java   
/**
 * Create a copy of this {@link DynAny} via buffer read/write.
 */
public DynAny copy()
{
  if (holder != null)
    {
      BufferedCdrOutput buffer = new BufferedCdrOutput();
      holder._write(buffer);

      gnuDynAny other;
      try
        {
          other =
            new gnuDynAny((Streamable) (holder.getClass().newInstance()),
              official_type, final_type, factory, orb
            );
        }
      catch (Exception e)
        {
          // Holder must have parameterless constructor.
          throw new Unexpected(e);
        }
      other.holder._read(buffer.create_input_stream());
      return other;
    }
  else
    {
      return new gnuDynAny(null, official_type, final_type, factory, orb);
    }
}
项目:jvm-stm    文件:gnuDynValueBox.java   
/** @inheritDoc */
public void from_any(Any an_any)
              throws TypeMismatch, InvalidValue
{
  checkType(official_type, an_any.type());
  try
    {
      if (!an_any.type().content_type().equal(content))
        throw new InvalidValue(CONTENT);
    }
  catch (BadKind e)
    {
      TypeMismatch t = new TypeMismatch("Not a box");
      t.initCause(e);
      throw t;
    }

  Serializable s = an_any.extract_Value();
  if (s == null)
    set_to_null();
  else
    {
      try
        {
          Streamable holder = HolderLocator.createHolder(content);
          Field v = holder.getClass().getField("value");
          v.set(holder, s);

          Any cont = createAny();
          cont.insert_Streamable(holder);

          array = new DynAny[] { factory.create_dyn_any(cont) };
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  valueChanged();
}
项目:jvm-stm    文件:gnuDynValueBox.java   
/** @inheritDoc */
public Any to_any()
{
  Any a = createAny();

  if (!is_null())
    {
      try
        {
          Streamable holder;
          if (array [ 0 ] instanceof gnuDynAny)
            holder = ((gnuDynAny) array [ 0 ]).holder;
          else
            {
              Any uan = array [ 0 ].to_any();
              holder = uan.extract_Streamable();
            }

          Field v = holder.getClass().getField("value");
          Serializable value = (Serializable) v.get(holder);
          a.type(official_type);
          a.insert_Value(value, content);
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  else
    a.type(orb.get_primitive_tc(TCKind.tk_null));
  return a;
}
项目:jvm-stm    文件:AbstractCdrOutput.java   
/**
 * Writes an instance of the CORBA {@link Any}.
 * This method writes the typecode, followed
 * by value itself. In Any contains null
 * (value not set), the {@link TCKind#tk_null}
 * is written.
 *
 * @param x the {@link Any} to write.
 */
public void write_any(Any x)
{
  Streamable value = x.extract_Streamable();
  if (value != null)
    {
      write_TypeCode(x.type());
      value._write(this);
    }
  else
    {
      PrimitiveTypeCode p = new PrimitiveTypeCode(TCKind.tk_null);
      write_TypeCode(p);
    }
}
项目:giv-planner    文件:Test75.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s        the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
//debug.log ("insert_Streamable");
typeCode = TypeCodeImpl.convertToNative(orb, s._type());
object = s;
isInitialized = true;
}
项目:infobip-open-jdk-8    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:openjdk-source-code-learn    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:OLD-OpenJDK8    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:JamVM-PH    文件:_BindingIteratorImplBase.java   
/**
 * The obsolete invocation using server request. Implemented for
 * compatibility reasons, but is it more effectinve to use
 * {@link #_invoke}.
 *
 * @param request a server request.
 */
public void invoke(ServerRequest request)
{
  // "destroy" has a void return type, the two other methods - boolean.
  Streamable result =
    request.operation().equals("destroy") ? null : new BooleanHolder();
  gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
}
项目:JamVM-PH    文件:RecordAny.java   
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable sHolder = HolderLocator.createHolder(official_type);

      Class sHolderClass = sHolder.getClass();
      Field sHolderValue = sHolderClass.getField("value");
      Class sClass = sHolderValue.getType();

      Object structure = sClass.newInstance();
      Object member;
      Any am;
      Field vread;
      Field vwrite;
      Streamable memberHolder;

      for (int i = 0; i < array.length; i++)
        {
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          vwrite = structure.getClass().getField(final_type.member_name(i));
          vread = memberHolder.getClass().getField("value");
          member = vread.get(memberHolder);
          vwrite.set(structure, member);
        }

      Any g = createAny();
      sHolderValue.set(sHolder, structure);
      g.insert_Streamable(sHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
项目:JamVM-PH    文件:gnuDynAny.java   
/**
 * Create DynAny providing the holder.
 *
 * @param a_holder
 */
public gnuDynAny(Streamable aHolder, TypeCode oType, TypeCode aType,
  gnuDynAnyFactory aFactory, ORB anOrb
)
{
  super(oType, aType, aFactory, anOrb);
  holder = aHolder;
}
项目:JamVM-PH    文件:gnuDynAny.java   
/**
 * Create a copy of this {@link DynAny} via buffer read/write.
 */
public DynAny copy()
{
  if (holder != null)
    {
      BufferedCdrOutput buffer = new BufferedCdrOutput();
      holder._write(buffer);

      gnuDynAny other;
      try
        {
          other =
            new gnuDynAny((Streamable) (holder.getClass().newInstance()),
              official_type, final_type, factory, orb
            );
        }
      catch (Exception e)
        {
          // Holder must have parameterless constructor.
          throw new Unexpected(e);
        }
      other.holder._read(buffer.create_input_stream());
      return other;
    }
  else
    {
      return new gnuDynAny(null, official_type, final_type, factory, orb);
    }
}
项目:JamVM-PH    文件:gnuDynValueBox.java   
/** @inheritDoc */
public void from_any(Any an_any)
              throws TypeMismatch, InvalidValue
{
  checkType(official_type, an_any.type());
  try
    {
      if (!an_any.type().content_type().equal(content))
        throw new InvalidValue(CONTENT);
    }
  catch (BadKind e)
    {
      TypeMismatch t = new TypeMismatch("Not a box");
      t.initCause(e);
      throw t;
    }

  Serializable s = an_any.extract_Value();
  if (s == null)
    set_to_null();
  else
    {
      try
        {
          Streamable holder = HolderLocator.createHolder(content);
          Field v = holder.getClass().getField("value");
          v.set(holder, s);

          Any cont = createAny();
          cont.insert_Streamable(holder);

          array = new DynAny[] { factory.create_dyn_any(cont) };
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  valueChanged();
}
项目:JamVM-PH    文件:gnuDynValueBox.java   
/** @inheritDoc */
public Any to_any()
{
  Any a = createAny();

  if (!is_null())
    {
      try
        {
          Streamable holder;
          if (array [ 0 ] instanceof gnuDynAny)
            holder = ((gnuDynAny) array [ 0 ]).holder;
          else
            {
              Any uan = array [ 0 ].to_any();
              holder = uan.extract_Streamable();
            }

          Field v = holder.getClass().getField("value");
          Serializable value = (Serializable) v.get(holder);
          a.type(official_type);
          a.insert_Value(value, content);
        }
      catch (Exception ex)
        {
          throw new Unexpected(ex);
        }
    }
  else
    a.type(orb.get_primitive_tc(TCKind.tk_null));
  return a;
}
项目:JamVM-PH    文件:AbstractCdrOutput.java   
/**
 * Writes an instance of the CORBA {@link Any}.
 * This method writes the typecode, followed
 * by value itself. In Any contains null
 * (value not set), the {@link TCKind#tk_null}
 * is written.
 *
 * @param x the {@link Any} to write.
 */
public void write_any(Any x)
{
  Streamable value = x.extract_Streamable();
  if (value != null)
    {
      write_TypeCode(x.type());
      value._write(this);
    }
  else
    {
      PrimitiveTypeCode p = new PrimitiveTypeCode(TCKind.tk_null);
      write_TypeCode(p);
    }
}
项目:openjdk-orb    文件:AnyImpl.java   
/**
 * takes a streamable and inserts its reference into the any
 *
 * @param s         the streamable to insert
 */
public void insert_Streamable(Streamable s)
{
    //debug.log ("insert_Streamable");
    typeCode = TypeCodeImpl.convertToNative(orb, s._type());
    object = s;
    isInitialized = true;
}
项目:classpath    文件:_BindingIteratorImplBase.java   
/**
 * The obsolete invocation using server request. Implemented for
 * compatibility reasons, but is it more effectinve to use
 * {@link #_invoke}.
 *
 * @param request a server request.
 */
public void invoke(ServerRequest request)
{
  // "destroy" has a void return type, the two other methods - boolean.
  Streamable result =
    request.operation().equals("destroy") ? null : new BooleanHolder();
  gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
}
项目:classpath    文件:RecordAny.java   
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable sHolder = HolderLocator.createHolder(official_type);

      Class sHolderClass = sHolder.getClass();
      Field sHolderValue = sHolderClass.getField("value");
      Class sClass = sHolderValue.getType();

      Object structure = sClass.newInstance();
      Object member;
      Any am;
      Field vread;
      Field vwrite;
      Streamable memberHolder;

      for (int i = 0; i < array.length; i++)
        {
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          vwrite = structure.getClass().getField(final_type.member_name(i));
          vread = memberHolder.getClass().getField("value");
          member = vread.get(memberHolder);
          vwrite.set(structure, member);
        }

      Any g = createAny();
      sHolderValue.set(sHolder, structure);
      g.insert_Streamable(sHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
项目:classpath    文件:gnuDynAny.java   
/**
 * Create DynAny providing the holder.
 *
 * @param a_holder
 */
public gnuDynAny(Streamable aHolder, TypeCode oType, TypeCode aType,
  gnuDynAnyFactory aFactory, ORB anOrb
)
{
  super(oType, aType, aFactory, anOrb);
  holder = aHolder;
}
项目:classpath    文件:gnuDynAny.java   
/**
 * Create a copy of this {@link DynAny} via buffer read/write.
 */
public DynAny copy()
{
  if (holder != null)
    {
      BufferedCdrOutput buffer = new BufferedCdrOutput();
      holder._write(buffer);

      gnuDynAny other;
      try
        {
          other =
            new gnuDynAny((Streamable) (holder.getClass().newInstance()),
              official_type, final_type, factory, orb
            );
        }
      catch (Exception e)
        {
          // Holder must have parameterless constructor.
          throw new Unexpected(e);
        }
      other.holder._read(buffer.create_input_stream());
      return other;
    }
  else
    {
      return new gnuDynAny(null, official_type, final_type, factory, orb);
    }
}