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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/CachingFileAccess.java | CachingFileAccess.cleanupParams | public void cleanupParams(int size, long interval) {
timer.cancel();
timer.schedule(new Cleanup(content,size), interval, interval);
} | java | public void cleanupParams(int size, long interval) {
timer.cancel();
timer.schedule(new Cleanup(content,size), interval, interval);
} | [
"public",
"void",
"cleanupParams",
"(",
"int",
"size",
",",
"long",
"interval",
")",
"{",
"timer",
".",
"cancel",
"(",
")",
";",
"timer",
".",
"schedule",
"(",
"new",
"Cleanup",
"(",
"content",
",",
"size",
")",
",",
"interval",
",",
"interval",
")",
... | Reset the Cleanup size and interval
The size and interval when started are 500 items (memory size unknown) checked every minute in a background thread.
@param size
@param interval | [
"Reset",
"the",
"Cleanup",
"size",
"and",
"interval"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/CachingFileAccess.java#L171-L174 | train |
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/CachingFileAccess.java | CachingFileAccess.load | public Content load(LogTarget logTarget, String dataRoot, String key, String mediaType, long _timeCheck) throws IOException {
long timeCheck = _timeCheck;
if(timeCheck<0) {
timeCheck=checkInterval; // if time < 0, then use default
}
String fileName = dataRoot + '/' + key;
Content c = content.get(key);
... | java | public Content load(LogTarget logTarget, String dataRoot, String key, String mediaType, long _timeCheck) throws IOException {
long timeCheck = _timeCheck;
if(timeCheck<0) {
timeCheck=checkInterval; // if time < 0, then use default
}
String fileName = dataRoot + '/' + key;
Content c = content.get(key);
... | [
"public",
"Content",
"load",
"(",
"LogTarget",
"logTarget",
",",
"String",
"dataRoot",
",",
"String",
"key",
",",
"String",
"mediaType",
",",
"long",
"_timeCheck",
")",
"throws",
"IOException",
"{",
"long",
"timeCheck",
"=",
"_timeCheck",
";",
"if",
"(",
"ti... | Load a file, first checking cache
@param logTarget - logTarget can be null (won't log)
@param dataRoot - data root storage directory
@param key - relative File Path
@param mediaType - what kind of file is it. If null, will check via file extension
@param timeCheck - "-1" will take system default - Otherwise, will co... | [
"Load",
"a",
"file",
"first",
"checking",
"cache"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/CachingFileAccess.java#L190-L255 | train |
att/AAF | cadi/client/src/main/java/com/att/cadi/client/Rcli.java | Rcli.update | public<T> Future<Void> update(String pathinfo) throws APIException, CadiException {
final int idx = pathinfo.indexOf('?');
final String qp;
if(idx>=0) {
qp=pathinfo.substring(idx+1);
pathinfo=pathinfo.substring(0,idx);
} else {
qp=queryParams;
}
EClient<CT> client = client();
client.setMethod(P... | java | public<T> Future<Void> update(String pathinfo) throws APIException, CadiException {
final int idx = pathinfo.indexOf('?');
final String qp;
if(idx>=0) {
qp=pathinfo.substring(idx+1);
pathinfo=pathinfo.substring(0,idx);
} else {
qp=queryParams;
}
EClient<CT> client = client();
client.setMethod(P... | [
"public",
"<",
"T",
">",
"Future",
"<",
"Void",
">",
"update",
"(",
"String",
"pathinfo",
")",
"throws",
"APIException",
",",
"CadiException",
"{",
"final",
"int",
"idx",
"=",
"pathinfo",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"final",
"String",
"qp"... | A method to update with a VOID
@param pathinfo
@param resp
@param expected
@return
@throws APIException
@throws CadiException | [
"A",
"method",
"to",
"update",
"with",
"a",
"VOID"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/Rcli.java#L457-L481 | train |
att/AAF | inno/rosetta/src/main/java/com/att/rosetta/JaxInfo.java | JaxInfo.buildFields | private static JaxInfo[] buildFields(Class<?> clazz, String defaultNS) throws SecurityException, NoSuchFieldException, ClassNotFoundException {
ArrayList<JaxInfo> fields = null; // allow for lazy instantiation, because many structures won't have XmlType
Class<?> cls = clazz;
// Build up Method names from JAXB Ann... | java | private static JaxInfo[] buildFields(Class<?> clazz, String defaultNS) throws SecurityException, NoSuchFieldException, ClassNotFoundException {
ArrayList<JaxInfo> fields = null; // allow for lazy instantiation, because many structures won't have XmlType
Class<?> cls = clazz;
// Build up Method names from JAXB Ann... | [
"private",
"static",
"JaxInfo",
"[",
"]",
"buildFields",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"defaultNS",
")",
"throws",
"SecurityException",
",",
"NoSuchFieldException",
",",
"ClassNotFoundException",
"{",
"ArrayList",
"<",
"JaxInfo",
">",
"fie... | This is recursive, if a member is a JAXB Object as well. | [
"This",
"is",
"recursive",
"if",
"a",
"member",
"is",
"a",
"JAXB",
"Object",
"as",
"well",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/rosetta/src/main/java/com/att/rosetta/JaxInfo.java#L142-L200 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cass/UserRoleDAO.java | UserRoleDAO.readByUserRole | public Result<List<Data>> readByUserRole(AuthzTrans trans, String user, String role) {
return psUserInRole.read(trans, R_TEXT + " by User " + user + " and Role " + role, new Object[]{user,role});
} | java | public Result<List<Data>> readByUserRole(AuthzTrans trans, String user, String role) {
return psUserInRole.read(trans, R_TEXT + " by User " + user + " and Role " + role, new Object[]{user,role});
} | [
"public",
"Result",
"<",
"List",
"<",
"Data",
">",
">",
"readByUserRole",
"(",
"AuthzTrans",
"trans",
",",
"String",
"user",
",",
"String",
"role",
")",
"{",
"return",
"psUserInRole",
".",
"read",
"(",
"trans",
",",
"R_TEXT",
"+",
"\" by User \"",
"+",
"... | Direct Lookup of User Role
Don't forget to check for Expiration | [
"Direct",
"Lookup",
"of",
"User",
"Role",
"Don",
"t",
"forget",
"to",
"check",
"for",
"Expiration"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cass/UserRoleDAO.java#L234-L236 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Hash.java | Hash.encryptMD5 | public static byte[] encryptMD5 (byte[] input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input);
return md.digest();
} | java | public static byte[] encryptMD5 (byte[] input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input);
return md.digest();
} | [
"public",
"static",
"byte",
"[",
"]",
"encryptMD5",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"md",
".",
"update",
"(",
"input",
... | Encrypt MD5 from Byte Array to Byte Array
@param input
@return
@throws NoSuchAlgorithmException | [
"Encrypt",
"MD5",
"from",
"Byte",
"Array",
"to",
"Byte",
"Array"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Hash.java#L22-L26 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Hash.java | Hash.isEqual | public static boolean isEqual(byte ba1[], byte ba2[]) {
if(ba1.length!=ba2.length)return false;
for(int i = 0;i<ba1.length; ++i) {
if(ba1[i]!=ba2[i])return false;
}
return true;
} | java | public static boolean isEqual(byte ba1[], byte ba2[]) {
if(ba1.length!=ba2.length)return false;
for(int i = 0;i<ba1.length; ++i) {
if(ba1[i]!=ba2[i])return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isEqual",
"(",
"byte",
"ba1",
"[",
"]",
",",
"byte",
"ba2",
"[",
"]",
")",
"{",
"if",
"(",
"ba1",
".",
"length",
"!=",
"ba2",
".",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i"... | Compare two byte arrays for equivalency
@param ba1
@param ba2
@return | [
"Compare",
"two",
"byte",
"arrays",
"for",
"equivalency"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Hash.java#L124-L130 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/Loader.java | Loader.readString | public static String readString(DataInputStream is, byte[] _buff) throws IOException {
int l = is.readInt();
byte[] buff = _buff;
switch(l) {
case -1: return null;
case 0: return "";
default:
// Cover case where there is a large string, without always allocating a large buffer.
if(l>buff.length)... | java | public static String readString(DataInputStream is, byte[] _buff) throws IOException {
int l = is.readInt();
byte[] buff = _buff;
switch(l) {
case -1: return null;
case 0: return "";
default:
// Cover case where there is a large string, without always allocating a large buffer.
if(l>buff.length)... | [
"public",
"static",
"String",
"readString",
"(",
"DataInputStream",
"is",
",",
"byte",
"[",
"]",
"_buff",
")",
"throws",
"IOException",
"{",
"int",
"l",
"=",
"is",
".",
"readInt",
"(",
")",
";",
"byte",
"[",
"]",
"buff",
"=",
"_buff",
";",
"switch",
... | We use bytes here to set a Maximum
@param is
@param MAX
@return
@throws IOException | [
"We",
"use",
"bytes",
"here",
"to",
"set",
"a",
"Maximum"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/Loader.java#L84-L98 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/Loader.java | Loader.writeStringSet | public static void writeStringSet(DataOutputStream os, Collection<String> set) throws IOException {
if(set==null) {
os.writeInt(-1);
} else {
os.writeInt(set.size());
for(String s : set) {
writeString(os, s);
}
}
} | java | public static void writeStringSet(DataOutputStream os, Collection<String> set) throws IOException {
if(set==null) {
os.writeInt(-1);
} else {
os.writeInt(set.size());
for(String s : set) {
writeString(os, s);
}
}
} | [
"public",
"static",
"void",
"writeStringSet",
"(",
"DataOutputStream",
"os",
",",
"Collection",
"<",
"String",
">",
"set",
")",
"throws",
"IOException",
"{",
"if",
"(",
"set",
"==",
"null",
")",
"{",
"os",
".",
"writeInt",
"(",
"-",
"1",
")",
";",
"}",... | Write a set with proper sizing
Note: at the moment, this is just String. Probably can develop system where types
are supported too... but not now.
@param os
@param set
@throws IOException | [
"Write",
"a",
"set",
"with",
"proper",
"sizing"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/Loader.java#L110-L120 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/Loader.java | Loader.writeStringMap | public static void writeStringMap(DataOutputStream os, Map<String,String> map) throws IOException {
if(map==null) {
os.writeInt(-1);
} else {
Set<Entry<String, String>> es = map.entrySet();
os.writeInt(es.size());
for(Entry<String,String> e : es) {
writeString(os, e.getKey());
writeString(os, e.... | java | public static void writeStringMap(DataOutputStream os, Map<String,String> map) throws IOException {
if(map==null) {
os.writeInt(-1);
} else {
Set<Entry<String, String>> es = map.entrySet();
os.writeInt(es.size());
for(Entry<String,String> e : es) {
writeString(os, e.getKey());
writeString(os, e.... | [
"public",
"static",
"void",
"writeStringMap",
"(",
"DataOutputStream",
"os",
",",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"throws",
"IOException",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"os",
".",
"writeInt",
"(",
"-",
"1",
")",
... | Write a map
@param os
@param map
@throws IOException | [
"Write",
"a",
"map"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/Loader.java#L152-L164 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java | CadiAccess.buildLine | public final static StringBuilder buildLine(Level level, StringBuilder sb, Object[] elements) {
sb.append(level.name());
return buildLine(sb,elements);
} | java | public final static StringBuilder buildLine(Level level, StringBuilder sb, Object[] elements) {
sb.append(level.name());
return buildLine(sb,elements);
} | [
"public",
"final",
"static",
"StringBuilder",
"buildLine",
"(",
"Level",
"level",
",",
"StringBuilder",
"sb",
",",
"Object",
"[",
"]",
"elements",
")",
"{",
"sb",
".",
"append",
"(",
"level",
".",
"name",
"(",
")",
")",
";",
"return",
"buildLine",
"(",
... | Add the "Level" to the Buildline for Logging types that don't specify, or straight Streams, etc. Then buildline
Build a line of code onto a StringBuilder based on Objects. Analyze whether
spaces need including.
@param level
@param sb
@param elements
@return | [
"Add",
"the",
"Level",
"to",
"the",
"Buildline",
"for",
"Logging",
"types",
"that",
"don",
"t",
"specify",
"or",
"straight",
"Streams",
"etc",
".",
"Then",
"buildline"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java#L80-L83 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java | CadiAccess.log | public void log(Level level, Object... elements) {
if(willWrite.compareTo(level)<=0) {
StringBuilder sb = buildLine(level, new StringBuilder(),elements);
if(context==null) {
System.out.println(sb.toString());
} else {
context.log(sb.toString());
}
}
} | java | public void log(Level level, Object... elements) {
if(willWrite.compareTo(level)<=0) {
StringBuilder sb = buildLine(level, new StringBuilder(),elements);
if(context==null) {
System.out.println(sb.toString());
} else {
context.log(sb.toString());
}
}
} | [
"public",
"void",
"log",
"(",
"Level",
"level",
",",
"Object",
"...",
"elements",
")",
"{",
"if",
"(",
"willWrite",
".",
"compareTo",
"(",
"level",
")",
"<=",
"0",
")",
"{",
"StringBuilder",
"sb",
"=",
"buildLine",
"(",
"level",
",",
"new",
"StringBuil... | Standard mechanism for logging, given being within a Servlet Context
Here, we treat
if context exists, log to it, otherwise log to Std Out (The latter is usually for startup
scenarios) | [
"Standard",
"mechanism",
"for",
"logging",
"given",
"being",
"within",
"a",
"Servlet",
"Context"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java#L137-L146 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java | CadiAccess.log | public void log(Exception e, Object... elements) {
if(willWrite.compareTo(Level.ERROR)<=0) {
StringBuilder sb = buildLine(Level.ERROR, new StringBuilder(),elements);
if(context==null) {
sb.append(e.toString());
System.out.println(sb.toString());
} else {
context.log(sb.toString(),e);
}
}
... | java | public void log(Exception e, Object... elements) {
if(willWrite.compareTo(Level.ERROR)<=0) {
StringBuilder sb = buildLine(Level.ERROR, new StringBuilder(),elements);
if(context==null) {
sb.append(e.toString());
System.out.println(sb.toString());
} else {
context.log(sb.toString(),e);
}
}
... | [
"public",
"void",
"log",
"(",
"Exception",
"e",
",",
"Object",
"...",
"elements",
")",
"{",
"if",
"(",
"willWrite",
".",
"compareTo",
"(",
"Level",
".",
"ERROR",
")",
"<=",
"0",
")",
"{",
"StringBuilder",
"sb",
"=",
"buildLine",
"(",
"Level",
".",
"E... | Standard mechanism for logging an Exception, given being within a Servlet Context, etc
if context exists, log to it, otherwise log to Std Out (The latter is usually for startup
scenarios) | [
"Standard",
"mechanism",
"for",
"logging",
"an",
"Exception",
"given",
"being",
"within",
"a",
"Servlet",
"Context",
"etc"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java#L155-L166 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java | CadiAccess.getProperty | public String getProperty(String string, String def) {
String rv = null;
if ( props != null )
rv = props.getProperty( string, def );
if(rv==null) {
rv = context.getInitParameter(string);
}
return rv==null?def:rv;
} | java | public String getProperty(String string, String def) {
String rv = null;
if ( props != null )
rv = props.getProperty( string, def );
if(rv==null) {
rv = context.getInitParameter(string);
}
return rv==null?def:rv;
} | [
"public",
"String",
"getProperty",
"(",
"String",
"string",
",",
"String",
"def",
")",
"{",
"String",
"rv",
"=",
"null",
";",
"if",
"(",
"props",
"!=",
"null",
")",
"rv",
"=",
"props",
".",
"getProperty",
"(",
"string",
",",
"def",
")",
";",
"if",
... | Get the Property from Context | [
"Get",
"the",
"Property",
"from",
"Context"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java#L183-L194 | train |
att/AAF | inno/env/src/main/java/com/att/inno/env/util/Pool.java | Pool.prime | public void prime(LogTarget lt, int prime) throws APIException {
for (int i = 0; i < prime; ++i) {
Pooled<T> pt = new Pooled<T>(creator.create(), this, lt);
synchronized (list) {
list.addFirst(pt);
++count;
}
}
} | java | public void prime(LogTarget lt, int prime) throws APIException {
for (int i = 0; i < prime; ++i) {
Pooled<T> pt = new Pooled<T>(creator.create(), this, lt);
synchronized (list) {
list.addFirst(pt);
++count;
}
}
} | [
"public",
"void",
"prime",
"(",
"LogTarget",
"lt",
",",
"int",
"prime",
")",
"throws",
"APIException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"prime",
";",
"++",
"i",
")",
"{",
"Pooled",
"<",
"T",
">",
"pt",
"=",
"new",
"Pooled",
... | Preallocate a certain number of T Objects. Useful for services so that
the first transactions don't get hit with all the Object creation costs
@param lt
@param prime
@throws APIException | [
"Preallocate",
"a",
"certain",
"number",
"of",
"T",
"Objects",
".",
"Useful",
"for",
"services",
"so",
"that",
"the",
"first",
"transactions",
"don",
"t",
"get",
"hit",
"with",
"all",
"the",
"Object",
"creation",
"costs"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/env/src/main/java/com/att/inno/env/util/Pool.java#L98-L107 | train |
att/AAF | inno/env/src/main/java/com/att/inno/env/util/Pool.java | Pool.drain | public void drain() {
synchronized (list) {
for (int i = 0; i < list.size(); ++i) {
Pooled<T> pt = list.remove();
creator.destroy(pt.content);
pt.logTarget.log("Pool drained ", creator.toString());
}
count = spares = 0;
}
} | java | public void drain() {
synchronized (list) {
for (int i = 0; i < list.size(); ++i) {
Pooled<T> pt = list.remove();
creator.destroy(pt.content);
pt.logTarget.log("Pool drained ", creator.toString());
}
count = spares = 0;
}
} | [
"public",
"void",
"drain",
"(",
")",
"{",
"synchronized",
"(",
"list",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"Pooled",
"<",
"T",
">",
"pt",
"=",
"list",
".",
"rem... | Destroy and remove all remaining objects. This is valuable for closing
down all Allocated objects cleanly for exiting. It is also a good method
for removing objects when, for instance, all Objects are invalid because
of broken connections, etc. | [
"Destroy",
"and",
"remove",
"all",
"remaining",
"objects",
".",
"This",
"is",
"valuable",
"for",
"closing",
"down",
"all",
"Allocated",
"objects",
"cleanly",
"for",
"exiting",
".",
"It",
"is",
"also",
"a",
"good",
"method",
"for",
"removing",
"objects",
"whe... | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/env/src/main/java/com/att/inno/env/util/Pool.java#L115-L125 | train |
att/AAF | inno/env/src/main/java/com/att/inno/env/util/Pool.java | Pool.validate | public boolean validate() {
boolean rv = true;
synchronized (list) {
for (Pooled<T> t : list) {
if (!creator.isValid(t.content)) {
rv = false;
t.toss();
list.remove(t);
}
}
}
return rv;
} | java | public boolean validate() {
boolean rv = true;
synchronized (list) {
for (Pooled<T> t : list) {
if (!creator.isValid(t.content)) {
rv = false;
t.toss();
list.remove(t);
}
}
}
return rv;
} | [
"public",
"boolean",
"validate",
"(",
")",
"{",
"boolean",
"rv",
"=",
"true",
";",
"synchronized",
"(",
"list",
")",
"{",
"for",
"(",
"Pooled",
"<",
"T",
">",
"t",
":",
"list",
")",
"{",
"if",
"(",
"!",
"creator",
".",
"isValid",
"(",
"t",
".",
... | This function will validate whether the Objects are still in a usable
state. If not, they are tossed from the Pool. This is valuable to have
when Remote Connections go down, and there is a question on whether the
Pooled Objects are still functional.
@return | [
"This",
"function",
"will",
"validate",
"whether",
"the",
"Objects",
"are",
"still",
"in",
"a",
"usable",
"state",
".",
"If",
"not",
"they",
"are",
"tossed",
"from",
"the",
"Pool",
".",
"This",
"is",
"valuable",
"to",
"have",
"when",
"Remote",
"Connections... | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/env/src/main/java/com/att/inno/env/util/Pool.java#L216-L228 | train |
att/AAF | inno/env/src/main/java/com/att/inno/env/util/RefreshableThreadObject.java | RefreshableThreadObject.get | public T get(Env env) throws APIException {
Thread t = Thread.currentThread();
T obj = objs.get(t);
if(obj==null || refreshed>obj.created()) {
try {
obj = cnst.newInstance(new Object[]{env});
} catch (InvocationTargetException e) {
throw new APIException(e.getTargetException());
} catch (Exceptio... | java | public T get(Env env) throws APIException {
Thread t = Thread.currentThread();
T obj = objs.get(t);
if(obj==null || refreshed>obj.created()) {
try {
obj = cnst.newInstance(new Object[]{env});
} catch (InvocationTargetException e) {
throw new APIException(e.getTargetException());
} catch (Exceptio... | [
"public",
"T",
"get",
"(",
"Env",
"env",
")",
"throws",
"APIException",
"{",
"Thread",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"T",
"obj",
"=",
"objs",
".",
"get",
"(",
"t",
")",
";",
"if",
"(",
"obj",
"==",
"null",
"||",
"refres... | Get the "T" class from the current thread
@param env
@return T
@throws APIException | [
"Get",
"the",
"T",
"class",
"from",
"the",
"current",
"thread"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/env/src/main/java/com/att/inno/env/util/RefreshableThreadObject.java#L69-L86 | train |
att/AAF | inno/env/src/main/java/com/att/inno/env/util/RefreshableThreadObject.java | RefreshableThreadObject.remove | public void remove(Env env) {
T obj = objs.remove(Thread.currentThread());
if(obj!=null)
obj.destroy(env);
} | java | public void remove(Env env) {
T obj = objs.remove(Thread.currentThread());
if(obj!=null)
obj.destroy(env);
} | [
"public",
"void",
"remove",
"(",
"Env",
"env",
")",
"{",
"T",
"obj",
"=",
"objs",
".",
"remove",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
";",
"if",
"(",
"obj",
"!=",
"null",
")",
"obj",
".",
"destroy",
"(",
"env",
")",
";",
"}"
] | Remove the object from the Thread instances
@param env | [
"Remove",
"the",
"object",
"from",
"the",
"Thread",
"instances"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/env/src/main/java/com/att/inno/env/util/RefreshableThreadObject.java#L101-L105 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedUserRoleDAO.java | CachedUserRoleDAO.readByUser | public Result<List<Data>> readByUser(AuthzTrans trans, final String user) {
DAOGetter getter = new DAOGetter(trans,dao()) {
public Result<List<Data>> call() {
// If the call is for THIS user, and it exists, get from TRANS, add to TRANS if not.
if(user!=null && user.equals(trans.user())) {
Result<List<... | java | public Result<List<Data>> readByUser(AuthzTrans trans, final String user) {
DAOGetter getter = new DAOGetter(trans,dao()) {
public Result<List<Data>> call() {
// If the call is for THIS user, and it exists, get from TRANS, add to TRANS if not.
if(user!=null && user.equals(trans.user())) {
Result<List<... | [
"public",
"Result",
"<",
"List",
"<",
"Data",
">",
">",
"readByUser",
"(",
"AuthzTrans",
"trans",
",",
"final",
"String",
"user",
")",
"{",
"DAOGetter",
"getter",
"=",
"new",
"DAOGetter",
"(",
"trans",
",",
"dao",
"(",
")",
")",
"{",
"public",
"Result"... | Special Case.
User Roles by User are very likely to be called many times in a Transaction, to validate "May User do..."
Pull result, and make accessible by the Trans, which is always keyed by User.
@param trans
@param user
@return | [
"Special",
"Case",
".",
"User",
"Roles",
"by",
"User",
"are",
"very",
"likely",
"to",
"be",
"called",
"many",
"times",
"in",
"a",
"Transaction",
"to",
"validate",
"May",
"User",
"do",
"...",
"Pull",
"result",
"and",
"make",
"accessible",
"by",
"the",
"Tr... | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedUserRoleDAO.java#L34-L54 | train |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFCon.java | AAFCon.clientAs | public Rcli<CLIENT> clientAs(String apiVersion, ServletRequest req) throws CadiException {
Rcli<CLIENT> cl = client(apiVersion);
return cl.forUser(transferSS(((HttpServletRequest)req).getUserPrincipal()));
} | java | public Rcli<CLIENT> clientAs(String apiVersion, ServletRequest req) throws CadiException {
Rcli<CLIENT> cl = client(apiVersion);
return cl.forUser(transferSS(((HttpServletRequest)req).getUserPrincipal()));
} | [
"public",
"Rcli",
"<",
"CLIENT",
">",
"clientAs",
"(",
"String",
"apiVersion",
",",
"ServletRequest",
"req",
")",
"throws",
"CadiException",
"{",
"Rcli",
"<",
"CLIENT",
">",
"cl",
"=",
"client",
"(",
"apiVersion",
")",
";",
"return",
"cl",
".",
"forUser",
... | Use this API when you have permission to have your call act as the end client's ID.
Your calls will get 403 errors if you do not have this permission. it is a special setup, rarely given.
@param apiVersion
@param req
@return
@throws CadiException | [
"Use",
"this",
"API",
"when",
"you",
"have",
"permission",
"to",
"have",
"your",
"call",
"act",
"as",
"the",
"end",
"client",
"s",
"ID",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFCon.java#L97-L100 | train |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFCon.java | AAFCon.obtain | public static final AAFCon<?> obtain(Object servletRequest) {
if(servletRequest instanceof CadiWrap) {
Lur lur = ((CadiWrap)servletRequest).getLur();
if(lur != null) {
if(lur instanceof EpiLur) {
AbsAAFLur<?> aal = (AbsAAFLur<?>) ((EpiLur)lur).subLur(AbsAAFLur.class);
if(aal!=null) {
return ... | java | public static final AAFCon<?> obtain(Object servletRequest) {
if(servletRequest instanceof CadiWrap) {
Lur lur = ((CadiWrap)servletRequest).getLur();
if(lur != null) {
if(lur instanceof EpiLur) {
AbsAAFLur<?> aal = (AbsAAFLur<?>) ((EpiLur)lur).subLur(AbsAAFLur.class);
if(aal!=null) {
return ... | [
"public",
"static",
"final",
"AAFCon",
"<",
"?",
">",
"obtain",
"(",
"Object",
"servletRequest",
")",
"{",
"if",
"(",
"servletRequest",
"instanceof",
"CadiWrap",
")",
"{",
"Lur",
"lur",
"=",
"(",
"(",
"CadiWrap",
")",
"servletRequest",
")",
".",
"getLur",
... | Return the backing AAFCon, if there is a Lur Setup that is AAF.
If there is no AAFLur setup, it will return "null"
@param servletRequest
@return | [
"Return",
"the",
"backing",
"AAFCon",
"if",
"there",
"is",
"a",
"Lur",
"Setup",
"that",
"is",
"AAF",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFCon.java#L202-L219 | train |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFCon.java | AAFCon.reverseDomain | public static String reverseDomain(String user) {
StringBuilder sb = null;
String[] split = Split.split('.',user);
int at;
for(int i=split.length-1;i>=0;--i) {
if(sb == null) {
sb = new StringBuilder();
} else {
sb.append('.');
}
if((at = split[i].indexOf('@'))>0) {
sb.append(split[i].s... | java | public static String reverseDomain(String user) {
StringBuilder sb = null;
String[] split = Split.split('.',user);
int at;
for(int i=split.length-1;i>=0;--i) {
if(sb == null) {
sb = new StringBuilder();
} else {
sb.append('.');
}
if((at = split[i].indexOf('@'))>0) {
sb.append(split[i].s... | [
"public",
"static",
"String",
"reverseDomain",
"(",
"String",
"user",
")",
"{",
"StringBuilder",
"sb",
"=",
"null",
";",
"String",
"[",
"]",
"split",
"=",
"Split",
".",
"split",
"(",
"'",
"'",
",",
"user",
")",
";",
"int",
"at",
";",
"for",
"(",
"i... | Take a Fully Qualified User, and get a Namespace from it.
@param user
@return | [
"Take",
"a",
"Fully",
"Qualified",
"User",
"and",
"get",
"a",
"Namespace",
"from",
"it",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFCon.java#L272-L291 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java | DenialOfServiceTaf.denyIP | public static synchronized boolean denyIP(String ip) {
boolean rv = false;
if(deniedIP==null) {
deniedIP = new HashMap<String,Counter>();
deniedIP.put(ip, new Counter(ip)); // Noted duplicated for minimum time spent
rv= true;
} else if(deniedIP.get(ip)==null) {
deniedIP.put(ip, new Counter(ip));
rv... | java | public static synchronized boolean denyIP(String ip) {
boolean rv = false;
if(deniedIP==null) {
deniedIP = new HashMap<String,Counter>();
deniedIP.put(ip, new Counter(ip)); // Noted duplicated for minimum time spent
rv= true;
} else if(deniedIP.get(ip)==null) {
deniedIP.put(ip, new Counter(ip));
rv... | [
"public",
"static",
"synchronized",
"boolean",
"denyIP",
"(",
"String",
"ip",
")",
"{",
"boolean",
"rv",
"=",
"false",
";",
"if",
"(",
"deniedIP",
"==",
"null",
")",
"{",
"deniedIP",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Counter",
">",
"(",
")",
... | Return of "True" means IP has been added.
Return of "False" means IP already added.
@param ip
@return | [
"Return",
"of",
"True",
"means",
"IP",
"has",
"been",
"added",
".",
"Return",
"of",
"False",
"means",
"IP",
"already",
"added",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java#L103-L117 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java | DenialOfServiceTaf.removeDenyIP | public static synchronized boolean removeDenyIP(String ip) {
if(deniedIP!=null && deniedIP.remove(ip)!=null) {
writeIP();
if(deniedIP.isEmpty()) {
deniedIP=null;
}
return true;
}
return false;
} | java | public static synchronized boolean removeDenyIP(String ip) {
if(deniedIP!=null && deniedIP.remove(ip)!=null) {
writeIP();
if(deniedIP.isEmpty()) {
deniedIP=null;
}
return true;
}
return false;
} | [
"public",
"static",
"synchronized",
"boolean",
"removeDenyIP",
"(",
"String",
"ip",
")",
"{",
"if",
"(",
"deniedIP",
"!=",
"null",
"&&",
"deniedIP",
".",
"remove",
"(",
"ip",
")",
"!=",
"null",
")",
"{",
"writeIP",
"(",
")",
";",
"if",
"(",
"deniedIP",... | Return of "True" means IP has was removed.
Return of "False" means IP wasn't being denied.
@param ip
@return | [
"Return",
"of",
"True",
"means",
"IP",
"has",
"was",
"removed",
".",
"Return",
"of",
"False",
"means",
"IP",
"wasn",
"t",
"being",
"denied",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java#L174-L183 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java | DenialOfServiceTaf.denyID | public static synchronized boolean denyID(String id) {
boolean rv = false;
if(deniedID==null) {
deniedID = new HashMap<String,Counter>();
deniedID.put(id, new Counter(id)); // Noted duplicated for minimum time spent
rv = true;
} else if(deniedID.get(id)==null) {
deniedID.put(id, new Counter(id));
r... | java | public static synchronized boolean denyID(String id) {
boolean rv = false;
if(deniedID==null) {
deniedID = new HashMap<String,Counter>();
deniedID.put(id, new Counter(id)); // Noted duplicated for minimum time spent
rv = true;
} else if(deniedID.get(id)==null) {
deniedID.put(id, new Counter(id));
r... | [
"public",
"static",
"synchronized",
"boolean",
"denyID",
"(",
"String",
"id",
")",
"{",
"boolean",
"rv",
"=",
"false",
";",
"if",
"(",
"deniedID",
"==",
"null",
")",
"{",
"deniedID",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Counter",
">",
"(",
")",
... | Return of "True" means ID has been added.
Return of "False" means ID already added.
@param ip
@return | [
"Return",
"of",
"True",
"means",
"ID",
"has",
"been",
"added",
".",
"Return",
"of",
"False",
"means",
"ID",
"already",
"added",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java#L192-L207 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java | DenialOfServiceTaf.removeDenyID | public static synchronized boolean removeDenyID(String id) {
if(deniedID!=null && deniedID.remove(id)!=null) {
writeID();
if(deniedID.isEmpty()) {
deniedID=null;
}
return true;
}
return false;
} | java | public static synchronized boolean removeDenyID(String id) {
if(deniedID!=null && deniedID.remove(id)!=null) {
writeID();
if(deniedID.isEmpty()) {
deniedID=null;
}
return true;
}
return false;
} | [
"public",
"static",
"synchronized",
"boolean",
"removeDenyID",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"deniedID",
"!=",
"null",
"&&",
"deniedID",
".",
"remove",
"(",
"id",
")",
"!=",
"null",
")",
"{",
"writeID",
"(",
")",
";",
"if",
"(",
"deniedID",... | Return of "True" means ID has was removed.
Return of "False" means ID wasn't being denied.
@param ip
@return | [
"Return",
"of",
"True",
"means",
"ID",
"has",
"was",
"removed",
".",
"Return",
"of",
"False",
"means",
"ID",
"wasn",
"t",
"being",
"denied",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/taf/dos/DenialOfServiceTaf.java#L262-L272 | train |
att/AAF | cadi/cass/src/main/java/com/att/cadi/aaf/cass/AAFAuthenticator.java | AAFAuthenticator.authenticate | public AuthenticatedUser authenticate(Map<String, String> credentials) throws AuthenticationException {
String username = (String)credentials.get("username");
if (username == null) {
throw new AuthenticationException("'username' is missing");
}
AAFAuthenticatedUser aau = new AAFAu... | java | public AuthenticatedUser authenticate(Map<String, String> credentials) throws AuthenticationException {
String username = (String)credentials.get("username");
if (username == null) {
throw new AuthenticationException("'username' is missing");
}
AAFAuthenticatedUser aau = new AAFAu... | [
"public",
"AuthenticatedUser",
"authenticate",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"credentials",
")",
"throws",
"AuthenticationException",
"{",
"String",
"username",
"=",
"(",
"String",
")",
"credentials",
".",
"get",
"(",
"\"username\"",
")",
";",
... | Invoked to authenticate an user | [
"Invoked",
"to",
"authenticate",
"an",
"user"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/cass/src/main/java/com/att/cadi/aaf/cass/AAFAuthenticator.java#L33-L89 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cass/HistoryDAO.java | HistoryDAO.readByUser | public Result<List<Data>> readByUser(AuthzTrans trans, String user, int ... yyyymm) {
if(yyyymm.length==0) {
return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified");
}
Result<ResultSet> rs = readByUser.exec(trans, "user", user);
if(rs.notOK()) {
return Result.err(rs);
}
return ... | java | public Result<List<Data>> readByUser(AuthzTrans trans, String user, int ... yyyymm) {
if(yyyymm.length==0) {
return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified");
}
Result<ResultSet> rs = readByUser.exec(trans, "user", user);
if(rs.notOK()) {
return Result.err(rs);
}
return ... | [
"public",
"Result",
"<",
"List",
"<",
"Data",
">",
">",
"readByUser",
"(",
"AuthzTrans",
"trans",
",",
"String",
"user",
",",
"int",
"...",
"yyyymm",
")",
"{",
"if",
"(",
"yyyymm",
".",
"length",
"==",
"0",
")",
"{",
"return",
"Result",
".",
"err",
... | Gets the history for a user in the specified year and month
year - the year in yyyy format
month - the month in a year ...values 1 - 12 | [
"Gets",
"the",
"history",
"for",
"a",
"user",
"in",
"the",
"specified",
"year",
"and",
"month",
"year",
"-",
"the",
"year",
"in",
"yyyy",
"format",
"month",
"-",
"the",
"month",
"in",
"a",
"year",
"...",
"values",
"1",
"-",
"12"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cass/HistoryDAO.java#L177-L186 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedPermDAO.java | CachedPermDAO.addDescription | public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
//TODO Invalidate?
return dao().addDescription(trans, ns, type, instance, action, description);
} | java | public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
//TODO Invalidate?
return dao().addDescription(trans, ns, type, instance, action, description);
} | [
"public",
"Result",
"<",
"Void",
">",
"addDescription",
"(",
"AuthzTrans",
"trans",
",",
"String",
"ns",
",",
"String",
"type",
",",
"String",
"instance",
",",
"String",
"action",
",",
"String",
"description",
")",
"{",
"//TODO Invalidate?",
"return",
"dao",
... | Add desciption to this permission
@param trans
@param ns
@param type
@param instance
@param action
@param description
@return | [
"Add",
"desciption",
"to",
"this",
"permission"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedPermDAO.java#L83-L87 | train |
att/AAF | inno/rosetta/src/main/java/com/att/rosetta/XmlEscape.java | XmlEscape.xmlEscape | public static void xmlEscape(StringBuilder sb, Reader r) throws ParseException {
try {
int c;
StringBuilder esc = new StringBuilder();
for(int cnt = 0;cnt<9 /*max*/; ++cnt) {
if((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence");
if(c!=';') {
esc.append((char)c)... | java | public static void xmlEscape(StringBuilder sb, Reader r) throws ParseException {
try {
int c;
StringBuilder esc = new StringBuilder();
for(int cnt = 0;cnt<9 /*max*/; ++cnt) {
if((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence");
if(c!=';') {
esc.append((char)c)... | [
"public",
"static",
"void",
"xmlEscape",
"(",
"StringBuilder",
"sb",
",",
"Reader",
"r",
")",
"throws",
"ParseException",
"{",
"try",
"{",
"int",
"c",
";",
"StringBuilder",
"esc",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"cnt",
"=",... | see initialization at end | [
"see",
"initialization",
"at",
"end"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/rosetta/src/main/java/com/att/rosetta/XmlEscape.java#L17-L43 | train |
att/AAF | cadi/cass/src/main/java/com/att/cadi/aaf/cass/AAFAuthorizer.java | AAFAuthorizer.checkPermissions | private Set<Permission> checkPermissions(AAFAuthenticatedUser aau, String type, String instance) {
// Can perform ALL actions
String fullName = aau.getFullName();
PermHolder ph = new PermHolder(aau);
aafLur.fishOneOf(fullName, ph,type,instance,actions);
return ph.permissions;
} | java | private Set<Permission> checkPermissions(AAFAuthenticatedUser aau, String type, String instance) {
// Can perform ALL actions
String fullName = aau.getFullName();
PermHolder ph = new PermHolder(aau);
aafLur.fishOneOf(fullName, ph,type,instance,actions);
return ph.permissions;
} | [
"private",
"Set",
"<",
"Permission",
">",
"checkPermissions",
"(",
"AAFAuthenticatedUser",
"aau",
",",
"String",
"type",
",",
"String",
"instance",
")",
"{",
"// Can perform ALL actions",
"String",
"fullName",
"=",
"aau",
".",
"getFullName",
"(",
")",
";",
"Perm... | Check remoted AAF Permissions
@param aau
@param type
@param instance
@return | [
"Check",
"remoted",
"AAF",
"Permissions"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/cass/src/main/java/com/att/cadi/aaf/cass/AAFAuthorizer.java#L75-L81 | train |
att/AAF | cadi/client/src/main/java/com/att/cadi/routing/GreatCircle.java | GreatCircle.calc | public static double calc(String ... coords) {
try {
String [] array;
switch(coords.length) {
case 1:
array = Split.split(',',coords[0]);
if(array.length!=4)return -1;
return calc(
Double.parseDouble(array[0]),
Double.parseDouble(array[1]),
Double.parseDouble(array[2]),
Double... | java | public static double calc(String ... coords) {
try {
String [] array;
switch(coords.length) {
case 1:
array = Split.split(',',coords[0]);
if(array.length!=4)return -1;
return calc(
Double.parseDouble(array[0]),
Double.parseDouble(array[1]),
Double.parseDouble(array[2]),
Double... | [
"public",
"static",
"double",
"calc",
"(",
"String",
"...",
"coords",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"array",
";",
"switch",
"(",
"coords",
".",
"length",
")",
"{",
"case",
"1",
":",
"array",
"=",
"Split",
".",
"split",
"(",
"'",
"'",
... | Convert from "Lat,Long Lat,Long" String format
"Lat,Long,Lat,Long" Format
or all four entries "Lat Long Lat Long"
(Convenience function)
Since Distance is positive, a "-1" indicates an error in String formatting | [
"Convert",
"from",
"Lat",
"Long",
"Lat",
"Long",
"String",
"format",
"Lat",
"Long",
"Lat",
"Long",
"Format",
"or",
"all",
"four",
"entries",
"Lat",
"Long",
"Lat",
"Long"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/routing/GreatCircle.java#L66-L103 | train |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/AAFPermission.java | AAFPermission.match | public boolean match(Permission p) {
if(p instanceof AAFPermission) {
AAFPermission ap = (AAFPermission)p;
// Note: In AAF > 1.0, Accepting "*" from name would violate multi-tenancy
// Current solution is only allow direct match on Type.
// 8/28/2014 - added REGEX ability
if(type.equals(ap.getNam... | java | public boolean match(Permission p) {
if(p instanceof AAFPermission) {
AAFPermission ap = (AAFPermission)p;
// Note: In AAF > 1.0, Accepting "*" from name would violate multi-tenancy
// Current solution is only allow direct match on Type.
// 8/28/2014 - added REGEX ability
if(type.equals(ap.getNam... | [
"public",
"boolean",
"match",
"(",
"Permission",
"p",
")",
"{",
"if",
"(",
"p",
"instanceof",
"AAFPermission",
")",
"{",
"AAFPermission",
"ap",
"=",
"(",
"AAFPermission",
")",
"p",
";",
"// Note: In AAF > 1.0, Accepting \"*\" from name would violate multi-tenancy\r",
... | Match a Permission
if Permission is Fielded type "Permission", we use the fields
otherwise, we split the Permission with '|'
when the type or action starts with REGEX indicator character ( ! ),
then it is evaluated as a regular expression.
If you want a simple field comparison, it is faster without REGEX | [
"Match",
"a",
"Permission",
"if",
"Permission",
"is",
"Fielded",
"type",
"Permission",
"we",
"use",
"the",
"fields",
"otherwise",
"we",
"split",
"the",
"Permission",
"with",
"|"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/AAFPermission.java#L36-L55 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java | Function.movePerms | private void movePerms(AuthzTrans trans, NsDAO.Data parent,
StringBuilder sb, Result<List<PermDAO.Data>> rpdc) {
Result<Void> rv;
Result<PermDAO.Data> pd;
if (rpdc.isOKhasData()) {
for (PermDAO.Data pdd : rpdc.value) {
String delP2 = pdd.type;
if ("access".equals(delP2)) {
continue;
}
... | java | private void movePerms(AuthzTrans trans, NsDAO.Data parent,
StringBuilder sb, Result<List<PermDAO.Data>> rpdc) {
Result<Void> rv;
Result<PermDAO.Data> pd;
if (rpdc.isOKhasData()) {
for (PermDAO.Data pdd : rpdc.value) {
String delP2 = pdd.type;
if ("access".equals(delP2)) {
continue;
}
... | [
"private",
"void",
"movePerms",
"(",
"AuthzTrans",
"trans",
",",
"NsDAO",
".",
"Data",
"parent",
",",
"StringBuilder",
"sb",
",",
"Result",
"<",
"List",
"<",
"PermDAO",
".",
"Data",
">",
">",
"rpdc",
")",
"{",
"Result",
"<",
"Void",
">",
"rv",
";",
"... | Helper function that moves permissions from a namespace being deleted to
its parent namespace
@param trans
@param parent
@param sb
@param rpdc
- list of permissions in namespace being deleted | [
"Helper",
"function",
"that",
"moves",
"permissions",
"from",
"a",
"namespace",
"being",
"deleted",
"to",
"its",
"parent",
"namespace"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java#L717-L771 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java | Function.moveRoles | private void moveRoles(AuthzTrans trans, NsDAO.Data parent,
StringBuilder sb, Result<List<RoleDAO.Data>> rrdc) {
Result<Void> rv;
Result<RoleDAO.Data> rd;
if (rrdc.isOKhasData()) {
for (RoleDAO.Data rdd : rrdc.value) {
String delP2 = rdd.name;
if ("admin".equals(delP2) || "owner".equals(delP2)) {
... | java | private void moveRoles(AuthzTrans trans, NsDAO.Data parent,
StringBuilder sb, Result<List<RoleDAO.Data>> rrdc) {
Result<Void> rv;
Result<RoleDAO.Data> rd;
if (rrdc.isOKhasData()) {
for (RoleDAO.Data rdd : rrdc.value) {
String delP2 = rdd.name;
if ("admin".equals(delP2) || "owner".equals(delP2)) {
... | [
"private",
"void",
"moveRoles",
"(",
"AuthzTrans",
"trans",
",",
"NsDAO",
".",
"Data",
"parent",
",",
"StringBuilder",
"sb",
",",
"Result",
"<",
"List",
"<",
"RoleDAO",
".",
"Data",
">",
">",
"rrdc",
")",
"{",
"Result",
"<",
"Void",
">",
"rv",
";",
"... | Helper function that moves roles from a namespace being deleted to its
parent namespace
@param trans
@param parent
@param sb
@param rrdc
- list of roles in namespace being deleted | [
"Helper",
"function",
"that",
"moves",
"roles",
"from",
"a",
"namespace",
"being",
"deleted",
"to",
"its",
"parent",
"namespace"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java#L783-L837 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java | Function.addUserRole | public Result<Void> addUserRole(AuthzTrans trans,UserRoleDAO.Data urData) {
Result<Void> rv;
if(Question.ADMIN.equals(urData.rname)) {
rv = mayAddAdmin(trans, urData.ns, urData.user);
} else if(Question.OWNER.equals(urData.rname)) {
rv = mayAddOwner(trans, urData.ns, urData.user);
} else {
rv = checkVa... | java | public Result<Void> addUserRole(AuthzTrans trans,UserRoleDAO.Data urData) {
Result<Void> rv;
if(Question.ADMIN.equals(urData.rname)) {
rv = mayAddAdmin(trans, urData.ns, urData.user);
} else if(Question.OWNER.equals(urData.rname)) {
rv = mayAddOwner(trans, urData.ns, urData.user);
} else {
rv = checkVa... | [
"public",
"Result",
"<",
"Void",
">",
"addUserRole",
"(",
"AuthzTrans",
"trans",
",",
"UserRoleDAO",
".",
"Data",
"urData",
")",
"{",
"Result",
"<",
"Void",
">",
"rv",
";",
"if",
"(",
"Question",
".",
"ADMIN",
".",
"equals",
"(",
"urData",
".",
"rname"... | Add a User to Role
1) Role must exist 2) User must be a known Credential (i.e. mechID ok if
Credential) or known Organizational User
@param trans
@param org
@param urData
@return
@throws DAOException | [
"Add",
"a",
"User",
"to",
"Role"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java#L1246-L1279 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java | Function.extendUserRole | public Result<Void> extendUserRole(AuthzTrans trans, UserRoleDAO.Data urData, boolean checkForExist) {
// Check if record still exists
if (checkForExist && q.userRoleDAO.read(trans, urData).notOKorIsEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,
"User Role does not exist");
}
if (q.roleDAO.re... | java | public Result<Void> extendUserRole(AuthzTrans trans, UserRoleDAO.Data urData, boolean checkForExist) {
// Check if record still exists
if (checkForExist && q.userRoleDAO.read(trans, urData).notOKorIsEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,
"User Role does not exist");
}
if (q.roleDAO.re... | [
"public",
"Result",
"<",
"Void",
">",
"extendUserRole",
"(",
"AuthzTrans",
"trans",
",",
"UserRoleDAO",
".",
"Data",
"urData",
",",
"boolean",
"checkForExist",
")",
"{",
"// Check if record still exists",
"if",
"(",
"checkForExist",
"&&",
"q",
".",
"userRoleDAO",
... | Extend User Role.
extend the Expiration data, according to Organization rules.
@param trans
@param org
@param urData
@return | [
"Extend",
"User",
"Role",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Function.java#L1299-L1318 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/lur/EpiLur.java | EpiLur.get | public Lur get(int idx) {
if(idx>=0 && idx<lurs.length) {
return lurs[idx];
}
return null;
} | java | public Lur get(int idx) {
if(idx>=0 && idx<lurs.length) {
return lurs[idx];
}
return null;
} | [
"public",
"Lur",
"get",
"(",
"int",
"idx",
")",
"{",
"if",
"(",
"idx",
">=",
"0",
"&&",
"idx",
"<",
"lurs",
".",
"length",
")",
"{",
"return",
"lurs",
"[",
"idx",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | Get Lur for index. Returns null if out of range
@param idx
@return | [
"Get",
"Lur",
"for",
"index",
".",
"Returns",
"null",
"if",
"out",
"of",
"range"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/lur/EpiLur.java#L92-L97 | train |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java | AbsAAFLur.fish | public boolean fish(String bait, Permission pond) {
if(isDebug(bait)) {
boolean rv = false;
StringBuilder sb = new StringBuilder("Log for ");
sb.append(bait);
if(supports(bait)) {
User<PERM> user = getUser(bait);
if(user==null) {
sb.append("\n\tUser is not in Cache");
} else {
if(use... | java | public boolean fish(String bait, Permission pond) {
if(isDebug(bait)) {
boolean rv = false;
StringBuilder sb = new StringBuilder("Log for ");
sb.append(bait);
if(supports(bait)) {
User<PERM> user = getUser(bait);
if(user==null) {
sb.append("\n\tUser is not in Cache");
} else {
if(use... | [
"public",
"boolean",
"fish",
"(",
"String",
"bait",
",",
"Permission",
"pond",
")",
"{",
"if",
"(",
"isDebug",
"(",
"bait",
")",
")",
"{",
"boolean",
"rv",
"=",
"false",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"Log for \"",
")",
... | This is where you build AAF CLient Code. Answer the question "Is principal "bait" in the "pond" | [
"This",
"is",
"where",
"you",
"build",
"AAF",
"CLient",
"Code",
".",
"Answer",
"the",
"question",
"Is",
"principal",
"bait",
"in",
"the",
"pond"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java#L76-L134 | train |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java | AbsAAFLur.fishOneOf | public<A> void fishOneOf(String bait, A obj, String type, String instance, List<Action<A>> actions) {
User<PERM> user = getUser(bait);
if(user==null || (user.noPerms() && user.permExpired()))user = loadUser(bait);
// return user==null?false:user.contains(pond);
if(user!=null) {
ReuseAAFPermission perm = new R... | java | public<A> void fishOneOf(String bait, A obj, String type, String instance, List<Action<A>> actions) {
User<PERM> user = getUser(bait);
if(user==null || (user.noPerms() && user.permExpired()))user = loadUser(bait);
// return user==null?false:user.contains(pond);
if(user!=null) {
ReuseAAFPermission perm = new R... | [
"public",
"<",
"A",
">",
"void",
"fishOneOf",
"(",
"String",
"bait",
",",
"A",
"obj",
",",
"String",
"type",
",",
"String",
"instance",
",",
"List",
"<",
"Action",
"<",
"A",
">",
">",
"actions",
")",
"{",
"User",
"<",
"PERM",
">",
"user",
"=",
"g... | This special case minimizes loops, avoids multiple Set hits, and calls all the appropriate Actions found.
@param bait
@param obj
@param type
@param instance
@param actions | [
"This",
"special",
"case",
"minimizes",
"loops",
"avoids",
"multiple",
"Set",
"hits",
"and",
"calls",
"all",
"the",
"appropriate",
"Actions",
"found",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java#L210-L223 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/Cached.java | Cached.cacheIdx | public int cacheIdx(String key) {
int h = 0;
for (int i = 0; i < key.length(); i++) {
h = 31*h + key.charAt(i);
}
if(h<0)h*=-1;
return h%segSize;
} | java | public int cacheIdx(String key) {
int h = 0;
for (int i = 0; i < key.length(); i++) {
h = 31*h + key.charAt(i);
}
if(h<0)h*=-1;
return h%segSize;
} | [
"public",
"int",
"cacheIdx",
"(",
"String",
"key",
")",
"{",
"int",
"h",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"h",
"=",
"31",
"*",
"h",
"+",
"key",
".",
... | Taken from String Hash, but coded, to ensure consistent across Java versions. Also covers negative case; | [
"Taken",
"from",
"String",
"Hash",
"but",
"coded",
"to",
"ensure",
"consistent",
"across",
"Java",
"versions",
".",
"Also",
"covers",
"negative",
"case",
";"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/Cached.java#L34-L41 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/Cached.java | Cached.startCleansing | public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) {
for(CachedDAO<?,?,?> d : dao) {
for(int i=0;i<d.segSize;++i) {
startCleansing(env, d.table()+i);
}
}
} | java | public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) {
for(CachedDAO<?,?,?> d : dao) {
for(int i=0;i<d.segSize;++i) {
startCleansing(env, d.table()+i);
}
}
} | [
"public",
"static",
"void",
"startCleansing",
"(",
"AuthzEnv",
"env",
",",
"CachedDAO",
"<",
"?",
",",
"?",
",",
"?",
">",
"...",
"dao",
")",
"{",
"for",
"(",
"CachedDAO",
"<",
"?",
",",
"?",
",",
"?",
">",
"d",
":",
"dao",
")",
"{",
"for",
"("... | Each Cached object has multiple Segments that need cleaning. Derive each, and add to Cleansing Thread
@param env
@param dao | [
"Each",
"Cached",
"object",
"has",
"multiple",
"Segments",
"that",
"need",
"cleaning",
".",
"Derive",
"each",
"and",
"add",
"to",
"Cleansing",
"Thread"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/Cached.java#L119-L125 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cass/FutureDAO.java | FutureDAO.create | public Result<FutureDAO.Data> create(AuthzTrans trans, FutureDAO.Data data, String id) {
// If ID is not set (typical), create one.
if(data.id==null) {
StringBuilder sb = new StringBuilder(trans.user());
sb.append(data.target);
sb.append(System.currentTimeMillis());
data.id = UUID.nameUUIDFromByte... | java | public Result<FutureDAO.Data> create(AuthzTrans trans, FutureDAO.Data data, String id) {
// If ID is not set (typical), create one.
if(data.id==null) {
StringBuilder sb = new StringBuilder(trans.user());
sb.append(data.target);
sb.append(System.currentTimeMillis());
data.id = UUID.nameUUIDFromByte... | [
"public",
"Result",
"<",
"FutureDAO",
".",
"Data",
">",
"create",
"(",
"AuthzTrans",
"trans",
",",
"FutureDAO",
".",
"Data",
"data",
",",
"String",
"id",
")",
"{",
"// If ID is not set (typical), create one.\r",
"if",
"(",
"data",
".",
"id",
"==",
"null",
")... | Override create to add secondary ID to Subject in History, and create Data.ID, if it is null | [
"Override",
"create",
"to",
"add",
"secondary",
"ID",
"to",
"Subject",
"in",
"History",
"and",
"create",
"Data",
".",
"ID",
"if",
"it",
"is",
"null"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cass/FutureDAO.java#L124-L138 | train |
att/AAF | inno/env/src/main/java/com/att/inno/env/BaseDataFactory.java | BaseDataFactory.genSchema | public static Schema genSchema(Store env, String ... filenames) throws APIException {
String schemaDir = env.get(
env.staticSlot(EnvFactory.SCHEMA_DIR),
EnvFactory.DEFAULT_SCHEMA_DIR);
File dir = new File(schemaDir);
if(!dir.exists())throw new APIException("Schema Directory " + schemaDir + " does not exis... | java | public static Schema genSchema(Store env, String ... filenames) throws APIException {
String schemaDir = env.get(
env.staticSlot(EnvFactory.SCHEMA_DIR),
EnvFactory.DEFAULT_SCHEMA_DIR);
File dir = new File(schemaDir);
if(!dir.exists())throw new APIException("Schema Directory " + schemaDir + " does not exis... | [
"public",
"static",
"Schema",
"genSchema",
"(",
"Store",
"env",
",",
"String",
"...",
"filenames",
")",
"throws",
"APIException",
"{",
"String",
"schemaDir",
"=",
"env",
".",
"get",
"(",
"env",
".",
"staticSlot",
"(",
"EnvFactory",
".",
"SCHEMA_DIR",
")",
... | Generate a Schema Object for use in validation based on FileNames.
WARNING: The java.xml.binding code requires YOU to figure out what order the
files go in. If there is an import from A in B, then you must list A first.
@param err
@param filenames
@return
@throws APIException | [
"Generate",
"a",
"Schema",
"Object",
"for",
"use",
"in",
"validation",
"based",
"on",
"FileNames",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/env/src/main/java/com/att/inno/env/BaseDataFactory.java#L51-L89 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Capacitor.java | Capacitor.read | public int read(byte[] array, int offset, int length) {
if(curr==null)return -1;
int len;
int count=0;
while(length>0) { // loop through while there's data needed
if((len=curr.remaining())>length) { // if enough data in curr buffer, use this code
curr.get(array,offset,length);
count+=length;
len... | java | public int read(byte[] array, int offset, int length) {
if(curr==null)return -1;
int len;
int count=0;
while(length>0) { // loop through while there's data needed
if((len=curr.remaining())>length) { // if enough data in curr buffer, use this code
curr.get(array,offset,length);
count+=length;
len... | [
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"curr",
"==",
"null",
")",
"return",
"-",
"1",
";",
"int",
"len",
";",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"lengt... | read into an array like Streams
@param array
@param offset
@param length
@return | [
"read",
"into",
"an",
"array",
"like",
"Streams"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Capacitor.java#L59-L81 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Capacitor.java | Capacitor.put | public void put(byte[] array, int offset, int length) {
if(curr == null || curr.remaining()==0) {
curr = ringGet();
bbs.add(curr);
}
int len;
while(length>0) {
if((len=curr.remaining())>length) {
curr.put(array,offset,length);
length=0;
} else {
// System.out.println(new String(array))... | java | public void put(byte[] array, int offset, int length) {
if(curr == null || curr.remaining()==0) {
curr = ringGet();
bbs.add(curr);
}
int len;
while(length>0) {
if((len=curr.remaining())>length) {
curr.put(array,offset,length);
length=0;
} else {
// System.out.println(new String(array))... | [
"public",
"void",
"put",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"curr",
"==",
"null",
"||",
"curr",
".",
"remaining",
"(",
")",
"==",
"0",
")",
"{",
"curr",
"=",
"ringGet",
"(",
")",
";"... | Put an array of data into Capacitor
@param array
@param offset
@param length | [
"Put",
"an",
"array",
"of",
"data",
"into",
"Capacitor"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Capacitor.java#L90-L110 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Capacitor.java | Capacitor.setForRead | public void setForRead() {
for(ByteBuffer bb : bbs) {
bb.flip();
}
if(bbs.isEmpty()) {
curr = null;
idx = 0;
} else {
curr=bbs.get(0);
idx=1;
}
} | java | public void setForRead() {
for(ByteBuffer bb : bbs) {
bb.flip();
}
if(bbs.isEmpty()) {
curr = null;
idx = 0;
} else {
curr=bbs.get(0);
idx=1;
}
} | [
"public",
"void",
"setForRead",
"(",
")",
"{",
"for",
"(",
"ByteBuffer",
"bb",
":",
"bbs",
")",
"{",
"bb",
".",
"flip",
"(",
")",
";",
"}",
"if",
"(",
"bbs",
".",
"isEmpty",
"(",
")",
")",
"{",
"curr",
"=",
"null",
";",
"idx",
"=",
"0",
";",
... | Move state from Storage mode into Read mode, changing all internal buffers to read mode, etc | [
"Move",
"state",
"from",
"Storage",
"mode",
"into",
"Read",
"mode",
"changing",
"all",
"internal",
"buffers",
"to",
"read",
"mode",
"etc"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Capacitor.java#L115-L126 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Capacitor.java | Capacitor.done | public void done() {
for(ByteBuffer bb : bbs) {
ringPut(bb);
}
bbs.clear();
curr = null;
} | java | public void done() {
for(ByteBuffer bb : bbs) {
ringPut(bb);
}
bbs.clear();
curr = null;
} | [
"public",
"void",
"done",
"(",
")",
"{",
"for",
"(",
"ByteBuffer",
"bb",
":",
"bbs",
")",
"{",
"ringPut",
"(",
"bb",
")",
";",
"}",
"bbs",
".",
"clear",
"(",
")",
";",
"curr",
"=",
"null",
";",
"}"
] | reuse all the buffers | [
"reuse",
"all",
"the",
"buffers"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Capacitor.java#L131-L137 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Capacitor.java | Capacitor.skip | public long skip(long n) {
long skipped=0L;
int skip;
while(n>0) {
if(n<(skip=curr.remaining())) {
curr.position(curr.position()+(int)n);
skipped+=skip;
n=0;
} else {
curr.position(curr.limit());
skipped-=skip;
if(idx<bbs.size()) {
curr=bbs.get(idx++);
n-=skip;
} e... | java | public long skip(long n) {
long skipped=0L;
int skip;
while(n>0) {
if(n<(skip=curr.remaining())) {
curr.position(curr.position()+(int)n);
skipped+=skip;
n=0;
} else {
curr.position(curr.limit());
skipped-=skip;
if(idx<bbs.size()) {
curr=bbs.get(idx++);
n-=skip;
} e... | [
"public",
"long",
"skip",
"(",
"long",
"n",
")",
"{",
"long",
"skipped",
"=",
"0L",
";",
"int",
"skip",
";",
"while",
"(",
"n",
">",
"0",
")",
"{",
"if",
"(",
"n",
"<",
"(",
"skip",
"=",
"curr",
".",
"remaining",
"(",
")",
")",
")",
"{",
"c... | Returns how many are left that were not skipped
@param n
@return | [
"Returns",
"how",
"many",
"are",
"left",
"that",
"were",
"not",
"skipped"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Capacitor.java#L157-L178 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Capacitor.java | Capacitor.reset | public void reset() {
for(ByteBuffer bb : bbs) {
bb.position(0);
}
if(bbs.isEmpty()) {
curr = null;
idx = 0;
} else {
curr=bbs.get(0);
idx=1;
}
} | java | public void reset() {
for(ByteBuffer bb : bbs) {
bb.position(0);
}
if(bbs.isEmpty()) {
curr = null;
idx = 0;
} else {
curr=bbs.get(0);
idx=1;
}
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"for",
"(",
"ByteBuffer",
"bb",
":",
"bbs",
")",
"{",
"bb",
".",
"position",
"(",
"0",
")",
";",
"}",
"if",
"(",
"bbs",
".",
"isEmpty",
"(",
")",
")",
"{",
"curr",
"=",
"null",
";",
"idx",
"=",
"0",
... | Be able to re-read data that is stored that has already been re-read. This is not a standard Stream behavior, but can be useful
in a standalone mode. | [
"Be",
"able",
"to",
"re",
"-",
"read",
"data",
"that",
"is",
"stored",
"that",
"has",
"already",
"been",
"re",
"-",
"read",
".",
"This",
"is",
"not",
"a",
"standard",
"Stream",
"behavior",
"but",
"can",
"be",
"useful",
"in",
"a",
"standalone",
"mode",
... | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Capacitor.java#L183-L194 | train |
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/HttpCode.java | HttpCode.pathParam | public String pathParam(HttpServletRequest req, String key) {
return match.param(req.getPathInfo(), key);
} | java | public String pathParam(HttpServletRequest req, String key) {
return match.param(req.getPathInfo(), key);
} | [
"public",
"String",
"pathParam",
"(",
"HttpServletRequest",
"req",
",",
"String",
"key",
")",
"{",
"return",
"match",
".",
"param",
"(",
"req",
".",
"getPathInfo",
"(",
")",
",",
"key",
")",
";",
"}"
] | Get the variable element out of the Path Parameter, as set by initial Code
@param req
@param key
@return | [
"Get",
"the",
"variable",
"element",
"out",
"of",
"the",
"Path",
"Parameter",
"as",
"set",
"by",
"initial",
"Code"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/HttpCode.java#L61-L63 | train |
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/HttpCode.java | HttpCode.isAuthorized | public boolean isAuthorized(HttpServletRequest req) {
if(all)return true;
if(roles!=null) {
for(String srole : roles) {
if(req.isUserInRole(srole)) return true;
}
}
return false;
} | java | public boolean isAuthorized(HttpServletRequest req) {
if(all)return true;
if(roles!=null) {
for(String srole : roles) {
if(req.isUserInRole(srole)) return true;
}
}
return false;
} | [
"public",
"boolean",
"isAuthorized",
"(",
"HttpServletRequest",
"req",
")",
"{",
"if",
"(",
"all",
")",
"return",
"true",
";",
"if",
"(",
"roles",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"srole",
":",
"roles",
")",
"{",
"if",
"(",
"req",
".",
... | Check for Authorization when set.
If no Roles set, then accepts all users
@param req
@return | [
"Check",
"for",
"Authorization",
"when",
"set",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/HttpCode.java#L75-L83 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiFilter.java | CadiFilter.destroy | public void destroy() {
// Synchronize, in case multiCadiFilters are used.
synchronized(CadiHTTPManip.noAdditional) {
if(--count<=0 && httpChecker!=null) {
httpChecker.destroy();
httpChecker=null;
access=null;
pathExceptions=null;
}
}
} | java | public void destroy() {
// Synchronize, in case multiCadiFilters are used.
synchronized(CadiHTTPManip.noAdditional) {
if(--count<=0 && httpChecker!=null) {
httpChecker.destroy();
httpChecker=null;
access=null;
pathExceptions=null;
}
}
} | [
"public",
"void",
"destroy",
"(",
")",
"{",
"// Synchronize, in case multiCadiFilters are used.\r",
"synchronized",
"(",
"CadiHTTPManip",
".",
"noAdditional",
")",
"{",
"if",
"(",
"--",
"count",
"<=",
"0",
"&&",
"httpChecker",
"!=",
"null",
")",
"{",
"httpChecker"... | Containers call "destroy" when time to cleanup | [
"Containers",
"call",
"destroy",
"when",
"time",
"to",
"cleanup"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiFilter.java#L202-L212 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiFilter.java | CadiFilter.noAuthn | private boolean noAuthn(HttpServletRequest hreq) {
if(pathExceptions!=null) {
String pi = hreq.getPathInfo();
if(pi==null) return false; // JBoss sometimes leaves null
for(String pe : pathExceptions) {
if(pi.startsWith(pe))return true;
}
}
return false;
} | java | private boolean noAuthn(HttpServletRequest hreq) {
if(pathExceptions!=null) {
String pi = hreq.getPathInfo();
if(pi==null) return false; // JBoss sometimes leaves null
for(String pe : pathExceptions) {
if(pi.startsWith(pe))return true;
}
}
return false;
} | [
"private",
"boolean",
"noAuthn",
"(",
"HttpServletRequest",
"hreq",
")",
"{",
"if",
"(",
"pathExceptions",
"!=",
"null",
")",
"{",
"String",
"pi",
"=",
"hreq",
".",
"getPathInfo",
"(",
")",
";",
"if",
"(",
"pi",
"==",
"null",
")",
"return",
"false",
";... | If PathExceptions exist, report if these should not have Authn applied.
@param hreq
@return | [
"If",
"PathExceptions",
"exist",
"report",
"if",
"these",
"should",
"not",
"have",
"Authn",
"applied",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiFilter.java#L247-L256 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/filter/CadiFilter.java | CadiFilter.getConverter | private PermConverter getConverter(HttpServletRequest hreq) {
if(mapPairs!=null) {
String pi = hreq.getPathInfo();
if(pi!=null) {
for(Pair p: mapPairs) {
if(pi.startsWith(p.name))return p.pc;
}
}
}
return NullPermConverter.singleton();
} | java | private PermConverter getConverter(HttpServletRequest hreq) {
if(mapPairs!=null) {
String pi = hreq.getPathInfo();
if(pi!=null) {
for(Pair p: mapPairs) {
if(pi.startsWith(p.name))return p.pc;
}
}
}
return NullPermConverter.singleton();
} | [
"private",
"PermConverter",
"getConverter",
"(",
"HttpServletRequest",
"hreq",
")",
"{",
"if",
"(",
"mapPairs",
"!=",
"null",
")",
"{",
"String",
"pi",
"=",
"hreq",
".",
"getPathInfo",
"(",
")",
";",
"if",
"(",
"pi",
"!=",
"null",
")",
"{",
"for",
"(",... | Get Converter by Path | [
"Get",
"Converter",
"by",
"Path"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiFilter.java#L261-L271 | train |
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/Routes.java | Routes.findOrCreate | synchronized Route<TRANS> findOrCreate(HttpMethods meth, String path) {
Route<TRANS> rv = null;
for(int i=0;i<end;++i) {
if(routes[i].resolvesTo(meth,path))rv = routes[i];
}
if(rv==null) {
if(end>=routes.length) {
@SuppressWarnings("unchecked")
Route<TRANS>[] temp = new Route[end+10];
Syst... | java | synchronized Route<TRANS> findOrCreate(HttpMethods meth, String path) {
Route<TRANS> rv = null;
for(int i=0;i<end;++i) {
if(routes[i].resolvesTo(meth,path))rv = routes[i];
}
if(rv==null) {
if(end>=routes.length) {
@SuppressWarnings("unchecked")
Route<TRANS>[] temp = new Route[end+10];
Syst... | [
"synchronized",
"Route",
"<",
"TRANS",
">",
"findOrCreate",
"(",
"HttpMethods",
"meth",
",",
"String",
"path",
")",
"{",
"Route",
"<",
"TRANS",
">",
"rv",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"end",
";",
"++",
"i",
"... | Package on purpose | [
"Package",
"on",
"purpose"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/Routes.java#L30-L47 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedCertDAO.java | CachedCertDAO.readID | public Result<List<CertDAO.Data>> readID(AuthzTrans trans, final String id) {
return dao().readID(trans, id);
} | java | public Result<List<CertDAO.Data>> readID(AuthzTrans trans, final String id) {
return dao().readID(trans, id);
} | [
"public",
"Result",
"<",
"List",
"<",
"CertDAO",
".",
"Data",
">",
">",
"readID",
"(",
"AuthzTrans",
"trans",
",",
"final",
"String",
"id",
")",
"{",
"return",
"dao",
"(",
")",
".",
"readID",
"(",
"trans",
",",
"id",
")",
";",
"}"
] | Pass through Cert ID Lookup
@param trans
@param ns
@return | [
"Pass",
"through",
"Cert",
"ID",
"Lookup"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedCertDAO.java#L27-L29 | train |
att/AAF | inno/xgen/src/main/java/com/att/xgen/XGenBuff.java | XGenBuff.run | public void run(Cache<G> cache, Code<G> code) throws APIException, IOException {
code.code(cache, xgen);
} | java | public void run(Cache<G> cache, Code<G> code) throws APIException, IOException {
code.code(cache, xgen);
} | [
"public",
"void",
"run",
"(",
"Cache",
"<",
"G",
">",
"cache",
",",
"Code",
"<",
"G",
">",
"code",
")",
"throws",
"APIException",
",",
"IOException",
"{",
"code",
".",
"code",
"(",
"cache",
",",
"xgen",
")",
";",
"}"
] | Normal case of building up Cached HTML without transaction info
@param cache
@param code
@throws APIException
@throws IOException | [
"Normal",
"case",
"of",
"building",
"up",
"Cached",
"HTML",
"without",
"transaction",
"info"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/xgen/src/main/java/com/att/xgen/XGenBuff.java#L32-L34 | train |
att/AAF | inno/xgen/src/main/java/com/att/xgen/XGenBuff.java | XGenBuff.run | @SuppressWarnings({ "unchecked", "rawtypes" })
public void run(State<Env> state, Trans trans, Cache cache, DynamicCode code) throws APIException, IOException {
code.code(state, trans, cache, xgen);
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public void run(State<Env> state, Trans trans, Cache cache, DynamicCode code) throws APIException, IOException {
code.code(state, trans, cache, xgen);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"void",
"run",
"(",
"State",
"<",
"Env",
">",
"state",
",",
"Trans",
"trans",
",",
"Cache",
"cache",
",",
"DynamicCode",
"code",
")",
"throws",
"APIException",
","... | Special Case where code is dynamic, so give access to State and Trans info
@param state
@param trans
@param cache
@param code
@throws APIException
@throws IOException | [
"Special",
"Case",
"where",
"code",
"is",
"dynamic",
"so",
"give",
"access",
"to",
"State",
"and",
"Trans",
"info"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/xgen/src/main/java/com/att/xgen/XGenBuff.java#L46-L49 | train |
att/AAF | inno/xgen/src/main/java/com/att/xgen/DynamicCode.java | DynamicCode.code | public void code(Cache<G> cache, G xgen) throws APIException, IOException {
code(null, null,cache,xgen);
} | java | public void code(Cache<G> cache, G xgen) throws APIException, IOException {
code(null, null,cache,xgen);
} | [
"public",
"void",
"code",
"(",
"Cache",
"<",
"G",
">",
"cache",
",",
"G",
"xgen",
")",
"throws",
"APIException",
",",
"IOException",
"{",
"code",
"(",
"null",
",",
"null",
",",
"cache",
",",
"xgen",
")",
";",
"}"
] | We expect not to have this section of the code engaged at any time | [
"We",
"expect",
"not",
"to",
"have",
"this",
"section",
"of",
"the",
"code",
"engaged",
"at",
"any",
"time"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/xgen/src/main/java/com/att/xgen/DynamicCode.java#L22-L24 | train |
att/AAF | authz/authz-gui/src/main/java/com/att/authz/gui/Page.java | Page.browser | public static BROWSER browser(AuthzTrans trans, Slot slot) {
BROWSER br = trans.get(slot, null);
if(br==null) {
String agent = trans.agent();
int msie;
if(agent.contains("iPhone") /* other phones? */) {
br=BROWSER.iPhone;
} else if ((msie = agent.indexOf("MSIE"))>=0) {
msie+=5;
int end = ag... | java | public static BROWSER browser(AuthzTrans trans, Slot slot) {
BROWSER br = trans.get(slot, null);
if(br==null) {
String agent = trans.agent();
int msie;
if(agent.contains("iPhone") /* other phones? */) {
br=BROWSER.iPhone;
} else if ((msie = agent.indexOf("MSIE"))>=0) {
msie+=5;
int end = ag... | [
"public",
"static",
"BROWSER",
"browser",
"(",
"AuthzTrans",
"trans",
",",
"Slot",
"slot",
")",
"{",
"BROWSER",
"br",
"=",
"trans",
".",
"get",
"(",
"slot",
",",
"null",
")",
";",
"if",
"(",
"br",
"==",
"null",
")",
"{",
"String",
"agent",
"=",
"tr... | It's IE if int >=0
Use int found in "ieVersion"
Official IE 7
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322;
.NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Official IE 8
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2;
.NET CLR 2.0.50727; .NET CLR 3... | [
"It",
"s",
"IE",
"if",
"int",
">",
"=",
"0"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-gui/src/main/java/com/att/authz/gui/Page.java#L267-L290 | train |
att/AAF | authz/authz-batch/src/main/java/com/att/authz/JobChange.java | JobChange.processJobChangeDataFile | public void processJobChangeDataFile(String fileName,
String falloutFileName, Date validDate) throws Exception
{
BufferedWriter writer = null;
try {
env.info().log("Reading file: " + fileName );
FileInputStream fstream = new FileInputS... | java | public void processJobChangeDataFile(String fileName,
String falloutFileName, Date validDate) throws Exception
{
BufferedWriter writer = null;
try {
env.info().log("Reading file: " + fileName );
FileInputStream fstream = new FileInputS... | [
"public",
"void",
"processJobChangeDataFile",
"(",
"String",
"fileName",
",",
"String",
"falloutFileName",
",",
"Date",
"validDate",
")",
"throws",
"Exception",
"{",
"BufferedWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"env",
".",
"info",
"(",
")",
".",
... | Processes the specified JobChange data file obtained from Webphone. Each line is
read and processed and any fallout is written to the specified fallout file.
If fallout file already exists it is deleted and a new one is created. A
comparison of the supervisor id in the job data file is done against the one returned
by ... | [
"Processes",
"the",
"specified",
"JobChange",
"data",
"file",
"obtained",
"from",
"Webphone",
".",
"Each",
"line",
"is",
"read",
"and",
"processed",
"and",
"any",
"fallout",
"is",
"written",
"to",
"the",
"specified",
"fallout",
"file",
".",
"If",
"fallout",
... | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-batch/src/main/java/com/att/authz/JobChange.java#L344-L370 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cass/PermDAO.java | PermDAO.addDescription | public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
try {
getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ description + "' WHERE ns = '" + ns + "' AND type = '" + type + "'"
+ "AND instance = '" + inst... | java | public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
try {
getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ description + "' WHERE ns = '" + ns + "' AND type = '" + type + "'"
+ "AND instance = '" + inst... | [
"public",
"Result",
"<",
"Void",
">",
"addDescription",
"(",
"AuthzTrans",
"trans",
",",
"String",
"ns",
",",
"String",
"type",
",",
"String",
"instance",
",",
"String",
"action",
",",
"String",
"description",
")",
"{",
"try",
"{",
"getSession",
"(",
"tran... | Add description to this permission
@param trans
@param ns
@param type
@param instance
@param action
@param description
@return | [
"Add",
"description",
"to",
"this",
"permission"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cass/PermDAO.java#L425-L444 | train |
att/AAF | authz/authz-defOrg/src/main/java/com/osaaf/defOrg/DefaultOrg.java | DefaultOrg.getApprovers | @Override
public List<Identity> getApprovers(AuthzTrans trans, String user) throws OrganizationException {
Identity orgIdentity = getIdentity(trans, user);
List<Identity> orgIdentitys = new ArrayList<Identity>();
if(orgIdentity!=null) {
String supervisorID = orgIdentity.responsibleTo();
if (supervisorID.in... | java | @Override
public List<Identity> getApprovers(AuthzTrans trans, String user) throws OrganizationException {
Identity orgIdentity = getIdentity(trans, user);
List<Identity> orgIdentitys = new ArrayList<Identity>();
if(orgIdentity!=null) {
String supervisorID = orgIdentity.responsibleTo();
if (supervisorID.in... | [
"@",
"Override",
"public",
"List",
"<",
"Identity",
">",
"getApprovers",
"(",
"AuthzTrans",
"trans",
",",
"String",
"user",
")",
"throws",
"OrganizationException",
"{",
"Identity",
"orgIdentity",
"=",
"getIdentity",
"(",
"trans",
",",
"user",
")",
";",
"List",... | Assume the Supervisor is the Approver. | [
"Assume",
"the",
"Supervisor",
"is",
"the",
"Approver",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-defOrg/src/main/java/com/osaaf/defOrg/DefaultOrg.java#L465-L478 | train |
att/AAF | authz/authz-defOrg/src/main/java/com/osaaf/defOrg/DefaultOrg.java | DefaultOrg.getAddresses | private Address[] getAddresses(List<String> strAddresses, String delimiter) throws OrganizationException {
Address[] addressArray = new Address[strAddresses.size()];
int count = 0;
for (String addr : strAddresses)
{
try{
addressArray[count] = new InternetAddress(addr);
coun... | java | private Address[] getAddresses(List<String> strAddresses, String delimiter) throws OrganizationException {
Address[] addressArray = new Address[strAddresses.size()];
int count = 0;
for (String addr : strAddresses)
{
try{
addressArray[count] = new InternetAddress(addr);
coun... | [
"private",
"Address",
"[",
"]",
"getAddresses",
"(",
"List",
"<",
"String",
">",
"strAddresses",
",",
"String",
"delimiter",
")",
"throws",
"OrganizationException",
"{",
"Address",
"[",
"]",
"addressArray",
"=",
"new",
"Address",
"[",
"strAddresses",
".",
"siz... | Convert the delimiter String into Internet addresses with the
delimiter of provided
@param strAddress
@param delimiter
@return | [
"Convert",
"the",
"delimiter",
"String",
"into",
"Internet",
"addresses",
"with",
"the",
"delimiter",
"of",
"provided"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-defOrg/src/main/java/com/osaaf/defOrg/DefaultOrg.java#L560-L573 | train |
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/TypedCode.java | TypedCode.add | public TypedCode<TRANS> add(HttpCode<TRANS,?> code, String ... others) {
StringBuilder sb = new StringBuilder();
boolean first = true;
for(String str : others) {
if(first) {
first = false;
} else {
sb.append(',');
}
sb.append(str);
}
parse(code, sb.toString());
return th... | java | public TypedCode<TRANS> add(HttpCode<TRANS,?> code, String ... others) {
StringBuilder sb = new StringBuilder();
boolean first = true;
for(String str : others) {
if(first) {
first = false;
} else {
sb.append(',');
}
sb.append(str);
}
parse(code, sb.toString());
return th... | [
"public",
"TypedCode",
"<",
"TRANS",
">",
"add",
"(",
"HttpCode",
"<",
"TRANS",
",",
"?",
">",
"code",
",",
"String",
"...",
"others",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"first",
"=",
"true",
";",
... | Construct Typed Code based on ContentType parameters passed in
@param code
@param others
@return | [
"Construct",
"Typed",
"Code",
"based",
"on",
"ContentType",
"parameters",
"passed",
"in"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/TypedCode.java#L52-L66 | train |
att/AAF | authz/authz-core/src/main/java/com/att/cssa/rserv/TypedCode.java | TypedCode.relatedTo | public StringBuilder relatedTo(HttpCode<TRANS, ?> code, StringBuilder sb) {
boolean first = true;
for(Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
if(code==null || pair.y.x == code) {
if(first) {
first = false;
} else {
sb.append(',');
}
sb... | java | public StringBuilder relatedTo(HttpCode<TRANS, ?> code, StringBuilder sb) {
boolean first = true;
for(Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
if(code==null || pair.y.x == code) {
if(first) {
first = false;
} else {
sb.append(',');
}
sb... | [
"public",
"StringBuilder",
"relatedTo",
"(",
"HttpCode",
"<",
"TRANS",
",",
"?",
">",
"code",
",",
"StringBuilder",
"sb",
")",
"{",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Pair",
"<",
"String",
",",
"Pair",
"<",
"HttpCode",
"<",
"TRANS",
","... | Print on String Builder content related to specific Code
This is for Reporting and Debugging purposes, so the content is not cached.
If code is "null", then all content is matched
@param code
@return | [
"Print",
"on",
"String",
"Builder",
"content",
"related",
"to",
"specific",
"Code"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/TypedCode.java#L171-L193 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedCredDAO.java | CachedCredDAO.readNS | public Result<List<CredDAO.Data>> readNS(AuthzTrans trans, final String ns) {
return dao().readNS(trans, ns);
} | java | public Result<List<CredDAO.Data>> readNS(AuthzTrans trans, final String ns) {
return dao().readNS(trans, ns);
} | [
"public",
"Result",
"<",
"List",
"<",
"CredDAO",
".",
"Data",
">",
">",
"readNS",
"(",
"AuthzTrans",
"trans",
",",
"final",
"String",
"ns",
")",
"{",
"return",
"dao",
"(",
")",
".",
"readNS",
"(",
"trans",
",",
"ns",
")",
";",
"}"
] | Pass through Cred Lookup
Unlike Role and Perm, we don't need or want to cache these elements... Only used for NS Delete.
@param trans
@param ns
@return | [
"Pass",
"through",
"Cred",
"Lookup"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedCredDAO.java#L29-L32 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedRoleDAO.java | CachedRoleDAO.addDescription | public Result<Void> addDescription(AuthzTrans trans, String ns, String name, String description) {
//TODO Invalidate?
return dao().addDescription(trans, ns, name, description);
} | java | public Result<Void> addDescription(AuthzTrans trans, String ns, String name, String description) {
//TODO Invalidate?
return dao().addDescription(trans, ns, name, description);
} | [
"public",
"Result",
"<",
"Void",
">",
"addDescription",
"(",
"AuthzTrans",
"trans",
",",
"String",
"ns",
",",
"String",
"name",
",",
"String",
"description",
")",
"{",
"//TODO Invalidate?",
"return",
"dao",
"(",
")",
".",
"addDescription",
"(",
"trans",
",",... | Add description to this role
@param trans
@param ns
@param name
@param description
@return | [
"Add",
"description",
"to",
"this",
"role"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cached/CachedRoleDAO.java#L82-L86 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Question.java | Question.domain2ns | public static String domain2ns(String id) {
int at = id.indexOf('@');
if (at >= 0) {
String[] domain = id.substring(at + 1).split("\\.");
StringBuilder ns = new StringBuilder(id.length());
boolean first = true;
for (int i = domain.length - 1; i >= 0; --i) {
if (first) {
first = false;
} els... | java | public static String domain2ns(String id) {
int at = id.indexOf('@');
if (at >= 0) {
String[] domain = id.substring(at + 1).split("\\.");
StringBuilder ns = new StringBuilder(id.length());
boolean first = true;
for (int i = domain.length - 1; i >= 0; --i) {
if (first) {
first = false;
} els... | [
"public",
"static",
"String",
"domain2ns",
"(",
"String",
"id",
")",
"{",
"int",
"at",
"=",
"id",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"at",
">=",
"0",
")",
"{",
"String",
"[",
"]",
"domain",
"=",
"id",
".",
"substring",
"(",
"at... | Translate an ID into it's domain
i.e. myid1234@myapp.att.com results in domain of com.att.myapp
@param id
@return | [
"Translate",
"an",
"ID",
"into",
"it",
"s",
"domain"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Question.java#L405-L424 | train |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Question.java | Question.canMove | public boolean canMove(NsType nsType) {
boolean rv;
switch(nsType) {
case DOT:
case ROOT:
case COMPANY:
case UNKNOWN:
rv = false;
break;
default:
rv = true;
}
return rv;
} | java | public boolean canMove(NsType nsType) {
boolean rv;
switch(nsType) {
case DOT:
case ROOT:
case COMPANY:
case UNKNOWN:
rv = false;
break;
default:
rv = true;
}
return rv;
} | [
"public",
"boolean",
"canMove",
"(",
"NsType",
"nsType",
")",
"{",
"boolean",
"rv",
";",
"switch",
"(",
"nsType",
")",
"{",
"case",
"DOT",
":",
"case",
"ROOT",
":",
"case",
"COMPANY",
":",
"case",
"UNKNOWN",
":",
"rv",
"=",
"false",
";",
"break",
";"... | canMove
Which Types can be moved
@param nsType
@return | [
"canMove",
"Which",
"Types",
"can",
"be",
"moved"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/hl/Question.java#L988-L1001 | train |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFAuthn.java | AAFAuthn.validate | public String validate(String user, String password) throws IOException, CadiException {
User<AAFPermission> usr = getUser(user);
if(password.startsWith("enc:???")) {
password = access.decrypt(password, true);
}
byte[] bytes = password.getBytes();
if(usr != null && usr.principal != null && usr.principal.g... | java | public String validate(String user, String password) throws IOException, CadiException {
User<AAFPermission> usr = getUser(user);
if(password.startsWith("enc:???")) {
password = access.decrypt(password, true);
}
byte[] bytes = password.getBytes();
if(usr != null && usr.principal != null && usr.principal.g... | [
"public",
"String",
"validate",
"(",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"IOException",
",",
"CadiException",
"{",
"User",
"<",
"AAFPermission",
">",
"usr",
"=",
"getUser",
"(",
"user",
")",
";",
"if",
"(",
"password",
".",
"startsW... | Returns null if ok, or an Error String;
@param user
@param password
@return
@throws IOException
@throws CadiException
@throws Exception | [
"Returns",
"null",
"if",
"ok",
"or",
"an",
"Error",
"String",
";"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AAFAuthn.java#L104-L142 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/util/Vars.java | Vars.convert | public static String convert(final String text, final List<String> vars) {
String[] array = new String[vars.size()];
StringBuilder sb = new StringBuilder();
convert(sb,text,vars.toArray(array));
return sb.toString();
} | java | public static String convert(final String text, final List<String> vars) {
String[] array = new String[vars.size()];
StringBuilder sb = new StringBuilder();
convert(sb,text,vars.toArray(array));
return sb.toString();
} | [
"public",
"static",
"String",
"convert",
"(",
"final",
"String",
"text",
",",
"final",
"List",
"<",
"String",
">",
"vars",
")",
"{",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"vars",
".",
"size",
"(",
")",
"]",
";",
"StringBuilder",
"sb... | Simplified Conversion based on typical use of getting AT&T style RESTful Error Messages
@param text
@param vars
@return | [
"Simplified",
"Conversion",
"based",
"on",
"typical",
"use",
"of",
"getting",
"AT&T",
"style",
"RESTful",
"Error",
"Messages"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/util/Vars.java#L15-L20 | train |
att/AAF | authz/authz-core/src/main/java/com/att/authz/layer/Result.java | Result.ok | public static<R> Result<R> ok(R value) {
return new Result<R>(value,OK,SUCCESS,null);
} | java | public static<R> Result<R> ok(R value) {
return new Result<R>(value,OK,SUCCESS,null);
} | [
"public",
"static",
"<",
"R",
">",
"Result",
"<",
"R",
">",
"ok",
"(",
"R",
"value",
")",
"{",
"return",
"new",
"Result",
"<",
"R",
">",
"(",
"value",
",",
"OK",
",",
"SUCCESS",
",",
"null",
")",
";",
"}"
] | Create a Result class with "OK" status and "Success" for details
This is the easiest to use
@param value
@param status
@return | [
"Create",
"a",
"Result",
"class",
"with",
"OK",
"status",
"and",
"Success",
"for",
"details"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/authz/layer/Result.java#L60-L62 | train |
att/AAF | authz/authz-core/src/main/java/com/att/authz/layer/Result.java | Result.ok | public static<R> Result<R[]> ok(R value[]) {
return new Result<R[]>(value,OK,SUCCESS,null).emptyList(value.length==0);
} | java | public static<R> Result<R[]> ok(R value[]) {
return new Result<R[]>(value,OK,SUCCESS,null).emptyList(value.length==0);
} | [
"public",
"static",
"<",
"R",
">",
"Result",
"<",
"R",
"[",
"]",
">",
"ok",
"(",
"R",
"value",
"[",
"]",
")",
"{",
"return",
"new",
"Result",
"<",
"R",
"[",
"]",
">",
"(",
"value",
",",
"OK",
",",
"SUCCESS",
",",
"null",
")",
".",
"emptyList"... | Accept Arrays and mark as empty or not
@param value
@return | [
"Accept",
"Arrays",
"and",
"mark",
"as",
"empty",
"or",
"not"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/authz/layer/Result.java#L69-L71 | train |
att/AAF | authz/authz-core/src/main/java/com/att/authz/layer/Result.java | Result.ok | public static<R> Result<List<R>> ok(List<R> value) {
return new Result<List<R>>(value,OK,SUCCESS,null).emptyList(value.size()==0);
} | java | public static<R> Result<List<R>> ok(List<R> value) {
return new Result<List<R>>(value,OK,SUCCESS,null).emptyList(value.size()==0);
} | [
"public",
"static",
"<",
"R",
">",
"Result",
"<",
"List",
"<",
"R",
">",
">",
"ok",
"(",
"List",
"<",
"R",
">",
"value",
")",
"{",
"return",
"new",
"Result",
"<",
"List",
"<",
"R",
">",
">",
"(",
"value",
",",
"OK",
",",
"SUCCESS",
",",
"null... | Accept Lists and mark as empty or not
@param value
@return | [
"Accept",
"Lists",
"and",
"mark",
"as",
"empty",
"or",
"not"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/authz/layer/Result.java#L87-L89 | train |
att/AAF | authz/authz-core/src/main/java/com/att/authz/layer/Result.java | Result.err | public static<R> Result<R> err(int status, String details, String ... variables) {
return new Result<R>(null,status,details,variables);
} | java | public static<R> Result<R> err(int status, String details, String ... variables) {
return new Result<R>(null,status,details,variables);
} | [
"public",
"static",
"<",
"R",
">",
"Result",
"<",
"R",
">",
"err",
"(",
"int",
"status",
",",
"String",
"details",
",",
"String",
"...",
"variables",
")",
"{",
"return",
"new",
"Result",
"<",
"R",
">",
"(",
"null",
",",
"status",
",",
"details",
",... | Create a Status (usually non OK, with a details statement and variables supported
@param status
@param details
@param variables
@return | [
"Create",
"a",
"Status",
"(",
"usually",
"non",
"OK",
"with",
"a",
"details",
"statement",
"and",
"variables",
"supported"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/authz/layer/Result.java#L127-L129 | train |
att/AAF | authz/authz-core/src/main/java/com/att/authz/layer/Result.java | Result.err | public static<R> Result<R> err(Exception e) {
return new Result<R>(null,ERR_General,e.getMessage(),EMPTY_VARS);
} | java | public static<R> Result<R> err(Exception e) {
return new Result<R>(null,ERR_General,e.getMessage(),EMPTY_VARS);
} | [
"public",
"static",
"<",
"R",
">",
"Result",
"<",
"R",
">",
"err",
"(",
"Exception",
"e",
")",
"{",
"return",
"new",
"Result",
"<",
"R",
">",
"(",
"null",
",",
"ERR_General",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"EMPTY_VARS",
")",
";",
"}"... | Create General Error from Exception
@param e
@return | [
"Create",
"General",
"Error",
"from",
"Exception"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/authz/layer/Result.java#L145-L147 | train |
att/AAF | authz/authz-core/src/main/java/com/att/authz/layer/Result.java | Result.create | public static<R> Result<R> create(R value, int status, String details, String ... vars) {
return new Result<R>(value,status,details,vars);
} | java | public static<R> Result<R> create(R value, int status, String details, String ... vars) {
return new Result<R>(value,status,details,vars);
} | [
"public",
"static",
"<",
"R",
">",
"Result",
"<",
"R",
">",
"create",
"(",
"R",
"value",
",",
"int",
"status",
",",
"String",
"details",
",",
"String",
"...",
"vars",
")",
"{",
"return",
"new",
"Result",
"<",
"R",
">",
"(",
"value",
",",
"status",
... | Create a Status (usually non OK, with a details statement
@param value
@param status
@param details
@return | [
"Create",
"a",
"Status",
"(",
"usually",
"non",
"OK",
"with",
"a",
"details",
"statement"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/authz/layer/Result.java#L156-L158 | train |
att/AAF | inno/rosetta/src/main/java/com/att/rosetta/env/RosettaDF.java | RosettaDF.out | public RosettaDF<T> out(Data.TYPE type) {
outType = type;
defaultOut = getOut(type==Data.TYPE.DEFAULT?Data.TYPE.JSON:type);
return this;
} | java | public RosettaDF<T> out(Data.TYPE type) {
outType = type;
defaultOut = getOut(type==Data.TYPE.DEFAULT?Data.TYPE.JSON:type);
return this;
} | [
"public",
"RosettaDF",
"<",
"T",
">",
"out",
"(",
"Data",
".",
"TYPE",
"type",
")",
"{",
"outType",
"=",
"type",
";",
"defaultOut",
"=",
"getOut",
"(",
"type",
"==",
"Data",
".",
"TYPE",
".",
"DEFAULT",
"?",
"Data",
".",
"TYPE",
".",
"JSON",
":",
... | If exists, first option is "Pretty", second is "Fragment"
@param options
@return | [
"If",
"exists",
"first",
"option",
"is",
"Pretty",
"second",
"is",
"Fragment"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/rosetta/src/main/java/com/att/rosetta/env/RosettaDF.java#L130-L134 | train |
att/AAF | inno/rosetta/src/main/java/com/att/rosetta/env/RosettaDF.java | RosettaDF.rootMarshal | public RosettaDF<T> rootMarshal(Marshal<T> marshal) {
if(marshal instanceof DocMarshal) {
this.marshal = marshal;
} else {
this.marshal = DocMarshal.root(marshal);
}
return this;
} | java | public RosettaDF<T> rootMarshal(Marshal<T> marshal) {
if(marshal instanceof DocMarshal) {
this.marshal = marshal;
} else {
this.marshal = DocMarshal.root(marshal);
}
return this;
} | [
"public",
"RosettaDF",
"<",
"T",
">",
"rootMarshal",
"(",
"Marshal",
"<",
"T",
">",
"marshal",
")",
"{",
"if",
"(",
"marshal",
"instanceof",
"DocMarshal",
")",
"{",
"this",
".",
"marshal",
"=",
"marshal",
";",
"}",
"else",
"{",
"this",
".",
"marshal",
... | Assigning Root Marshal Object
Will wrap with DocMarshal Object if not already
@param marshal
@return | [
"Assigning",
"Root",
"Marshal",
"Object"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/inno/rosetta/src/main/java/com/att/rosetta/env/RosettaDF.java#L201-L208 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.encode | public String encode(String str) throws IOException {
byte[] array;
try {
array = str.getBytes(encoding);
} catch (IOException e) {
array = str.getBytes(); // take default
}
// Calculate expected size to avoid any buffer expansion copies within the ByteArrayOutput code
ByteArr... | java | public String encode(String str) throws IOException {
byte[] array;
try {
array = str.getBytes(encoding);
} catch (IOException e) {
array = str.getBytes(); // take default
}
// Calculate expected size to avoid any buffer expansion copies within the ByteArrayOutput code
ByteArr... | [
"public",
"String",
"encode",
"(",
"String",
"str",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"array",
";",
"try",
"{",
"array",
"=",
"str",
".",
"getBytes",
"(",
"encoding",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"arra... | Helper function for String API of "Encode"
use "getBytes" with appropriate char encoding, etc.
@param str
@return
@throws IOException | [
"Helper",
"function",
"for",
"String",
"API",
"of",
"Encode",
"use",
"getBytes",
"with",
"appropriate",
"char",
"encoding",
"etc",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L230-L242 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.encode | public void encode(InputStream is, OutputStream os) throws IOException {
// StringBuilder sb = new StringBuilder((int)(estimate*1.255)); // try to get the right size of StringBuilder from start.. slightly more than 1.25 times
int prev=0;
int read, idx=0, line=0;
boolean go;
do {
read = i... | java | public void encode(InputStream is, OutputStream os) throws IOException {
// StringBuilder sb = new StringBuilder((int)(estimate*1.255)); // try to get the right size of StringBuilder from start.. slightly more than 1.25 times
int prev=0;
int read, idx=0, line=0;
boolean go;
do {
read = i... | [
"public",
"void",
"encode",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"// StringBuilder sb = new StringBuilder((int)(estimate*1.255)); // try to get the right size of StringBuilder from start.. slightly more than 1.25 times ",
"int",
"prev"... | encode InputStream onto Output Stream
@param is
@param estimate
@return
@throws IOException | [
"encode",
"InputStream",
"onto",
"Output",
"Stream"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L303-L353 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.decode | public void decode(InputStream is, OutputStream os) throws IOException {
int read, idx=0;
int prev=0, index;
while((read = is.read())>=0) {
index = convert.convert(read);
if(index>=0) {
switch(++idx) { // 1 based cases, slightly faster ++
case 1: // index goes into first 6 bits o... | java | public void decode(InputStream is, OutputStream os) throws IOException {
int read, idx=0;
int prev=0, index;
while((read = is.read())>=0) {
index = convert.convert(read);
if(index>=0) {
switch(++idx) { // 1 based cases, slightly faster ++
case 1: // index goes into first 6 bits o... | [
"public",
"void",
"decode",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"int",
"read",
",",
"idx",
"=",
"0",
";",
"int",
"prev",
"=",
"0",
",",
"index",
";",
"while",
"(",
"(",
"read",
"=",
"is",
".",
"re... | Decode InputStream onto OutputStream
@param is
@param os
@throws IOException | [
"Decode",
"InputStream",
"onto",
"OutputStream"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L366-L391 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.keygen | public byte[] keygen() throws IOException {
byte inkey[] = new byte[0x600];
new SecureRandom().nextBytes(inkey);
ByteArrayOutputStream baos = new ByteArrayOutputStream(0x800);
base64url.encode(new ByteArrayInputStream(inkey), baos);
return baos.toByteArray();
} | java | public byte[] keygen() throws IOException {
byte inkey[] = new byte[0x600];
new SecureRandom().nextBytes(inkey);
ByteArrayOutputStream baos = new ByteArrayOutputStream(0x800);
base64url.encode(new ByteArrayInputStream(inkey), baos);
return baos.toByteArray();
} | [
"public",
"byte",
"[",
"]",
"keygen",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"inkey",
"[",
"]",
"=",
"new",
"byte",
"[",
"0x600",
"]",
";",
"new",
"SecureRandom",
"(",
")",
".",
"nextBytes",
"(",
"inkey",
")",
";",
"ByteArrayOutputStream",
"ba... | Generate a 2048 based Key from which we extract our code base
@return
@throws IOException | [
"Generate",
"a",
"2048",
"based",
"Key",
"from",
"which",
"we",
"extract",
"our",
"code",
"base"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L458-L464 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.obtain | public static Symm obtain(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
base64url.decode(is, baos);
} catch (IOException e) {
// don't give clue
throw new IOException("Invalid Key");
}
byte[] bkey = baos.toByteArray();
if(bkey.length<0... | java | public static Symm obtain(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
base64url.decode(is, baos);
} catch (IOException e) {
// don't give clue
throw new IOException("Invalid Key");
}
byte[] bkey = baos.toByteArray();
if(bkey.length<0... | [
"public",
"static",
"Symm",
"obtain",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"base64url",
".",
"decode",
"(",
"is",
",",
"baos",
")",
";",
... | Obtain a Symm from 2048 key from a Stream
@param is
@return
@throws IOException | [
"Obtain",
"a",
"Symm",
"from",
"2048",
"key",
"from",
"a",
"Stream"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L551-L564 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.obtain | public static Symm obtain(File f) throws IOException {
FileInputStream fis = new FileInputStream(f);
try {
return obtain(fis);
} finally {
fis.close();
}
} | java | public static Symm obtain(File f) throws IOException {
FileInputStream fis = new FileInputStream(f);
try {
return obtain(fis);
} finally {
fis.close();
}
} | [
"public",
"static",
"Symm",
"obtain",
"(",
"File",
"f",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"f",
")",
";",
"try",
"{",
"return",
"obtain",
"(",
"fis",
")",
";",
"}",
"finally",
"{",
"fis",
".... | Convenience for picking up Keyfile
@param f
@return
@throws IOException | [
"Convenience",
"for",
"picking",
"up",
"Keyfile"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L573-L580 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.enpass | public String enpass(String password) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
enpass(password,baos);
return new String(baos.toByteArray());
} | java | public String enpass(String password) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
enpass(password,baos);
return new String(baos.toByteArray());
} | [
"public",
"String",
"enpass",
"(",
"String",
"password",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"enpass",
"(",
"password",
",",
"baos",
")",
";",
"return",
"new",
"String",
"(",
... | Decrypt into a String
Convenience method
@param password
@return
@throws IOException | [
"Decrypt",
"into",
"a",
"String"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L590-L594 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.enpass | public void enpass(final String password, final OutputStream os) throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
byte[] bytes = password.getBytes();
if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose ... | java | public void enpass(final String password, final OutputStream os) throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
byte[] bytes = password.getBytes();
if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose ... | [
"public",
"void",
"enpass",
"(",
"final",
"String",
"password",
",",
"final",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"final",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"DataOutputStream",
"dos",
"=",
"... | Create an encrypted password, making sure that even short passwords have a minimum length.
@param password
@param os
@throws IOException | [
"Create",
"an",
"encrypted",
"password",
"making",
"sure",
"that",
"even",
"short",
"passwords",
"have",
"a",
"minimum",
"length",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L603-L654 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.depass | public String depass(String password) throws IOException {
if(password==null)return null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
depass(password,baos);
return new String(baos.toByteArray());
} | java | public String depass(String password) throws IOException {
if(password==null)return null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
depass(password,baos);
return new String(baos.toByteArray());
} | [
"public",
"String",
"depass",
"(",
"String",
"password",
")",
"throws",
"IOException",
"{",
"if",
"(",
"password",
"==",
"null",
")",
"return",
"null",
";",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"depass",
"(",
"... | Decrypt a password into a String
Convenience method
@param password
@return
@throws IOException | [
"Decrypt",
"a",
"password",
"into",
"a",
"String"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L665-L670 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.depass | public long depass(final String password, final OutputStream os) throws IOException {
int offset = password.startsWith(ENC)?4:0;
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ByteArrayInputStream bais = new ByteArrayInputStream(password.getBytes(),offset,password.length()-offset);
e... | java | public long depass(final String password, final OutputStream os) throws IOException {
int offset = password.startsWith(ENC)?4:0;
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ByteArrayInputStream bais = new ByteArrayInputStream(password.getBytes(),offset,password.length()-offset);
e... | [
"public",
"long",
"depass",
"(",
"final",
"String",
"password",
",",
"final",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"int",
"offset",
"=",
"password",
".",
"startsWith",
"(",
"ENC",
")",
"?",
"4",
":",
"0",
";",
"final",
"ByteArrayOutputS... | Decrypt a password
Skip Symm.ENC
@param password
@param os
@return
@throws IOException | [
"Decrypt",
"a",
"password"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L682-L723 | train |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.obtain | public Symm obtain(byte[] key) throws IOException {
try {
byte[] bytes = new byte[AES.AES_KEY_SIZE/8];
int offset = (Math.abs(key[(47%key.length)])+137)%(key.length-bytes.length);
for(int i=0;i<bytes.length;++i) {
bytes[i] = key[i+offset];
}
aes = new AES(bytes,0,bytes.length);
} catch (Exception ... | java | public Symm obtain(byte[] key) throws IOException {
try {
byte[] bytes = new byte[AES.AES_KEY_SIZE/8];
int offset = (Math.abs(key[(47%key.length)])+137)%(key.length-bytes.length);
for(int i=0;i<bytes.length;++i) {
bytes[i] = key[i+offset];
}
aes = new AES(bytes,0,bytes.length);
} catch (Exception ... | [
"public",
"Symm",
"obtain",
"(",
"byte",
"[",
"]",
"key",
")",
"throws",
"IOException",
"{",
"try",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"AES",
".",
"AES_KEY_SIZE",
"/",
"8",
"]",
";",
"int",
"offset",
"=",
"(",
"Math",
".",
"... | quick recreation when the official stream is actually obtained. | [
"quick",
"recreation",
"when",
"the",
"official",
"stream",
"is",
"actually",
"obtained",
"."
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L745-L791 | train |
att/AAF | authz/authz-service/src/main/java/com/att/authz/service/validation/Validator.java | Validator.nob | private boolean nob(String str, Pattern p) {
return str==null || !p.matcher(str).matches();
} | java | private boolean nob(String str, Pattern p) {
return str==null || !p.matcher(str).matches();
} | [
"private",
"boolean",
"nob",
"(",
"String",
"str",
",",
"Pattern",
"p",
")",
"{",
"return",
"str",
"==",
"null",
"||",
"!",
"p",
".",
"matcher",
"(",
"str",
")",
".",
"matches",
"(",
")",
";",
"}"
] | nob = Null Or Not match Pattern | [
"nob",
"=",
"Null",
"Or",
"Not",
"match",
"Pattern"
] | 090562e956c0035db972aafba844dc6d3fc948ee | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-service/src/main/java/com/att/authz/service/validation/Validator.java#L324-L326 | train |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/ElasticsearchBeyonder.java | ElasticsearchBeyonder.start | public static void start(RestClient client, String root, boolean merge, boolean force) throws Exception {
logger.info("starting automatic settings/mappings discovery");
// create templates
List<String> templateNames = TemplateFinder.findTemplates(root);
for (String templateName : templateNames) {
createTemp... | java | public static void start(RestClient client, String root, boolean merge, boolean force) throws Exception {
logger.info("starting automatic settings/mappings discovery");
// create templates
List<String> templateNames = TemplateFinder.findTemplates(root);
for (String templateName : templateNames) {
createTemp... | [
"public",
"static",
"void",
"start",
"(",
"RestClient",
"client",
",",
"String",
"root",
",",
"boolean",
"merge",
",",
"boolean",
"force",
")",
"throws",
"Exception",
"{",
"logger",
".",
"info",
"(",
"\"starting automatic settings/mappings discovery\"",
")",
";",
... | Automatically scan classpath and create indices, mappings, templates, and other settings.
@param client elasticsearch client
@param root dir within the classpath
@param merge whether or not to merge mappings
@param force whether or not to force creation of indices and templates
@throws Exception when beyonder can not s... | [
"Automatically",
"scan",
"classpath",
"and",
"create",
"indices",
"mappings",
"templates",
"and",
"other",
"settings",
"."
] | 275bf63432b97169a90a266e983143cca9ad7629 | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/ElasticsearchBeyonder.java#L103-L119 | train |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/index/IndexFinder.java | IndexFinder.findIndexNames | public static List<String> findIndexNames(final String root) throws IOException, URISyntaxException {
if (root == null) {
return findIndexNames();
}
logger.debug("Looking for indices in classpath under [{}].", root);
final List<String> indexNames = new ArrayList<>();
... | java | public static List<String> findIndexNames(final String root) throws IOException, URISyntaxException {
if (root == null) {
return findIndexNames();
}
logger.debug("Looking for indices in classpath under [{}].", root);
final List<String> indexNames = new ArrayList<>();
... | [
"public",
"static",
"List",
"<",
"String",
">",
"findIndexNames",
"(",
"final",
"String",
"root",
")",
"throws",
"IOException",
",",
"URISyntaxException",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"return",
"findIndexNames",
"(",
")",
";",
"}",
"logg... | Find all indices existing in a given classpath dir
@param root dir within the classpath
@return a list of indices
@throws IOException if connection with elasticsearch is failing
@throws URISyntaxException this should not happen | [
"Find",
"all",
"indices",
"existing",
"in",
"a",
"given",
"classpath",
"dir"
] | 275bf63432b97169a90a266e983143cca9ad7629 | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexFinder.java#L54-L82 | train |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/template/TemplateSettingsReader.java | TemplateSettingsReader.readTemplate | public static String readTemplate(String root, String template) throws IOException {
if (root == null) {
return readTemplate(template);
}
String settingsFile = root + "/" + Defaults.TemplateDir + "/" + template + Defaults.JsonFileExtension;
return readFileFromClasspath(settingsFile);
} | java | public static String readTemplate(String root, String template) throws IOException {
if (root == null) {
return readTemplate(template);
}
String settingsFile = root + "/" + Defaults.TemplateDir + "/" + template + Defaults.JsonFileExtension;
return readFileFromClasspath(settingsFile);
} | [
"public",
"static",
"String",
"readTemplate",
"(",
"String",
"root",
",",
"String",
"template",
")",
"throws",
"IOException",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"return",
"readTemplate",
"(",
"template",
")",
";",
"}",
"String",
"settingsFile",
... | Read a template
@param root dir within the classpath
@param template template name (.json will be appended)
@return The template content
@throws IOException if the connection with elasticsearch is failing | [
"Read",
"a",
"template"
] | 275bf63432b97169a90a266e983143cca9ad7629 | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateSettingsReader.java#L44-L50 | train |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java | TemplateElasticsearchUpdater.createTemplate | @Deprecated
public static void createTemplate(Client client, String root, String template, boolean force) throws Exception {
String json = TemplateSettingsReader.readTemplate(root, template);
createTemplateWithJson(client, template, json, force);
} | java | @Deprecated
public static void createTemplate(Client client, String root, String template, boolean force) throws Exception {
String json = TemplateSettingsReader.readTemplate(root, template);
createTemplateWithJson(client, template, json, force);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"createTemplate",
"(",
"Client",
"client",
",",
"String",
"root",
",",
"String",
"template",
",",
"boolean",
"force",
")",
"throws",
"Exception",
"{",
"String",
"json",
"=",
"TemplateSettingsReader",
".",
"readTempl... | Create a template in Elasticsearch.
@param client Elasticsearch client
@param root dir within the classpath
@param template Template name
@param force set it to true if you want to force cleaning template before adding it
@throws Exception if something goes wrong
@deprecated Will be removed when we don't support Transp... | [
"Create",
"a",
"template",
"in",
"Elasticsearch",
"."
] | 275bf63432b97169a90a266e983143cca9ad7629 | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L50-L54 | train |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java | TemplateElasticsearchUpdater.createTemplate | public static void createTemplate(RestClient client, String template, boolean force) throws Exception {
String json = TemplateSettingsReader.readTemplate(template);
createTemplateWithJson(client, template, json, force);
} | java | public static void createTemplate(RestClient client, String template, boolean force) throws Exception {
String json = TemplateSettingsReader.readTemplate(template);
createTemplateWithJson(client, template, json, force);
} | [
"public",
"static",
"void",
"createTemplate",
"(",
"RestClient",
"client",
",",
"String",
"template",
",",
"boolean",
"force",
")",
"throws",
"Exception",
"{",
"String",
"json",
"=",
"TemplateSettingsReader",
".",
"readTemplate",
"(",
"template",
")",
";",
"crea... | Create a template in Elasticsearch. Read read content from default classpath dir.
@param client Elasticsearch client
@param template Template name
@param force set it to true if you want to force cleaning template before adding it
@throws Exception if something goes wrong | [
"Create",
"a",
"template",
"in",
"Elasticsearch",
".",
"Read",
"read",
"content",
"from",
"default",
"classpath",
"dir",
"."
] | 275bf63432b97169a90a266e983143cca9ad7629 | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L169-L172 | train |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java | TemplateElasticsearchUpdater.createTemplateWithJson | public static void createTemplateWithJson(RestClient client, String template, String json, boolean force) throws Exception {
if (isTemplateExist(client, template)) {
if (force) {
logger.debug("Template [{}] already exists. Force is set. Removing it.", template);
removeTemplate(client, template);
} else ... | java | public static void createTemplateWithJson(RestClient client, String template, String json, boolean force) throws Exception {
if (isTemplateExist(client, template)) {
if (force) {
logger.debug("Template [{}] already exists. Force is set. Removing it.", template);
removeTemplate(client, template);
} else ... | [
"public",
"static",
"void",
"createTemplateWithJson",
"(",
"RestClient",
"client",
",",
"String",
"template",
",",
"String",
"json",
",",
"boolean",
"force",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isTemplateExist",
"(",
"client",
",",
"template",
")",
")... | Create a new template in Elasticsearch
@param client Elasticsearch client
@param template Template name
@param json JSon content for the template
@param force set it to true if you want to force cleaning template before adding it
@throws Exception if something goes wrong | [
"Create",
"a",
"new",
"template",
"in",
"Elasticsearch"
] | 275bf63432b97169a90a266e983143cca9ad7629 | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L182-L196 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.