code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public Runner enableRunner(Object projectIdOrPath, Integer runnerId) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("runner_id", runnerId, true);
Response response = post(Response.Status.CREATED, formData.asMap(),
"projects", getProjectIdOrPath(project... | java |
public RunnerDetail registerRunner(String token, String description, Boolean active, List<String> tagList,
Boolean runUntagged, Boolean locked, Integer maximumTimeout) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("token... | java |
public void deleteRunner(String token) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("token", token, true);
delete(Response.Status.NO_CONTENT, formData.asMap(), "runners");
} | java |
public boolean isValidSecretToken(String secretToken) {
return (this.secretToken == null || this.secretToken.equals(secretToken) ? true : false);
} | java |
public boolean isValidSecretToken(HttpServletRequest request) {
if (this.secretToken != null) {
String secretToken = request.getHeader("X-Gitlab-Token");
return (isValidSecretToken(secretToken));
}
return (true);
} | java |
public List<Note> getIssueNotes(Object projectIdOrPath, Integer issueIid, int page, int perPage) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects",
getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes");
return... | java |
public Stream<Note> getIssueNotesStream(Object projectIdOrPath, Integer issueIid) throws GitLabApiException {
return (getIssueNotes(projectIdOrPath, issueIid, getDefaultPerPage()).stream());
} | java |
public Note getIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId);
return (response.rea... | java |
public Note updateIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId, String body) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true);
Response response = put(Response.Status.OK, formData.asMap(),
"projects", getProject... | java |
public List<Note> getMergeRequestNotes(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, null, null, getDefaultPerPage()).all());
} | java |
public List<Note> getMergeRequestNotes(Object projectIdOrPath, Integer mergeRequestIid, SortOrder sortOrder, Note.OrderBy orderBy) throws GitLabApiException {
return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, sortOrder, orderBy, getDefaultPerPage()).all());
} | java |
public Stream<Note> getMergeRequestNotesStream(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, null, null, getDefaultPerPage()).stream());
} | java |
public Stream<Note> getMergeRequestNotesStream(Object projectIdOrPath, Integer mergeRequestIid, SortOrder sortOrder, Note.OrderBy orderBy) throws GitLabApiException {
return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, sortOrder, orderBy, getDefaultPerPage()).stream());
} | java |
public Note getMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId);... | java |
public Note createMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, String body) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true);
Response response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrP... | java |
public void deleteMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException {
if (mergeRequestIid == null) {
throw new RuntimeException("mergeRequestIid cannot be null");
}
if (noteId == null) {
throw new RuntimeExceptio... | java |
public Stream<Tag> getTagsStream(Object projectIdOrPath) throws GitLabApiException {
return (getTags(projectIdOrPath, getDefaultPerPage()).stream());
} | java |
public Tag getTag(Object projectIdOrPath, String tagName) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName);
return (response.readEntity(Tag.class));
} | java |
public Optional<Tag> getOptionalTag(Object projectIdOrPath, String tagName) throws GitLabApiException {
try {
return (Optional.ofNullable(getTag(projectIdOrPath, tagName)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} | java |
public Tag createTag(Object projectIdOrPath, String tagName, String ref) throws GitLabApiException {
return (createTag(projectIdOrPath, tagName, ref, null, (String)null));
} | java |
public Release createRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("description", releaseNotes);
Response response = post(Response.Status.CREATED, formData.asMap(),
"projects", getProjectIdOr... | java |
public Release updateRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("description", releaseNotes);
Response response = put(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(p... | java |
public List<User> getUsers(int page, int perPage) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage, customAttributesEnabled), "users");
return (response.readEntity(new GenericType<List<User>>() {}));
} | java |
public Pager<User> getUsers(int itemsPerPage) throws GitLabApiException {
return (new Pager<User>(this, User.class, itemsPerPage, createGitLabApiForm().asMap(), "users"));
} | java |
public Pager<User> getActiveUsers(int itemsPerPage) throws GitLabApiException {
GitLabApiForm formData = createGitLabApiForm().withParam("active", true);
return (new Pager<User>(this, User.class, itemsPerPage, formData.asMap(), "users"));
} | java |
public void blockUser(Integer userId) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("userId cannot be null");
}
if (isApiVersion(ApiVersion.V3)) {
put(Response.Status.CREATED, null, "users", userId, "block");
} else {
po... | java |
public List<User> getblockedUsers(int page, int perPage) throws GitLabApiException {
GitLabApiForm formData = createGitLabApiForm()
.withParam("blocked", true)
.withParam(PAGE_PARAM, page)
.withParam(PER_PAGE_PARAM, perPage);
Response response = get(Respon... | java |
public User getUser(int userId) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("with_custom_attributes", customAttributesEnabled);
Response response = get(Response.Status.OK, formData.asMap(), "users", userId);
return (response.readEntity(User.class));
} | java |
public Optional<User> getOptionalUser(int userId) {
try {
return (Optional.ofNullable(getUser(userId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} | java |
public User getUser(String username) throws GitLabApiException {
GitLabApiForm formData = createGitLabApiForm().withParam("username", username, true);
Response response = get(Response.Status.OK, formData.asMap(), "users");
List<User> users = response.readEntity(new GenericType<List<User>>() {});... | java |
public Optional<User> getOptionalUser(String username) {
try {
return (Optional.ofNullable(getUser(username)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} | java |
public List<User> findUsers(String emailOrUsername) throws GitLabApiException {
return (findUsers(emailOrUsername, getDefaultPerPage()).all());
} | java |
public Pager<User> findUsers(String emailOrUsername, int itemsPerPage) throws GitLabApiException {
GitLabApiForm formData = createGitLabApiForm().withParam("search", emailOrUsername, true);
return (new Pager<User>(this, User.class, itemsPerPage, formData.asMap(), "users"));
} | java |
public Stream<User> findUsersStream(String emailOrUsername) throws GitLabApiException {
return (findUsers(emailOrUsername, getDefaultPerPage()).stream());
} | java |
@Deprecated
public User modifyUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException {
Form form = userToForm(user, projectsLimit, password, false, false);
Response response = put(Response.Status.OK, form.asMap(), "users", user.getId());
return (response.read... | java |
public void deleteUser(Object userIdOrUsername, Boolean hardDelete) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("hard_delete ", hardDelete);
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
de... | java |
public User getCurrentUser() throws GitLabApiException {
Response response = get(Response.Status.OK, null, "user");
return (response.readEntity(User.class));
} | java |
public List<SshKey> getSshKeys() throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "user", "keys");
return (response.readEntity(new GenericType<List<SshKey>>() {}));
} | java |
public List<SshKey> getSshKeys(Integer userId) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("userId cannot be null");
}
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "users", userId, "keys");
List<SshKey> keys = respon... | java |
public SshKey getSshKey(Integer keyId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "user", "keys", keyId);
return (response.readEntity(SshKey.class));
} | java |
public Optional<SshKey> getOptionalSshKey(Integer keyId) {
try {
return (Optional.ofNullable(getSshKey(keyId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} | java |
public SshKey addSshKey(String title, String key) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key);
Response response = post(Response.Status.CREATED, formData, "user", "keys");
return (response.readEntity(SshKey.class));
... | java |
public SshKey addSshKey(Integer userId, String title, String key) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("userId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key);
Response ... | java |
public List<ImpersonationToken> getImpersonationTokens(Object userIdOrUsername, ImpersonationState state) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("state", state)
.withParam(PER_PAGE_PARAM, getDefaultPerPage());
Response response... | java |
public ImpersonationToken getImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException {
if (tokenId == null) {
throw new RuntimeException("tokenId cannot be null");
}
Response response = get(Response.Status.OK, null, "users", getUserIdOrUsername(userId... | java |
public Optional<ImpersonationToken> getOptionalImpersonationToken(Object userIdOrUsername, Integer tokenId) {
try {
return (Optional.ofNullable(getImpersonationToken(userIdOrUsername, tokenId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(gl... | java |
public ImpersonationToken createImpersonationToken(Object userIdOrUsername, String name, Date expiresAt, Scope[] scopes) throws GitLabApiException {
if (scopes == null || scopes.length == 0) {
throw new RuntimeException("scopes cannot be null or empty");
}
GitLabApiForm formData = ... | java |
public void revokeImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException {
if (tokenId == null) {
throw new RuntimeException("tokenId cannot be null");
}
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.St... | java |
Form userToForm(User user, Integer projectsLimit, CharSequence password, Boolean resetPassword, boolean create) {
if (create) {
if ((password == null || password.toString().trim().isEmpty()) && !resetPassword) {
throw new IllegalArgumentException("either password or reset_password m... | java |
public CustomAttribute createCustomAttribute(final Object userIdOrUsername, final String key, final String value) throws GitLabApiException {
if (Objects.isNull(key) || key.trim().isEmpty()) {
throw new IllegalArgumentException("Key can't be null or empty");
}
if (Objects.isNull(val... | java |
public CustomAttribute changeCustomAttribute(final Object userIdOrUsername, final CustomAttribute customAttribute) throws GitLabApiException {
if (Objects.isNull(customAttribute)) {
throw new IllegalArgumentException("CustomAttributes can't be null");
}
//changing & creating custom... | java |
public CustomAttribute changeCustomAttribute(final Object userIdOrUsername, final String key, final String value) throws GitLabApiException {
return createCustomAttribute(userIdOrUsername, key, value);
} | java |
private GitLabApiForm createGitLabApiForm() {
GitLabApiForm formData = new GitLabApiForm();
return (customAttributesEnabled ? formData.withParam("with_custom_attributes", true) : formData);
} | java |
public User setUserAvatar(final Object userIdOrUsername, File avatarFile) throws GitLabApiException {
Response response = putUpload(Response.Status.OK, "avatar", avatarFile, "users", getUserIdOrUsername(userIdOrUsername));
return (response.readEntity(User.class));
} | java |
private static Object[] convertToObjectArray(Object obj) {
if (obj instanceof Object[]) {
return (Object[]) obj;
}
int arrayLength = Array.getLength(obj);
Object[] retArray = new Object[arrayLength];
for (int i = 0; i < arrayLength; ++i){
retArray[i] = Arr... | java |
public static void loadProperties(String classpathName, Properties toProps) {
Validate.argumentIsNotNull(classpathName);
Validate.argumentIsNotNull(toProps);
InputStream inputStream = PropertiesUtil.class.getClassLoader().getResourceAsStream(classpathName);
if (inputStream == null) {
... | java |
private static Collection difference(Collection first, Collection second){
if (first == null) {
return EMPTY_LIST;
}
if (second == null) {
return first;
}
Collection difference = new ArrayList<>(first);
for (Object current : second){
... | java |
public List<CdoSnapshot> getHistoricals(GlobalId globalId, CommitId timePoint, boolean withChildValueObjects, int limit) {
argumentsAreNotNull(globalId, timePoint);
return delegate.getStateHistory(globalId, QueryParamsBuilder
.withLimit(limit)
.withChildV... | java |
public Optional<CdoSnapshot> getHistorical(GlobalId globalId, LocalDateTime timePoint) {
argumentsAreNotNull(globalId, timePoint);
return delegate.getStateHistory(globalId, QueryParamsBuilder.withLimit(1).to(timePoint).build())
.stream().findFirst();
} | java |
private List<CdoSnapshot> loadMasterEntitySnapshotIfNecessary(InstanceId instanceId, List<CdoSnapshot> alreadyLoaded) {
if (alreadyLoaded.isEmpty()) {
return alreadyLoaded;
}
if (alreadyLoaded.stream().filter(s -> s.getGlobalId().equals(instanceId)).findFirst().isPresent()) {
... | java |
public SqlRepositoryBuilder withSchema(String schemaName) {
if (schemaName != null && !schemaName.isEmpty()) {
this.schemaName = schemaName;
}
return this;
} | java |
public Object getPropertyValue(Property property) {
Validate.argumentIsNotNull(property);
Object val = properties.get(property.getName());
if (val == null){
return Defaults.defaultValue(property.getGenericType());
}
return val;
} | java |
public <C extends Change> List getObjectsByChangeType(final Class<C> type) {
argumentIsNotNull(type);
return Lists.transform(getChangesByType(type),
input -> input.getAffectedObject().<JaversException>orElseThrow(() -> new JaversException(AFFECTED_CDO_IS_NOT_AVAILABLE)));
} | java |
public List getObjectsWithChangedProperty(String propertyName){
argumentIsNotNull(propertyName);
return Lists.transform(getPropertyChanges(propertyName),
input -> input.getAffectedObject().<JaversException>orElseThrow(() -> new JaversException(AFFECTED_CDO_IS_NOT_AVAILABLE)));
} | java |
public List<Change> getChanges(Predicate<Change> predicate) {
return Lists.positiveFilter(changes, predicate);
} | java |
public List<PropertyChange> getPropertyChanges(final String propertyName) {
argumentIsNotNull(propertyName);
return (List)getChanges(input -> input instanceof PropertyChange && ((PropertyChange)input).getPropertyName().equals(propertyName));
} | java |
public List<Change> calculateDiffs(List<CdoSnapshot> snapshots, Map<SnapshotIdentifier, CdoSnapshot> previousSnapshots) {
Validate.argumentsAreNotNull(snapshots);
Validate.argumentsAreNotNull(previousSnapshots);
List<Change> changes = new ArrayList<>();
for (CdoSnapshot snapshot : snaps... | java |
public <T> List<T> filterToList(Object source, Class<T> filter) {
Validate.argumentsAreNotNull(filter);
return (List) unmodifiableList(
items(source).filter(item -> item!=null && filter.isAssignableFrom(item.getClass()))
.collect(Collectors.toList()));
} | java |
List<JaversProperty> getManagedProperties(Predicate<JaversProperty> query) {
return Lists.positiveFilter(managedProperties, query);
} | java |
public MapContentType getMapContentType(ContainerType containerType){
JaversType keyType = getJaversType(Integer.class);
JaversType valueType = getJaversType(containerType.getItemType());
return new MapContentType(keyType, valueType);
} | java |
public boolean isContainerOfManagedTypes(JaversType javersType){
if (! (javersType instanceof ContainerType)) {
return false;
}
return getJaversType(((ContainerType)javersType).getItemType()) instanceof ManagedType;
} | java |
public JaversType getJaversType(Type javaType) {
argumentIsNotNull(javaType);
if (javaType == Object.class) {
return OBJECT_TYPE;
}
return engine.computeIfAbsent(javaType, j -> typeFactory.infer(j, findPrototype(j)));
} | java |
public <T extends ManagedType> T getJaversManagedType(Class javaClass, Class<T> expectedType) {
JaversType mType = getJaversType(javaClass);
if (expectedType.isAssignableFrom(mType.getClass())) {
return (T) mType;
} else {
throw new JaversException(JaversExceptionCode.MA... | java |
@Bean(name = "JaversFromStarter")
@ConditionalOnMissingBean
public Javers javers() {
logger.info("Starting javers-spring-boot-starter-mongo ...");
MongoDatabase mongoDatabase = mongoClient.getDatabase( mongoProperties.getMongoClientDatabase() );
logger.info("connecting to database: {}"... | java |
private Diff createAndAppendChanges(GraphPair graphPair, Optional<CommitMetadata> commitMetadata) {
DiffBuilder diff = new DiffBuilder(javersCoreConfiguration.getPrettyValuePrinter());
//calculate node scope diff
for (NodeChangeAppender appender : nodeChangeAppenders) {
diff.addChan... | java |
private void addCommitDateInstantColumnIfNeeded() {
if (!columnExists(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT)){
addStringColumn(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT, 30);
} else {
extendStringColumnIfNeeded(getCommitTableNameWithSchema(),... | java |
private void alterCommitIdColumnIfNeeded() {
ColumnType commitIdColType = getTypeOf(getCommitTableNameWithSchema(), "commit_id");
if (commitIdColType.precision == 12) {
logger.info("migrating db schema from JaVers 2.5 to 2.6 ...");
if (dialect instanceof PostgresDialect) {
... | java |
private void alterMssqlTextColumns() {
ColumnType stateColType = getTypeOf(getSnapshotTableNameWithSchema(), "state");
ColumnType changedPropertiesColType = getTypeOf(getSnapshotTableNameWithSchema(), "state");
if(stateColType.typeName.equals("text")) {
executeSQL("ALTER TABLE " + g... | java |
@Override
public Object map(Object sourceEnumerable, Function mapFunction, boolean filterNulls) {
Validate.argumentIsNotNull(mapFunction);
Multimap sourceMultimap = toNotNullMultimap(sourceEnumerable);
Multimap targetMultimap = ArrayListMultimap.create();
MapType.mapEntrySet(source... | java |
private Collection<JaversType> bootJsonConverter() {
JsonConverterBuilder jsonConverterBuilder = jsonConverterBuilder();
addModule(new ChangeTypeAdaptersModule(getContainer()));
addModule(new CommitTypeAdaptersModule(getContainer()));
if (new RequiredMongoSupportPredicate().test(reposi... | java |
private Object reverseCdoIdMapKey(Cdo cdo) {
if (cdo.getGlobalId() instanceof InstanceId) {
return cdo.getGlobalId();
}
return new SystemIdentityWrapper(cdo.getWrappedCdo().get());
} | java |
private static Bson prefixQuery(String fieldName, String prefix){
return Filters.regex(fieldName, "^" + RegexEscape.escape(prefix) + ".*");
} | java |
public static <T> List<T> positiveFilter(List<T> input, Predicate<T> filter) {
argumentsAreNotNull(input, filter);
return input.stream().filter(filter).collect(Collectors.toList());
} | java |
public static <T> List<T> negativeFilter(List<T> input, final Predicate<T> filter) {
argumentsAreNotNull(input, filter);
return input.stream().filter(element -> !filter.test(element)).collect(Collectors.toList());
} | java |
public QueryBuilder withChangedProperty(String propertyName) {
Validate.argumentIsNotNull(propertyName);
queryParamsBuilder.changedProperty(propertyName);
return this;
} | java |
public QueryBuilder withCommitId(CommitId commitId) {
Validate.argumentIsNotNull(commitId);
queryParamsBuilder.commitId(commitId);
return this;
} | java |
public QueryBuilder withCommitIds(Collection<BigDecimal> commitIds) {
Validate.argumentIsNotNull(commitIds);
queryParamsBuilder.commitIds(commitIds.stream().map(CommitId::valueOf).collect(Collectors.toSet()));
return this;
} | java |
public QueryBuilder toCommitId(CommitId commitId) {
Validate.argumentIsNotNull(commitId);
queryParamsBuilder.toCommitId(commitId);
return this;
} | java |
public QueryBuilder byAuthor(String author) {
Validate.argumentIsNotNull(author);
queryParamsBuilder.author(author);
return this;
} | java |
public static Class<?> classForName(String className) {
try {
return Class.forName(className, false, Javers.class.getClassLoader());
}
catch (ClassNotFoundException ex) {
throw new JaversException(ex);
}
} | java |
public static Object newInstance(Class clazz, ArgumentResolver resolver){
Validate.argumentIsNotNull(clazz);
for (Constructor constructor : clazz.getDeclaredConstructors()) {
if (isPrivate(constructor) || isProtected(constructor)) {
continue;
}
Class ... | java |
JaversType spawn(Type baseJavaType) {
try {
Constructor c = this.getClass().getConstructor(Type.class);
return (JaversType)c.newInstance(new Object[]{baseJavaType});
} catch (ReflectiveOperationException exception) {
throw new RuntimeException("error calling Construct... | java |
private String formatMaybeIpv6(String address) {
String openBracket = "[";
String closeBracket = "]";
if (address.contains(":") && !address.startsWith(openBracket) && !address.endsWith(closeBracket)) {
return openBracket + address + closeBracket;
}
return address;
... | java |
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
Account account = exchange.getSecurityContext().getAuthenticatedAccount();
if (account != null && account.getPrincipal() instanceof JsonWebToken) {
JsonWebToken token = (JsonWebToken)account.getPrincipal(... | java |
public static Options defaultOptions() {
return new Options(
HELP,
CONFIG_HELP,
YAML_HELP,
VERSION,
PROPERTY,
PROPERTIES_URL,
SERVER_CONFIG,
CONFIG,
PROFILES,
... | java |
public <T> void put(Option<T> key, T value) {
this.values.put(key, value);
} | java |
@SuppressWarnings("unchecked")
public <T> T get(Option<T> key) {
T v = (T) this.values.get(key);
if (v == null) {
v = key.defaultValue();
this.values.put(key, v);
}
return v;
} | java |
public void applyProperties(Swarm swarm) throws IOException {
URL propsUrl = get(PROPERTIES_URL);
if (propsUrl != null) {
Properties urlProps = new Properties();
urlProps.load(propsUrl.openStream());
for (String name : urlProps.stringPropertyNames()) {
... | java |
public void applyConfigurations(Swarm swarm) throws IOException {
if (get(SERVER_CONFIG) != null) {
swarm.withXmlConfig(get(SERVER_CONFIG));
}
if (get(CONFIG) != null) {
List<URL> configs = get(CONFIG);
for (URL config : configs) {
swarm.withCo... | java |
public void apply(Swarm swarm) throws IOException, ModuleLoadException {
applyProperties(swarm);
applyConfigurations(swarm);
if (get(HELP)) {
displayVersion(System.err);
System.err.println();
displayHelp(System.err);
System.exit(0);
}
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.