Package org.waveprotocol.wave.model.wave

Examples of org.waveprotocol.wave.model.wave.InvalidParticipantAddress


    if (!Strings.isNullOrEmpty(proxyFor)) {
      RobotName robotName = RobotName.fromAddress(participant.getAddress());
      robotName.setProxyFor(proxyFor);
      String robotAddress = robotName.toParticipantAddress();
      if (!RobotName.isWellFormedAddress(robotAddress)) {
        throw new InvalidParticipantAddress(robotAddress,
            "is not a valid robot name, the proxy is likely to be wrong");
      }
      return ParticipantId.of(robotName.toParticipantAddress());
    } else {
      return participant;
View Full Code Here


        }
      }
    } catch (UnsupportedEncodingException ex) {
      throw new RuntimeException(ex);
    } catch (InvalidNameException ex) {
      throw new InvalidParticipantAddress(distinguishedName,
          "Certificate does not contain a valid distinguished name");
    }
    return null;
  }
View Full Code Here

  public static ParticipantId checkNewUsername(String domain, String username) throws InvalidParticipantAddress {
    ParticipantId id = null;

      // First, some cleanup on the parameters.
      if (username == null) {
        throw new InvalidParticipantAddress(username, "Username portion of address cannot be empty");
      }
      username = username.trim().toLowerCase();
      if (username.contains(ParticipantId.DOMAIN_PREFIX)) {
        id = ParticipantId.of(username);
      } else {
        id = ParticipantId.of(username + ParticipantId.DOMAIN_PREFIX + domain);
      }
      if (id.getAddress().indexOf("@") < 1) {
        throw new InvalidParticipantAddress(username, "Username portion of address cannot be empty");
      }
      String[] usernameSplit = id.getAddress().split("@");
      if (usernameSplit.length != 2 || !usernameSplit[0].matches("[\\w\\.]+")) {
        throw new InvalidParticipantAddress(username, "Only letters (a-z), numbers (0-9), and periods (.) are allowed in Username");
      }
      if (!id.getDomain().equals(domain)) {
        throw new InvalidParticipantAddress(username,"You can only create users at the " + domain + " domain");
      }
    return id;
  }
View Full Code Here

    if (!Strings.isNullOrEmpty(proxyFor)) {
      RobotName robotName = RobotName.fromAddress(participant.getAddress());
      robotName.setProxyFor(proxyFor);
      String robotAddress = robotName.toParticipantAddress();
      if (!RobotName.isWellFormedAddress(robotAddress)) {
        throw new InvalidParticipantAddress(robotAddress,
            "is not a valid robot name, the proxy is likely to be wrong");
      }
      return ParticipantId.of(robotName.toParticipantAddress());
    } else {
      return participant;
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.wave.InvalidParticipantAddress

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.