public long[] getHeartbeat() { String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER); String[] rawValues = StringUtils.split(rawValue, ","); if (rawValues == null) { return Arrays.copyOf(DEFAULT_HEARTBEAT, 2); } return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])}; }
/** * Get the heartbeat header. */ @Nullable public long[] getHeartbeat() { String rawValue = getFirst(HEARTBEAT); String[] rawValues = StringUtils.split(rawValue, ","); if (rawValues == null) { return null; } return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])}; }
private void authType(MockHttpServletRequest request) { String authorization = header("Authorization"); String[] authSplit = StringUtils.split(authorization, ": "); if (authSplit != null) { request.setAuthType(authSplit[0]); } }
element = deleteAny(element, charsToDelete); String[] splittedElement = split(element, delimiter); if (splittedElement == null) { continue;
private List<URI> getServersList() throws URISyntaxException { List<URI> uris = new ArrayList<URI>(); if (couchbaseServers.indexOf(',') == -1) { uris.add(new URI( couchbaseServers)); return uris; } for (String serverHost : StringUtils.split(couchbaseServers, ",")) { uris.add(new URI( serverHost)); } return uris; }
private RedisNode readHostAndPortFromString(String hostAndPort) { String[] args = split(hostAndPort, ":"); notNull(args, "HostAndPort need to be seperated by ':'."); isTrue(args.length == 2, "Host and Port String needs to specified as host:port"); return new RedisNode(args[0], Integer.valueOf(args[1]).intValue()); }
private Long value(int index) { return NumberUtils.parseNumber(StringUtils.split(raw, DELIMITER)[index], Long.class); } }
private RedisNode readHostAndPortFromString(String hostAndPort) { String[] args = split(hostAndPort, ":"); notNull(args, "HostAndPort need to be seperated by ':'."); isTrue(args.length == 2, "Host and Port String needs to specified as host:port"); return new RedisNode(args[0], Integer.valueOf(args[1])); }
element = deleteAny(element, charsToDelete); String[] splittedElement = split(element, delimiter); if (splittedElement == null) { continue;
@Nullable /* for testing */ static LinkedCaseInsensitiveMap<String> splitIntoCaseInsensitiveMap(String[] pairs) { if (ObjectUtils.isEmpty(pairs)) { return null; } LinkedCaseInsensitiveMap<String> result = new LinkedCaseInsensitiveMap<>(); for (String element : pairs) { String[] splittedElement = StringUtils.split(element, "="); if (splittedElement == null) { continue; } result.put(splittedElement[0].trim(), splittedElement[1].trim()); } return result; }
private SlotRange parseSlotRange(String[] args) { Set<Integer> slots = new LinkedHashSet<>(); for (int i = SLOTS_INDEX; i < args.length; i++) { String raw = args[i]; if (raw.startsWith("[")) { continue; } if (raw.contains("-")) { String[] slotRange = StringUtils.split(raw, "-"); if (slotRange != null) { int from = Integer.valueOf(slotRange[0]); int to = Integer.valueOf(slotRange[1]); for (int slot = from; slot <= to; slot++) { slots.add(slot); } } } else { slots.add(Integer.valueOf(raw)); } } return new SlotRange(slots); }
private Map<String, Object> parseMapInternal(String json) { Map<String, Object> map = new LinkedHashMap<>(); json = trimLeadingCharacter(trimTrailingCharacter(json, '}'), '{'); for (String pair : tokenize(json)) { String[] values = StringUtils.trimArrayElements(StringUtils.split(pair, ":")); String key = trimLeadingCharacter(trimTrailingCharacter(values[0], '"'), '"'); Object value = parseInternal(values[1]); map.put(key, value); } return map; }
@Override public RedisClusterNode convert(String source) { String[] args = source.split(" "); String[] hostAndPort = StringUtils.split(args[HOST_PORT_INDEX], ":"); Assert.notNull(hostAndPort, "CusterNode information does not define host and port!"); SlotRange range = parseSlotRange(args); Set<Flag> flags = parseFlags(args); String portPart = hostAndPort[1]; if (portPart.contains("@")) { portPart = portPart.substring(0, portPart.indexOf('@')); } RedisClusterNodeBuilder nodeBuilder = RedisClusterNode.newRedisClusterNode() .listeningAt(hostAndPort[0], Integer.valueOf(portPart)) // .withId(args[ID_INDEX]) // .promotedAs(flags.contains(Flag.MASTER) ? NodeType.MASTER : NodeType.SLAVE) // .serving(range) // .withFlags(flags) // .linkState(parseLinkState(args)); if (!args[MASTER_ID_INDEX].isEmpty() && !args[MASTER_ID_INDEX].startsWith("-")) { nodeBuilder.slaveOf(args[MASTER_ID_INDEX]); } return nodeBuilder.build(); }
/** * Get the heartbeat header. */ @Nullable public long[] getHeartbeat() { String rawValue = getFirst(HEARTBEAT); String[] rawValues = StringUtils.split(rawValue, ","); if (rawValues == null) { return null; } return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])}; }
public long[] getHeartbeat() { String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER); String[] rawValues = StringUtils.split(rawValue, ","); if (rawValues == null) { return Arrays.copyOf(DEFAULT_HEARTBEAT, 2); } return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])}; }
element = deleteAny(element, charsToDelete); String[] splittedElement = split(element, delimiter); if (splittedElement == null) { continue;
public void transferDefaultMappingsToZone(IdentityZone zone) { JdbcScimGroupExternalMembershipManager exm = getWebApplicationContext().getBean(JdbcScimGroupExternalMembershipManager.class); ScimGroupProvisioning gp = getWebApplicationContext().getBean(ScimGroupProvisioning.class); List<String> defaultMappings = (List<String>) getWebApplicationContext().getBean("defaultExternalMembers"); IdentityZoneHolder.set(zone); for (String s : defaultMappings) { String[] groupData = StringUtils.split(s, "|"); String internalName = groupData[0]; String externalName = groupData[1]; ScimGroup group = new ScimGroup(internalName); group.setZoneId(zone.getId()); try { group = gp.create(group, IdentityZoneHolder.get().getId()); } catch (ScimResourceAlreadyExistsException e) { String filter = "displayName eq \""+internalName+"\""; group = gp.query(filter, IdentityZoneHolder.get().getId()).get(0); } exm.mapExternalGroup(group.getId(), externalName, OriginKeys.LDAP, zone.getId()); } }
/** * Construct an instance with the provided url and credentials. * @param url the url e.g. "http://guest:guest@localhost:15672/api/". * @throws MalformedURLException for a badly formed URL. * @throws URISyntaxException for a badly formed URL. */ public Client(String url) throws MalformedURLException, URISyntaxException { this(urlWithoutCredentials(url), StringUtils.split(new URL(url).getUserInfo(),":")[0], StringUtils.split(new URL(url).getUserInfo(),":")[1] ); }
private RedisNode readHostAndPortFromString(String hostAndPort) { String[] args = split(hostAndPort, ":"); notNull(args, "HostAndPort need to be seperated by ':'."); isTrue(args.length == 2, "Host and Port String needs to specified as host:port"); return new RedisNode(args[0], Integer.valueOf(args[1]).intValue()); }