This adds support for two properties that are used in CORBA since jdk 1.5.
2005-11-10 Audrius Meskauskas <[EMAIL PROTECTED]> * gnu/CORBA/OrbFunctional.java (use_properties, set_parameters): Rewritten to support orb and server ids. * org/omg/CORBA/ORB.java, org/omg/PortableInterceptor/ObjectReferenceTemplate.java: Documentation update.
Index: gnu/CORBA/OrbFunctional.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/CORBA/OrbFunctional.java,v retrieving revision 1.2 diff -u -r1.2 OrbFunctional.java --- gnu/CORBA/OrbFunctional.java 28 Oct 2005 13:01:50 -0000 1.2 +++ gnu/CORBA/OrbFunctional.java 10 Nov 2005 07:34:00 -0000 @@ -298,6 +298,17 @@ public static final String NAME_SERVICE = "NameService"; /** + * Defines the ORB ID that is accessible by IOR interceptors. + */ + public static final String ORB_ID = "org.omg.CORBA.ORBid"; + + + /** + * Defines the SERVER ID that is accessible by IOR interceptors. + */ + public static final String SERVER_ID = "org.omg.CORBA.ServerId"; + + /** * The if the client has once opened a socket, it should start sending the * message header in a given time. Otherwise the server will close the socket. * This prevents server hang when the client opens the socket, but does not @@ -370,6 +381,17 @@ * seven seconds. */ public static int TANDEM_REQUESTS = 7000; + + /** + * The Id of this ORB. + */ + public String orb_id = "orb_"+hashCode(); + + /** + * The Id of this Server. This field is defined static to ensure it has + * the same value over all ORB's in this machine. + */ + public static String server_id = "server_"+OrbFunctional.class.hashCode(); /** * The map of the already conncted objects. @@ -1093,9 +1115,9 @@ /** * Set the ORB parameters. This method is normally called from * [EMAIL PROTECTED] #init(Applet, Properties)}. - * + * * @param app the current applet. - * + * * @param props application specific properties, passed as the second * parameter in [EMAIL PROTECTED] #init(Applet, Properties)}. Can be <code>null</code>. */ @@ -1108,37 +1130,39 @@ { for (int i = 0; i < para.length; i++) { - if (para [ i ] [ 0 ].equals(LISTEN_ON)) - Port = Integer.parseInt(para [ i ] [ 1 ]); - if (para [ i ] [ 0 ].equals(REFERENCE)) + if (para[i][0].equals(LISTEN_ON)) + Port = Integer.parseInt(para[i][1]); + if (para[i][0].equals(REFERENCE)) { - StringTokenizer st = - new StringTokenizer(para [ i ] [ 1 ], "="); + StringTokenizer st = new StringTokenizer(para[i][1], "="); initial_references.put(st.nextToken(), - string_to_object(st.nextToken()) - ); + string_to_object(st.nextToken())); } - if (para [ i ] [ 0 ].equals(NS_HOST)) - ns_host = para [ i ] [ 1 ]; - if (para [ i ] [ 0 ].equals(START_READING_MESSAGE)) - TOUT_START_READING_MESSAGE = Integer.parseInt(para [ i ] [ 1 ]); - if (para [ i ] [ 0 ].equals(WHILE_READING)) - TOUT_WHILE_READING = Integer.parseInt(para [ i ] [ 1 ]); - if (para [ i ] [ 0 ].equals(AFTER_RECEIVING)) - TOUT_AFTER_RECEIVING = Integer.parseInt(para [ i ] [ 1 ]); + if (para[i][0].equals(ORB_ID)) + orb_id = para[i][1]; + + if (para[i][0].equals(SERVER_ID)) + server_id = para[i][1]; + + if (para[i][0].equals(NS_HOST)) + ns_host = para[i][1]; + if (para[i][0].equals(START_READING_MESSAGE)) + TOUT_START_READING_MESSAGE = Integer.parseInt(para[i][1]); + if (para[i][0].equals(WHILE_READING)) + TOUT_WHILE_READING = Integer.parseInt(para[i][1]); + if (para[i][0].equals(AFTER_RECEIVING)) + TOUT_AFTER_RECEIVING = Integer.parseInt(para[i][1]); try { - if (para [ i ] [ 0 ].equals(NS_PORT)) - ns_port = Integer.parseInt(para [ i ] [ 1 ]); + if (para[i][0].equals(NS_PORT)) + ns_port = Integer.parseInt(para[i][1]); } catch (NumberFormatException ex) { - BAD_PARAM bad = - new BAD_PARAM("Invalid " + NS_PORT + - "property, unable to parse '" + - props.getProperty(NS_PORT) + "'" - ); + BAD_PARAM bad = new BAD_PARAM("Invalid " + NS_PORT + + "property, unable to parse '" + props.getProperty(NS_PORT) + + "'"); bad.initCause(ex); throw bad; } @@ -1149,11 +1173,11 @@ /** * Set the ORB parameters. This method is normally called from * [EMAIL PROTECTED] #init(String[], Properties)}. - * + * * @param para the parameters, that were passed as the parameters to the * <code>main(String[] args)</code> method of the current standalone * application. - * + * * @param props application specific properties that were passed as a second * parameter in [EMAIL PROTECTED] init(String[], Properties)}). Can be <code>null</code>. */ @@ -1163,29 +1187,33 @@ { for (int i = 0; i < para.length - 1; i++) { - if (para [ i ].endsWith("ListenOn")) - Port = Integer.parseInt(para [ i + 1 ]); - if (para [ i ].endsWith("ORBInitRef")) + if (para[i].endsWith("ListenOn")) + Port = Integer.parseInt(para[i + 1]); + if (para[i].endsWith("ORBInitRef")) { - StringTokenizer st = new StringTokenizer(para [ i + 1 ], "="); + StringTokenizer st = new StringTokenizer(para[i + 1], "="); initial_references.put(st.nextToken(), - string_to_object(st.nextToken()) - ); + string_to_object(st.nextToken())); } - if (para [ i ].endsWith("ORBInitialHost")) - ns_host = para [ i + 1 ]; + if (para[i].endsWith("ORBInitialHost")) + ns_host = para[i + 1]; + + if (para[i].endsWith("ServerId")) + server_id = para[i++]; + else if (para[i].endsWith("ORBid")) + orb_id = para[i++]; + try { - if (para [ i ].endsWith("ORBInitialPort")) - ns_port = Integer.parseInt(para [ i + 1 ]); + if (para[i].endsWith("ORBInitialPort")) + ns_port = Integer.parseInt(para[i + 1]); } catch (NumberFormatException ex) { - throw new BAD_PARAM("Invalid " + para [ i ] + - "parameter, unable to parse '" + - props.getProperty(para [ i + 1 ]) + "'" - ); + throw new BAD_PARAM("Invalid " + para[i] + + "parameter, unable to parse '" + + props.getProperty(para[i + 1]) + "'"); } } } @@ -1640,6 +1668,12 @@ throw p; } } + + if (props.containsKey(ORB_ID)) + orb_id = props.getProperty(ORB_ID); + + if (props.containsKey(SERVER_ID)) + server_id = props.getProperty(SERVER_ID); Enumeration en = props.elements(); while (en.hasMoreElements()) Index: org/omg/CORBA/ORB.java =================================================================== RCS file: /cvsroot/classpath/classpath/org/omg/CORBA/ORB.java,v retrieving revision 1.24 diff -u -r1.24 ORB.java --- org/omg/CORBA/ORB.java 6 Nov 2005 11:32:32 -0000 1.24 +++ org/omg/CORBA/ORB.java 10 Nov 2005 07:25:12 -0000 @@ -49,6 +49,7 @@ import gnu.CORBA.typecodes.RecursiveTypeCode; import org.omg.CORBA.ORBPackage.InconsistentTypeCode; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; import java.applet.Applet; @@ -95,6 +96,21 @@ * <td>org.omg.CORBA.ORBInitRef</td> * <td>Specifies the initial reference, accessible by name with the method * [EMAIL PROTECTED] #resolve_initial_references(String)}.</td> + * </tr> + * <tr> + * <td>org.omg.CORBA.ORBid</td> + * <td>Specifies the name (ORB Id) of this ORB. The ORB Id is later accessible + * by [EMAIL PROTECTED] ObjectReferenceTemplate#orb_id}. The default value includes the + * hashcode of the ORB instance that is normally different for each ORB. + * </td> + * </tr> + * <tr> + * <td>org.omg.CORBA.ServerId</td> + * <td>Specifies the name (Server Id) of this server. This property assigns + * value to the <i>static</i> field, ensuring that all ORB's on the same jre + * have the same Server Id. It is normally set as the system property. The + * server Id is later accessible as [EMAIL PROTECTED] ObjectReferenceTemplate#server_id}. + * </td> * </tr> * <tr> * <td>gnu.CORBA.ListenerPort</td> Index: org/omg/PortableInterceptor/ObjectReferenceTemplate.java =================================================================== RCS file: /cvsroot/classpath/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java,v retrieving revision 1.1 diff -u -r1.1 ObjectReferenceTemplate.java --- org/omg/PortableInterceptor/ObjectReferenceTemplate.java 9 Nov 2005 18:40:30 -0000 1.1 +++ org/omg/PortableInterceptor/ObjectReferenceTemplate.java 10 Nov 2005 07:41:44 -0000 @@ -38,7 +38,7 @@ package org.omg.PortableInterceptor; -import org.omg.CORBA.portable.IDLEntity; +import org.omg.PortableServer.POA; /** * Defines the identity of the portable object adapter ([EMAIL PROTECTED] POA}}. The @@ -51,7 +51,10 @@ extends ObjectReferenceFactory { /** - * Get the name of this adapter. + * Get the name of this adapter. This name can be set by specifying + * the org.omg.CORBA.ORBid property in the ORB.Init(.., Properties). + * The default value includes the hashcode of the ORB instance and hence + * should normally differ for each ORB. * * @return the name of adapter, represented in the form of the string array. */ @@ -65,7 +68,9 @@ String orb_id(); /** - * Get the server id of of this adapter. + * Get the server id of of this adapter. This name can be set by specifying + * the org.omg.CORBA.ServerId property in the ORB.Init(.., Properties) or + * in the system property. All ORB's on the same jre share the same value. * * @return the server id, represented in the form of string. */
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches