Java Code Examples for org.omg.CORBA.portable.Streamable

The following are top voted examples for showing how to use org.omg.CORBA.portable.Streamable. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: javify   File: Vio.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Project: jvm-stm   File: Vio.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Project: JamVM-PH   File: Vio.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Project: classpath   File: Vio.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 5
Project: TIDorbJ   File: DynUnionImpl.java   Source Code and License 6 votes vote down vote up
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());
    }
}
 
Example 6
Project: OpenJSharp   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 7
Project: openjdk-jdk10   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 8
Project: openjdk9   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 9
Project: lookaside_java-1.8.0-openjdk   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 10
Project: jdk8u_corba   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 11
Project: javify   File: _BindingIteratorImplBase.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 12
Project: javify   File: RecordAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 13
Project: javify   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 14
Project: javify   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 15
Project: javify   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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();
}
 
Example 16
Project: javify   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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;
}
 
Example 17
Project: javify   File: AbstractCdrOutput.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 18
Project: jvm-stm   File: _BindingIteratorImplBase.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 19
Project: jvm-stm   File: RecordAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 20
Project: jvm-stm   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 21
Project: jvm-stm   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 22
Project: jvm-stm   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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();
}
 
Example 23
Project: jvm-stm   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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;
}
 
Example 24
Project: jvm-stm   File: AbstractCdrOutput.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 25
Project: giv-planner   File: Test75.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 26
Project: infobip-open-jdk-8   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 27
Project: openjdk-source-code-learn   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 28
Project: OLD-OpenJDK8   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 29
Project: JamVM-PH   File: _BindingIteratorImplBase.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 30
Project: JamVM-PH   File: RecordAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 31
Project: JamVM-PH   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 32
Project: JamVM-PH   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 33
Project: JamVM-PH   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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();
}
 
Example 34
Project: JamVM-PH   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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;
}
 
Example 35
Project: JamVM-PH   File: AbstractCdrOutput.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 36
Project: openjdk-orb   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 37
Project: classpath   File: _BindingIteratorImplBase.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 38
Project: classpath   File: RecordAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 39
Project: classpath   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 40
Project: classpath   File: gnuDynAny.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 41
Project: classpath   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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();
}
 
Example 42
Project: classpath   File: gnuDynValueBox.java   Source Code and License 5 votes vote down vote up
/** @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;
}
 
Example 43
Project: classpath   File: AbstractCdrOutput.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 44
Project: openjdk-icedtea7   File: AnyImpl.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 45
Project: OpenJSharp   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 46
Project: openjdk-jdk10   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 47
Project: openjdk9   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 48
Project: lookaside_java-1.8.0-openjdk   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 49
Project: jdk8u_corba   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 50
Project: javify   File: ValueHandlerDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Checks if an instance of this class can write its fields itself.
 */
public boolean isCustomMarshaled(Class clz)
{
  return CustomMarshal.class.isAssignableFrom(clz)
    || Streamable.class.isAssignableFrom(clz);
}
 
Example 51
Project: javify   File: gnuDynAnyFactory.java   Source Code and License 4 votes vote down vote up
/**
 * Create the undivideable DynAny.
 */
public DynAny create_simple(TypeCode official, TypeCode type)
{
  Streamable holder = HolderLocator.createHolder(type);
  return new gnuDynAny(holder, official, type, this, orb);
}
 
Example 52
Project: javify   File: gnuDynArray.java   Source Code and License 4 votes vote down vote up
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable memberHolder =
        HolderLocator.createHolder(official_components);

      if (memberHolder == null)
        memberHolder = HolderLocator.createHolder(final_components);

      Class memberHolderClass = memberHolder.getClass();
      Class memberClass = memberHolderClass.getField("value").getType();

      Object members = Array.newInstance(memberClass, array.length);
      Object member;
      Any am;
      Field value = memberHolder.getClass().getField("value");

      for (int i = 0; i < array.length; i++)
        {
          // Recursive call should support multidimensional arrays.
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          member = value.get(memberHolder);
          Array.set(members, i, member);
        }

      Streamable arrayHolder = HolderLocator.createHolder(official_type);
      arrayHolder.getClass().getField("value").set(arrayHolder, members);

      Any g = createAny();
      g.insert_Streamable(arrayHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
 
Example 53
Project: jvm-stm   File: ValueHandlerDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Checks if an instance of this class can write its fields itself.
 */
public boolean isCustomMarshaled(Class clz)
{
  return CustomMarshal.class.isAssignableFrom(clz)
    || Streamable.class.isAssignableFrom(clz);
}
 
Example 54
Project: jvm-stm   File: gnuDynAnyFactory.java   Source Code and License 4 votes vote down vote up
/**
 * Create the undivideable DynAny.
 */
public DynAny create_simple(TypeCode official, TypeCode type)
{
  Streamable holder = HolderLocator.createHolder(type);
  return new gnuDynAny(holder, official, type, this, orb);
}
 
Example 55
Project: jvm-stm   File: gnuDynArray.java   Source Code and License 4 votes vote down vote up
/**
 * Done via reflection.
 */
public Any to_any()
{
  try
    {
      Streamable memberHolder =
        HolderLocator.createHolder(official_components);

      if (memberHolder == null)
        memberHolder = HolderLocator.createHolder(final_components);

      Class memberHolderClass = memberHolder.getClass();
      Class memberClass = memberHolderClass.getField("value").getType();

      Object members = Array.newInstance(memberClass, array.length);
      Object member;
      Any am;
      Field value = memberHolder.getClass().getField("value");

      for (int i = 0; i < array.length; i++)
        {
          // Recursive call should support multidimensional arrays.
          am = array [ i ].to_any();
          memberHolder = am.extract_Streamable();
          member = value.get(memberHolder);
          Array.set(members, i, member);
        }

      Streamable arrayHolder = HolderLocator.createHolder(official_type);
      arrayHolder.getClass().getField("value").set(arrayHolder, members);

      Any g = createAny();
      g.insert_Streamable(arrayHolder);
      g.type(official_type);
      return g;
    }
  catch (Exception e)
    {
      throw new Unexpected(e);
    }
}
 
Example 56
Project: giv-planner   File: Test75.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
//debug.log( "extract_Streamable" ) ;
return (Streamable)object;
}
 
Example 57
Project: infobip-open-jdk-8   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 58
Project: openjdk-source-code-learn   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 59
Project: OLD-OpenJDK8   File: AnyImpl.java   Source Code and License 4 votes vote down vote up
public Streamable extract_Streamable()
{
    //debug.log( "extract_Streamable" ) ;
    return (Streamable)object;
}
 
Example 60
Project: JamVM-PH   File: ValueHandlerDelegateImpl.java   Source Code and License 4 votes vote down vote up
/**
 * Checks if an instance of this class can write its fields itself.
 */
public boolean isCustomMarshaled(Class clz)
{
  return CustomMarshal.class.isAssignableFrom(clz)
    || Streamable.class.isAssignableFrom(clz);
}