List of usage examples for org.springframework.util Assert state
public static void state(boolean expression, Supplier<String> messageSupplier)
From source file:com.autentia.wuija.security.impl.hibernate.HibernateUserDetailsServiceHelper.java
/** * Devuelve el grupo que corresponde con <code>group</code>. * //www .j av a 2 s. c o m * @param group El nombre del grupo. * @return El grupo que corresponde con <code>group</code>. * @throws BadCredentialsException Si no se encuentra el grupo o si hay algun problema. */ public SecurityGroup loadGroupByGroupName(String group) throws BadCredentialsException, DataAccessException { Assert.hasText(group, "group must not be empty"); final String groupByNameHql = userDetailsHqlProvider.getGroupByNameHql(); if (log.isDebugEnabled()) { log.debug("Loading group: " + group + ", query: " + groupByNameHql); } final List<SecurityGroup> groups = dao.find(groupByNameHql, group); Assert.state(groups.size() == 1, "Cannot find group: " + group); return groups.get(0); }
From source file:cz.cvut.zuul.support.spring.provider.RemoteResourceTokenServices.java
public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException { LOG.debug("Verifying access token {} on authorization server: {}", accessToken, tokenInfoEndpointUrl); TokenInfo tokenInfo = requestTokenInfo(accessToken); LOG.debug("Server returned: {}", tokenInfo); Assert.state(tokenInfo.getClientId() != null, "Client id must be present in response from auth server"); AuthorizationRequest clientAuthentication = createClientAuthentication(tokenInfo); Authentication userAuthentication = createUserAuthentication(tokenInfo); return new OAuth2Authentication(clientAuthentication, userAuthentication); }
From source file:admin.jmx.StepExecutionServiceLevelMonitor.java
public void afterPropertiesSet() throws Exception { Assert.state(jobName != null, "A Job name must be provided"); Assert.state(stepName != null, "A Step name must be provided"); Assert.state(upperThreshold > 0, "A threshold must be provided"); Assert.state(lowerThreshold < upperThreshold, "A threshold must be provided"); if (lowerThreshold == 0) { lowerThreshold = upperThreshold * 8 / 10; }/*w ww.j a va2s . c o m*/ }
From source file:com.github.mybatis.repository.autoconfig.MybatisAutoConfiguration.java
@PostConstruct public void checkConfigFileExists() { if (this.properties.isCheckConfigLocation() && StringUtils.hasText(this.properties.getConfigLocation())) { Resource resource = this.resourceLoader.getResource(this.properties.getConfigLocation()); Assert.state(resource.exists(), "Cannot find config location: " + resource + " (please add config file or check your Mybatis configuration)"); }/*from w w w .ja v a 2 s. c o m*/ }
From source file:com.wavemaker.commons.io.store.StoredFolder.java
@Override public Folder copyTo(Folder folder) { Assert.notNull(folder, "Folder must not be empty"); ensureExists();/* www . j a va2 s . co m*/ Assert.state(getPath().getParent() != null, "Unable to copy a root folder"); Folder destination = createDestinationFolder(folder); for (Resource child : list()) { child.copyTo(destination); } return destination; }
From source file:org.opennms.ng.services.databaseschemaconfig.JdbcFilterDao.java
/** * <p>afterPropertiesSet</p> */// w ww. j a v a2 s.co m @Override public void afterPropertiesSet() { Assert.state(m_dataSource != null, "property dataSource cannot be null"); Assert.state(m_databaseSchemaConfigFactory != null, "property databaseSchemaConfigFactory cannot be null"); }
From source file:org.opennms.ng.services.collectdconfig.CollectdConfigFactory.java
/** * Return the singleton instance of this factory. * * @return The current factory instance. * @throws IllegalStateException Thrown if the factory has not yet been initialized. */// w w w. ja v a 2 s. c o m public static synchronized CollectdConfigFactory getInstance() { Assert.state(isInitialized(), "The factory has not been initialized"); return m_singleton; }
From source file:org.pivotal.gemfire.cache.GemFireBasedSerialAsyncEventQueueTest.java
protected AsyncEventQueue getEventQueue() { Assert.state(eventQueue != null, "The 'EventQueue' was not properly configured and initialized!"); return eventQueue; }
From source file:sample.GemFireClientServerReadyBeanPostProcessor.java
@SuppressWarnings("all") private void validateCacheClientSubscriptionQueueConnectionEstablished() throws InterruptedException { boolean cacheClientSubscriptionQueueConnectionEstablished = false; Pool pool = defaultIfNull(this.gemfirePool.get(), GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME, GEMFIRE_DEFAULT_POOL_NAME);/*from www . ja v a 2s .co m*/ if (pool instanceof PoolImpl) { long timeout = (System.currentTimeMillis() + DEFAULT_TIMEOUT); while (System.currentTimeMillis() < timeout && !((PoolImpl) pool).isPrimaryUpdaterAlive()) { synchronized (pool) { TimeUnit.MILLISECONDS.timedWait(pool, 500L); } } cacheClientSubscriptionQueueConnectionEstablished |= ((PoolImpl) pool).isPrimaryUpdaterAlive(); } Assert.state(cacheClientSubscriptionQueueConnectionEstablished, String.format( "Cache client subscription queue connection not established; GemFire Pool was [%s];" + " GemFire Pool configuration was [locators = %s, servers = %s]", pool, pool.getLocators(), pool.getServers())); }