List of usage examples for org.apache.commons.lang Validate notEmpty
public static void notEmpty(String string)
Validate an argument, throwing IllegalArgumentException
if the argument String is empty (null
or zero length).
Validate.notEmpty(myString);
The message in the exception is 'The validated string is empty'.
From source file:ar.com.zauber.commons.message.message.templates.MultipartSubjectMessageTemplate.java
/** * Creates the MultipartSubjectMessageTemplate. * /* www .j a va 2 s. c o m*/ * @param headers for the messages created * */ public MultipartSubjectMessageTemplate(final List<PartTemplate> templates, final PartTemplate subjectTemplate, final NotificationAddressFactory notificationAddressFactory, final PartTemplate replyToTemplate, final Map<String, String> headers) { Validate.notEmpty(templates); Validate.notNull(subjectTemplate); Validate.notNull(notificationAddressFactory); Validate.notNull(replyToTemplate); Validate.notNull(headers); this.headers = headers; this.templates = templates; this.subjectTemplate = subjectTemplate; this.notificationAddressFactory = notificationAddressFactory; this.replyToTemplate = replyToTemplate; }
From source file:ar.com.zauber.commons.message.impl.mail.BufferedServiceEmailNotificationStrategy.java
/** * Creates the BufferedServiceEmailNotificationStrategy. *//*from w ww .j a va 2s. c o m*/ public BufferedServiceEmailNotificationStrategy(final EmailService emailService, final int qtyFlush, final String senderDomain, final String senderAccount) { Validate.notNull(emailService); Validate.isTrue(qtyFlush > 0); Validate.notEmpty(senderDomain); Validate.notEmpty(senderAccount); this.queue = new ArrayBlockingQueue<SendEmailDTO>(qtyFlush); this.emailService = emailService; this.senderDomain = senderDomain; this.senderAccount = senderAccount; }
From source file:com.vmware.identity.idm.server.AuthSessionFactoryCache.java
/** * Return AuthSessionFactory for the tenant. Use cache if it exist. * Create one if none was found.//w ww . j a v a2s. c o m * @param info * @return * @throws IDMException */ public AuthenticationSessionFactory getAuthnFactory(TenantInformation info) throws IDMException { Validate.notNull(info, "TenantInformation"); String tenantName = info.getTenant().getName(); Validate.notEmpty(tenantName); AuthenticationSessionFactory factory = _factoryLookup.get(tenantName); if (factory == null) { logger.debug("Creating RSA AuthSessionFactory. tenant: " + tenantName); File configFolder = new File(_configDir, tenantName); File apiFile = new File(configFolder, "rsa_api.properties"); String apiPropsFile = apiFile.getAbsolutePath(); Validate.notEmpty(apiPropsFile, "rsa_api.properties"); try { info.get_rsaConfigFilesLock().readLock().lock(); factory = PasscodeAuthenticationServiceProvider.getInstance().getAuthenticationSessionFactory( authSessionType, new SessionFactoryProperties(apiPropsFile)); } catch (AuthenticationException ex) { logger.error(ex); throw new IDMException( String.format("Failed to create AuthSessionFactory instance with %s", apiPropsFile)); } finally { info.get_rsaConfigFilesLock().readLock().unlock(); } _factoryLookup.putIfAbsent(tenantName, factory); //this avoids synchronization logger.debug("Created RSA AuthSessionFactory for tenant: " + tenantName); } return factory; }
From source file:com.vmware.identity.saml.SamlAuthorityFactoryPerformanceWrapper.java
@Override public TokenValidator createTokenValidator(String tenantName) throws NoSuchIdPException, SystemException { Validate.notEmpty(tenantName); return new TokenValidatorImplPerformanceDecorator(wrapped.createTokenValidator(tenantName), perfDataSink); }
From source file:me.eccentric_nz.TARDIS.utility.TARDISUUIDCache.java
/** * Get the UUID from the cache for the player named 'name'. * * If the id does not exist in our database, then we will queue a fetch to * get it, and return null. A fetch at a later point will then be able to * return this id.//from w ww . jav a 2 s . c om * * @param name the player name to lookup * @return the player's UUID */ public UUID getIdOptimistic(String name) { Validate.notEmpty(name); UUID uuid = cache.get(name); if (uuid == null) { ensurePlayerUUID(name); return null; } return uuid; }
From source file:ar.com.zauber.commons.message.message.templates.MultipartMessageTemplate.java
/** * Creates the MultipartMessageTemplate. * * @param headers for the messages created */// w w w .j a va 2 s . c om public MultipartMessageTemplate(final List<PartTemplate> templates, final String subject, final NotificationAddress address, final Map<String, String> headers) { super(); Validate.notEmpty(templates); Validate.notEmpty(subject); Validate.notNull(address); Validate.notNull(headers); this.headers = headers; this.templates = templates; this.subject = subject; this.address = address; }
From source file:ar.com.zauber.commons.spring.beans.factory.impl.ContextPathRegexCaseBlock.java
/** * Creates the ContextPathRegexCaseBlock. * *///w ww . j a va2 s . co m public ContextPathRegexCaseBlock(final String regex, final Object object) { Validate.notEmpty(regex); this.regex = Pattern.compile(regex); this.object = object; }
From source file:com.alibaba.cobar.client.datasources.DefaultCobarDataSourceService.java
public void afterPropertiesSet() throws Exception { if (getHaDataSourceCreator() == null) { setHaDataSourceCreator(new NonHADataSourceCreator()); }/*ww w . j a va 2 s . c om*/ if (CollectionUtils.isEmpty(dataSourceDescriptors)) { return; } for (CobarDataSourceDescriptor descriptor : getDataSourceDescriptors()) { Validate.notEmpty(descriptor.getIdentity()); Validate.notNull(descriptor.getTargetDataSource()); DataSource dataSourceToUse = descriptor.getTargetDataSource(); if (descriptor.getStandbyDataSource() != null) { dataSourceToUse = getHaDataSourceCreator().createHADataSource(descriptor); if (CollectionUtils.isNotEmpty(dataSourcePostProcessor)) { for (IDataSourcePostProcessor pp : dataSourcePostProcessor) { dataSourceToUse = pp.postProcess(dataSourceToUse); } } } dataSources.put(descriptor.getIdentity(), new LazyConnectionDataSourceProxy(dataSourceToUse)); } }
From source file:com.alibaba.cobar.client.router.DefaultCobarClientInternalRouter.java
public RoutingResult doRoute(IBatisRoutingFact routingFact) throws RoutingException { Validate.notNull(routingFact);// w ww.j a v a 2s .c o m String action = routingFact.getAction(); Validate.notEmpty(action); String namespace = StringUtils.substringBeforeLast(action, "."); List<Set<IRoutingRule<IBatisRoutingFact, List<String>>>> rules = getRulesGroupByNamespaces().get(namespace); RoutingResult result = new RoutingResult(); result.setResourceIdentities(new ArrayList<String>()); if (!CollectionUtils.isEmpty(rules)) { IRoutingRule<IBatisRoutingFact, List<String>> ruleToUse = null; for (Set<IRoutingRule<IBatisRoutingFact, List<String>>> ruleSet : rules) { ruleToUse = searchMatchedRuleAgainst(ruleSet, routingFact); if (ruleToUse != null) { break; } } if (ruleToUse != null) { logger.info("matched with rule:{} with fact:{}", ruleToUse, routingFact); result.getResourceIdentities().addAll(ruleToUse.action()); } else { logger.info("No matched rule found for routing fact:{}", routingFact); } } return result; }
From source file:com.edmunds.etm.runtime.api.ApplicationVersion.java
/** * Constructs a new {@code VersionNumber} with the specified version. * * @param version the version string/*from w ww .j a v a 2 s . c o m*/ */ public ApplicationVersion(String version) { Validate.notEmpty(version); parseVersion(version); }