Java Code Examples for gnu.CORBA.Minor

The following are top voted examples for showing how to use gnu.CORBA.Minor. 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: ErrorMessage.java   Source Code and License 6 votes vote down vote up
/**
 * Send the error message to the given IOR address.
 *
 * @param ior the IOR address (host and port, other fields
 * are not used).
 *
 * @param orb the ORB, sending the error message.
 */
public void send(IOR ior, ORB orb)
{
  try
    {
      Socket socket;

      if (orb instanceof OrbFunctional)
        socket = ((OrbFunctional) orb).socketFactory.createClientSocket(
          ior.Internet.host, ior.Internet.port);
      else
        socket = new Socket(ior.Internet.host, ior.Internet.port);

      OutputStream socketOutput = socket.getOutputStream();
      write(socketOutput);
      socketOutput.close();
      socket.close();
    }
  catch (IOException ex)
    {
      MARSHAL t = new MARSHAL();
      t.minor = Minor.Header;
      t.initCause(ex);
      throw t;
    }
}
 
Example 2
Project: javify   File: UnknownEncodingHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the UnknownEncoding from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain UnknownEncoding.
 */
public static UnknownEncoding extract(Any any)
{
  try
    {
      EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable();
      return (UnknownEncoding) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("UnknownEncoding expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 3
Project: javify   File: InvalidTypeForEncodingHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the InvalidTypeForEncoding from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain
 * InvalidTypeForEncoding.
 */
public static InvalidTypeForEncoding extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (InvalidTypeForEncoding) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad =
        new BAD_OPERATION("InvalidTypeForEncoding expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 4
Project: javify   File: TypeMismatchHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the TypeMismatch from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain TypeMismatch.
 */
public static TypeMismatch extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (TypeMismatch) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 5
Project: javify   File: FormatMismatchHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the FormatMismatch from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain FormatMismatch.
 */
public static FormatMismatch extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (FormatMismatch) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("FormatMismatch expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 6
Project: javify   File: AbstractCdrInput.java   Source Code and License 6 votes vote down vote up
/**
 * Read a single byte directly from the buffer.
 */
public int read()
  throws java.io.IOException
{
  try
    {
      return b.read();
    }
  catch (EOFException ex)
    {
      MARSHAL t = new MARSHAL(UNEXP_EOF);
      t.minor = Minor.EOF;
      t.initCause(ex);
      throw t;
    }
}
 
Example 7
Project: javify   File: InvalidValueHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the InvalidValue from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain InvalidValue.
 */
public static InvalidValue extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (InvalidValue) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("InvalidValue expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 8
Project: javify   File: TypeMismatchHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the TypeMismatch from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain TypeMismatch.
 */
public static TypeMismatch extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (TypeMismatch) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 9
Project: javify   File: InconsistentTypeCodeHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the InconsistentTypeCode from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain
 * InconsistentTypeCode.
 */
public static InconsistentTypeCode extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (InconsistentTypeCode) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("InconsistentTypeCode expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 10
Project: javify   File: StructMemberHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Read the StructMember from the input stream.
 */
public static StructMember read(InputStream istream)
{
  try
    {
      StructMember value = new StructMember();
      value.name = istream.read_string();
      value.type = TypeCodeHelper.read(istream);
      value.type_def = IDLTypeHelper.read(istream);
      return value;
    }
  catch (UserException ex)
    {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.UserException;
      m.initCause(ex);
      throw m;
    }
}
 
Example 11
Project: javify   File: StructMemberHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Write the StructMember to the input stream.
 */
public static void write(OutputStream ostream, StructMember value)
{
  try
    {
      ostream.write_string(value.name);
      TypeCodeHelper.write(ostream, value.type);
      IDLTypeHelper.write(ostream, value.type_def);
    }
  catch (UserException ex)
    {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.UserException;
      m.initCause(ex);
      throw m;
    }
}
 
Example 12
Project: javify   File: UnionMemberHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Write the union member to the given stream.
 */
public static void write(OutputStream ostream, UnionMember value)
{
  try
    {
      ostream.write_string(value.name);
      ostream.write_any(value.label);
      TypeCodeHelper.write(ostream, value.type);
      IDLTypeHelper.write(ostream, value.type_def);
    }
  catch (UserException ex)
    {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.UserException;
      m.initCause(ex);
      throw m;
    }
}
 
Example 13
Project: javify   File: ValueMemberHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Reads the value member from the given stream.
 */
public static ValueMember read(InputStream istream)
{
  try
    {
      ValueMember value = new ValueMember();
      value.name = istream.read_string();
      value.id = istream.read_string();
      value.defined_in = istream.read_string();
      value.version = istream.read_string();
      value.type = TypeCodeHelper.read(istream);
      value.type_def = IDLTypeHelper.read(istream);
      value.access = istream.read_short();
      return value;
    }
  catch (UserException ex)
    {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.UserException;
      m.initCause(ex);
      throw m;
    }
}
 
Example 14
Project: javify   File: ValueMemberHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Writes the value member to the given stream.
 */
public static void write(OutputStream ostream, ValueMember value)
{
  try
    {
      ostream.write_string(value.name);
      ostream.write_string(value.id);
      ostream.write_string(value.defined_in);
      ostream.write_string(value.version);
      TypeCodeHelper.write(ostream, value.type);
      IDLTypeHelper.write(ostream, value.type_def);
      ostream.write_short(value.access);
    }
  catch (UserException ex)
    {
      MARSHAL m = new MARSHAL();
      m.minor = Minor.UserException;
      m.initCause(ex);
      throw m;
    }
}
 
Example 15
Project: javify   File: NoContextHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the NoContext from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain NoContext.
 */
public static NoContext extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (NoContext) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("NoContext expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 16
Project: javify   File: AbstractCdrOutput.java   Source Code and License 6 votes vote down vote up
/**
 * Writes first the size of array, and then the byte array using
 * the {@link java.io.OutputStream#write(byte[]) }. The sequence
 * being written is preceeded by the int, representing the array
 * length.
 */
public void write_sequence(byte[] buf)
{
  try
    {
      write_long(buf.length);
      write(buf);
    }
  catch (IOException ex)
    {
      MARSHAL t = new MARSHAL();
      t.minor = Minor.CDR;
      t.initCause(ex);
      throw t;
    }
}
 
Example 17
Project: javify   File: AdapterAlreadyExistsHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the AdapterAlreadyExists from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain AdapterAlreadyExists.
 */
public static AdapterAlreadyExists extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (AdapterAlreadyExists) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("AdapterAlreadyExists expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 18
Project: javify   File: AdapterNonExistentHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the AdapterNonExistent from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain AdapterNonExistent.
 */
public static AdapterNonExistent extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (AdapterNonExistent) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("AdapterNonExistent expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 19
Project: javify   File: ServantNotActiveHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the ServantNotActive from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain ServantNotActive.
 */
public static ServantNotActive extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (ServantNotActive) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("ServantNotActive expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 20
Project: javify   File: ServantAlreadyActiveHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the ServantAlreadyActive from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain ServantAlreadyActive.
 */
public static ServantAlreadyActive extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (ServantAlreadyActive) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("ServantAlreadyActive expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 21
Project: javify   File: WrongPolicyHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the WrongPolicy from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain WrongPolicy.
 */
public static WrongPolicy extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (WrongPolicy) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("WrongPolicy expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 22
Project: javify   File: NoServantHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the NoServant from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain NoServant.
 */
public static NoServant extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (NoServant) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("NoServant expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 23
Project: javify   File: ObjectAlreadyActiveHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the ObjectAlreadyActive from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain ObjectAlreadyActive.
 */
public static ObjectAlreadyActive extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (ObjectAlreadyActive) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("ObjectAlreadyActive expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 24
Project: javify   File: ObjectNotActiveHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the ObjectNotActive from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain ObjectNotActive.
 */
public static ObjectNotActive extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (ObjectNotActive) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("ObjectNotActive expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 25
Project: javify   File: WrongAdapterHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the WrongAdapter from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain WrongAdapter.
 */
public static WrongAdapter extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (WrongAdapter) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("WrongAdapter expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 26
Project: javify   File: HeadlessInput.java   Source Code and License 6 votes vote down vote up
/**
 * Try to read when having an unitialised value.
 */
public Serializable read_value(Class clz)
{
  if (subsequentCalls)
    return stream.read_value(clz);
  else
    {
      try
        {
          subsequentCalls = true;
          Serializable value = (Serializable) Vio.instantiateAnyWay(clz);
          value = Vio.readValue(this, NONE, value, null, null,
            null, null);
          return value;
        }
      catch (Exception ex)
        {
          MARSHAL m = new MARSHAL("Can't read an instance of "
            + clz.getName());
          m.minor = Minor.Value;
          m.initCause(ex);
          throw m;
        }
    }
}
 
Example 27
Project: javify   File: gnuRuntime.java   Source Code and License 6 votes vote down vote up
/**
 * Get the object, written at the given position. This returs both shared
 * objects and repository Ids.
 *
 * @return the position, at that the object is allready written.
 *
 * @throws MARSHAL if there is no object written at that position.
 */
public Object isObjectWrittenAt(int x, int offset)
{
  Entry e = (Entry) positions.get(new Integer(x));
  if (e instanceof Redirection)
    return isObjectWrittenAt(e.at, offset);
  else if (e != null)
    return e.object;
  else
    {
      MARSHAL m = new MARSHAL("No object was written at " + x +
        " (offset " + offset + ") r " + this + dump());
      m.minor = Minor.Graph;
      throw m;
    }
}
 
Example 28
Project: javify   File: CloseMessage.java   Source Code and License 6 votes vote down vote up
/**
 * Send the close message to the given output stream. The method,
 * however, does not close the socket itself, this must be done
 * explicitly in the calling code.
 *
 * @param socketStream a stream, where the close message is
 * written.
 */
public static void close(OutputStream socketStream)
{
  try
    {
      Singleton.write(socketStream);
      socketStream.flush();
    }
  catch (IOException ex)
    {
      MARSHAL m = new MARSHAL("Unable to flush the stream");
      m.minor = Minor.Header;
      m.initCause(ex);
      throw m;
    }
}
 
Example 29
Project: javify   File: InvalidSlotHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the InvalidSlot from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain InvalidSlot.
 */
public static InvalidSlot extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (InvalidSlot) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("InvalidSlot expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 30
Project: javify   File: AbstractCdrInput.java   Source Code and License 6 votes vote down vote up
/**
 * Read bytes directly from the buffer.
 */
public int read(byte[] x, int ofs, int len)
  throws java.io.IOException
{
  try
    {
      return b.read(x, ofs, len);
    }
  catch (EOFException ex)
    {
      MARSHAL t = new MARSHAL(UNEXP_EOF);
      t.minor = Minor.EOF;
      t.initCause(ex);
      throw t;
    }
}
 
Example 31
Project: javify   File: ObjectReferenceTemplateHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the ObjectReferenceTemplate from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not
 * contain ObjectReferenceTemplate.
 */
public static ObjectReferenceTemplate extract(Any any)
{
  try
    {
      ObjectReferenceTemplateHolder h =
        (ObjectReferenceTemplateHolder) any.extract_Streamable();
      return h.value;
    }
  catch (ClassCastException ex)
    {
      BAD_OPERATION bad =
        new BAD_OPERATION("ObjectReferenceTemplate expected");
      bad.minor = Minor.Any;
      bad.initCause(ex);
      throw bad;
    }
}
 
Example 32
Project: javify   File: ObjectReferenceTemplateSeqHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the <code>ObjectReferenceTemplate[]</code> from the given
 * {@link Any}. This implementation expects the {@link Any} to hold the
 * instance of {@link ObjectReferenceTemplateSeqHolder} that is returned by
 * {@link Any#extract_Streamable() }.
 *
 * @param a an Any to extract the array from.
 *
 * @return the extracted array.
 *
 * @throws BAD_OPERATION if the Any contains something other than the the
 * {@link ObjectReferenceTemplateSeqHolder}.
 */
public static ObjectReferenceTemplate[] extract(Any a)
{
  try
    {
      ObjectReferenceTemplateSeqHolder h = (ObjectReferenceTemplateSeqHolder)
        a.extract_Streamable();
      return h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION(
        "ObjectReferenceTemplate[] expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 33
Project: javify   File: IORInterceptor_3_0Helper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the IORInterceptor_3_0 from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain
 * IORInterceptor_3_0.
 */
public static IORInterceptor_3_0 extract(Any any)
{
  try
    {
      IORInterceptor_3_0Holder holder = (IORInterceptor_3_0Holder)
        any.extract_Streamable();
      return holder.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("IORInterceptor_3_0 expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 34
Project: javify   File: InvalidNameHelper.java   Source Code and License 6 votes vote down vote up
/**
 * Extract the InvalidName from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain InvalidName.
 */
public static InvalidName extract(Any any)
{
  try
    {
      EmptyExceptionHolder h =
        (EmptyExceptionHolder) any.extract_Streamable();
      return (InvalidName) h.value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("InvalidName expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 35
Project: javify   File: CorbalocParser.java   Source Code and License 6 votes vote down vote up
/**
 * Read IOR from the file in the local file system.
 */
String readFile(String file)
{
  File f = new File(file);
  if (!f.exists())
    {
      DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath()
        + " does not exist.");
      err.minor = Minor.Missing_IOR;
    }
  try
    {
      char[] c = new char[(int) f.length()];
      FileReader fr = new FileReader(f);
      fr.read(c);
      fr.close();
      return new String(c).trim();
    }
  catch (IOException ex)
    {
      DATA_CONVERSION d = new DATA_CONVERSION();
      d.initCause(ex);
      d.minor = Minor.Missing_IOR;
      throw (d);
    }
}
 
Example 36
Project: javify   File: NameParser.java   Source Code and License 6 votes vote down vote up
/**
 * Read IOR from the file in the local file system.
 */
String readFile(String file)
{
  File f = new File(file);
  if (!f.exists())
    {
      DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath()
        + " does not exist.");
      err.minor = Minor.Missing_IOR;
    }
  try
    {
      char[] c = new char[(int) f.length()];
      FileReader fr = new FileReader(f);
      fr.read(c);
      fr.close();
      return new String(c).trim();
    }
  catch (IOException ex)
    {
      DATA_CONVERSION d = new DATA_CONVERSION();
      d.initCause(ex);
      d.minor = Minor.Missing_IOR;
      throw (d);
    }
}
 
Example 37
Project: javify   File: IORHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the IOR from given Any.
 * This method uses the IORHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain IOR.
 */
public static IOR extract(Any any)
{
  try
    {
      return ((IORHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("IOR expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 38
Project: javify   File: MultipleComponentProfileHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the MultipleComponentProfile from given Any.
 * This method uses the MultipleComponentProfileHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain MultipleComponentProfile.
 */
public static TaggedComponent[] extract(Any any)
{
  try
    {
      return ((MultipleComponentProfileHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("MultipleComponentProfile expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 39
Project: javify   File: ServiceContextHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the ServiceContext from given Any.
 * This method uses the ServiceContextHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain ServiceContext.
 */
public static ServiceContext extract(Any any)
{
  try
    {
      return ((ServiceContextHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("ServiceContext expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 40
Project: javify   File: TaggedProfileHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Write the structure to the CDR output stream.
 *
 * @param output a org.omg.CORBA.portable stream stream to write into.
 * @param value a value to write.
 */
public static void write(OutputStream output, TaggedProfile value)
{
  output.write_long(value.tag);

  if (output instanceof BufferedCdrOutput)
    {
      // Highly probable.
      output.write_long(value.profile_data.length);
      try
        {
          output.write(value.profile_data);
        }
      catch (IOException e)
        {
          MARSHAL m = new MARSHAL();
          m.minor = Minor.Encapsulation;
          m.initCause(e);
          throw m;
        }
    }
  else
    {
      output.write_long(value.profile_data.length);
      for (int i0 = 0; i0 < value.profile_data.length; i0++)
        output.write_octet(value.profile_data[i0]);
    }
}
 
Example 41
Project: javify   File: NameDynAnyPairSeqHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the NameDynAnyPairSeq from given Any.
 * This method uses the NameDynAnyPairSeqHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain NameDynAnyPairSeq.
 */
public static NameDynAnyPair[] extract(Any any)
{
  try
    {
      return ((NameDynAnyPairSeqHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPairSeq expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 42
Project: javify   File: _DynAnyFactoryStub.java   Source Code and License 5 votes vote down vote up
/**
 * The remote call of this DynAnyFactory method is not possible
 * (the created DynAny would not be transferred to client).
 *
 * @throws MARSHAL, always.
 */
public DynAny create_dyn_any(Any _0)
                      throws InconsistentTypeCode
{
  MARSHAL m = new MARSHAL(NOT_APPLICABLE);
  m.minor = Minor.Inappropriate;
  throw m;
}
 
Example 43
Project: javify   File: _DynAnyFactoryStub.java   Source Code and License 5 votes vote down vote up
/**
 * The remote call of this DynAnyFactory method is not possible
 * (the created DynAny would not be transferred to client).
 *
 * @throws MARSHAL, always.
 */
public DynAny create_dyn_any_from_type_code(TypeCode _0)
                                     throws InconsistentTypeCode
{
  MARSHAL m = new MARSHAL(NOT_APPLICABLE);
  m.minor = Minor.Inappropriate;
  throw m;
}
 
Example 44
Project: javify   File: DynAnySeqHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the DynAnySeq from given Any.
 * This method uses the DynAnySeqHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain DynAnySeq.
 */
public static DynAny[] extract(Any any)
{
  try
    {
      return ((DynAnySeqHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("DynAnySeq expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 45
Project: javify   File: NameValuePairHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the NameValuePair from given Any.
 * This method uses the NameValuePairHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain NameValuePair.
 */
public static NameValuePair extract(Any any)
{
  try
    {
      return ((NameValuePairHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 46
Project: javify   File: NameDynAnyPairHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the NameDynAnyPair from given Any.
 * This method uses the NameDynAnyPairHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain NameDynAnyPair.
 */
public static NameDynAnyPair extract(Any any)
{
  try
    {
      return ((NameDynAnyPairHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPair expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 47
Project: javify   File: NameValuePairSeqHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the NameValuePairSeq from given Any.
 * This method uses the NameValuePairSeqHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain NameValuePairSeq.
 */
public static NameValuePair[] extract(Any any)
{
  try
    {
      return ((NameValuePairSeqHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("NameValuePairSeq expected");
      bad.initCause(cex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 48
Project: javify   File: ObjectHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the array of object from the given {@link Any}.
 */
public static org.omg.CORBA.Object extract(Any a)
{
  try
    {
      return ((ObjectHolder) a.extract_Streamable()).value;
    }
  catch (ClassCastException ex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("CORBA object expected");
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 49
Project: javify   File: Vio.java   Source Code and License 5 votes vote down vote up
/**
 * Throw MARSHAL.
 */
static void throwIt(String msg, String id1, String id2, Throwable e)
  throws MARSHAL
{
  MARSHAL m = new MARSHAL(msg + ":'" + id1 + "' versus '" + id2 + "'");
  if (e != null)
    m.initCause(e);
  m.minor = Minor.Value;
  throw m;
}
 
Example 50
Project: javify   File: UnknownUserExceptionHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the UnknownUserException from given Any.
 * This method uses the UnknownUserExceptionHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain
 * UnknownUserException.
 */
public static UnknownUserException extract(Any any)
{
  try
    {
      return ((UnknownUserExceptionHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("UnknownUserException expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}
 
Example 51
Project: javify   File: NameParser.java   Source Code and License 5 votes vote down vote up
/**
 * Read IOR from the remote URL.
 */
String readUrl(String url)
{
  URL u;
  try
    {
      u = new URL(url);
    }
  catch (MalformedURLException mex)
    {
      throw new BAD_PARAM("Malformed URL: '" + url + "'");
    }

  try
    {
      InputStreamReader r = new InputStreamReader(u.openStream());

      CPStringBuilder b = new CPStringBuilder();
      int c;

      while ((c = r.read()) > 0)
        b.append((char) c);

      return b.toString().trim();
    }
  catch (Exception exc)
    {
      DATA_CONVERSION d = new DATA_CONVERSION("Reading " + url + " failed.");
      d.minor = Minor.Missing_IOR;
      throw d;
    }
}
 
Example 52
Project: javify   File: ServiceDetailHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the service detail info from the given {@link Any}
 *
 * @param a the Any to extract from.
 *
 * @return the extracted detail.
 *
 * @throws BAD_OPERATION if the parameter holds something different
 * from the ServiceDetail.
 */
public static ServiceDetail extract(Any a)
{
  try
    {
      return ((ServiceDetailHolder) a.extract_Streamable()).value;
    }
  catch (ClassCastException ex)
    {
      BAD_OPERATION bad = new BAD_OPERATION();
      bad.initCause(ex);
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 53
Project: javify   File: WStringValueHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Write the given wide string value into the output stream.
 *
 * @param ostream a stream to write into.
 * @param a_string a string to write.
 */
public void write_value(OutputStream ostream, Serializable a_string)
{
  try
    {
      ostream.write_wstring((String) a_string);
    }
  catch (ClassCastException ex)
    {
      MARSHAL m = new MARSHAL("String expected");
      m.minor = Minor.ClassCast;
      throw m;
    }
}
 
Example 54
Project: javify   File: WStringValueHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the wide string from the given Any. The operation
 * requires Any to hold a String value and not a String.
 *
 * @param an_any an Any to extract from.
 *
 * @return the extracted string.
 */
public static String extract(Any an_any)
{
  if (an_any.type().equal(type()))
    {
      an_any.type(twString);
      return an_any.extract_wstring();
    }
  else
    {
      BAD_OPERATION bad = new BAD_OPERATION("WString value type expected");
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 55
Project: javify   File: PolicyHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the Policy from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain Policy.
 */
public static Policy extract(Any any)
{
  try
    {
      PolicyHolder h = (PolicyHolder) any.extract_Streamable();
      return h.value;
    }
  catch (ClassCastException ex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("Policy expected");
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 56
Project: javify   File: PolicyListHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the Policy[] from given Any.
 *
 * @throws BAD_OPERATION if the passed Any does not contain Policy[].
 */
public static Policy[] extract(Any any)
{
  try
    {
      PolicyListHolder holds = (PolicyListHolder) any.extract_Streamable();
      return holds.value;
    }
  catch (ClassCastException ex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("Policy[] expected");
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 57
Project: javify   File: NameValuePairHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the NameValuePair from the given {@link Any}.
 */
public static NameValuePair extract(Any a)
{
  try
    {
      return ((NameValuePairHolder) a.extract_Streamable()).value;
    }
  catch (ClassCastException ex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected");
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 58
Project: javify   File: StringValueHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Write the given string value into the output stream.
 *
 * @param ostream a stream to write into.
 * @param a_string a string to write.
 */
public void write_value(OutputStream ostream, Serializable a_string)
{
  try
    {
      ostream.write_string((String) a_string);
    }
  catch (ClassCastException ex)
    {
      MARSHAL m = new MARSHAL("String expected");
      m.minor = Minor.ClassCast;
      throw m;
    }
}
 
Example 59
Project: javify   File: StringValueHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the string from the given Any. The operation
 * requires Any to hold a String value and not a String.
 *
 * @param an_any an Any to extract from.
 *
 * @return the extracted string.
 */
public static String extract(Any an_any)
{
  if (an_any.type().equal(type()))
    {
      an_any.type(tString);
      return an_any.extract_string();
    }
  else
    {
      BAD_OPERATION bad = new BAD_OPERATION("String value type expected");
      bad.minor = Minor.Any;
      throw bad;
    }
}
 
Example 60
Project: javify   File: ForwardRequestHelper.java   Source Code and License 5 votes vote down vote up
/**
 * Extract the ForwardRequest from given Any.
 * This method uses the ForwardRequestHolder.
 *
 * @throws BAD_OPERATION if the passed Any does not contain ForwardRequest.
 */
public static ForwardRequest extract(Any any)
{
  try
    {
      return ((ForwardRequestHolder) any.extract_Streamable()).value;
    }
  catch (ClassCastException cex)
    {
      BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected");
      bad.minor = Minor.Any;
      bad.initCause(cex);
      throw bad;
    }
}