src/main/java/pityoulish/jrmi/outlet/MsgOutletHandlerImpl.java
public void sendMessage(String originator, String text, String... recipients)
    throws Exception
  {
    RemoteOutletManager rom = regBackend.getRemoteOutletManager();

    List<String> usernames = null;

    if ((recipients.length == 1) && "*".equals(recipients[0]))
     {
       System.out.println(Catalog.REPORT_LIST_OUTLETS_0.format());
       usernames = rom.listUsernames();
       if (usernames.size() < 1)
        {
          System.out.println(Catalog.REPORT_NO_OUTLET_0.format());
        }
     }
    else
     {
       usernames = Arrays.asList(recipients);
     }

    for (String username: usernames)
     {
       System.out.println(Catalog.REPORT_SENDING_TO_1.format(username));
       // PYL:keep
       Missing.here("deliver the message to the outlet of '"+username+"'");
       // From where can you get the user's outlet?
       // Print the outlet object... can you make sense of the output?
       // Make sure to handle errors. If the outlet is broken, the loop
       // should deliver the message to the remaining users anyway.
       // PYL:cut
       try {
         DirectMessageOutlet dmo = rom.getOutlet(username);
         System.out.println(dmo); // NLS?
         dmo.deliverMessage(originator, text);
       } catch (Exception x) {
         System.out.println(x.toString()); // no trace
       }
       // PYL:end
     }
  }
// non-javadoc, see interface MsgBoardClientHandler
non-javadoc, see interface MsgBoardClientHandler
non - javadoc see interface MsgBoardClientHandler
public void sendMessage(String originator, String text, String... recipients)
    throws Exception
  {
    RemoteOutletManager rom = regBackend.getRemoteOutletManager();
    List<String> usernames = null;
    if ((recipients.length == 1) && "*".equals(recipients[0]))
     {
       System.out.println(Catalog.REPORT_LIST_OUTLETS_0.format());
       usernames = rom.listUsernames();
       if (usernames.size() < 1)
        {
          System.out.println(Catalog.REPORT_NO_OUTLET_0.format());
        }
     }
    else
     {
       usernames = Arrays.asList(recipients);
     }
    for (String username: usernames)
     {
       System.out.println(Catalog.REPORT_SENDING_TO_1.format(username));
       Missing.here("deliver the message to the outlet of '"+username+"'");
       try {
         DirectMessageOutlet dmo = rom.getOutlet(username);
         System.out.println(dmo); 
         dmo.deliverMessage(originator, text);
       } catch (Exception x) {
         System.out.println(x.toString()); 
       }
     }
  }
public void sendMessage ( String originator , String text , String ... recipients ) throws Exception { RemoteOutletManager rom = regBackend . getRemoteOutletManager ( ) ; List < String > usernames = null ; if ( ( recipients . length == 1 ) && "*" . equals ( recipients [ 0 ] ) ) { System . out . println ( Catalog . REPORT_LIST_OUTLETS_0 . format ( ) ) ; usernames = rom . listUsernames ( ) ; if ( usernames . size ( ) < 1 ) { System . out . println ( Catalog . REPORT_NO_OUTLET_0 . format ( ) ) ; } } else { usernames = Arrays . asList ( recipients ) ; } for ( String username : usernames ) { System . out . println ( Catalog . REPORT_SENDING_TO_1 . format ( username ) ) ; Missing . here ( "deliver the message to the outlet of '" + username + "'" ) ; try { DirectMessageOutlet dmo = rom . getOutlet ( username ) ; System . out . println ( dmo ) ; dmo . deliverMessage ( originator , text ) ; } catch ( Exception x ) { System . out . println ( x . toString ( ) ) ; } } }
non-javadoc, see interface MsgBoardClientHandler
non - javadoc see interface MsgBoardClientHandler
// PYL:keep // From where can you get the user's outlet? // Print the outlet object... can you make sense of the output? // Make sure to handle errors. If the outlet is broken, the loop // should deliver the message to the remaining users anyway. // PYL:cut // NLS? // no trace // PYL:end