id
stringlengths
7
14
text
stringlengths
1
106k
4031229_3
public static Optional<String> getLastSegment(final URI uri) { return getSegment(uri, -1); }
4031229_4
public static String getParent(final URI uri) { final String path = uri.getPath(); if (StringUtils.isBlank(path)) { return "/"; } final String parent = path.substring(0, path.lastIndexOf('/')).trim(); return StringUtils.isBlank(parent) ? "/" : parent; }
4031229_5
public static String getPath(final URI uri) { return isFileUri(uri) ? uri.getPath() : uri.toASCIIString(); }
4031229_6
public static String getPath(final URI uri) { return isFileUri(uri) ? uri.getPath() : uri.toASCIIString(); }
4031229_7
public static URI toUri(final String s) { URI uri = createURI(s); if (uri.getScheme() != null) { final Matcher matcher = supportedUriSchemeRe.matcher(uri.getScheme()); Preconditions.checkArgument(matcher.find(), "Supported URI schemes are: http, https and file"); return uri; } re...
4031229_8
public static String getFullSourcePath(final HtmlPage htmlPage, final String sourceName) { try { final URI sourceUri = URI.create(sourceName.replaceAll(" ", "%20")); if (sourceUri.isAbsolute()) { return new File(URI.create(sourceUri.getScheme() + "://" + sourceUri.getPath())).getAbsolute...
4031229_9
public static String getFullSourcePath(final HtmlPage htmlPage, final String sourceName) { try { final URI sourceUri = URI.create(sourceName.replaceAll(" ", "%20")); if (sourceUri.isAbsolute()) { return new File(URI.create(sourceUri.getScheme() + "://" + sourceUri.getPath())).getAbsolute...
4057303_0
@Override public ContainerAddress selectDestinationForMessage(final KeyedMessageWithType message) { if(!isRunning.get()) throw new IllegalStateException( "attempt to use " + SimpleRoutingStrategy.class.getSimpleName() + " prior to starting it or after stopping it."); return address.get(); }
4057303_1
protected String getName(final String key) { return MetricRegistry.name(DropwizardNodeStatsCollector.class, "node", key); }
4057303_2
protected String getName(final String key) { return MetricRegistry.name(DropwizardClusterStatsCollector.class, "cluster", clusterId.applicationName, clusterId.clusterName, key); }
4057303_3
public static InetAddress getFirstNonLocalhostInetAddress() throws SocketException { return getFirstNonLocalhostInetAddress(null); }
4057303_4
public Manager(final Class<T> clazz) { this.clazz = clazz; }
4057303_5
public T getAssociatedInstance(final String typeId) throws DempsyException { if(LOGGER.isTraceEnabled()) LOGGER.trace("Trying to find " + clazz.getSimpleName() + " associated with the transport \"{}\"", typeId); T ret = null; synchronized(registered) { ret = registered.get(typeId); i...
4060867_0
protected void setArtistSortName(List<Artist> artists, String[] ignoredArticles) { for (Artist artist : artists) { rtist.setSortName(artist.getName()); for (int i = 0; i < ignoredArticles.length; i++) { if (artist.getName().toUpperCase().startsWith(ignoredArticles[i] + " ")) { artist.setSortName(arti...
4060867_1
protected Map<Character, String> createIndexesFromExpression(String expr) { Map<Character, String> index = new LinkedHashMap<>(); String[] expressions = StringUtils.split(expr, ' '); for (String expression : expressions) { int separatorIndex = expression.indexOf('('); if (separatorIndex == -1 && ex...
4060867_2
protected Map<String, List<Artist>> createArtistIndex(Map<Character, String> letterIndex, List<Artist> artists) { Map<String, List<Artist>> map = new LinkedHashMap<>(); for (String index : letterIndex.values()) { map.put(index, new ArrayList<Artist>()); } for (Artist artist : artists) { char f...
4060867_3
protected Comparator<String> getIndexComparator() { return new Comparator<String>() { Override ublic int compare(String s1, String s2) { if (s1.equals(HASH_STR) && s2.equals(HASH_STR)) { return 0; } else if (s1.equals(HASH_STR)) { return 1; } else if (s2.equals(HASH_STR)) { return -1; } else { return s1.compareTo(...
4060867_4
public void star(HttpServletRequest request, HttpServletResponse response) throws Exception { starOrUnstar(request, response, true); }
4060867_5
public void unstar(HttpServletRequest request, HttpServletResponse response) throws Exception { starOrUnstar(request, response, false); }
4060867_6
public void ping(HttpServletRequest request, HttpServletResponse response) throws Exception { XMLBuilder builder = createXMLBuilder(request, response, true).endAll(); response.getWriter().print(builder); }
4060867_7
public void getVideos(HttpServletRequest request, HttpServletResponse response) throws Exception { XMLBuilder builder = createXMLBuilder(request, response, true); builder.add("videos", true); builder.endAll(); response.getWriter().print(builder); }
4090170_0
public void generate(Schema schema, Writer output) throws IOException { final VelocityContext context = new VelocityContext(); context.put("schema", schema); context.put("this", this); engine.mergeTemplate(path + "fields.vm", "UTF-8", context, output); }
4090170_1
public File getDestination(Schema schema, File outputDirectory) { final String classFile = fieldsClassName(schema.getName()) + ".java"; final String packageDir; if(schema.getNamespace() == null) { packageDir = ""; } else { packageDir = schema.getNamespace().replace('.', '/'); } r...
4101951_0
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_1
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_2
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_3
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_4
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_5
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_6
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_7
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_8
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4101951_9
public List<DtoProperty> getProperties() { if (properties == null) { properties = list(); final List<PropConfig> pcs = getPropertiesConfig(); if (getDomainType() != null) { addPropertiesFromDomainObject(pcs); addChainedPropertiesFromDomainObject(pcs); } addLeftOverExtensionProperties(p...
4103388_0
Method getControllerMethod(final String methodName, final Object controllerInstance, final Object[] args, final String cacheKey) { final Class<?> controllerClass = controllerInstance.getClass(); // retrieve method from cache, or put in cache if not there Method controllerMethod = ...
4103388_1
Object getController(final String controllerName, final boolean isExternal) { Object controllerInstance = this.controllers.get(controllerName); // if retrieving yields null, get controller from Guice, and put in cache if (controllerInstance == null) { // make up the full class name final Str...
4103388_2
Class<?>[] getClasses(final Object[] args) { if (args == null) { return new Class<?>[0]; } final Class<?>[] classes = new Class<?>[args.length]; for (int ii = 0; ii < classes.length; ii++) { classes[ii] = args[ii].getClass(); } return classes; }
4103388_3
@Override protected Object invokeMethod(HttpServletRequest servletRequest) throws Exception { StepRequest sr = new StepRequest(servletRequest, UTF_8_ENCODING); return invokeMethodWithStepRequest(sr); }
4103388_4
public ControllerCacheKey getCacheKey() { final String methodKey; // generate the shorter key final StringBuilder cacheKeyBuffer = new StringBuilder(this.controllerName.length() + this.methodName.length()); cacheKeyBuffer.append(this.controllerName); cacheKeyBuffer.append(this.methodName...
4103388_5
public ControllerCacheKey getCacheKey() { final String methodKey; // generate the shorter key final StringBuilder cacheKeyBuffer = new StringBuilder(this.controllerName.length() + this.methodName.length()); cacheKeyBuffer.append(this.controllerName); cacheKeyBuffer.append(this.methodName...
4103388_6
private String[] parseArguments(final int parameterStart, final String encoding) { final List<String> arguments = new ArrayList<String>(); int argStart = parameterStart; int nextArgStop = this.requestURI.indexOf('/', argStart); try { while (nextArgStop != -1) { arguments.add(URLDecod...
4103388_7
public String[] getArgs() { return this.args; }
4103388_8
public ModulesForLanguageUser getModules(final String allVersions) { final String language = this.clientSession.get().getLanguage(); final Locale userLocale = this.clientSession.get().getLocale(); final ModulesForLanguageUser versions = new ModulesForLanguageUser(); versions.setLanguageCode(userLocale.g...
4103388_9
public OsisWrapper getBibleText(final String version, final String reference) { return getBibleText(version, reference, null, null, null); }
4106766_0
@RequestMapping(method=RequestMethod.GET) public ResponseEntity<List<User>> findAll(){ final List<User> users = userService.getAllUsers(); if(users == null){ return new ResponseEntity<List<User>>(HttpStatus.NOT_FOUND); } return new ResponseEntity<List<User>>(users, HttpStatus.OK); }
4106766_1
@RequestMapping(method = RequestMethod.POST) public ResponseEntity<User> createUser(@RequestBody User user){ try { final User dbuser = userService.createUser(user); return new ResponseEntity<User>(dbuser, HttpStatus.CREATED); }catch (Exception e){ return new ResponseEntity<User>(HttpStat...
4106766_2
@RequestMapping(value="/{id}",method = RequestMethod.GET) public ResponseEntity<User> getUser(@PathVariable String id){ try { final User dbuser = userService.findUserById(id); if(dbuser == null){ return new ResponseEntity<User>(HttpStatus.NOT_FOUND); } return new Respons...
4106766_3
@RequestMapping(value="/{id}",method = RequestMethod.PUT) public ResponseEntity<User> updateUser(@PathVariable String id, @RequestBody User user){ try { final User dbuser = userService.updateUser(id, user); return new ResponseEntity<User>(dbuser, HttpStatus.OK); }catch (Exception e){ re...
4106766_4
@RequestMapping(value="/{id}",method = RequestMethod.DELETE) public ResponseEntity<User> deleteUser(@PathVariable String id, @RequestBody User user){ try { final User dbuser = userService.deleteUser(id, user); return new ResponseEntity<User>(dbuser, HttpStatus.OK); } catch (RuntimeException e){...
4106766_5
public static void main(String[] args) throws Exception { final InputStream properties = Thread.currentThread().getContextClassLoader() .getResourceAsStream("aws.properties"); final AWSCredentials propertiesCredentials = new PropertiesCredentials(properties); final AmazonDynamoDB amazonDynamoDb ...
4106766_6
@Override public User get(String username) throws Exception { return Optional.ofNullable(dynamoDBMapper.load(User.class, username)) .orElseThrow(() -> new Exception(String.format("User for username %s was not found", username))); }
4106766_7
@RequestMapping(method = RequestMethod.GET) public CompletableFuture<ResponseEntity<Ip>> ip() { return httpBinService.ip() .thenApply(ResponseEntity::ok); }
4112450_0
public static final String resolveDelimitedTemplate(final String suffix, final String postfix, final String template, final Map<String, String> map) { if (suffix==null || postfix==null || template == null || map == null) { return null; } String buffer = new String(template); synchronized...
4112450_1
public static <T, D extends Set<Object[]>> D readCsv(final Logger LOGGER, final File csv, final String separator, final SetComparator<T> comparator, final boolean randomRowSize, final boolean failsOnError) throws IllegalArgumentException, IOException { if (csv == null || separator == null) t...
4112450_2
public static File toRelativeFile(final File srcMountPoint, final File file) throws IOException, IllegalArgumentException { if (file==null || srcMountPoint==null){ throw new IllegalArgumentException("Some passed file argument are null: mountPoint:"+srcMountPoint+" file: "+file); } else if (!file.isAbsolute() ...
4112450_3
public static File rebaseFile(final File srcMountPoint, final File destMountPoint, final File file) throws IOException, IllegalArgumentException { final StringBuffer buf = new StringBuffer(file.getCanonicalPath()); String srcMountPointFilePath = srcMountPoint.getCanonicalPath(); // file is equals to the...
4112450_4
public static <T, D extends Set<Object[]>> void writeCsv( final Logger LOGGER, final D data, final File csv, final String separator, final boolean failsOnError) throws IllegalArgumentException, IOException { FileWriter fw = null; BufferedWriter writer = null; try { fw = new FileWrite...
4112450_5
public static Project buildSimpleProject(String targetName, String... executables) throws IllegalArgumentException { final Project project = new Project(); Target target = new Target(); target.setName(targetName); target.setProject(project); addToTarget(target, buildTask(executables)); proje...
4112450_6
public void setBaseToken(String name, String value) { baseTokens.put(name, value); }
4112450_7
public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ...
4112450_8
public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ...
4112450_9
public static void handleError(ActionConfiguration conf, BaseAction owner, String msg) throws ActionException { if (conf == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error(NULL_CONF_ERROR); } throw new IllegalArgumentException(NULL_CONF_ERROR); } final String ...
4114494_0
public BitSet getExistingLines() { return existingLines; }
4114494_1
public int getClassId() { return classId; }
4114494_2
public boolean cantHaveRun(int exitInstruction, int lineIndex) { return cantHaveRun.get(exitInstruction).get(lineIndex); }
4117239_0
public Queue(Variable<ImmutableList<VALUE>> input, Variable<ImmutableList<VALUE>> output, Variable<Boolean> frozen) { super(input, output, frozen); }
4120901_0
@Override public void afterJob(JobExecution jobExecution) { logger.info("afterJob enter"); SimpleMailMessage message = new SimpleMailMessage(templateMessage); message.setSubject("Spring Batch Job Status"); message.setText("Job " + jobExecution.getJobInstance().getJobName() + " completed. Status is: " + jobExecut...
4120901_1
public String getPromptText() { return "springHadoopAdmin>"; }
4120901_2
@Override public String name() { return "spring hadoop admin prompt provider"; }
4120901_3
public String getHistoryFileName() { return "spring-hadoop-admin.log"; }
4120901_4
@Override public String name() { return "spring hadoop admin history file name provider"; }
4120901_5
@CliCommand(value = { "version" }, help = "Displays current CLI version") public String getBanner() { StringBuffer buf = new StringBuffer(); buf.append("=======================================" + StringUtils.LINE_SEPARATOR); buf.append("* *"+ StringUtils.LINE_SEPARATOR); buf.app...
4120901_6
public String getVersion() { return "1.0.0"; }
4120901_7
public String getWelcomeMessage() { return "Welcome to Spring Hadoop Admin CLI"; }
4120901_8
@Override public String name() { return "spring hadoop admin banner provider"; }
4120901_9
public void setCommandURL(String commandURL) { this.commandURL = commandURL; }
4129770_0
public void forUnitTest() { }
4131741_0
@Override public final boolean preHandle( final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { this.assignCacheControlHeader(request, response, handler); return super.preHandle(request, response, handler); }
4131741_1
@Override public final boolean preHandle( final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { this.assignCacheControlHeader(request, response, handler); return super.preHandle(request, response, handler); }
4131741_2
@Override public final boolean preHandle( final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { this.assignCacheControlHeader(request, response, handler); return super.preHandle(request, response, handler); }
4131741_3
@Override public final boolean preHandle( final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { this.assignCacheControlHeader(request, response, handler); return super.preHandle(request, response, handler); }
4131741_4
@Override public final boolean preHandle( final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { this.assignCacheControlHeader(request, response, handler); return super.preHandle(request, response, handler); }
4131741_5
protected final CacheControl getCacheControl( final HttpServletRequest request, final HttpServletResponse response, final Object handler) { if (handler == null || !(handler instanceof HandlerMethod)) { return null; } final HandlerMethod handlerMethod = (HandlerMethod) handler; CacheControl cacheControl...
4138309_0
public void setId(String id) { this.id = id; }
4138309_1
public synchronized void setSuccessors(Collection<DAGNode<? extends Job>> successors) { Collection<String> successorNames = new HashSet<String>(); if (successors != null) { for(DAGNode node : successors) { successorNames.add(node.getName()); } } this.successors = successors; this.successorNames ...
4138309_2
public static Event<?> fromJson(String json) throws IOException { return JSONUtil.toObject(json, new TypeReference<Event<?>>() {}); }
4138309_3
static Configuration initHBaseConfiguration(Configuration jobConf) { // setup hraven hbase connection information Configuration hbaseConf = null; String hravenDir = System.getenv(HRAVEN_HBASE_CONF_DIR_ENV); if (hravenDir != null && !hravenDir.isEmpty()) { hbaseConf = new Configuration(false); Path hbase...
4139627_0
@Override public StartLetterCountMP clone() throws CloneNotSupportedException { return (StartLetterCountMP)super.clone(); }
4139627_1
@MessageHandler public LetterCount handleFirstCharacter(Letter letter) { if(character != null) { if(!character.equals(letter.getLetterKey())) { logger.error("Expected letter "+character+" actually received "+letter.getLetterKey()); return null; } } else { this.ch...
4139627_2
@MessageHandler public LetterCount handleFirstCharacter(Letter letter) { if(character != null) { if(!character.equals(letter.getLetterKey())) { logger.error("Expected letter "+character+" actually received "+letter.getLetterKey()); return null; } } else { this.ch...
4139627_3
@MessageHandler public LetterCount handleFirstCharacter(Letter letter) { if(character != null) { if(!character.equals(letter.getLetterKey())) { logger.error("Expected letter "+character+" actually received "+letter.getLetterKey()); return null; } } else { this.ch...
4139627_4
@MessageHandler public void handleWordCount(LetterCount letterCount) { if(map == null) { synchronized(this) { if(map == null) { map = new ConcurrentHashMap<Letter, LetterCount>(); } } } map.put(letterCount.getLetter(), letterCount); logger.info("re...
4139627_5
@Output public void output() { sortedset = new TreeSet<LetterCount>(new Comparator<LetterCount>() { @Override public int compare(LetterCount o1, LetterCount o2) { if(o1 == o2) { return 0; } if(o1 == null) { return 2; }...
4139627_6
@Override public WordCountMP clone() throws CloneNotSupportedException { WordCountMP mp = (WordCountMP)super.clone(); return mp; }
4139627_7
@MessageHandler public List<?> handleWord(Word word) { if(this.word != null) { if(!this.word.equals(word)) { logger.error("Expected "+this.word+" actually received "+word); return null; } } else { this.word = word; } this.count++; if(wordCount == null) ...
4139627_8
@MessageHandler public List<?> handleWord(Word word) { if(this.word != null) { if(!this.word.equals(word)) { logger.error("Expected "+this.word+" actually received "+word); return null; } } else { this.word = word; } this.count++; if(wordCount == null) ...
4139627_9
@MessageHandler public List<?> handleWord(Word word) { if(this.word != null) { if(!this.word.equals(word)) { logger.error("Expected "+this.word+" actually received "+word); return null; } } else { this.word = word; } this.count++; if(wordCount == null) ...
4159017_0
@Override public final boolean consume(CodeReader code, O output) { if (code.popTo(matcher, tmpBuilder) > 0) { consume(tmpBuilder, output); tmpBuilder.delete(0, tmpBuilder.length()); return true; } return false; }
4159017_1
@Override public final boolean consume(CodeReader code, O output) { if (code.popTo(matcher, tmpBuilder) > 0) { consume(tmpBuilder, output); tmpBuilder.delete(0, tmpBuilder.length()); return true; } return false; }
4159017_2
public final void pop(Appendable appendable) { try { appendable.append((char) pop()); } catch (IOException e) { throw new ChannelException(e.getMessage(), e); } }
4159017_3
public final char[] peek(int length) { char[] result = new char[length]; int index = 0; int nextChar = intAt(index); while (nextChar != -1 && index < length) { result[index] = (char) nextChar; index++; nextChar = intAt(index); } return result; }