Package commoms

Examples of commoms.CommandImpl


  comm.setMessage(" " + userName + " gone away!\n");
  return comm;
    }

    CommandIF makeCommandOfPeerList() {
  CommandImpl impl = new CommandImpl();

  impl.setPeerListChanged(true);
  impl.setPrivateMessage(false);
  impl.setCommand(ProtocolConstants.UPDATE_PEER_LIST);
  impl.setNewPeerList(Arrays.asList(peers.keySet().toArray()));

  return impl;
    }
View Full Code Here


  return impl;
    }
   
    CommandIF makeCommandForConfirmation(List recpList) {
  CommandImpl impl = new CommandImpl();
  impl.setPeerListChanged(false);
  impl.setPrivateMessage(false);
  impl.setCommand(ProtocolConstants.CONFIRM_USER);
  impl.setRecipientNames(recpList);
 
  return impl;
    }
View Full Code Here

  showStatus("message sent");

    }

    CommandIF makeCommandForSendToAllMessage(String senderName, String msg) {
  CommandImpl impl = new CommandImpl();

  msg = formatMessage(msg);
  impl.setMessage(msg);
  impl.setCommand(ProtocolConstants.COMMAND_SEND);
  List list = new ArrayList();
  list.add(ProtocolConstants.SEND_TO_ALL);
  impl.setPrivateMessage(false);
  impl.setRecipientNames(list);
  impl.setMsgFrom(senderName);
  return impl;
    }
View Full Code Here

String getUrl() {
return this.url.getHost();
}

CommandIF makeCommandForSendToAllMessage(String senderName, String msg) {
CommandImpl impl = new CommandImpl();
impl.setMessage(senderName + ": " + msg);
impl.setCommand(ProtocolConstants.COMMAND_SEND);
List list = new ArrayList();
list.add(ProtocolConstants.SEND_TO_ALL);
impl.setPrivateMessage(false);
impl.setRecipientNames(list);
impl.setMsgFrom(senderName);
return impl;
}
View Full Code Here

  impl.setMsgFrom(senderName);
  return impl;
    }

    CommandIF makeCommandForPvtMessage(String senderName, String msg) {
  CommandImpl impl = new CommandImpl();

  msg = formatMessage(msg);
  impl.setMessage(msg);
  impl.setCommand(ProtocolConstants.COMMAND_SEND);
  List list = new ArrayList();
  String[] strArr = privateMsgTo.split(",");
  for (String str : strArr) {
      list.add(str);
  }
  impl.setPrivateMessage(true);
  impl.setRecipientNames(list);
  impl.setMsgFrom(senderName);
  return impl;
    }
View Full Code Here

    comm.setMessage(" " + userName + " gone away!");
    return comm;
  }

  CommandIF makeCommandOfPeerList() {
    CommandImpl impl = new CommandImpl();

    impl.setPeerListChanged(true);
    impl.setPrivateMessage(false);
    impl.setCommand(ProtocolConstants.UPDATE_PEER_LIST);
    impl.setNewPeerList(Arrays.asList(peers.keySet().toArray()));

    return impl;
  }
View Full Code Here

impl.setMsgFrom(senderName);
return impl;
}

CommandIF makeCommandForPvtMessage(String senderName, String msg) {
CommandImpl impl = new CommandImpl();
impl.setMessage(senderName + ": " + msg);
impl.setCommand(ProtocolConstants.COMMAND_SEND);
List list = new ArrayList();
list.add(privateMsgTo);
impl.setPrivateMessage(true);
impl.setRecipientNames(list);
impl.setMsgFrom(senderName);
return impl;
}
View Full Code Here

  } else {
      return null;
  }

  CommandImpl impl = new CommandImpl();
  impl.setCommand(ProtocolConstants.COMMAND_SEND);
  impl.setSendingFile(true);
  impl.setPrivateMessage(true);
  impl.setMsgFrom(sendername);
  impl.setFileName(f.getName());
  List list = new ArrayList();
  if ((null == privateMsgTo) || (privateMsgTo.equals(""))
    || (privateMsgTo.contains(ProtocolConstants.SEND_TO_ALL))) {
      showMessage.setTitle(" Error ");
      info.setText("\n    Please select valid users from left\n");
      showMessage.add(info);
      showMessage.setBounds(100, 300, 280, 100);
      showMessage.setVisible(true);
      playAlertSound();
      return null;
  }

  String[] strArr = privateMsgTo.split(",");
  for (String str : strArr) {
      list.add(str);
  }
  impl.setRecipientNames(list);

  try {
      FileInputStream fis = new FileInputStream(f);
      int size = fis.available();
      // size should be less than 10 MB
      // TODO make it configurable
      if (size > maxUploadFileSize) {
    fis.close();
    showMessage.setTitle(" Error ");
    info.setText("\n    File size exceeds max. limit permitted\n");
    showMessage.add(info);
    showMessage.setBounds(100, 300, 280, 100);
    showMessage.setVisible(true);
    playAlertSound();
    return null;
      }

      byte[] bytes = new byte[size];
      fis.read(bytes);

      impl.setFile(bytes);
      fis.close();

  } catch (IOException ioe) {
      ioe.printStackTrace();
  }
View Full Code Here

      e.printStackTrace();
  } catch (IOException e) {

      e.printStackTrace();
  }
  CommandImpl impl = new CommandImpl();
  impl.setCommand(ProtocolConstants.DOWNLOAD_FILE);
  impl.setPrivateMessage(true);
  impl.setConfirmation(false);
  impl.setFileName(fileName);
  impl.setMsgFrom(comm.getMsgFrom());
  impl.setPeerListChanged(false);
  impl.setRecipientNames(comm.getRecipientNames());
  impl.setSendingFile(false);

  return impl;
    }
View Full Code Here

    }


    void sendDeleteFileCommand(CommandIF comm) {

  CommandImpl impl = new CommandImpl();
  impl.setMsgFrom(sendername);
  impl.setCommand(ProtocolConstants.DELETE_FILE);
  impl.setFileName(comm.getMsgFrom() + comm.getFileName());
 
  sendMessage(impl);

    }
View Full Code Here

TOP

Related Classes of commoms.CommandImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.