/[classpath]/classpath/gnu/CORBA/OrbFunctional.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/OrbFunctional.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.1 by gnu_andrew, Wed Nov 2 00:43:23 2005 UTC revision 1.2.2.2 by gnu_andrew, Sun Nov 27 21:00:36 2005 UTC
# Line 298  public class OrbFunctional extends OrbRe Line 298  public class OrbFunctional extends OrbRe
298    public static final String NAME_SERVICE = "NameService";    public static final String NAME_SERVICE = "NameService";
299        
300    /**    /**
301       * Defines the ORB ID that is accessible by IOR interceptors.
302       */
303      public static final String ORB_ID = "org.omg.CORBA.ORBid";
304      
305      
306      /**
307       * Defines the SERVER ID that is accessible by IOR interceptors.
308       */
309      public static final String SERVER_ID = "org.omg.CORBA.ServerId";
310      
311      /**
312     * The if the client has once opened a socket, it should start sending the     * The if the client has once opened a socket, it should start sending the
313     * message header in a given time. Otherwise the server will close the socket.     * message header in a given time. Otherwise the server will close the socket.
314     * This prevents server hang when the client opens the socket, but does not     * This prevents server hang when the client opens the socket, but does not
# Line 370  public class OrbFunctional extends OrbRe Line 381  public class OrbFunctional extends OrbRe
381     * seven seconds.     * seven seconds.
382     */     */
383    public static int TANDEM_REQUESTS = 7000;    public static int TANDEM_REQUESTS = 7000;
384      
385      /**
386       * The Id of this ORB.
387       */
388      public String orb_id = "orb_"+hashCode();
389      
390      /**
391       * The Id of this Server. This field is defined static to ensure it has
392       * the same value over all ORB's in this machine.
393       */
394      public static String server_id = "server_"+OrbFunctional.class.hashCode();
395    
396    /**    /**
397     * The map of the already conncted objects.     * The map of the already conncted objects.
# Line 1093  public class OrbFunctional extends OrbRe Line 1115  public class OrbFunctional extends OrbRe
1115    /**    /**
1116     * Set the ORB parameters. This method is normally called from     * Set the ORB parameters. This method is normally called from
1117     * {@link #init(Applet, Properties)}.     * {@link #init(Applet, Properties)}.
1118     *     *
1119     * @param app the current applet.     * @param app the current applet.
1120     *     *
1121     * @param props application specific properties, passed as the second     * @param props application specific properties, passed as the second
1122     * parameter in {@link #init(Applet, Properties)}. Can be <code>null</code>.     * parameter in {@link #init(Applet, Properties)}. Can be <code>null</code>.
1123     */     */
# Line 1108  public class OrbFunctional extends OrbRe Line 1130  public class OrbFunctional extends OrbRe
1130        {        {
1131          for (int i = 0; i < para.length; i++)          for (int i = 0; i < para.length; i++)
1132            {            {
1133              if (para [ i ] [ 0 ].equals(LISTEN_ON))              if (para[i][0].equals(LISTEN_ON))
1134                Port = Integer.parseInt(para [ i ] [ 1 ]);                Port = Integer.parseInt(para[i][1]);
1135              if (para [ i ] [ 0 ].equals(REFERENCE))              if (para[i][0].equals(REFERENCE))
1136                {                {
1137                  StringTokenizer st =                  StringTokenizer st = new StringTokenizer(para[i][1], "=");
                   new StringTokenizer(para [ i ] [ 1 ], "=");  
1138                  initial_references.put(st.nextToken(),                  initial_references.put(st.nextToken(),
1139                    string_to_object(st.nextToken())                    string_to_object(st.nextToken()));
                 );  
1140                }                }
1141    
1142              if (para [ i ] [ 0 ].equals(NS_HOST))              if (para[i][0].equals(ORB_ID))
1143                ns_host = para [ i ] [ 1 ];                orb_id = para[i][1];
1144              if (para [ i ] [ 0 ].equals(START_READING_MESSAGE))  
1145                TOUT_START_READING_MESSAGE = Integer.parseInt(para [ i ] [ 1 ]);              if (para[i][0].equals(SERVER_ID))
1146              if (para [ i ] [ 0 ].equals(WHILE_READING))                server_id = para[i][1];
1147                TOUT_WHILE_READING = Integer.parseInt(para [ i ] [ 1 ]);  
1148              if (para [ i ] [ 0 ].equals(AFTER_RECEIVING))              if (para[i][0].equals(NS_HOST))
1149                TOUT_AFTER_RECEIVING = Integer.parseInt(para [ i ] [ 1 ]);                ns_host = para[i][1];
1150                if (para[i][0].equals(START_READING_MESSAGE))
1151                  TOUT_START_READING_MESSAGE = Integer.parseInt(para[i][1]);
1152                if (para[i][0].equals(WHILE_READING))
1153                  TOUT_WHILE_READING = Integer.parseInt(para[i][1]);
1154                if (para[i][0].equals(AFTER_RECEIVING))
1155                  TOUT_AFTER_RECEIVING = Integer.parseInt(para[i][1]);
1156              try              try
1157                {                {
1158                  if (para [ i ] [ 0 ].equals(NS_PORT))                  if (para[i][0].equals(NS_PORT))
1159                    ns_port = Integer.parseInt(para [ i ] [ 1 ]);                    ns_port = Integer.parseInt(para[i][1]);
1160                }                }
1161              catch (NumberFormatException ex)              catch (NumberFormatException ex)
1162                {                {
1163                  BAD_PARAM bad =                  BAD_PARAM bad = new BAD_PARAM("Invalid " + NS_PORT
1164                    new BAD_PARAM("Invalid " + NS_PORT +                    + "property, unable to parse '" + props.getProperty(NS_PORT)
1165                      "property, unable to parse '" +                    + "'");
                     props.getProperty(NS_PORT) + "'"  
                   );  
1166                  bad.initCause(ex);                  bad.initCause(ex);
1167                  throw bad;                  throw bad;
1168                }                }
# Line 1149  public class OrbFunctional extends OrbRe Line 1173  public class OrbFunctional extends OrbRe
1173    /**    /**
1174     * Set the ORB parameters. This method is normally called from     * Set the ORB parameters. This method is normally called from
1175     * {@link #init(String[], Properties)}.     * {@link #init(String[], Properties)}.
1176     *     *
1177     * @param para the parameters, that were passed as the parameters to the     * @param para the parameters, that were passed as the parameters to the
1178     * <code>main(String[] args)</code> method of the current standalone     * <code>main(String[] args)</code> method of the current standalone
1179     * application.     * application.
1180     *     *
1181     * @param props application specific properties that were passed as a second     * @param props application specific properties that were passed as a second
1182     * parameter in {@link init(String[], Properties)}). Can be <code>null</code>.     * parameter in {@link init(String[], Properties)}). Can be <code>null</code>.
1183     */     */
# Line 1163  public class OrbFunctional extends OrbRe Line 1187  public class OrbFunctional extends OrbRe
1187        {        {
1188          for (int i = 0; i < para.length - 1; i++)          for (int i = 0; i < para.length - 1; i++)
1189            {            {
1190              if (para [ i ].endsWith("ListenOn"))              if (para[i].endsWith("ListenOn"))
1191                Port = Integer.parseInt(para [ i + 1 ]);                Port = Integer.parseInt(para[i + 1]);
1192              if (para [ i ].endsWith("ORBInitRef"))              if (para[i].endsWith("ORBInitRef"))
1193                {                {
1194                  StringTokenizer st = new StringTokenizer(para [ i + 1 ], "=");                  StringTokenizer st = new StringTokenizer(para[i + 1], "=");
1195                  initial_references.put(st.nextToken(),                  initial_references.put(st.nextToken(),
1196                    string_to_object(st.nextToken())                    string_to_object(st.nextToken()));
                 );  
1197                }                }
1198    
1199              if (para [ i ].endsWith("ORBInitialHost"))              if (para[i].endsWith("ORBInitialHost"))
1200                ns_host = para [ i + 1 ];                ns_host = para[i + 1];
1201    
1202                if (para[i].endsWith("ServerId"))
1203                  server_id = para[i++];
1204                else if (para[i].endsWith("ORBid"))
1205                  orb_id = para[i++];
1206    
1207              try              try
1208                {                {
1209                  if (para [ i ].endsWith("ORBInitialPort"))                  if (para[i].endsWith("ORBInitialPort"))
1210                    ns_port = Integer.parseInt(para [ i + 1 ]);                    ns_port = Integer.parseInt(para[i + 1]);
1211                }                }
1212              catch (NumberFormatException ex)              catch (NumberFormatException ex)
1213                {                {
1214                  throw new BAD_PARAM("Invalid " + para [ i ] +                  throw new BAD_PARAM("Invalid " + para[i]
1215                    "parameter, unable to parse '" +                    + "parameter, unable to parse '"
1216                    props.getProperty(para [ i + 1 ]) + "'"                    + props.getProperty(para[i + 1]) + "'");
                 );  
1217                }                }
1218            }            }
1219        }        }
# Line 1584  public class OrbFunctional extends OrbRe Line 1612  public class OrbFunctional extends OrbRe
1612          // TODO log it.          // TODO log it.
1613          return;          return;
1614        }        }
1615        finally
1616          {
1617            try
1618              {
1619                if (service!=null && !service.isClosed())
1620                  service.close();
1621              }
1622            catch (IOException ioex)
1623              {
1624                // OK.
1625              }
1626          }
1627    }    }
1628        
1629    /**    /**
# Line 1641  public class OrbFunctional extends OrbRe Line 1681  public class OrbFunctional extends OrbRe
1681                }                }
1682            }            }
1683                    
1684            if (props.containsKey(ORB_ID))
1685              orb_id = props.getProperty(ORB_ID);
1686            
1687            if (props.containsKey(SERVER_ID))
1688              server_id = props.getProperty(SERVER_ID);
1689            
1690          Enumeration en = props.elements();          Enumeration en = props.elements();
1691          while (en.hasMoreElements())          while (en.hasMoreElements())
1692            {            {

Legend:
Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26