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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jaeksoft/jcifs-krb5 | src/jcifs/smb/Dfs.java | Dfs.getDc | public SmbTransport getDc(String domain, SmbExtendedAuthenticator authenticator,
NtlmPasswordAuthentication auth) throws SmbAuthException {
// public SmbTransport getDc(String domain,
// NtlmPasswordAuthentication auth) throws SmbAuthException {
// SmbAuthenticator<<
if (DISAB... | java | public SmbTransport getDc(String domain, SmbExtendedAuthenticator authenticator,
NtlmPasswordAuthentication auth) throws SmbAuthException {
// public SmbTransport getDc(String domain,
// NtlmPasswordAuthentication auth) throws SmbAuthException {
// SmbAuthenticator<<
if (DISAB... | [
"public",
"SmbTransport",
"getDc",
"(",
"String",
"domain",
",",
"SmbExtendedAuthenticator",
"authenticator",
",",
"NtlmPasswordAuthentication",
"auth",
")",
"throws",
"SmbAuthException",
"{",
"// public SmbTransport getDc(String domain,\r",
"// NtlmPasswordAuthentica... | >>SmbAuthenticator Fixed trusted domain issue. | [
">>",
"SmbAuthenticator",
"Fixed",
"trusted",
"domain",
"issue",
"."
] | c16ea9a39925dc198adf3e049598aaea292dc5e4 | https://github.com/jaeksoft/jcifs-krb5/blob/c16ea9a39925dc198adf3e049598aaea292dc5e4/src/jcifs/smb/Dfs.java#L125-L165 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/util/Elements.java | Elements.addAll | public static boolean addAll(LongCollection collection, long[] array) {
boolean changed = false;
for (long element : array) {
changed |= collection.add(element);
}
return changed;
} | java | public static boolean addAll(LongCollection collection, long[] array) {
boolean changed = false;
for (long element : array) {
changed |= collection.add(element);
}
return changed;
} | [
"public",
"static",
"boolean",
"addAll",
"(",
"LongCollection",
"collection",
",",
"long",
"[",
"]",
"array",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"for",
"(",
"long",
"element",
":",
"array",
")",
"{",
"changed",
"|=",
"collection",
".",
"a... | Add all elements in the array to the collection.
@return true if the collection was changed
@since 2.6.0 | [
"Add",
"all",
"elements",
"in",
"the",
"array",
"to",
"the",
"collection",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/util/Elements.java#L44-L50 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/util/Elements.java | Elements.get | @Nullable
public static <T> T get(T[] array, int index) {
return array != null && index >= 0 && index < array.length ? array[index] : null;
} | java | @Nullable
public static <T> T get(T[] array, int index) {
return array != null && index >= 0 && index < array.length ? array[index] : null;
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"T",
"[",
"]",
"array",
",",
"int",
"index",
")",
"{",
"return",
"array",
"!=",
"null",
"&&",
"index",
">=",
"0",
"&&",
"index",
"<",
"array",
".",
"length",
"?",
"array",
"[",
... | Get the element at the index in the array.
@return null if the array is null or the index is out of bounds | [
"Get",
"the",
"element",
"at",
"the",
"index",
"in",
"the",
"array",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/util/Elements.java#L57-L60 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/util/Elements.java | Elements.slice | public static <T> T[] slice(T[] array, int... indexes) {
int length = indexes.length;
T[] slice = ObjectArrays.newArray(array, length);
for (int i = 0; i < length; i++) {
slice[i] = array[indexes[i]];
}
return slice;
} | java | public static <T> T[] slice(T[] array, int... indexes) {
int length = indexes.length;
T[] slice = ObjectArrays.newArray(array, length);
for (int i = 0; i < length; i++) {
slice[i] = array[indexes[i]];
}
return slice;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"slice",
"(",
"T",
"[",
"]",
"array",
",",
"int",
"...",
"indexes",
")",
"{",
"int",
"length",
"=",
"indexes",
".",
"length",
";",
"T",
"[",
"]",
"slice",
"=",
"ObjectArrays",
".",
"newArray",
"("... | Get the elements in the array that are at the indexes.
@since 1.4.0 | [
"Get",
"the",
"elements",
"in",
"the",
"array",
"that",
"are",
"at",
"the",
"indexes",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/util/Elements.java#L77-L84 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/util/Elements.java | Elements.slice | public static <T> List<T> slice(List<T> list, int... indexes) {
List<T> slice = new ArrayList<>(indexes.length);
for (int i : indexes) {
slice.add(list.get(i));
}
return slice;
} | java | public static <T> List<T> slice(List<T> list, int... indexes) {
List<T> slice = new ArrayList<>(indexes.length);
for (int i : indexes) {
slice.add(list.get(i));
}
return slice;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"slice",
"(",
"List",
"<",
"T",
">",
"list",
",",
"int",
"...",
"indexes",
")",
"{",
"List",
"<",
"T",
">",
"slice",
"=",
"new",
"ArrayList",
"<>",
"(",
"indexes",
".",
"length",
")",
";... | Get the elements in the list that are at the indexes.
@since 1.4.0 | [
"Get",
"the",
"elements",
"in",
"the",
"list",
"that",
"are",
"at",
"the",
"indexes",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/util/Elements.java#L91-L97 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/lang/Classes.java | Classes.getClass | public static Class<?> getClass(Object obj) {
Class<?> cls = obj.getClass();
return cls != Class.class ? cls : (Class<?>) obj;
} | java | public static Class<?> getClass(Object obj) {
Class<?> cls = obj.getClass();
return cls != Class.class ? cls : (Class<?>) obj;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getClass",
"(",
"Object",
"obj",
")",
"{",
"Class",
"<",
"?",
">",
"cls",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"return",
"cls",
"!=",
"Class",
".",
"class",
"?",
"cls",
":",
"(",
"Class",
"<",
... | If the object is not a Class, get its Class. Otherwise get the object as a Class.
@since 4.0.0 | [
"If",
"the",
"object",
"is",
"not",
"a",
"Class",
"get",
"its",
"Class",
".",
"Otherwise",
"get",
"the",
"object",
"as",
"a",
"Class",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/lang/Classes.java#L40-L43 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/lang/Classes.java | Classes.getNamedClass | public static Class<?> getNamedClass(Object obj) {
Class<?> cls = getClass(obj);
while (cls != null && cls.isAnonymousClass()) {
cls = cls.getEnclosingClass();
}
return cls;
} | java | public static Class<?> getNamedClass(Object obj) {
Class<?> cls = getClass(obj);
while (cls != null && cls.isAnonymousClass()) {
cls = cls.getEnclosingClass();
}
return cls;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getNamedClass",
"(",
"Object",
"obj",
")",
"{",
"Class",
"<",
"?",
">",
"cls",
"=",
"getClass",
"(",
"obj",
")",
";",
"while",
"(",
"cls",
"!=",
"null",
"&&",
"cls",
".",
"isAnonymousClass",
"(",
")",
")... | If the object is not a Class, get its Class. Otherwise get the object as a Class. If the
class is anonymous, get a non-anonymous enclosing class.
@since 4.0.0 | [
"If",
"the",
"object",
"is",
"not",
"a",
"Class",
"get",
"its",
"Class",
".",
"Otherwise",
"get",
"the",
"object",
"as",
"a",
"Class",
".",
"If",
"the",
"class",
"is",
"anonymous",
"get",
"a",
"non",
"-",
"anonymous",
"enclosing",
"class",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/lang/Classes.java#L51-L57 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/okhttp/OkHttp.java | OkHttp.request | public static Request request(String url, String... headers) {
Request.Builder request = new Request.Builder().url(url);
if (headers != null) {
int length = headers.length;
checkArgument(length % 2 == 0, "headers length must be a multiple of two");
for (int i = 0; i < length; i += 2) {
request.addHeade... | java | public static Request request(String url, String... headers) {
Request.Builder request = new Request.Builder().url(url);
if (headers != null) {
int length = headers.length;
checkArgument(length % 2 == 0, "headers length must be a multiple of two");
for (int i = 0; i < length; i += 2) {
request.addHeade... | [
"public",
"static",
"Request",
"request",
"(",
"String",
"url",
",",
"String",
"...",
"headers",
")",
"{",
"Request",
".",
"Builder",
"request",
"=",
"new",
"Request",
".",
"Builder",
"(",
")",
".",
"url",
"(",
"url",
")",
";",
"if",
"(",
"headers",
... | Get a GET request for the URL and headers.
@param headers
length must be a multiple of two: {@code String name, String value, ...} | [
"Get",
"a",
"GET",
"request",
"for",
"the",
"URL",
"and",
"headers",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/okhttp/OkHttp.java#L61-L71 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/okhttp/OkHttp.java | OkHttp.call | public Call call(String url, String... headers) {
return mCaller.newCall(request(url, headers));
} | java | public Call call(String url, String... headers) {
return mCaller.newCall(request(url, headers));
} | [
"public",
"Call",
"call",
"(",
"String",
"url",
",",
"String",
"...",
"headers",
")",
"{",
"return",
"mCaller",
".",
"newCall",
"(",
"request",
"(",
"url",
",",
"headers",
")",
")",
";",
"}"
] | Get a Call for a GET request for the URL and headers. | [
"Get",
"a",
"Call",
"for",
"a",
"GET",
"request",
"for",
"the",
"URL",
"and",
"headers",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/okhttp/OkHttp.java#L83-L85 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/okhttp/OkHttp.java | OkHttp.response | public Response response(String url, String... headers) throws IOException {
return call(url, headers).execute();
} | java | public Response response(String url, String... headers) throws IOException {
return call(url, headers).execute();
} | [
"public",
"Response",
"response",
"(",
"String",
"url",
",",
"String",
"...",
"headers",
")",
"throws",
"IOException",
"{",
"return",
"call",
"(",
"url",
",",
"headers",
")",
".",
"execute",
"(",
")",
";",
"}"
] | Get a response to a GET request for the URL and headers. | [
"Get",
"a",
"response",
"to",
"a",
"GET",
"request",
"for",
"the",
"URL",
"and",
"headers",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/okhttp/OkHttp.java#L97-L99 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/okhttp/OkHttp.java | OkHttp.download | public Response download(String url, File destination) throws IOException {
return download(url, destination, (String[]) null);
} | java | public Response download(String url, File destination) throws IOException {
return download(url, destination, (String[]) null);
} | [
"public",
"Response",
"download",
"(",
"String",
"url",
",",
"File",
"destination",
")",
"throws",
"IOException",
"{",
"return",
"download",
"(",
"url",
",",
"destination",
",",
"(",
"String",
"[",
"]",
")",
"null",
")",
";",
"}"
] | Download the resource at the URL and write it to the file.
@return Response whose body has already been consumed and closed | [
"Download",
"the",
"resource",
"at",
"the",
"URL",
"and",
"write",
"it",
"to",
"the",
"file",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/okhttp/OkHttp.java#L106-L108 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/okhttp/OkHttp.java | OkHttp.download | public Response download(String url, File destination, String... headers) throws IOException {
try (Response resp = response(url, headers)) {
if (resp.isSuccessful()) {
try (BufferedSink sink = Okio.buffer(Okio.sink(destination))) {
resp.body().source().readAll(sink);
}
}
return resp;
}
} | java | public Response download(String url, File destination, String... headers) throws IOException {
try (Response resp = response(url, headers)) {
if (resp.isSuccessful()) {
try (BufferedSink sink = Okio.buffer(Okio.sink(destination))) {
resp.body().source().readAll(sink);
}
}
return resp;
}
} | [
"public",
"Response",
"download",
"(",
"String",
"url",
",",
"File",
"destination",
",",
"String",
"...",
"headers",
")",
"throws",
"IOException",
"{",
"try",
"(",
"Response",
"resp",
"=",
"response",
"(",
"url",
",",
"headers",
")",
")",
"{",
"if",
"(",... | Download the resource at the URL with the headers and write it to the file.
@return Response whose body has already been consumed and closed | [
"Download",
"the",
"resource",
"at",
"the",
"URL",
"with",
"the",
"headers",
"and",
"write",
"it",
"to",
"the",
"file",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/okhttp/OkHttp.java#L115-L124 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/lang/Substring.java | Substring.getOffset | @Default
public int getOffset() {
String value = getValue();
String superstring = getSuperstring();
return value != null && superstring != null ? superstring.indexOf(value) : -1;
} | java | @Default
public int getOffset() {
String value = getValue();
String superstring = getSuperstring();
return value != null && superstring != null ? superstring.indexOf(value) : -1;
} | [
"@",
"Default",
"public",
"int",
"getOffset",
"(",
")",
"{",
"String",
"value",
"=",
"getValue",
"(",
")",
";",
"String",
"superstring",
"=",
"getSuperstring",
"(",
")",
";",
"return",
"value",
"!=",
"null",
"&&",
"superstring",
"!=",
"null",
"?",
"super... | Zero-based position of the first character of the substring within the superstring. | [
"Zero",
"-",
"based",
"position",
"of",
"the",
"first",
"character",
"of",
"the",
"substring",
"within",
"the",
"superstring",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/lang/Substring.java#L47-L52 | train |
jaeksoft/jcifs-krb5 | src/jcifs/spnego/asn1/DERUniversalString.java | DERUniversalString.getString | public String getString()
{
StringBuffer buf = new StringBuffer();
for (int i = 0; i != string.length; i++)
{
buf.append(table[(string[i] >>> 4) % 0xf]);
buf.append(table[string[i] & 0xf]);
}
return buf.toString();
} | java | public String getString()
{
StringBuffer buf = new StringBuffer();
for (int i = 0; i != string.length; i++)
{
buf.append(table[(string[i] >>> 4) % 0xf]);
buf.append(table[string[i] & 0xf]);
}
return buf.toString();
} | [
"public",
"String",
"getString",
"(",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"string",
".",
"length",
";",
"i",
"++",
")",
"{",
"buf",
".",
"append",
"(",
"tab... | UniversalStrings have characters which are 4 bytes long - for the
moment we just return them in Hex... | [
"UniversalStrings",
"have",
"characters",
"which",
"are",
"4",
"bytes",
"long",
"-",
"for",
"the",
"moment",
"we",
"just",
"return",
"them",
"in",
"Hex",
"..."
] | c16ea9a39925dc198adf3e049598aaea292dc5e4 | https://github.com/jaeksoft/jcifs-krb5/blob/c16ea9a39925dc198adf3e049598aaea292dc5e4/src/jcifs/spnego/asn1/DERUniversalString.java#L87-L98 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/lang/Maths.java | Maths.clamp | public static int clamp(int value, int min, int max) {
return Math.min(Math.max(min, value), max);
} | java | public static int clamp(int value, int min, int max) {
return Math.min(Math.max(min, value), max);
} | [
"public",
"static",
"int",
"clamp",
"(",
"int",
"value",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"return",
"Math",
".",
"min",
"(",
"Math",
".",
"max",
"(",
"min",
",",
"value",
")",
",",
"max",
")",
";",
"}"
] | Get the value if it is between min and max, min if the value is less than min, or max if the
value is greater than max. | [
"Get",
"the",
"value",
"if",
"it",
"is",
"between",
"min",
"and",
"max",
"min",
"if",
"the",
"value",
"is",
"less",
"than",
"min",
"or",
"max",
"if",
"the",
"value",
"is",
"greater",
"than",
"max",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/lang/Maths.java#L33-L35 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/SQLite.java | SQLite.normalise | public static String normalise(String s) {
if (sDiacritics == null) {
sDiacritics = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
}
return sDiacritics.matcher(Normalizer.normalize(s, NFD)).replaceAll("").toUpperCase(US);
} | java | public static String normalise(String s) {
if (sDiacritics == null) {
sDiacritics = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
}
return sDiacritics.matcher(Normalizer.normalize(s, NFD)).replaceAll("").toUpperCase(US);
} | [
"public",
"static",
"String",
"normalise",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"sDiacritics",
"==",
"null",
")",
"{",
"sDiacritics",
"=",
"Pattern",
".",
"compile",
"(",
"\"\\\\p{InCombiningDiacriticalMarks}+\"",
")",
";",
"}",
"return",
"sDiacritics",
".... | Remove diacritics from the string and convert it to upper case. | [
"Remove",
"diacritics",
"from",
"the",
"string",
"and",
"convert",
"it",
"to",
"upper",
"case",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/SQLite.java#L300-L305 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/SQLite.java | SQLite.distance | public static String distance(String latitudeColumn, String longitudeColumn,
String latitudeCosineColumn, double latitude, double longitude, MeasureUnit unit,
String alias) {
double degree = unit == MILE ? LATITUDE_DEGREE_MI : LATITUDE_DEGREE_KM;
return String.format((Locale) null, sDistance, degree, latitude... | java | public static String distance(String latitudeColumn, String longitudeColumn,
String latitudeCosineColumn, double latitude, double longitude, MeasureUnit unit,
String alias) {
double degree = unit == MILE ? LATITUDE_DEGREE_MI : LATITUDE_DEGREE_KM;
return String.format((Locale) null, sDistance, degree, latitude... | [
"public",
"static",
"String",
"distance",
"(",
"String",
"latitudeColumn",
",",
"String",
"longitudeColumn",
",",
"String",
"latitudeCosineColumn",
",",
"double",
"latitude",
",",
"double",
"longitude",
",",
"MeasureUnit",
"unit",
",",
"String",
"alias",
")",
"{",... | Get a result column for the squared distance from the row coordinates to the supplied
coordinates. SQLite doesn't have a square root core function, so this must be applied in Java
when reading the result column value.
@param latitudeCosineColumn
see {@link Geos#cos(double)}
@param unit
KILOMETER or MILE
@param alias
r... | [
"Get",
"a",
"result",
"column",
"for",
"the",
"squared",
"distance",
"from",
"the",
"row",
"coordinates",
"to",
"the",
"supplied",
"coordinates",
".",
"SQLite",
"doesn",
"t",
"have",
"a",
"square",
"root",
"core",
"function",
"so",
"this",
"must",
"be",
"a... | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/SQLite.java#L327-L334 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/util/concurrent/Interruptibles.java | Interruptibles.sleep | public static void sleep(long length, TimeUnit unit) {
try {
unit.sleep(length);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
} | java | public static void sleep(long length, TimeUnit unit) {
try {
unit.sleep(length);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
} | [
"public",
"static",
"void",
"sleep",
"(",
"long",
"length",
",",
"TimeUnit",
"unit",
")",
"{",
"try",
"{",
"unit",
".",
"sleep",
"(",
"length",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")"... | Sleep for the length of time. | [
"Sleep",
"for",
"the",
"length",
"of",
"time",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/util/concurrent/Interruptibles.java#L37-L43 | train |
jaeksoft/jcifs-krb5 | src/jcifs/smb/SmbSession.java | SmbSession.matches | boolean matches(SmbExtendedAuthenticator authenticator,
NtlmPasswordAuthentication auth) {
return matcheObject(this.authenticator, authenticator)
&& matcheObject(this.auth, auth);
} | java | boolean matches(SmbExtendedAuthenticator authenticator,
NtlmPasswordAuthentication auth) {
return matcheObject(this.authenticator, authenticator)
&& matcheObject(this.auth, auth);
} | [
"boolean",
"matches",
"(",
"SmbExtendedAuthenticator",
"authenticator",
",",
"NtlmPasswordAuthentication",
"auth",
")",
"{",
"return",
"matcheObject",
"(",
"this",
".",
"authenticator",
",",
"authenticator",
")",
"&&",
"matcheObject",
"(",
"this",
".",
"auth",
",",
... | authenticator to decide whether or not reuse a session. | [
"authenticator",
"to",
"decide",
"whether",
"or",
"not",
"reuse",
"a",
"session",
"."
] | c16ea9a39925dc198adf3e049598aaea292dc5e4 | https://github.com/jaeksoft/jcifs-krb5/blob/c16ea9a39925dc198adf3e049598aaea292dc5e4/src/jcifs/smb/SmbSession.java#L207-L211 | train |
jaeksoft/jcifs-krb5 | src/jcifs/smb/Kerb5Context.java | Kerb5Context.searchSessionKey | Key searchSessionKey(Subject subject) throws GSSException{
/*
The kerberos session key is not accessible via the JGSS API IBM and
Oracle both implement a similar API to make an ExtendedGSSContext
available.
The older implementation to find the session key is still... | java | Key searchSessionKey(Subject subject) throws GSSException{
/*
The kerberos session key is not accessible via the JGSS API IBM and
Oracle both implement a similar API to make an ExtendedGSSContext
available.
The older implementation to find the session key is still... | [
"Key",
"searchSessionKey",
"(",
"Subject",
"subject",
")",
"throws",
"GSSException",
"{",
"/*\r\n The kerberos session key is not accessible via the JGSS API IBM and \r\n Oracle both implement a similar API to make an ExtendedGSSContext\r\n available.\r\n \r\n Th... | Extract the context session key from the gssContext. The subject is only
used if no support for extraction of the session key is not possible
with an API and is used as a fallback method.
@param subject
@return context session key
@throws GSSException | [
"Extract",
"the",
"context",
"session",
"key",
"from",
"the",
"gssContext",
".",
"The",
"subject",
"is",
"only",
"used",
"if",
"no",
"support",
"for",
"extraction",
"of",
"the",
"session",
"key",
"is",
"not",
"possible",
"with",
"an",
"API",
"and",
"is",
... | c16ea9a39925dc198adf3e049598aaea292dc5e4 | https://github.com/jaeksoft/jcifs-krb5/blob/c16ea9a39925dc198adf3e049598aaea292dc5e4/src/jcifs/smb/Kerb5Context.java#L74-L130 | train |
jaeksoft/jcifs-krb5 | src/jcifs/spnego/asn1/DERBitString.java | DERBitString.getPadBits | static protected int getPadBits(
int bitString)
{
int val;
if (bitString == 0)
{
return 7;
}
if (bitString > 255)
{
val = ((bitString >> 8) & 0xFF);
}
else
{
val = (bitString & 0xFF)... | java | static protected int getPadBits(
int bitString)
{
int val;
if (bitString == 0)
{
return 7;
}
if (bitString > 255)
{
val = ((bitString >> 8) & 0xFF);
}
else
{
val = (bitString & 0xFF)... | [
"static",
"protected",
"int",
"getPadBits",
"(",
"int",
"bitString",
")",
"{",
"int",
"val",
";",
"if",
"(",
"bitString",
"==",
"0",
")",
"{",
"return",
"7",
";",
"}",
"if",
"(",
"bitString",
">",
"255",
")",
"{",
"val",
"=",
"(",
"(",
"bitString",... | return the correct number of pad bits for a bit string defined in
a 16 bit constant | [
"return",
"the",
"correct",
"number",
"of",
"pad",
"bits",
"for",
"a",
"bit",
"string",
"defined",
"in",
"a",
"16",
"bit",
"constant"
] | c16ea9a39925dc198adf3e049598aaea292dc5e4 | https://github.com/jaeksoft/jcifs-krb5/blob/c16ea9a39925dc198adf3e049598aaea292dc5e4/src/jcifs/spnego/asn1/DERBitString.java#L38-L65 | train |
jaeksoft/jcifs-krb5 | src/jcifs/spnego/asn1/DERBitString.java | DERBitString.getBytes | static protected byte[] getBytes(
int bitString)
{
if (bitString > 255)
{
byte[] bytes = new byte[2];
bytes[0] = (byte)(bitString & 0xFF);
bytes[1] = (byte)((bitString >> 8) & 0xFF);
return bytes;
}
else
... | java | static protected byte[] getBytes(
int bitString)
{
if (bitString > 255)
{
byte[] bytes = new byte[2];
bytes[0] = (byte)(bitString & 0xFF);
bytes[1] = (byte)((bitString >> 8) & 0xFF);
return bytes;
}
else
... | [
"static",
"protected",
"byte",
"[",
"]",
"getBytes",
"(",
"int",
"bitString",
")",
"{",
"if",
"(",
"bitString",
">",
"255",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"bytes",
"[",
"0",
"]",
"=",
"(",
"byte",
"... | return the correct number of bytes for a bit string defined in
a 16 bit constant | [
"return",
"the",
"correct",
"number",
"of",
"bytes",
"for",
"a",
"bit",
"string",
"defined",
"in",
"a",
"16",
"bit",
"constant"
] | c16ea9a39925dc198adf3e049598aaea292dc5e4 | https://github.com/jaeksoft/jcifs-krb5/blob/c16ea9a39925dc198adf3e049598aaea292dc5e4/src/jcifs/spnego/asn1/DERBitString.java#L71-L91 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.setStrings | public static PreparedStatement setStrings(PreparedStatement stmt, String... params)
throws SQLException {
return setStrings(1, stmt, params);
} | java | public static PreparedStatement setStrings(PreparedStatement stmt, String... params)
throws SQLException {
return setStrings(1, stmt, params);
} | [
"public",
"static",
"PreparedStatement",
"setStrings",
"(",
"PreparedStatement",
"stmt",
",",
"String",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"setStrings",
"(",
"1",
",",
"stmt",
",",
"params",
")",
";",
"}"
] | Set the statement parameters, starting at 1, in the order of the params.
@since 3.0.0 | [
"Set",
"the",
"statement",
"parameters",
"starting",
"at",
"1",
"in",
"the",
"order",
"of",
"the",
"params",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L90-L93 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.firstInt | public static int firstInt(PreparedStatement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery();
int i = rs.next() ? rs.getInt(1) : Integer.MIN_VALUE;
stmt.close();
return i;
} | java | public static int firstInt(PreparedStatement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery();
int i = rs.next() ? rs.getInt(1) : Integer.MIN_VALUE;
stmt.close();
return i;
} | [
"public",
"static",
"int",
"firstInt",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"stmt",
".",
"executeQuery",
"(",
")",
";",
"int",
"i",
"=",
"rs",
".",
"next",
"(",
")",
"?",
"rs",
".",
"getInt",
"("... | Execute the query, get the int value in the first row and column of the result set, and close
the statement.
@param stmt
must already have parameters set
@return {@link Integer#MIN_VALUE} if the result set is empty | [
"Execute",
"the",
"query",
"get",
"the",
"int",
"value",
"in",
"the",
"first",
"row",
"and",
"column",
"of",
"the",
"result",
"set",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L128-L133 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.firstLong | public static long firstLong(PreparedStatement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery();
long l = rs.next() ? rs.getLong(1) : Long.MIN_VALUE;
stmt.close();
return l;
} | java | public static long firstLong(PreparedStatement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery();
long l = rs.next() ? rs.getLong(1) : Long.MIN_VALUE;
stmt.close();
return l;
} | [
"public",
"static",
"long",
"firstLong",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"stmt",
".",
"executeQuery",
"(",
")",
";",
"long",
"l",
"=",
"rs",
".",
"next",
"(",
")",
"?",
"rs",
".",
"getLong",
... | Execute the query, get the long value in the first row and column of the result set, and
close the statement.
@param stmt
must already have parameters set
@return {@link Long#MIN_VALUE} if the result set is empty | [
"Execute",
"the",
"query",
"get",
"the",
"long",
"value",
"in",
"the",
"first",
"row",
"and",
"column",
"of",
"the",
"result",
"set",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L143-L148 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.firstString | @Nullable
public static String firstString(PreparedStatement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery();
String s = rs.next() ? rs.getString(1) : null;
stmt.close();
return s;
} | java | @Nullable
public static String firstString(PreparedStatement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery();
String s = rs.next() ? rs.getString(1) : null;
stmt.close();
return s;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"firstString",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"stmt",
".",
"executeQuery",
"(",
")",
";",
"String",
"s",
"=",
"rs",
".",
"next",
"(",
")",
"?",
... | Execute the query, get the String value in the first row and column of the result set, and
close the statement.
@param stmt
must already have parameters set
@return null if the result set is empty
@since 3.0.0 | [
"Execute",
"the",
"query",
"get",
"the",
"String",
"value",
"in",
"the",
"first",
"row",
"and",
"column",
"of",
"the",
"result",
"set",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L159-L165 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.firstStringRow | @SuppressWarnings("unchecked")
public static List<String> firstStringRow(PreparedStatement stmt) throws SQLException {
return (List<String>) firstRow(stmt, String.class);
} | java | @SuppressWarnings("unchecked")
public static List<String> firstStringRow(PreparedStatement stmt) throws SQLException {
return (List<String>) firstRow(stmt, String.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"String",
">",
"firstStringRow",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"return",
"(",
"List",
"<",
"String",
">",
")",
"firstRow",
"(",
"stmt",... | Execute the query, get the String values in the first row of the result set, and close the
statement.
@param stmt
must already have parameters set
@since 3.0.0 | [
"Execute",
"the",
"query",
"get",
"the",
"String",
"values",
"in",
"the",
"first",
"row",
"of",
"the",
"result",
"set",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L199-L202 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.allStrings | @SuppressWarnings("unchecked")
public static List<String> allStrings(PreparedStatement stmt) throws SQLException {
return (List<String>) all(stmt, String.class);
} | java | @SuppressWarnings("unchecked")
public static List<String> allStrings(PreparedStatement stmt) throws SQLException {
return (List<String>) all(stmt, String.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"String",
">",
"allStrings",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"return",
"(",
"List",
"<",
"String",
">",
")",
"all",
"(",
"stmt",
",",
... | Execute the query, get the String values in the first column of the result set, and close the
statement.
@param stmt
must already have parameters set
@since 1.5.0 | [
"Execute",
"the",
"query",
"get",
"the",
"String",
"values",
"in",
"the",
"first",
"column",
"of",
"the",
"result",
"set",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L262-L265 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.firstIntKey | public static int firstIntKey(PreparedStatement stmt) throws SQLException {
stmt.execute();
ResultSet rs = stmt.getGeneratedKeys();
int key = rs.next() ? rs.getInt(1) : 0;
stmt.close();
return key;
} | java | public static int firstIntKey(PreparedStatement stmt) throws SQLException {
stmt.execute();
ResultSet rs = stmt.getGeneratedKeys();
int key = rs.next() ? rs.getInt(1) : 0;
stmt.close();
return key;
} | [
"public",
"static",
"int",
"firstIntKey",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"stmt",
".",
"execute",
"(",
")",
";",
"ResultSet",
"rs",
"=",
"stmt",
".",
"getGeneratedKeys",
"(",
")",
";",
"int",
"key",
"=",
"rs",
".",
"... | Execute the insert statement, get the first generated key as an int, and close the statement.
@param stmt
must have been created with {@link Statement#RETURN_GENERATED_KEYS} and already
have parameters set
@return 0 if the statement did not generate any keys
@since 3.0.0 | [
"Execute",
"the",
"insert",
"statement",
"get",
"the",
"first",
"generated",
"key",
"as",
"an",
"int",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L301-L307 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.firstLongKey | public static long firstLongKey(PreparedStatement stmt) throws SQLException {
stmt.execute();
ResultSet rs = stmt.getGeneratedKeys();
long key = rs.next() ? rs.getLong(1) : 0L;
stmt.close();
return key;
} | java | public static long firstLongKey(PreparedStatement stmt) throws SQLException {
stmt.execute();
ResultSet rs = stmt.getGeneratedKeys();
long key = rs.next() ? rs.getLong(1) : 0L;
stmt.close();
return key;
} | [
"public",
"static",
"long",
"firstLongKey",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"stmt",
".",
"execute",
"(",
")",
";",
"ResultSet",
"rs",
"=",
"stmt",
".",
"getGeneratedKeys",
"(",
")",
";",
"long",
"key",
"=",
"rs",
".",
... | Execute the insert statement, get the first generated key as a long, and close the statement.
@param stmt
must have been created with {@link Statement#RETURN_GENERATED_KEYS} and already
have parameters set
@return 0 if the statement did not generate any keys | [
"Execute",
"the",
"insert",
"statement",
"get",
"the",
"first",
"generated",
"key",
"as",
"a",
"long",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L317-L323 | train |
pushbit/sprockets | src/main/java/net/sf/sprockets/sql/Statements.java | Statements.update | public static int update(PreparedStatement stmt) throws SQLException {
int rows = stmt.executeUpdate();
stmt.close();
return rows;
} | java | public static int update(PreparedStatement stmt) throws SQLException {
int rows = stmt.executeUpdate();
stmt.close();
return rows;
} | [
"public",
"static",
"int",
"update",
"(",
"PreparedStatement",
"stmt",
")",
"throws",
"SQLException",
"{",
"int",
"rows",
"=",
"stmt",
".",
"executeUpdate",
"(",
")",
";",
"stmt",
".",
"close",
"(",
")",
";",
"return",
"rows",
";",
"}"
] | Execute the insert, update, or delete statement, get the number of rows affected, and close
the statement.
@param stmt
must already have parameters set
@since 1.4.0 | [
"Execute",
"the",
"insert",
"update",
"or",
"delete",
"statement",
"get",
"the",
"number",
"of",
"rows",
"affected",
"and",
"close",
"the",
"statement",
"."
] | 5d967317cbb2374c69d33271d3c7b7311e1ea4ac | https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L333-L337 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/CpeParser.java | CpeParser.parse | public static Cpe parse(String cpeString, boolean lenient) throws CpeParsingException {
if (cpeString == null) {
throw new CpeParsingException("CPE String is null and cannot be parsed");
} else if (cpeString.regionMatches(0, "cpe:/", 0, 5)) {
return parse22(cpeString, lenient);
... | java | public static Cpe parse(String cpeString, boolean lenient) throws CpeParsingException {
if (cpeString == null) {
throw new CpeParsingException("CPE String is null and cannot be parsed");
} else if (cpeString.regionMatches(0, "cpe:/", 0, 5)) {
return parse22(cpeString, lenient);
... | [
"public",
"static",
"Cpe",
"parse",
"(",
"String",
"cpeString",
",",
"boolean",
"lenient",
")",
"throws",
"CpeParsingException",
"{",
"if",
"(",
"cpeString",
"==",
"null",
")",
"{",
"throw",
"new",
"CpeParsingException",
"(",
"\"CPE String is null and cannot be pars... | Parses a CPE String into an object with the option of parsing CPE 2.2 URI
strings in lenient mode - allowing for CPE values that do not adhere to
the specification.
@param cpeString the CPE string to parse
@param lenient when <code>true</code> the CPE 2.2 parser will put in
lenient mode attempting to parse invalid CPE... | [
"Parses",
"a",
"CPE",
"String",
"into",
"an",
"object",
"with",
"the",
"option",
"of",
"parsing",
"CPE",
"2",
".",
"2",
"URI",
"strings",
"in",
"lenient",
"mode",
"-",
"allowing",
"for",
"CPE",
"values",
"that",
"do",
"not",
"adhere",
"to",
"the",
"spe... | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/CpeParser.java#L71-L80 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/CpeParser.java | CpeParser.parse22 | protected static Cpe parse22(String cpeString, boolean lenient) throws CpeParsingException {
if (cpeString == null || cpeString.isEmpty()) {
throw new CpeParsingException("CPE String is null ir enpty - unable to parse");
}
CpeBuilder cb = new CpeBuilder();
String[] parts = cp... | java | protected static Cpe parse22(String cpeString, boolean lenient) throws CpeParsingException {
if (cpeString == null || cpeString.isEmpty()) {
throw new CpeParsingException("CPE String is null ir enpty - unable to parse");
}
CpeBuilder cb = new CpeBuilder();
String[] parts = cp... | [
"protected",
"static",
"Cpe",
"parse22",
"(",
"String",
"cpeString",
",",
"boolean",
"lenient",
")",
"throws",
"CpeParsingException",
"{",
"if",
"(",
"cpeString",
"==",
"null",
"||",
"cpeString",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"CpeParsin... | Parses a CPE 2.2 URI.
@param cpeString the CPE string to parse
@param lenient when <code>true</code> the parser will put in lenient mode
attempting to parse invalid CPE values.
@return the CPE object represented by the cpeString
@throws CpeParsingException thrown if the cpeString is invalid | [
"Parses",
"a",
"CPE",
"2",
".",
"2",
"URI",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/CpeParser.java#L102-L138 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/CpeParser.java | CpeParser.unpackEdition | protected static void unpackEdition(String edition, CpeBuilder cb, boolean lenient) throws CpeParsingException {
if (edition == null || edition.isEmpty()) {
return;
}
try {
String[] unpacked = edition.split("~");
if (edition.startsWith("~")) {
... | java | protected static void unpackEdition(String edition, CpeBuilder cb, boolean lenient) throws CpeParsingException {
if (edition == null || edition.isEmpty()) {
return;
}
try {
String[] unpacked = edition.split("~");
if (edition.startsWith("~")) {
... | [
"protected",
"static",
"void",
"unpackEdition",
"(",
"String",
"edition",
",",
"CpeBuilder",
"cb",
",",
"boolean",
"lenient",
")",
"throws",
"CpeParsingException",
"{",
"if",
"(",
"edition",
"==",
"null",
"||",
"edition",
".",
"isEmpty",
"(",
")",
")",
"{",
... | In a CPE 2.2 URI the new fields from CPE 2.3 may be "packed" into the
edition field. If present, each field will be preceeded by a '~'.
Example, "~edition~swEdition~targetSw~targetHw~other".
@param edition the edition string to unpack
@param cb a reference to the CPE Builder to unpack the edition into
@param lenient w... | [
"In",
"a",
"CPE",
"2",
".",
"2",
"URI",
"the",
"new",
"fields",
"from",
"CPE",
"2",
".",
"3",
"may",
"be",
"packed",
"into",
"the",
"edition",
"field",
".",
"If",
"present",
"each",
"field",
"will",
"be",
"preceeded",
"by",
"a",
"~",
".",
"Example"... | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/CpeParser.java#L150-L181 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/CpeParser.java | CpeParser.parse23 | protected static Cpe parse23(String cpeString, boolean lenient) throws CpeParsingException {
if (cpeString == null || cpeString.isEmpty()) {
throw new CpeParsingException("CPE String is null ir enpty - unable to parse");
}
CpeBuilder cb = new CpeBuilder();
Cpe23PartIterator c... | java | protected static Cpe parse23(String cpeString, boolean lenient) throws CpeParsingException {
if (cpeString == null || cpeString.isEmpty()) {
throw new CpeParsingException("CPE String is null ir enpty - unable to parse");
}
CpeBuilder cb = new CpeBuilder();
Cpe23PartIterator c... | [
"protected",
"static",
"Cpe",
"parse23",
"(",
"String",
"cpeString",
",",
"boolean",
"lenient",
")",
"throws",
"CpeParsingException",
"{",
"if",
"(",
"cpeString",
"==",
"null",
"||",
"cpeString",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"CpeParsin... | Parses a CPE 2.3 Formatted String.
@param cpeString the CPE string to parse
@param lenient when <code>true</code> the parser will put in lenient mode
attempting to parse invalid CPE values.
@return the CPE object represented by the cpeString
@throws CpeParsingException thrown if the cpeString is invalid | [
"Parses",
"a",
"CPE",
"2",
".",
"3",
"Formatted",
"String",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/CpeParser.java#L203-L232 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/util/Validate.java | Validate.component | public static Status component(String value) {
if (value != null && !value.isEmpty()) {
if ("\\-".equals(value)) {
return Status.SINGLE_QUOTED_HYPHEN;
}
for (int x = 0; x < value.length(); x++) {
char c = value.charAt(x);
if (c ... | java | public static Status component(String value) {
if (value != null && !value.isEmpty()) {
if ("\\-".equals(value)) {
return Status.SINGLE_QUOTED_HYPHEN;
}
for (int x = 0; x < value.length(); x++) {
char c = value.charAt(x);
if (c ... | [
"public",
"static",
"Status",
"component",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"\"\\\\-\"",
".",
"equals",
"(",
"value",
")",
")",
"{",
"return",
"St... | Validates the component to ensure it meets the CPE 2.3 specification of
allowed values.
@param value the value to validate
@return the validation status given value;
@see us.springett.parsers.cpe.util.Status#isValid() | [
"Validates",
"the",
"component",
"to",
"ensure",
"it",
"meets",
"the",
"CPE",
"2",
".",
"3",
"specification",
"of",
"allowed",
"values",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/util/Validate.java#L61-L86 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/util/Validate.java | Validate.countCharacter | private static long countCharacter(String value, char c) {
return value.chars().filter(s -> s == c).count();
} | java | private static long countCharacter(String value, char c) {
return value.chars().filter(s -> s == c).count();
} | [
"private",
"static",
"long",
"countCharacter",
"(",
"String",
"value",
",",
"char",
"c",
")",
"{",
"return",
"value",
".",
"chars",
"(",
")",
".",
"filter",
"(",
"s",
"->",
"s",
"==",
"c",
")",
".",
"count",
"(",
")",
";",
"}"
] | Counts the number of times the char c is contained in the value.
@param value the string to search
@param c the character to count
@return the number of times the char c is contained in the value | [
"Counts",
"the",
"number",
"of",
"times",
"the",
"char",
"c",
"is",
"contained",
"in",
"the",
"value",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/util/Validate.java#L358-L360 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/util/Validate.java | Validate.cpe | public static Status cpe(String value) {
if ("cpe:2.3:".regionMatches(0, value, 0, 8)) {
return formattedString(value);
}
return cpeUri(value);
} | java | public static Status cpe(String value) {
if ("cpe:2.3:".regionMatches(0, value, 0, 8)) {
return formattedString(value);
}
return cpeUri(value);
} | [
"public",
"static",
"Status",
"cpe",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"\"cpe:2.3:\"",
".",
"regionMatches",
"(",
"0",
",",
"value",
",",
"0",
",",
"8",
")",
")",
"{",
"return",
"formattedString",
"(",
"value",
")",
";",
"}",
"return",
"cp... | Validates the given CPE string value to ensure it is either a valid CPE
URI or Formatted String.
@param value the CPE to validate
@return the validation status given value;
@see us.springett.parsers.cpe.util.Status#isValid() | [
"Validates",
"the",
"given",
"CPE",
"string",
"value",
"to",
"ensure",
"it",
"is",
"either",
"a",
"valid",
"CPE",
"URI",
"or",
"Formatted",
"String",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/util/Validate.java#L370-L375 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/util/Convert.java | Convert.fromWellFormed | public static String fromWellFormed(String value) {
if (value == null) {
return LogicalValue.ANY.getAbbreviation();
}
//return value.replaceAll("\\\\([^0-9A-Za-z])", "$1");
StringBuilder buffer = new StringBuilder(value);
char p = ' ';
for (int x = 0; x < buff... | java | public static String fromWellFormed(String value) {
if (value == null) {
return LogicalValue.ANY.getAbbreviation();
}
//return value.replaceAll("\\\\([^0-9A-Za-z])", "$1");
StringBuilder buffer = new StringBuilder(value);
char p = ' ';
for (int x = 0; x < buff... | [
"public",
"static",
"String",
"fromWellFormed",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"LogicalValue",
".",
"ANY",
".",
"getAbbreviation",
"(",
")",
";",
"}",
"//return value.replaceAll(\"\\\\\\\\([^0-9A-Za-z])\", \... | Transforms the given well formed string into a non-escaped string. A well
formed string has all non-alphanumeric characters escaped with a
backslash.
@param value the well formed string
@return the string value represented by the well formed string | [
"Transforms",
"the",
"given",
"well",
"formed",
"string",
"into",
"a",
"non",
"-",
"escaped",
"string",
".",
"A",
"well",
"formed",
"string",
"has",
"all",
"non",
"-",
"alphanumeric",
"characters",
"escaped",
"with",
"a",
"backslash",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/util/Convert.java#L87-L103 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/util/Convert.java | Convert.wellFormedToFS | public static String wellFormedToFS(Part value) {
if (value == null) {
return LogicalValue.ANY.getAbbreviation();
}
return value.getAbbreviation();
} | java | public static String wellFormedToFS(Part value) {
if (value == null) {
return LogicalValue.ANY.getAbbreviation();
}
return value.getAbbreviation();
} | [
"public",
"static",
"String",
"wellFormedToFS",
"(",
"Part",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"LogicalValue",
".",
"ANY",
".",
"getAbbreviation",
"(",
")",
";",
"}",
"return",
"value",
".",
"getAbbreviation",
"(",
... | Encodes the given value into the CPE 2.3 Formatted String representation.
@param value the component value to encode
@return the formatted string | [
"Encodes",
"the",
"given",
"value",
"into",
"the",
"CPE",
"2",
".",
"3",
"Formatted",
"String",
"representation",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/util/Convert.java#L251-L256 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/util/Convert.java | Convert.wellFormedToPattern | public static Pattern wellFormedToPattern(String value) {
StringBuilder sb = new StringBuilder(value.length() + 4);
for (int x = 0; x < value.length(); x++) {
if (value.charAt(x) == '*') {
sb.append(".*");
} else if (value.charAt(x) == '?') {
sb.ap... | java | public static Pattern wellFormedToPattern(String value) {
StringBuilder sb = new StringBuilder(value.length() + 4);
for (int x = 0; x < value.length(); x++) {
if (value.charAt(x) == '*') {
sb.append(".*");
} else if (value.charAt(x) == '?') {
sb.ap... | [
"public",
"static",
"Pattern",
"wellFormedToPattern",
"(",
"String",
"value",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"value",
".",
"length",
"(",
")",
"+",
"4",
")",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"v... | Converts a well formed string into a regular expression pattern.
@param value the well formed string to convert
@return the generated pattern object | [
"Converts",
"a",
"well",
"formed",
"string",
"into",
"a",
"regular",
"expression",
"pattern",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/util/Convert.java#L373-L391 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.validate | private void validate(String vendor1, String product1, String version1,
String update1, String edition1, String language1, String swEdition1,
String targetSw1, String targetHw1, String other1) throws CpeValidationException {
Status status = Validate.component(vendor1);
if (!statu... | java | private void validate(String vendor1, String product1, String version1,
String update1, String edition1, String language1, String swEdition1,
String targetSw1, String targetHw1, String other1) throws CpeValidationException {
Status status = Validate.component(vendor1);
if (!statu... | [
"private",
"void",
"validate",
"(",
"String",
"vendor1",
",",
"String",
"product1",
",",
"String",
"version1",
",",
"String",
"update1",
",",
"String",
"edition1",
",",
"String",
"language1",
",",
"String",
"swEdition1",
",",
"String",
"targetSw1",
",",
"Strin... | Validates the CPE attributes.
@param vendor1 the vendor
@param product1 the product
@param version1 the version
@param update1 the update version
@param edition1 the edition
@param language1 the language
@param swEdition1 the software edition
@param targetSw1 the target software
@param targetHw1 the target hardware
@p... | [
"Validates",
"the",
"CPE",
"attributes",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L151-L194 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.toCpe22Uri | @Override
public String toCpe22Uri() throws CpeEncodingException {
StringBuilder sb = new StringBuilder("cpe:/");
sb.append(Convert.wellFormedToCpeUri(part)).append(":");
sb.append(Convert.wellFormedToCpeUri(vendor)).append(":");
sb.append(Convert.wellFormedToCpeUri(product)).append(... | java | @Override
public String toCpe22Uri() throws CpeEncodingException {
StringBuilder sb = new StringBuilder("cpe:/");
sb.append(Convert.wellFormedToCpeUri(part)).append(":");
sb.append(Convert.wellFormedToCpeUri(vendor)).append(":");
sb.append(Convert.wellFormedToCpeUri(product)).append(... | [
"@",
"Override",
"public",
"String",
"toCpe22Uri",
"(",
")",
"throws",
"CpeEncodingException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"cpe:/\"",
")",
";",
"sb",
".",
"append",
"(",
"Convert",
".",
"wellFormedToCpeUri",
"(",
"part",
")"... | Converts the CPE into the CPE 2.2 URI format.
@return the CPE 2.2 URI format of the CPE
@throws CpeEncodingException thrown if the CPE is not well formed | [
"Converts",
"the",
"CPE",
"into",
"the",
"CPE",
"2",
".",
"2",
"URI",
"format",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L456-L486 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.toCpe23FS | @Override
public String toCpe23FS() {
return String.format("cpe:2.3:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s",
Convert.wellFormedToFS(part),
Convert.wellFormedToFS(vendor),
Convert.wellFormedToFS(product),
Convert.wellFormedToFS(version),
... | java | @Override
public String toCpe23FS() {
return String.format("cpe:2.3:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s",
Convert.wellFormedToFS(part),
Convert.wellFormedToFS(vendor),
Convert.wellFormedToFS(product),
Convert.wellFormedToFS(version),
... | [
"@",
"Override",
"public",
"String",
"toCpe23FS",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"cpe:2.3:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\"",
",",
"Convert",
".",
"wellFormedToFS",
"(",
"part",
")",
",",
"Convert",
".",
"wellFormedToFS",
"(",
"vendor",
... | Converts the CPE into the CPE 2.3 Formatted String.
@return the CPE 2.3 Formatted String | [
"Converts",
"the",
"CPE",
"into",
"the",
"CPE",
"2",
".",
"3",
"Formatted",
"String",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L493-L507 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.matches | @Override
public boolean matches(ICpe target) {
boolean result = true;
result &= compareAttributes(this.part, target.getPart());
result &= compareAttributes(this.vendor, target.getWellFormedVendor());
result &= compareAttributes(this.product, target.getWellFormedProduct());
r... | java | @Override
public boolean matches(ICpe target) {
boolean result = true;
result &= compareAttributes(this.part, target.getPart());
result &= compareAttributes(this.vendor, target.getWellFormedVendor());
result &= compareAttributes(this.product, target.getWellFormedProduct());
r... | [
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"ICpe",
"target",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"result",
"&=",
"compareAttributes",
"(",
"this",
".",
"part",
",",
"target",
".",
"getPart",
"(",
")",
")",
";",
"result",
"&=",
"... | Determines if the CPE matches the given target CPE. This does not follow
the CPE 2.3 Specification exactly as there are cases where undefined
comparisons will result in either true or false. For instance, 'ANY' will
match 'm+wild cards' and NA will return false when the target has 'm+wild
cards'.
@param target the tar... | [
"Determines",
"if",
"the",
"CPE",
"matches",
"the",
"given",
"target",
"CPE",
".",
"This",
"does",
"not",
"follow",
"the",
"CPE",
"2",
".",
"3",
"Specification",
"exactly",
"as",
"there",
"are",
"cases",
"where",
"undefined",
"comparisons",
"will",
"result",... | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L537-L552 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.containsSpecialCharacter | private static boolean containsSpecialCharacter(String value) {
for (int x = 0; x < value.length(); x++) {
char c = value.charAt(x);
if (c == '?' || c == '*') {
return true;
} else if (c == '\\') {
//skip the next character because it is quoted... | java | private static boolean containsSpecialCharacter(String value) {
for (int x = 0; x < value.length(); x++) {
char c = value.charAt(x);
if (c == '?' || c == '*') {
return true;
} else if (c == '\\') {
//skip the next character because it is quoted... | [
"private",
"static",
"boolean",
"containsSpecialCharacter",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"value",
".",
"length",
"(",
")",
";",
"x",
"++",
")",
"{",
"char",
"c",
"=",
"value",
".",
"charAt",
"("... | Determines if the string has an unquoted special character.
@param value the string to check
@return <code>true</code> if the string contains an unquoted special
character; otherwise <code>false</code> | [
"Determines",
"if",
"the",
"string",
"has",
"an",
"unquoted",
"special",
"character",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L644-L655 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.compareTo | @Override
public int compareTo(Object o) {
if (o instanceof ICpe) {
ICpe otherObject = (ICpe) o;
final int before = -1;
final int equal = 0;
final int after = 1;
if (this == otherObject) {
return equal;
}
i... | java | @Override
public int compareTo(Object o) {
if (o instanceof ICpe) {
ICpe otherObject = (ICpe) o;
final int before = -1;
final int equal = 0;
final int after = 1;
if (this == otherObject) {
return equal;
}
i... | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"instanceof",
"ICpe",
")",
"{",
"ICpe",
"otherObject",
"=",
"(",
"ICpe",
")",
"o",
";",
"final",
"int",
"before",
"=",
"-",
"1",
";",
"final",
"int",
"equa... | CompareTo is used for sorting, this does not implement any CPE Matching
rules.
@param o the CPE to compare
@return the sort order | [
"CompareTo",
"is",
"used",
"for",
"sorting",
"this",
"does",
"not",
"implement",
"any",
"CPE",
"Matching",
"rules",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L717-L798 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.compareVersions | protected static int compareVersions(String left, String right) {
int result = 0;
//while the strings are well formed - the backslashes will be in the exact
//same location in equal strings - for version numbers the cost of conversion
//should not be incurred
//final List<String>... | java | protected static int compareVersions(String left, String right) {
int result = 0;
//while the strings are well formed - the backslashes will be in the exact
//same location in equal strings - for version numbers the cost of conversion
//should not be incurred
//final List<String>... | [
"protected",
"static",
"int",
"compareVersions",
"(",
"String",
"left",
",",
"String",
"right",
")",
"{",
"int",
"result",
"=",
"0",
";",
"//while the strings are well formed - the backslashes will be in the exact",
"//same location in equal strings - for version numbers the cost... | Compare version numbers to obtain the correct ordering.
@param left the left hand version for comparison
@param right the right hand version for comparison
@return <code>-1</code> if left is before the right; <code>0</code> if
the left and right are equal;<code>1</code> if left is after the right | [
"Compare",
"version",
"numbers",
"to",
"obtain",
"the",
"correct",
"ordering",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L808-L844 | train |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/CpeBuilder.java | CpeBuilder.reset | protected void reset() {
part = Part.ANY;
vendor = LogicalValue.ANY.getAbbreviation();
product = LogicalValue.ANY.getAbbreviation();
version = LogicalValue.ANY.getAbbreviation();
update = LogicalValue.ANY.getAbbreviation();
edition = LogicalValue.ANY.getAbbreviation();
... | java | protected void reset() {
part = Part.ANY;
vendor = LogicalValue.ANY.getAbbreviation();
product = LogicalValue.ANY.getAbbreviation();
version = LogicalValue.ANY.getAbbreviation();
update = LogicalValue.ANY.getAbbreviation();
edition = LogicalValue.ANY.getAbbreviation();
... | [
"protected",
"void",
"reset",
"(",
")",
"{",
"part",
"=",
"Part",
".",
"ANY",
";",
"vendor",
"=",
"LogicalValue",
".",
"ANY",
".",
"getAbbreviation",
"(",
")",
";",
"product",
"=",
"LogicalValue",
".",
"ANY",
".",
"getAbbreviation",
"(",
")",
";",
"ver... | Resets the CPE Builder to a clean state. | [
"Resets",
"the",
"CPE",
"Builder",
"to",
"a",
"clean",
"state",
"."
] | e6324ca020dc0790097d3d62bb98aabf60e56843 | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/CpeBuilder.java#L81-L93 | train |
gtri/bk-tree | src/main/java/edu/gatech/gtri/bktree/MutableBkTree.java | MutableBkTree.add | public void add(E element) {
if (element == null) throw new NullPointerException();
if (root == null) {
root = new MutableNode<>(element);
} else {
MutableNode<E> node = root;
while (!node.getElement().equals(element)) {
int distance = distanc... | java | public void add(E element) {
if (element == null) throw new NullPointerException();
if (root == null) {
root = new MutableNode<>(element);
} else {
MutableNode<E> node = root;
while (!node.getElement().equals(element)) {
int distance = distanc... | [
"public",
"void",
"add",
"(",
"E",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"root",
"=",
"new",
"MutableNode",
"<>",
"(",
"element"... | Adds the given element to this tree, if it's not already present.
@param element element | [
"Adds",
"the",
"given",
"element",
"to",
"this",
"tree",
"if",
"it",
"s",
"not",
"already",
"present",
"."
] | fed9d01a85d63a8bb548995b5a455e784ed8b28d | https://github.com/gtri/bk-tree/blob/fed9d01a85d63a8bb548995b5a455e784ed8b28d/src/main/java/edu/gatech/gtri/bktree/MutableBkTree.java#L55-L74 | train |
gtri/bk-tree | src/main/java/edu/gatech/gtri/bktree/BkTreeSearcher.java | BkTreeSearcher.search | public Set<Match<? extends E>> search(E query, int maxDistance) {
if (query == null) throw new NullPointerException();
if (maxDistance < 0) throw new IllegalArgumentException("maxDistance must be non-negative");
Metric<? super E> metric = tree.getMetric();
Set<Match<? extends E>> match... | java | public Set<Match<? extends E>> search(E query, int maxDistance) {
if (query == null) throw new NullPointerException();
if (maxDistance < 0) throw new IllegalArgumentException("maxDistance must be non-negative");
Metric<? super E> metric = tree.getMetric();
Set<Match<? extends E>> match... | [
"public",
"Set",
"<",
"Match",
"<",
"?",
"extends",
"E",
">",
">",
"search",
"(",
"E",
"query",
",",
"int",
"maxDistance",
")",
"{",
"if",
"(",
"query",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"if",
"(",
"maxDistance... | Searches the tree for elements whose distance from the given query
is less than or equal to the given maximum distance.
@param query query against which to match tree elements
@param maxDistance non-negative maximum distance of matching elements from query
@return matching elements in no particular order | [
"Searches",
"the",
"tree",
"for",
"elements",
"whose",
"distance",
"from",
"the",
"given",
"query",
"is",
"less",
"than",
"or",
"equal",
"to",
"the",
"given",
"maximum",
"distance",
"."
] | fed9d01a85d63a8bb548995b5a455e784ed8b28d | https://github.com/gtri/bk-tree/blob/fed9d01a85d63a8bb548995b5a455e784ed8b28d/src/main/java/edu/gatech/gtri/bktree/BkTreeSearcher.java#L56-L94 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java | LoggingJBossASClient.isLogger | public boolean isLogger(String loggerName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
return null != readResource(addr);
} | java | public boolean isLogger(String loggerName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
return null != readResource(addr);
} | [
"public",
"boolean",
"isLogger",
"(",
"String",
"loggerName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"LOGGING",
",",
"LOGGER",
",",
"loggerName",
")",
";",
"return",
"... | Checks to see if there is already a logger with the given name.
@param loggerName the name to check (this is also known as the category name)
@return true if there is a logger/category with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"logger",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java#L44-L47 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java | LoggingJBossASClient.getLoggerLevel | public String getLoggerLevel(String loggerName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
return getStringAttribute("level", addr);
} | java | public String getLoggerLevel(String loggerName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
return getStringAttribute("level", addr);
} | [
"public",
"String",
"getLoggerLevel",
"(",
"String",
"loggerName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"LOGGING",
",",
"LOGGER",
",",
"loggerName",
")",
";",
"return"... | Returns the level of the given logger.
@param loggerName the name of the logger (this is also known as the category name)
@return level of the logger
@throws Exception if the log level could not be obtained (typically because the logger doesn't exist) | [
"Returns",
"the",
"level",
"of",
"the",
"given",
"logger",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java#L56-L59 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java | LoggingJBossASClient.setLoggerLevel | public void setLoggerLevel(String loggerName, String level) throws Exception {
final Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
final ModelNode request;
if (isLogger(loggerName)) {
request = createWriteAttributeRequest("level", level, addr);
... | java | public void setLoggerLevel(String loggerName, String level) throws Exception {
final Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
final ModelNode request;
if (isLogger(loggerName)) {
request = createWriteAttributeRequest("level", level, addr);
... | [
"public",
"void",
"setLoggerLevel",
"(",
"String",
"loggerName",
",",
"String",
"level",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"LOGGING",
",",
"LOGGER",
",",
... | Sets the logger to the given level.
If the logger does not exist yet, it will be created.
@param loggerName the logger name (this is also known as the category name)
@param level the new level of the logger (e.g. DEBUG, INFO, ERROR, etc.)
@throws Exception any error | [
"Sets",
"the",
"logger",
"to",
"the",
"given",
"level",
".",
"If",
"the",
"logger",
"does",
"not",
"exist",
"yet",
"it",
"will",
"be",
"created",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java#L69-L95 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.isWebSubsystem | public boolean isWebSubsystem() throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB);
return null != readResource(addr);
} | java | public boolean isWebSubsystem() throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB);
return null != readResource(addr);
} | [
"public",
"boolean",
"isWebSubsystem",
"(",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_WEB",
")",
";",
"return",
"null",
"!=",
"readResource",
"(",
"addr",
")",
... | Checks to see if the web subsystem exists. This should always exist unless
the server is just starting up and its web subsystem has not even initialized yet.
@return true if the web subsystem is ready
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"the",
"web",
"subsystem",
"exists",
".",
"This",
"should",
"always",
"exist",
"unless",
"the",
"server",
"is",
"just",
"starting",
"up",
"and",
"its",
"web",
"subsystem",
"has",
"not",
"even",
"initialized",
"yet",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L46-L49 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.setEnableWelcomeRoot | public void setEnableWelcomeRoot(boolean enableFlag) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, VIRTUAL_SERVER, DEFAULT_HOST);
final ModelNode req = createWriteAttributeRequest("enable-welcome-root", Boolean.toString(enableFlag), address);
final Model... | java | public void setEnableWelcomeRoot(boolean enableFlag) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, VIRTUAL_SERVER, DEFAULT_HOST);
final ModelNode req = createWriteAttributeRequest("enable-welcome-root", Boolean.toString(enableFlag), address);
final Model... | [
"public",
"void",
"setEnableWelcomeRoot",
"(",
"boolean",
"enableFlag",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"address",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_WEB",
",",
"VIRTUAL_SERVER",
",",
"DEFA... | The enable-welcome-root setting controls whether or not to deploy JBoss'
welcome-content application at root context. If you want to deploy your
own app at the root context, you need to disable the enable-welcome-root setting
on the default host virtual server. If you want to show the JBoss' welcome screen,
you need to... | [
"The",
"enable",
"-",
"welcome",
"-",
"root",
"setting",
"controls",
"whether",
"or",
"not",
"to",
"deploy",
"JBoss",
"welcome",
"-",
"content",
"application",
"at",
"root",
"context",
".",
"If",
"you",
"want",
"to",
"deploy",
"your",
"own",
"app",
"at",
... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L61-L69 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.isConnector | public boolean isConnector(String name) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name);
return null != readResource(address);
} | java | public boolean isConnector(String name) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name);
return null != readResource(address);
} | [
"public",
"boolean",
"isConnector",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"address",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_WEB",
",",
"CONNECTOR",
",",
"name",
")",
";",
... | Checks to see if there is already a connector with the given name.
@param name the name to check
@return true if there is a connector with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"connector",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L78-L81 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.getConnector | public ModelNode getConnector(String name) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name);
return readResource(address, true);
} | java | public ModelNode getConnector(String name) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name);
return readResource(address, true);
} | [
"public",
"ModelNode",
"getConnector",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"address",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_WEB",
",",
"CONNECTOR",
",",
"name",
")",
";"... | Returns the connector node with all its attributes. Will be null if it doesn't exist.
@param name the name of the connector whose node is to be returned
@return the node if there is a connector with the given name already in existence, null otherwise
@throws Exception any error | [
"Returns",
"the",
"connector",
"node",
"with",
"all",
"its",
"attributes",
".",
"Will",
"be",
"null",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L90-L93 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.changeConnector | public void changeConnector(String connectorName, String attribName, String attribValue) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, connectorName);
final ModelNode op = createWriteAttributeRequest(attribName, attribValue, address);
final Mo... | java | public void changeConnector(String connectorName, String attribName, String attribValue) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, connectorName);
final ModelNode op = createWriteAttributeRequest(attribName, attribValue, address);
final Mo... | [
"public",
"void",
"changeConnector",
"(",
"String",
"connectorName",
",",
"String",
"attribName",
",",
"String",
"attribValue",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"address",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",... | Use this to modify an attribute for an existing connector.
@param connectorName the existing connector whose attribute is to be changed
@param attribName the attribute to get a new value
@param attribValue the new value of the attribute
@throws Exception if failed to change the attribute on the named connector | [
"Use",
"this",
"to",
"modify",
"an",
"attribute",
"for",
"an",
"existing",
"connector",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L102-L110 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.removeConnector | public void removeConnector(String doomedConnectorName) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, doomedConnectorName);
if (isConnector(doomedConnectorName)) {
remove(address);
}
return;
} | java | public void removeConnector(String doomedConnectorName) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, doomedConnectorName);
if (isConnector(doomedConnectorName)) {
remove(address);
}
return;
} | [
"public",
"void",
"removeConnector",
"(",
"String",
"doomedConnectorName",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"address",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_WEB",
",",
"CONNECTOR",
",",
"doomed... | Removes the given web connector.
@param doomedConnectorName the name of the web connector to remove.
@throws Exception any error | [
"Removes",
"the",
"given",
"web",
"connector",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L118-L124 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.createWriteAttributeRequest | public static ModelNode createWriteAttributeRequest(String attributeName, String attributeValue, Address address) {
final ModelNode op = createRequest(WRITE_ATTRIBUTE, address);
op.get(NAME).set(attributeName);
setPossibleExpression(op, VALUE, attributeValue);
return op;
} | java | public static ModelNode createWriteAttributeRequest(String attributeName, String attributeValue, Address address) {
final ModelNode op = createRequest(WRITE_ATTRIBUTE, address);
op.get(NAME).set(attributeName);
setPossibleExpression(op, VALUE, attributeValue);
return op;
} | [
"public",
"static",
"ModelNode",
"createWriteAttributeRequest",
"(",
"String",
"attributeName",
",",
"String",
"attributeValue",
",",
"Address",
"address",
")",
"{",
"final",
"ModelNode",
"op",
"=",
"createRequest",
"(",
"WRITE_ATTRIBUTE",
",",
"address",
")",
";",
... | Convienence method that allows you to create request that writes a single attribute's
string value to a resource.
@param attributeName the name of the attribute whose value is to be written
@param attributeValue the attribute value that is to be written
@param address identifies the resource
@return the request | [
"Convienence",
"method",
"that",
"allows",
"you",
"to",
"create",
"request",
"that",
"writes",
"a",
"single",
"attribute",
"s",
"string",
"value",
"to",
"a",
"resource",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L111-L116 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.createRequest | public static ModelNode createRequest(String operation, Address address) {
return createRequest(operation, address, null);
} | java | public static ModelNode createRequest(String operation, Address address) {
return createRequest(operation, address, null);
} | [
"public",
"static",
"ModelNode",
"createRequest",
"(",
"String",
"operation",
",",
"Address",
"address",
")",
"{",
"return",
"createRequest",
"(",
"operation",
",",
"address",
",",
"null",
")",
";",
"}"
] | Convienence method that builds a partial operation request node.
@param operation the operation to be requested
@param address identifies the target resource
@return the partial operation request node - caller should fill this in further to complete the node | [
"Convienence",
"method",
"that",
"builds",
"a",
"partial",
"operation",
"request",
"node",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L125-L127 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.createRequest | public static ModelNode createRequest(String operation, Address address, ModelNode extra) {
final ModelNode request = (extra != null) ? extra.clone() : new ModelNode();
request.get(OPERATION).set(operation);
request.get(ADDRESS).set(address.getAddressNode());
return request;
} | java | public static ModelNode createRequest(String operation, Address address, ModelNode extra) {
final ModelNode request = (extra != null) ? extra.clone() : new ModelNode();
request.get(OPERATION).set(operation);
request.get(ADDRESS).set(address.getAddressNode());
return request;
} | [
"public",
"static",
"ModelNode",
"createRequest",
"(",
"String",
"operation",
",",
"Address",
"address",
",",
"ModelNode",
"extra",
")",
"{",
"final",
"ModelNode",
"request",
"=",
"(",
"extra",
"!=",
"null",
")",
"?",
"extra",
".",
"clone",
"(",
")",
":",
... | Convienence method that builds a partial operation request node, with additional
node properties supplied by the given node.
@param operation the operation to be requested
@param address identifies the target resource
@param extra provides additional properties to add to the returned request node.
@return the partial ... | [
"Convienence",
"method",
"that",
"builds",
"a",
"partial",
"operation",
"request",
"node",
"with",
"additional",
"node",
"properties",
"supplied",
"by",
"the",
"given",
"node",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L138-L143 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.createBatchRequest | public static ModelNode createBatchRequest(ModelNode... steps) {
final ModelNode composite = new ModelNode();
composite.get(OPERATION).set(BATCH);
composite.get(ADDRESS).setEmptyList();
final ModelNode stepsNode = composite.get(BATCH_STEPS);
for (ModelNode step : steps) {
... | java | public static ModelNode createBatchRequest(ModelNode... steps) {
final ModelNode composite = new ModelNode();
composite.get(OPERATION).set(BATCH);
composite.get(ADDRESS).setEmptyList();
final ModelNode stepsNode = composite.get(BATCH_STEPS);
for (ModelNode step : steps) {
... | [
"public",
"static",
"ModelNode",
"createBatchRequest",
"(",
"ModelNode",
"...",
"steps",
")",
"{",
"final",
"ModelNode",
"composite",
"=",
"new",
"ModelNode",
"(",
")",
";",
"composite",
".",
"get",
"(",
"OPERATION",
")",
".",
"set",
"(",
"BATCH",
")",
";"... | Creates a batch of operations that can be atomically invoked.
@param steps the different operation steps of the batch
@return the batch operation node | [
"Creates",
"a",
"batch",
"of",
"operations",
"that",
"can",
"be",
"atomically",
"invoked",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L152-L163 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.getResults | public static ModelNode getResults(ModelNode operationResult) {
if (!operationResult.hasDefined(RESULT)) {
return new ModelNode();
}
return operationResult.get(RESULT);
} | java | public static ModelNode getResults(ModelNode operationResult) {
if (!operationResult.hasDefined(RESULT)) {
return new ModelNode();
}
return operationResult.get(RESULT);
} | [
"public",
"static",
"ModelNode",
"getResults",
"(",
"ModelNode",
"operationResult",
")",
"{",
"if",
"(",
"!",
"operationResult",
".",
"hasDefined",
"(",
"RESULT",
")",
")",
"{",
"return",
"new",
"ModelNode",
"(",
")",
";",
"}",
"return",
"operationResult",
"... | If the given node has results, those results are returned in a ModelNode.
Otherwise, an empty node is returned.
@param operationResult the node to examine
@return the results as a ModelNode | [
"If",
"the",
"given",
"node",
"has",
"results",
"those",
"results",
"are",
"returned",
"in",
"a",
"ModelNode",
".",
"Otherwise",
"an",
"empty",
"node",
"is",
"returned",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L197-L203 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.execute | public ModelNode execute(ModelNode request) throws Exception {
ModelControllerClient mcc = getModelControllerClient();
return mcc.execute(request, OperationMessageHandler.logging);
} | java | public ModelNode execute(ModelNode request) throws Exception {
ModelControllerClient mcc = getModelControllerClient();
return mcc.execute(request, OperationMessageHandler.logging);
} | [
"public",
"ModelNode",
"execute",
"(",
"ModelNode",
"request",
")",
"throws",
"Exception",
"{",
"ModelControllerClient",
"mcc",
"=",
"getModelControllerClient",
"(",
")",
";",
"return",
"mcc",
".",
"execute",
"(",
"request",
",",
"OperationMessageHandler",
".",
"l... | Convienence method that executes the request.
@param request request to execute
@return results results of execution
@throws Exception any error | [
"Convienence",
"method",
"that",
"executes",
"the",
"request",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L282-L285 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.remove | public void remove(Address doomedAddr) throws Exception {
final ModelNode request = createRequest(REMOVE, doomedAddr);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response, "Failed to remove resource at address [" + doomedAddr +... | java | public void remove(Address doomedAddr) throws Exception {
final ModelNode request = createRequest(REMOVE, doomedAddr);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response, "Failed to remove resource at address [" + doomedAddr +... | [
"public",
"void",
"remove",
"(",
"Address",
"doomedAddr",
")",
"throws",
"Exception",
"{",
"final",
"ModelNode",
"request",
"=",
"createRequest",
"(",
"REMOVE",
",",
"doomedAddr",
")",
";",
"final",
"ModelNode",
"response",
"=",
"execute",
"(",
"request",
")",... | Removes the resource at the given address.
@param doomedAddr the address of the resource to remove
@throws Exception any error | [
"Removes",
"the",
"resource",
"at",
"the",
"given",
"address",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L329-L336 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DeploymentJBossASClient.java | DeploymentJBossASClient.deploy | public void deploy(String deploymentName, InputStream content, boolean enabled, Set<String> serverGroups,
boolean forceDeploy) {
if (serverGroups == null) {
serverGroups = Collections.emptySet();
}
DeploymentResult result = null;
try {
DeploymentMana... | java | public void deploy(String deploymentName, InputStream content, boolean enabled, Set<String> serverGroups,
boolean forceDeploy) {
if (serverGroups == null) {
serverGroups = Collections.emptySet();
}
DeploymentResult result = null;
try {
DeploymentMana... | [
"public",
"void",
"deploy",
"(",
"String",
"deploymentName",
",",
"InputStream",
"content",
",",
"boolean",
"enabled",
",",
"Set",
"<",
"String",
">",
"serverGroups",
",",
"boolean",
"forceDeploy",
")",
"{",
"if",
"(",
"serverGroups",
"==",
"null",
")",
"{",... | Uploads the content to the app server's content repository and then deploys the content.
If this is to be used for app servers in "domain" mode you have to pass in one or more
server groups. If this is to be used to deploy an app in a standalone server, the
server groups should be empty.
@param deploymentName name tha... | [
"Uploads",
"the",
"content",
"to",
"the",
"app",
"server",
"s",
"content",
"repository",
"and",
"then",
"deploys",
"the",
"content",
".",
"If",
"this",
"is",
"to",
"be",
"used",
"for",
"app",
"servers",
"in",
"domain",
"mode",
"you",
"have",
"to",
"pass"... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DeploymentJBossASClient.java#L107-L146 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DeploymentJBossASClient.java | DeploymentJBossASClient.undeploy | public void undeploy(String deploymentName, Set<String> serverGroups, boolean removeContent) {
if (serverGroups == null) {
serverGroups = Collections.emptySet();
}
DeploymentResult result = null;
try {
DeploymentManager dm = DeploymentManager.Factory.create(getM... | java | public void undeploy(String deploymentName, Set<String> serverGroups, boolean removeContent) {
if (serverGroups == null) {
serverGroups = Collections.emptySet();
}
DeploymentResult result = null;
try {
DeploymentManager dm = DeploymentManager.Factory.create(getM... | [
"public",
"void",
"undeploy",
"(",
"String",
"deploymentName",
",",
"Set",
"<",
"String",
">",
"serverGroups",
",",
"boolean",
"removeContent",
")",
"{",
"if",
"(",
"serverGroups",
"==",
"null",
")",
"{",
"serverGroups",
"=",
"Collections",
".",
"emptySet",
... | Undeploys an app. If an empty set of server groups is passed in, this will assume we are operating on a
standalone server.
@param deploymentName name that the app is known as
@param serverGroups the server groups where the application may already be deployed. If empty,
this will assume the app server is in STANDALONE ... | [
"Undeploys",
"an",
"app",
".",
"If",
"an",
"empty",
"set",
"of",
"server",
"groups",
"is",
"passed",
"in",
"this",
"will",
"assume",
"we",
"are",
"operating",
"on",
"a",
"standalone",
"server",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DeploymentJBossASClient.java#L157-L193 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/VaultJBossASClient.java | VaultJBossASClient.isVault | public boolean isVault() throws Exception {
Address addr = Address.root().add(CORE_SERVICE, VAULT);
final ModelNode queryNode = createRequest(READ_RESOURCE, addr);
final ModelNode results = execute(queryNode);
if (isSuccess(results)) {
return true;
}
return f... | java | public boolean isVault() throws Exception {
Address addr = Address.root().add(CORE_SERVICE, VAULT);
final ModelNode queryNode = createRequest(READ_RESOURCE, addr);
final ModelNode results = execute(queryNode);
if (isSuccess(results)) {
return true;
}
return f... | [
"public",
"boolean",
"isVault",
"(",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"CORE_SERVICE",
",",
"VAULT",
")",
";",
"final",
"ModelNode",
"queryNode",
"=",
"createRequest",
"(",
"READ_RES... | Checks to see if there is already a vault configured.
@return true if the vault is already configured
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"vault",
"configured",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/VaultJBossASClient.java#L42-L51 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/VaultJBossASClient.java | VaultJBossASClient.getVaultClass | public String getVaultClass() throws Exception {
Address addr = Address.root().add(CORE_SERVICE, VAULT);
ModelNode vaultNode = readResource(addr);
if (vaultNode == null) {
return null;
}
ModelNode codeNode = vaultNode.get("code");
if (codeNode == null) {
... | java | public String getVaultClass() throws Exception {
Address addr = Address.root().add(CORE_SERVICE, VAULT);
ModelNode vaultNode = readResource(addr);
if (vaultNode == null) {
return null;
}
ModelNode codeNode = vaultNode.get("code");
if (codeNode == null) {
... | [
"public",
"String",
"getVaultClass",
"(",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"CORE_SERVICE",
",",
"VAULT",
")",
";",
"ModelNode",
"vaultNode",
"=",
"readResource",
"(",
"addr",
")",
... | Attempts to retrieve the configured class for the vault. This method will
return null if no vault is configured or if the vault does not have a custom
vault class.
@return vault configured class
@throws Exception any error | [
"Attempts",
"to",
"retrieve",
"the",
"configured",
"class",
"for",
"the",
"vault",
".",
"This",
"method",
"will",
"return",
"null",
"if",
"no",
"vault",
"is",
"configured",
"or",
"if",
"the",
"vault",
"does",
"not",
"have",
"a",
"custom",
"vault",
"class",... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/VaultJBossASClient.java#L61-L75 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/VaultJBossASClient.java | VaultJBossASClient.createNewVaultRequest | public ModelNode createNewVaultRequest(String className) {
String dmrTemplate = "" //
+ "{" //
+ "\"code\" => \"%s\""
+ "}";
String dmr = String.format(dmrTemplate, className);
Address addr = Address.root().add(CORE_SERVICE, VAULT);
final ModelNode r... | java | public ModelNode createNewVaultRequest(String className) {
String dmrTemplate = "" //
+ "{" //
+ "\"code\" => \"%s\""
+ "}";
String dmr = String.format(dmrTemplate, className);
Address addr = Address.root().add(CORE_SERVICE, VAULT);
final ModelNode r... | [
"public",
"ModelNode",
"createNewVaultRequest",
"(",
"String",
"className",
")",
"{",
"String",
"dmrTemplate",
"=",
"\"\"",
"//",
"+",
"\"{\"",
"//",
"+",
"\"\\\"code\\\" => \\\"%s\\\"\"",
"+",
"\"}\"",
";",
"String",
"dmr",
"=",
"String",
".",
"format",
"(",
... | Returns a ModelNode that can be used to create the vault.
Callers are free to tweak the queue request that is returned,
if they so choose, before asking the client to execute the request.
@param className class name for the custom vault
@return the request that can be used to create the vault | [
"Returns",
"a",
"ModelNode",
"that",
"can",
"be",
"used",
"to",
"create",
"the",
"vault",
".",
"Callers",
"are",
"free",
"to",
"tweak",
"the",
"queue",
"request",
"that",
"is",
"returned",
"if",
"they",
"so",
"choose",
"before",
"asking",
"the",
"client",
... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/VaultJBossASClient.java#L86-L100 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.setEnableAdminConsole | public void setEnableAdminConsole(boolean enableFlag) throws Exception {
final Address address = Address.root()
.add(CORE_SERVICE, CORE_SERVICE_MGMT, MGMT_INTERFACE, MGMT_INTERFACE_HTTP);
final ModelNode req = createWriteAttributeRequest("console-enabled", Boolean.toString(enableFlag), a... | java | public void setEnableAdminConsole(boolean enableFlag) throws Exception {
final Address address = Address.root()
.add(CORE_SERVICE, CORE_SERVICE_MGMT, MGMT_INTERFACE, MGMT_INTERFACE_HTTP);
final ModelNode req = createWriteAttributeRequest("console-enabled", Boolean.toString(enableFlag), a... | [
"public",
"void",
"setEnableAdminConsole",
"(",
"boolean",
"enableFlag",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"address",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"CORE_SERVICE",
",",
"CORE_SERVICE_MGMT",
",",
"MGMT_INTERFACE",
",",... | Allows the caller to turn on or off complete access for the app server's admin console.
@param enableFlag true if the admin console enabled and visible;
false if you want to prohibit all access to the admin console
@throws Exception any error | [
"Allows",
"the",
"caller",
"to",
"turn",
"on",
"or",
"off",
"complete",
"access",
"for",
"the",
"app",
"server",
"s",
"admin",
"console",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L56-L65 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.getSystemProperties | public Properties getSystemProperties() throws Exception {
final String[] address = { CORE_SERVICE, PLATFORM_MBEAN, "type", "runtime" };
final ModelNode op = createReadAttributeRequest(true, "system-properties", Address.root().add(address));
final ModelNode results = execute(op);
if (isS... | java | public Properties getSystemProperties() throws Exception {
final String[] address = { CORE_SERVICE, PLATFORM_MBEAN, "type", "runtime" };
final ModelNode op = createReadAttributeRequest(true, "system-properties", Address.root().add(address));
final ModelNode results = execute(op);
if (isS... | [
"public",
"Properties",
"getSystemProperties",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"[",
"]",
"address",
"=",
"{",
"CORE_SERVICE",
",",
"PLATFORM_MBEAN",
",",
"\"type\"",
",",
"\"runtime\"",
"}",
";",
"final",
"ModelNode",
"op",
"=",
"creat... | This returns the system properties that are set in the AS JVM. This is not the system properties
in the JVM of this client object - it is actually the system properties in the remote
JVM of the AS instance that the client is talking to.
@return the AS JVM's system properties
@throws Exception any error | [
"This",
"returns",
"the",
"system",
"properties",
"that",
"are",
"set",
"in",
"the",
"AS",
"JVM",
".",
"This",
"is",
"not",
"the",
"system",
"properties",
"in",
"the",
"JVM",
"of",
"this",
"client",
"object",
"-",
"it",
"is",
"actually",
"the",
"system",... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L98-L118 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.setAppServerDefaultDeploymentScanEnabled | public void setAppServerDefaultDeploymentScanEnabled(boolean enabled) throws Exception {
final String[] addressArr = { SUBSYSTEM, DEPLOYMENT_SCANNER, SCANNER, "default" };
final Address address = Address.root().add(addressArr);
final ModelNode req = createWriteAttributeRequest("scan-enabled", Bo... | java | public void setAppServerDefaultDeploymentScanEnabled(boolean enabled) throws Exception {
final String[] addressArr = { SUBSYSTEM, DEPLOYMENT_SCANNER, SCANNER, "default" };
final Address address = Address.root().add(addressArr);
final ModelNode req = createWriteAttributeRequest("scan-enabled", Bo... | [
"public",
"void",
"setAppServerDefaultDeploymentScanEnabled",
"(",
"boolean",
"enabled",
")",
"throws",
"Exception",
"{",
"final",
"String",
"[",
"]",
"addressArr",
"=",
"{",
"SUBSYSTEM",
",",
"DEPLOYMENT_SCANNER",
",",
"SCANNER",
",",
"\"default\"",
"}",
";",
"fi... | Enabled or disables the default deployment scanner.
@param enabled the new status to be set
@throws Exception any error | [
"Enabled",
"or",
"disables",
"the",
"default",
"deployment",
"scanner",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L182-L192 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.getAppServerDefaultDeploymentDir | public String getAppServerDefaultDeploymentDir() throws Exception {
final String[] addressArr = { SUBSYSTEM, DEPLOYMENT_SCANNER, SCANNER, "default" };
final Address address = Address.root().add(addressArr);
final ModelNode resourceAttributes = readResource(address);
if (resourceAttribut... | java | public String getAppServerDefaultDeploymentDir() throws Exception {
final String[] addressArr = { SUBSYSTEM, DEPLOYMENT_SCANNER, SCANNER, "default" };
final Address address = Address.root().add(addressArr);
final ModelNode resourceAttributes = readResource(address);
if (resourceAttribut... | [
"public",
"String",
"getAppServerDefaultDeploymentDir",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"[",
"]",
"addressArr",
"=",
"{",
"SUBSYSTEM",
",",
"DEPLOYMENT_SCANNER",
",",
"SCANNER",
",",
"\"default\"",
"}",
";",
"final",
"Address",
"address",
... | Returns the location where the default deployment scanner is pointing to.
This is where EARs, WARs and the like are deployed to.
@return the default deployments directory - null if there is no deployment scanner
@throws Exception any error | [
"Returns",
"the",
"location",
"where",
"the",
"default",
"deployment",
"scanner",
"is",
"pointing",
"to",
".",
"This",
"is",
"where",
"EARs",
"WARs",
"and",
"the",
"like",
"are",
"deployed",
"to",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L200-L231 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.setAppServerDefaultDeploymentTimeout | public void setAppServerDefaultDeploymentTimeout(long secs) throws Exception {
final String[] addressArr = { SUBSYSTEM, DEPLOYMENT_SCANNER, SCANNER, "default" };
final Address address = Address.root().add(addressArr);
final ModelNode req = createWriteAttributeRequest("deployment-timeout", Long.t... | java | public void setAppServerDefaultDeploymentTimeout(long secs) throws Exception {
final String[] addressArr = { SUBSYSTEM, DEPLOYMENT_SCANNER, SCANNER, "default" };
final Address address = Address.root().add(addressArr);
final ModelNode req = createWriteAttributeRequest("deployment-timeout", Long.t... | [
"public",
"void",
"setAppServerDefaultDeploymentTimeout",
"(",
"long",
"secs",
")",
"throws",
"Exception",
"{",
"final",
"String",
"[",
"]",
"addressArr",
"=",
"{",
"SUBSYSTEM",
",",
"DEPLOYMENT_SCANNER",
",",
"SCANNER",
",",
"\"default\"",
"}",
";",
"final",
"A... | Sets the deployment timeout of the default deployment scanner. If a deployment
takes longer than this value, it will fail.
@param secs number of seconds the app server will wait for a deployment to finish
@throws Exception any error | [
"Sets",
"the",
"deployment",
"timeout",
"of",
"the",
"default",
"deployment",
"scanner",
".",
"If",
"a",
"deployment",
"takes",
"longer",
"than",
"this",
"value",
"it",
"will",
"fail",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L257-L267 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.setSystemProperty | public void setSystemProperty(String name, String value) throws Exception {
final ModelNode request = createRequest(ADD, Address.root().add(SYSTEM_PROPERTY, name));
request.get(VALUE).set(value);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw n... | java | public void setSystemProperty(String name, String value) throws Exception {
final ModelNode request = createRequest(ADD, Address.root().add(SYSTEM_PROPERTY, name));
request.get(VALUE).set(value);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw n... | [
"public",
"void",
"setSystemProperty",
"(",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"final",
"ModelNode",
"request",
"=",
"createRequest",
"(",
"ADD",
",",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SYSTEM_PROPERTY... | Set a runtime system property in the JVM that is managed by JBossAS.
@param name system property name to set
@param value the new value of the system property
@throws Exception any error | [
"Set",
"a",
"runtime",
"system",
"property",
"in",
"the",
"JVM",
"that",
"is",
"managed",
"by",
"JBossAS",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L276-L283 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.addExtension | public void addExtension(String name) throws Exception {
// /extension=<name>/:add(module=<name>)
final ModelNode request = createRequest(ADD, Address.root().add(EXTENSION, name));
request.get(MODULE).set(name);
final ModelNode response = execute(request);
if (!isSuccess(response... | java | public void addExtension(String name) throws Exception {
// /extension=<name>/:add(module=<name>)
final ModelNode request = createRequest(ADD, Address.root().add(EXTENSION, name));
request.get(MODULE).set(name);
final ModelNode response = execute(request);
if (!isSuccess(response... | [
"public",
"void",
"addExtension",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"// /extension=<name>/:add(module=<name>)",
"final",
"ModelNode",
"request",
"=",
"createRequest",
"(",
"ADD",
",",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"EXTE... | Adds a new module extension to the core system.
@param name the name of the new module extension
@throws Exception any error | [
"Adds",
"a",
"new",
"module",
"extension",
"to",
"the",
"core",
"system",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L291-L300 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.isExtension | public boolean isExtension(String name) throws Exception {
return null != readResource(Address.root().add(EXTENSION, name));
} | java | public boolean isExtension(String name) throws Exception {
return null != readResource(Address.root().add(EXTENSION, name));
} | [
"public",
"boolean",
"isExtension",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"return",
"null",
"!=",
"readResource",
"(",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"EXTENSION",
",",
"name",
")",
")",
";",
"}"
] | Returns true if the given extension is already in existence.
@param name the name of the extension to check
@return true if the extension already exists; false if not
@throws Exception any error | [
"Returns",
"true",
"if",
"the",
"given",
"extension",
"is",
"already",
"in",
"existence",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L309-L311 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.isSubsystem | public boolean isSubsystem(String name) throws Exception {
return null != readResource(Address.root().add(SUBSYSTEM, name));
} | java | public boolean isSubsystem(String name) throws Exception {
return null != readResource(Address.root().add(SUBSYSTEM, name));
} | [
"public",
"boolean",
"isSubsystem",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"return",
"null",
"!=",
"readResource",
"(",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"name",
")",
")",
";",
"}"
] | Returns true if the given subsystem is already in existence.
@param name the name of the subsystem to check
@return true if the subsystem already exists; false if not
@throws Exception any error | [
"Returns",
"true",
"if",
"the",
"given",
"subsystem",
"is",
"already",
"in",
"existence",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L348-L350 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.reload | public void reload(boolean adminOnly) throws Exception {
final ModelNode request = createRequest("reload", Address.root());
request.get("admin-only").set(adminOnly);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response);... | java | public void reload(boolean adminOnly) throws Exception {
final ModelNode request = createRequest("reload", Address.root());
request.get("admin-only").set(adminOnly);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response);... | [
"public",
"void",
"reload",
"(",
"boolean",
"adminOnly",
")",
"throws",
"Exception",
"{",
"final",
"ModelNode",
"request",
"=",
"createRequest",
"(",
"\"reload\"",
",",
"Address",
".",
"root",
"(",
")",
")",
";",
"request",
".",
"get",
"(",
"\"admin-only\"",... | Invokes the management "reload" operation which will shut down all the app server services and
restart them again potentially in admin-only mode.
This does not shutdown the JVM itself.
NOTE: once this method returns, the client is probably unusable since the server side
will probably shutdown the connection. You will ... | [
"Invokes",
"the",
"management",
"reload",
"operation",
"which",
"will",
"shut",
"down",
"all",
"the",
"app",
"server",
"services",
"and",
"restart",
"them",
"again",
"potentially",
"in",
"admin",
"-",
"only",
"mode",
".",
"This",
"does",
"not",
"shutdown",
"... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L380-L388 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.shutdown | public void shutdown(boolean restart) throws Exception {
final ModelNode request = createRequest("shutdown", Address.root());
request.get("restart").set(restart);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response);
... | java | public void shutdown(boolean restart) throws Exception {
final ModelNode request = createRequest("shutdown", Address.root());
request.get("restart").set(restart);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response);
... | [
"public",
"void",
"shutdown",
"(",
"boolean",
"restart",
")",
"throws",
"Exception",
"{",
"final",
"ModelNode",
"request",
"=",
"createRequest",
"(",
"\"shutdown\"",
",",
"Address",
".",
"root",
"(",
")",
")",
";",
"request",
".",
"get",
"(",
"\"restart\"",
... | Invokes the management "shutdown" operation that kills the JVM completely with System.exit.
If restart is set to true, the JVM will immediately be restarted again. If restart is false,
the JVM is killed and will stay down.
Note that in either case, the caller may not be returned to since the JVM in which this call is m... | [
"Invokes",
"the",
"management",
"shutdown",
"operation",
"that",
"kills",
"the",
"JVM",
"completely",
"with",
"System",
".",
"exit",
".",
"If",
"restart",
"is",
"set",
"to",
"true",
"the",
"JVM",
"will",
"immediately",
"be",
"restarted",
"again",
".",
"If",
... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L423-L431 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/MessagingJBossASClient.java | MessagingJBossASClient.isQueue | public boolean isQueue(String queueName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default");
String haystack = JMS_QUEUE;
return null != findNodeInList(addr, haystack, queueName);
} | java | public boolean isQueue(String queueName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default");
String haystack = JMS_QUEUE;
return null != findNodeInList(addr, haystack, queueName);
} | [
"public",
"boolean",
"isQueue",
"(",
"String",
"queueName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_MESSAGING",
",",
"HORNETQ_SERVER",
",",
"\"default\"",
")",
"... | Checks to see if there is already a queue with the given name.
@param queueName the name to check
@return true if there is a queue with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"queue",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/MessagingJBossASClient.java#L47-L51 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/MessagingJBossASClient.java | MessagingJBossASClient.createNewQueueRequest | public ModelNode createNewQueueRequest(String name, Boolean durable, List<String> entryNames) {
String dmrTemplate = "" //
+ "{" //
+ "\"durable\" => \"%s\", " //
+ "\"entries\" => [\"%s\"] " //
+ "}";
String dmr = String.format(dmrTemplate, ((null == du... | java | public ModelNode createNewQueueRequest(String name, Boolean durable, List<String> entryNames) {
String dmrTemplate = "" //
+ "{" //
+ "\"durable\" => \"%s\", " //
+ "\"entries\" => [\"%s\"] " //
+ "}";
String dmr = String.format(dmrTemplate, ((null == du... | [
"public",
"ModelNode",
"createNewQueueRequest",
"(",
"String",
"name",
",",
"Boolean",
"durable",
",",
"List",
"<",
"String",
">",
"entryNames",
")",
"{",
"String",
"dmrTemplate",
"=",
"\"\"",
"//",
"+",
"\"{\"",
"//",
"+",
"\"\\\"durable\\\" => \\\"%s\\\", \"",
... | Returns a ModelNode that can be used to create a queue.
Callers are free to tweak the queue request that is returned,
if they so choose, before asking the client to execute the request.
@param name the queue name
@param durable if null, default is "true"
@param entryNames the jndiNames, each is prefixed with 'java:/'.... | [
"Returns",
"a",
"ModelNode",
"that",
"can",
"be",
"used",
"to",
"create",
"a",
"queue",
".",
"Callers",
"are",
"free",
"to",
"tweak",
"the",
"queue",
"request",
"that",
"is",
"returned",
"if",
"they",
"so",
"choose",
"before",
"asking",
"the",
"client",
... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/MessagingJBossASClient.java#L64-L80 | train |
hawkular/hawkular-agent | hawkular-javaagent/src/main/java/org/hawkular/agent/javaagent/Util.java | Util.cloneArray | @SuppressWarnings("unchecked")
public static <T> T[] cloneArray(T[] original) {
if (original == null) {
return null;
}
try {
Class<?> clazz = original.getClass().getComponentType();
T[] copy = (T[]) Array.newInstance(clazz, original.length);
i... | java | @SuppressWarnings("unchecked")
public static <T> T[] cloneArray(T[] original) {
if (original == null) {
return null;
}
try {
Class<?> clazz = original.getClass().getComponentType();
T[] copy = (T[]) Array.newInstance(clazz, original.length);
i... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"cloneArray",
"(",
"T",
"[",
"]",
"original",
")",
"{",
"if",
"(",
"original",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"Cl... | Performs a deep copy of the given array by calling a copy constructor to build clones of each array element. | [
"Performs",
"a",
"deep",
"copy",
"of",
"the",
"given",
"array",
"by",
"calling",
"a",
"copy",
"constructor",
"to",
"build",
"clones",
"of",
"each",
"array",
"element",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-javaagent/src/main/java/org/hawkular/agent/javaagent/Util.java#L27-L47 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java | SecurityDomainJBossASClient.isSecurityDomain | public boolean isSecurityDomain(String securityDomainName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY);
String haystack = SECURITY_DOMAIN;
return null != findNodeInList(addr, haystack, securityDomainName);
} | java | public boolean isSecurityDomain(String securityDomainName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY);
String haystack = SECURITY_DOMAIN;
return null != findNodeInList(addr, haystack, securityDomainName);
} | [
"public",
"boolean",
"isSecurityDomain",
"(",
"String",
"securityDomainName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_SECURITY",
")",
";",
"String",
"haystack",
"=... | Checks to see if there is already a security domain with the given name.
@param securityDomainName the name to check
@return true if there is a security domain with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"security",
"domain",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L66-L70 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java | SecurityDomainJBossASClient.createNewSecureIdentitySecurityDomain72 | public void createNewSecureIdentitySecurityDomain72(String securityDomainName, String username, String password)
throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
ModelNode addTopNode = createRequest(ADD, addr);
... | java | public void createNewSecureIdentitySecurityDomain72(String securityDomainName, String username, String password)
throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
ModelNode addTopNode = createRequest(ADD, addr);
... | [
"public",
"void",
"createNewSecureIdentitySecurityDomain72",
"(",
"String",
"securityDomainName",
",",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"S... | Create a new security domain using the SecureIdentity authentication method.
This is used when you want to obfuscate a database password in the configuration.
This is the version for as7.2+ (e.g. eap 6.1)
@param securityDomainName the name of the new security domain
@param username the username associated with the se... | [
"Create",
"a",
"new",
"security",
"domain",
"using",
"the",
"SecureIdentity",
"authentication",
"method",
".",
"This",
"is",
"used",
"when",
"you",
"want",
"to",
"obfuscate",
"a",
"database",
"password",
"in",
"the",
"configuration",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L85-L113 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java | SecurityDomainJBossASClient.getSecureIdentitySecurityDomainModuleOptions | public ModelNode getSecureIdentitySecurityDomainModuleOptions(String securityDomainName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName,
AUTHENTICATION, CLASSIC);
ModelNode authResource = readResource(addr);
... | java | public ModelNode getSecureIdentitySecurityDomainModuleOptions(String securityDomainName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName,
AUTHENTICATION, CLASSIC);
ModelNode authResource = readResource(addr);
... | [
"public",
"ModelNode",
"getSecureIdentitySecurityDomainModuleOptions",
"(",
"String",
"securityDomainName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_SECURITY",
",",
"SECU... | Given the name of an existing security domain that uses the SecureIdentity authentication method,
this returns the module options for that security domain authentication method. This includes
the username and password of the domain.
@param securityDomainName the name of the security domain whose module options are to ... | [
"Given",
"the",
"name",
"of",
"an",
"existing",
"security",
"domain",
"that",
"uses",
"the",
"SecureIdentity",
"authentication",
"method",
"this",
"returns",
"the",
"module",
"options",
"for",
"that",
"security",
"domain",
"authentication",
"method",
".",
"This",
... | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L177-L192 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java | SecurityDomainJBossASClient.removeSecurityDomain | public void removeSecurityDomain(String securityDomainName) throws Exception {
// If not there just return
if (!isSecurityDomain(securityDomainName)) {
return;
}
final Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
... | java | public void removeSecurityDomain(String securityDomainName) throws Exception {
// If not there just return
if (!isSecurityDomain(securityDomainName)) {
return;
}
final Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
... | [
"public",
"void",
"removeSecurityDomain",
"(",
"String",
"securityDomainName",
")",
"throws",
"Exception",
"{",
"// If not there just return",
"if",
"(",
"!",
"isSecurityDomain",
"(",
"securityDomainName",
")",
")",
"{",
"return",
";",
"}",
"final",
"Address",
"addr... | Convenience method that removes a security domain by name. Useful when changing the characteristics of the
login modules.
@param securityDomainName the name of the new security domain
@throws Exception if failed to remove the security domain | [
"Convenience",
"method",
"that",
"removes",
"a",
"security",
"domain",
"by",
"name",
".",
"Useful",
"when",
"changing",
"the",
"characteristics",
"of",
"the",
"login",
"modules",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L247-L263 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java | SecurityDomainJBossASClient.createNewSecurityDomain | public void createNewSecurityDomain(String securityDomainName, LoginModuleRequest... loginModules)
throws Exception {
//do not close the controller client here, we're using our own..
CoreJBossASClient coreClient = new CoreJBossASClient(getModelControllerClient());
String serverVersio... | java | public void createNewSecurityDomain(String securityDomainName, LoginModuleRequest... loginModules)
throws Exception {
//do not close the controller client here, we're using our own..
CoreJBossASClient coreClient = new CoreJBossASClient(getModelControllerClient());
String serverVersio... | [
"public",
"void",
"createNewSecurityDomain",
"(",
"String",
"securityDomainName",
",",
"LoginModuleRequest",
"...",
"loginModules",
")",
"throws",
"Exception",
"{",
"//do not close the controller client here, we're using our own..",
"CoreJBossASClient",
"coreClient",
"=",
"new",
... | Creates a new security domain including one or more login modules.
The security domain will be replaced if it exists.
@param securityDomainName the name of the new security domain
@param loginModules an array of login modules to place in the security domain.
They are ordered top-down in the same index order of the arr... | [
"Creates",
"a",
"new",
"security",
"domain",
"including",
"one",
"or",
"more",
"login",
"modules",
".",
"The",
"security",
"domain",
"will",
"be",
"replaced",
"if",
"it",
"exists",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L274-L286 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java | SecurityDomainJBossASClient.securityDomainHasLoginModule | public boolean securityDomainHasLoginModule(String domainName, String moduleName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, domainName);
addr.add(AUTHENTICATION, CLASSIC);
addr.add(LOGIN_MODULE, moduleName);
ModelNode request = c... | java | public boolean securityDomainHasLoginModule(String domainName, String moduleName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, domainName);
addr.add(AUTHENTICATION, CLASSIC);
addr.add(LOGIN_MODULE, moduleName);
ModelNode request = c... | [
"public",
"boolean",
"securityDomainHasLoginModule",
"(",
"String",
"domainName",
",",
"String",
"moduleName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_SECURITY",
","... | Check if a certain login module is present inside the passed security domain
@param domainName Name of the security domain
@param moduleName Name of the Login module - wich usually is it FQCN
@return True if the module is present
@throws Exception any error | [
"Check",
"if",
"a",
"certain",
"login",
"module",
"is",
"present",
"inside",
"the",
"passed",
"security",
"domain"
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L406-L413 | train |
hawkular/hawkular-agent | hawkular-javaagent/src/main/java/org/hawkular/agent/javaagent/config/ConfigConverter.java | ConfigConverter.populateMetricTypesForResourceType | private static <L> void populateMetricTypesForResourceType(
ResourceType.Builder<?, L> resourceTypeBuilder,
TypeSets.Builder<L> typeSetsBuilder) {
Map<Name, TypeSet<MetricType<L>>> metricTypeSets = typeSetsBuilder.getMetricTypeSets();
List<Name> metricSetNames = resourceTypeBuil... | java | private static <L> void populateMetricTypesForResourceType(
ResourceType.Builder<?, L> resourceTypeBuilder,
TypeSets.Builder<L> typeSetsBuilder) {
Map<Name, TypeSet<MetricType<L>>> metricTypeSets = typeSetsBuilder.getMetricTypeSets();
List<Name> metricSetNames = resourceTypeBuil... | [
"private",
"static",
"<",
"L",
">",
"void",
"populateMetricTypesForResourceType",
"(",
"ResourceType",
".",
"Builder",
"<",
"?",
",",
"L",
">",
"resourceTypeBuilder",
",",
"TypeSets",
".",
"Builder",
"<",
"L",
">",
"typeSetsBuilder",
")",
"{",
"Map",
"<",
"N... | Given a resource type builder, this will fill in its metric types.
@param resourceTypeBuilder the type being built whose metric types are to be filled in
@param typeSetsBuilder all type metadata - this is where our metrics are | [
"Given",
"a",
"resource",
"type",
"builder",
"this",
"will",
"fill",
"in",
"its",
"metric",
"types",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-javaagent/src/main/java/org/hawkular/agent/javaagent/config/ConfigConverter.java#L529-L542 | train |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/Discovery.java | Discovery.discoverChildren | public <N, S extends Session<L>> void discoverChildren(
Resource<L> parent,
ResourceType<L> childType,
Session<L> session,
EndpointService<L, S> service,
Consumer<Resource<L>> resourceConsumer) {
try {
L parentLocation = parent != null ? ... | java | public <N, S extends Session<L>> void discoverChildren(
Resource<L> parent,
ResourceType<L> childType,
Session<L> session,
EndpointService<L, S> service,
Consumer<Resource<L>> resourceConsumer) {
try {
L parentLocation = parent != null ? ... | [
"public",
"<",
"N",
",",
"S",
"extends",
"Session",
"<",
"L",
">",
">",
"void",
"discoverChildren",
"(",
"Resource",
"<",
"L",
">",
"parent",
",",
"ResourceType",
"<",
"L",
">",
"childType",
",",
"Session",
"<",
"L",
">",
"session",
",",
"EndpointServi... | Discovers children of the given type underneath the given parent.
@param parent look under this resource to find its children (if null, this looks for root resources)
@param childType only find children of this type
@param session session used to query the managed endpoint
@param samplingService the service that colle... | [
"Discovers",
"children",
"of",
"the",
"given",
"type",
"underneath",
"the",
"given",
"parent",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/Discovery.java#L61-L127 | train |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/prometheus/JmxScraper.java | JmxScraper.doScrape | public void doScrape() throws Exception {
MBeanServerConnection beanConn;
JMXConnector jmxc = null;
if (jmxUrl.isEmpty()) {
beanConn = ManagementFactory.getPlatformMBeanServer();
} else {
Map<String, Object> environment = new HashMap<String, Object>();
... | java | public void doScrape() throws Exception {
MBeanServerConnection beanConn;
JMXConnector jmxc = null;
if (jmxUrl.isEmpty()) {
beanConn = ManagementFactory.getPlatformMBeanServer();
} else {
Map<String, Object> environment = new HashMap<String, Object>();
... | [
"public",
"void",
"doScrape",
"(",
")",
"throws",
"Exception",
"{",
"MBeanServerConnection",
"beanConn",
";",
"JMXConnector",
"jmxc",
"=",
"null",
";",
"if",
"(",
"jmxUrl",
".",
"isEmpty",
"(",
")",
")",
"{",
"beanConn",
"=",
"ManagementFactory",
".",
"getPl... | Get a list of mbeans on host_port and scrape their values.
Values are passed to the receiver in a single thread. | [
"Get",
"a",
"list",
"of",
"mbeans",
"on",
"host_port",
"and",
"scrape",
"their",
"values",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/prometheus/JmxScraper.java#L124-L170 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java | InfinispanJBossASClient.isCacheContainer | public boolean isCacheContainer(String cacheContainerName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN);
String haystack = CACHE_CONTAINER;
return null != findNodeInList(addr, haystack, cacheContainerName);
} | java | public boolean isCacheContainer(String cacheContainerName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN);
String haystack = CACHE_CONTAINER;
return null != findNodeInList(addr, haystack, cacheContainerName);
} | [
"public",
"boolean",
"isCacheContainer",
"(",
"String",
"cacheContainerName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_INFINISPAN",
")",
";",
"String",
"haystack",
... | Checks to see if there is already a cache container with the given name.
@param cacheContainerName the name to check
@return true if there is a cache container with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"cache",
"container",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java#L45-L49 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java | InfinispanJBossASClient.isLocalCache | public boolean isLocalCache(String cacheContainerName, String localCacheName) throws Exception {
if (!isCacheContainer(cacheContainerName)) {
return false;
}
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, cacheContainerName);
String hayst... | java | public boolean isLocalCache(String cacheContainerName, String localCacheName) throws Exception {
if (!isCacheContainer(cacheContainerName)) {
return false;
}
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, cacheContainerName);
String hayst... | [
"public",
"boolean",
"isLocalCache",
"(",
"String",
"cacheContainerName",
",",
"String",
"localCacheName",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"isCacheContainer",
"(",
"cacheContainerName",
")",
")",
"{",
"return",
"false",
";",
"}",
"Address",
"add... | Checks to see if there is already a local cache with the given name.
@param cacheContainerName the parent container
@param localCacheName the name to check
@return true if there is a local cache with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"local",
"cache",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java#L59-L67 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DatasourceJBossASClient.java | DatasourceJBossASClient.isJDBCDriver | public boolean isJDBCDriver(String jdbcDriverName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES);
String haystack = JDBC_DRIVER;
return null != findNodeInList(addr, haystack, jdbcDriverName);
} | java | public boolean isJDBCDriver(String jdbcDriverName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES);
String haystack = JDBC_DRIVER;
return null != findNodeInList(addr, haystack, jdbcDriverName);
} | [
"public",
"boolean",
"isJDBCDriver",
"(",
"String",
"jdbcDriverName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_DATASOURCES",
")",
";",
"String",
"haystack",
"=",
... | Checks to see if there is already a JDBC driver with the given name.
@param jdbcDriverName the name to check
@return true if there is a JDBC driver with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"JDBC",
"driver",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DatasourceJBossASClient.java#L149-L153 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DatasourceJBossASClient.java | DatasourceJBossASClient.isDatasource | public boolean isDatasource(String datasourceName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES);
String haystack = DATA_SOURCE;
return null != findNodeInList(addr, haystack, datasourceName);
} | java | public boolean isDatasource(String datasourceName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES);
String haystack = DATA_SOURCE;
return null != findNodeInList(addr, haystack, datasourceName);
} | [
"public",
"boolean",
"isDatasource",
"(",
"String",
"datasourceName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_DATASOURCES",
")",
";",
"String",
"haystack",
"=",
... | Checks to see if there is already a datasource with the given name.
@param datasourceName the name to check
@return true if there is a datasource with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"datasource",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DatasourceJBossASClient.java#L162-L166 | train |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DatasourceJBossASClient.java | DatasourceJBossASClient.isXADatasource | public boolean isXADatasource(String datasourceName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES);
String haystack = XA_DATA_SOURCE;
return null != findNodeInList(addr, haystack, datasourceName);
} | java | public boolean isXADatasource(String datasourceName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_DATASOURCES);
String haystack = XA_DATA_SOURCE;
return null != findNodeInList(addr, haystack, datasourceName);
} | [
"public",
"boolean",
"isXADatasource",
"(",
"String",
"datasourceName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"SUBSYSTEM_DATASOURCES",
")",
";",
"String",
"haystack",
"=",
... | Checks to see if there is already a XA datasource with the given name.
@param datasourceName the name to check
@return true if there is a XA datasource with the given name already in existence
@throws Exception any error | [
"Checks",
"to",
"see",
"if",
"there",
"is",
"already",
"a",
"XA",
"datasource",
"with",
"the",
"given",
"name",
"."
] | a7a88fc7e4f12302e4c4306d1c91e11f81c8b811 | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/DatasourceJBossASClient.java#L175-L179 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.