List of usage examples for org.springframework.util Assert hasLength
@Deprecated public static void hasLength(@Nullable String text)
From source file:de.blizzy.documentr.repository.ProjectRepositoryManager.java
ILockedRepository getBranchRepository(String branchName) throws IOException, GitAPIException { Assert.hasLength(branchName); File repoDir = new File(reposDir, branchName); if (!repoDir.isDirectory()) { throw new RepositoryNotFoundException(projectName, branchName); }//from w w w . j a v a 2 s .com LockedRepository lockedRepo = LockedRepository.lockProjectBranch(projectName, branchName, lockManager); Repository repo = new RepositoryBuilder().findGitDir(repoDir).build(); Git.wrap(repo).pull().call(); lockedRepo.setRepository(repo); return lockedRepo; }
From source file:de.blizzy.documentr.search.PageFinder.java
public SearchResult findPages(final String searchText, final int page, final Authentication authentication) throws ParseException, IOException, TimeoutException { Assert.hasLength(searchText); Assert.isTrue(page >= 1);// www .ja v a2 s . c o m Assert.notNull(authentication); IndexSearcher searcher = null; Future<SearchResult> findFuture = null; try { searcher = searcherManager.acquire(); final IndexSearcher indexSearcher = searcher; Callable<SearchResult> findCallable = new Callable<SearchResult>() { @Override public SearchResult call() throws ParseException, IOException, TimeoutException { return findPages(searchText, page, authentication, indexSearcher); } }; findFuture = taskExecutor.submit(findCallable); SearchTextSuggestion suggestion = getSearchTextSuggestion(searchText, authentication, indexSearcher); SearchResult result = findFuture.get(DocumentrConstants.INTERACTIVE_TIMEOUT, TimeUnit.SECONDS); result.setSuggestion(suggestion); return result; } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof ParseException) { throw (ParseException) cause; } else if (cause instanceof IOException) { throw (IOException) cause; } else if (cause instanceof TimeoutException) { throw (TimeoutException) cause; } else { throw Util.toRuntimeException(cause); } } finally { if (findFuture != null) { findFuture.cancel(false); } if (searcher != null) { searcherManager.release(searcher); } } }
From source file:de.blizzy.documentr.search.PageIndex.java
public SearchResult findPages(final String searchText, final int page, final Authentication authentication) throws ParseException, IOException, TimeoutException { Assert.hasLength(searchText); Assert.isTrue(page >= 1);/*from ww w . j av a 2 s . c o m*/ Assert.notNull(authentication); IndexSearcher searcher = null; Future<SearchResult> findFuture = null; try { searcher = searcherManager.acquire(); final IndexSearcher indexSearcher = searcher; Callable<SearchResult> findCallable = new Callable<SearchResult>() { @Override public SearchResult call() throws ParseException, IOException, TimeoutException { return findPages(searchText, page, authentication, indexSearcher); } }; findFuture = taskExecutor.submit(findCallable); SearchTextSuggestion suggestion = getSearchTextSuggestion(searchText, authentication, indexSearcher); SearchResult result = findFuture.get(INTERACTIVE_TIMEOUT, TimeUnit.SECONDS); result.setSuggestion(suggestion); return result; } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof ParseException) { throw (ParseException) cause; } else if (cause instanceof IOException) { throw (IOException) cause; } else if (cause instanceof TimeoutException) { throw (TimeoutException) cause; } else { throw Util.toRuntimeException(cause); } } finally { if (findFuture != null) { findFuture.cancel(false); } if (searcher != null) { searcherManager.release(searcher); } } }
From source file:de.blizzy.documentr.Settings.java
@PostConstruct public void init() { String dataDirParam = getInitParam("documentr.dataDir"); //$NON-NLS-1$ Assert.hasLength(dataDirParam); documentrDataDir = new File(dataDirParam); }
From source file:de.hybris.platform.acceleratorservices.util.RegexParser.java
@Override public void afterPropertiesSet() { Assert.hasLength(regex); pattern = Pattern.compile(regex); }
From source file:org.acegisecurity.ldap.LdapUtils.java
/** * Works out the root DN for an LDAP URL.<p>For example, the URL * <tt>ldap://monkeymachine:11389/dc=acegisecurity,dc=org</tt> has the root DN "dc=acegisecurity,dc=org".</p> * * @param url the LDAP URL/*ww w.ja va 2s . co m*/ * * @return the root DN */ public static String parseRootDnFromUrl(String url) { Assert.hasLength(url); String urlRootDn = ""; if (url.startsWith("ldap:") || url.startsWith("ldaps:")) { // URI uri = parseLdapUrl(url); // urlRootDn = uri.getPath(); // skip past the "://" int colon = url.indexOf(':'); url = url.substring(colon + 3); // Match the slash at the end of the address (if there) int slash = url.indexOf('/'); if (slash >= 0) { urlRootDn = url.substring(slash); } } else { // Assume it's an embedded server urlRootDn = url; } if (urlRootDn.startsWith("/")) { urlRootDn = urlRootDn.substring(1); } return urlRootDn; }
From source file:org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.java
public void afterPropertiesSet() throws Exception { Assert.notNull(userAttribute); Assert.hasLength(key); }
From source file:org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider.java
public void afterPropertiesSet() throws Exception { Assert.hasLength(key); Assert.notNull(this.messages, "A message source must be set"); }
From source file:org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices.java
public void afterPropertiesSet() throws Exception { Assert.hasLength(key); Assert.hasLength(parameter);/*from w ww.ja v a 2 s . c o m*/ Assert.hasLength(cookieName); Assert.notNull(userDetailsService); }
From source file:org.pentaho.platform.plugin.services.importexport.legacy.DbSolutionRepositoryImportSource.java
public DbSolutionRepositoryImportSource(final DataSource dataSource, final String srcCharset, final String requiredCharset, final String ownerName) { super();/* ww w .j a v a 2 s. c o m*/ Assert.notNull(dataSource); this.jdbcTemplate = new JdbcTemplate(dataSource); Assert.hasLength(srcCharset); this.srcCharset = srcCharset; this.requiredCharset = requiredCharset; this.ownerName = ownerName; }