org.objectweb.david.libs.helpers
Class IORHelpers

java.lang.Object
  extended byorg.objectweb.david.libs.helpers.IORHelpers

public class IORHelpers
extends java.lang.Object

This class contains utilies to manipulate Interoperable Object References.


Constructor Summary
IORHelpers()
           
 
Method Summary
static java.lang.String bytesToIORHexString(byte[] octet_stream)
          Returns a stringified IOR.
static java.lang.String forgeIOR(org.omg.CORBA.ORB orb, java.lang.String rep_id, byte[] key, java.lang.String host, int port)
          Creates a stringified IOR with an IIOP profile.
static byte[] IORHexStringToBytes(java.lang.String str)
          Decodes a stringified IOR into an array of bytes encoding the IOR.
static java.lang.String readIORFromFile(java.lang.String filename)
          Reads an IOR from a file.
static java.lang.String readIORFromURL(java.lang.String url)
          Reads an IOR from a file whose location is specified by 'url'.
static void writeIORToFile(java.lang.String ior, java.lang.String filename)
          Writes an IOR to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IORHelpers

public IORHelpers()
Method Detail

forgeIOR

public static final java.lang.String forgeIOR(org.omg.CORBA.ORB orb,
                                              java.lang.String rep_id,
                                              byte[] key,
                                              java.lang.String host,
                                              int port)
                                       throws org.objectweb.jonathan.apis.kernel.JonathanException
Creates a stringified IOR with an IIOP profile.

Parameters:
orb - an ORB instance;
rep_id - the repository id of the interface referenced by the returned IOR;
key - the referenced object key;
host - the name of the machine where the referenced object lives;
port - the port to use to communicate with the referenced object.
Returns:
a stringified IOR of a CORBA object.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if something goes wrong.

writeIORToFile

public static final void writeIORToFile(java.lang.String ior,
                                        java.lang.String filename)
                                 throws java.io.IOException
Writes an IOR to a file.

Parameters:
ior - the IOR to write.
filename - the name of the file.
Throws:
java.io.IOException - if an IO Exception occurred;

readIORFromFile

public static final java.lang.String readIORFromFile(java.lang.String filename)
                                              throws java.io.IOException
Reads an IOR from a file.

Parameters:
filename - the file name.
Returns:
the IOR
Throws:
java.io.IOException - if an IO Exception occurred;

readIORFromURL

public static final java.lang.String readIORFromURL(java.lang.String url)
                                             throws java.io.IOException
Reads an IOR from a file whose location is specified by 'url'.

Parameters:
url - the url specifying the file location.
Returns:
an ior
Throws:
java.io.IOException - if an IO Exception occurred;

bytesToIORHexString

public static final java.lang.String bytesToIORHexString(byte[] octet_stream)
Returns a stringified IOR.

Parameters:
octet_stream - a byte array encoding the IOR.
Returns:
a stringified IOR.

IORHexStringToBytes

public static final byte[] IORHexStringToBytes(java.lang.String str)
Decodes a stringified IOR into an array of bytes encoding the IOR.

Parameters:
str - a stringified IOR.
Returns:
an array of bytes encoding the IOR.