id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
156,200
|
tempodb/tempodb-java
|
src/main/java/com/tempodb/Client.java
|
Client.deleteAllSeries
|
public Result<DeleteSummary> deleteAllSeries() {
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/", API_VERSION));
builder.addParameter("allow_truncation", "true");
uri = builder.build();
} catch (URISyntaxException e) {
String message = "Could not build URI";
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString(), HttpMethod.DELETE);
Result<DeleteSummary> result = execute(request, DeleteSummary.class);
return result;
}
|
java
|
public Result<DeleteSummary> deleteAllSeries() {
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/", API_VERSION));
builder.addParameter("allow_truncation", "true");
uri = builder.build();
} catch (URISyntaxException e) {
String message = "Could not build URI";
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString(), HttpMethod.DELETE);
Result<DeleteSummary> result = execute(request, DeleteSummary.class);
return result;
}
|
[
"public",
"Result",
"<",
"DeleteSummary",
">",
"deleteAllSeries",
"(",
")",
"{",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/\"",
",",
"API_VERSION",
")",
")",
";",
"builder",
".",
"addParameter",
"(",
"\"allow_truncation\"",
",",
"\"true\"",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"\"Could not build URI\"",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"HttpRequest",
"request",
"=",
"buildRequest",
"(",
"uri",
".",
"toString",
"(",
")",
",",
"HttpMethod",
".",
"DELETE",
")",
";",
"Result",
"<",
"DeleteSummary",
">",
"result",
"=",
"execute",
"(",
"request",
",",
"DeleteSummary",
".",
"class",
")",
";",
"return",
"result",
";",
"}"
] |
Deletes all Series in a database.
@return A DeleteSummary providing information about the series deleted.
@see DeleteSummary
@since 1.0.0
|
[
"Deletes",
"all",
"Series",
"in",
"a",
"database",
"."
] |
5733f204fe4c8dda48916ba1f67cf44f5a3f9c69
|
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L272-L286
|
156,201
|
tempodb/tempodb-java
|
src/main/java/com/tempodb/Client.java
|
Client.getSeries
|
public Result<Series> getSeries(String key) {
checkNotNull(key);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/", API_VERSION, urlencode(key)));
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s", key);
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Series> result = execute(request, Series.class);
return result;
}
|
java
|
public Result<Series> getSeries(String key) {
checkNotNull(key);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/", API_VERSION, urlencode(key)));
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s", key);
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Series> result = execute(request, Series.class);
return result;
}
|
[
"public",
"Result",
"<",
"Series",
">",
"getSeries",
"(",
"String",
"key",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"key",
")",
")",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s\"",
",",
"key",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"HttpRequest",
"request",
"=",
"buildRequest",
"(",
"uri",
".",
"toString",
"(",
")",
")",
";",
"Result",
"<",
"Series",
">",
"result",
"=",
"execute",
"(",
"request",
",",
"Series",
".",
"class",
")",
";",
"return",
"result",
";",
"}"
] |
Returns a Series referenced by key.
@param key The Series key to retrieve
@return The requested Series.
@since 1.0.0
|
[
"Returns",
"a",
"Series",
"referenced",
"by",
"key",
"."
] |
5733f204fe4c8dda48916ba1f67cf44f5a3f9c69
|
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L345-L360
|
156,202
|
tempodb/tempodb-java
|
src/main/java/com/tempodb/Client.java
|
Client.getSeries
|
public Cursor<Series> getSeries(Filter filter) {
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/", API_VERSION));
addFilterToURI(builder, filter);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with input - filter: %s", filter);
throw new IllegalArgumentException(message, e);
}
Cursor<Series> cursor = new SeriesCursor(uri, this);
return cursor;
}
|
java
|
public Cursor<Series> getSeries(Filter filter) {
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/", API_VERSION));
addFilterToURI(builder, filter);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with input - filter: %s", filter);
throw new IllegalArgumentException(message, e);
}
Cursor<Series> cursor = new SeriesCursor(uri, this);
return cursor;
}
|
[
"public",
"Cursor",
"<",
"Series",
">",
"getSeries",
"(",
"Filter",
"filter",
")",
"{",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/\"",
",",
"API_VERSION",
")",
")",
";",
"addFilterToURI",
"(",
"builder",
",",
"filter",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with input - filter: %s\"",
",",
"filter",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"Cursor",
"<",
"Series",
">",
"cursor",
"=",
"new",
"SeriesCursor",
"(",
"uri",
",",
"this",
")",
";",
"return",
"cursor",
";",
"}"
] |
Returns a cursor of series specified by a filter.
@param filter The series filter
@return A Cursor of Series. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@see Filter
@since 1.0.0
|
[
"Returns",
"a",
"cursor",
"of",
"series",
"specified",
"by",
"a",
"filter",
"."
] |
5733f204fe4c8dda48916ba1f67cf44f5a3f9c69
|
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L372-L385
|
156,203
|
tempodb/tempodb-java
|
src/main/java/com/tempodb/Client.java
|
Client.readSummary
|
public Result<Summary> readSummary(Series series, Interval interval) {
checkNotNull(series);
checkNotNull(interval);
DateTimeZone timezone = interval.getStart().getChronology().getZone();
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/summary/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, timezone: %s", series.getKey(), interval.toString(), timezone.toString());
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Summary> result = execute(request, Summary.class);
return result;
}
|
java
|
public Result<Summary> readSummary(Series series, Interval interval) {
checkNotNull(series);
checkNotNull(interval);
DateTimeZone timezone = interval.getStart().getChronology().getZone();
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/summary/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, timezone: %s", series.getKey(), interval.toString(), timezone.toString());
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Summary> result = execute(request, Summary.class);
return result;
}
|
[
"public",
"Result",
"<",
"Summary",
">",
"readSummary",
"(",
"Series",
"series",
",",
"Interval",
"interval",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"interval",
")",
";",
"DateTimeZone",
"timezone",
"=",
"interval",
".",
"getStart",
"(",
")",
".",
"getChronology",
"(",
")",
".",
"getZone",
"(",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/summary/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"series",
".",
"getKey",
"(",
")",
")",
")",
")",
";",
"addIntervalToURI",
"(",
"builder",
",",
"interval",
")",
";",
"addTimeZoneToURI",
"(",
"builder",
",",
"timezone",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s, interval: %s, timezone: %s\"",
",",
"series",
".",
"getKey",
"(",
")",
",",
"interval",
".",
"toString",
"(",
")",
",",
"timezone",
".",
"toString",
"(",
")",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"HttpRequest",
"request",
"=",
"buildRequest",
"(",
"uri",
".",
"toString",
"(",
")",
")",
";",
"Result",
"<",
"Summary",
">",
"result",
"=",
"execute",
"(",
"request",
",",
"Summary",
".",
"class",
")",
";",
"return",
"result",
";",
"}"
] |
Reads summary statistics for a series for the specified interval.
@param series The series to read from
@param interval The interval of data to summarize
@return A set of statistics for an interval of data
@see SingleValue
@since 1.1.0
|
[
"Reads",
"summary",
"statistics",
"for",
"a",
"series",
"for",
"the",
"specified",
"interval",
"."
] |
5733f204fe4c8dda48916ba1f67cf44f5a3f9c69
|
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L575-L594
|
156,204
|
tempodb/tempodb-java
|
src/main/java/com/tempodb/Client.java
|
Client.readDataPoints
|
public Cursor<DataPoint> readDataPoints(Series series, Interval interval, DateTimeZone timezone, Rollup rollup, Interpolation interpolation) {
checkNotNull(series);
checkNotNull(interval);
checkNotNull(timezone);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/segment/", API_VERSION, urlencode(series.getKey())));
addInterpolationToURI(builder, interpolation);
addIntervalToURI(builder, interval);
addRollupToURI(builder, rollup);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s", series.getKey(), interval, rollup, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<DataPoint> cursor = new DataPointCursor(uri, this);
return cursor;
}
|
java
|
public Cursor<DataPoint> readDataPoints(Series series, Interval interval, DateTimeZone timezone, Rollup rollup, Interpolation interpolation) {
checkNotNull(series);
checkNotNull(interval);
checkNotNull(timezone);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/segment/", API_VERSION, urlencode(series.getKey())));
addInterpolationToURI(builder, interpolation);
addIntervalToURI(builder, interval);
addRollupToURI(builder, rollup);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s", series.getKey(), interval, rollup, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<DataPoint> cursor = new DataPointCursor(uri, this);
return cursor;
}
|
[
"public",
"Cursor",
"<",
"DataPoint",
">",
"readDataPoints",
"(",
"Series",
"series",
",",
"Interval",
"interval",
",",
"DateTimeZone",
"timezone",
",",
"Rollup",
"rollup",
",",
"Interpolation",
"interpolation",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"interval",
")",
";",
"checkNotNull",
"(",
"timezone",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/segment/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"series",
".",
"getKey",
"(",
")",
")",
")",
")",
";",
"addInterpolationToURI",
"(",
"builder",
",",
"interpolation",
")",
";",
"addIntervalToURI",
"(",
"builder",
",",
"interval",
")",
";",
"addRollupToURI",
"(",
"builder",
",",
"rollup",
")",
";",
"addTimeZoneToURI",
"(",
"builder",
",",
"timezone",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s\"",
",",
"series",
".",
"getKey",
"(",
")",
",",
"interval",
",",
"rollup",
",",
"timezone",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"Cursor",
"<",
"DataPoint",
">",
"cursor",
"=",
"new",
"DataPointCursor",
"(",
"uri",
",",
"this",
")",
";",
"return",
"cursor",
";",
"}"
] |
Returns a cursor of datapoints specified by series.
@param series The series
@param interval An interval of time for the query (start/end datetimes)
@param timezone The time zone for the returned datapoints.
@param rollup The rollup for the read query. This can be null.
@param interpolation The interpolation for the read query. This can be null.
@return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@since 1.0.0
|
[
"Returns",
"a",
"cursor",
"of",
"datapoints",
"specified",
"by",
"series",
"."
] |
5733f204fe4c8dda48916ba1f67cf44f5a3f9c69
|
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L655-L675
|
156,205
|
tempodb/tempodb-java
|
src/main/java/com/tempodb/Client.java
|
Client.readMultiRollupDataPoints
|
public Cursor<MultiDataPoint> readMultiRollupDataPoints(Series series, Interval interval, DateTimeZone timezone, MultiRollup rollup, Interpolation interpolation) {
checkNotNull(series);
checkNotNull(interval);
checkNotNull(timezone);
checkNotNull(rollup);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/rollups/segment/", API_VERSION, urlencode(series.getKey())));
addInterpolationToURI(builder, interpolation);
addIntervalToURI(builder, interval);
addMultiRollupToURI(builder, rollup);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s", series.getKey(), interval, rollup, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<MultiDataPoint> cursor = new MultiRollupDataPointCursor(uri, this);
return cursor;
}
|
java
|
public Cursor<MultiDataPoint> readMultiRollupDataPoints(Series series, Interval interval, DateTimeZone timezone, MultiRollup rollup, Interpolation interpolation) {
checkNotNull(series);
checkNotNull(interval);
checkNotNull(timezone);
checkNotNull(rollup);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/rollups/segment/", API_VERSION, urlencode(series.getKey())));
addInterpolationToURI(builder, interpolation);
addIntervalToURI(builder, interval);
addMultiRollupToURI(builder, rollup);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s", series.getKey(), interval, rollup, timezone);
throw new IllegalArgumentException(message, e);
}
Cursor<MultiDataPoint> cursor = new MultiRollupDataPointCursor(uri, this);
return cursor;
}
|
[
"public",
"Cursor",
"<",
"MultiDataPoint",
">",
"readMultiRollupDataPoints",
"(",
"Series",
"series",
",",
"Interval",
"interval",
",",
"DateTimeZone",
"timezone",
",",
"MultiRollup",
"rollup",
",",
"Interpolation",
"interpolation",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"interval",
")",
";",
"checkNotNull",
"(",
"timezone",
")",
";",
"checkNotNull",
"(",
"rollup",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/data/rollups/segment/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"series",
".",
"getKey",
"(",
")",
")",
")",
")",
";",
"addInterpolationToURI",
"(",
"builder",
",",
"interpolation",
")",
";",
"addIntervalToURI",
"(",
"builder",
",",
"interval",
")",
";",
"addMultiRollupToURI",
"(",
"builder",
",",
"rollup",
")",
";",
"addTimeZoneToURI",
"(",
"builder",
",",
"timezone",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s, interval: %s, rollup: %s, timezone: %s\"",
",",
"series",
".",
"getKey",
"(",
")",
",",
"interval",
",",
"rollup",
",",
"timezone",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"Cursor",
"<",
"MultiDataPoint",
">",
"cursor",
"=",
"new",
"MultiRollupDataPointCursor",
"(",
"uri",
",",
"this",
")",
";",
"return",
"cursor",
";",
"}"
] |
Returns a cursor of datapoints specified by series with multiple rollups.
@param series The series
@param interval An interval of time for the query (start/end datetimes)
@param timezone The time zone for the returned datapoints.
@param rollup The MultiRollup for the read query.
@param interpolation The interpolation for the read query. This can be null.
@return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@see MultiRollup
@since 1.0.0
|
[
"Returns",
"a",
"cursor",
"of",
"datapoints",
"specified",
"by",
"series",
"with",
"multiple",
"rollups",
"."
] |
5733f204fe4c8dda48916ba1f67cf44f5a3f9c69
|
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L725-L746
|
156,206
|
tempodb/tempodb-java
|
src/main/java/com/tempodb/Client.java
|
Client.writeDataPoints
|
public Result<Void> writeDataPoints(Series series, List<DataPoint> data) {
checkNotNull(series);
checkNotNull(data);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/", API_VERSION, urlencode(series.getKey())));
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s", series.getKey());
throw new IllegalArgumentException(message, e);
}
Result<Void> result = null;
String body = null;
try{
body = Json.dumps(data);
} catch (JsonProcessingException e) {
String message = "Error serializing the body of the request. More detail: " + e.getMessage();
result = new Result<Void>(null, GENERIC_ERROR_CODE, message);
return result;
}
HttpRequest request = buildRequest(uri.toString(), HttpMethod.POST, body);
result = execute(request, Void.class);
return result;
}
|
java
|
public Result<Void> writeDataPoints(Series series, List<DataPoint> data) {
checkNotNull(series);
checkNotNull(data);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/", API_VERSION, urlencode(series.getKey())));
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s", series.getKey());
throw new IllegalArgumentException(message, e);
}
Result<Void> result = null;
String body = null;
try{
body = Json.dumps(data);
} catch (JsonProcessingException e) {
String message = "Error serializing the body of the request. More detail: " + e.getMessage();
result = new Result<Void>(null, GENERIC_ERROR_CODE, message);
return result;
}
HttpRequest request = buildRequest(uri.toString(), HttpMethod.POST, body);
result = execute(request, Void.class);
return result;
}
|
[
"public",
"Result",
"<",
"Void",
">",
"writeDataPoints",
"(",
"Series",
"series",
",",
"List",
"<",
"DataPoint",
">",
"data",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"data",
")",
";",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/key/%s/data/\"",
",",
"API_VERSION",
",",
"urlencode",
"(",
"series",
".",
"getKey",
"(",
")",
")",
")",
")",
";",
"uri",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Could not build URI with inputs: key: %s\"",
",",
"series",
".",
"getKey",
"(",
")",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
",",
"e",
")",
";",
"}",
"Result",
"<",
"Void",
">",
"result",
"=",
"null",
";",
"String",
"body",
"=",
"null",
";",
"try",
"{",
"body",
"=",
"Json",
".",
"dumps",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
")",
"{",
"String",
"message",
"=",
"\"Error serializing the body of the request. More detail: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"result",
"=",
"new",
"Result",
"<",
"Void",
">",
"(",
"null",
",",
"GENERIC_ERROR_CODE",
",",
"message",
")",
";",
"return",
"result",
";",
"}",
"HttpRequest",
"request",
"=",
"buildRequest",
"(",
"uri",
".",
"toString",
"(",
")",
",",
"HttpMethod",
".",
"POST",
",",
"body",
")",
";",
"result",
"=",
"execute",
"(",
"request",
",",
"Void",
".",
"class",
")",
";",
"return",
"result",
";",
"}"
] |
Writes datapoints to single Series.
@param series The series to write to.
@param data A list of datapoints
@return {@link Void}
@see DataPoint
@see Void
@since 1.0.0
|
[
"Writes",
"datapoints",
"to",
"single",
"Series",
"."
] |
5733f204fe4c8dda48916ba1f67cf44f5a3f9c69
|
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L1002-L1028
|
156,207
|
eiichiro/jaguar
|
jaguar-core/src/main/java/org/eiichiro/jaguar/WebFilter.java
|
WebFilter.doFilter
|
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = WebFilter.request.get();
try {
WebFilter.request.set((HttpServletRequest) request);
chain.doFilter(request, response);
} finally {
WebFilter.request.set(httpServletRequest);
}
}
|
java
|
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = WebFilter.request.get();
try {
WebFilter.request.set((HttpServletRequest) request);
chain.doFilter(request, response);
} finally {
WebFilter.request.set(httpServletRequest);
}
}
|
[
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"HttpServletRequest",
"httpServletRequest",
"=",
"WebFilter",
".",
"request",
".",
"get",
"(",
")",
";",
"try",
"{",
"WebFilter",
".",
"request",
".",
"set",
"(",
"(",
"HttpServletRequest",
")",
"request",
")",
";",
"chain",
".",
"doFilter",
"(",
"request",
",",
"response",
")",
";",
"}",
"finally",
"{",
"WebFilter",
".",
"request",
".",
"set",
"(",
"httpServletRequest",
")",
";",
"}",
"}"
] |
Associates the current HTTP servlet request with the current thread until
filter chain ends.
@param request The current {@code ServletRequest}.
@param response The current {@code ServletResponse}.
@param chain The current {@code FilterChain}.
|
[
"Associates",
"the",
"current",
"HTTP",
"servlet",
"request",
"with",
"the",
"current",
"thread",
"until",
"filter",
"chain",
"ends",
"."
] |
9da0b8677fa306f10f848402490c75d05c213547
|
https://github.com/eiichiro/jaguar/blob/9da0b8677fa306f10f848402490c75d05c213547/jaguar-core/src/main/java/org/eiichiro/jaguar/WebFilter.java#L65-L75
|
156,208
|
eiichiro/jaguar
|
jaguar-core/src/main/java/org/eiichiro/jaguar/WebFilter.java
|
WebFilter.session
|
public static HttpSession session() {
HttpServletRequest httpServletRequest = request.get();
return (httpServletRequest == null) ? null : httpServletRequest.getSession();
}
|
java
|
public static HttpSession session() {
HttpServletRequest httpServletRequest = request.get();
return (httpServletRequest == null) ? null : httpServletRequest.getSession();
}
|
[
"public",
"static",
"HttpSession",
"session",
"(",
")",
"{",
"HttpServletRequest",
"httpServletRequest",
"=",
"request",
".",
"get",
"(",
")",
";",
"return",
"(",
"httpServletRequest",
"==",
"null",
")",
"?",
"null",
":",
"httpServletRequest",
".",
"getSession",
"(",
")",
";",
"}"
] |
Returns the HTTP session associated with the current thread.
@return The HTTP session associated with the current thread.
|
[
"Returns",
"the",
"HTTP",
"session",
"associated",
"with",
"the",
"current",
"thread",
"."
] |
9da0b8677fa306f10f848402490c75d05c213547
|
https://github.com/eiichiro/jaguar/blob/9da0b8677fa306f10f848402490c75d05c213547/jaguar-core/src/main/java/org/eiichiro/jaguar/WebFilter.java#L104-L107
|
156,209
|
trellis-ldp-archive/trellis-http
|
src/main/java/org/trellisldp/http/impl/RdfUtils.java
|
RdfUtils.filterWithPrefer
|
public static Predicate<Quad> filterWithPrefer(final Prefer prefer) {
final Set<String> include = new HashSet<>(DEFAULT_REPRESENTATION);
ofNullable(prefer).ifPresent(p -> {
p.getOmit().forEach(include::remove);
p.getInclude().forEach(include::add);
});
return quad -> quad.getGraphName().filter(x -> x instanceof IRI).map(x -> (IRI) x)
.map(IRI::getIRIString).filter(include::contains).isPresent();
}
|
java
|
public static Predicate<Quad> filterWithPrefer(final Prefer prefer) {
final Set<String> include = new HashSet<>(DEFAULT_REPRESENTATION);
ofNullable(prefer).ifPresent(p -> {
p.getOmit().forEach(include::remove);
p.getInclude().forEach(include::add);
});
return quad -> quad.getGraphName().filter(x -> x instanceof IRI).map(x -> (IRI) x)
.map(IRI::getIRIString).filter(include::contains).isPresent();
}
|
[
"public",
"static",
"Predicate",
"<",
"Quad",
">",
"filterWithPrefer",
"(",
"final",
"Prefer",
"prefer",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"include",
"=",
"new",
"HashSet",
"<>",
"(",
"DEFAULT_REPRESENTATION",
")",
";",
"ofNullable",
"(",
"prefer",
")",
".",
"ifPresent",
"(",
"p",
"->",
"{",
"p",
".",
"getOmit",
"(",
")",
".",
"forEach",
"(",
"include",
"::",
"remove",
")",
";",
"p",
".",
"getInclude",
"(",
")",
".",
"forEach",
"(",
"include",
"::",
"add",
")",
";",
"}",
")",
";",
"return",
"quad",
"->",
"quad",
".",
"getGraphName",
"(",
")",
".",
"filter",
"(",
"x",
"->",
"x",
"instanceof",
"IRI",
")",
".",
"map",
"(",
"x",
"->",
"(",
"IRI",
")",
"x",
")",
".",
"map",
"(",
"IRI",
"::",
"getIRIString",
")",
".",
"filter",
"(",
"include",
"::",
"contains",
")",
".",
"isPresent",
"(",
")",
";",
"}"
] |
Create a filter based on a Prefer header
@param prefer the Prefer header
@return a suitable predicate for filtering a stream of quads
|
[
"Create",
"a",
"filter",
"based",
"on",
"a",
"Prefer",
"header"
] |
bc762f88602c49c2b137a7adf68d576666e55fff
|
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L102-L110
|
156,210
|
trellis-ldp-archive/trellis-http
|
src/main/java/org/trellisldp/http/impl/RdfUtils.java
|
RdfUtils.unskolemizeQuads
|
public static Function<Quad, Quad> unskolemizeQuads(final ResourceService svc, final String baseUrl) {
return quad -> rdf.createQuad(quad.getGraphName().orElse(PreferUserManaged),
(BlankNodeOrIRI) svc.toExternal(svc.unskolemize(quad.getSubject()), baseUrl),
quad.getPredicate(), svc.toExternal(svc.unskolemize(quad.getObject()), baseUrl));
}
|
java
|
public static Function<Quad, Quad> unskolemizeQuads(final ResourceService svc, final String baseUrl) {
return quad -> rdf.createQuad(quad.getGraphName().orElse(PreferUserManaged),
(BlankNodeOrIRI) svc.toExternal(svc.unskolemize(quad.getSubject()), baseUrl),
quad.getPredicate(), svc.toExternal(svc.unskolemize(quad.getObject()), baseUrl));
}
|
[
"public",
"static",
"Function",
"<",
"Quad",
",",
"Quad",
">",
"unskolemizeQuads",
"(",
"final",
"ResourceService",
"svc",
",",
"final",
"String",
"baseUrl",
")",
"{",
"return",
"quad",
"->",
"rdf",
".",
"createQuad",
"(",
"quad",
".",
"getGraphName",
"(",
")",
".",
"orElse",
"(",
"PreferUserManaged",
")",
",",
"(",
"BlankNodeOrIRI",
")",
"svc",
".",
"toExternal",
"(",
"svc",
".",
"unskolemize",
"(",
"quad",
".",
"getSubject",
"(",
")",
")",
",",
"baseUrl",
")",
",",
"quad",
".",
"getPredicate",
"(",
")",
",",
"svc",
".",
"toExternal",
"(",
"svc",
".",
"unskolemize",
"(",
"quad",
".",
"getObject",
"(",
")",
")",
",",
"baseUrl",
")",
")",
";",
"}"
] |
Convert quads from a skolemized form to an external form
@param svc the resource service
@param baseUrl the base URL
@return a mapping function
|
[
"Convert",
"quads",
"from",
"a",
"skolemized",
"form",
"to",
"an",
"external",
"form"
] |
bc762f88602c49c2b137a7adf68d576666e55fff
|
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L159-L163
|
156,211
|
trellis-ldp-archive/trellis-http
|
src/main/java/org/trellisldp/http/impl/RdfUtils.java
|
RdfUtils.skolemizeQuads
|
public static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl) {
return quad -> rdf.createQuad(quad.getGraphName().orElse(PreferUserManaged),
(BlankNodeOrIRI) svc.toInternal(svc.skolemize(quad.getSubject()), baseUrl), quad.getPredicate(),
svc.toInternal(svc.skolemize(quad.getObject()), baseUrl));
}
|
java
|
public static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl) {
return quad -> rdf.createQuad(quad.getGraphName().orElse(PreferUserManaged),
(BlankNodeOrIRI) svc.toInternal(svc.skolemize(quad.getSubject()), baseUrl), quad.getPredicate(),
svc.toInternal(svc.skolemize(quad.getObject()), baseUrl));
}
|
[
"public",
"static",
"Function",
"<",
"Quad",
",",
"Quad",
">",
"skolemizeQuads",
"(",
"final",
"ResourceService",
"svc",
",",
"final",
"String",
"baseUrl",
")",
"{",
"return",
"quad",
"->",
"rdf",
".",
"createQuad",
"(",
"quad",
".",
"getGraphName",
"(",
")",
".",
"orElse",
"(",
"PreferUserManaged",
")",
",",
"(",
"BlankNodeOrIRI",
")",
"svc",
".",
"toInternal",
"(",
"svc",
".",
"skolemize",
"(",
"quad",
".",
"getSubject",
"(",
")",
")",
",",
"baseUrl",
")",
",",
"quad",
".",
"getPredicate",
"(",
")",
",",
"svc",
".",
"toInternal",
"(",
"svc",
".",
"skolemize",
"(",
"quad",
".",
"getObject",
"(",
")",
")",
",",
"baseUrl",
")",
")",
";",
"}"
] |
Convert quads from an external form to a skolemized form
@param svc the resource service
@param baseUrl the base URL
@return a mapping function
|
[
"Convert",
"quads",
"from",
"an",
"external",
"form",
"to",
"a",
"skolemized",
"form"
] |
bc762f88602c49c2b137a7adf68d576666e55fff
|
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L171-L175
|
156,212
|
trellis-ldp-archive/trellis-http
|
src/main/java/org/trellisldp/http/impl/RdfUtils.java
|
RdfUtils.getProfile
|
public static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax) {
for (final MediaType type : acceptableTypes) {
if (RDFSyntax.byMediaType(type.toString()).filter(syntax::equals).isPresent() &&
type.getParameters().containsKey("profile")) {
return rdf.createIRI(type.getParameters().get("profile").split(" ")[0].trim());
}
}
return null;
}
|
java
|
public static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax) {
for (final MediaType type : acceptableTypes) {
if (RDFSyntax.byMediaType(type.toString()).filter(syntax::equals).isPresent() &&
type.getParameters().containsKey("profile")) {
return rdf.createIRI(type.getParameters().get("profile").split(" ")[0].trim());
}
}
return null;
}
|
[
"public",
"static",
"IRI",
"getProfile",
"(",
"final",
"List",
"<",
"MediaType",
">",
"acceptableTypes",
",",
"final",
"RDFSyntax",
"syntax",
")",
"{",
"for",
"(",
"final",
"MediaType",
"type",
":",
"acceptableTypes",
")",
"{",
"if",
"(",
"RDFSyntax",
".",
"byMediaType",
"(",
"type",
".",
"toString",
"(",
")",
")",
".",
"filter",
"(",
"syntax",
"::",
"equals",
")",
".",
"isPresent",
"(",
")",
"&&",
"type",
".",
"getParameters",
"(",
")",
".",
"containsKey",
"(",
"\"profile\"",
")",
")",
"{",
"return",
"rdf",
".",
"createIRI",
"(",
"type",
".",
"getParameters",
"(",
")",
".",
"get",
"(",
"\"profile\"",
")",
".",
"split",
"(",
"\" \"",
")",
"[",
"0",
"]",
".",
"trim",
"(",
")",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Given a list of acceptable media types and an RDF syntax, get the relevant profile data, if
relevant
@param acceptableTypes the types from HTTP headers
@param syntax an RDF syntax
@return a profile IRI if relevant
|
[
"Given",
"a",
"list",
"of",
"acceptable",
"media",
"types",
"and",
"an",
"RDF",
"syntax",
"get",
"the",
"relevant",
"profile",
"data",
"if",
"relevant"
] |
bc762f88602c49c2b137a7adf68d576666e55fff
|
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L214-L222
|
156,213
|
trellis-ldp-archive/trellis-http
|
src/main/java/org/trellisldp/http/impl/RdfUtils.java
|
RdfUtils.isDeleted
|
public static Boolean isDeleted(final Resource res) {
return LDP.Resource.equals(res.getInteractionModel()) && res.getTypes().contains(DeletedResource);
}
|
java
|
public static Boolean isDeleted(final Resource res) {
return LDP.Resource.equals(res.getInteractionModel()) && res.getTypes().contains(DeletedResource);
}
|
[
"public",
"static",
"Boolean",
"isDeleted",
"(",
"final",
"Resource",
"res",
")",
"{",
"return",
"LDP",
".",
"Resource",
".",
"equals",
"(",
"res",
".",
"getInteractionModel",
"(",
")",
")",
"&&",
"res",
".",
"getTypes",
"(",
")",
".",
"contains",
"(",
"DeletedResource",
")",
";",
"}"
] |
Check if the resource has a deleted mark
@param res the resource
@return true if the resource has been deleted; false otherwise
|
[
"Check",
"if",
"the",
"resource",
"has",
"a",
"deleted",
"mark"
] |
bc762f88602c49c2b137a7adf68d576666e55fff
|
https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L239-L241
|
156,214
|
guicamest/bsoneer
|
compiler/codeprovider/src/main/java/com/sleepcamel/bsoneer/processor/codeprovider/NameGenerator.java
|
NameGenerator.unqualifiedClassName
|
@SuppressWarnings("rawtypes")
public static String unqualifiedClassName(Class type) {
if (type.isArray()) {
return unqualifiedClassName(type.getComponentType()) + "Array";
}
String name = type.getName();
return name.substring(name.lastIndexOf('.') + 1);
}
|
java
|
@SuppressWarnings("rawtypes")
public static String unqualifiedClassName(Class type) {
if (type.isArray()) {
return unqualifiedClassName(type.getComponentType()) + "Array";
}
String name = type.getName();
return name.substring(name.lastIndexOf('.') + 1);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"String",
"unqualifiedClassName",
"(",
"Class",
"type",
")",
"{",
"if",
"(",
"type",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"unqualifiedClassName",
"(",
"type",
".",
"getComponentType",
"(",
")",
")",
"+",
"\"Array\"",
";",
"}",
"String",
"name",
"=",
"type",
".",
"getName",
"(",
")",
";",
"return",
"name",
".",
"substring",
"(",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"}"
] |
Returns the root name of the class.
|
[
"Returns",
"the",
"root",
"name",
"of",
"the",
"class",
"."
] |
170a4a5d99519c49ee01a38bb1562a42375f686d
|
https://github.com/guicamest/bsoneer/blob/170a4a5d99519c49ee01a38bb1562a42375f686d/compiler/codeprovider/src/main/java/com/sleepcamel/bsoneer/processor/codeprovider/NameGenerator.java#L56-L63
|
156,215
|
guicamest/bsoneer
|
compiler/codeprovider/src/main/java/com/sleepcamel/bsoneer/processor/codeprovider/NameGenerator.java
|
NameGenerator.capitalize
|
public static String capitalize(String name) {
if (name == null || name.length() == 0) {
return name;
}
return name.substring(0, 1).toUpperCase(ENGLISH) + name.substring(1);
}
|
java
|
public static String capitalize(String name) {
if (name == null || name.length() == 0) {
return name;
}
return name.substring(0, 1).toUpperCase(ENGLISH) + name.substring(1);
}
|
[
"public",
"static",
"String",
"capitalize",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"name",
";",
"}",
"return",
"name",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
"ENGLISH",
")",
"+",
"name",
".",
"substring",
"(",
"1",
")",
";",
"}"
] |
Returns a String which capitalizes the first letter of the string.
|
[
"Returns",
"a",
"String",
"which",
"capitalizes",
"the",
"first",
"letter",
"of",
"the",
"string",
"."
] |
170a4a5d99519c49ee01a38bb1562a42375f686d
|
https://github.com/guicamest/bsoneer/blob/170a4a5d99519c49ee01a38bb1562a42375f686d/compiler/codeprovider/src/main/java/com/sleepcamel/bsoneer/processor/codeprovider/NameGenerator.java#L79-L84
|
156,216
|
pressgang-ccms/PressGangCCMSZanataInterface
|
src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java
|
ZanataInterface.getZanataResource
|
public Resource getZanataResource(final String id) throws NotModifiedException {
ClientResponse<Resource> response = null;
try {
final ISourceDocResource client = proxyFactory.getSourceDocResource(details.getProject(), details.getVersion());
response = client.getResource(id, null);
final Status status = Response.Status.fromStatusCode(response.getStatus());
if (status == Response.Status.OK) {
final Resource entity = response.getEntity();
return entity;
} else if (status == Status.NOT_MODIFIED) {
throw new NotModifiedException();
}
} catch (final Exception ex) {
if (ex instanceof NotModifiedException) {
throw (NotModifiedException) ex;
} else {
log.error("Failed to retrieve the Zanata Source Document", ex);
}
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return null;
}
|
java
|
public Resource getZanataResource(final String id) throws NotModifiedException {
ClientResponse<Resource> response = null;
try {
final ISourceDocResource client = proxyFactory.getSourceDocResource(details.getProject(), details.getVersion());
response = client.getResource(id, null);
final Status status = Response.Status.fromStatusCode(response.getStatus());
if (status == Response.Status.OK) {
final Resource entity = response.getEntity();
return entity;
} else if (status == Status.NOT_MODIFIED) {
throw new NotModifiedException();
}
} catch (final Exception ex) {
if (ex instanceof NotModifiedException) {
throw (NotModifiedException) ex;
} else {
log.error("Failed to retrieve the Zanata Source Document", ex);
}
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return null;
}
|
[
"public",
"Resource",
"getZanataResource",
"(",
"final",
"String",
"id",
")",
"throws",
"NotModifiedException",
"{",
"ClientResponse",
"<",
"Resource",
">",
"response",
"=",
"null",
";",
"try",
"{",
"final",
"ISourceDocResource",
"client",
"=",
"proxyFactory",
".",
"getSourceDocResource",
"(",
"details",
".",
"getProject",
"(",
")",
",",
"details",
".",
"getVersion",
"(",
")",
")",
";",
"response",
"=",
"client",
".",
"getResource",
"(",
"id",
",",
"null",
")",
";",
"final",
"Status",
"status",
"=",
"Response",
".",
"Status",
".",
"fromStatusCode",
"(",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"if",
"(",
"status",
"==",
"Response",
".",
"Status",
".",
"OK",
")",
"{",
"final",
"Resource",
"entity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"return",
"entity",
";",
"}",
"else",
"if",
"(",
"status",
"==",
"Status",
".",
"NOT_MODIFIED",
")",
"{",
"throw",
"new",
"NotModifiedException",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"Exception",
"ex",
")",
"{",
"if",
"(",
"ex",
"instanceof",
"NotModifiedException",
")",
"{",
"throw",
"(",
"NotModifiedException",
")",
"ex",
";",
"}",
"else",
"{",
"log",
".",
"error",
"(",
"\"Failed to retrieve the Zanata Source Document\"",
",",
"ex",
")",
";",
"}",
"}",
"finally",
"{",
"/*\n * If you are using RESTEasy client framework, and returning a Response from your service method, you will\n * explicitly need to release the connection.\n */",
"if",
"(",
"response",
"!=",
"null",
")",
"response",
".",
"releaseConnection",
"(",
")",
";",
"/* Perform a small wait to ensure zanata isn't overloaded */",
"performZanataRESTCallWaiting",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get a specific Source Document from Zanata.
@param id The ID of the Document in Zanata.
@return The Zanata Source Document that matches the id passed, or null if it doesn't exist.
|
[
"Get",
"a",
"specific",
"Source",
"Document",
"from",
"Zanata",
"."
] |
0fed2480fec2cca2c578d08724288ae8268ee4d9
|
https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L250-L282
|
156,217
|
pressgang-ccms/PressGangCCMSZanataInterface
|
src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java
|
ZanataInterface.getZanataResources
|
public List<ResourceMeta> getZanataResources() {
ClientResponse<List<ResourceMeta>> response = null;
try {
final ISourceDocResource client = proxyFactory.getSourceDocResource(details.getProject(), details.getVersion());
response = client.get(null);
final Status status = Response.Status.fromStatusCode(response.getStatus());
if (status == Response.Status.OK) {
final List<ResourceMeta> entities = response.getEntity();
return entities;
} else {
log.error(
"REST call to get() did not complete successfully. HTTP response code was " + status.getStatusCode() + ". Reason " +
"was " + status.getReasonPhrase());
}
} catch (final Exception ex) {
log.error("Failed to retrieve the list of Zanata Source Documents", ex);
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return null;
}
|
java
|
public List<ResourceMeta> getZanataResources() {
ClientResponse<List<ResourceMeta>> response = null;
try {
final ISourceDocResource client = proxyFactory.getSourceDocResource(details.getProject(), details.getVersion());
response = client.get(null);
final Status status = Response.Status.fromStatusCode(response.getStatus());
if (status == Response.Status.OK) {
final List<ResourceMeta> entities = response.getEntity();
return entities;
} else {
log.error(
"REST call to get() did not complete successfully. HTTP response code was " + status.getStatusCode() + ". Reason " +
"was " + status.getReasonPhrase());
}
} catch (final Exception ex) {
log.error("Failed to retrieve the list of Zanata Source Documents", ex);
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return null;
}
|
[
"public",
"List",
"<",
"ResourceMeta",
">",
"getZanataResources",
"(",
")",
"{",
"ClientResponse",
"<",
"List",
"<",
"ResourceMeta",
">>",
"response",
"=",
"null",
";",
"try",
"{",
"final",
"ISourceDocResource",
"client",
"=",
"proxyFactory",
".",
"getSourceDocResource",
"(",
"details",
".",
"getProject",
"(",
")",
",",
"details",
".",
"getVersion",
"(",
")",
")",
";",
"response",
"=",
"client",
".",
"get",
"(",
"null",
")",
";",
"final",
"Status",
"status",
"=",
"Response",
".",
"Status",
".",
"fromStatusCode",
"(",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"if",
"(",
"status",
"==",
"Response",
".",
"Status",
".",
"OK",
")",
"{",
"final",
"List",
"<",
"ResourceMeta",
">",
"entities",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"return",
"entities",
";",
"}",
"else",
"{",
"log",
".",
"error",
"(",
"\"REST call to get() did not complete successfully. HTTP response code was \"",
"+",
"status",
".",
"getStatusCode",
"(",
")",
"+",
"\". Reason \"",
"+",
"\"was \"",
"+",
"status",
".",
"getReasonPhrase",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"Exception",
"ex",
")",
"{",
"log",
".",
"error",
"(",
"\"Failed to retrieve the list of Zanata Source Documents\"",
",",
"ex",
")",
";",
"}",
"finally",
"{",
"/*\n * If you are using RESTEasy client framework, and returning a Response from your service method, you will\n * explicitly need to release the connection.\n */",
"if",
"(",
"response",
"!=",
"null",
")",
"response",
".",
"releaseConnection",
"(",
")",
";",
"/* Perform a small wait to ensure zanata isn't overloaded */",
"performZanataRESTCallWaiting",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get all of the Document ID's available from Zanata for the configured project.
@return A List of Resource Objects that contain information such as Document ID's.
|
[
"Get",
"all",
"of",
"the",
"Document",
"ID",
"s",
"available",
"from",
"Zanata",
"for",
"the",
"configured",
"project",
"."
] |
0fed2480fec2cca2c578d08724288ae8268ee4d9
|
https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L289-L319
|
156,218
|
pressgang-ccms/PressGangCCMSZanataInterface
|
src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java
|
ZanataInterface.createFile
|
public boolean createFile(final Resource resource, boolean copyTrans) throws UnauthorizedException {
ClientResponse<String> response = null;
try {
final ISourceDocResource client = proxyFactory.getSourceDocResource(details.getProject(), details.getVersion());
response = client.post(resource, null, false);
final Status status = Response.Status.fromStatusCode(response.getStatus());
if (status == Response.Status.CREATED) {
final String entity = response.getEntity();
if (entity.trim().length() != 0) log.info(entity);
// Run copytrans if requested
if (copyTrans) {
runCopyTrans(resource.getName(), true);
}
return true;
} else if (status == Status.UNAUTHORIZED) {
throw new UnauthorizedException();
} else {
log.error("REST call to createResource() did not complete successfully. HTTP response code was " + status.getStatusCode() +
". Reason was " + status.getReasonPhrase());
}
} catch (final Exception ex) {
log.error("Failed to create the Zanata Document", ex);
if (ex instanceof UnauthorizedException) {
throw (UnauthorizedException) ex;
}
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return false;
}
|
java
|
public boolean createFile(final Resource resource, boolean copyTrans) throws UnauthorizedException {
ClientResponse<String> response = null;
try {
final ISourceDocResource client = proxyFactory.getSourceDocResource(details.getProject(), details.getVersion());
response = client.post(resource, null, false);
final Status status = Response.Status.fromStatusCode(response.getStatus());
if (status == Response.Status.CREATED) {
final String entity = response.getEntity();
if (entity.trim().length() != 0) log.info(entity);
// Run copytrans if requested
if (copyTrans) {
runCopyTrans(resource.getName(), true);
}
return true;
} else if (status == Status.UNAUTHORIZED) {
throw new UnauthorizedException();
} else {
log.error("REST call to createResource() did not complete successfully. HTTP response code was " + status.getStatusCode() +
". Reason was " + status.getReasonPhrase());
}
} catch (final Exception ex) {
log.error("Failed to create the Zanata Document", ex);
if (ex instanceof UnauthorizedException) {
throw (UnauthorizedException) ex;
}
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return false;
}
|
[
"public",
"boolean",
"createFile",
"(",
"final",
"Resource",
"resource",
",",
"boolean",
"copyTrans",
")",
"throws",
"UnauthorizedException",
"{",
"ClientResponse",
"<",
"String",
">",
"response",
"=",
"null",
";",
"try",
"{",
"final",
"ISourceDocResource",
"client",
"=",
"proxyFactory",
".",
"getSourceDocResource",
"(",
"details",
".",
"getProject",
"(",
")",
",",
"details",
".",
"getVersion",
"(",
")",
")",
";",
"response",
"=",
"client",
".",
"post",
"(",
"resource",
",",
"null",
",",
"false",
")",
";",
"final",
"Status",
"status",
"=",
"Response",
".",
"Status",
".",
"fromStatusCode",
"(",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"if",
"(",
"status",
"==",
"Response",
".",
"Status",
".",
"CREATED",
")",
"{",
"final",
"String",
"entity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"if",
"(",
"entity",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"!=",
"0",
")",
"log",
".",
"info",
"(",
"entity",
")",
";",
"// Run copytrans if requested",
"if",
"(",
"copyTrans",
")",
"{",
"runCopyTrans",
"(",
"resource",
".",
"getName",
"(",
")",
",",
"true",
")",
";",
"}",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"status",
"==",
"Status",
".",
"UNAUTHORIZED",
")",
"{",
"throw",
"new",
"UnauthorizedException",
"(",
")",
";",
"}",
"else",
"{",
"log",
".",
"error",
"(",
"\"REST call to createResource() did not complete successfully. HTTP response code was \"",
"+",
"status",
".",
"getStatusCode",
"(",
")",
"+",
"\". Reason was \"",
"+",
"status",
".",
"getReasonPhrase",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"Exception",
"ex",
")",
"{",
"log",
".",
"error",
"(",
"\"Failed to create the Zanata Document\"",
",",
"ex",
")",
";",
"if",
"(",
"ex",
"instanceof",
"UnauthorizedException",
")",
"{",
"throw",
"(",
"UnauthorizedException",
")",
"ex",
";",
"}",
"}",
"finally",
"{",
"/*\n * If you are using RESTEasy client framework, and returning a Response from your service method, you will\n * explicitly need to release the connection.\n */",
"if",
"(",
"response",
"!=",
"null",
")",
"response",
".",
"releaseConnection",
"(",
")",
";",
"/* Perform a small wait to ensure zanata isn't overloaded */",
"performZanataRESTCallWaiting",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Create a Document in Zanata.
@param resource The resource data to be used by Zanata to create the Document.
@param copyTrans Run copytrans on the server
@return True if the document was successfully created, otherwise false.
|
[
"Create",
"a",
"Document",
"in",
"Zanata",
"."
] |
0fed2480fec2cca2c578d08724288ae8268ee4d9
|
https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L338-L380
|
156,219
|
pressgang-ccms/PressGangCCMSZanataInterface
|
src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java
|
ZanataInterface.getTranslations
|
public TranslationsResource getTranslations(final String id, final LocaleId locale) throws NotModifiedException {
ClientResponse<TranslationsResource> response = null;
try {
final ITranslatedDocResource client = proxyFactory.getTranslatedDocResource(details.getProject(), details.getVersion());
response = client.getTranslations(id, locale, null);
final Status status = Response.Status.fromStatusCode(response.getStatus());
/* Remove the locale if it is forbidden */
if (status == Response.Status.FORBIDDEN) {
localeManager.removeLocale(locale);
} else if (status == Status.NOT_MODIFIED) {
throw new NotModifiedException();
} else if (status == Response.Status.OK) {
final TranslationsResource retValue = response.getEntity();
return retValue;
}
} catch (final Exception ex) {
if (ex instanceof NotModifiedException) {
throw (NotModifiedException) ex;
} else {
log.error("Failed to retrieve the Zanata Translated Document", ex);
}
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return null;
}
|
java
|
public TranslationsResource getTranslations(final String id, final LocaleId locale) throws NotModifiedException {
ClientResponse<TranslationsResource> response = null;
try {
final ITranslatedDocResource client = proxyFactory.getTranslatedDocResource(details.getProject(), details.getVersion());
response = client.getTranslations(id, locale, null);
final Status status = Response.Status.fromStatusCode(response.getStatus());
/* Remove the locale if it is forbidden */
if (status == Response.Status.FORBIDDEN) {
localeManager.removeLocale(locale);
} else if (status == Status.NOT_MODIFIED) {
throw new NotModifiedException();
} else if (status == Response.Status.OK) {
final TranslationsResource retValue = response.getEntity();
return retValue;
}
} catch (final Exception ex) {
if (ex instanceof NotModifiedException) {
throw (NotModifiedException) ex;
} else {
log.error("Failed to retrieve the Zanata Translated Document", ex);
}
} finally {
/*
* If you are using RESTEasy client framework, and returning a Response from your service method, you will
* explicitly need to release the connection.
*/
if (response != null) response.releaseConnection();
/* Perform a small wait to ensure zanata isn't overloaded */
performZanataRESTCallWaiting();
}
return null;
}
|
[
"public",
"TranslationsResource",
"getTranslations",
"(",
"final",
"String",
"id",
",",
"final",
"LocaleId",
"locale",
")",
"throws",
"NotModifiedException",
"{",
"ClientResponse",
"<",
"TranslationsResource",
">",
"response",
"=",
"null",
";",
"try",
"{",
"final",
"ITranslatedDocResource",
"client",
"=",
"proxyFactory",
".",
"getTranslatedDocResource",
"(",
"details",
".",
"getProject",
"(",
")",
",",
"details",
".",
"getVersion",
"(",
")",
")",
";",
"response",
"=",
"client",
".",
"getTranslations",
"(",
"id",
",",
"locale",
",",
"null",
")",
";",
"final",
"Status",
"status",
"=",
"Response",
".",
"Status",
".",
"fromStatusCode",
"(",
"response",
".",
"getStatus",
"(",
")",
")",
";",
"/* Remove the locale if it is forbidden */",
"if",
"(",
"status",
"==",
"Response",
".",
"Status",
".",
"FORBIDDEN",
")",
"{",
"localeManager",
".",
"removeLocale",
"(",
"locale",
")",
";",
"}",
"else",
"if",
"(",
"status",
"==",
"Status",
".",
"NOT_MODIFIED",
")",
"{",
"throw",
"new",
"NotModifiedException",
"(",
")",
";",
"}",
"else",
"if",
"(",
"status",
"==",
"Response",
".",
"Status",
".",
"OK",
")",
"{",
"final",
"TranslationsResource",
"retValue",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"return",
"retValue",
";",
"}",
"}",
"catch",
"(",
"final",
"Exception",
"ex",
")",
"{",
"if",
"(",
"ex",
"instanceof",
"NotModifiedException",
")",
"{",
"throw",
"(",
"NotModifiedException",
")",
"ex",
";",
"}",
"else",
"{",
"log",
".",
"error",
"(",
"\"Failed to retrieve the Zanata Translated Document\"",
",",
"ex",
")",
";",
"}",
"}",
"finally",
"{",
"/*\n * If you are using RESTEasy client framework, and returning a Response from your service method, you will\n * explicitly need to release the connection.\n */",
"if",
"(",
"response",
"!=",
"null",
")",
"response",
".",
"releaseConnection",
"(",
")",
";",
"/* Perform a small wait to ensure zanata isn't overloaded */",
"performZanataRESTCallWaiting",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get a Translation from Zanata using the Zanata Document ID and Locale.
@param id The ID of the document in Zanata.
@param locale The locale of the translation to find.
@return null if the translation doesn't exist or an error occurred, otherwise the TranslationResource containing the
Translation Strings (TextFlowTargets).
@throws NotModifiedException Thrown if the translation has not been modified since it was last retrieved.
|
[
"Get",
"a",
"Translation",
"from",
"Zanata",
"using",
"the",
"Zanata",
"Document",
"ID",
"and",
"Locale",
"."
] |
0fed2480fec2cca2c578d08724288ae8268ee4d9
|
https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L391-L426
|
156,220
|
pressgang-ccms/PressGangCCMSZanataInterface
|
src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java
|
ZanataInterface.runCopyTrans
|
public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750);
}
}
return true;
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally {
performZanataRESTCallWaiting();
}
return false;
}
|
java
|
public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750);
}
}
return true;
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally {
performZanataRESTCallWaiting();
}
return false;
}
|
[
"public",
"boolean",
"runCopyTrans",
"(",
"final",
"String",
"zanataId",
",",
"boolean",
"waitForFinish",
")",
"{",
"log",
".",
"debug",
"(",
"\"Running Zanata CopyTrans for \"",
"+",
"zanataId",
")",
";",
"try",
"{",
"final",
"CopyTransResource",
"copyTransResource",
"=",
"proxyFactory",
".",
"getCopyTransResource",
"(",
")",
";",
"copyTransResource",
".",
"startCopyTrans",
"(",
"details",
".",
"getProject",
"(",
")",
",",
"details",
".",
"getVersion",
"(",
")",
",",
"zanataId",
")",
";",
"performZanataRESTCallWaiting",
"(",
")",
";",
"if",
"(",
"waitForFinish",
")",
"{",
"while",
"(",
"!",
"isCopyTransCompleteForSourceDocument",
"(",
"copyTransResource",
",",
"zanataId",
")",
")",
"{",
"// Sleep for 3/4 of a second",
"Thread",
".",
"sleep",
"(",
"750",
")",
";",
"}",
"}",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Failed to run copyTrans for \"",
"+",
"zanataId",
",",
"e",
")",
";",
"}",
"finally",
"{",
"performZanataRESTCallWaiting",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Run copy trans against a Source Document in zanata and then wait for it to complete
@param zanataId The id of the document to run copytrans for.
@param waitForFinish Wait for copytrans to finish running.
@return True if copytrans was run successfully, otherwise false.
|
[
"Run",
"copy",
"trans",
"against",
"a",
"Source",
"Document",
"in",
"zanata",
"and",
"then",
"wait",
"for",
"it",
"to",
"complete"
] |
0fed2480fec2cca2c578d08724288ae8268ee4d9
|
https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L512-L535
|
156,221
|
pressgang-ccms/PressGangCCMSZanataInterface
|
src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java
|
ZanataInterface.isCopyTransCompleteForSourceDocument
|
protected boolean isCopyTransCompleteForSourceDocument(final CopyTransResource copyTransResource, final String zanataId) {
final CopyTransStatus status = copyTransResource.getCopyTransStatus(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
return !status.isInProgress();
}
|
java
|
protected boolean isCopyTransCompleteForSourceDocument(final CopyTransResource copyTransResource, final String zanataId) {
final CopyTransStatus status = copyTransResource.getCopyTransStatus(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
return !status.isInProgress();
}
|
[
"protected",
"boolean",
"isCopyTransCompleteForSourceDocument",
"(",
"final",
"CopyTransResource",
"copyTransResource",
",",
"final",
"String",
"zanataId",
")",
"{",
"final",
"CopyTransStatus",
"status",
"=",
"copyTransResource",
".",
"getCopyTransStatus",
"(",
"details",
".",
"getProject",
"(",
")",
",",
"details",
".",
"getVersion",
"(",
")",
",",
"zanataId",
")",
";",
"performZanataRESTCallWaiting",
"(",
")",
";",
"return",
"!",
"status",
".",
"isInProgress",
"(",
")",
";",
"}"
] |
Check if copy trans has finished processing a source document.
@param zanataId The Source Document id.
@return True if the source document has finished processing otherwise false.
|
[
"Check",
"if",
"copy",
"trans",
"has",
"finished",
"processing",
"a",
"source",
"document",
"."
] |
0fed2480fec2cca2c578d08724288ae8268ee4d9
|
https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L543-L547
|
156,222
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/cache/Cache.java
|
Cache.delete
|
public Cache delete(Regex regex) {
logger.debug("deleting all files named according to /{}/", regex);
storage.delete(regex);
return this;
}
|
java
|
public Cache delete(Regex regex) {
logger.debug("deleting all files named according to /{}/", regex);
storage.delete(regex);
return this;
}
|
[
"public",
"Cache",
"delete",
"(",
"Regex",
"regex",
")",
"{",
"logger",
".",
"debug",
"(",
"\"deleting all files named according to /{}/\"",
",",
"regex",
")",
";",
"storage",
".",
"delete",
"(",
"regex",
")",
";",
"return",
"this",
";",
"}"
] |
Deletes all resources that match the given resource name criteria.
@param regex
the resource name pattern.
@return
the cache itself, for method chaining.
|
[
"Deletes",
"all",
"resources",
"that",
"match",
"the",
"given",
"resource",
"name",
"criteria",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/Cache.java#L98-L102
|
156,223
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/cache/Cache.java
|
Cache.delete
|
public Cache delete(String resource, boolean caseInsensitive) {
logger.debug("deleting all files named according to '{}' (case insensitive)", resource);
storage.delete(resource, caseInsensitive);
return this;
}
|
java
|
public Cache delete(String resource, boolean caseInsensitive) {
logger.debug("deleting all files named according to '{}' (case insensitive)", resource);
storage.delete(resource, caseInsensitive);
return this;
}
|
[
"public",
"Cache",
"delete",
"(",
"String",
"resource",
",",
"boolean",
"caseInsensitive",
")",
"{",
"logger",
".",
"debug",
"(",
"\"deleting all files named according to '{}' (case insensitive)\"",
",",
"resource",
")",
";",
"storage",
".",
"delete",
"(",
"resource",
",",
"caseInsensitive",
")",
";",
"return",
"this",
";",
"}"
] |
Deletes all resource that match the given resource name criteria.
@param resource
the resource name.
@param caseInsensitive
whether the resource name comparison should be
case insensitive.
@return
the cache itself, for method chaining.
|
[
"Deletes",
"all",
"resource",
"that",
"match",
"the",
"given",
"resource",
"name",
"criteria",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/Cache.java#L115-L119
|
156,224
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/cache/Cache.java
|
Cache.copyAs
|
public Cache copyAs(String source, String destination) throws CacheException {
if(!Strings.areValid(source, destination)) {
logger.error("invalid input parameters for copy from '{}' to '{}'", source, destination);
throw new CacheException("invalid input parameters (source: '" + source + "', destination: '" + destination + "')");
}
try (InputStream input = storage.retrieve(source); OutputStream output = storage.store(destination)) {
long copied = Streams.copy(input, output);
logger.trace("copied {} bytes from '{}' to '{}'", copied, source, destination);
} catch (IOException e) {
logger.error("error copying from '" + source + "' to '" + destination + "'", e);
throw new CacheException("error copying from '" + source + "' to '" + destination + "'", e);
}
return this;
}
|
java
|
public Cache copyAs(String source, String destination) throws CacheException {
if(!Strings.areValid(source, destination)) {
logger.error("invalid input parameters for copy from '{}' to '{}'", source, destination);
throw new CacheException("invalid input parameters (source: '" + source + "', destination: '" + destination + "')");
}
try (InputStream input = storage.retrieve(source); OutputStream output = storage.store(destination)) {
long copied = Streams.copy(input, output);
logger.trace("copied {} bytes from '{}' to '{}'", copied, source, destination);
} catch (IOException e) {
logger.error("error copying from '" + source + "' to '" + destination + "'", e);
throw new CacheException("error copying from '" + source + "' to '" + destination + "'", e);
}
return this;
}
|
[
"public",
"Cache",
"copyAs",
"(",
"String",
"source",
",",
"String",
"destination",
")",
"throws",
"CacheException",
"{",
"if",
"(",
"!",
"Strings",
".",
"areValid",
"(",
"source",
",",
"destination",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"invalid input parameters for copy from '{}' to '{}'\"",
",",
"source",
",",
"destination",
")",
";",
"throw",
"new",
"CacheException",
"(",
"\"invalid input parameters (source: '\"",
"+",
"source",
"+",
"\"', destination: '\"",
"+",
"destination",
"+",
"\"')\"",
")",
";",
"}",
"try",
"(",
"InputStream",
"input",
"=",
"storage",
".",
"retrieve",
"(",
"source",
")",
";",
"OutputStream",
"output",
"=",
"storage",
".",
"store",
"(",
"destination",
")",
")",
"{",
"long",
"copied",
"=",
"Streams",
".",
"copy",
"(",
"input",
",",
"output",
")",
";",
"logger",
".",
"trace",
"(",
"\"copied {} bytes from '{}' to '{}'\"",
",",
"copied",
",",
"source",
",",
"destination",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"error copying from '\"",
"+",
"source",
"+",
"\"' to '\"",
"+",
"destination",
"+",
"\"'\"",
",",
"e",
")",
";",
"throw",
"new",
"CacheException",
"(",
"\"error copying from '\"",
"+",
"source",
"+",
"\"' to '\"",
"+",
"destination",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Copies data from one resource to another, possibly replacing the destination
resource if one exists.
@param source
the name of the source resource.
@param destination
the name of the destination resource
@return
the cache itself, for method chaining.
|
[
"Copies",
"data",
"from",
"one",
"resource",
"to",
"another",
"possibly",
"replacing",
"the",
"destination",
"resource",
"if",
"one",
"exists",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/Cache.java#L132-L145
|
156,225
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/cache/Cache.java
|
Cache.contains
|
public boolean contains(String resource) {
boolean result = storage.contains(resource);
logger.debug("resource '{}' {} in cache", resource, (result ? "is" : "is not"));
return result;
}
|
java
|
public boolean contains(String resource) {
boolean result = storage.contains(resource);
logger.debug("resource '{}' {} in cache", resource, (result ? "is" : "is not"));
return result;
}
|
[
"public",
"boolean",
"contains",
"(",
"String",
"resource",
")",
"{",
"boolean",
"result",
"=",
"storage",
".",
"contains",
"(",
"resource",
")",
";",
"logger",
".",
"debug",
"(",
"\"resource '{}' {} in cache\"",
",",
"resource",
",",
"(",
"result",
"?",
"\"is\"",
":",
"\"is not\"",
")",
")",
";",
"return",
"result",
";",
"}"
] |
Checks whether the cache contains the given resource.
@param resource
the resource whose existence in the cache is to be checked.
@return
<code>true</code> if the resource exists in the cache, <code>false
</code> otherwise.
|
[
"Checks",
"whether",
"the",
"cache",
"contains",
"the",
"given",
"resource",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/Cache.java#L180-L184
|
156,226
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/cache/Cache.java
|
Cache.put
|
public OutputStream put(String resource) throws CacheException {
if(Strings.isValid(resource)) {
return storage.store(resource);
}
return null;
}
|
java
|
public OutputStream put(String resource) throws CacheException {
if(Strings.isValid(resource)) {
return storage.store(resource);
}
return null;
}
|
[
"public",
"OutputStream",
"put",
"(",
"String",
"resource",
")",
"throws",
"CacheException",
"{",
"if",
"(",
"Strings",
".",
"isValid",
"(",
"resource",
")",
")",
"{",
"return",
"storage",
".",
"store",
"(",
"resource",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Tells the cache to store under the given resource name the contents
that will be written to the output stream; the method creates a new
resource entry and opens an output stream to it, then returns the
stream to the caller so this can copy its data into it. It is up to
the caller to close the steam once all data have been written to it.
This mechanism actually by-passes the cache and the miss handlers and
provides direct access to the underlying storage engine, thus providing
a highly efficient way of storing data into the cache.
@param resource
the name of the new resource, to which the returned output stream
will point; it must be a valid, non empty string.
@return
an output stream ; the caller will write its data into it, and then
will flush and close it once it's done writing data.
@throws CacheException
|
[
"Tells",
"the",
"cache",
"to",
"store",
"under",
"the",
"given",
"resource",
"name",
"the",
"contents",
"that",
"will",
"be",
"written",
"to",
"the",
"output",
"stream",
";",
"the",
"method",
"creates",
"a",
"new",
"resource",
"entry",
"and",
"opens",
"an",
"output",
"stream",
"to",
"it",
"then",
"returns",
"the",
"stream",
"to",
"the",
"caller",
"so",
"this",
"can",
"copy",
"its",
"data",
"into",
"it",
".",
"It",
"is",
"up",
"to",
"the",
"caller",
"to",
"close",
"the",
"steam",
"once",
"all",
"data",
"have",
"been",
"written",
"to",
"it",
".",
"This",
"mechanism",
"actually",
"by",
"-",
"passes",
"the",
"cache",
"and",
"the",
"miss",
"handlers",
"and",
"provides",
"direct",
"access",
"to",
"the",
"underlying",
"storage",
"engine",
"thus",
"providing",
"a",
"highly",
"efficient",
"way",
"of",
"storing",
"data",
"into",
"the",
"cache",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/Cache.java#L268-L273
|
156,227
|
intellimate/Izou
|
src/main/java/org/intellimate/izou/addon/AddOnManager.java
|
AddOnManager.addAndRegisterAddOns
|
public void addAndRegisterAddOns(List<AddOnModel> addOns) {
this.addOns.addAll(addOns);
registerAllAddOns(this.addOns);
initialized();
}
|
java
|
public void addAndRegisterAddOns(List<AddOnModel> addOns) {
this.addOns.addAll(addOns);
registerAllAddOns(this.addOns);
initialized();
}
|
[
"public",
"void",
"addAndRegisterAddOns",
"(",
"List",
"<",
"AddOnModel",
">",
"addOns",
")",
"{",
"this",
".",
"addOns",
".",
"addAll",
"(",
"addOns",
")",
";",
"registerAllAddOns",
"(",
"this",
".",
"addOns",
")",
";",
"initialized",
"(",
")",
";",
"}"
] |
Registers all AddOns.
@param addOns a List containing all the AddOns
|
[
"Registers",
"all",
"AddOns",
"."
] |
40a808b97998e17655c4a78e30ce7326148aed27
|
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/addon/AddOnManager.java#L73-L77
|
156,228
|
intellimate/Izou
|
src/main/java/org/intellimate/izou/addon/AddOnManager.java
|
AddOnManager.createAddOnInfos
|
private void createAddOnInfos(IdentifiableSet<AddOnModel> addOns) {
addOns.stream().forEach(addOn -> addOnInformationManager.registerAddOn(addOn));
}
|
java
|
private void createAddOnInfos(IdentifiableSet<AddOnModel> addOns) {
addOns.stream().forEach(addOn -> addOnInformationManager.registerAddOn(addOn));
}
|
[
"private",
"void",
"createAddOnInfos",
"(",
"IdentifiableSet",
"<",
"AddOnModel",
">",
"addOns",
")",
"{",
"addOns",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"addOn",
"->",
"addOnInformationManager",
".",
"registerAddOn",
"(",
"addOn",
")",
")",
";",
"}"
] |
Checks that addOns have all required properties and creating the addOn information list if they do
|
[
"Checks",
"that",
"addOns",
"have",
"all",
"required",
"properties",
"and",
"creating",
"the",
"addOn",
"information",
"list",
"if",
"they",
"do"
] |
40a808b97998e17655c4a78e30ce7326148aed27
|
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/addon/AddOnManager.java#L100-L102
|
156,229
|
agmip/agmip-common-functions
|
src/main/java/org/agmip/translators/soil/SAReducerDecorator.java
|
SAReducerDecorator.computeInitialConditions
|
public Float computeInitialConditions(String key, Map<String, String> fullCurrentSoil, Map<String, String> previousSoil) {
Float newValue = (parseFloat(fullCurrentSoil.get(key)) * parseFloat(fullCurrentSoil.get(SLLB)) + parseFloat(previousSoil.get(key)) * parseFloat(previousSoil.get(SLLB)));
newValue = newValue / (parseFloat(fullCurrentSoil.get(SLLB)) + parseFloat(previousSoil.get(SLLB)));
return newValue;
}
|
java
|
public Float computeInitialConditions(String key, Map<String, String> fullCurrentSoil, Map<String, String> previousSoil) {
Float newValue = (parseFloat(fullCurrentSoil.get(key)) * parseFloat(fullCurrentSoil.get(SLLB)) + parseFloat(previousSoil.get(key)) * parseFloat(previousSoil.get(SLLB)));
newValue = newValue / (parseFloat(fullCurrentSoil.get(SLLB)) + parseFloat(previousSoil.get(SLLB)));
return newValue;
}
|
[
"public",
"Float",
"computeInitialConditions",
"(",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"String",
">",
"fullCurrentSoil",
",",
"Map",
"<",
"String",
",",
"String",
">",
"previousSoil",
")",
"{",
"Float",
"newValue",
"=",
"(",
"parseFloat",
"(",
"fullCurrentSoil",
".",
"get",
"(",
"key",
")",
")",
"*",
"parseFloat",
"(",
"fullCurrentSoil",
".",
"get",
"(",
"SLLB",
")",
")",
"+",
"parseFloat",
"(",
"previousSoil",
".",
"get",
"(",
"key",
")",
")",
"*",
"parseFloat",
"(",
"previousSoil",
".",
"get",
"(",
"SLLB",
")",
")",
")",
";",
"newValue",
"=",
"newValue",
"/",
"(",
"parseFloat",
"(",
"fullCurrentSoil",
".",
"get",
"(",
"SLLB",
")",
")",
"+",
"parseFloat",
"(",
"previousSoil",
".",
"get",
"(",
"SLLB",
")",
")",
")",
";",
"return",
"newValue",
";",
"}"
] |
Perform initial condition convertion, for icnh4 and icno3 it's important to take into account the deep of the layer
for computing the aggregated value.
@param key
@param fullCurrentSoil
@param previousSoil
@return
|
[
"Perform",
"initial",
"condition",
"convertion",
"for",
"icnh4",
"and",
"icno3",
"it",
"s",
"important",
"to",
"take",
"into",
"account",
"the",
"deep",
"of",
"the",
"layer",
"for",
"computing",
"the",
"aggregated",
"value",
"."
] |
4efa3042178841b026ca6fba9c96da02fbfb9a8e
|
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/translators/soil/SAReducerDecorator.java#L45-L49
|
156,230
|
agmip/agmip-common-functions
|
src/main/java/org/agmip/translators/soil/SAReducerDecorator.java
|
SAReducerDecorator.computeSoil
|
public HashMap<String, String> computeSoil(Map<String, String> fullCurrentSoil, Map<String, String> previousSoil) {
HashMap<String, String> aggregatedSoil;
String fullCurrentValue;
String previousValue;
Float newValue;
newValue = 0f;
aggregatedSoil = new HashMap<String, String>();
for (String p : allParams) {
if (SLLB.equals(p)) {
newValue = (parseFloat(fullCurrentSoil.get(p)) + parseFloat(previousSoil.get(p)));
} else if ((ICNH4.equals(p) && fullCurrentSoil.containsKey(ICNH4) && previousSoil.containsKey(ICNH4)) || ICNO3.equals(p) && fullCurrentSoil.containsKey(ICNO3)
&& previousSoil.containsKey(ICNO3)) {
newValue = computeInitialConditions(p, fullCurrentSoil, previousSoil);
} else {
fullCurrentValue = fullCurrentSoil.get(p) == null ? LayerReducerUtil.defaultValue(p) : fullCurrentSoil.get(p);
previousValue = previousSoil.get(p) == null ? LayerReducerUtil.defaultValue(p) : previousSoil.get(p);
newValue = (parseFloat(fullCurrentValue) + parseFloat(previousValue)) / 2f;
}
aggregatedSoil.put(p, newValue.toString());
}
return aggregatedSoil;
}
|
java
|
public HashMap<String, String> computeSoil(Map<String, String> fullCurrentSoil, Map<String, String> previousSoil) {
HashMap<String, String> aggregatedSoil;
String fullCurrentValue;
String previousValue;
Float newValue;
newValue = 0f;
aggregatedSoil = new HashMap<String, String>();
for (String p : allParams) {
if (SLLB.equals(p)) {
newValue = (parseFloat(fullCurrentSoil.get(p)) + parseFloat(previousSoil.get(p)));
} else if ((ICNH4.equals(p) && fullCurrentSoil.containsKey(ICNH4) && previousSoil.containsKey(ICNH4)) || ICNO3.equals(p) && fullCurrentSoil.containsKey(ICNO3)
&& previousSoil.containsKey(ICNO3)) {
newValue = computeInitialConditions(p, fullCurrentSoil, previousSoil);
} else {
fullCurrentValue = fullCurrentSoil.get(p) == null ? LayerReducerUtil.defaultValue(p) : fullCurrentSoil.get(p);
previousValue = previousSoil.get(p) == null ? LayerReducerUtil.defaultValue(p) : previousSoil.get(p);
newValue = (parseFloat(fullCurrentValue) + parseFloat(previousValue)) / 2f;
}
aggregatedSoil.put(p, newValue.toString());
}
return aggregatedSoil;
}
|
[
"public",
"HashMap",
"<",
"String",
",",
"String",
">",
"computeSoil",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"fullCurrentSoil",
",",
"Map",
"<",
"String",
",",
"String",
">",
"previousSoil",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"aggregatedSoil",
";",
"String",
"fullCurrentValue",
";",
"String",
"previousValue",
";",
"Float",
"newValue",
";",
"newValue",
"=",
"0f",
";",
"aggregatedSoil",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"p",
":",
"allParams",
")",
"{",
"if",
"(",
"SLLB",
".",
"equals",
"(",
"p",
")",
")",
"{",
"newValue",
"=",
"(",
"parseFloat",
"(",
"fullCurrentSoil",
".",
"get",
"(",
"p",
")",
")",
"+",
"parseFloat",
"(",
"previousSoil",
".",
"get",
"(",
"p",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"(",
"ICNH4",
".",
"equals",
"(",
"p",
")",
"&&",
"fullCurrentSoil",
".",
"containsKey",
"(",
"ICNH4",
")",
"&&",
"previousSoil",
".",
"containsKey",
"(",
"ICNH4",
")",
")",
"||",
"ICNO3",
".",
"equals",
"(",
"p",
")",
"&&",
"fullCurrentSoil",
".",
"containsKey",
"(",
"ICNO3",
")",
"&&",
"previousSoil",
".",
"containsKey",
"(",
"ICNO3",
")",
")",
"{",
"newValue",
"=",
"computeInitialConditions",
"(",
"p",
",",
"fullCurrentSoil",
",",
"previousSoil",
")",
";",
"}",
"else",
"{",
"fullCurrentValue",
"=",
"fullCurrentSoil",
".",
"get",
"(",
"p",
")",
"==",
"null",
"?",
"LayerReducerUtil",
".",
"defaultValue",
"(",
"p",
")",
":",
"fullCurrentSoil",
".",
"get",
"(",
"p",
")",
";",
"previousValue",
"=",
"previousSoil",
".",
"get",
"(",
"p",
")",
"==",
"null",
"?",
"LayerReducerUtil",
".",
"defaultValue",
"(",
"p",
")",
":",
"previousSoil",
".",
"get",
"(",
"p",
")",
";",
"newValue",
"=",
"(",
"parseFloat",
"(",
"fullCurrentValue",
")",
"+",
"parseFloat",
"(",
"previousValue",
")",
")",
"/",
"2f",
";",
"}",
"aggregatedSoil",
".",
"put",
"(",
"p",
",",
"newValue",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"aggregatedSoil",
";",
"}"
] |
Create a new soil filled with aggregated data coming from soils set as
input parameters.
@param fullCurrentSoil
@param previousSoil
@return
|
[
"Create",
"a",
"new",
"soil",
"filled",
"with",
"aggregated",
"data",
"coming",
"from",
"soils",
"set",
"as",
"input",
"parameters",
"."
] |
4efa3042178841b026ca6fba9c96da02fbfb9a8e
|
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/translators/soil/SAReducerDecorator.java#L59-L80
|
156,231
|
s1-platform/s1
|
s1-core/src/java/org/s1/options/OptionsStorage.java
|
OptionsStorage.openConfig
|
public InputStream openConfig(String name) {
InputStream is = null;
String configPath = configHome + "/" + name;
try {
return FileUtils.readResource(configPath);
} catch (Throwable e) {
LOG.debug("Config " + name + " (" + configPath + ") not found", e);
}
return is;
}
|
java
|
public InputStream openConfig(String name) {
InputStream is = null;
String configPath = configHome + "/" + name;
try {
return FileUtils.readResource(configPath);
} catch (Throwable e) {
LOG.debug("Config " + name + " (" + configPath + ") not found", e);
}
return is;
}
|
[
"public",
"InputStream",
"openConfig",
"(",
"String",
"name",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"String",
"configPath",
"=",
"configHome",
"+",
"\"/\"",
"+",
"name",
";",
"try",
"{",
"return",
"FileUtils",
".",
"readResource",
"(",
"configPath",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Config \"",
"+",
"name",
"+",
"\" (\"",
"+",
"configPath",
"+",
"\") not found\"",
",",
"e",
")",
";",
"}",
"return",
"is",
";",
"}"
] |
Do not forget to close InputStream
@param name
@return
|
[
"Do",
"not",
"forget",
"to",
"close",
"InputStream"
] |
370101c13fef01af524bc171bcc1a97e5acc76e8
|
https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-core/src/java/org/s1/options/OptionsStorage.java#L269-L280
|
156,232
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/http/HttpRequest.java
|
HttpRequest.getURL
|
URL getURL() throws HttpClientException, MalformedURLException {
String buffer = url;
if(method == HttpMethod.GET) {
buffer = url + (url.contains("?") ? "&" : "?") + HttpParameter.concatenate(parameters);
}
logger.trace("real request URL: '{}'", buffer);
return new URL(buffer);
}
|
java
|
URL getURL() throws HttpClientException, MalformedURLException {
String buffer = url;
if(method == HttpMethod.GET) {
buffer = url + (url.contains("?") ? "&" : "?") + HttpParameter.concatenate(parameters);
}
logger.trace("real request URL: '{}'", buffer);
return new URL(buffer);
}
|
[
"URL",
"getURL",
"(",
")",
"throws",
"HttpClientException",
",",
"MalformedURLException",
"{",
"String",
"buffer",
"=",
"url",
";",
"if",
"(",
"method",
"==",
"HttpMethod",
".",
"GET",
")",
"{",
"buffer",
"=",
"url",
"+",
"(",
"url",
".",
"contains",
"(",
"\"?\"",
")",
"?",
"\"&\"",
":",
"\"?\"",
")",
"+",
"HttpParameter",
".",
"concatenate",
"(",
"parameters",
")",
";",
"}",
"logger",
".",
"trace",
"(",
"\"real request URL: '{}'\"",
",",
"buffer",
")",
";",
"return",
"new",
"URL",
"(",
"buffer",
")",
";",
"}"
] |
Returns the destination URL of this request.
@return
the destination URL of this request.
@throws HttpClientException
if the parameters of a GET request contain a "FILE" type parameter, which
cannot be serialised as a set of ampersand-joined key/value strings.
@throws MalformedURLException
if the string representation of the URL cannot be parsed.
|
[
"Returns",
"the",
"destination",
"URL",
"of",
"this",
"request",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/http/HttpRequest.java#L109-L116
|
156,233
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/http/HttpRequest.java
|
HttpRequest.withHeader
|
public HttpRequest withHeader(String header, String value) {
if(Strings.isValid(header)) {
if(Strings.isValid(value)) {
headers.put(header, value);
} else {
withoutHeader(header);
}
}
return this;
}
|
java
|
public HttpRequest withHeader(String header, String value) {
if(Strings.isValid(header)) {
if(Strings.isValid(value)) {
headers.put(header, value);
} else {
withoutHeader(header);
}
}
return this;
}
|
[
"public",
"HttpRequest",
"withHeader",
"(",
"String",
"header",
",",
"String",
"value",
")",
"{",
"if",
"(",
"Strings",
".",
"isValid",
"(",
"header",
")",
")",
"{",
"if",
"(",
"Strings",
".",
"isValid",
"(",
"value",
")",
")",
"{",
"headers",
".",
"put",
"(",
"header",
",",
"value",
")",
";",
"}",
"else",
"{",
"withoutHeader",
"(",
"header",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Sets the value of the given header, replacing whatever was already
in there; if the value is null or empty, the header is dropped
altogether.
@param header
the name of the header to set.
@param value
the new value for the header.
@return
the object itself, for method chaining.
|
[
"Sets",
"the",
"value",
"of",
"the",
"given",
"header",
"replacing",
"whatever",
"was",
"already",
"in",
"there",
";",
"if",
"the",
"value",
"is",
"null",
"or",
"empty",
"the",
"header",
"is",
"dropped",
"altogether",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/http/HttpRequest.java#L151-L160
|
156,234
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/http/HttpRequest.java
|
HttpRequest.withoutHeader
|
public HttpRequest withoutHeader(String header) {
if(headers.containsKey(header)) {
headers.remove(header);
}
return this;
}
|
java
|
public HttpRequest withoutHeader(String header) {
if(headers.containsKey(header)) {
headers.remove(header);
}
return this;
}
|
[
"public",
"HttpRequest",
"withoutHeader",
"(",
"String",
"header",
")",
"{",
"if",
"(",
"headers",
".",
"containsKey",
"(",
"header",
")",
")",
"{",
"headers",
".",
"remove",
"(",
"header",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Resets the value of the given header.
@param header
the name of the header to reset.
@return
the object itself, for method chaining.
|
[
"Resets",
"the",
"value",
"of",
"the",
"given",
"header",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/http/HttpRequest.java#L170-L175
|
156,235
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/http/HttpRequest.java
|
HttpRequest.withParameter
|
public HttpRequest withParameter(HttpParameter parameter) {
if(parameter != null) {
parameters.add(parameter);
} else {
withoutParameter(parameter);
}
return this;
}
|
java
|
public HttpRequest withParameter(HttpParameter parameter) {
if(parameter != null) {
parameters.add(parameter);
} else {
withoutParameter(parameter);
}
return this;
}
|
[
"public",
"HttpRequest",
"withParameter",
"(",
"HttpParameter",
"parameter",
")",
"{",
"if",
"(",
"parameter",
"!=",
"null",
")",
"{",
"parameters",
".",
"add",
"(",
"parameter",
")",
";",
"}",
"else",
"{",
"withoutParameter",
"(",
"parameter",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the value of the given parameter, replacing whatever was
already in there; if the value is null or empty, the parameter
is dropped altogether.
@param parameter
the name of the parameter to set.
@param value
the new value for the parameter.
@return
the object itself, for method chaining.
|
[
"Sets",
"the",
"value",
"of",
"the",
"given",
"parameter",
"replacing",
"whatever",
"was",
"already",
"in",
"there",
";",
"if",
"the",
"value",
"is",
"null",
"or",
"empty",
"the",
"parameter",
"is",
"dropped",
"altogether",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/http/HttpRequest.java#L199-L206
|
156,236
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/http/HttpRequest.java
|
HttpRequest.withoutParameter
|
public HttpRequest withoutParameter(String parameter) {
if(Strings.isValid(parameter)) {
for(HttpParameter p : parameters) {
if(parameter.equals(p.getName())) {
parameters.remove(p);
}
}
}
return this;
}
|
java
|
public HttpRequest withoutParameter(String parameter) {
if(Strings.isValid(parameter)) {
for(HttpParameter p : parameters) {
if(parameter.equals(p.getName())) {
parameters.remove(p);
}
}
}
return this;
}
|
[
"public",
"HttpRequest",
"withoutParameter",
"(",
"String",
"parameter",
")",
"{",
"if",
"(",
"Strings",
".",
"isValid",
"(",
"parameter",
")",
")",
"{",
"for",
"(",
"HttpParameter",
"p",
":",
"parameters",
")",
"{",
"if",
"(",
"parameter",
".",
"equals",
"(",
"p",
".",
"getName",
"(",
")",
")",
")",
"{",
"parameters",
".",
"remove",
"(",
"p",
")",
";",
"}",
"}",
"}",
"return",
"this",
";",
"}"
] |
Resets the value of the given parameter.
@param parameter
the name of the parameter to reset.
@return
the object itself, for method chaining.
|
[
"Resets",
"the",
"value",
"of",
"the",
"given",
"parameter",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/http/HttpRequest.java#L216-L225
|
156,237
|
csc19601128/Phynixx
|
phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/Watchdog.java
|
Watchdog.copyConditions
|
private Set<IWatchedCondition> copyConditions() {
Set<IWatchedCondition> copiedConditions = null;
// Copy the current Conditions ...
synchronized (conditions) {
Set<IObjectReference<IWatchedCondition>> copiedObjref = new HashSet<IObjectReference<IWatchedCondition>>(this.conditions);
copiedConditions = new HashSet<IWatchedCondition>(this.conditions.size());
this.conditions.clear();
IWatchedCondition cond = null;
for (Iterator<IObjectReference<IWatchedCondition>> iterator = copiedObjref.iterator(); iterator.hasNext(); ) {
IObjectReference<IWatchedCondition> objRef = iterator.next();
cond = objRef.get();
if (!objRef.isStale() && cond != null && !cond.isUseless()) {
copiedConditions.add(cond);
this.conditions.add(objRef);
}
}
}
return copiedConditions;
}
|
java
|
private Set<IWatchedCondition> copyConditions() {
Set<IWatchedCondition> copiedConditions = null;
// Copy the current Conditions ...
synchronized (conditions) {
Set<IObjectReference<IWatchedCondition>> copiedObjref = new HashSet<IObjectReference<IWatchedCondition>>(this.conditions);
copiedConditions = new HashSet<IWatchedCondition>(this.conditions.size());
this.conditions.clear();
IWatchedCondition cond = null;
for (Iterator<IObjectReference<IWatchedCondition>> iterator = copiedObjref.iterator(); iterator.hasNext(); ) {
IObjectReference<IWatchedCondition> objRef = iterator.next();
cond = objRef.get();
if (!objRef.isStale() && cond != null && !cond.isUseless()) {
copiedConditions.add(cond);
this.conditions.add(objRef);
}
}
}
return copiedConditions;
}
|
[
"private",
"Set",
"<",
"IWatchedCondition",
">",
"copyConditions",
"(",
")",
"{",
"Set",
"<",
"IWatchedCondition",
">",
"copiedConditions",
"=",
"null",
";",
"// Copy the current Conditions ...",
"synchronized",
"(",
"conditions",
")",
"{",
"Set",
"<",
"IObjectReference",
"<",
"IWatchedCondition",
">>",
"copiedObjref",
"=",
"new",
"HashSet",
"<",
"IObjectReference",
"<",
"IWatchedCondition",
">",
">",
"(",
"this",
".",
"conditions",
")",
";",
"copiedConditions",
"=",
"new",
"HashSet",
"<",
"IWatchedCondition",
">",
"(",
"this",
".",
"conditions",
".",
"size",
"(",
")",
")",
";",
"this",
".",
"conditions",
".",
"clear",
"(",
")",
";",
"IWatchedCondition",
"cond",
"=",
"null",
";",
"for",
"(",
"Iterator",
"<",
"IObjectReference",
"<",
"IWatchedCondition",
">",
">",
"iterator",
"=",
"copiedObjref",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IObjectReference",
"<",
"IWatchedCondition",
">",
"objRef",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"cond",
"=",
"objRef",
".",
"get",
"(",
")",
";",
"if",
"(",
"!",
"objRef",
".",
"isStale",
"(",
")",
"&&",
"cond",
"!=",
"null",
"&&",
"!",
"cond",
".",
"isUseless",
"(",
")",
")",
"{",
"copiedConditions",
".",
"add",
"(",
"cond",
")",
";",
"this",
".",
"conditions",
".",
"add",
"(",
"objRef",
")",
";",
"}",
"}",
"}",
"return",
"copiedConditions",
";",
"}"
] |
copies the current set of conditions and cleans up the current set of conditions
@return
|
[
"copies",
"the",
"current",
"set",
"of",
"conditions",
"and",
"cleans",
"up",
"the",
"current",
"set",
"of",
"conditions"
] |
a26c03bc229a8882c647799834115bec6bdc0ac8
|
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/Watchdog.java#L223-L245
|
156,238
|
csc19601128/Phynixx
|
phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/Watchdog.java
|
Watchdog.stop
|
public synchronized void stop() {
try {
this.kill();
} finally {
this.killed = false;
this.restartCondition.setUseless(false);
this.restartCondition.setActive(false);
}
}
|
java
|
public synchronized void stop() {
try {
this.kill();
} finally {
this.killed = false;
this.restartCondition.setUseless(false);
this.restartCondition.setActive(false);
}
}
|
[
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"try",
"{",
"this",
".",
"kill",
"(",
")",
";",
"}",
"finally",
"{",
"this",
".",
"killed",
"=",
"false",
";",
"this",
".",
"restartCondition",
".",
"setUseless",
"(",
"false",
")",
";",
"this",
".",
"restartCondition",
".",
"setActive",
"(",
"false",
")",
";",
"}",
"}"
] |
stops the executing thread but does not kill the thread.
It can be restarted
|
[
"stops",
"the",
"executing",
"thread",
"but",
"does",
"not",
"kill",
"the",
"thread",
".",
"It",
"can",
"be",
"restarted"
] |
a26c03bc229a8882c647799834115bec6bdc0ac8
|
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/Watchdog.java#L293-L302
|
156,239
|
csc19601128/Phynixx
|
phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/Watchdog.java
|
Watchdog.evaluateConditions
|
private synchronized void evaluateConditions() {
// Copy the current Conditions ...
Set<IWatchedCondition> copiedConditions = this.copyConditions();
// check the conditions ....
for (Iterator<IWatchedCondition> iterator = copiedConditions.iterator(); iterator.hasNext(); ) {
IWatchedCondition cond = iterator.next();
synchronized (cond) {
// the conditions are not accessed in a synchronized way. This has to be make sure by the Implementations
if (cond.isActive() && !cond.checkCondition()) {
cond.conditionViolated();
}
}
}
return;
}
|
java
|
private synchronized void evaluateConditions() {
// Copy the current Conditions ...
Set<IWatchedCondition> copiedConditions = this.copyConditions();
// check the conditions ....
for (Iterator<IWatchedCondition> iterator = copiedConditions.iterator(); iterator.hasNext(); ) {
IWatchedCondition cond = iterator.next();
synchronized (cond) {
// the conditions are not accessed in a synchronized way. This has to be make sure by the Implementations
if (cond.isActive() && !cond.checkCondition()) {
cond.conditionViolated();
}
}
}
return;
}
|
[
"private",
"synchronized",
"void",
"evaluateConditions",
"(",
")",
"{",
"// Copy the current Conditions ...",
"Set",
"<",
"IWatchedCondition",
">",
"copiedConditions",
"=",
"this",
".",
"copyConditions",
"(",
")",
";",
"// check the conditions ....",
"for",
"(",
"Iterator",
"<",
"IWatchedCondition",
">",
"iterator",
"=",
"copiedConditions",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"IWatchedCondition",
"cond",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"synchronized",
"(",
"cond",
")",
"{",
"// the conditions are not accessed in a synchronized way. This has to be make sure by the Implementations",
"if",
"(",
"cond",
".",
"isActive",
"(",
")",
"&&",
"!",
"cond",
".",
"checkCondition",
"(",
")",
")",
"{",
"cond",
".",
"conditionViolated",
"(",
")",
";",
"}",
"}",
"}",
"return",
";",
"}"
] |
evaluate the conditions
it's synchronized to prevent any other thread from changing the state of
the watchdog or of one of its conditions
|
[
"evaluate",
"the",
"conditions"
] |
a26c03bc229a8882c647799834115bec6bdc0ac8
|
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-watchdog/src/main/java/org/csc/phynixx/watchdog/Watchdog.java#L430-L446
|
156,240
|
dottydingo/tracelog
|
src/main/java/com/dottydingo/service/tracelog/logback/TraceTurboFilter.java
|
TraceTurboFilter.start
|
@Override
public void start()
{
LoggerContext loggerFactory = (LoggerContext) LoggerFactory.getILoggerFactory();
setContext(loggerFactory);
loggerFactory.addTurboFilter(this);
super.start();
}
|
java
|
@Override
public void start()
{
LoggerContext loggerFactory = (LoggerContext) LoggerFactory.getILoggerFactory();
setContext(loggerFactory);
loggerFactory.addTurboFilter(this);
super.start();
}
|
[
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"{",
"LoggerContext",
"loggerFactory",
"=",
"(",
"LoggerContext",
")",
"LoggerFactory",
".",
"getILoggerFactory",
"(",
")",
";",
"setContext",
"(",
"loggerFactory",
")",
";",
"loggerFactory",
".",
"addTurboFilter",
"(",
"this",
")",
";",
"super",
".",
"start",
"(",
")",
";",
"}"
] |
Initialize and add this turbo filter to the loggerFactory.
|
[
"Initialize",
"and",
"add",
"this",
"turbo",
"filter",
"to",
"the",
"loggerFactory",
"."
] |
e856d3593f2aad5465a89d50f79d2fc6c4169cb1
|
https://github.com/dottydingo/tracelog/blob/e856d3593f2aad5465a89d50f79d2fc6c4169cb1/src/main/java/com/dottydingo/service/tracelog/logback/TraceTurboFilter.java#L32-L39
|
156,241
|
caduandrade/japura-framework
|
src/main/java/org/japura/task/Task.java
|
Task.registerTaskSubmitter
|
public final void registerTaskSubmitter(TaskSubmitter taskSubmitter) {
if (taskSubmitter == null) {
throw new TaskExeception("TaskSubmitter can't be NULL");
}
this.taskSubmitters.put(taskSubmitter.getClass(),
taskSubmitter.getTaskSubmitterId());
}
|
java
|
public final void registerTaskSubmitter(TaskSubmitter taskSubmitter) {
if (taskSubmitter == null) {
throw new TaskExeception("TaskSubmitter can't be NULL");
}
this.taskSubmitters.put(taskSubmitter.getClass(),
taskSubmitter.getTaskSubmitterId());
}
|
[
"public",
"final",
"void",
"registerTaskSubmitter",
"(",
"TaskSubmitter",
"taskSubmitter",
")",
"{",
"if",
"(",
"taskSubmitter",
"==",
"null",
")",
"{",
"throw",
"new",
"TaskExeception",
"(",
"\"TaskSubmitter can't be NULL\"",
")",
";",
"}",
"this",
".",
"taskSubmitters",
".",
"put",
"(",
"taskSubmitter",
".",
"getClass",
"(",
")",
",",
"taskSubmitter",
".",
"getTaskSubmitterId",
"(",
")",
")",
";",
"}"
] |
Registers the task submitter. DO NOT USE THIS METHOD UNLESS YOU ARE
DEVELOPING A NEW TASK SUBMITTER.
@param taskSubmitter
the submitter
|
[
"Registers",
"the",
"task",
"submitter",
".",
"DO",
"NOT",
"USE",
"THIS",
"METHOD",
"UNLESS",
"YOU",
"ARE",
"DEVELOPING",
"A",
"NEW",
"TASK",
"SUBMITTER",
"."
] |
9b714f07d37b8ff91762de2272fa158e0ecc5ab6
|
https://github.com/caduandrade/japura-framework/blob/9b714f07d37b8ff91762de2272fa158e0ecc5ab6/src/main/java/org/japura/task/Task.java#L197-L203
|
156,242
|
caduandrade/japura-framework
|
src/main/java/org/japura/task/Task.java
|
Task.registerExecutionType
|
public final void registerExecutionType(ExecutionType executionType) {
if (executionType == null) {
throw new TaskExeception(ExecutionType.class.getSimpleName() + " NULL");
}
this.executionType = executionType;
}
|
java
|
public final void registerExecutionType(ExecutionType executionType) {
if (executionType == null) {
throw new TaskExeception(ExecutionType.class.getSimpleName() + " NULL");
}
this.executionType = executionType;
}
|
[
"public",
"final",
"void",
"registerExecutionType",
"(",
"ExecutionType",
"executionType",
")",
"{",
"if",
"(",
"executionType",
"==",
"null",
")",
"{",
"throw",
"new",
"TaskExeception",
"(",
"ExecutionType",
".",
"class",
".",
"getSimpleName",
"(",
")",
"+",
"\" NULL\"",
")",
";",
"}",
"this",
".",
"executionType",
"=",
"executionType",
";",
"}"
] |
Registers the executor type. DO NOT USE THIS METHOD UNLESS YOU ARE
DEVELOPING A NEW TASK EXECUTOR.
@param executionType
the executor type
|
[
"Registers",
"the",
"executor",
"type",
".",
"DO",
"NOT",
"USE",
"THIS",
"METHOD",
"UNLESS",
"YOU",
"ARE",
"DEVELOPING",
"A",
"NEW",
"TASK",
"EXECUTOR",
"."
] |
9b714f07d37b8ff91762de2272fa158e0ecc5ab6
|
https://github.com/caduandrade/japura-framework/blob/9b714f07d37b8ff91762de2272fa158e0ecc5ab6/src/main/java/org/japura/task/Task.java#L220-L225
|
156,243
|
caduandrade/japura-framework
|
src/main/java/org/japura/task/Task.java
|
Task.registerStatus
|
public final void registerStatus(TaskStatus status) {
TaskStatus.validate(this.status, status);
this.status = status;
if (status.equals(TaskStatus.SUBMITTED)) {
clear();
}
}
|
java
|
public final void registerStatus(TaskStatus status) {
TaskStatus.validate(this.status, status);
this.status = status;
if (status.equals(TaskStatus.SUBMITTED)) {
clear();
}
}
|
[
"public",
"final",
"void",
"registerStatus",
"(",
"TaskStatus",
"status",
")",
"{",
"TaskStatus",
".",
"validate",
"(",
"this",
".",
"status",
",",
"status",
")",
";",
"this",
".",
"status",
"=",
"status",
";",
"if",
"(",
"status",
".",
"equals",
"(",
"TaskStatus",
".",
"SUBMITTED",
")",
")",
"{",
"clear",
"(",
")",
";",
"}",
"}"
] |
Registers a new status. DO NOT USE THIS METHOD UNLESS YOU ARE DEVELOPING A
NEW TASK EXECUTOR.
@param status
the new status
|
[
"Registers",
"a",
"new",
"status",
".",
"DO",
"NOT",
"USE",
"THIS",
"METHOD",
"UNLESS",
"YOU",
"ARE",
"DEVELOPING",
"A",
"NEW",
"TASK",
"EXECUTOR",
"."
] |
9b714f07d37b8ff91762de2272fa158e0ecc5ab6
|
https://github.com/caduandrade/japura-framework/blob/9b714f07d37b8ff91762de2272fa158e0ecc5ab6/src/main/java/org/japura/task/Task.java#L245-L251
|
156,244
|
scottbw/spaws
|
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
|
ParadataManager.getSubmissions
|
public List<ISubmission> getSubmissions(String resourceUrl) throws Exception{
ParadataFetcher fetcher = new ParadataFetcher(node, resourceUrl);
return fetcher.getSubmissions();
}
|
java
|
public List<ISubmission> getSubmissions(String resourceUrl) throws Exception{
ParadataFetcher fetcher = new ParadataFetcher(node, resourceUrl);
return fetcher.getSubmissions();
}
|
[
"public",
"List",
"<",
"ISubmission",
">",
"getSubmissions",
"(",
"String",
"resourceUrl",
")",
"throws",
"Exception",
"{",
"ParadataFetcher",
"fetcher",
"=",
"new",
"ParadataFetcher",
"(",
"node",
",",
"resourceUrl",
")",
";",
"return",
"fetcher",
".",
"getSubmissions",
"(",
")",
";",
"}"
] |
Return all paradata for a resource of all types from all submitters for the resource
@param resourceUrl
@return
@throws Exception
|
[
"Return",
"all",
"paradata",
"for",
"a",
"resource",
"of",
"all",
"types",
"from",
"all",
"submitters",
"for",
"the",
"resource"
] |
9b1e07453091f6a8d60c6046d194b1a8f1236502
|
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L52-L55
|
156,245
|
scottbw/spaws
|
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
|
ParadataManager.getExternalSubmissions
|
public List<ISubmission> getExternalSubmissions(String resourceUrl) throws Exception{
return new SubmitterSubmissionsFilter().omit(getSubmissions(resourceUrl), submitter);
}
|
java
|
public List<ISubmission> getExternalSubmissions(String resourceUrl) throws Exception{
return new SubmitterSubmissionsFilter().omit(getSubmissions(resourceUrl), submitter);
}
|
[
"public",
"List",
"<",
"ISubmission",
">",
"getExternalSubmissions",
"(",
"String",
"resourceUrl",
")",
"throws",
"Exception",
"{",
"return",
"new",
"SubmitterSubmissionsFilter",
"(",
")",
".",
"omit",
"(",
"getSubmissions",
"(",
"resourceUrl",
")",
",",
"submitter",
")",
";",
"}"
] |
Return all paradata for a resource of all types from other submitters for the resource
@param resourceUrl
@return
@throws Exception
|
[
"Return",
"all",
"paradata",
"for",
"a",
"resource",
"of",
"all",
"types",
"from",
"other",
"submitters",
"for",
"the",
"resource"
] |
9b1e07453091f6a8d60c6046d194b1a8f1236502
|
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L63-L65
|
156,246
|
scottbw/spaws
|
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
|
ParadataManager.getExternalStats
|
public List<ISubmission> getExternalStats(String resourceUrl) throws Exception{
return getExternalSubmissions(resourceUrl, IStats.VERB);
}
|
java
|
public List<ISubmission> getExternalStats(String resourceUrl) throws Exception{
return getExternalSubmissions(resourceUrl, IStats.VERB);
}
|
[
"public",
"List",
"<",
"ISubmission",
">",
"getExternalStats",
"(",
"String",
"resourceUrl",
")",
"throws",
"Exception",
"{",
"return",
"getExternalSubmissions",
"(",
"resourceUrl",
",",
"IStats",
".",
"VERB",
")",
";",
"}"
] |
Return all stats from other submitters for the resource
@param resourceUrl
@return
@throws Exception
|
[
"Return",
"all",
"stats",
"from",
"other",
"submitters",
"for",
"the",
"resource"
] |
9b1e07453091f6a8d60c6046d194b1a8f1236502
|
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L73-L75
|
156,247
|
scottbw/spaws
|
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
|
ParadataManager.getExternalRatingSubmissions
|
public List<ISubmission> getExternalRatingSubmissions(String resourceUrl) throws Exception{
return getExternalSubmissions(resourceUrl, IRating.VERB);
}
|
java
|
public List<ISubmission> getExternalRatingSubmissions(String resourceUrl) throws Exception{
return getExternalSubmissions(resourceUrl, IRating.VERB);
}
|
[
"public",
"List",
"<",
"ISubmission",
">",
"getExternalRatingSubmissions",
"(",
"String",
"resourceUrl",
")",
"throws",
"Exception",
"{",
"return",
"getExternalSubmissions",
"(",
"resourceUrl",
",",
"IRating",
".",
"VERB",
")",
";",
"}"
] |
Return all rating submissions from other submitters for the resource
@param resourceUrl
@return
@throws Exception
|
[
"Return",
"all",
"rating",
"submissions",
"from",
"other",
"submitters",
"for",
"the",
"resource"
] |
9b1e07453091f6a8d60c6046d194b1a8f1236502
|
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L83-L85
|
156,248
|
scottbw/spaws
|
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
|
ParadataManager.getExternalSubmissions
|
public List<ISubmission> getExternalSubmissions(String resourceUrl, String verb) throws Exception{
return new SubmitterSubmissionsFilter().omit(new NormalizingFilter(verb).filter(getSubmissions(resourceUrl)), submitter);
}
|
java
|
public List<ISubmission> getExternalSubmissions(String resourceUrl, String verb) throws Exception{
return new SubmitterSubmissionsFilter().omit(new NormalizingFilter(verb).filter(getSubmissions(resourceUrl)), submitter);
}
|
[
"public",
"List",
"<",
"ISubmission",
">",
"getExternalSubmissions",
"(",
"String",
"resourceUrl",
",",
"String",
"verb",
")",
"throws",
"Exception",
"{",
"return",
"new",
"SubmitterSubmissionsFilter",
"(",
")",
".",
"omit",
"(",
"new",
"NormalizingFilter",
"(",
"verb",
")",
".",
"filter",
"(",
"getSubmissions",
"(",
"resourceUrl",
")",
")",
",",
"submitter",
")",
";",
"}"
] |
Return all submissions using the specified verb from other submitters for the resource
@param resourceUrl
@param verb
@return
@throws Exception
|
[
"Return",
"all",
"submissions",
"using",
"the",
"specified",
"verb",
"from",
"other",
"submitters",
"for",
"the",
"resource"
] |
9b1e07453091f6a8d60c6046d194b1a8f1236502
|
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L94-L96
|
156,249
|
scottbw/spaws
|
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
|
ParadataManager.getSubmissionsForSubmitter
|
public List<ISubmission> getSubmissionsForSubmitter(ISubmitter submitter, String resourceUrl, String verb) throws Exception{
return new SubmitterSubmissionsFilter().include(new NormalizingFilter(IRating.VERB).filter(getSubmissions(resourceUrl)), submitter);
}
|
java
|
public List<ISubmission> getSubmissionsForSubmitter(ISubmitter submitter, String resourceUrl, String verb) throws Exception{
return new SubmitterSubmissionsFilter().include(new NormalizingFilter(IRating.VERB).filter(getSubmissions(resourceUrl)), submitter);
}
|
[
"public",
"List",
"<",
"ISubmission",
">",
"getSubmissionsForSubmitter",
"(",
"ISubmitter",
"submitter",
",",
"String",
"resourceUrl",
",",
"String",
"verb",
")",
"throws",
"Exception",
"{",
"return",
"new",
"SubmitterSubmissionsFilter",
"(",
")",
".",
"include",
"(",
"new",
"NormalizingFilter",
"(",
"IRating",
".",
"VERB",
")",
".",
"filter",
"(",
"getSubmissions",
"(",
"resourceUrl",
")",
")",
",",
"submitter",
")",
";",
"}"
] |
Return all submissions using the specified verb from the specified submitter for the resource
@param submitter
@param resourceUrl
@return
@throws Exception
|
[
"Return",
"all",
"submissions",
"using",
"the",
"specified",
"verb",
"from",
"the",
"specified",
"submitter",
"for",
"the",
"resource"
] |
9b1e07453091f6a8d60c6046d194b1a8f1236502
|
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L105-L107
|
156,250
|
scottbw/spaws
|
src/main/java/uk/ac/bolton/spaws/ParadataManager.java
|
ParadataManager.publishSubmissions
|
public void publishSubmissions(List<ISubmission> submissions) throws Exception{
ParadataPublisher publisher = new ParadataPublisher(node);
for (ISubmission submission: submissions){
publisher.publish(submission);
}
}
|
java
|
public void publishSubmissions(List<ISubmission> submissions) throws Exception{
ParadataPublisher publisher = new ParadataPublisher(node);
for (ISubmission submission: submissions){
publisher.publish(submission);
}
}
|
[
"public",
"void",
"publishSubmissions",
"(",
"List",
"<",
"ISubmission",
">",
"submissions",
")",
"throws",
"Exception",
"{",
"ParadataPublisher",
"publisher",
"=",
"new",
"ParadataPublisher",
"(",
"node",
")",
";",
"for",
"(",
"ISubmission",
"submission",
":",
"submissions",
")",
"{",
"publisher",
".",
"publish",
"(",
"submission",
")",
";",
"}",
"}"
] |
Publish a collection of submissions; this can be a mix of submission types and be about different resources
@param submissions
@throws Exception
|
[
"Publish",
"a",
"collection",
"of",
"submissions",
";",
"this",
"can",
"be",
"a",
"mix",
"of",
"submission",
"types",
"and",
"be",
"about",
"different",
"resources"
] |
9b1e07453091f6a8d60c6046d194b1a8f1236502
|
https://github.com/scottbw/spaws/blob/9b1e07453091f6a8d60c6046d194b1a8f1236502/src/main/java/uk/ac/bolton/spaws/ParadataManager.java#L114-L119
|
156,251
|
dihedron/dihedron-commons
|
src/main/java/org/dihedron/patterns/activities/engine/javaee/AsynchronousBean.java
|
AsynchronousBean.submit
|
public Future<ActivityData> submit(ActivityCallable callable) throws ActivityException {
logger.info("submitting activity to asynchronous EJB...");
return new AsyncResult<ActivityData>(callable.call());
}
|
java
|
public Future<ActivityData> submit(ActivityCallable callable) throws ActivityException {
logger.info("submitting activity to asynchronous EJB...");
return new AsyncResult<ActivityData>(callable.call());
}
|
[
"public",
"Future",
"<",
"ActivityData",
">",
"submit",
"(",
"ActivityCallable",
"callable",
")",
"throws",
"ActivityException",
"{",
"logger",
".",
"info",
"(",
"\"submitting activity to asynchronous EJB...\"",
")",
";",
"return",
"new",
"AsyncResult",
"<",
"ActivityData",
">",
"(",
"callable",
".",
"call",
"(",
")",
")",
";",
"}"
] |
Assigns the given activity to the asynchronous EJB for background execution.
@param callable
the {@code Activity} to be executed asynchronously.
@return
the activity's {@code Future} object, for result retrieval.
@see
org.dihedron.patterns.activities.concurrent.ActivityExecutor#submit(org.dihedron.patterns.activities.Activity)
|
[
"Assigns",
"the",
"given",
"activity",
"to",
"the",
"asynchronous",
"EJB",
"for",
"background",
"execution",
"."
] |
a5194cdaa0d6417ef4aade6ea407a1cad6e8458e
|
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/activities/engine/javaee/AsynchronousBean.java#L38-L41
|
156,252
|
pdef/pdef-java
|
pdef/src/main/java/io/pdef/rpc/RpcProtocol.java
|
RpcProtocol.getRequest
|
public RpcRequest getRequest(final Invocation invocation) {
if (invocation == null) throw new NullPointerException("invocation");
MethodDescriptor<?, ?> method = invocation.getMethod();
if (!method.isTerminal()) {
throw new IllegalArgumentException("Last invocation method must be terminal");
}
RpcRequest request = new RpcRequest(method.isPost() ? RpcRequest.POST : RpcRequest.GET);
for (Invocation invocation1 : invocation.toChain()) {
writeInvocation(request, invocation1);
}
return request;
}
|
java
|
public RpcRequest getRequest(final Invocation invocation) {
if (invocation == null) throw new NullPointerException("invocation");
MethodDescriptor<?, ?> method = invocation.getMethod();
if (!method.isTerminal()) {
throw new IllegalArgumentException("Last invocation method must be terminal");
}
RpcRequest request = new RpcRequest(method.isPost() ? RpcRequest.POST : RpcRequest.GET);
for (Invocation invocation1 : invocation.toChain()) {
writeInvocation(request, invocation1);
}
return request;
}
|
[
"public",
"RpcRequest",
"getRequest",
"(",
"final",
"Invocation",
"invocation",
")",
"{",
"if",
"(",
"invocation",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"invocation\"",
")",
";",
"MethodDescriptor",
"<",
"?",
",",
"?",
">",
"method",
"=",
"invocation",
".",
"getMethod",
"(",
")",
";",
"if",
"(",
"!",
"method",
".",
"isTerminal",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Last invocation method must be terminal\"",
")",
";",
"}",
"RpcRequest",
"request",
"=",
"new",
"RpcRequest",
"(",
"method",
".",
"isPost",
"(",
")",
"?",
"RpcRequest",
".",
"POST",
":",
"RpcRequest",
".",
"GET",
")",
";",
"for",
"(",
"Invocation",
"invocation1",
":",
"invocation",
".",
"toChain",
"(",
")",
")",
"{",
"writeInvocation",
"(",
"request",
",",
"invocation1",
")",
";",
"}",
"return",
"request",
";",
"}"
] |
Converts an invocation into an rpc request.
|
[
"Converts",
"an",
"invocation",
"into",
"an",
"rpc",
"request",
"."
] |
7776c44d1aab0f3dbf7267b0c32b8f9282fe6167
|
https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/rpc/RpcProtocol.java#L46-L60
|
156,253
|
pdef/pdef-java
|
pdef/src/main/java/io/pdef/rpc/RpcProtocol.java
|
RpcProtocol.toJson
|
<V> String toJson(final DataTypeDescriptor<V> descriptor, final V arg) {
String s = format.write(arg, descriptor, false);
TypeEnum type = descriptor.getType();
if (type == TypeEnum.STRING || type == TypeEnum.ENUM || type == TypeEnum.DATETIME) {
// Remove the quotes.
s = s.substring(1, s.length() - 1);
}
return s;
}
|
java
|
<V> String toJson(final DataTypeDescriptor<V> descriptor, final V arg) {
String s = format.write(arg, descriptor, false);
TypeEnum type = descriptor.getType();
if (type == TypeEnum.STRING || type == TypeEnum.ENUM || type == TypeEnum.DATETIME) {
// Remove the quotes.
s = s.substring(1, s.length() - 1);
}
return s;
}
|
[
"<",
"V",
">",
"String",
"toJson",
"(",
"final",
"DataTypeDescriptor",
"<",
"V",
">",
"descriptor",
",",
"final",
"V",
"arg",
")",
"{",
"String",
"s",
"=",
"format",
".",
"write",
"(",
"arg",
",",
"descriptor",
",",
"false",
")",
";",
"TypeEnum",
"type",
"=",
"descriptor",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"==",
"TypeEnum",
".",
"STRING",
"||",
"type",
"==",
"TypeEnum",
".",
"ENUM",
"||",
"type",
"==",
"TypeEnum",
".",
"DATETIME",
")",
"{",
"// Remove the quotes.",
"s",
"=",
"s",
".",
"substring",
"(",
"1",
",",
"s",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"return",
"s",
";",
"}"
] |
Serializes an argument to JSON, strips the quotes.
|
[
"Serializes",
"an",
"argument",
"to",
"JSON",
"strips",
"the",
"quotes",
"."
] |
7776c44d1aab0f3dbf7267b0c32b8f9282fe6167
|
https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/rpc/RpcProtocol.java#L103-L112
|
156,254
|
pdef/pdef-java
|
pdef/src/main/java/io/pdef/rpc/RpcProtocol.java
|
RpcProtocol.getInvocation
|
public Invocation getInvocation(final RpcRequest request, InterfaceDescriptor<?> descriptor) {
if (request == null) throw new NullPointerException("request");
if (descriptor == null) throw new NullPointerException("descriptor");
Invocation invocation = null;
LinkedList<String> parts = splitPath(request.getRelativePath());
while (!parts.isEmpty()) {
String part = parts.removeFirst();
// Find a method by a name.
MethodDescriptor<?, ?> method = descriptor.getMethod(part);
if (method == null) {
throw RpcException.badRequest("Method is not found: " + part);
}
// Check the required HTTP method.
if (method.isPost() && !request.isPost()) {
throw RpcException.methodNotAllowed("Method not allowed, POST required");
}
// Parse arguments.
List<Object> args = readArgs(method, parts, request.getQuery(), request.getPost());
// Create a root invocation,
// or a next invocation in a chain.
invocation = invocation != null ? invocation.next(method, args.toArray())
: Invocation.root(method, args.toArray());
if (method.isTerminal()) {
break;
}
// It's an interface method.
// Get the next interface and proceed parsing the parts.
descriptor = (InterfaceDescriptor<?>) method.getResult();
}
if (!parts.isEmpty()) {
// No more interface descriptors in a chain, but the parts are still present.
throw RpcException.badRequest("Failed to parse an invocation chain");
}
if (invocation == null) {
throw RpcException.badRequest("Invocation chain required");
}
if (!invocation.getMethod().isTerminal()) {
throw RpcException.badRequest("The last method must be a terminal one. "
+ "It must return a data type or be void.");
}
return invocation;
}
|
java
|
public Invocation getInvocation(final RpcRequest request, InterfaceDescriptor<?> descriptor) {
if (request == null) throw new NullPointerException("request");
if (descriptor == null) throw new NullPointerException("descriptor");
Invocation invocation = null;
LinkedList<String> parts = splitPath(request.getRelativePath());
while (!parts.isEmpty()) {
String part = parts.removeFirst();
// Find a method by a name.
MethodDescriptor<?, ?> method = descriptor.getMethod(part);
if (method == null) {
throw RpcException.badRequest("Method is not found: " + part);
}
// Check the required HTTP method.
if (method.isPost() && !request.isPost()) {
throw RpcException.methodNotAllowed("Method not allowed, POST required");
}
// Parse arguments.
List<Object> args = readArgs(method, parts, request.getQuery(), request.getPost());
// Create a root invocation,
// or a next invocation in a chain.
invocation = invocation != null ? invocation.next(method, args.toArray())
: Invocation.root(method, args.toArray());
if (method.isTerminal()) {
break;
}
// It's an interface method.
// Get the next interface and proceed parsing the parts.
descriptor = (InterfaceDescriptor<?>) method.getResult();
}
if (!parts.isEmpty()) {
// No more interface descriptors in a chain, but the parts are still present.
throw RpcException.badRequest("Failed to parse an invocation chain");
}
if (invocation == null) {
throw RpcException.badRequest("Invocation chain required");
}
if (!invocation.getMethod().isTerminal()) {
throw RpcException.badRequest("The last method must be a terminal one. "
+ "It must return a data type or be void.");
}
return invocation;
}
|
[
"public",
"Invocation",
"getInvocation",
"(",
"final",
"RpcRequest",
"request",
",",
"InterfaceDescriptor",
"<",
"?",
">",
"descriptor",
")",
"{",
"if",
"(",
"request",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"request\"",
")",
";",
"if",
"(",
"descriptor",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"descriptor\"",
")",
";",
"Invocation",
"invocation",
"=",
"null",
";",
"LinkedList",
"<",
"String",
">",
"parts",
"=",
"splitPath",
"(",
"request",
".",
"getRelativePath",
"(",
")",
")",
";",
"while",
"(",
"!",
"parts",
".",
"isEmpty",
"(",
")",
")",
"{",
"String",
"part",
"=",
"parts",
".",
"removeFirst",
"(",
")",
";",
"// Find a method by a name.",
"MethodDescriptor",
"<",
"?",
",",
"?",
">",
"method",
"=",
"descriptor",
".",
"getMethod",
"(",
"part",
")",
";",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"throw",
"RpcException",
".",
"badRequest",
"(",
"\"Method is not found: \"",
"+",
"part",
")",
";",
"}",
"// Check the required HTTP method.",
"if",
"(",
"method",
".",
"isPost",
"(",
")",
"&&",
"!",
"request",
".",
"isPost",
"(",
")",
")",
"{",
"throw",
"RpcException",
".",
"methodNotAllowed",
"(",
"\"Method not allowed, POST required\"",
")",
";",
"}",
"// Parse arguments.",
"List",
"<",
"Object",
">",
"args",
"=",
"readArgs",
"(",
"method",
",",
"parts",
",",
"request",
".",
"getQuery",
"(",
")",
",",
"request",
".",
"getPost",
"(",
")",
")",
";",
"// Create a root invocation,",
"// or a next invocation in a chain.",
"invocation",
"=",
"invocation",
"!=",
"null",
"?",
"invocation",
".",
"next",
"(",
"method",
",",
"args",
".",
"toArray",
"(",
")",
")",
":",
"Invocation",
".",
"root",
"(",
"method",
",",
"args",
".",
"toArray",
"(",
")",
")",
";",
"if",
"(",
"method",
".",
"isTerminal",
"(",
")",
")",
"{",
"break",
";",
"}",
"// It's an interface method.",
"// Get the next interface and proceed parsing the parts.",
"descriptor",
"=",
"(",
"InterfaceDescriptor",
"<",
"?",
">",
")",
"method",
".",
"getResult",
"(",
")",
";",
"}",
"if",
"(",
"!",
"parts",
".",
"isEmpty",
"(",
")",
")",
"{",
"// No more interface descriptors in a chain, but the parts are still present.",
"throw",
"RpcException",
".",
"badRequest",
"(",
"\"Failed to parse an invocation chain\"",
")",
";",
"}",
"if",
"(",
"invocation",
"==",
"null",
")",
"{",
"throw",
"RpcException",
".",
"badRequest",
"(",
"\"Invocation chain required\"",
")",
";",
"}",
"if",
"(",
"!",
"invocation",
".",
"getMethod",
"(",
")",
".",
"isTerminal",
"(",
")",
")",
"{",
"throw",
"RpcException",
".",
"badRequest",
"(",
"\"The last method must be a terminal one. \"",
"+",
"\"It must return a data type or be void.\"",
")",
";",
"}",
"return",
"invocation",
";",
"}"
] |
Parses an invocation from an rpc request.
|
[
"Parses",
"an",
"invocation",
"from",
"an",
"rpc",
"request",
"."
] |
7776c44d1aab0f3dbf7267b0c32b8f9282fe6167
|
https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/rpc/RpcProtocol.java#L115-L167
|
156,255
|
pdef/pdef-java
|
pdef/src/main/java/io/pdef/rpc/RpcProtocol.java
|
RpcProtocol.fromJson
|
<V> V fromJson(final DataTypeDescriptor<V> descriptor, String value) {
if (value == null) {
return null;
}
TypeEnum type = descriptor.getType();
if (type == TypeEnum.STRING || type == TypeEnum.DATETIME || type == TypeEnum.ENUM) {
if (!value.startsWith("\"") && !value.endsWith("\"")) {
// Return the quotes to parse a value as valid json strings.
value = "\"" + value + "\"";
}
}
return format.read(value, descriptor);
}
|
java
|
<V> V fromJson(final DataTypeDescriptor<V> descriptor, String value) {
if (value == null) {
return null;
}
TypeEnum type = descriptor.getType();
if (type == TypeEnum.STRING || type == TypeEnum.DATETIME || type == TypeEnum.ENUM) {
if (!value.startsWith("\"") && !value.endsWith("\"")) {
// Return the quotes to parse a value as valid json strings.
value = "\"" + value + "\"";
}
}
return format.read(value, descriptor);
}
|
[
"<",
"V",
">",
"V",
"fromJson",
"(",
"final",
"DataTypeDescriptor",
"<",
"V",
">",
"descriptor",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"TypeEnum",
"type",
"=",
"descriptor",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"==",
"TypeEnum",
".",
"STRING",
"||",
"type",
"==",
"TypeEnum",
".",
"DATETIME",
"||",
"type",
"==",
"TypeEnum",
".",
"ENUM",
")",
"{",
"if",
"(",
"!",
"value",
".",
"startsWith",
"(",
"\"\\\"\"",
")",
"&&",
"!",
"value",
".",
"endsWith",
"(",
"\"\\\"\"",
")",
")",
"{",
"// Return the quotes to parse a value as valid json strings.",
"value",
"=",
"\"\\\"\"",
"+",
"value",
"+",
"\"\\\"\"",
";",
"}",
"}",
"return",
"format",
".",
"read",
"(",
"value",
",",
"descriptor",
")",
";",
"}"
] |
Parses an argument from an unquoted JSON string.
|
[
"Parses",
"an",
"argument",
"from",
"an",
"unquoted",
"JSON",
"string",
"."
] |
7776c44d1aab0f3dbf7267b0c32b8f9282fe6167
|
https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/rpc/RpcProtocol.java#L220-L234
|
156,256
|
pdef/pdef-java
|
pdef/src/main/java/io/pdef/rpc/RpcProtocol.java
|
RpcProtocol.urlencode
|
static String urlencode(final String s) {
try {
return URLEncoder.encode(s, CHARSET_NAME);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
|
java
|
static String urlencode(final String s) {
try {
return URLEncoder.encode(s, CHARSET_NAME);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
|
[
"static",
"String",
"urlencode",
"(",
"final",
"String",
"s",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"s",
",",
"CHARSET_NAME",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Url-encodes a string.
|
[
"Url",
"-",
"encodes",
"a",
"string",
"."
] |
7776c44d1aab0f3dbf7267b0c32b8f9282fe6167
|
https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/rpc/RpcProtocol.java#L237-L243
|
156,257
|
pdef/pdef-java
|
pdef/src/main/java/io/pdef/rpc/RpcProtocol.java
|
RpcProtocol.urldecode
|
static String urldecode(final String s) {
try {
return URLDecoder.decode(s, CHARSET_NAME);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
|
java
|
static String urldecode(final String s) {
try {
return URLDecoder.decode(s, CHARSET_NAME);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
|
[
"static",
"String",
"urldecode",
"(",
"final",
"String",
"s",
")",
"{",
"try",
"{",
"return",
"URLDecoder",
".",
"decode",
"(",
"s",
",",
"CHARSET_NAME",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Url-decodes a string.
|
[
"Url",
"-",
"decodes",
"a",
"string",
"."
] |
7776c44d1aab0f3dbf7267b0c32b8f9282fe6167
|
https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/rpc/RpcProtocol.java#L246-L252
|
156,258
|
tiesebarrell/process-assertions
|
process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java
|
MessageLogger.getMessage
|
public String getMessage(final String messageKey, final Object... objects) {
//TODO validate input
return getFormattedMessage(getMessagePattern(messageKey), objects);
}
|
java
|
public String getMessage(final String messageKey, final Object... objects) {
//TODO validate input
return getFormattedMessage(getMessagePattern(messageKey), objects);
}
|
[
"public",
"String",
"getMessage",
"(",
"final",
"String",
"messageKey",
",",
"final",
"Object",
"...",
"objects",
")",
"{",
"//TODO validate input",
"return",
"getFormattedMessage",
"(",
"getMessagePattern",
"(",
"messageKey",
")",
",",
"objects",
")",
";",
"}"
] |
Gets the message as defined by the provided messageKey and substitutes the provided object values in the message.
@param messageKey the key of the message pattern
@param objects the object values to substitute
@return the formatted message
|
[
"Gets",
"the",
"message",
"as",
"defined",
"by",
"the",
"provided",
"messageKey",
"and",
"substitutes",
"the",
"provided",
"object",
"values",
"in",
"the",
"message",
"."
] |
932a8443982e356cdf5a230165a35c725d9306ab
|
https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java#L88-L91
|
156,259
|
amlinv/registry-utils
|
src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java
|
ConcurrentRegistry.getListeners
|
public List<RegistryListener<K, V>> getListeners() {
return new LinkedList<RegistryListener<K, V>>(listeners);
}
|
java
|
public List<RegistryListener<K, V>> getListeners() {
return new LinkedList<RegistryListener<K, V>>(listeners);
}
|
[
"public",
"List",
"<",
"RegistryListener",
"<",
"K",
",",
"V",
">",
">",
"getListeners",
"(",
")",
"{",
"return",
"new",
"LinkedList",
"<",
"RegistryListener",
"<",
"K",
",",
"V",
">",
">",
"(",
"listeners",
")",
";",
"}"
] |
Retrieve a copy of the list of listeners to this registry.
@return a copy of the list of listeners.
|
[
"Retrieve",
"a",
"copy",
"of",
"the",
"list",
"of",
"listeners",
"to",
"this",
"registry",
"."
] |
784c455be38acb0df3a35c38afe60a516b8e4f32
|
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java#L73-L75
|
156,260
|
amlinv/registry-utils
|
src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java
|
ConcurrentRegistry.put
|
public V put (K putKey, V putValue) {
V oldValue = this.store.put(putKey, putValue);
if ( oldValue == null ) {
this.notificationExecutor.firePutNotification(this.listeners.iterator(), putKey, putValue);
} else {
this.notificationExecutor.fireReplaceNotification(this.listeners.iterator(), putKey, oldValue, putValue);
}
return oldValue;
}
|
java
|
public V put (K putKey, V putValue) {
V oldValue = this.store.put(putKey, putValue);
if ( oldValue == null ) {
this.notificationExecutor.firePutNotification(this.listeners.iterator(), putKey, putValue);
} else {
this.notificationExecutor.fireReplaceNotification(this.listeners.iterator(), putKey, oldValue, putValue);
}
return oldValue;
}
|
[
"public",
"V",
"put",
"(",
"K",
"putKey",
",",
"V",
"putValue",
")",
"{",
"V",
"oldValue",
"=",
"this",
".",
"store",
".",
"put",
"(",
"putKey",
",",
"putValue",
")",
";",
"if",
"(",
"oldValue",
"==",
"null",
")",
"{",
"this",
".",
"notificationExecutor",
".",
"firePutNotification",
"(",
"this",
".",
"listeners",
".",
"iterator",
"(",
")",
",",
"putKey",
",",
"putValue",
")",
";",
"}",
"else",
"{",
"this",
".",
"notificationExecutor",
".",
"fireReplaceNotification",
"(",
"this",
".",
"listeners",
".",
"iterator",
"(",
")",
",",
"putKey",
",",
"oldValue",
",",
"putValue",
")",
";",
"}",
"return",
"oldValue",
";",
"}"
] |
Put the given entry into the registry under the specified key.
@param putKey
@param putValue
@return
|
[
"Put",
"the",
"given",
"entry",
"into",
"the",
"registry",
"under",
"the",
"specified",
"key",
"."
] |
784c455be38acb0df3a35c38afe60a516b8e4f32
|
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java#L134-L144
|
156,261
|
amlinv/registry-utils
|
src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java
|
ConcurrentRegistry.putIfAbsent
|
public V putIfAbsent (K putKey, V putValue) {
V existingValue = this.store.putIfAbsent(putKey, putValue);
if ( existingValue == null ) {
this.notificationExecutor.firePutNotification(this.listeners.iterator(), putKey, putValue);
}
return existingValue;
}
|
java
|
public V putIfAbsent (K putKey, V putValue) {
V existingValue = this.store.putIfAbsent(putKey, putValue);
if ( existingValue == null ) {
this.notificationExecutor.firePutNotification(this.listeners.iterator(), putKey, putValue);
}
return existingValue;
}
|
[
"public",
"V",
"putIfAbsent",
"(",
"K",
"putKey",
",",
"V",
"putValue",
")",
"{",
"V",
"existingValue",
"=",
"this",
".",
"store",
".",
"putIfAbsent",
"(",
"putKey",
",",
"putValue",
")",
";",
"if",
"(",
"existingValue",
"==",
"null",
")",
"{",
"this",
".",
"notificationExecutor",
".",
"firePutNotification",
"(",
"this",
".",
"listeners",
".",
"iterator",
"(",
")",
",",
"putKey",
",",
"putValue",
")",
";",
"}",
"return",
"existingValue",
";",
"}"
] |
Add the given entry into the registry under the specified key, but only if the key is not already registered.
@param putKey key identifying the entry in the registry to add, if it does not already exist.
@param putValue value to add to the registry.
@return existing value in the registry if already defined; null if the new value is added to the registry.
|
[
"Add",
"the",
"given",
"entry",
"into",
"the",
"registry",
"under",
"the",
"specified",
"key",
"but",
"only",
"if",
"the",
"key",
"is",
"not",
"already",
"registered",
"."
] |
784c455be38acb0df3a35c38afe60a516b8e4f32
|
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java#L153-L161
|
156,262
|
amlinv/registry-utils
|
src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java
|
ConcurrentRegistry.remove
|
public V remove (K removeKey) {
V removedValue = this.store.remove(removeKey);
if ( removedValue != null ) {
this.notificationExecutor.fireRemoveNotification(this.listeners.iterator(), removeKey, removedValue);
}
return removedValue;
}
|
java
|
public V remove (K removeKey) {
V removedValue = this.store.remove(removeKey);
if ( removedValue != null ) {
this.notificationExecutor.fireRemoveNotification(this.listeners.iterator(), removeKey, removedValue);
}
return removedValue;
}
|
[
"public",
"V",
"remove",
"(",
"K",
"removeKey",
")",
"{",
"V",
"removedValue",
"=",
"this",
".",
"store",
".",
"remove",
"(",
"removeKey",
")",
";",
"if",
"(",
"removedValue",
"!=",
"null",
")",
"{",
"this",
".",
"notificationExecutor",
".",
"fireRemoveNotification",
"(",
"this",
".",
"listeners",
".",
"iterator",
"(",
")",
",",
"removeKey",
",",
"removedValue",
")",
";",
"}",
"return",
"removedValue",
";",
"}"
] |
Remove the given entry from the registry under the specified key.
@param removeKey key of the entry to be removed.
@return value of the removed entry; null if no value was removed.
|
[
"Remove",
"the",
"given",
"entry",
"from",
"the",
"registry",
"under",
"the",
"specified",
"key",
"."
] |
784c455be38acb0df3a35c38afe60a516b8e4f32
|
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java#L169-L177
|
156,263
|
amlinv/registry-utils
|
src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java
|
ConcurrentRegistry.remove
|
public boolean remove (K removeKey, V removeValue) {
boolean removedInd = this.store.remove(removeKey, removeValue);
if ( removedInd ) {
this.notificationExecutor.fireRemoveNotification(this.listeners.iterator(), removeKey, removeValue);
}
return removedInd;
}
|
java
|
public boolean remove (K removeKey, V removeValue) {
boolean removedInd = this.store.remove(removeKey, removeValue);
if ( removedInd ) {
this.notificationExecutor.fireRemoveNotification(this.listeners.iterator(), removeKey, removeValue);
}
return removedInd;
}
|
[
"public",
"boolean",
"remove",
"(",
"K",
"removeKey",
",",
"V",
"removeValue",
")",
"{",
"boolean",
"removedInd",
"=",
"this",
".",
"store",
".",
"remove",
"(",
"removeKey",
",",
"removeValue",
")",
";",
"if",
"(",
"removedInd",
")",
"{",
"this",
".",
"notificationExecutor",
".",
"fireRemoveNotification",
"(",
"this",
".",
"listeners",
".",
"iterator",
"(",
")",
",",
"removeKey",
",",
"removeValue",
")",
";",
"}",
"return",
"removedInd",
";",
"}"
] |
Remove the given entry from the registry under the specified key, only if the value matches the one given.
@param removeKey key of the entry to be removed.
@param removeValue value of the entry to be removed.
@return true => if the value was removed; false => otherwise.
|
[
"Remove",
"the",
"given",
"entry",
"from",
"the",
"registry",
"under",
"the",
"specified",
"key",
"only",
"if",
"the",
"value",
"matches",
"the",
"one",
"given",
"."
] |
784c455be38acb0df3a35c38afe60a516b8e4f32
|
https://github.com/amlinv/registry-utils/blob/784c455be38acb0df3a35c38afe60a516b8e4f32/src/main/java/com/amlinv/registry/util/ConcurrentRegistry.java#L186-L194
|
156,264
|
clanie/clanie-core
|
src/main/java/dk/clanie/properties/TemporalProperty.java
|
TemporalProperty.set
|
void set(Instant effectiveFrom, T value) {
T oldValue = get();
values.put(effectiveFrom, value);
notifyListeners(oldValue, value);
}
|
java
|
void set(Instant effectiveFrom, T value) {
T oldValue = get();
values.put(effectiveFrom, value);
notifyListeners(oldValue, value);
}
|
[
"void",
"set",
"(",
"Instant",
"effectiveFrom",
",",
"T",
"value",
")",
"{",
"T",
"oldValue",
"=",
"get",
"(",
")",
";",
"values",
".",
"put",
"(",
"effectiveFrom",
",",
"value",
")",
";",
"notifyListeners",
"(",
"oldValue",
",",
"value",
")",
";",
"}"
] |
Sets the value of the property at the specified time.
For internal and test use only.<p/>
Values are assumed to be set in chronological order.
@param effectiveFrom
@param value
|
[
"Sets",
"the",
"value",
"of",
"the",
"property",
"at",
"the",
"specified",
"time",
"."
] |
ac8a655b93127f0e281b741c4d53f429be2816ad
|
https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/properties/TemporalProperty.java#L63-L67
|
156,265
|
clanie/clanie-core
|
src/main/java/dk/clanie/properties/TemporalProperty.java
|
TemporalProperty.purge
|
public void purge(Instant limit) {
Instant firstKeeper = values.floorKey(limit);
if (firstKeeper == null) return;
Set<Instant> purgables = values.headMap(firstKeeper).keySet();
if (purgables == null) return;
for (Instant purgable : purgables) {
values.remove(purgable);
}
}
|
java
|
public void purge(Instant limit) {
Instant firstKeeper = values.floorKey(limit);
if (firstKeeper == null) return;
Set<Instant> purgables = values.headMap(firstKeeper).keySet();
if (purgables == null) return;
for (Instant purgable : purgables) {
values.remove(purgable);
}
}
|
[
"public",
"void",
"purge",
"(",
"Instant",
"limit",
")",
"{",
"Instant",
"firstKeeper",
"=",
"values",
".",
"floorKey",
"(",
"limit",
")",
";",
"if",
"(",
"firstKeeper",
"==",
"null",
")",
"return",
";",
"Set",
"<",
"Instant",
">",
"purgables",
"=",
"values",
".",
"headMap",
"(",
"firstKeeper",
")",
".",
"keySet",
"(",
")",
";",
"if",
"(",
"purgables",
"==",
"null",
")",
"return",
";",
"for",
"(",
"Instant",
"purgable",
":",
"purgables",
")",
"{",
"values",
".",
"remove",
"(",
"purgable",
")",
";",
"}",
"}"
] |
Removes values no longer in effect at the specified point in time.
@param limit
|
[
"Removes",
"values",
"no",
"longer",
"in",
"effect",
"at",
"the",
"specified",
"point",
"in",
"time",
"."
] |
ac8a655b93127f0e281b741c4d53f429be2816ad
|
https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/properties/TemporalProperty.java#L96-L104
|
156,266
|
adamfisk/littleshoot-util
|
src/main/java/org/littleshoot/util/JmxUtils.java
|
JmxUtils.register
|
public static void register(final MBeanServer mbs, final Object obj)
{
final ObjectName mBeanName = JmxUtils.getObjectName(obj.getClass());
try
{
mbs.registerMBean(obj, mBeanName);
}
catch (final InstanceAlreadyExistsException e)
{
LOG.error("Could not start JMX", e);
}
catch (final MBeanRegistrationException e)
{
LOG.error("Could not register", e);
}
catch (final NotCompliantMBeanException e)
{
LOG.error("MBean error", e);
}
}
|
java
|
public static void register(final MBeanServer mbs, final Object obj)
{
final ObjectName mBeanName = JmxUtils.getObjectName(obj.getClass());
try
{
mbs.registerMBean(obj, mBeanName);
}
catch (final InstanceAlreadyExistsException e)
{
LOG.error("Could not start JMX", e);
}
catch (final MBeanRegistrationException e)
{
LOG.error("Could not register", e);
}
catch (final NotCompliantMBeanException e)
{
LOG.error("MBean error", e);
}
}
|
[
"public",
"static",
"void",
"register",
"(",
"final",
"MBeanServer",
"mbs",
",",
"final",
"Object",
"obj",
")",
"{",
"final",
"ObjectName",
"mBeanName",
"=",
"JmxUtils",
".",
"getObjectName",
"(",
"obj",
".",
"getClass",
"(",
")",
")",
";",
"try",
"{",
"mbs",
".",
"registerMBean",
"(",
"obj",
",",
"mBeanName",
")",
";",
"}",
"catch",
"(",
"final",
"InstanceAlreadyExistsException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not start JMX\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"MBeanRegistrationException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not register\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"NotCompliantMBeanException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"MBean error\"",
",",
"e",
")",
";",
"}",
"}"
] |
Registers the specified object as an MBean with the specified server
using standard conventions for the bean name.
@param mbs The {@link MBeanServer} to register with.
@param obj The {@link Object} to register as an MBean.
|
[
"Registers",
"the",
"specified",
"object",
"as",
"an",
"MBean",
"with",
"the",
"specified",
"server",
"using",
"standard",
"conventions",
"for",
"the",
"bean",
"name",
"."
] |
3c0dc4955116b3382d6b0575d2f164b7508a4f73
|
https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/JmxUtils.java#L59-L78
|
156,267
|
lotaris/rox-client-java
|
rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java
|
Configuration.getUid
|
public String getUid(String category, String projectName, String projectVersion, boolean force) {
String uid = null;
if (!force) {
uid = readUid(new File(uidDirectory, "latest"));
}
// Check if the UID was already used for the ROX client and projec/version
if (uid != null && uidAlreadyUsed(category, projectName, uid)) {
uid = null;
}
// Generate UID and store it
if (uid == null) {
uid = generateUid();
writeUid(new File(uidDirectory, "latest"), uid);
}
writeUid(getUidFile(category, projectName, projectVersion), uid);
return uid;
}
|
java
|
public String getUid(String category, String projectName, String projectVersion, boolean force) {
String uid = null;
if (!force) {
uid = readUid(new File(uidDirectory, "latest"));
}
// Check if the UID was already used for the ROX client and projec/version
if (uid != null && uidAlreadyUsed(category, projectName, uid)) {
uid = null;
}
// Generate UID and store it
if (uid == null) {
uid = generateUid();
writeUid(new File(uidDirectory, "latest"), uid);
}
writeUid(getUidFile(category, projectName, projectVersion), uid);
return uid;
}
|
[
"public",
"String",
"getUid",
"(",
"String",
"category",
",",
"String",
"projectName",
",",
"String",
"projectVersion",
",",
"boolean",
"force",
")",
"{",
"String",
"uid",
"=",
"null",
";",
"if",
"(",
"!",
"force",
")",
"{",
"uid",
"=",
"readUid",
"(",
"new",
"File",
"(",
"uidDirectory",
",",
"\"latest\"",
")",
")",
";",
"}",
"// Check if the UID was already used for the ROX client and projec/version",
"if",
"(",
"uid",
"!=",
"null",
"&&",
"uidAlreadyUsed",
"(",
"category",
",",
"projectName",
",",
"uid",
")",
")",
"{",
"uid",
"=",
"null",
";",
"}",
"// Generate UID and store it",
"if",
"(",
"uid",
"==",
"null",
")",
"{",
"uid",
"=",
"generateUid",
"(",
")",
";",
"writeUid",
"(",
"new",
"File",
"(",
"uidDirectory",
",",
"\"latest\"",
")",
",",
"uid",
")",
";",
"}",
"writeUid",
"(",
"getUidFile",
"(",
"category",
",",
"projectName",
",",
"projectVersion",
")",
",",
"uid",
")",
";",
"return",
"uid",
";",
"}"
] |
Generate a UID or retrieve the latest if it is valid depending the context given
by the category, project name and project version
@param category The category
@param projectName The project name
@param projectVersion The project version
@param force Force the generation of a new UID
@return The valid UID
|
[
"Generate",
"a",
"UID",
"or",
"retrieve",
"the",
"latest",
"if",
"it",
"is",
"valid",
"depending",
"the",
"context",
"given",
"by",
"the",
"category",
"project",
"name",
"and",
"project",
"version"
] |
1b33f7560347c382c59a40c4037d175ab8127fde
|
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java#L422-L443
|
156,268
|
lotaris/rox-client-java
|
rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java
|
Configuration.writeUid
|
private void writeUid(File uidFile, String uid) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(uidFile));
bw.write(uid);
}
catch (IOException ioe) {}
finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } }
}
|
java
|
private void writeUid(File uidFile, String uid) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(uidFile));
bw.write(uid);
}
catch (IOException ioe) {}
finally { if (bw != null) { try { bw.close(); } catch (IOException ioe) {} } }
}
|
[
"private",
"void",
"writeUid",
"(",
"File",
"uidFile",
",",
"String",
"uid",
")",
"{",
"BufferedWriter",
"bw",
"=",
"null",
";",
"try",
"{",
"bw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"uidFile",
")",
")",
";",
"bw",
".",
"write",
"(",
"uid",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"bw",
"!=",
"null",
")",
"{",
"try",
"{",
"bw",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"}",
"}",
"}",
"}"
] |
Write a UID file
@param uidFile The UID file to write
@param uid The UID to write to the file
|
[
"Write",
"a",
"UID",
"file"
] |
1b33f7560347c382c59a40c4037d175ab8127fde
|
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java#L489-L497
|
156,269
|
lotaris/rox-client-java
|
rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java
|
Configuration.uidAlreadyUsed
|
private boolean uidAlreadyUsed(String category, String projectName, String uid) {
if (uid == null) {
return false;
}
else {
for (File versionDirectory : getUidFilesForProject(category, projectName)) {
String uidRead = readUid(new File(versionDirectory, "latest"));
if (uidRead != null && !uidRead.isEmpty()) {
if (uidRead.equals(uid)) {
return true;
}
}
}
return false;
}
}
|
java
|
private boolean uidAlreadyUsed(String category, String projectName, String uid) {
if (uid == null) {
return false;
}
else {
for (File versionDirectory : getUidFilesForProject(category, projectName)) {
String uidRead = readUid(new File(versionDirectory, "latest"));
if (uidRead != null && !uidRead.isEmpty()) {
if (uidRead.equals(uid)) {
return true;
}
}
}
return false;
}
}
|
[
"private",
"boolean",
"uidAlreadyUsed",
"(",
"String",
"category",
",",
"String",
"projectName",
",",
"String",
"uid",
")",
"{",
"if",
"(",
"uid",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"for",
"(",
"File",
"versionDirectory",
":",
"getUidFilesForProject",
"(",
"category",
",",
"projectName",
")",
")",
"{",
"String",
"uidRead",
"=",
"readUid",
"(",
"new",
"File",
"(",
"versionDirectory",
",",
"\"latest\"",
")",
")",
";",
"if",
"(",
"uidRead",
"!=",
"null",
"&&",
"!",
"uidRead",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"uidRead",
".",
"equals",
"(",
"uid",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}",
"}"
] |
Check if a UID was already used in any context
@param category The category to check
@param projectName The project name to check
@param uid The UID to validate
@return True if the UID is present for at least one version of a project in a category, false otherwise
|
[
"Check",
"if",
"a",
"UID",
"was",
"already",
"used",
"in",
"any",
"context"
] |
1b33f7560347c382c59a40c4037d175ab8127fde
|
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java#L507-L525
|
156,270
|
lotaris/rox-client-java
|
rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java
|
Configuration.getUidFilesForProject
|
private List<File> getUidFilesForProject(String category, String projectName) {
// Check that the category directory exists
File categoryDirectory = new File(uidDirectory, category);
if (!categoryDirectory.exists() || (categoryDirectory.exists() && categoryDirectory.isFile())) {
return new ArrayList<>();
}
// Check that the project directory exists
File projectDirectory = new File(categoryDirectory, projectName);
if (!projectDirectory.exists() || (projectDirectory.exists() && projectDirectory.isFile())) {
return new ArrayList<>();
}
// Get all the version directories
List<File> versionDirectories = new ArrayList<>();
for (File electableDirectory : projectDirectory.listFiles()) {
if (electableDirectory.isDirectory()) {
versionDirectories.add(electableDirectory);
}
}
return versionDirectories;
}
|
java
|
private List<File> getUidFilesForProject(String category, String projectName) {
// Check that the category directory exists
File categoryDirectory = new File(uidDirectory, category);
if (!categoryDirectory.exists() || (categoryDirectory.exists() && categoryDirectory.isFile())) {
return new ArrayList<>();
}
// Check that the project directory exists
File projectDirectory = new File(categoryDirectory, projectName);
if (!projectDirectory.exists() || (projectDirectory.exists() && projectDirectory.isFile())) {
return new ArrayList<>();
}
// Get all the version directories
List<File> versionDirectories = new ArrayList<>();
for (File electableDirectory : projectDirectory.listFiles()) {
if (electableDirectory.isDirectory()) {
versionDirectories.add(electableDirectory);
}
}
return versionDirectories;
}
|
[
"private",
"List",
"<",
"File",
">",
"getUidFilesForProject",
"(",
"String",
"category",
",",
"String",
"projectName",
")",
"{",
"// Check that the category directory exists",
"File",
"categoryDirectory",
"=",
"new",
"File",
"(",
"uidDirectory",
",",
"category",
")",
";",
"if",
"(",
"!",
"categoryDirectory",
".",
"exists",
"(",
")",
"||",
"(",
"categoryDirectory",
".",
"exists",
"(",
")",
"&&",
"categoryDirectory",
".",
"isFile",
"(",
")",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"// Check that the project directory exists",
"File",
"projectDirectory",
"=",
"new",
"File",
"(",
"categoryDirectory",
",",
"projectName",
")",
";",
"if",
"(",
"!",
"projectDirectory",
".",
"exists",
"(",
")",
"||",
"(",
"projectDirectory",
".",
"exists",
"(",
")",
"&&",
"projectDirectory",
".",
"isFile",
"(",
")",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"// Get all the version directories",
"List",
"<",
"File",
">",
"versionDirectories",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"File",
"electableDirectory",
":",
"projectDirectory",
".",
"listFiles",
"(",
")",
")",
"{",
"if",
"(",
"electableDirectory",
".",
"isDirectory",
"(",
")",
")",
"{",
"versionDirectories",
".",
"add",
"(",
"electableDirectory",
")",
";",
"}",
"}",
"return",
"versionDirectories",
";",
"}"
] |
Retrieve the list of the version directories for the project
@param category The category
@param projectName The project name
@return The list of version directories or empty list if none are present
|
[
"Retrieve",
"the",
"list",
"of",
"the",
"version",
"directories",
"for",
"the",
"project"
] |
1b33f7560347c382c59a40c4037d175ab8127fde
|
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java#L534-L556
|
156,271
|
lotaris/rox-client-java
|
rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java
|
Configuration.getUidFile
|
private File getUidFile(String category, String projectName, String projectVersion) {
// Check that the category directory exists
File categoryDirectory = new File(uidDirectory, category);
if (categoryDirectory.exists() && categoryDirectory.isFile()) {
throw new IllegalArgumentException("The category file for the UID storage is not a directory");
}
else if (!categoryDirectory.exists()) {
categoryDirectory.mkdir();
}
// Check that the project directory exists
File projectDirectory = new File(categoryDirectory, projectName);
if (projectDirectory.exists() && projectDirectory.isFile()) {
throw new IllegalArgumentException("The project file for the UID store is not a directory");
}
else if (!projectDirectory.exists()) {
projectDirectory.mkdir();
}
// Check that the version directory exists
File versionDirectory = new File(projectDirectory, projectVersion);
if (versionDirectory.exists() && versionDirectory.isFile()) {
throw new IllegalArgumentException("The version file for the UID store is not a directory");
}
else if (!versionDirectory.exists()) {
versionDirectory.mkdir();
}
return new File(versionDirectory, "latest");
}
|
java
|
private File getUidFile(String category, String projectName, String projectVersion) {
// Check that the category directory exists
File categoryDirectory = new File(uidDirectory, category);
if (categoryDirectory.exists() && categoryDirectory.isFile()) {
throw new IllegalArgumentException("The category file for the UID storage is not a directory");
}
else if (!categoryDirectory.exists()) {
categoryDirectory.mkdir();
}
// Check that the project directory exists
File projectDirectory = new File(categoryDirectory, projectName);
if (projectDirectory.exists() && projectDirectory.isFile()) {
throw new IllegalArgumentException("The project file for the UID store is not a directory");
}
else if (!projectDirectory.exists()) {
projectDirectory.mkdir();
}
// Check that the version directory exists
File versionDirectory = new File(projectDirectory, projectVersion);
if (versionDirectory.exists() && versionDirectory.isFile()) {
throw new IllegalArgumentException("The version file for the UID store is not a directory");
}
else if (!versionDirectory.exists()) {
versionDirectory.mkdir();
}
return new File(versionDirectory, "latest");
}
|
[
"private",
"File",
"getUidFile",
"(",
"String",
"category",
",",
"String",
"projectName",
",",
"String",
"projectVersion",
")",
"{",
"// Check that the category directory exists",
"File",
"categoryDirectory",
"=",
"new",
"File",
"(",
"uidDirectory",
",",
"category",
")",
";",
"if",
"(",
"categoryDirectory",
".",
"exists",
"(",
")",
"&&",
"categoryDirectory",
".",
"isFile",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The category file for the UID storage is not a directory\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"categoryDirectory",
".",
"exists",
"(",
")",
")",
"{",
"categoryDirectory",
".",
"mkdir",
"(",
")",
";",
"}",
"// Check that the project directory exists",
"File",
"projectDirectory",
"=",
"new",
"File",
"(",
"categoryDirectory",
",",
"projectName",
")",
";",
"if",
"(",
"projectDirectory",
".",
"exists",
"(",
")",
"&&",
"projectDirectory",
".",
"isFile",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The project file for the UID store is not a directory\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"projectDirectory",
".",
"exists",
"(",
")",
")",
"{",
"projectDirectory",
".",
"mkdir",
"(",
")",
";",
"}",
"// Check that the version directory exists",
"File",
"versionDirectory",
"=",
"new",
"File",
"(",
"projectDirectory",
",",
"projectVersion",
")",
";",
"if",
"(",
"versionDirectory",
".",
"exists",
"(",
")",
"&&",
"versionDirectory",
".",
"isFile",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The version file for the UID store is not a directory\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"versionDirectory",
".",
"exists",
"(",
")",
")",
"{",
"versionDirectory",
".",
"mkdir",
"(",
")",
";",
"}",
"return",
"new",
"File",
"(",
"versionDirectory",
",",
"\"latest\"",
")",
";",
"}"
] |
Get the UID file regarding the category, project name and project version
@param category The category
@param projectName The project name
@param projectVersion The project version
@return The UID file
|
[
"Get",
"the",
"UID",
"file",
"regarding",
"the",
"category",
"project",
"name",
"and",
"project",
"version"
] |
1b33f7560347c382c59a40c4037d175ab8127fde
|
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/common/config/Configuration.java#L566-L595
|
156,272
|
banjocreek/java-builder
|
src/main/java/com/banjocreek/riverbed/builder/map/AbstractImmutableMapBuilder.java
|
AbstractImmutableMapBuilder.genRemove
|
protected final MapDelta<K, V> genRemove(final Collection<K> toRemove) {
return toRemove.isEmpty() ? Nop.instance() : new Remove<>(toRemove);
}
|
java
|
protected final MapDelta<K, V> genRemove(final Collection<K> toRemove) {
return toRemove.isEmpty() ? Nop.instance() : new Remove<>(toRemove);
}
|
[
"protected",
"final",
"MapDelta",
"<",
"K",
",",
"V",
">",
"genRemove",
"(",
"final",
"Collection",
"<",
"K",
">",
"toRemove",
")",
"{",
"return",
"toRemove",
".",
"isEmpty",
"(",
")",
"?",
"Nop",
".",
"instance",
"(",
")",
":",
"new",
"Remove",
"<>",
"(",
"toRemove",
")",
";",
"}"
] |
Create a delta consisting of items to remove.
@param toRemove
collection of items to remove.
@return delta
|
[
"Create",
"a",
"delta",
"consisting",
"of",
"items",
"to",
"remove",
"."
] |
4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81
|
https://github.com/banjocreek/java-builder/blob/4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81/src/main/java/com/banjocreek/riverbed/builder/map/AbstractImmutableMapBuilder.java#L90-L92
|
156,273
|
banjocreek/java-builder
|
src/main/java/com/banjocreek/riverbed/builder/map/AbstractImmutableMapBuilder.java
|
AbstractImmutableMapBuilder.genUpdates
|
protected final MapDelta<K, V> genUpdates(final K key,
final Function<? super V, ? extends V> mutate) {
return new Update<>(key, mutate);
}
|
java
|
protected final MapDelta<K, V> genUpdates(final K key,
final Function<? super V, ? extends V> mutate) {
return new Update<>(key, mutate);
}
|
[
"protected",
"final",
"MapDelta",
"<",
"K",
",",
"V",
">",
"genUpdates",
"(",
"final",
"K",
"key",
",",
"final",
"Function",
"<",
"?",
"super",
"V",
",",
"?",
"extends",
"V",
">",
"mutate",
")",
"{",
"return",
"new",
"Update",
"<>",
"(",
"key",
",",
"mutate",
")",
";",
"}"
] |
Create a delta consisting of a single update.
@param key
key of entry to update.
@param mutate
mutation specification.
|
[
"Create",
"a",
"delta",
"consisting",
"of",
"a",
"single",
"update",
"."
] |
4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81
|
https://github.com/banjocreek/java-builder/blob/4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81/src/main/java/com/banjocreek/riverbed/builder/map/AbstractImmutableMapBuilder.java#L149-L152
|
156,274
|
banjocreek/java-builder
|
src/main/java/com/banjocreek/riverbed/builder/map/AbstractImmutableMapBuilder.java
|
AbstractImmutableMapBuilder.genUpdates
|
protected final MapDelta<K, V> genUpdates(
final Map<K, Function<? super V, ? extends V>> mutators) {
return mutators.isEmpty() ? Nop.instance() : new Update<>(mutators);
}
|
java
|
protected final MapDelta<K, V> genUpdates(
final Map<K, Function<? super V, ? extends V>> mutators) {
return mutators.isEmpty() ? Nop.instance() : new Update<>(mutators);
}
|
[
"protected",
"final",
"MapDelta",
"<",
"K",
",",
"V",
">",
"genUpdates",
"(",
"final",
"Map",
"<",
"K",
",",
"Function",
"<",
"?",
"super",
"V",
",",
"?",
"extends",
"V",
">",
">",
"mutators",
")",
"{",
"return",
"mutators",
".",
"isEmpty",
"(",
")",
"?",
"Nop",
".",
"instance",
"(",
")",
":",
"new",
"Update",
"<>",
"(",
"mutators",
")",
";",
"}"
] |
Create a delta consisting of updates.
@param mutators
mutations to apply
|
[
"Create",
"a",
"delta",
"consisting",
"of",
"updates",
"."
] |
4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81
|
https://github.com/banjocreek/java-builder/blob/4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81/src/main/java/com/banjocreek/riverbed/builder/map/AbstractImmutableMapBuilder.java#L160-L163
|
156,275
|
UW-Madison-DoIT/datalist-portlet-utils
|
datalist-portlet-utils/src/main/java/edu/wisc/web/security/portlet/primaryattr/PrimaryAttributePortletPreAuthenticatedAuthenticationDetailsSource.java
|
PrimaryAttributePortletPreAuthenticatedAuthenticationDetailsSource.getPrimaryUserAttribute
|
protected final String getPrimaryUserAttribute(PortletRequest request) {
final PortletPreferences preferences = request.getPreferences();
@SuppressWarnings("unchecked")
final Map<String, String> userAttributes = (Map<String, String>)request.getAttribute(PortletRequest.USER_INFO);
final String[] attributeNames = preferences.getValues(primaryUserAttributesPreference, new String[0]);
for (final String attributeName : attributeNames) {
final String emplid = userAttributes.get(attributeName);
if (StringUtils.isNotEmpty(emplid)) {
if (logger.isDebugEnabled()) {
logger.debug("Found emplid '" + emplid + "' for under attribute: " + attributeName);
}
return emplid;
}
}
logger.warn("Could not find a value for any of the user attributes " + Arrays.toString(attributeNames) + " specified by preference: " + primaryUserAttributesPreference);
throw new AccessDeniedException("No primary attribute found in attributes: " + Arrays.toString(attributeNames));
}
|
java
|
protected final String getPrimaryUserAttribute(PortletRequest request) {
final PortletPreferences preferences = request.getPreferences();
@SuppressWarnings("unchecked")
final Map<String, String> userAttributes = (Map<String, String>)request.getAttribute(PortletRequest.USER_INFO);
final String[] attributeNames = preferences.getValues(primaryUserAttributesPreference, new String[0]);
for (final String attributeName : attributeNames) {
final String emplid = userAttributes.get(attributeName);
if (StringUtils.isNotEmpty(emplid)) {
if (logger.isDebugEnabled()) {
logger.debug("Found emplid '" + emplid + "' for under attribute: " + attributeName);
}
return emplid;
}
}
logger.warn("Could not find a value for any of the user attributes " + Arrays.toString(attributeNames) + " specified by preference: " + primaryUserAttributesPreference);
throw new AccessDeniedException("No primary attribute found in attributes: " + Arrays.toString(attributeNames));
}
|
[
"protected",
"final",
"String",
"getPrimaryUserAttribute",
"(",
"PortletRequest",
"request",
")",
"{",
"final",
"PortletPreferences",
"preferences",
"=",
"request",
".",
"getPreferences",
"(",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"userAttributes",
"=",
"(",
"Map",
"<",
"String",
",",
"String",
">",
")",
"request",
".",
"getAttribute",
"(",
"PortletRequest",
".",
"USER_INFO",
")",
";",
"final",
"String",
"[",
"]",
"attributeNames",
"=",
"preferences",
".",
"getValues",
"(",
"primaryUserAttributesPreference",
",",
"new",
"String",
"[",
"0",
"]",
")",
";",
"for",
"(",
"final",
"String",
"attributeName",
":",
"attributeNames",
")",
"{",
"final",
"String",
"emplid",
"=",
"userAttributes",
".",
"get",
"(",
"attributeName",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"emplid",
")",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Found emplid '\"",
"+",
"emplid",
"+",
"\"' for under attribute: \"",
"+",
"attributeName",
")",
";",
"}",
"return",
"emplid",
";",
"}",
"}",
"logger",
".",
"warn",
"(",
"\"Could not find a value for any of the user attributes \"",
"+",
"Arrays",
".",
"toString",
"(",
"attributeNames",
")",
"+",
"\" specified by preference: \"",
"+",
"primaryUserAttributesPreference",
")",
";",
"throw",
"new",
"AccessDeniedException",
"(",
"\"No primary attribute found in attributes: \"",
"+",
"Arrays",
".",
"toString",
"(",
"attributeNames",
")",
")",
";",
"}"
] |
Get the user's primary attribute.
@param primaryUserAttributesPreference The portlet preference that contains a list of user attributes to inspect in order. The first attribute with a value is returned.
@return The primary attribute, will never return null or empty string
@throws ModelAndViewDefiningException If no emplid is found
|
[
"Get",
"the",
"user",
"s",
"primary",
"attribute",
"."
] |
7a8f762442a0d390dea8f4e28ad59c4300fb33ff
|
https://github.com/UW-Madison-DoIT/datalist-portlet-utils/blob/7a8f762442a0d390dea8f4e28ad59c4300fb33ff/datalist-portlet-utils/src/main/java/edu/wisc/web/security/portlet/primaryattr/PrimaryAttributePortletPreAuthenticatedAuthenticationDetailsSource.java#L80-L100
|
156,276
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.getScheme
|
public static String getScheme(final URI uri) throws NormalizationException {
final String scheme = Strings.emptyToNull(uri.getScheme());
if (scheme == null && hasPort(uri)) {
return NetProtocol.find(getPort(uri), DEFAULT_PROTOCOL).getScheme();
} else if (scheme == null) {
return DEFAULT_PROTOCOL.getScheme();
}
return scheme;
}
|
java
|
public static String getScheme(final URI uri) throws NormalizationException {
final String scheme = Strings.emptyToNull(uri.getScheme());
if (scheme == null && hasPort(uri)) {
return NetProtocol.find(getPort(uri), DEFAULT_PROTOCOL).getScheme();
} else if (scheme == null) {
return DEFAULT_PROTOCOL.getScheme();
}
return scheme;
}
|
[
"public",
"static",
"String",
"getScheme",
"(",
"final",
"URI",
"uri",
")",
"throws",
"NormalizationException",
"{",
"final",
"String",
"scheme",
"=",
"Strings",
".",
"emptyToNull",
"(",
"uri",
".",
"getScheme",
"(",
")",
")",
";",
"if",
"(",
"scheme",
"==",
"null",
"&&",
"hasPort",
"(",
"uri",
")",
")",
"{",
"return",
"NetProtocol",
".",
"find",
"(",
"getPort",
"(",
"uri",
")",
",",
"DEFAULT_PROTOCOL",
")",
".",
"getScheme",
"(",
")",
";",
"}",
"else",
"if",
"(",
"scheme",
"==",
"null",
")",
"{",
"return",
"DEFAULT_PROTOCOL",
".",
"getScheme",
"(",
")",
";",
"}",
"return",
"scheme",
";",
"}"
] |
Returns the scheme of the given URI or the scheme of the URI's port if there is a port. If there is no default,
then the scheme of the default protocol is returned.
@param uri the URI to extract the scheme from
@return the scheme of the URI or the default protocol (http)
@throws NormalizationException if we tried to get the scheme based off of port, and we couldn't get the port
|
[
"Returns",
"the",
"scheme",
"of",
"the",
"given",
"URI",
"or",
"the",
"scheme",
"of",
"the",
"URI",
"s",
"port",
"if",
"there",
"is",
"a",
"port",
".",
"If",
"there",
"is",
"no",
"default",
"then",
"the",
"scheme",
"of",
"the",
"default",
"protocol",
"is",
"returned",
"."
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L40-L48
|
156,277
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.getHost
|
public static String getHost(final URI uri) throws NormalizationException {
final String host = Strings.emptyToNull(uri.getHost());
if (host == null) {
throw new NormalizationException(uri.toString(), "No host in URI");
}
return host;
}
|
java
|
public static String getHost(final URI uri) throws NormalizationException {
final String host = Strings.emptyToNull(uri.getHost());
if (host == null) {
throw new NormalizationException(uri.toString(), "No host in URI");
}
return host;
}
|
[
"public",
"static",
"String",
"getHost",
"(",
"final",
"URI",
"uri",
")",
"throws",
"NormalizationException",
"{",
"final",
"String",
"host",
"=",
"Strings",
".",
"emptyToNull",
"(",
"uri",
".",
"getHost",
"(",
")",
")",
";",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"throw",
"new",
"NormalizationException",
"(",
"uri",
".",
"toString",
"(",
")",
",",
"\"No host in URI\"",
")",
";",
"}",
"return",
"host",
";",
"}"
] |
Returns the host of the given URI or throws an exception if the URI has no host.
@param uri the URI to extract the host from
@return the extracted host
@throws NormalizationException if there is no host for the given uri
|
[
"Returns",
"the",
"host",
"of",
"the",
"given",
"URI",
"or",
"throws",
"an",
"exception",
"if",
"the",
"URI",
"has",
"no",
"host",
"."
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L87-L93
|
156,278
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.getPort
|
public static int getPort(final URI uri) throws NormalizationException {
if (hasPort(uri)) {
return uri.getPort();
}
Integer port = NetProtocol.find(getScheme(uri)).getPort();
if (null == port) {
throw new NormalizationException(uri.toString(), "Cannot determine port");
}
return port;
}
|
java
|
public static int getPort(final URI uri) throws NormalizationException {
if (hasPort(uri)) {
return uri.getPort();
}
Integer port = NetProtocol.find(getScheme(uri)).getPort();
if (null == port) {
throw new NormalizationException(uri.toString(), "Cannot determine port");
}
return port;
}
|
[
"public",
"static",
"int",
"getPort",
"(",
"final",
"URI",
"uri",
")",
"throws",
"NormalizationException",
"{",
"if",
"(",
"hasPort",
"(",
"uri",
")",
")",
"{",
"return",
"uri",
".",
"getPort",
"(",
")",
";",
"}",
"Integer",
"port",
"=",
"NetProtocol",
".",
"find",
"(",
"getScheme",
"(",
"uri",
")",
")",
".",
"getPort",
"(",
")",
";",
"if",
"(",
"null",
"==",
"port",
")",
"{",
"throw",
"new",
"NormalizationException",
"(",
"uri",
".",
"toString",
"(",
")",
",",
"\"Cannot determine port\"",
")",
";",
"}",
"return",
"port",
";",
"}"
] |
Returns the port of the given URI. If not specified, it returns the default port based on scheme. If the
default port cannot be determined, then it throws an exception.
@param uri the URI to extract the port from
@return the extracted port
@throws NormalizationException if there is no port, and we cannot determine a default.
|
[
"Returns",
"the",
"port",
"of",
"the",
"given",
"URI",
".",
"If",
"not",
"specified",
"it",
"returns",
"the",
"default",
"port",
"based",
"on",
"scheme",
".",
"If",
"the",
"default",
"port",
"cannot",
"be",
"determined",
"then",
"it",
"throws",
"an",
"exception",
"."
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L113-L124
|
156,279
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.prependSlash
|
private static String prependSlash(final String path) {
if (path.length() == 0 || path.charAt(0) != '/') {
/* our path doesn't start with a slash, so we prepend it */
return "/" + path;
}
return path;
}
|
java
|
private static String prependSlash(final String path) {
if (path.length() == 0 || path.charAt(0) != '/') {
/* our path doesn't start with a slash, so we prepend it */
return "/" + path;
}
return path;
}
|
[
"private",
"static",
"String",
"prependSlash",
"(",
"final",
"String",
"path",
")",
"{",
"if",
"(",
"path",
".",
"length",
"(",
")",
"==",
"0",
"||",
"path",
".",
"charAt",
"(",
"0",
")",
"!=",
"'",
"'",
")",
"{",
"/* our path doesn't start with a slash, so we prepend it */",
"return",
"\"/\"",
"+",
"path",
";",
"}",
"return",
"path",
";",
"}"
] |
Prepends a string with a slash, if there isn't one already
|
[
"Prepends",
"a",
"string",
"with",
"a",
"slash",
"if",
"there",
"isn",
"t",
"one",
"already"
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L127-L133
|
156,280
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.toRawString
|
public static String toRawString(final URI uri, final boolean strict) throws NormalizationException {
final StringBuffer sb = new StringBuffer(getScheme(uri)).append("://");
if (hasUserInfo(uri)) {
sb.append(getRawUserInfo(uri)).append('@');
}
sb.append(getHost(uri)).append(':').append(getPort(uri)).append(getRawPath(uri, strict));
if (hasQuery(uri)) {
sb.append('?').append(getRawQuery(uri, strict));
}
if (hasFragment(uri)) {
sb.append('#').append(getRawFragment(uri, strict));
}
return sb.toString();
}
|
java
|
public static String toRawString(final URI uri, final boolean strict) throws NormalizationException {
final StringBuffer sb = new StringBuffer(getScheme(uri)).append("://");
if (hasUserInfo(uri)) {
sb.append(getRawUserInfo(uri)).append('@');
}
sb.append(getHost(uri)).append(':').append(getPort(uri)).append(getRawPath(uri, strict));
if (hasQuery(uri)) {
sb.append('?').append(getRawQuery(uri, strict));
}
if (hasFragment(uri)) {
sb.append('#').append(getRawFragment(uri, strict));
}
return sb.toString();
}
|
[
"public",
"static",
"String",
"toRawString",
"(",
"final",
"URI",
"uri",
",",
"final",
"boolean",
"strict",
")",
"throws",
"NormalizationException",
"{",
"final",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"getScheme",
"(",
"uri",
")",
")",
".",
"append",
"(",
"\"://\"",
")",
";",
"if",
"(",
"hasUserInfo",
"(",
"uri",
")",
")",
"{",
"sb",
".",
"append",
"(",
"getRawUserInfo",
"(",
"uri",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"sb",
".",
"append",
"(",
"getHost",
"(",
"uri",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"getPort",
"(",
"uri",
")",
")",
".",
"append",
"(",
"getRawPath",
"(",
"uri",
",",
"strict",
")",
")",
";",
"if",
"(",
"hasQuery",
"(",
"uri",
")",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"getRawQuery",
"(",
"uri",
",",
"strict",
")",
")",
";",
"}",
"if",
"(",
"hasFragment",
"(",
"uri",
")",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"getRawFragment",
"(",
"uri",
",",
"strict",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the entire URL as a string with its raw components normalized
@param uri the URI to convert
@param strict whether or not to do strict escaping
@return the raw string representation of the URI
@throws NormalizationException if the given URI doesn't meet our stricter restrictions
|
[
"Returns",
"the",
"entire",
"URL",
"as",
"a",
"string",
"with",
"its",
"raw",
"components",
"normalized"
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L285-L298
|
156,281
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.replaceHost
|
public static URI replaceHost(final URI uri, final String newHost, final boolean strict) throws URISyntaxException {
final URI hostUri = newUri(newHost, strict);
return newUri(uri.toString().replaceFirst(Pattern.quote(uri.getHost()),
Matcher.quoteReplacement(hostUri.getHost())), strict);
}
|
java
|
public static URI replaceHost(final URI uri, final String newHost, final boolean strict) throws URISyntaxException {
final URI hostUri = newUri(newHost, strict);
return newUri(uri.toString().replaceFirst(Pattern.quote(uri.getHost()),
Matcher.quoteReplacement(hostUri.getHost())), strict);
}
|
[
"public",
"static",
"URI",
"replaceHost",
"(",
"final",
"URI",
"uri",
",",
"final",
"String",
"newHost",
",",
"final",
"boolean",
"strict",
")",
"throws",
"URISyntaxException",
"{",
"final",
"URI",
"hostUri",
"=",
"newUri",
"(",
"newHost",
",",
"strict",
")",
";",
"return",
"newUri",
"(",
"uri",
".",
"toString",
"(",
")",
".",
"replaceFirst",
"(",
"Pattern",
".",
"quote",
"(",
"uri",
".",
"getHost",
"(",
")",
")",
",",
"Matcher",
".",
"quoteReplacement",
"(",
"hostUri",
".",
"getHost",
"(",
")",
")",
")",
",",
"strict",
")",
";",
"}"
] |
Returns a new URI with the host portion replaced by the new host portion
@param uri the uri to replace the host in
@param newHost the new host to replace with
@param strict whether or not to perform strict escaping. (defaults to false)
@return the new URI with everything the same except for the host being replaced
@throws URISyntaxException if the newly-created URI is malformed.
|
[
"Returns",
"a",
"new",
"URI",
"with",
"the",
"host",
"portion",
"replaced",
"by",
"the",
"new",
"host",
"portion"
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L401-L405
|
156,282
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.toDirectory
|
public static URI toDirectory(final URI uri, final boolean strict) throws NormalizationException {
return resolve(uri, getRawDirectory(uri, strict), strict);
}
|
java
|
public static URI toDirectory(final URI uri, final boolean strict) throws NormalizationException {
return resolve(uri, getRawDirectory(uri, strict), strict);
}
|
[
"public",
"static",
"URI",
"toDirectory",
"(",
"final",
"URI",
"uri",
",",
"final",
"boolean",
"strict",
")",
"throws",
"NormalizationException",
"{",
"return",
"resolve",
"(",
"uri",
",",
"getRawDirectory",
"(",
"uri",
",",
"strict",
")",
",",
"strict",
")",
";",
"}"
] |
Returns a URI that has been truncated to its directory.
@param uri the URI to resolve to the directory level
@param strict whether or not to do strict escaping
@return the resolved and normalized URI
@throws NormalizationException if there was a problem normalizing the URL
|
[
"Returns",
"a",
"URI",
"that",
"has",
"been",
"truncated",
"to",
"its",
"directory",
"."
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L430-L432
|
156,283
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.toPath
|
public static URI toPath(final URI uri, final boolean strict) throws NormalizationException {
return resolve(uri, getRawPath(uri, strict), strict);
}
|
java
|
public static URI toPath(final URI uri, final boolean strict) throws NormalizationException {
return resolve(uri, getRawPath(uri, strict), strict);
}
|
[
"public",
"static",
"URI",
"toPath",
"(",
"final",
"URI",
"uri",
",",
"final",
"boolean",
"strict",
")",
"throws",
"NormalizationException",
"{",
"return",
"resolve",
"(",
"uri",
",",
"getRawPath",
"(",
"uri",
",",
"strict",
")",
",",
"strict",
")",
";",
"}"
] |
Returns a URI that has been truncated to its path.
@param uri the URI to resolve to the path level
@param strict whether or not to do strict escaping
@return the resolved and normalized URI
@throws NormalizationException if there was a problem normalizing the URL
|
[
"Returns",
"a",
"URI",
"that",
"has",
"been",
"truncated",
"to",
"its",
"path",
"."
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L442-L444
|
156,284
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.isNormalized
|
public static boolean isNormalized(final URI uri, final boolean strict) {
return !Strings.isNullOrEmpty(uri.getScheme()) &&
Objects.equal(Uris.getRawUserInfo(uri), uri.getRawUserInfo()) &&
!Strings.isNullOrEmpty(uri.getHost()) &&
hasPort(uri) &&
Objects.equal(Uris.getRawPath(uri, strict), uri.getRawPath()) &&
Objects.equal(Uris.getRawQuery(uri, strict), uri.getRawQuery()) &&
Objects.equal(Uris.getRawFragment(uri, strict), uri.getRawFragment());
}
|
java
|
public static boolean isNormalized(final URI uri, final boolean strict) {
return !Strings.isNullOrEmpty(uri.getScheme()) &&
Objects.equal(Uris.getRawUserInfo(uri), uri.getRawUserInfo()) &&
!Strings.isNullOrEmpty(uri.getHost()) &&
hasPort(uri) &&
Objects.equal(Uris.getRawPath(uri, strict), uri.getRawPath()) &&
Objects.equal(Uris.getRawQuery(uri, strict), uri.getRawQuery()) &&
Objects.equal(Uris.getRawFragment(uri, strict), uri.getRawFragment());
}
|
[
"public",
"static",
"boolean",
"isNormalized",
"(",
"final",
"URI",
"uri",
",",
"final",
"boolean",
"strict",
")",
"{",
"return",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"uri",
".",
"getScheme",
"(",
")",
")",
"&&",
"Objects",
".",
"equal",
"(",
"Uris",
".",
"getRawUserInfo",
"(",
"uri",
")",
",",
"uri",
".",
"getRawUserInfo",
"(",
")",
")",
"&&",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"uri",
".",
"getHost",
"(",
")",
")",
"&&",
"hasPort",
"(",
"uri",
")",
"&&",
"Objects",
".",
"equal",
"(",
"Uris",
".",
"getRawPath",
"(",
"uri",
",",
"strict",
")",
",",
"uri",
".",
"getRawPath",
"(",
")",
")",
"&&",
"Objects",
".",
"equal",
"(",
"Uris",
".",
"getRawQuery",
"(",
"uri",
",",
"strict",
")",
",",
"uri",
".",
"getRawQuery",
"(",
")",
")",
"&&",
"Objects",
".",
"equal",
"(",
"Uris",
".",
"getRawFragment",
"(",
"uri",
",",
"strict",
")",
",",
"uri",
".",
"getRawFragment",
"(",
")",
")",
";",
"}"
] |
Returns whether or not the given URI is normalized according to our rules.
@param uri the uri to check normalization status
@param strict whether or not to do strict escaping
@return true if the given uri is already normalized
|
[
"Returns",
"whether",
"or",
"not",
"the",
"given",
"URI",
"is",
"normalized",
"according",
"to",
"our",
"rules",
"."
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L453-L461
|
156,285
|
jronrun/benayn
|
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
|
Uris.createUri
|
public static URI createUri(final String url, final boolean strict) {
try {
return newUri(url, strict);
} catch (URISyntaxException e) {
throw new AssertionError("Error creating URI: " + e.getMessage());
}
}
|
java
|
public static URI createUri(final String url, final boolean strict) {
try {
return newUri(url, strict);
} catch (URISyntaxException e) {
throw new AssertionError("Error creating URI: " + e.getMessage());
}
}
|
[
"public",
"static",
"URI",
"createUri",
"(",
"final",
"String",
"url",
",",
"final",
"boolean",
"strict",
")",
"{",
"try",
"{",
"return",
"newUri",
"(",
"url",
",",
"strict",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"Error creating URI: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Creates a new URI based off the given string. This function differs from newUri in that it throws an
AssertionError instead of a URISyntaxException - so it is suitable for use in static locations as long as
you can be sure it is a valid string that is being parsed.
@param url the string to parse
@param strict whether or not to perform strict escaping. (defaults to false)
@return the parsed, normalized URI
|
[
"Creates",
"a",
"new",
"URI",
"based",
"off",
"the",
"given",
"string",
".",
"This",
"function",
"differs",
"from",
"newUri",
"in",
"that",
"it",
"throws",
"an",
"AssertionError",
"instead",
"of",
"a",
"URISyntaxException",
"-",
"so",
"it",
"is",
"suitable",
"for",
"use",
"in",
"static",
"locations",
"as",
"long",
"as",
"you",
"can",
"be",
"sure",
"it",
"is",
"a",
"valid",
"string",
"that",
"is",
"being",
"parsed",
"."
] |
7585152e10e4cac07b4274c65f1c72ad7061ae69
|
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L514-L520
|
156,286
|
bwkimmel/java-util
|
src/main/java/ca/eandb/util/IntegerArray.java
|
IntegerArray.resize
|
public void resize(int newSize) {
if (newSize > elements.length) {
reallocate(Math.max(newSize, 2 * elements.length));
} else {
for (int i = size; i < newSize; i++) {
elements[i] = 0;
}
}
size = newSize;
}
|
java
|
public void resize(int newSize) {
if (newSize > elements.length) {
reallocate(Math.max(newSize, 2 * elements.length));
} else {
for (int i = size; i < newSize; i++) {
elements[i] = 0;
}
}
size = newSize;
}
|
[
"public",
"void",
"resize",
"(",
"int",
"newSize",
")",
"{",
"if",
"(",
"newSize",
">",
"elements",
".",
"length",
")",
"{",
"reallocate",
"(",
"Math",
".",
"max",
"(",
"newSize",
",",
"2",
"*",
"elements",
".",
"length",
")",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"size",
";",
"i",
"<",
"newSize",
";",
"i",
"++",
")",
"{",
"elements",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"}",
"size",
"=",
"newSize",
";",
"}"
] |
Resizes the array to the specified length, truncating or zero-padding the
array as necessary.
@param newSize
The new size of the array.
|
[
"Resizes",
"the",
"array",
"to",
"the",
"specified",
"length",
"truncating",
"or",
"zero",
"-",
"padding",
"the",
"array",
"as",
"necessary",
"."
] |
0c03664d42f0e6b111f64447f222aa73c2819e5c
|
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/IntegerArray.java#L532-L541
|
156,287
|
bwkimmel/java-util
|
src/main/java/ca/eandb/util/IntegerArray.java
|
IntegerArray.ensureCapacity
|
public void ensureCapacity(int size) {
if (size > elements.length) {
reallocate(Math.max(size, 2 * elements.length));
}
}
|
java
|
public void ensureCapacity(int size) {
if (size > elements.length) {
reallocate(Math.max(size, 2 * elements.length));
}
}
|
[
"public",
"void",
"ensureCapacity",
"(",
"int",
"size",
")",
"{",
"if",
"(",
"size",
">",
"elements",
".",
"length",
")",
"{",
"reallocate",
"(",
"Math",
".",
"max",
"(",
"size",
",",
"2",
"*",
"elements",
".",
"length",
")",
")",
";",
"}",
"}"
] |
Ensures that there is enough room in the array to hold the specified
number of elements.
@param size
The required capacity.
|
[
"Ensures",
"that",
"there",
"is",
"enough",
"room",
"in",
"the",
"array",
"to",
"hold",
"the",
"specified",
"number",
"of",
"elements",
"."
] |
0c03664d42f0e6b111f64447f222aa73c2819e5c
|
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/IntegerArray.java#L558-L562
|
156,288
|
wigforss/Ka-Jmx
|
core/src/main/java/org/kasource/jmx/core/service/JmxServiceImpl.java
|
JmxServiceImpl.handleNotification
|
@Override
public void handleNotification(Notification notification, Object handback) {
if(notification instanceof MBeanServerNotification) {
MBeanServerNotification mbeanNotification = (MBeanServerNotification) notification;
if(mbeanNotification.getType().equals("JMX.mbean.registered")) {
jmxTree = null;
registerAsNotificationListener(mbeanNotification.getMBeanName());
} else if(mbeanNotification.getType().equals("JMX.mbean.unregistered")) {
jmxTree = null;
}
}
for (NotificationListener listener : listeners) {
listener.handleNotification(notification, handback);
}
}
|
java
|
@Override
public void handleNotification(Notification notification, Object handback) {
if(notification instanceof MBeanServerNotification) {
MBeanServerNotification mbeanNotification = (MBeanServerNotification) notification;
if(mbeanNotification.getType().equals("JMX.mbean.registered")) {
jmxTree = null;
registerAsNotificationListener(mbeanNotification.getMBeanName());
} else if(mbeanNotification.getType().equals("JMX.mbean.unregistered")) {
jmxTree = null;
}
}
for (NotificationListener listener : listeners) {
listener.handleNotification(notification, handback);
}
}
|
[
"@",
"Override",
"public",
"void",
"handleNotification",
"(",
"Notification",
"notification",
",",
"Object",
"handback",
")",
"{",
"if",
"(",
"notification",
"instanceof",
"MBeanServerNotification",
")",
"{",
"MBeanServerNotification",
"mbeanNotification",
"=",
"(",
"MBeanServerNotification",
")",
"notification",
";",
"if",
"(",
"mbeanNotification",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"\"JMX.mbean.registered\"",
")",
")",
"{",
"jmxTree",
"=",
"null",
";",
"registerAsNotificationListener",
"(",
"mbeanNotification",
".",
"getMBeanName",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"mbeanNotification",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"\"JMX.mbean.unregistered\"",
")",
")",
"{",
"jmxTree",
"=",
"null",
";",
"}",
"}",
"for",
"(",
"NotificationListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"handleNotification",
"(",
"notification",
",",
"handback",
")",
";",
"}",
"}"
] |
Handles JMX Notifications and relays notifications to the notification listers
registered with this service.
|
[
"Handles",
"JMX",
"Notifications",
"and",
"relays",
"notifications",
"to",
"the",
"notification",
"listers",
"registered",
"with",
"this",
"service",
"."
] |
7f096394e5a11ad5ef483c90ce511a2ba2c14ab2
|
https://github.com/wigforss/Ka-Jmx/blob/7f096394e5a11ad5ef483c90ce511a2ba2c14ab2/core/src/main/java/org/kasource/jmx/core/service/JmxServiceImpl.java#L212-L229
|
156,289
|
janus-project/guava.janusproject.io
|
guava/src/com/google/common/collect/Iterators.java
|
Iterators.cycle
|
public static <T> Iterator<T> cycle(T... elements) {
return cycle(Lists.newArrayList(elements));
}
|
java
|
public static <T> Iterator<T> cycle(T... elements) {
return cycle(Lists.newArrayList(elements));
}
|
[
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"cycle",
"(",
"T",
"...",
"elements",
")",
"{",
"return",
"cycle",
"(",
"Lists",
".",
"newArrayList",
"(",
"elements",
")",
")",
";",
"}"
] |
Returns an iterator that cycles indefinitely over the provided elements.
<p>The returned iterator supports {@code remove()}. After {@code remove()}
is called, subsequent cycles omit the removed
element, but {@code elements} does not change. The iterator's
{@code hasNext()} method returns {@code true} until all of the original
elements have been removed.
<p><b>Warning:</b> Typical uses of the resulting iterator may produce an
infinite loop. You should use an explicit {@code break} or be certain that
you will eventually remove all the elements.
|
[
"Returns",
"an",
"iterator",
"that",
"cycles",
"indefinitely",
"over",
"the",
"provided",
"elements",
"."
] |
1c48fb672c9fdfddf276970570f703fa1115f588
|
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/Iterators.java#L435-L437
|
156,290
|
pip-services3-java/pip-services3-components-java
|
src/org/pipservices3/components/cache/CacheEntry.java
|
CacheEntry.setValue
|
public void setValue(Object value, long timeout) {
_value = value;
_expiration = System.currentTimeMillis() + timeout;
}
|
java
|
public void setValue(Object value, long timeout) {
_value = value;
_expiration = System.currentTimeMillis() + timeout;
}
|
[
"public",
"void",
"setValue",
"(",
"Object",
"value",
",",
"long",
"timeout",
")",
"{",
"_value",
"=",
"value",
";",
"_expiration",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"timeout",
";",
"}"
] |
Sets a new value and extends its expiration.
@param value a new cached value.
@param timeout a expiration timeout in milliseconds.
|
[
"Sets",
"a",
"new",
"value",
"and",
"extends",
"its",
"expiration",
"."
] |
122352fbf9b208f6417376da7b8ad725bc85ee58
|
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/cache/CacheEntry.java#L48-L51
|
156,291
|
brettonw/Bag
|
src/main/java/com/brettonw/bag/SourceAdapterHttp.java
|
SourceAdapterHttp.trustAllHosts
|
public static void trustAllHosts () {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager () {
public X509Certificate[] getAcceptedIssuers () { return new X509Certificate[]{}; }
public void checkClientTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
public void checkServerTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
}
};
// Install the all-trusting trust manager
try {
SSLContext sslContext = SSLContext.getInstance ("TLS");
sslContext.init (null, trustAllCerts, new java.security.SecureRandom ());
HttpsURLConnection.setDefaultSSLSocketFactory (sslContext.getSocketFactory ());
HttpsURLConnection.setDefaultHostnameVerifier ((String var1, SSLSession var2) -> {
return true;
});
} catch (Exception exception) {
log.error (exception);
}
}
|
java
|
public static void trustAllHosts () {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager () {
public X509Certificate[] getAcceptedIssuers () { return new X509Certificate[]{}; }
public void checkClientTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
public void checkServerTrusted (X509Certificate[] chain, String authType) throws CertificateException {}
}
};
// Install the all-trusting trust manager
try {
SSLContext sslContext = SSLContext.getInstance ("TLS");
sslContext.init (null, trustAllCerts, new java.security.SecureRandom ());
HttpsURLConnection.setDefaultSSLSocketFactory (sslContext.getSocketFactory ());
HttpsURLConnection.setDefaultHostnameVerifier ((String var1, SSLSession var2) -> {
return true;
});
} catch (Exception exception) {
log.error (exception);
}
}
|
[
"public",
"static",
"void",
"trustAllHosts",
"(",
")",
"{",
"// Create a trust manager that does not validate certificate chains\r",
"TrustManager",
"[",
"]",
"trustAllCerts",
"=",
"new",
"TrustManager",
"[",
"]",
"{",
"new",
"X509TrustManager",
"(",
")",
"{",
"public",
"X509Certificate",
"[",
"]",
"getAcceptedIssuers",
"(",
")",
"{",
"return",
"new",
"X509Certificate",
"[",
"]",
"{",
"}",
";",
"}",
"public",
"void",
"checkClientTrusted",
"(",
"X509Certificate",
"[",
"]",
"chain",
",",
"String",
"authType",
")",
"throws",
"CertificateException",
"{",
"}",
"public",
"void",
"checkServerTrusted",
"(",
"X509Certificate",
"[",
"]",
"chain",
",",
"String",
"authType",
")",
"throws",
"CertificateException",
"{",
"}",
"}",
"}",
";",
"// Install the all-trusting trust manager\r",
"try",
"{",
"SSLContext",
"sslContext",
"=",
"SSLContext",
".",
"getInstance",
"(",
"\"TLS\"",
")",
";",
"sslContext",
".",
"init",
"(",
"null",
",",
"trustAllCerts",
",",
"new",
"java",
".",
"security",
".",
"SecureRandom",
"(",
")",
")",
";",
"HttpsURLConnection",
".",
"setDefaultSSLSocketFactory",
"(",
"sslContext",
".",
"getSocketFactory",
"(",
")",
")",
";",
"HttpsURLConnection",
".",
"setDefaultHostnameVerifier",
"(",
"(",
"String",
"var1",
",",
"SSLSession",
"var2",
")",
"->",
"{",
"return",
"true",
";",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"log",
".",
"error",
"(",
"exception",
")",
";",
"}",
"}"
] |
Sometimes a remote source is self-signed or not otherwise trusted
|
[
"Sometimes",
"a",
"remote",
"source",
"is",
"self",
"-",
"signed",
"or",
"not",
"otherwise",
"trusted"
] |
25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56
|
https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/SourceAdapterHttp.java#L113-L136
|
156,292
|
Frostman/dropbox4j
|
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
|
DropboxClient.getAccountInfo
|
public AccountInfo getAccountInfo() {
OAuthRequest request = new OAuthRequest(Verb.GET, INFO_URL);
service.signRequest(accessToken, request);
String content = check(request.send()).getBody();
return Json.parse(content, AccountInfo.class);
}
|
java
|
public AccountInfo getAccountInfo() {
OAuthRequest request = new OAuthRequest(Verb.GET, INFO_URL);
service.signRequest(accessToken, request);
String content = check(request.send()).getBody();
return Json.parse(content, AccountInfo.class);
}
|
[
"public",
"AccountInfo",
"getAccountInfo",
"(",
")",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"GET",
",",
"INFO_URL",
")",
";",
"service",
".",
"signRequest",
"(",
"accessToken",
",",
"request",
")",
";",
"String",
"content",
"=",
"check",
"(",
"request",
".",
"send",
"(",
")",
")",
".",
"getBody",
"(",
")",
";",
"return",
"Json",
".",
"parse",
"(",
"content",
",",
"AccountInfo",
".",
"class",
")",
";",
"}"
] |
Returns information about current user's account.
@return info about user's account
@see AccountInfo
|
[
"Returns",
"information",
"about",
"current",
"user",
"s",
"account",
"."
] |
774c817e5bf294d0139ecb5ac81399be50ada5e0
|
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L85-L91
|
156,293
|
Frostman/dropbox4j
|
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
|
DropboxClient.getMetadata
|
public Entry getMetadata(String path, int fileLimit) {
return getMetadata(path, fileLimit, null, true);
}
|
java
|
public Entry getMetadata(String path, int fileLimit) {
return getMetadata(path, fileLimit, null, true);
}
|
[
"public",
"Entry",
"getMetadata",
"(",
"String",
"path",
",",
"int",
"fileLimit",
")",
"{",
"return",
"getMetadata",
"(",
"path",
",",
"fileLimit",
",",
"null",
",",
"true",
")",
";",
"}"
] |
Returns metadata information about specified resource with specified
maximum child entries count.
@param path to file or directory
@param fileLimit max child elements count
@return metadata of specified resource
@see Entry
|
[
"Returns",
"metadata",
"information",
"about",
"specified",
"resource",
"with",
"specified",
"maximum",
"child",
"entries",
"count",
"."
] |
774c817e5bf294d0139ecb5ac81399be50ada5e0
|
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L117-L119
|
156,294
|
Frostman/dropbox4j
|
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
|
DropboxClient.copy
|
public Entry copy(String from, String to) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_COPY_URL);
request.addQuerystringParameter("root", "dropbox");
request.addQuerystringParameter("from_path", encode(from));
request.addQuerystringParameter("to_path", encode(to));
service.signRequest(accessToken, request);
String content = checkCopy(request.send()).getBody();
return Json.parse(content, Entry.class);
}
|
java
|
public Entry copy(String from, String to) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_COPY_URL);
request.addQuerystringParameter("root", "dropbox");
request.addQuerystringParameter("from_path", encode(from));
request.addQuerystringParameter("to_path", encode(to));
service.signRequest(accessToken, request);
String content = checkCopy(request.send()).getBody();
return Json.parse(content, Entry.class);
}
|
[
"public",
"Entry",
"copy",
"(",
"String",
"from",
",",
"String",
"to",
")",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"GET",
",",
"FILE_OPS_COPY_URL",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"root\"",
",",
"\"dropbox\"",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"from_path\"",
",",
"encode",
"(",
"from",
")",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"to_path\"",
",",
"encode",
"(",
"to",
")",
")",
";",
"service",
".",
"signRequest",
"(",
"accessToken",
",",
"request",
")",
";",
"String",
"content",
"=",
"checkCopy",
"(",
"request",
".",
"send",
"(",
")",
")",
".",
"getBody",
"(",
")",
";",
"return",
"Json",
".",
"parse",
"(",
"content",
",",
"Entry",
".",
"class",
")",
";",
"}"
] |
Copy file from specified source to specified target.
@param from source
@param to target
@return metadata of target file
@see Entry
|
[
"Copy",
"file",
"from",
"specified",
"source",
"to",
"specified",
"target",
"."
] |
774c817e5bf294d0139ecb5ac81399be50ada5e0
|
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L200-L210
|
156,295
|
Frostman/dropbox4j
|
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
|
DropboxClient.move
|
public Entry move(String from, String to) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_MOVE_URL);
request.addQuerystringParameter("root", "dropbox");
request.addQuerystringParameter("from_path", encode(from));
request.addQuerystringParameter("to_path", encode(to));
service.signRequest(accessToken, request);
String content = checkMove(request.send()).getBody();
return Json.parse(content, Entry.class);
}
|
java
|
public Entry move(String from, String to) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_MOVE_URL);
request.addQuerystringParameter("root", "dropbox");
request.addQuerystringParameter("from_path", encode(from));
request.addQuerystringParameter("to_path", encode(to));
service.signRequest(accessToken, request);
String content = checkMove(request.send()).getBody();
return Json.parse(content, Entry.class);
}
|
[
"public",
"Entry",
"move",
"(",
"String",
"from",
",",
"String",
"to",
")",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"GET",
",",
"FILE_OPS_MOVE_URL",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"root\"",
",",
"\"dropbox\"",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"from_path\"",
",",
"encode",
"(",
"from",
")",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"to_path\"",
",",
"encode",
"(",
"to",
")",
")",
";",
"service",
".",
"signRequest",
"(",
"accessToken",
",",
"request",
")",
";",
"String",
"content",
"=",
"checkMove",
"(",
"request",
".",
"send",
"(",
")",
")",
".",
"getBody",
"(",
")",
";",
"return",
"Json",
".",
"parse",
"(",
"content",
",",
"Entry",
".",
"class",
")",
";",
"}"
] |
Move file from specified source to specified target.
@param from source
@param to target
@return metadata of target file
@see Entry
|
[
"Move",
"file",
"from",
"specified",
"source",
"to",
"specified",
"target",
"."
] |
774c817e5bf294d0139ecb5ac81399be50ada5e0
|
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L223-L233
|
156,296
|
Frostman/dropbox4j
|
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
|
DropboxClient.createFolder
|
public Entry createFolder(String path) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_CREATE_FOLDER_URL);
request.addQuerystringParameter("root", "dropbox");
request.addQuerystringParameter("path", encode(path));
service.signRequest(accessToken, request);
String content = checkCreateFolder(request.send()).getBody();
return Json.parse(content, Entry.class);
}
|
java
|
public Entry createFolder(String path) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_CREATE_FOLDER_URL);
request.addQuerystringParameter("root", "dropbox");
request.addQuerystringParameter("path", encode(path));
service.signRequest(accessToken, request);
String content = checkCreateFolder(request.send()).getBody();
return Json.parse(content, Entry.class);
}
|
[
"public",
"Entry",
"createFolder",
"(",
"String",
"path",
")",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"GET",
",",
"FILE_OPS_CREATE_FOLDER_URL",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"root\"",
",",
"\"dropbox\"",
")",
";",
"request",
".",
"addQuerystringParameter",
"(",
"\"path\"",
",",
"encode",
"(",
"path",
")",
")",
";",
"service",
".",
"signRequest",
"(",
"accessToken",
",",
"request",
")",
";",
"String",
"content",
"=",
"checkCreateFolder",
"(",
"request",
".",
"send",
"(",
")",
")",
".",
"getBody",
"(",
")",
";",
"return",
"Json",
".",
"parse",
"(",
"content",
",",
"Entry",
".",
"class",
")",
";",
"}"
] |
Create folder with specified path.
@param path to create
@return metadata of created folder
@see Entry
|
[
"Create",
"folder",
"with",
"specified",
"path",
"."
] |
774c817e5bf294d0139ecb5ac81399be50ada5e0
|
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L258-L267
|
156,297
|
Frostman/dropbox4j
|
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
|
DropboxClient.putFile
|
public void putFile(File file, String path) throws IOException {
OAuthRequest request = new OAuthRequest(Verb.POST, FILES_URL + encode(path));
Multipart.attachFile(file, request);
service.signRequest(accessToken, request);
checkFiles(request.send());
}
|
java
|
public void putFile(File file, String path) throws IOException {
OAuthRequest request = new OAuthRequest(Verb.POST, FILES_URL + encode(path));
Multipart.attachFile(file, request);
service.signRequest(accessToken, request);
checkFiles(request.send());
}
|
[
"public",
"void",
"putFile",
"(",
"File",
"file",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"POST",
",",
"FILES_URL",
"+",
"encode",
"(",
"path",
")",
")",
";",
"Multipart",
".",
"attachFile",
"(",
"file",
",",
"request",
")",
";",
"service",
".",
"signRequest",
"(",
"accessToken",
",",
"request",
")",
";",
"checkFiles",
"(",
"request",
".",
"send",
"(",
")",
")",
";",
"}"
] |
Upload specified file to specified folder.
@param file to upload
@param path of target folder
@throws IOException iff exception while accessing file
|
[
"Upload",
"specified",
"file",
"to",
"specified",
"folder",
"."
] |
774c817e5bf294d0139ecb5ac81399be50ada5e0
|
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L277-L283
|
156,298
|
Frostman/dropbox4j
|
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
|
DropboxClient.getFile
|
public EntryDownload getFile(String path) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILES_URL + encode(path));
service.signRequest(accessToken, request);
Response response = checkFiles(request.send());
return new EntryDownload(response, path);
}
|
java
|
public EntryDownload getFile(String path) {
OAuthRequest request = new OAuthRequest(Verb.GET, FILES_URL + encode(path));
service.signRequest(accessToken, request);
Response response = checkFiles(request.send());
return new EntryDownload(response, path);
}
|
[
"public",
"EntryDownload",
"getFile",
"(",
"String",
"path",
")",
"{",
"OAuthRequest",
"request",
"=",
"new",
"OAuthRequest",
"(",
"Verb",
".",
"GET",
",",
"FILES_URL",
"+",
"encode",
"(",
"path",
")",
")",
";",
"service",
".",
"signRequest",
"(",
"accessToken",
",",
"request",
")",
";",
"Response",
"response",
"=",
"checkFiles",
"(",
"request",
".",
"send",
"(",
")",
")",
";",
"return",
"new",
"EntryDownload",
"(",
"response",
",",
"path",
")",
";",
"}"
] |
Download file with specified path.
@param path to download
@return special objects that provides different ways to access file
|
[
"Download",
"file",
"with",
"specified",
"path",
"."
] |
774c817e5bf294d0139ecb5ac81399be50ada5e0
|
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L292-L299
|
156,299
|
dbracewell/hermes
|
hermes-core/src/main/java/com/davidbracewell/hermes/HermesCommandLineApp.java
|
HermesCommandLineApp.getCorpus
|
public Corpus getCorpus() {
return Corpus.builder()
.distributed(distributed)
.source(inputFormat, input)
.build();
}
|
java
|
public Corpus getCorpus() {
return Corpus.builder()
.distributed(distributed)
.source(inputFormat, input)
.build();
}
|
[
"public",
"Corpus",
"getCorpus",
"(",
")",
"{",
"return",
"Corpus",
".",
"builder",
"(",
")",
".",
"distributed",
"(",
"distributed",
")",
".",
"source",
"(",
"inputFormat",
",",
"input",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Creates a corpus based on the command line parameters.
@return the corpus
|
[
"Creates",
"a",
"corpus",
"based",
"on",
"the",
"command",
"line",
"parameters",
"."
] |
9ebefe7ad5dea1b731ae6931a30771eb75325ea3
|
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/HermesCommandLineApp.java#L93-L98
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.