@Override public List<String> getOptions() { return OPTIONS.get(); }
/** * Please only use this as a static variable. Calling getList(..).get() * repeatedly will probably cause a memory leak * * @param key * @return */ public static DynamicStringListProperty getList(String key) { return new DynamicStringListProperty(key, (String) null); }
@PostConstruct public void init() { load(); EXCLUDE.addCallback(new Runnable() { @Override public void run() { load(); } }); }
@Override public String[] getProcessNames() { List<String> processes = PROCESSES.get(); return processes.toArray(new String[processes.size()]); }
public static List<String> getStringList(String property) { final DynamicListProperty<String> listProperty = new DynamicStringListProperty(property, ""); return listProperty.get(); }
public void load() { excludeTypes = new HashSet<String>(); excludeTypes.addAll(EXCLUDE.get()); }
private boolean isWhitelisted(String host) { for (String valid : PROXY_WHITELIST.get()) { if (valid.equals(host)) { return true; } if (valid.startsWith("*") && host.endsWith(valid.substring(1))) { return true; } } return false; }
@Override public String[] getProcessNames() { List<String> result = new ArrayList<>(); for (String i : AgentUtils.AGENT_RESOURCES.get()) { result.add(String.format("%s.remove", i).toLowerCase()); } return result.toArray(new String[result.size()]); }
protected static void addToList(List<ConfigUpdateItem> list, ConfigUpdateItem item) { if (PRIORITY_ITEMS.get().contains(item.getName())) { list.add(0, item); } else { list.add(item); } }
@Override public String toLogLine() { StringBuilder sb = new StringBuilder(); sb.append(timestamp.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)) .append(DELIM).append(httpMethod) .append(DELIM).append(uri) .append(DELIM).append(statusCode) .append(DELIM).append(durationNs / 1000) // Converting duration to microseconds. .append(DELIM).append(responseBodySize); includeMatchingHeaders(sb, LOG_RESP_HEADERS.get(), responseHeaders); includeMatchingHeaders(sb, LOG_REQ_HEADERS.get(), requestHeaders); return sb.toString(); }
public static boolean shouldIgnore(File base, String path) { for (String prefix : IGNORE_PREFIX.get()) { if (path.startsWith(prefix)) { return true; } } return base == null ? false : Files.isSymbolicLink(new File(base, path).toPath()); }
public AbstractAgentBaseContextFactory() { String name = getClass().getSimpleName().replaceAll("Factory", "").replaceAll("([a-z])([A-Z])", "$1.$2").toLowerCase(); List<String> items = ArchaiusUtil.getList(String.format("item.context.%s.items", name)).get(); this.items = items.toArray(new String[items.size()]); }
@Override public boolean canSetProjectMembers(long projectId, Long usingAccount, boolean isAdmin, Set<Identity> identities) { return hasProjectRole(projectId, usingAccount, isAdmin, identities, SET_MEMBER_ROLES.get()); }
public boolean shouldCreateCredentials(Account account, ProcessState state) { return ACCOUNT_KIND_CREDENTIALS.get().contains(account.getKind()); }
@Override public Subnet doWithLock() { List<Subnet> subnets = objectManager.find(Subnet.class, SUBNET.ACCOUNT_ID, accountId, SUBNET.KIND, SubnetConstants.KIND_VIP_SUBNET); if (subnets.size() > 0) { return subnets.get(0); } Pair<String, Integer> cidr = NetUtils.getCidrAndSize(DOCKER_VIP_SUBNET_CIDR.get().get(0)); return resourceDao.createAndSchedule(Subnet.class, SUBNET.ACCOUNT_ID, accountId, SUBNET.CIDR_SIZE, cidr.getRight(), SUBNET.NETWORK_ADDRESS, cidr.getLeft(), SUBNET.KIND, SubnetConstants.KIND_VIP_SUBNET); } });
@Override public boolean isHttpsPort(String host, String port) { if (port == null && host != null) { String[] parts = host.split(":", 2); if (parts.length > 1) { port = parts[1]; } else if (ServerContext.isCustomApiHost()) { if (ServerContext.getHostApiBaseUrl(BaseProtocol.HTTP).startsWith("https")) { port = "443"; } else { port = "80"; } } } for (String p : HTTPS_PORTS.get()) { if (p.equals(port)) { return true; } } return false; }
@Override public SchemaImpl postProcess(SchemaImpl schema, SchemaFactory factory) { if(schema.getId().equals("projectMember")) { FieldImpl field = getField(schema, "externalIdType"); if(field != null){ field.getOptions().addAll(AUTH_SERVICE_EXTERNAL_ID_TYPES.get()); } } return schema; }
@Override public Map<String, String> getMap(String name) { Map<String, String> result = new LinkedHashMap<String, String>(); if (name == null) { return result; } for (String item : ArchaiusUtil.getList("agent.packages." + sanitize(name)).get()) { String key = String.format("agent.package.%s.url", sanitize(item)); DynamicStringProperty prop = values.get(key); if (prop == null) { prop = ArchaiusUtil.getString(key); values.put(key, prop); } String value = prop.get(); if (value != null) { result.put(item, value); } } return result; }