| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.client.cli; |
| | | |
| | |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.EnumSet; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (completionNotificationArg.isPresent()) { |
| | | LinkedList<String> addrs = completionNotificationArg.getValues(); |
| | | for (String addr : addrs) { |
| | | if (!StaticUtils.isEmailAddress(addr)) { |
| | | throw new ArgumentException(ERR_TASKTOOL_INVALID_EMAIL_ADDRESS.get( |
| | | addr, completionNotificationArg.getLongIdentifier())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (errorNotificationArg.isPresent()) { |
| | | LinkedList<String> addrs = errorNotificationArg.getValues(); |
| | | for (String addr : addrs) { |
| | | if (!StaticUtils.isEmailAddress(addr)) { |
| | | throw new ArgumentException(ERR_TASKTOOL_INVALID_EMAIL_ADDRESS.get( |
| | | addr, errorNotificationArg.getLongIdentifier())); |
| | | } |
| | | } |
| | | } |
| | | checkEmailArgument(completionNotificationArg); |
| | | checkEmailArgument(errorNotificationArg); |
| | | |
| | | if (failedDependencyActionArg.isPresent()) { |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void checkEmailArgument(final StringArgument argument) throws ArgumentException { |
| | | if (argument.isPresent()) { |
| | | for (final String email : argument.getValues()) { |
| | | if (!StaticUtils.isEmailAddress(email)) { |
| | | throw new ArgumentException(ERR_TASKTOOL_INVALID_EMAIL_ADDRESS.get(email, argument.getLongIdentifier())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Validates arguments related to task scheduling. This should be |
| | | * called after the <code>ArgumentParser.parseArguments</code> has |