code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
private String getConfigFileMd5(File configFile) {
try (FileInputStream inputStream = new FileInputStream(configFile)) {
return DigestUtils.md5Hex(inputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | getConfigFileMd5 | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private void rememberLatestFileAttributes(ReloadTestResult result) {
synchronized (this) {
lastModified = result.modifiedTime;
prevSize = result.fileSize;
}
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | rememberLatestFileAttributes | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public GoFileConfigDataSource reloadEveryTime() {
this.reloadStrategy = new AlwaysReload();
return this;
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | reloadEveryTime | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public GoFileConfigDataSource reloadIfModified() {
this.reloadStrategy = new ReloadIfModified();
return this;
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | reloadIfModified | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public File fileLocation() {
return new File(systemEnvironment.getCruiseConfigFile());
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | fileLocation | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public Path location() {
return Path.of(systemEnvironment.getCruiseConfigFile());
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | location | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public GoConfigHolder load() throws Exception {
File configFile = fileLocation();
ReloadStrategy.ReloadTestResult result = reloadStrategy.requiresReload(configFile);
if (!result.requiresReload) {
reloadStrategy.hasLatest(result);
return null;
}
synchroniz... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | load | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
@TestOnly
public synchronized GoConfigHolder write(String configFileContent, boolean shouldMigrate) throws Exception {
File configFile = fileLocation();
try {
if (shouldMigrate) {
configFileContent = upgrader.upgradeIfNecessary(configFileContent);
}
... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | write | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public synchronized EntityConfigSaveResult<?> writeEntityWithLock(EntityConfigUpdateCommand<?> updatingCommand, GoConfigHolder configHolder, Username currentUser) {
CruiseConfig modifiedConfig = cloner.deepClone(configHolder.configForEdit);
try {
updatingCommand.update(modifiedConfig);
... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | writeEntityWithLock | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
synchronized GoConfigSaveResult writeWithLock(UpdateConfigCommand updatingCommand, GoConfigHolder configHolder) {
try {
// Need to convert to xml before we try to write it to the config file.
// If our cruiseConfig fails XSD validation, we don't want to write it incorrectly.
... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | writeWithLock | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public synchronized GoConfigSaveResult writeFullConfigWithLock(FullConfigUpdateCommand updatingCommand, GoConfigHolder configHolder) {
try {
GoConfigHolder validatedConfigHolder;
try {
validatedConfigHolder = trySavingConfigWithLastKnownPartials(updatingCommand, configHol... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | writeFullConfigWithLock | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public String configAsXml(CruiseConfig config, boolean skipPreprocessingAndValidation) throws Exception {
LOGGER.debug("[Config Save] === Converting config to XML");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
magicalGoConfigXmlWriter.write(config, outputStream, skipPreproc... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | configAsXml | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
public String getFileLocation() {
return fileLocation().getAbsolutePath();
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | getFileLocation | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
synchronized GoConfigHolder forceLoad() throws Exception {
Path configFile = goConfigFileReader.location();
CruiseConfig cruiseConfig = this.magicalGoConfigXmlLoader.deserializeConfig(goConfigFileReader.configXml());
LOGGER.debug("Reloading config file: {}", configFile.toAbsolutePath());
... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | forceLoad | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
@TestOnly
synchronized GoConfigHolder forceLoad(Path configFile) throws Exception {
LOGGER.debug("Reloading config file: {}", configFile.toAbsolutePath());
GoConfigHolder holder;
try {
try {
List<PartialConfig> lastKnownPartials = cloner.deepClone(cachedGoPartials... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | forceLoad | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private static void logConfigLoadException(Path configFile, Exception e) throws Exception {
LOGGER.error("Unable to load config file: {} {}", configFile.toAbsolutePath(), e.getMessage(), e);
if (LOGGER.isDebugEnabled() && Files.exists(configFile)) {
LOGGER.debug("--- {} ---", configFile.toAb... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | logConfigLoadException | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private <T> EntityConfigSaveResult<T> trySavingEntity(EntityConfigUpdateCommand<T> updatingCommand, Username currentUser, CruiseConfig modifiedConfig, List<PartialConfig> partials) {
modifiedConfig.setPartials(partials);
CruiseConfig preprocessedConfig = cloner.deepClone(modifiedConfig);
Magical... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | trySavingEntity | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private GoConfigHolder trySavingConfigWithLastKnownPartials(FullConfigUpdateCommand updateCommand, GoConfigHolder configHolder) throws Exception {
LOGGER.debug("[Config Save] Trying to save config with Last Known Partials");
return trySavingFullConfig(updateCommand, configHolder, cachedGoPartials.lastKn... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | trySavingConfigWithLastKnownPartials | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private GoConfigHolder trySavingConfigWithLastValidPartials(FullConfigUpdateCommand updateCommand, GoConfigHolder configHolder) throws Exception {
List<PartialConfig> lastValidPartials = cachedGoPartials.lastValidPartials();
GoConfigHolder goConfigHolder;
try {
goConfigHolder = tryS... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | trySavingConfigWithLastValidPartials | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private boolean cannotUpdateConfigWithLastValidPartials() {
List<PartialConfig> lastKnownPartials = cachedGoPartials.lastKnownPartials();
List<PartialConfig> lastValidPartials = cachedGoPartials.lastValidPartials();
return lastKnownPartials.isEmpty() || partials.isEquivalent(lastKnownPartials, ... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | cannotUpdateConfigWithLastValidPartials | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private void updateMergedConfigForEdit(GoConfigHolder validatedConfigHolder, List<PartialConfig> partialConfigs) {
if (partialConfigs.isEmpty()) return;
CruiseConfig mergedCruiseConfigForEdit = cloner.deepClone(validatedConfigHolder.configForEdit);
mergedCruiseConfigForEdit.merge(partialConfigs,... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | updateMergedConfigForEdit | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private GoConfigHolder trySavingFullConfig(FullConfigUpdateCommand updatingCommand, GoConfigHolder configHolder, List<PartialConfig> partials) throws Exception {
String userName = getConfigUpdatingUser(updatingCommand).getUserName();
GoConfigHolder goConfigHolder;
LOGGER.debug("[Config Save] ==... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | trySavingFullConfig | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private GoConfigHolder trySavingConfig(UpdateConfigCommand updatingCommand, GoConfigHolder configHolder, List<PartialConfig> partials) throws Exception {
String configAsXml;
GoConfigHolder validatedConfigHolder;
LOGGER.debug("[Config Save] ==-- Getting modified config");
if (shouldMergeC... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | trySavingConfig | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private ConfigModifyingUser getConfigUpdatingUser(UpdateConfigCommand updatingCommand) {
return updatingCommand instanceof UserAware ? ((UserAware) updatingCommand).user() : new ConfigModifyingUser();
} | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | getConfigUpdatingUser | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private String getUnmergedConfig(UpdateConfigCommand updatingCommand, GoConfigHolder configHolder, List<PartialConfig> partials) throws Exception {
CruiseConfig deepCloneForEdit = cloner.deepClone(configHolder.configForEdit);
deepCloneForEdit.setPartials(partials);
CruiseConfig config = updating... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | getUnmergedConfig | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private boolean shouldMergeConfig(UpdateConfigCommand updatingCommand, GoConfigHolder configHolder) {
LOGGER.debug("[Config Save] Checking whether config should be merged");
if (updatingCommand instanceof NoOverwriteUpdateConfigCommand noOverwriteCommand) {
return !configHolder.configForEdit... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | shouldMergeConfig | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private String getMergedConfig(NoOverwriteUpdateConfigCommand noOverwriteCommand, String latestMd5, List<PartialConfig> partials) throws Exception {
LOGGER.debug("[Config Save] Getting merged config");
String oldMd5 = noOverwriteCommand.unmodifiedMd5();
CruiseConfig modifiedConfig = getOldConfig... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | getMergedConfig | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private String convertMutatedConfigToXml(CruiseConfig modifiedConfig, String latestMd5) {
try {
return configAsXml(modifiedConfig, false);
} catch (Exception e) {
LOGGER.info("[CONFIG_MERGE] Pre merge validation failed, latest-md5: {}", latestMd5);
throw new ConfigMer... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | convertMutatedConfigToXml | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private CruiseConfig getOldConfigAndMutateWithChanges(NoOverwriteUpdateConfigCommand noOverwriteCommand, String oldMd5) throws Exception {
LOGGER.debug("[Config Save] --- Mutating old config");
String configXmlAtOldMd5 = configRepository.getRevision(oldMd5).getContent();
CruiseConfig cruiseConfi... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | getOldConfigAndMutateWithChanges | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private GoConfigHolder internalLoad(final String content, final ConfigModifyingUser configModifyingUser, final List<PartialConfig> partials) throws Exception {
GoConfigHolder configHolder = magicalGoConfigXmlLoader.loadConfigHolder(content, cruiseConfig -> cruiseConfig.setPartials(partials));
CruiseConf... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | internalLoad | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
private void checkinConfigToGitRepo(List<PartialConfig> partials, CruiseConfig config, String configAsXml, String md5, String currentUser) throws Exception {
reloadStrategy.latestState(config);
LOGGER.debug("[Config Save] === Checking in the valid XML to config.git");
configRepository.checkin(ne... | This class find the location of cruise-config.xml and turn that into stream
and passing it into MagicLoader or MagicWriter. | checkinConfigToGitRepo | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/GoFileConfigDataSource.java | Apache-2.0 |
@Override
public void onConfigChange(CruiseConfig newCruiseConfig) {
if (registering) {
registering = false;
return;
}
serverHealthService.removeByScope(HealthStateScope.forInvalidConfig());
} | Understands removing server health message on valid config changes | onConfigChange | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | Apache-2.0 |
public void initialize() {
registering = true;
goConfigService.register(this);
goConfigService.register(pipelineConfigChangedListener());
} | Understands removing server health message on valid config changes | initialize | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | Apache-2.0 |
protected EntityConfigChangedListener<PipelineConfig> pipelineConfigChangedListener() {
final InvalidConfigMessageRemover invalidConfigMessageRemover = this;
return new EntityConfigChangedListener<>() {
@Override
public void onEntityConfigChange(PipelineConfig entity) {
... | Understands removing server health message on valid config changes | pipelineConfigChangedListener | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | Apache-2.0 |
@Override
public void onEntityConfigChange(PipelineConfig entity) {
invalidConfigMessageRemover.onConfigChange(null);
} | Understands removing server health message on valid config changes | onEntityConfigChange | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/InvalidConfigMessageRemover.java | Apache-2.0 |
public boolean isEquivalent(PartialConfig left, PartialConfig right) {
return hasSameOrigins(left, right) && isStructurallyEquivalent(left, right);
} | Tests whether two {@link PartialConfig} instances have identical structure and origin
@param left a {@link PartialConfig}
@param right a {@link PartialConfig}
@return whether or not the {@link PartialConfig}s are equivalent | isEquivalent | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
public boolean isEquivalent(Collection<PartialConfig> left, Collection<PartialConfig> right) {
return Objects.equals(identities(left), identities(right));
} | Determines the equivalence of to collections of {@link PartialConfig}s
@param left a {@link Collection<PartialConfig>}
@param right a {@link Collection<PartialConfig>}
@return whether or not the {@link Collection<PartialConfig>}s are equivalent | isEquivalent | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
private Set<String> identities(Collection<PartialConfig> collection) {
if (null == collection) return Collections.emptySet();
return collection.stream().map(this::identity).collect(Collectors.toSet());
} | Determines the equivalence of to collections of {@link PartialConfig}s
@param left a {@link Collection<PartialConfig>}
@param right a {@link Collection<PartialConfig>}
@return whether or not the {@link Collection<PartialConfig>}s are equivalent | identities | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
private String identity(PartialConfig partial) {
final RepoConfigOrigin origin = (RepoConfigOrigin) partial.getOrigin();
return hash(partial) + ":" + origin.getMaterial().getFingerprint() + ":" + origin.getRevision();
} | Determines the equivalence of to collections of {@link PartialConfig}s
@param left a {@link Collection<PartialConfig>}
@param right a {@link Collection<PartialConfig>}
@return whether or not the {@link Collection<PartialConfig>}s are equivalent | identity | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
private boolean isStructurallyEquivalent(PartialConfig previous, PartialConfig incoming) {
return Objects.equals(hash(incoming), hash(previous));
} | Tests whether two {@link PartialConfig} instances define structurally identical configurations.
@param previous a {@link PartialConfig}
@param incoming a {@link PartialConfig}
@return whether or not the structures are identical | isStructurallyEquivalent | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
private boolean hasSameOrigins(PartialConfig previous, PartialConfig incoming) {
return Objects.equals(
Optional.ofNullable(previous).map(PartialConfig::getOrigin).orElse(null),
Optional.ofNullable(incoming).map(PartialConfig::getOrigin).orElse(null)
);
} | Tests whether two {@link PartialConfig} instances share an identical
{@link com.thoughtworks.go.config.remote.ConfigOrigin}.
<p>
This is needed because we need to update the origins of the generated {@link PipelineConfig} instances to match
the revisions of their {@link com.thoughtworks.go.domain.materials.MaterialConf... | hasSameOrigins | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
public String hash(PartialConfig partial) {
// in case of a deserialization bug, a plugin may return an invalid config which might fail during serializing into xml
// hence, in case of a serialization error, return null has hash
//
// it is safe to return null on a structurally invalid c... | Tests whether two {@link PartialConfig} instances share an identical
{@link com.thoughtworks.go.config.remote.ConfigOrigin}.
<p>
This is needed because we need to update the origins of the generated {@link PipelineConfig} instances to match
the revisions of their {@link com.thoughtworks.go.domain.materials.MaterialConf... | hash | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
protected String digestPartial(PartialConfig partial) {
if (null == partial) {
return null;
}
return hashes.digest(
hashes.digest(partial.getGroups()),
hashes.digest(partial.getEnvironments()),
hashes.digest(partial.getScms())
... | Computes a digest of a {@link PartialConfig}.
<p>
NOTE: Don't move this to EntityHashingService; it will create a cyclic dependency. The dependency graph leading
here is pretty deep. Your head may explode.
@param partial a {@link PartialConfig} to hash
@return a cryptographic digest that can be used for comparison. | digestPartial | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigHelper.java | Apache-2.0 |
private boolean isPartialDifferentFromLastKnown(PartialConfig partial, String fingerprint) {
final PartialConfig previous = cachedGoPartials.getKnown(fingerprint);
return !partialConfigHelper.isEquivalent(previous, partial);
} | Tests whether a given {@link PartialConfig} is different from the last known cached attempt.
@param partial a {@link PartialConfig}
@param fingerprint the config repo material fingerprint ({@link String})
@return whether or not the incoming partial is different from the last cached partial | isPartialDifferentFromLastKnown | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigService.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigService.java | Apache-2.0 |
private boolean hasRuleViolations(PartialConfig partial) {
if (null == partial) {
return false;
}
partial.validatePermissionsOnSubtree();
return partial.hasErrors();
} | Tests whether a given {@link PartialConfig} is different from the last known cached attempt.
@param partial a {@link PartialConfig}
@param fingerprint the config repo material fingerprint ({@link String})
@return whether or not the incoming partial is different from the last cached partial | hasRuleViolations | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/PartialConfigService.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/PartialConfigService.java | Apache-2.0 |
Set<String> configuredAdmins() {
return configuredAdmins;
} | Helper class to calculate the effective users that have view, operate, and admin permissions on
a specific group, upon which one can build {@link Permissions}
<p>
NOTE: Instances are intended to have short lifetimes (e.g., within the life of a request).
Don't hang onto references as results are cached and will not upda... | configuredAdmins | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | Apache-2.0 |
AllowedUsers effectiveAdmins() {
if (null == this.admins) {
this.admins = new AllowedUsers(configuredAdmins(), definedAdminRoles);
}
return this.admins;
} | Helper class to calculate the effective users that have view, operate, and admin permissions on
a specific group, upon which one can build {@link Permissions}
<p>
NOTE: Instances are intended to have short lifetimes (e.g., within the life of a request).
Don't hang onto references as results are cached and will not upda... | effectiveAdmins | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | Apache-2.0 |
AllowedUsers effectiveOperators() {
if (null == this.operators) {
Set<String> operators = new HashSet<>();
operators.addAll(configuredAdmins());
operators.addAll(namesOf(group.getAuthorization().getOperationConfig(), rolesToUsers));
Set<PluginRoleConfig> roles = ... | Helper class to calculate the effective users that have view, operate, and admin permissions on
a specific group, upon which one can build {@link Permissions}
<p>
NOTE: Instances are intended to have short lifetimes (e.g., within the life of a request).
Don't hang onto references as results are cached and will not upda... | effectiveOperators | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | Apache-2.0 |
AllowedUsers effectiveViewers() {
if (null == this.viewers) {
Set<String> viewers = new HashSet<>();
viewers.addAll(configuredAdmins());
viewers.addAll(namesOf(group.getAuthorization().getViewConfig(), rolesToUsers));
Set<PluginRoleConfig> roles = pluginRolesFor(... | Helper class to calculate the effective users that have view, operate, and admin permissions on
a specific group, upon which one can build {@link Permissions}
<p>
NOTE: Instances are intended to have short lifetimes (e.g., within the life of a request).
Don't hang onto references as results are cached and will not upda... | effectiveViewers | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | Apache-2.0 |
AllowedUsers operatorsForStage(StageConfig stage) {
if (!stage.hasOperatePermissionDefined()) {
return effectiveOperators();
}
Set<String> approversOfStage = namesOf(stage.getApproval().getAuthConfig(), rolesToUsers);
Set<PluginRoleConfig> roleApproverOfStage = pluginRolesFo... | Helper class to calculate the effective users that have view, operate, and admin permissions on
a specific group, upon which one can build {@link Permissions}
<p>
NOTE: Instances are intended to have short lifetimes (e.g., within the life of a request).
Don't hang onto references as results are cached and will not upda... | operatorsForStage | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/GroupSecurity.java | Apache-2.0 |
boolean hasNoSuperAdmins() {
return hasNoAdminsDefinedAtRootLevel;
} | Helper factory to build {@link GroupSecurity} helpers that abstract the details of calculating
effective pipeline group viewers, operators, and admins.
<p>
NOTE: Instances are intended to have short lifetimes (e.g., within the life of a request).
Don't hang onto references as results are cached and will not update on c... | hasNoSuperAdmins | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/PipelineGroupsSecurityHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/PipelineGroupsSecurityHelper.java | Apache-2.0 |
GroupSecurity forGroup(PipelineConfigs group) {
return new GroupSecurity(group, security, rolesToUsers, superAdminUsers, superAdminPluginRoles);
} | Helper factory to build {@link GroupSecurity} helpers that abstract the details of calculating
effective pipeline group viewers, operators, and admins.
<p>
NOTE: Instances are intended to have short lifetimes (e.g., within the life of a request).
Don't hang onto references as results are cached and will not update on c... | forGroup | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/PipelineGroupsSecurityHelper.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/PipelineGroupsSecurityHelper.java | Apache-2.0 |
public static Set<String> namesOf(AdminsConfig adminsConfig, Map<String, Collection<String>> rolesToUsers) {
List<AdminUser> admins = adminsConfig.getUsers();
Set<String> adminNames = new HashSet<>();
for (AdminUser admin : admins) {
adminNames.add(admin.getName().toLower());
... | Compiles a list of users from an {@link AdminsConfig}, denormalizing roles to the underlying
members.
@param adminsConfig the config fragment
@param rolesToUsers a {@link Map} of member users to their respective roles
@return a {@link Set} of user names from the config | namesOf | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | Apache-2.0 |
public static Map<String, Collection<String>> rolesToUsers(SecurityConfig securityConfig) {
Map<String, Collection<String>> rolesToUsers = new HashMap<>();
for (Role role : securityConfig.getRoles()) {
if (role instanceof RoleConfig) {
rolesToUsers.put(role.getName().toLower(... | Compiles a list of users from an {@link AdminsConfig}, denormalizing roles to the underlying
members.
@param adminsConfig the config fragment
@param rolesToUsers a {@link Map} of member users to their respective roles
@return a {@link Set} of user names from the config | rolesToUsers | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | Apache-2.0 |
public static Set<PluginRoleConfig> pluginRolesFor(SecurityConfig securityConfig, List<AdminRole> roles) {
Set<PluginRoleConfig> pluginRoleConfigs = new HashSet<>();
for (AdminRole role : roles) {
PluginRoleConfig pluginRole = securityConfig.getPluginRole(role.getName());
if (pl... | Compiles a list of users from an {@link AdminsConfig}, denormalizing roles to the underlying
members.
@param adminsConfig the config fragment
@param rolesToUsers a {@link Map} of member users to their respective roles
@return a {@link Set} of user names from the config | pluginRolesFor | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | Apache-2.0 |
public static boolean noSuperAdminsDefined(SecurityConfig securityConfig) {
AdminsConfig adminsConfig = securityConfig.adminsConfig();
return adminsConfig.getRoles().isEmpty() && adminsConfig.getUsers().isEmpty();
} | Compiles a list of users from an {@link AdminsConfig}, denormalizing roles to the underlying
members.
@param adminsConfig the config fragment
@param rolesToUsers a {@link Map} of member users to their respective roles
@return a {@link Set} of user names from the config | noSuperAdminsDefined | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | Apache-2.0 |
private static Collection<String> emptyIfNull(Collection<String> collection) {
return collection == null ? Collections.emptyList() : collection;
} | Compiles a list of users from an {@link AdminsConfig}, denormalizing roles to the underlying
members.
@param adminsConfig the config fragment
@param rolesToUsers a {@link Map} of member users to their respective roles
@return a {@link Set} of user names from the config | emptyIfNull | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/config/security/util/SecurityConfigUtils.java | Apache-2.0 |
@Override
public void jobStatusChanged(JobInstance job) {
cache(job);
} | Understands jobs that are currently in progress | jobStatusChanged | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
private synchronized void cache(JobInstance newJob) {
JobConfigIdentifier identifier = newJob.getIdentifier().jobConfigIdentifier();
jobs.put(identifier, newJob);
clearOldJobs(newJob);
} | Understands jobs that are currently in progress | cache | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
private void clearOldJobs(JobInstance newJob) {
Set<JobConfigIdentifier> cachedIds = new HashSet<>(jobs.keySet());
for (JobConfigIdentifier cachedId : cachedIds) {
JobInstance originalCached = jobs.get(cachedId);
if ((originalCached == NEVER_RUN && !newJob.getIdentifier().jobConf... | Understands jobs that are currently in progress | clearOldJobs | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
private boolean shouldBeCleared(JobInstance newJob, JobInstance cached) {
return cached.isSameStageConfig(newJob) && !cached.isSamePipelineInstance(newJob);
} | Understands jobs that are currently in progress | shouldBeCleared | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
public JobInstance currentJob(JobConfigIdentifier identifier) {
List<JobInstance> jobs = currentJobs(identifier);
return jobs.isEmpty() ? null : jobs.get(0);
} | Understands jobs that are currently in progress | currentJob | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
public List<JobInstance> currentJobs(final JobConfigIdentifier identifier) {
if (jobs.get(identifier) == NEVER_RUN) {
return new ArrayList<>();
}
List<JobInstance> found = addInstances(identifier, jobs.values());
if (found.isEmpty()) {
found = addInstances(identif... | Understands jobs that are currently in progress | currentJobs | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
private List<JobInstance> addInstances(JobConfigIdentifier identifier, Collection<JobInstance> jobInstances) {
List<JobInstance> found = new ArrayList<>();
for (JobInstance jobInstance : jobInstances) {
if (jobInstance != NEVER_RUN && jobInstance.matches(identifier)) {
found.... | Understands jobs that are currently in progress | addInstances | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
@TestOnly
public void clear() {
jobs.clear();
} | Understands jobs that are currently in progress | clear | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/activity/JobStatusCache.java | Apache-2.0 |
ProjectStatus get(String projectName) {
return cache.get(projectName);
} | Assumption: The put(), putAll() and replaceAllEntriesInCacheWith() methods, which change this cache,
will always be called from the same thread (queueProcessor in CcTrayActivityListener). Even get() is
called only from that thread. So, not surrounding it with a synchronizedMap. Also, uses {@link LinkedHashMap}
to prese... | get | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | Apache-2.0 |
public void put(ProjectStatus status) {
this.cache.put(status.name(), status);
cacheHasChanged();
} | Assumption: The put(), putAll() and replaceAllEntriesInCacheWith() methods, which change this cache,
will always be called from the same thread (queueProcessor in CcTrayActivityListener). Even get() is
called only from that thread. So, not surrounding it with a synchronizedMap. Also, uses {@link LinkedHashMap}
to prese... | put | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | Apache-2.0 |
public void putAll(List<ProjectStatus> statuses) {
cache.putAll(createReplacementItems(statuses));
cacheHasChanged();
} | Assumption: The put(), putAll() and replaceAllEntriesInCacheWith() methods, which change this cache,
will always be called from the same thread (queueProcessor in CcTrayActivityListener). Even get() is
called only from that thread. So, not surrounding it with a synchronizedMap. Also, uses {@link LinkedHashMap}
to prese... | putAll | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | Apache-2.0 |
void replaceAllEntriesInCacheWith(List<ProjectStatus> projectStatuses) {
this.cache.clear();
this.cache.putAll(createReplacementItems(projectStatuses));
cacheHasChanged();
} | Assumption: The put(), putAll() and replaceAllEntriesInCacheWith() methods, which change this cache,
will always be called from the same thread (queueProcessor in CcTrayActivityListener). Even get() is
called only from that thread. So, not surrounding it with a synchronizedMap. Also, uses {@link LinkedHashMap}
to prese... | replaceAllEntriesInCacheWith | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | Apache-2.0 |
public List<ProjectStatus> allEntriesInOrder() {
return this.orderedEntries;
} | Assumption: The put(), putAll() and replaceAllEntriesInCacheWith() methods, which change this cache,
will always be called from the same thread (queueProcessor in CcTrayActivityListener). Even get() is
called only from that thread. So, not surrounding it with a synchronizedMap. Also, uses {@link LinkedHashMap}
to prese... | allEntriesInOrder | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | Apache-2.0 |
private void cacheHasChanged() {
this.orderedEntries = new ArrayList<>(cache.values());
} | Assumption: The put(), putAll() and replaceAllEntriesInCacheWith() methods, which change this cache,
will always be called from the same thread (queueProcessor in CcTrayActivityListener). Even get() is
called only from that thread. So, not surrounding it with a synchronizedMap. Also, uses {@link LinkedHashMap}
to prese... | cacheHasChanged | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | Apache-2.0 |
private Map<String, ProjectStatus> createReplacementItems(List<ProjectStatus> statuses) {
Map<String, ProjectStatus> replacementItems = new LinkedHashMap<>();
for (ProjectStatus status : statuses) {
replacementItems.put(status.name(), status);
}
return replacementItems;
} | Assumption: The put(), putAll() and replaceAllEntriesInCacheWith() methods, which change this cache,
will always be called from the same thread (queueProcessor in CcTrayActivityListener). Even get() is
called only from that thread. So, not surrounding it with a synchronizedMap. Also, uses {@link LinkedHashMap}
to prese... | createReplacementItems | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/domain/cctray/CcTrayCache.java | Apache-2.0 |
public boolean cacheCreated(T artifactLocation) throws Exception {
if (currentlyCreatingCache(artifactLocation)) { return false; }
if (exceptionCreatingCache(artifactLocation)) {
Exception e = pendingExceptions.get(artifactLocation);
if (e != null && pendingExceptions.remove(arti... | Understands serving prepared artifacts and preparing artifact offline | cacheCreated | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | Apache-2.0 |
private boolean exceptionCreatingCache(T artifactLocation) {
return pendingExceptions.containsKey(artifactLocation);
} | Understands serving prepared artifacts and preparing artifact offline | exceptionCreatingCache | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | Apache-2.0 |
private boolean cacheAlreadyCreated(T artifactLocation) {
return cachedFile(artifactLocation).exists();
} | Understands serving prepared artifacts and preparing artifact offline | cacheAlreadyCreated | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | Apache-2.0 |
private boolean currentlyCreatingCache(T artifactLocation) {
return pendingCacheFiles.contains(artifactLocation);
} | Understands serving prepared artifacts and preparing artifact offline | currentlyCreatingCache | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | Apache-2.0 |
protected void startCacheCreationThread(final T artifactLocation) {
boolean inserted = pendingCacheFiles.add(artifactLocation);
if (inserted) {
Thread cacheCreatorThread = new Thread("cache-creator-thread-" + UUID.randomUUID()) {
@Override
public void run() {
... | Understands serving prepared artifacts and preparing artifact offline | startCacheCreationThread | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | Apache-2.0 |
@Override
public void run() {
try {
createCachedFile(artifactLocation);
} catch (Exception e) {
pendingExceptions.putIfAbsent(artifactLocation, e);
} finally {
pendingCache... | Understands serving prepared artifacts and preparing artifact offline | run | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/ArtifactCache.java | Apache-2.0 |
@PreDestroy
public void destroy() {
clear();
Optional.ofNullable(ehCache.getCacheManager())
.ifPresent(cm -> cm.removeCache(ehCache.getName()));
} | Understands storing and retrieving objects from an underlying LRU cache | destroy | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
protected void registerAsCacheEvictionListener() {
ehCache.getCacheEventNotificationService().registerListener(new CacheEvictionListener(this));
} | Understands storing and retrieving objects from an underlying LRU cache | registerAsCacheEvictionListener | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public void stopServingForTransaction() {
if (transactionSynchronizationManager.isTransactionBodyExecuting() && !doNotServeForTransaction()) {
doNotServeForTransaction.set(true);
transactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
... | Understands storing and retrieving objects from an underlying LRU cache | stopServingForTransaction | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
@Override
public void beforeCompletion() {
doNotServeForTransaction.set(false);
} | Understands storing and retrieving objects from an underlying LRU cache | beforeCompletion | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public void put(String key, Object value) {
logUnsavedPersistentObjectInteraction(value, "PersistentObject {} added to cache without an id.");
if (transactionSynchronizationManager.isActualTransactionActive()) {
LOGGER.debug("transaction active during cache put for {} = {}", key, value, new ... | Understands storing and retrieving objects from an underlying LRU cache | put | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public List<String> getKeys() {
return ehCache.getKeys();
} | Understands storing and retrieving objects from an underlying LRU cache | getKeys | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
private void logUnsavedPersistentObjectInteraction(Object value, String message) {
if (value instanceof PersistentObject persistentObject) {
for (Class<? extends PersistentObject> nullObjectClass : nullObjectClasses) {
if (value.getClass().equals(nullObjectClass)) {
... | Understands storing and retrieving objects from an underlying LRU cache | logUnsavedPersistentObjectInteraction | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public <T> T get(String key) {
if (doNotServeForTransaction()) {
return null;
}
return getWithoutTransactionCheck(key);
} | Understands storing and retrieving objects from an underlying LRU cache | get | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
private <T> T getWithoutTransactionCheck(String key) {
Element element = ehCache.get(key);
if (element == null) {
return null;
}
@SuppressWarnings("unchecked") T value = (T) element.getObjectValue();
logUnsavedPersistentObjectInteraction(value, "PersistentObject {} wi... | Understands storing and retrieving objects from an underlying LRU cache | getWithoutTransactionCheck | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
private boolean doNotServeForTransaction() {
return doNotServeForTransaction.get() != null && doNotServeForTransaction.get();
} | Understands storing and retrieving objects from an underlying LRU cache | doNotServeForTransaction | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public boolean remove(String key) {
synchronized (key.intern()) {
Object value = getWithoutTransactionCheck(key);
if (value instanceof KeyList) {
for (String subKey : (KeyList) value) {
ehCache.remove(compositeKey(key, subKey));
}
... | Understands storing and retrieving objects from an underlying LRU cache | remove | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public Object get(String key, String subKey) {
return get(compositeKey(key, subKey));
} | Understands storing and retrieving objects from an underlying LRU cache | get | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public void put(String key, String subKey, Object value) {
KeyList subKeys;
synchronized (key.intern()) {
subKeys = subKeyFamily(key);
if (subKeys == null) {
subKeys = new KeyList();
put(key, subKeys);
}
subKeys.add(subKey);... | Understands storing and retrieving objects from an underlying LRU cache | put | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public void removeAll(List<String> keys) {
for (String key : keys) {
remove(key);
}
} | Understands storing and retrieving objects from an underlying LRU cache | removeAll | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public void removeAssociations(String key, Element element) {
if (element.getObjectValue() instanceof KeyList) {
synchronized (key.intern()) {
for (String subkey : (KeyList) element.getObjectValue()) {
remove(compositeKey(key, subkey));
}
... | Understands storing and retrieving objects from an underlying LRU cache | removeAssociations | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public boolean isKeyInCache(Object key) {
return ehCache.isKeyInCache(key);
} | Understands storing and retrieving objects from an underlying LRU cache | isKeyInCache | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
private KeyList subKeyFamily(String parentKey) {
return get(parentKey);
} | Understands storing and retrieving objects from an underlying LRU cache | subKeyFamily | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
private String compositeKey(String key, String subKey) {
String concat = key + subKey;
if (concat.contains(SUB_KEY_DELIMITER)) {
bomb(String.format("Base and sub key concatenation(key = %s, subkey = %s) must not have pattern %s", key, subKey, SUB_KEY_DELIMITER));
}
return key... | Understands storing and retrieving objects from an underlying LRU cache | compositeKey | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public void remove(String key, String subKey) {
synchronized (key.intern()) {
KeyList subKeys = subKeyFamily(key);
if (subKeys == null) {
return;
}
subKeys.remove(subKey);
remove(compositeKey(key, subKey));
}
} | Understands storing and retrieving objects from an underlying LRU cache | remove | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
public CacheConfiguration configuration() {
return ehCache.getCacheConfiguration();
} | Understands storing and retrieving objects from an underlying LRU cache | configuration | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/cache/GoCache.java | Apache-2.0 |
@Override
public List<Modification> getPassedStagesByName(DependencyMaterial material, Pagination pagination) {
Stages stages = stageDao.getPassedStagesByName(CaseInsensitiveString.str(material.getPipelineName()), CaseInsensitiveString.str(material.getStageName()), pagination.getPageSize(), pagination.getOf... | Understands fetching modifications from local stages | getPassedStagesByName | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/dao/LocalDependencyMaterialSourceDao.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/dao/LocalDependencyMaterialSourceDao.java | Apache-2.0 |
@Override
public List<Modification> getPassedStagesAfter(final String lastRevision, DependencyMaterial material, Pagination pagination) {
StageIdentifier identifier = new StageIdentifier(lastRevision);
List<StageAsDMR> passedStagesAfter = stageDao.getPassedStagesAfter(identifier, pagination.getPageS... | Understands fetching modifications from local stages | getPassedStagesAfter | java | gocd/gocd | server/src/main/java/com/thoughtworks/go/server/dao/LocalDependencyMaterialSourceDao.java | https://github.com/gocd/gocd/blob/master/server/src/main/java/com/thoughtworks/go/server/dao/LocalDependencyMaterialSourceDao.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.