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 |
|---|---|---|---|---|---|---|---|
@Override
public void onSimpleTap(MotionEvent e) {
setSelectedAnnotation(INVALID_POSITION);
} | Determine whether multi-touch is fully enabled on the current device. The
hint returned by this method can be used to decide whether to enable the
built-in zoom controls or not.
@return True is the device supports distinct multi-touch gestures.
Otherwise it return false. | onSimpleTap | java | cyrilmottier/Polaris | library/src/com/cyrilmottier/polaris/PolarisMapView.java | https://github.com/cyrilmottier/Polaris/blob/master/library/src/com/cyrilmottier/polaris/PolarisMapView.java | Apache-2.0 |
@Override
public void onLongPress(MotionEvent e) {
if (mOnMapViewLongClickListener != null) {
mOnMapViewLongClickListener.onLongClick(PolarisMapView.this, getProjection().fromPixels((int) e.getX(), (int) e.getY()));
}
} | Determine whether multi-touch is fully enabled on the current device. The
hint returned by this method can be used to decide whether to enable the
built-in zoom controls or not.
@return True is the device supports distinct multi-touch gestures.
Otherwise it return false. | onLongPress | java | cyrilmottier/Polaris | library/src/com/cyrilmottier/polaris/PolarisMapView.java | https://github.com/cyrilmottier/Polaris/blob/master/library/src/com/cyrilmottier/polaris/PolarisMapView.java | Apache-2.0 |
@Override
public void onDoubleTap(MotionEvent e) {
getController().zoomInFixing((int) e.getX(), (int) e.getY());
} | Determine whether multi-touch is fully enabled on the current device. The
hint returned by this method can be used to decide whether to enable the
built-in zoom controls or not.
@return True is the device supports distinct multi-touch gestures.
Otherwise it return false. | onDoubleTap | java | cyrilmottier/Polaris | library/src/com/cyrilmottier/polaris/PolarisMapView.java | https://github.com/cyrilmottier/Polaris/blob/master/library/src/com/cyrilmottier/polaris/PolarisMapView.java | Apache-2.0 |
@Override
public void onClick(View v) {
if (mOnAnnotationSelectionChangedListener != null) {
final int annotationPosition = getSelectedAnnotationPosition();
final Annotation annotation = getSelectedAnnotation();
if (annotation != null && annotationPosi... | Determine whether multi-touch is fully enabled on the current device. The
hint returned by this method can be used to decide whether to enable the
built-in zoom controls or not.
@return True is the device supports distinct multi-touch gestures.
Otherwise it return false. | onClick | java | cyrilmottier/Polaris | library/src/com/cyrilmottier/polaris/PolarisMapView.java | https://github.com/cyrilmottier/Polaris/blob/master/library/src/com/cyrilmottier/polaris/PolarisMapView.java | Apache-2.0 |
@Override
public void onDoubleTap(View v) {
final Annotation annotation = getSelectedAnnotation();
if (annotation != null) {
getController().zoomToSpan(1, 1);
getController().setCenter(annotation.getPoint());
}
} | Determine whether multi-touch is fully enabled on the current device. The
hint returned by this method can be used to decide whether to enable the
built-in zoom controls or not.
@return True is the device supports distinct multi-touch gestures.
Otherwise it return false. | onDoubleTap | java | cyrilmottier/Polaris | library/src/com/cyrilmottier/polaris/PolarisMapView.java | https://github.com/cyrilmottier/Polaris/blob/master/library/src/com/cyrilmottier/polaris/PolarisMapView.java | Apache-2.0 |
@Override
public void onClick(View v) {
MapViewUtils.smoothCenterOnUserLocation(PolarisMapView.this, mMyLocationOverlay, R.string.polaris__unable_to_locate_you);
} | Determine whether multi-touch is fully enabled on the current device. The
hint returned by this method can be used to decide whether to enable the
built-in zoom controls or not.
@return True is the device supports distinct multi-touch gestures.
Otherwise it return false. | onClick | java | cyrilmottier/Polaris | library/src/com/cyrilmottier/polaris/PolarisMapView.java | https://github.com/cyrilmottier/Polaris/blob/master/library/src/com/cyrilmottier/polaris/PolarisMapView.java | Apache-2.0 |
private static String getLocalConfigString(String name) {
try {
return (String) LOCAL_CONFIG_CLASS.getField(name).get(null);
} catch (Exception e) {
Log.e(LOG_TAG, "No local configuration found with key " + name);
return null;
}
} | Uses reflection in order to extract a local configuration.
@return The String associated to the given name (should be stored as a
static final variable) or the defaultValue if an error occurred. | getLocalConfigString | java | cyrilmottier/Polaris | sample/src/com/cyrilmottier/android/polarissample/util/Config.java | https://github.com/cyrilmottier/Polaris/blob/master/sample/src/com/cyrilmottier/android/polarissample/util/Config.java | Apache-2.0 |
protected void setContentType(Request req, Response res) {
res.raw().setCharacterEncoding("utf-8");
res.type(mimeType);
} | all controllers are singletons, so instance loggers are ok | setContentType | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected String messageJson(String message) {
return MessageJson.create(message);
} | all controllers are singletons, so instance loggers are ok | messageJson | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected String renderMessage(Response res, int statusCode, String message) {
res.status(statusCode);
res.body(messageJson(message));
return NOTHING;
} | all controllers are singletons, so instance loggers are ok | renderMessage | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected void verifyContentType(Request request, Response response) throws IOException {
if (!UPDATE_HTTP_METHODS.contains(request.requestMethod().toUpperCase())) {
return;
}
boolean requestHasBody = request.contentLength() >= 1 || request.raw().getInputStream().available() >= 1 ||... | all controllers are singletons, so instance loggers are ok | verifyContentType | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected boolean isJsonContentType(Request request) {
String mime = request.headers("Content-Type");
if (mime == null || mime.isBlank()) {
return false;
}
try {
MimeType mimeType = MimeType.valueOf(mime);
return "application".equals(mimeType.getType()... | all controllers are singletons, so instance loggers are ok | isJsonContentType | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
public String getMimeType() {
return mimeType;
} | all controllers are singletons, so instance loggers are ok | getMimeType | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected Map<String, Object> readRequestBodyAsJSON(Request req) {
Map<String, Object> map = GsonTransformer.getInstance().fromJson(req.body(), new TypeToken<Map<String, Object>>() {
}.getType());
if (map == null) {
return Collections.emptyMap();
}
return map;
} | all controllers are singletons, so instance loggers are ok | readRequestBodyAsJSON | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected static Filter onlyOn(Filter filter, String... allowedMethods) {
return (request, response) -> {
if (Set.of(allowedMethods).contains(request.requestMethod())) {
filter.handle(request, response);
}
};
} | all controllers are singletons, so instance loggers are ok | onlyOn | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected int getPageSize(Request request) {
int offset;
try {
offset = Integer.parseInt(request.queryParamOrDefault("page_size", DEFAULT_PAGE_SIZE));
if (offset < 10 || offset > 100) {
throw new BadRequestException(BAD_PAGE_SIZE_MSG);
}
} catc... | all controllers are singletons, so instance loggers are ok | getPageSize | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected long beforeCursor(Request request) {
return getCursor(request, "before");
} | all controllers are singletons, so instance loggers are ok | beforeCursor | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected long afterCursor(Request request) {
return getCursor(request, "after");
} | all controllers are singletons, so instance loggers are ok | afterCursor | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
protected long getCursor(Request request, String key) {
long cursor = 0;
try {
String value = request.queryParams(key);
if (value == null || value.isBlank()) {
return cursor;
}
cursor = Long.parseLong(value);
} catch (NumberFormatEx... | all controllers are singletons, so instance loggers are ok | getCursor | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/ApiController.java | Apache-2.0 |
public static List<ConfigurationProperty> fromJSONArrayHandlingEncryption(JsonReader jsonReader, String arrayKey) {
List<ConfigurationProperty> configurationProperties = new ArrayList<>();
jsonReader.readArrayIfPresent(arrayKey, properties -> properties.forEach(property -> {
JsonReader confi... | Like {@link #fromJSONArray(JsonReader, String)}, but honors the `secure` flag
@param jsonReader the reader for JSON input
@param arrayKey the JSON key holding the configuration properties block
@return a {@link List<ConfigurationProperty>} | fromJSONArrayHandlingEncryption | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/representers/ConfigurationPropertyRepresenter.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/representers/ConfigurationPropertyRepresenter.java | Apache-2.0 |
public static ConfigurationProperty fromJSONHandlingEncryption(JsonReader jsonReader) {
try {
final String key = jsonReader.getString("key");
final String value = jsonReader.optString("value").orElse(null);
final String encryptedValue = jsonReader.optString("encrypted_value")... | Like {@link #fromJSON(JsonReader)}, but handles an additional `secure` flag.
<p>
Behavior:
<p>
1. if `encrypted_value` is provided, it behaves like {@link #fromJSON(JsonReader)} and ignores `secure`
2. only if `value` and `secure` are present, conditionally encrypts `value` => `encrypted_value` depending
on the `secure... | fromJSONHandlingEncryption | java | gocd/gocd | api/api-base/src/main/java/com/thoughtworks/go/api/representers/ConfigurationPropertyRepresenter.java | https://github.com/gocd/gocd/blob/master/api/api-base/src/main/java/com/thoughtworks/go/api/representers/ConfigurationPropertyRepresenter.java | Apache-2.0 |
@Override
public MaterialConfig configMaterial() {
return null == repo ? dummyMaterial() : repo.getRepo();
} | This is primarily used for two things:
1) When a pipeline definition defines its material type as `configrepo`, this
provides the material configuration used by the {@link ConfigRepoConfig}
itself; this means that the pipeline definition is on the same repo as the
pipeline build material. For preflight, if no... | configMaterial | java | gocd/gocd | api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | Apache-2.0 |
private MaterialConfig dummyMaterial() {
GitMaterialConfig gitMaterialConfig = new GitMaterialConfig();
gitMaterialConfig.setUrl(UUID.randomUuid());
return gitMaterialConfig;
} | This is primarily used for two things:
1) When a pipeline definition defines its material type as `configrepo`, this
provides the material configuration used by the {@link ConfigRepoConfig}
itself; this means that the pipeline definition is on the same repo as the
pipeline build material. For preflight, if no... | dummyMaterial | java | gocd/gocd | api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | Apache-2.0 |
private ConfigRepoPlugin pluginFromRequest(Request req) {
String pluginId = req.queryParams("pluginId");
if (StringUtils.isBlank(pluginId)) {
throw HaltApiResponses.haltBecauseRequiredParamMissing("pluginId");
}
return (ConfigRepoPlugin) pluginService.partialConfigProviderFor... | This is primarily used for two things:
1) When a pipeline definition defines its material type as `configrepo`, this
provides the material configuration used by the {@link ConfigRepoConfig}
itself; this means that the pipeline definition is on the same repo as the
pipeline build material. For preflight, if no... | pluginFromRequest | java | gocd/gocd | api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | Apache-2.0 |
private ConfigRepoConfig repoFromRequest(Request req) {
String repoId = req.queryParams("repoId");
if (null == repoId) {
return null;
}
ConfigRepoConfig repo = service.getConfigRepo(repoId);
if (null == repo) {
throw new RecordNotFoundException(EntityTyp... | This is primarily used for two things:
1) When a pipeline definition defines its material type as `configrepo`, this
provides the material configuration used by the {@link ConfigRepoConfig}
itself; this means that the pipeline definition is on the same repo as the
pipeline build material. For preflight, if no... | repoFromRequest | java | gocd/gocd | api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-config-repo-operations-v1/src/main/java/com/thoughtworks/go/apiv1/configrepooperations/ConfigRepoOperationsControllerV1.java | Apache-2.0 |
@Override
public String controllerBasePath() {
return Routes.InternalPipelineGroups.BASE;
} | Internal PipelineGroups API, to be used on the environments SPA while editing pipelines. | controllerBasePath | java | gocd/gocd | api/api-internal-pipeline-groups-v1/src/main/java/com/thoughtworks/go/apiv1/internalpipelinegroups/InternalPipelineGroupsControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-internal-pipeline-groups-v1/src/main/java/com/thoughtworks/go/apiv1/internalpipelinegroups/InternalPipelineGroupsControllerV1.java | Apache-2.0 |
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this.mimeType, this.apiAuthenticationHelper::checkUserAnd403);
before("/*", this.mime... | Internal PipelineGroups API, to be used on the environments SPA while editing pipelines. | setupRoutes | java | gocd/gocd | api/api-internal-pipeline-groups-v1/src/main/java/com/thoughtworks/go/apiv1/internalpipelinegroups/InternalPipelineGroupsControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-internal-pipeline-groups-v1/src/main/java/com/thoughtworks/go/apiv1/internalpipelinegroups/InternalPipelineGroupsControllerV1.java | Apache-2.0 |
public String index(Request request, Response response) throws IOException {
String pipelineGroupAuthorizationType = request.queryParamOrDefault("pipeline_group_authorization", "view");
Supplier<PipelineGroups> pipelineGroupsSupplier = pipelineGroupAuthorizationRegistry.get(pipelineGroupAuthorizationTyp... | Internal PipelineGroups API, to be used on the environments SPA while editing pipelines. | index | java | gocd/gocd | api/api-internal-pipeline-groups-v1/src/main/java/com/thoughtworks/go/apiv1/internalpipelinegroups/InternalPipelineGroupsControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-internal-pipeline-groups-v1/src/main/java/com/thoughtworks/go/apiv1/internalpipelinegroups/InternalPipelineGroupsControllerV1.java | Apache-2.0 |
private Consumer<OutputWriter> jsonWriter(PipelineConfig pipelineConfig) {
String groupName = goConfigService.findGroupNameByPipeline(pipelineConfig.name());
return writer -> PipelineConfigRepresenter.toJSON(writer, pipelineConfig, groupName);
} | @throws HaltException when "name" is missing from JSON body | jsonWriter | java | gocd/gocd | api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | Apache-2.0 |
private ConfigRepoPlugin pluginFromRequest(Request req) {
String pluginId = requiredParam(req, ":plugin_id");
if (!pluginService.isConfigRepoPlugin(pluginId)) {
throw haltBecauseOfReason("Plugin `%s` is not a Pipelines-as-Code plugin.", pluginId);
}
return (ConfigRepoPlugin... | @throws HaltException when "name" is missing from JSON body | pluginFromRequest | java | gocd/gocd | api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | Apache-2.0 |
private String requiredParam(final Request req, @SuppressWarnings("SameParameterValue") final String name) {
String value = req.params(name);
if (StringUtils.isBlank(value)) {
throw HaltApiResponses.haltBecauseRequiredParamMissing(name);
}
return value;
} | @throws HaltException when "name" is missing from JSON body | requiredParam | java | gocd/gocd | api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | Apache-2.0 |
private String requiredQueryParam(final Request req, @SuppressWarnings("SameParameterValue") final String name) {
String value = req.queryParams(name);
if (StringUtils.isBlank(value)) {
throw HaltApiResponses.haltBecauseRequiredParamMissing(name);
}
return value;
} | @throws HaltException when "name" is missing from JSON body | requiredQueryParam | java | gocd/gocd | api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | https://github.com/gocd/gocd/blob/master/api/api-pipelines-as-code-internal-v1/src/main/java/com/thoughtworks/go/apiv1/pipelinesascodeinternal/PipelinesAsCodeInternalControllerV1.java | Apache-2.0 |
public static UserToRepresent from(User user, boolean isAdmin, RolesConfig rolesConfig) {
return new UserToRepresent(user, isAdmin, rolesConfig);
} | UserToRepresent Class extends com.thoughtworks.go.domain.User class,
hence it has all the data fields of a User defined in DB.
<p>
Additionally, UserToRepresent also knows following fields:
@field isAdmin Boolean
Tells whether the current user is admin or not.
</p>
<br/>
@since Users API v3 | from | java | gocd/gocd | api/api-users-v3/src/main/java/com/thoughtworks/go/apiv3/users/model/UserToRepresent.java | https://github.com/gocd/gocd/blob/master/api/api-users-v3/src/main/java/com/thoughtworks/go/apiv3/users/model/UserToRepresent.java | Apache-2.0 |
public boolean isAdmin() {
return this.isAdmin;
} | UserToRepresent Class extends com.thoughtworks.go.domain.User class,
hence it has all the data fields of a User defined in DB.
<p>
Additionally, UserToRepresent also knows following fields:
@field isAdmin Boolean
Tells whether the current user is admin or not.
</p>
<br/>
@since Users API v3 | isAdmin | java | gocd/gocd | api/api-users-v3/src/main/java/com/thoughtworks/go/apiv3/users/model/UserToRepresent.java | https://github.com/gocd/gocd/blob/master/api/api-users-v3/src/main/java/com/thoughtworks/go/apiv3/users/model/UserToRepresent.java | Apache-2.0 |
public RolesConfig getRoles() {
return this.rolesConfig;
} | UserToRepresent Class extends com.thoughtworks.go.domain.User class,
hence it has all the data fields of a User defined in DB.
<p>
Additionally, UserToRepresent also knows following fields:
@field isAdmin Boolean
Tells whether the current user is admin or not.
</p>
<br/>
@since Users API v3 | getRoles | java | gocd/gocd | api/api-users-v3/src/main/java/com/thoughtworks/go/apiv3/users/model/UserToRepresent.java | https://github.com/gocd/gocd/blob/master/api/api-users-v3/src/main/java/com/thoughtworks/go/apiv3/users/model/UserToRepresent.java | Apache-2.0 |
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void mkdirsParentQuietly(File file) {
File directory = file.getParentFile();
mkdirsQuietly(directory);
} | Makes parent directories, ignoring if it already exists | mkdirsParentQuietly | java | gocd/gocd | base/src/main/java/com/thoughtworks/go/util/FileUtil.java | https://github.com/gocd/gocd/blob/master/base/src/main/java/com/thoughtworks/go/util/FileUtil.java | Apache-2.0 |
@SuppressWarnings("ResultOfMethodCallIgnored")
private static void mkdirsQuietly(File directory) {
if (directory != null && !directory.exists()) {
directory.mkdirs();
}
} | Makes directories, ignoring if null or already exists | mkdirsQuietly | java | gocd/gocd | base/src/main/java/com/thoughtworks/go/util/FileUtil.java | https://github.com/gocd/gocd/blob/master/base/src/main/java/com/thoughtworks/go/util/FileUtil.java | Apache-2.0 |
public static String toFileURI(File file) {
URI uri = file.toURI();
String uriString = uri.toASCIIString();
return uriString.replaceAll("^file:/", "file:///");
} | Makes directories, ignoring if null or already exists | toFileURI | java | gocd/gocd | base/src/main/java/com/thoughtworks/go/util/FileUtil.java | https://github.com/gocd/gocd/blob/master/base/src/main/java/com/thoughtworks/go/util/FileUtil.java | Apache-2.0 |
public static String toFileURI(String path) {
return toFileURI(new File(path));
} | Makes directories, ignoring if null or already exists | toFileURI | java | gocd/gocd | base/src/main/java/com/thoughtworks/go/util/FileUtil.java | https://github.com/gocd/gocd/blob/master/base/src/main/java/com/thoughtworks/go/util/FileUtil.java | Apache-2.0 |
public static boolean isSubdirectoryOf(File parent, File subdirectory) throws IOException {
File parentFile = parent.getCanonicalFile();
File current = subdirectory.getCanonicalFile();
while (current != null) {
if (current.equals(parentFile)) {
return true;
... | Makes directories, ignoring if null or already exists | isSubdirectoryOf | java | gocd/gocd | base/src/main/java/com/thoughtworks/go/util/FileUtil.java | https://github.com/gocd/gocd/blob/master/base/src/main/java/com/thoughtworks/go/util/FileUtil.java | Apache-2.0 |
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void createFilesByPath(File baseDir, String... files) throws IOException {
for (String file : files) {
File file1 = new File(baseDir, file);
if (file.endsWith("/")) {
file1.mkdirs();
} else {
... | Makes directories, ignoring if null or already exists | createFilesByPath | java | gocd/gocd | base/src/main/java/com/thoughtworks/go/util/FileUtil.java | https://github.com/gocd/gocd/blob/master/base/src/main/java/com/thoughtworks/go/util/FileUtil.java | Apache-2.0 |
public static File createTempFolder() {
File tempDir = new File(TMP_PARENT_DIR, CRUISE_TMP_FOLDER);
File dir = new File(tempDir, UUID.randomUUID().toString());
boolean ret = dir.mkdirs();
if (!ret) {
throw new RuntimeException("FileUtil#createTempFolder - Could not create tem... | Makes directories, ignoring if null or already exists | createTempFolder | java | gocd/gocd | base/src/main/java/com/thoughtworks/go/util/FileUtil.java | https://github.com/gocd/gocd/blob/master/base/src/main/java/com/thoughtworks/go/util/FileUtil.java | Apache-2.0 |
public static String toString(String[] line, boolean quote) {
return toString(line, quote, " ");
} | Commandline objects help handling command lines specifying processes to execute.
<p/>
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<p/>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
&nbs... | toString | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public static String toString(String[] line, boolean quote, String separator) {
// empty path return empty string
if (line == null || line.length == 0) {
return "";
}
// path containing one or more elements
final StringBuilder result = new StringBuilder();
fo... | Commandline objects help handling command lines specifying processes to execute.
<p/>
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<p/>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
&nbs... | toString | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public static String[] translateCommandLine(String toProcess) throws CommandLineException {
if (toProcess == null || toProcess.isEmpty()) {
return new String[0];
}
// parse with a simple finite state machine
final int normal = 0;
final int inQuote = 1;
final... | Commandline objects help handling command lines specifying processes to execute.
<p/>
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<p/>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
&nbs... | translateCommandLine | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public static CommandLine createCommandLine(String command) {
return new CommandLine(command);
} | Commandline objects help handling command lines specifying processes to execute.
<p/>
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<p/>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
&nbs... | createCommandLine | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public Map<String, String> env() {
return env;
} | Commandline objects help handling command lines specifying processes to execute.
<p/>
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<p/>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
&nbs... | env | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public String describe() {
String description = "--- Command ---\n" + this
+ "\n--- Environment ---\n" + env + "\n"
+ "--- INPUT ----\n" + String.join(",", inputs) + "\n";
for (CommandArgument argument : arguments) {
description = argument.replaceSecretInfo(descriptio... | Commandline objects help handling command lines specifying processes to execute.
<p/>
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<p/>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
&nbs... | describe | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
@Override
public String toString() {
return toString(getCommandLineForDisplay(), true);
} | Commandline objects help handling command lines specifying processes to execute.
<p/>
The class can be used to define a command line as nested elements or as a helper to define a command line by an
application.
<p/>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
&nbs... | toString | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public String toStringForDisplay() {
return toString(getCommandLineForDisplay(), false);
} | Converts the command line to a string without adding quotes to any of the arguments. | toStringForDisplay | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public int size() {
return getCommandLine().length;
} | Converts the command line to a string without adding quotes to any of the arguments. | size | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public File getWorkingDirectory() {
return workingDir;
} | Converts the command line to a string without adding quotes to any of the arguments. | getWorkingDirectory | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public ProcessWrapper execute(ConsoleOutputStreamConsumer outputStreamConsumer, EnvironmentVariableContext environmentVariableContext, ProcessTag processTag) {
ProcessWrapper process = createProcess(environmentVariableContext, outputStreamConsumer, processTag, ERROR_STREAM_PREFIX_FOR_CMDS);
process.type... | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | execute | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public String getExecutable() {
return executable;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | getExecutable | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withArg(String argument) {
this.arguments.add(new StringArgument(argument));
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withArg | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withArgs(String... args) {
addStringArguments(args);
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withArgs | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withArgs(List<String> args) {
args.forEach(arg -> arguments.add(new StringArgument(arg)));
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withArgs | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine when(boolean condition, Consumer<CommandLine> thenDo) {
return this.tap((cmd) -> {
if (condition) {
thenDo.accept(cmd);
}
});
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | when | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine tap(Consumer<CommandLine> thenDo) {
thenDo.accept(this);
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | tap | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine argPassword(String password) {
arguments.add(new PasswordArgument(password));
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | argPassword | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withWorkingDir(File folder) {
setWorkingDir(folder);
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withWorkingDir | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withEnv(Map<String, String> env) {
this.env.putAll(env);
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withEnv | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withArg(CommandArgument argument) {
arguments.add(argument);
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withArg | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withNonArgSecret(SecretString argument) {
secrets.add(argument);
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withNonArgSecret | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withNonArgSecrets(List<SecretString> secrets) {
this.secrets.addAll(secrets);
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withNonArgSecrets | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public List<CommandArgument> getArguments() {
return arguments;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | getArguments | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public CommandLine withEncoding(Charset encoding) {
this.encoding = encoding;
return this;
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | withEncoding | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public void runScript(Script script, StreamConsumer buildOutputConsumer,
EnvironmentVariableContext environmentVariableContext, ProcessTag processTag) {
LOG.info("Running command: {}", toStringForDisplay());
CompositeConsumer errorStreamConsumer = new CompositeConsumer(Composi... | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | runScript | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public ConsoleResult runOrBomb(boolean failOnNonZeroReturn, ProcessTag processTag, String... input) {
LOG.debug("Running {}", this);
addInput(input);
InMemoryStreamConsumer output = ProcessOutputStreamConsumer.inMemoryConsumer();
ProcessWrapper process = execute(output, new EnvironmentVa... | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | runOrBomb | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public int run(ConsoleOutputStreamConsumer outputStreamConsumer, ProcessTag processTag, String... input) {
LOG.debug("Running {}", this);
addInput(input);
SafeOutputStreamConsumer safeStreamConsumer = new SafeOutputStreamConsumer(outputStreamConsumer);
safeStreamConsumer.addArguments(arg... | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | run | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public ConsoleResult runOrBomb(ProcessTag processTag, String... input) {
return runOrBomb(true, processTag, input);
} | This should not be used outside of this CommandLine(in production code), as using it directly can bypass smudging of sensitive data | runOrBomb | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
String[] getCommandLine() {
List<String> args = new ArrayList<>();
if (executable != null) {
args.add(executable);
}
for (CommandArgument argument : arguments) {
args.add(argument.forCommandLine());
}
return args.toArray(new String[0]);
} | Returns the executable and all defined arguments. | getCommandLine | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public void setWorkingDir(File workingDir) {
checkWorkingDir(workingDir);
this.workingDir = workingDir;
} | Returns the executable and all defined arguments. | setWorkingDir | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
private void addStringArguments(String... args) {
for (String arg : args) {
arguments.add(new StringArgument(arg));
}
} | Returns the executable and all defined arguments. | addStringArguments | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
private String[] getCommandLineForDisplay() {
List<String> args = new ArrayList<>();
if (executable != null) {
args.add(executable);
}
for (CommandArgument argument : arguments) {
args.add(argument.forDisplay());
}
return args.toArray(new String[0]... | Returns the executable and all defined arguments. | getCommandLineForDisplay | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
private void checkWorkingDir(File dir) {
if (dir != null) {
if (!dir.exists()) {
throw new CommandLineException("Working directory \"" + dir.getAbsolutePath() + "\" does not exist!");
} else if (!dir.isDirectory()) {
throw new CommandLineException("Path \"... | Returns the executable and all defined arguments. | checkWorkingDir | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
private ProcessWrapper createProcess(EnvironmentVariableContext environmentVariableContext, ConsoleOutputStreamConsumer consumer, ProcessTag processTag, String errorPrefix) {
return ProcessManager.getInstance().createProcess(getCommandLine(), toString(getCommandLineForDisplay(), true), workingDir, env, environm... | Returns the executable and all defined arguments. | createProcess | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
private ProcessWrapper startProcess(EnvironmentVariableContext environmentVariableContext, ConsoleOutputStreamConsumer consumer, ProcessTag processTag) throws IOException {
ProcessWrapper process = createProcess(environmentVariableContext, consumer, processTag, ERROR_STREAM_PREFIX_FOR_SCRIPTS);
process.... | Returns the executable and all defined arguments. | startProcess | java | gocd/gocd | commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | https://github.com/gocd/gocd/blob/master/commandline/src/main/java/com/thoughtworks/go/util/command/CommandLine.java | Apache-2.0 |
public boolean wasLineConsumed(String testLine, long timeout) {
long start = System.currentTimeMillis();
long trialTime = 0;
do {
if (lines.contains(testLine)) {
return true;
}
//Sleep a bit.
try {... | Checks to see if this consumer consumed a particular line. This method
will wait up to timeout number of milliseconds for the line to get
consumed.
@param testLine Line to test for.
@param timeout Number of milliseconds to wait for the line.
@return true if the line gets consumed, else false. | wasLineConsumed | java | gocd/gocd | commandline/src/test/java/com/thoughtworks/go/util/command/StreamPumperTest.java | https://github.com/gocd/gocd/blob/master/commandline/src/test/java/com/thoughtworks/go/util/command/StreamPumperTest.java | Apache-2.0 |
@Override
public void consumeLine(String line) {
lines.add(line);
} | Checks to see if this consumer consumed a particular line. This method
will wait up to timeout number of milliseconds for the line to get
consumed.
@param testLine Line to test for.
@param timeout Number of milliseconds to wait for the line.
@return true if the line gets consumed, else false. | consumeLine | java | gocd/gocd | commandline/src/test/java/com/thoughtworks/go/util/command/StreamPumperTest.java | https://github.com/gocd/gocd/blob/master/commandline/src/test/java/com/thoughtworks/go/util/command/StreamPumperTest.java | Apache-2.0 |
public GoAgentServerHttpClient httpClient() {
return httpClient;
} | Used to wrap the constructors in order to mock them out. | httpClient | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/agent/HttpService.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/agent/HttpService.java | Apache-2.0 |
public HttpPost createPost(String url) {
return new HttpPost(url);
} | Used to wrap the constructors in order to mock them out. | createPost | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/agent/HttpService.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/agent/HttpService.java | Apache-2.0 |
public HttpGet createGet(String url) {
return new HttpGet(url);
} | Used to wrap the constructors in order to mock them out. | createGet | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/agent/HttpService.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/agent/HttpService.java | Apache-2.0 |
public HttpEntity createMultipartRequestEntity(File artifact, Properties artifactChecksums) throws IOException {
MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
entityBuilder.addPart(GoConstants.ZIP_MULTIPART_FILENAME, new FileBody(artifact));
if (artifactChec... | Used to wrap the constructors in order to mock them out. | createMultipartRequestEntity | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/agent/HttpService.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/agent/HttpService.java | Apache-2.0 |
public String getHostname() {
return getAgent().getHostname();
} | Understands runtime and configuration information of a builder machine | getHostname | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public String getUuid() {
return getAgent().getUuid();
} | Understands runtime and configuration information of a builder machine | getUuid | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
@Override
public int compareTo(AgentInstance other) {
int comparison = this.getHostname().compareTo(other.getHostname());
if (comparison == 0) {
comparison = this.getLocation().compareTo(other.getLocation());
}
if (comparison == 0) {
comparison = this.getUuid(... | Understands runtime and configuration information of a builder machine | compareTo | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public void syncAgentFrom(Agent agent) {
this.agent = agent;
if (agent.isElastic()) {
agentRuntimeInfo = ElasticAgentRuntimeInfo.fromServer(agentRuntimeInfo, agent.getElasticAgentId(), agent.getElasticPluginId());
}
if (agentRuntimeInfo.getRuntimeStatus() == AgentRuntimeSta... | Understands runtime and configuration information of a builder machine | syncAgentFrom | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
private void syncRuntimeStatus(AgentRuntimeStatus runtimeStatus) {
if (runtimeStatus == Idle) {
updateRuntimeStatus(Idle);
agentRuntimeInfo.clearBuildingInfo();
clearCancelledState();
} else if (!(agentRuntimeInfo.isCancelled())) {
updateRuntimeStatus(runt... | Understands runtime and configuration information of a builder machine | syncRuntimeStatus | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public void building(AgentBuildingInfo agentBuildingInfo) {
syncRuntimeStatus(Building);
agentRuntimeInfo.busy(agentBuildingInfo);
} | Understands runtime and configuration information of a builder machine | building | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
@TestOnly
public void idle() {
agentConfigStatus = Enabled;
syncRuntimeStatus(Idle);
agentRuntimeInfo.clearBuildingInfo();
} | Understands runtime and configuration information of a builder machine | idle | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public void pending() {
agentConfigStatus = Pending;
agentRuntimeInfo.clearBuildingInfo();
} | Understands runtime and configuration information of a builder machine | pending | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public void enable() {
updateConfigStatus(Enabled);
agentRuntimeInfo.clearBuildingInfo();
} | Understands runtime and configuration information of a builder machine | enable | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public void cancel() {
updateRuntimeStatus(AgentRuntimeStatus.Cancelled);
cancelledAt = timeProvider.currentUtilDate();
} | Understands runtime and configuration information of a builder machine | cancel | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public void killRunningTasks() throws InvalidAgentInstructionException {
if (!isCancelled()) {
throw new InvalidAgentInstructionException(format("The agent should be in cancelled state before attempting " +
"to kill running tasks. Current Agent state is: '%s'", agentRuntimeInfo.getRu... | Understands runtime and configuration information of a builder machine | killRunningTasks | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public void deny() {
if (!canDisable()) {
throw new RuntimeException("Should not deny agent when is building.");
}
getAgent().disable();
updateConfigStatus(Disabled);
} | Understands runtime and configuration information of a builder machine | deny | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public AgentStatus getStatus() {
return agentConfigStatus == Enabled
? fromRuntime(agentRuntimeInfo.getRuntimeStatus())
: fromConfig(agentConfigStatus);
} | Understands runtime and configuration information of a builder machine | getStatus | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public AgentConfigStatus getAgentConfigStatus() {
return agentConfigStatus;
} | Understands runtime and configuration information of a builder machine | getAgentConfigStatus | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public AgentBuildingInfo getBuildingInfo() {
return agentRuntimeInfo.getBuildingInfo();
} | Understands runtime and configuration information of a builder machine | getBuildingInfo | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
public Agent getAgent() {
return agent;
} | Understands runtime and configuration information of a builder machine | getAgent | java | gocd/gocd | common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | https://github.com/gocd/gocd/blob/master/common/src/main/java/com/thoughtworks/go/domain/AgentInstance.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.