id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
135,400
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java
RaXmlGen.writeConfigPropsXml
void writeConfigPropsXml(List<ConfigPropType> props, Writer out, int indent) throws IOException { if (props == null || props.size() == 0) return; for (ConfigPropType prop : props) { writeIndent(out, indent); out.write("<config-property>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-name>" + prop.getName() + "</config-property-name>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-type>java.lang." + prop.getType() + "</config-property-type>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-value>" + prop.getValue() + "</config-property-value>"); writeEol(out); writeIndent(out, indent); out.write("</config-property>"); writeEol(out); writeEol(out); } }
java
void writeConfigPropsXml(List<ConfigPropType> props, Writer out, int indent) throws IOException { if (props == null || props.size() == 0) return; for (ConfigPropType prop : props) { writeIndent(out, indent); out.write("<config-property>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-name>" + prop.getName() + "</config-property-name>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-type>java.lang." + prop.getType() + "</config-property-type>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-value>" + prop.getValue() + "</config-property-value>"); writeEol(out); writeIndent(out, indent); out.write("</config-property>"); writeEol(out); writeEol(out); } }
[ "void", "writeConfigPropsXml", "(", "List", "<", "ConfigPropType", ">", "props", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "if", "(", "props", "==", "null", "||", "props", ".", "size", "(", ")", "==", "0", ")", "ret...
Output config props xml part @param props config properties @param out Writer @param indent space number @throws IOException ioException
[ "Output", "config", "props", "xml", "part" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java#L166-L191
135,401
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java
RaXmlGen.writeRequireConfigPropsXml
void writeRequireConfigPropsXml(List<ConfigPropType> props, Writer out, int indent) throws IOException { if (props == null || props.size() == 0) return; for (ConfigPropType prop : props) { if (prop.isRequired()) { writeIndent(out, indent); out.write("<required-config-property>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-name>" + prop.getName() + "</config-property-name>"); writeEol(out); writeIndent(out, indent); out.write("</required-config-property>"); writeEol(out); } } writeEol(out); }
java
void writeRequireConfigPropsXml(List<ConfigPropType> props, Writer out, int indent) throws IOException { if (props == null || props.size() == 0) return; for (ConfigPropType prop : props) { if (prop.isRequired()) { writeIndent(out, indent); out.write("<required-config-property>"); writeEol(out); writeIndent(out, indent + 1); out.write("<config-property-name>" + prop.getName() + "</config-property-name>"); writeEol(out); writeIndent(out, indent); out.write("</required-config-property>"); writeEol(out); } } writeEol(out); }
[ "void", "writeRequireConfigPropsXml", "(", "List", "<", "ConfigPropType", ">", "props", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "if", "(", "props", "==", "null", "||", "props", ".", "size", "(", ")", "==", "0", ")",...
Output required config props xml part @param props config properties @param out Writer @param indent space number @throws IOException ioException
[ "Output", "required", "config", "props", "xml", "part" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java#L211-L233
135,402
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java
RaXmlGen.writeInbound
private void writeInbound(Definition def, Writer out, int indent) throws IOException { writeIndent(out, indent); out.write("<inbound-resourceadapter>"); writeEol(out); writeIndent(out, indent + 1); out.write("<messageadapter>"); writeEol(out); writeIndent(out, indent + 2); out.write("<messagelistener>"); writeEol(out); writeIndent(out, indent + 3); if (!def.isDefaultPackageInbound()) { out.write("<messagelistener-type>" + def.getMlClass() + "</messagelistener-type>"); } else { out.write("<messagelistener-type>" + def.getRaPackage() + ".inflow." + def.getMlClass() + "</messagelistener-type>"); } writeEol(out); writeIndent(out, indent + 3); out.write("<activationspec>"); writeEol(out); writeIndent(out, indent + 4); out.write("<activationspec-class>" + def.getRaPackage() + ".inflow." + def.getAsClass() + "</activationspec-class>"); writeEol(out); writeAsConfigPropsXml(def.getAsConfigProps(), out, indent + 4); writeIndent(out, indent + 3); out.write("</activationspec>"); writeEol(out); writeIndent(out, indent + 2); out.write("</messagelistener>"); writeEol(out); writeIndent(out, indent + 1); out.write("</messageadapter>"); writeEol(out); writeIndent(out, indent); out.write("</inbound-resourceadapter>"); writeEol(out); }
java
private void writeInbound(Definition def, Writer out, int indent) throws IOException { writeIndent(out, indent); out.write("<inbound-resourceadapter>"); writeEol(out); writeIndent(out, indent + 1); out.write("<messageadapter>"); writeEol(out); writeIndent(out, indent + 2); out.write("<messagelistener>"); writeEol(out); writeIndent(out, indent + 3); if (!def.isDefaultPackageInbound()) { out.write("<messagelistener-type>" + def.getMlClass() + "</messagelistener-type>"); } else { out.write("<messagelistener-type>" + def.getRaPackage() + ".inflow." + def.getMlClass() + "</messagelistener-type>"); } writeEol(out); writeIndent(out, indent + 3); out.write("<activationspec>"); writeEol(out); writeIndent(out, indent + 4); out.write("<activationspec-class>" + def.getRaPackage() + ".inflow." + def.getAsClass() + "</activationspec-class>"); writeEol(out); writeAsConfigPropsXml(def.getAsConfigProps(), out, indent + 4); writeIndent(out, indent + 3); out.write("</activationspec>"); writeEol(out); writeIndent(out, indent + 2); out.write("</messagelistener>"); writeEol(out); writeIndent(out, indent + 1); out.write("</messageadapter>"); writeEol(out); writeIndent(out, indent); out.write("</inbound-resourceadapter>"); writeEol(out); }
[ "private", "void", "writeInbound", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeIndent", "(", "out", ",", "indent", ")", ";", "out", ".", "write", "(", "\"<inbound-resourceadapter>\"", ")", ";...
Output inbound xml part @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "inbound", "xml", "part" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java#L243-L286
135,403
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java
Main.main
public static void main(String[] args) { String outputDir = "out"; //default output directory String defxml = null; int arg = 0; if (args.length > 0) { while (args.length > arg + 1) { if (args[arg].startsWith("-")) { if (args[arg].equals("-o")) { arg++; if (arg >= args.length) { usage(); System.exit(OTHER); } outputDir = args[arg]; } else if (args[arg].equals("-f")) { arg++; if (arg >= args.length) { usage(); System.exit(OTHER); } defxml = args[arg]; } } else { usage(); System.exit(OTHER); } arg++; } } try { File out = new File(outputDir); Utils.recursiveDelete(out); Definition def; if (defxml == null) def = inputFromCommandLine(); else def = inputFromXml(defxml); if (def == null) System.exit(ERROR); def.setOutputDir(outputDir); Profile profile; switch (def.getVersion()) { case "1.7": profile = new JCA17Profile(); break; case "1.6": profile = new JCA16Profile(); break; case "1.5": profile = new JCA15Profile(); break; default: profile = new JCA10Profile(); break; } profile.generate(def); if (def.getBuild().equals("ant")) copyAllJars(outputDir); System.out.println(rb.getString("code.wrote")); System.exit(SUCCESS); } catch (IOException | JAXBException e) { e.printStackTrace(); } }
java
public static void main(String[] args) { String outputDir = "out"; //default output directory String defxml = null; int arg = 0; if (args.length > 0) { while (args.length > arg + 1) { if (args[arg].startsWith("-")) { if (args[arg].equals("-o")) { arg++; if (arg >= args.length) { usage(); System.exit(OTHER); } outputDir = args[arg]; } else if (args[arg].equals("-f")) { arg++; if (arg >= args.length) { usage(); System.exit(OTHER); } defxml = args[arg]; } } else { usage(); System.exit(OTHER); } arg++; } } try { File out = new File(outputDir); Utils.recursiveDelete(out); Definition def; if (defxml == null) def = inputFromCommandLine(); else def = inputFromXml(defxml); if (def == null) System.exit(ERROR); def.setOutputDir(outputDir); Profile profile; switch (def.getVersion()) { case "1.7": profile = new JCA17Profile(); break; case "1.6": profile = new JCA16Profile(); break; case "1.5": profile = new JCA15Profile(); break; default: profile = new JCA10Profile(); break; } profile.generate(def); if (def.getBuild().equals("ant")) copyAllJars(outputDir); System.out.println(rb.getString("code.wrote")); System.exit(SUCCESS); } catch (IOException | JAXBException e) { e.printStackTrace(); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "String", "outputDir", "=", "\"out\"", ";", "//default output directory", "String", "defxml", "=", "null", ";", "int", "arg", "=", "0", ";", "if", "(", "args", ".", "length", ...
Code generator stand alone tool @param args command line arguments
[ "Code", "generator", "stand", "alone", "tool" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java#L65-L151
135,404
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java
Main.inputFromXml
private static Definition inputFromXml(String defxml) throws IOException, JAXBException { JAXBContext context = JAXBContext.newInstance("org.ironjacamar.codegenerator"); Unmarshaller unmarshaller = context.createUnmarshaller(); return (Definition) unmarshaller.unmarshal(new File(defxml)); }
java
private static Definition inputFromXml(String defxml) throws IOException, JAXBException { JAXBContext context = JAXBContext.newInstance("org.ironjacamar.codegenerator"); Unmarshaller unmarshaller = context.createUnmarshaller(); return (Definition) unmarshaller.unmarshal(new File(defxml)); }
[ "private", "static", "Definition", "inputFromXml", "(", "String", "defxml", ")", "throws", "IOException", ",", "JAXBException", "{", "JAXBContext", "context", "=", "JAXBContext", ".", "newInstance", "(", "\"org.ironjacamar.codegenerator\"", ")", ";", "Unmarshaller", "...
input from xml file @param defxml definition xml file @return Definition definition from input @throws IOException ioException @throws JAXBException jaxb exception
[ "input", "from", "xml", "file" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java#L161-L167
135,405
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java
Main.setDefaultValue
private static void setDefaultValue(Definition def, String className, String stringValue) { if (className.endsWith(stringValue)) def.setDefaultValue(className.substring(0, className.length() - stringValue.length())); }
java
private static void setDefaultValue(Definition def, String className, String stringValue) { if (className.endsWith(stringValue)) def.setDefaultValue(className.substring(0, className.length() - stringValue.length())); }
[ "private", "static", "void", "setDefaultValue", "(", "Definition", "def", ",", "String", "className", ",", "String", "stringValue", ")", "{", "if", "(", "className", ".", "endsWith", "(", "stringValue", ")", ")", "def", ".", "setDefaultValue", "(", "className"...
check defalut value and set it @param def definition @param className the class name @param stringValue post-fix string
[ "check", "defalut", "value", "and", "set", "it" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java#L788-L792
135,406
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java
Main.copyAllJars
private static void copyAllJars(String outputDir) throws IOException { File out = new File(outputDir); String targetPath = out.getAbsolutePath() + File.separatorChar + "lib"; File current = new File("."); String path = current.getCanonicalPath(); String libPath = path + File.separatorChar + ".." + File.separatorChar + ".." + File.separatorChar + "lib"; Utils.copyFolder(libPath, targetPath, "jar", false); }
java
private static void copyAllJars(String outputDir) throws IOException { File out = new File(outputDir); String targetPath = out.getAbsolutePath() + File.separatorChar + "lib"; File current = new File("."); String path = current.getCanonicalPath(); String libPath = path + File.separatorChar + ".." + File.separatorChar + ".." + File.separatorChar + "lib"; Utils.copyFolder(libPath, targetPath, "jar", false); }
[ "private", "static", "void", "copyAllJars", "(", "String", "outputDir", ")", "throws", "IOException", "{", "File", "out", "=", "new", "File", "(", "outputDir", ")", ";", "String", "targetPath", "=", "out", ".", "getAbsolutePath", "(", ")", "+", "File", "."...
copy all jars @param outputDir output directory @throws IOException ioException
[ "copy", "all", "jars" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java#L800-L812
135,407
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.loadProperties
private static Properties loadProperties() { Properties properties = new Properties(); boolean loaded = false; String sysProperty = SecurityActions.getSystemProperty("ironjacamar.options"); if (sysProperty != null && !sysProperty.equals("")) { File file = new File(sysProperty); if (file.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(file); properties.load(fis); loaded = true; } catch (Throwable t) { // Ignore } finally { if (fis != null) { try { fis.close(); } catch (IOException ioe) { //No op } } } } } if (!loaded) { File file = new File(IRONJACAMAR_PROPERTIES); if (file.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(file); properties.load(fis); loaded = true; } catch (Throwable t) { // Ignore } finally { if (fis != null) { try { fis.close(); } catch (IOException ioe) { //No op } } } } } if (!loaded) { InputStream is = null; try { ClassLoader cl = Main.class.getClassLoader(); is = cl.getResourceAsStream(IRONJACAMAR_PROPERTIES); properties.load(is); loaded = true; } catch (Throwable t) { // Ignore } finally { if (is != null) { try { is.close(); } catch (IOException ioe) { // Nothing to do } } } } return properties; }
java
private static Properties loadProperties() { Properties properties = new Properties(); boolean loaded = false; String sysProperty = SecurityActions.getSystemProperty("ironjacamar.options"); if (sysProperty != null && !sysProperty.equals("")) { File file = new File(sysProperty); if (file.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(file); properties.load(fis); loaded = true; } catch (Throwable t) { // Ignore } finally { if (fis != null) { try { fis.close(); } catch (IOException ioe) { //No op } } } } } if (!loaded) { File file = new File(IRONJACAMAR_PROPERTIES); if (file.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(file); properties.load(fis); loaded = true; } catch (Throwable t) { // Ignore } finally { if (fis != null) { try { fis.close(); } catch (IOException ioe) { //No op } } } } } if (!loaded) { InputStream is = null; try { ClassLoader cl = Main.class.getClassLoader(); is = cl.getResourceAsStream(IRONJACAMAR_PROPERTIES); properties.load(is); loaded = true; } catch (Throwable t) { // Ignore } finally { if (is != null) { try { is.close(); } catch (IOException ioe) { // Nothing to do } } } } return properties; }
[ "private", "static", "Properties", "loadProperties", "(", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "boolean", "loaded", "=", "false", ";", "String", "sysProperty", "=", "SecurityActions", ".", "getSystemProperty", "(", "\"ir...
Load configuration values specified from either a file or the classloader @return The properties
[ "Load", "configuration", "values", "specified", "from", "either", "a", "file", "or", "the", "classloader" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L316-L419
135,408
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.configurationString
private static String configurationString(Properties properties, String key, String defaultValue) { if (properties != null) { return properties.getProperty(key, defaultValue); } return defaultValue; }
java
private static String configurationString(Properties properties, String key, String defaultValue) { if (properties != null) { return properties.getProperty(key, defaultValue); } return defaultValue; }
[ "private", "static", "String", "configurationString", "(", "Properties", "properties", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "return", "properties", ".", "getProperty", "(", "key", ",", ...
Get configuration string @param properties The properties @param key The key @param defaultValue The default value @return The value
[ "Get", "configuration", "string" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L428-L436
135,409
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.configurationBoolean
private static boolean configurationBoolean(Properties properties, String key, boolean defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Boolean.valueOf(properties.getProperty(key)); } return defaultValue; }
java
private static boolean configurationBoolean(Properties properties, String key, boolean defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Boolean.valueOf(properties.getProperty(key)); } return defaultValue; }
[ "private", "static", "boolean", "configurationBoolean", "(", "Properties", "properties", ",", "String", "key", ",", "boolean", "defaultValue", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "if", "(", "properties", ".", "containsKey", "(", "key", ...
Get configuration boolean @param properties The properties @param key The key @param defaultValue The default value @return The value
[ "Get", "configuration", "boolean" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L445-L454
135,410
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.configurationInteger
private static int configurationInteger(Properties properties, String key, int defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Integer.valueOf(properties.getProperty(key)); } return defaultValue; }
java
private static int configurationInteger(Properties properties, String key, int defaultValue) { if (properties != null) { if (properties.containsKey(key)) return Integer.valueOf(properties.getProperty(key)); } return defaultValue; }
[ "private", "static", "int", "configurationInteger", "(", "Properties", "properties", ",", "String", "key", ",", "int", "defaultValue", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "if", "(", "properties", ".", "containsKey", "(", "key", ")", ...
Get configuration integer @param properties The properties @param key The key @param defaultValue The default value @return The value
[ "Get", "configuration", "integer" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L463-L472
135,411
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.applySystemProperties
private static void applySystemProperties(Properties properties) { if (properties != null) { for (Map.Entry<Object, Object> entry : properties.entrySet()) { String key = (String)entry.getKey(); if (key.startsWith("system.property.")) { key = key.substring(16); SecurityActions.setSystemProperty(key, (String)entry.getValue()); } } } }
java
private static void applySystemProperties(Properties properties) { if (properties != null) { for (Map.Entry<Object, Object> entry : properties.entrySet()) { String key = (String)entry.getKey(); if (key.startsWith("system.property.")) { key = key.substring(16); SecurityActions.setSystemProperty(key, (String)entry.getValue()); } } } }
[ "private", "static", "void", "applySystemProperties", "(", "Properties", "properties", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "properties", ".", "entrySet...
Apply any defined system properties @param properties The properties
[ "Apply", "any", "defined", "system", "properties" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L478-L492
135,412
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkClassLoader.java
WorkClassLoader.setResourceAdapterClassLoader
public void setResourceAdapterClassLoader(ResourceAdapterClassLoader v) { if (trace) log.tracef("%s: setResourceAdapterClassLoader(%s)", Integer.toHexString(System.identityHashCode(this)), v); resourceAdapterClassLoader = v; }
java
public void setResourceAdapterClassLoader(ResourceAdapterClassLoader v) { if (trace) log.tracef("%s: setResourceAdapterClassLoader(%s)", Integer.toHexString(System.identityHashCode(this)), v); resourceAdapterClassLoader = v; }
[ "public", "void", "setResourceAdapterClassLoader", "(", "ResourceAdapterClassLoader", "v", ")", "{", "if", "(", "trace", ")", "log", ".", "tracef", "(", "\"%s: setResourceAdapterClassLoader(%s)\"", ",", "Integer", ".", "toHexString", "(", "System", ".", "identityHashC...
Set the resource adapter class loader @param v The value
[ "Set", "the", "resource", "adapter", "class", "loader" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkClassLoader.java#L95-L101
135,413
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/naming/Util.java
Util.bind
private static void bind(Context ctx, Name name, Object value) throws NamingException { int size = name.size(); String atom = name.get(size - 1); Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1)); parentCtx.bind(atom, value); }
java
private static void bind(Context ctx, Name name, Object value) throws NamingException { int size = name.size(); String atom = name.get(size - 1); Context parentCtx = createSubcontext(ctx, name.getPrefix(size - 1)); parentCtx.bind(atom, value); }
[ "private", "static", "void", "bind", "(", "Context", "ctx", ",", "Name", "name", ",", "Object", "value", ")", "throws", "NamingException", "{", "int", "size", "=", "name", ".", "size", "(", ")", ";", "String", "atom", "=", "name", ".", "get", "(", "s...
Bind val to name in ctx, and make sure that all intermediate contexts exist @param ctx the parent JNDI Context under which value will be bound @param name the name relative to ctx where value will be bound @param value the value to bind. @throws NamingException for any error
[ "Bind", "val", "to", "name", "in", "ctx", "and", "make", "sure", "that", "all", "intermediate", "contexts", "exist" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/naming/Util.java#L89-L95
135,414
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tx/noopts/TxRegistry.java
TxRegistry.startTransaction
public void startTransaction() { Long key = Long.valueOf(Thread.currentThread().getId()); TransactionImpl tx = txs.get(key); if (tx == null) { TransactionImpl newTx = new TransactionImpl(key); tx = txs.putIfAbsent(key, newTx); if (tx == null) tx = newTx; } tx.active(); }
java
public void startTransaction() { Long key = Long.valueOf(Thread.currentThread().getId()); TransactionImpl tx = txs.get(key); if (tx == null) { TransactionImpl newTx = new TransactionImpl(key); tx = txs.putIfAbsent(key, newTx); if (tx == null) tx = newTx; } tx.active(); }
[ "public", "void", "startTransaction", "(", ")", "{", "Long", "key", "=", "Long", ".", "valueOf", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ")", ";", "TransactionImpl", "tx", "=", "txs", ".", "get", "(", "key", ")", ";", ...
Start a transaction
[ "Start", "a", "transaction" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/noopts/TxRegistry.java#L59-L73
135,415
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tx/noopts/TxRegistry.java
TxRegistry.commitTransaction
public void commitTransaction() throws SystemException { Long key = Long.valueOf(Thread.currentThread().getId()); TransactionImpl tx = txs.get(key); if (tx != null) { try { tx.commit(); } catch (Throwable t) { SystemException se = new SystemException("Error during commit"); se.initCause(t); throw se; } } else { throw new IllegalStateException("No transaction to commit"); } }
java
public void commitTransaction() throws SystemException { Long key = Long.valueOf(Thread.currentThread().getId()); TransactionImpl tx = txs.get(key); if (tx != null) { try { tx.commit(); } catch (Throwable t) { SystemException se = new SystemException("Error during commit"); se.initCause(t); throw se; } } else { throw new IllegalStateException("No transaction to commit"); } }
[ "public", "void", "commitTransaction", "(", ")", "throws", "SystemException", "{", "Long", "key", "=", "Long", ".", "valueOf", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ")", ";", "TransactionImpl", "tx", "=", "txs", ".", "get...
Commit a transaction @exception SystemException Thrown if an error occurs
[ "Commit", "a", "transaction" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/noopts/TxRegistry.java#L79-L100
135,416
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tx/noopts/TxRegistry.java
TxRegistry.assignTransaction
public void assignTransaction(TransactionImpl v) { txs.put(Long.valueOf(Thread.currentThread().getId()), v); }
java
public void assignTransaction(TransactionImpl v) { txs.put(Long.valueOf(Thread.currentThread().getId()), v); }
[ "public", "void", "assignTransaction", "(", "TransactionImpl", "v", ")", "{", "txs", ".", "put", "(", "Long", ".", "valueOf", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ")", ",", "v", ")", ";", "}" ]
Assign a transaction @param v The value
[ "Assign", "a", "transaction" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tx/noopts/TxRegistry.java#L133-L136
135,417
ironjacamar/ironjacamar
validator/src/main/java/org/ironjacamar/validator/maven/SecurityActions.java
SecurityActions.getClassLoader
public static ClassLoader getClassLoader(final Class<?> c) { if (System.getSecurityManager() == null) return c.getClassLoader(); return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { return c.getClassLoader(); } }); }
java
public static ClassLoader getClassLoader(final Class<?> c) { if (System.getSecurityManager() == null) return c.getClassLoader(); return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { return c.getClassLoader(); } }); }
[ "public", "static", "ClassLoader", "getClassLoader", "(", "final", "Class", "<", "?", ">", "c", ")", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "return", "c", ".", "getClassLoader", "(", ")", ";", "return", "AccessC...
Get the classloader. @param c The class @return The classloader
[ "Get", "the", "classloader", "." ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/validator/src/main/java/org/ironjacamar/validator/maven/SecurityActions.java#L38-L50
135,418
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java
StringUtils.restoreExpression
public static String restoreExpression(Map<String, String> m, String key, String subkey, String v) { String k = key; if (subkey != null) { if (!isIncorrectExpression(subkey) && subkey.startsWith("${")) { subkey = subkey.substring(2, subkey.length() - 1); if (subkey.indexOf(":") != -1) subkey = subkey.substring(0, subkey.indexOf(":")); } k += "|" + subkey; } return substituteValueInExpression(m.get(k), v); }
java
public static String restoreExpression(Map<String, String> m, String key, String subkey, String v) { String k = key; if (subkey != null) { if (!isIncorrectExpression(subkey) && subkey.startsWith("${")) { subkey = subkey.substring(2, subkey.length() - 1); if (subkey.indexOf(":") != -1) subkey = subkey.substring(0, subkey.indexOf(":")); } k += "|" + subkey; } return substituteValueInExpression(m.get(k), v); }
[ "public", "static", "String", "restoreExpression", "(", "Map", "<", "String", ",", "String", ">", "m", ",", "String", "key", ",", "String", "subkey", ",", "String", "v", ")", "{", "String", "k", "=", "key", ";", "if", "(", "subkey", "!=", "null", ")"...
Restores expression with substituted default value @param m a Map with expressions @param key of the Map @param subkey of the Map @param v value for substitution @return restored expression string
[ "Restores", "expression", "with", "substituted", "default", "value" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java#L46-L65
135,419
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java
StringUtils.substituteValueInExpression
public static String substituteValueInExpression(String expression, String newValue) { ExpressionTemplate t = new ExpressionTemplate(expression); if (newValue != null && (getExpressionKey(t.getTemplate()) == null || (t.isComplex() && !newValue.equals(t.getValue())))) return newValue; String result = t.getSubstitution(); if (!t.isComplex() && newValue != null) { int start = result.lastIndexOf(":$"); start = result.indexOf(":", start + 1); int end = result.indexOf("}", start + 1); if (start < 0 || end < 0 || start == result.lastIndexOf("${:}") + 2) return result; result = result.substring(0, start + 1) + newValue + result.substring(end); } return result; }
java
public static String substituteValueInExpression(String expression, String newValue) { ExpressionTemplate t = new ExpressionTemplate(expression); if (newValue != null && (getExpressionKey(t.getTemplate()) == null || (t.isComplex() && !newValue.equals(t.getValue())))) return newValue; String result = t.getSubstitution(); if (!t.isComplex() && newValue != null) { int start = result.lastIndexOf(":$"); start = result.indexOf(":", start + 1); int end = result.indexOf("}", start + 1); if (start < 0 || end < 0 || start == result.lastIndexOf("${:}") + 2) return result; result = result.substring(0, start + 1) + newValue + result.substring(end); } return result; }
[ "public", "static", "String", "substituteValueInExpression", "(", "String", "expression", ",", "String", "newValue", ")", "{", "ExpressionTemplate", "t", "=", "new", "ExpressionTemplate", "(", "expression", ")", ";", "if", "(", "newValue", "!=", "null", "&&", "(...
Substitutes a default value in expression by a new one @param expression to check @param newValue to substitute @return resulting expression
[ "Substitutes", "a", "default", "value", "in", "expression", "by", "a", "new", "one" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java#L73-L93
135,420
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java
StringUtils.getExpressionKey
public static String getExpressionKey(String result) { if (result == null) return null; try { int from = result.indexOf(startTag); int to = result.indexOf(endTag, from); Integer.parseInt(result.substring(from + 5, to)); return result.substring(from, to + 5); } catch (Exception e) { return null; } }
java
public static String getExpressionKey(String result) { if (result == null) return null; try { int from = result.indexOf(startTag); int to = result.indexOf(endTag, from); Integer.parseInt(result.substring(from + 5, to)); return result.substring(from, to + 5); } catch (Exception e) { return null; } }
[ "public", "static", "String", "getExpressionKey", "(", "String", "result", ")", "{", "if", "(", "result", "==", "null", ")", "return", "null", ";", "try", "{", "int", "from", "=", "result", ".", "indexOf", "(", "startTag", ")", ";", "int", "to", "=", ...
Get an entities map key from the string @param result the string where to find the key @return the key or null if nothing was found
[ "Get", "an", "entities", "map", "key", "from", "the", "string" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java#L140-L155
135,421
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java
RaCodeGen.writeXAResource
private void writeXAResource(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This method is called by the application server during crash recovery.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param specs An array of ActivationSpec JavaBeans \n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " * @return An array of XAResource objects\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource[] getXAResources(ActivationSpec[] specs)\n"); writeWithIndent(out, indent + 1, "throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getXAResources", "specs.toString()"); writeWithIndent(out, indent + 1, "return null;"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeXAResource(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This method is called by the application server during crash recovery.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param specs An array of ActivationSpec JavaBeans \n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " * @return An array of XAResource objects\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource[] getXAResources(ActivationSpec[] specs)\n"); writeWithIndent(out, indent + 1, "throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getXAResources", "specs.toString()"); writeWithIndent(out, indent + 1, "return null;"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeXAResource", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "ind...
Output getXAResources method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "getXAResources", "method" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java#L223-L240
135,422
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java
RaCodeGen.writeEndpointLifecycle
private void writeEndpointLifecycle(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called during the activation of a message endpoint.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointActivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec) throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = new " + def.getActivationClass() + "(this, endpointFactory, (" + def.getAsClass() + ")spec);\n"); writeWithIndent(out, indent + 1, "activations.put((" + def.getAsClass() + ")spec, activation);\n"); writeWithIndent(out, indent + 1, "activation.start();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointActivation", "endpointFactory", "spec"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called when a message endpoint is deactivated. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointDeactivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec)"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = activations.remove(spec);\n"); writeWithIndent(out, indent + 1, "if (activation != null)\n"); writeWithIndent(out, indent + 2, "activation.stop();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointDeactivation", "endpointFactory"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeEndpointLifecycle(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called during the activation of a message endpoint.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointActivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec) throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = new " + def.getActivationClass() + "(this, endpointFactory, (" + def.getAsClass() + ")spec);\n"); writeWithIndent(out, indent + 1, "activations.put((" + def.getAsClass() + ")spec, activation);\n"); writeWithIndent(out, indent + 1, "activation.start();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointActivation", "endpointFactory", "spec"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called when a message endpoint is deactivated. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointDeactivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec)"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = activations.remove(spec);\n"); writeWithIndent(out, indent + 1, "if (activation != null)\n"); writeWithIndent(out, indent + 2, "activation.stop();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointDeactivation", "endpointFactory"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeEndpointLifecycle", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",",...
Output EndpointLifecycle method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "EndpointLifecycle", "method" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java#L286-L334
135,423
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java
ActivationCodeGen.writeGetAs
private void writeGetAs(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get activation spec class\n"); writeWithIndent(out, indent, " * @return Activation spec\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + def.getAsClass() + " getActivationSpec()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return spec;"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeGetAs(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get activation spec class\n"); writeWithIndent(out, indent, " * @return Activation spec\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + def.getAsClass() + " getActivationSpec()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return spec;"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeGetAs", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent",...
Output get activation spec method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "get", "activation", "spec", "method" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java#L136-L149
135,424
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java
ActivationCodeGen.writeMef
private void writeMef(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get message endpoint factory\n"); writeWithIndent(out, indent, " * @return Message endpoint factory\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public MessageEndpointFactory getMessageEndpointFactory()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return endpointFactory;"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeMef(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Get message endpoint factory\n"); writeWithIndent(out, indent, " * @return Message endpoint factory\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public MessageEndpointFactory getMessageEndpointFactory()"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return endpointFactory;"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeMef", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ...
Output message endpoint factory method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "message", "endpoint", "factory", "method" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java#L159-L172
135,425
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java
WorkManagerCoordinator.unregisterWorkManager
public void unregisterWorkManager(WorkManager wm) { if (wm != null) { if (wm.getName() == null || wm.getName().trim().equals("")) throw new IllegalArgumentException("The name of WorkManager is invalid: " + wm); if (trace) log.tracef("Unregistering WorkManager: %s", wm); if (workmanagers.keySet().contains(wm.getName())) { workmanagers.remove(wm.getName()); // Clear any events if (wm instanceof DistributedWorkManager) { WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance(); List<WorkManagerEvent> events = wmeq.getEvents(wm.getName()); events.clear(); } } } }
java
public void unregisterWorkManager(WorkManager wm) { if (wm != null) { if (wm.getName() == null || wm.getName().trim().equals("")) throw new IllegalArgumentException("The name of WorkManager is invalid: " + wm); if (trace) log.tracef("Unregistering WorkManager: %s", wm); if (workmanagers.keySet().contains(wm.getName())) { workmanagers.remove(wm.getName()); // Clear any events if (wm instanceof DistributedWorkManager) { WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance(); List<WorkManagerEvent> events = wmeq.getEvents(wm.getName()); events.clear(); } } } }
[ "public", "void", "unregisterWorkManager", "(", "WorkManager", "wm", ")", "{", "if", "(", "wm", "!=", "null", ")", "{", "if", "(", "wm", ".", "getName", "(", ")", "==", "null", "||", "wm", ".", "getName", "(", ")", ".", "trim", "(", ")", ".", "eq...
Unregister work manager @param wm The work manager
[ "Unregister", "work", "manager" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java#L182-L205
135,426
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java
WorkManagerCoordinator.setDefaultWorkManager
public void setDefaultWorkManager(WorkManager wm) { if (trace) log.tracef("Default WorkManager: %s", wm); String currentName = null; if (defaultWorkManager != null) currentName = defaultWorkManager.getName(); defaultWorkManager = wm; if (wm != null) { workmanagers.put(wm.getName(), wm); } else if (currentName != null) { workmanagers.remove(currentName); } }
java
public void setDefaultWorkManager(WorkManager wm) { if (trace) log.tracef("Default WorkManager: %s", wm); String currentName = null; if (defaultWorkManager != null) currentName = defaultWorkManager.getName(); defaultWorkManager = wm; if (wm != null) { workmanagers.put(wm.getName(), wm); } else if (currentName != null) { workmanagers.remove(currentName); } }
[ "public", "void", "setDefaultWorkManager", "(", "WorkManager", "wm", ")", "{", "if", "(", "trace", ")", "log", ".", "tracef", "(", "\"Default WorkManager: %s\"", ",", "wm", ")", ";", "String", "currentName", "=", "null", ";", "if", "(", "defaultWorkManager", ...
Set the default work manager @param wm The work manager
[ "Set", "the", "default", "work", "manager" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java#L220-L240
135,427
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java
WorkManagerCoordinator.resolveDistributedWorkManager
public DistributedWorkManager resolveDistributedWorkManager(Address address) { if (trace) { log.tracef("resolveDistributedWorkManager(%s)", address); log.tracef(" ActiveWorkManagers: %s", activeWorkmanagers); } WorkManager wm = activeWorkmanagers.get(address.getWorkManagerId()); if (wm != null) { if (wm instanceof DistributedWorkManager) { if (trace) log.tracef(" WorkManager: %s", wm); return (DistributedWorkManager)wm; } else { if (trace) log.tracef(" WorkManager not distributable: %s", wm); return null; } } try { // Create a new instance WorkManager template = workmanagers.get(address.getWorkManagerName()); if (template != null) { wm = template.clone(); wm.setId(address.getWorkManagerId()); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); activeWorkmanagers.put(address.getWorkManagerId(), dwm); refCountWorkmanagers.put(address.getWorkManagerId(), Integer.valueOf(0)); if (trace) log.tracef("Created WorkManager: %s", dwm); return dwm; } } } catch (Throwable t) { //throw new IllegalStateException("The WorkManager couldn't be created: " + name); } return null; }
java
public DistributedWorkManager resolveDistributedWorkManager(Address address) { if (trace) { log.tracef("resolveDistributedWorkManager(%s)", address); log.tracef(" ActiveWorkManagers: %s", activeWorkmanagers); } WorkManager wm = activeWorkmanagers.get(address.getWorkManagerId()); if (wm != null) { if (wm instanceof DistributedWorkManager) { if (trace) log.tracef(" WorkManager: %s", wm); return (DistributedWorkManager)wm; } else { if (trace) log.tracef(" WorkManager not distributable: %s", wm); return null; } } try { // Create a new instance WorkManager template = workmanagers.get(address.getWorkManagerName()); if (template != null) { wm = template.clone(); wm.setId(address.getWorkManagerId()); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); activeWorkmanagers.put(address.getWorkManagerId(), dwm); refCountWorkmanagers.put(address.getWorkManagerId(), Integer.valueOf(0)); if (trace) log.tracef("Created WorkManager: %s", dwm); return dwm; } } } catch (Throwable t) { //throw new IllegalStateException("The WorkManager couldn't be created: " + name); } return null; }
[ "public", "DistributedWorkManager", "resolveDistributedWorkManager", "(", "Address", "address", ")", "{", "if", "(", "trace", ")", "{", "log", ".", "tracef", "(", "\"resolveDistributedWorkManager(%s)\"", ",", "address", ")", ";", "log", ".", "tracef", "(", "\" Ac...
Resolve a distributed work manager @param address The work manager address @return The value
[ "Resolve", "a", "distributed", "work", "manager" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java#L302-L361
135,428
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java
WorkManagerCoordinator.createWorkManager
public synchronized WorkManager createWorkManager(String id, String name) { if (id == null || id.trim().equals("")) throw new IllegalArgumentException("The id of WorkManager is invalid: " + id); // Check for an active work manager if (activeWorkmanagers.keySet().contains(id)) { if (trace) log.tracef("RefCounting WorkManager: %s", id); Integer i = refCountWorkmanagers.get(id); refCountWorkmanagers.put(id, Integer.valueOf(i.intValue() + 1)); WorkManager wm = activeWorkmanagers.get(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; if (dwm.getTransport() != null) dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); } return wm; } try { // Create a new instance WorkManager template = null; if (name != null) { template = workmanagers.get(name); } else { template = defaultWorkManager; } if (template == null) throw new IllegalArgumentException("The WorkManager wasn't found: " + name); WorkManager wm = template.clone(); wm.setId(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); if (dwm.getTransport() != null) { dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); try { ((DistributedWorkManager) wm).getTransport().startup(); } catch (Throwable t) { throw new ApplicationServerInternalException("Unable to start the DWM Transport ID:" + ((DistributedWorkManager) wm).getTransport().getId(), t); } } else { throw new ApplicationServerInternalException("DistributedWorkManager " + dwm.getName() + " doesn't have a transport associated"); } } activeWorkmanagers.put(id, wm); refCountWorkmanagers.put(id, Integer.valueOf(1)); if (trace) log.tracef("Created WorkManager: %s", wm); return wm; } catch (Throwable t) { throw new IllegalStateException("The WorkManager couldn't be created: " + name, t); } }
java
public synchronized WorkManager createWorkManager(String id, String name) { if (id == null || id.trim().equals("")) throw new IllegalArgumentException("The id of WorkManager is invalid: " + id); // Check for an active work manager if (activeWorkmanagers.keySet().contains(id)) { if (trace) log.tracef("RefCounting WorkManager: %s", id); Integer i = refCountWorkmanagers.get(id); refCountWorkmanagers.put(id, Integer.valueOf(i.intValue() + 1)); WorkManager wm = activeWorkmanagers.get(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; if (dwm.getTransport() != null) dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); } return wm; } try { // Create a new instance WorkManager template = null; if (name != null) { template = workmanagers.get(name); } else { template = defaultWorkManager; } if (template == null) throw new IllegalArgumentException("The WorkManager wasn't found: " + name); WorkManager wm = template.clone(); wm.setId(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); if (dwm.getTransport() != null) { dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); try { ((DistributedWorkManager) wm).getTransport().startup(); } catch (Throwable t) { throw new ApplicationServerInternalException("Unable to start the DWM Transport ID:" + ((DistributedWorkManager) wm).getTransport().getId(), t); } } else { throw new ApplicationServerInternalException("DistributedWorkManager " + dwm.getName() + " doesn't have a transport associated"); } } activeWorkmanagers.put(id, wm); refCountWorkmanagers.put(id, Integer.valueOf(1)); if (trace) log.tracef("Created WorkManager: %s", wm); return wm; } catch (Throwable t) { throw new IllegalStateException("The WorkManager couldn't be created: " + name, t); } }
[ "public", "synchronized", "WorkManager", "createWorkManager", "(", "String", "id", ",", "String", "name", ")", "{", "if", "(", "id", "==", "null", "||", "id", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "throw", "new", "IllegalArgumentEx...
Create a work manager @param id The id of the work manager @param name The name of the work manager; if <code>null</code> default value is used @return The work manager
[ "Create", "a", "work", "manager" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java#L369-L450
135,429
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java
WorkManagerCoordinator.removeWorkManager
public synchronized void removeWorkManager(String id) { if (id == null || id.trim().equals("")) throw new IllegalArgumentException("The id of WorkManager is invalid: " + id); Integer i = refCountWorkmanagers.get(id); if (i != null) { int newValue = i.intValue() - 1; if (newValue == 0) { if (trace) log.tracef("Removed WorkManager: %s", id); WorkManager wm = activeWorkmanagers.get(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; if (dwm.getTransport() != null) dwm.getTransport().unregister(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); } activeWorkmanagers.remove(id); refCountWorkmanagers.remove(id); } else { if (trace) log.tracef("DerefCount WorkManager: %s", id); refCountWorkmanagers.put(id, Integer.valueOf(newValue)); } } }
java
public synchronized void removeWorkManager(String id) { if (id == null || id.trim().equals("")) throw new IllegalArgumentException("The id of WorkManager is invalid: " + id); Integer i = refCountWorkmanagers.get(id); if (i != null) { int newValue = i.intValue() - 1; if (newValue == 0) { if (trace) log.tracef("Removed WorkManager: %s", id); WorkManager wm = activeWorkmanagers.get(id); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; if (dwm.getTransport() != null) dwm.getTransport().unregister(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); } activeWorkmanagers.remove(id); refCountWorkmanagers.remove(id); } else { if (trace) log.tracef("DerefCount WorkManager: %s", id); refCountWorkmanagers.put(id, Integer.valueOf(newValue)); } } }
[ "public", "synchronized", "void", "removeWorkManager", "(", "String", "id", ")", "{", "if", "(", "id", "==", "null", "||", "id", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"The id of Work...
Remove a work manager @param id The id of the work manager
[ "Remove", "a", "work", "manager" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerCoordinator.java#L456-L489
135,430
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/spec/ResourceAdapterImpl.java
ResourceAdapterImpl.forceAdminObjects
public synchronized void forceAdminObjects(List<AdminObject> newContent) { if (newContent != null) { this.adminobjects = new ArrayList<AdminObject>(newContent); } else { this.adminobjects = new ArrayList<AdminObject>(0); } }
java
public synchronized void forceAdminObjects(List<AdminObject> newContent) { if (newContent != null) { this.adminobjects = new ArrayList<AdminObject>(newContent); } else { this.adminobjects = new ArrayList<AdminObject>(0); } }
[ "public", "synchronized", "void", "forceAdminObjects", "(", "List", "<", "AdminObject", ">", "newContent", ")", "{", "if", "(", "newContent", "!=", "null", ")", "{", "this", ".", "adminobjects", "=", "new", "ArrayList", "<", "AdminObject", ">", "(", "newCont...
Force adminobjects with new content. This method is thread safe @param newContent the list of new properties
[ "Force", "adminobjects", "with", "new", "content", ".", "This", "method", "is", "thread", "safe" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/spec/ResourceAdapterImpl.java#L184-L194
135,431
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java
PoolStatisticsImpl.deltaTotalBlockingTime
public void deltaTotalBlockingTime(long delta) { if (enabled.get() && delta > 0) { totalBlockingTime.addAndGet(delta); totalBlockingTimeInvocations.incrementAndGet(); if (delta > maxWaitTime.get()) maxWaitTime.set(delta); } }
java
public void deltaTotalBlockingTime(long delta) { if (enabled.get() && delta > 0) { totalBlockingTime.addAndGet(delta); totalBlockingTimeInvocations.incrementAndGet(); if (delta > maxWaitTime.get()) maxWaitTime.set(delta); } }
[ "public", "void", "deltaTotalBlockingTime", "(", "long", "delta", ")", "{", "if", "(", "enabled", ".", "get", "(", ")", "&&", "delta", ">", "0", ")", "{", "totalBlockingTime", ".", "addAndGet", "(", "delta", ")", ";", "totalBlockingTimeInvocations", ".", "...
Add delta to total blocking timeout @param delta The value
[ "Add", "delta", "to", "total", "blocking", "timeout" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java#L981-L991
135,432
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java
PoolStatisticsImpl.deltaTotalCreationTime
public void deltaTotalCreationTime(long delta) { if (enabled.get() && delta > 0) { totalCreationTime.addAndGet(delta); if (delta > maxCreationTime.get()) maxCreationTime.set(delta); } }
java
public void deltaTotalCreationTime(long delta) { if (enabled.get() && delta > 0) { totalCreationTime.addAndGet(delta); if (delta > maxCreationTime.get()) maxCreationTime.set(delta); } }
[ "public", "void", "deltaTotalCreationTime", "(", "long", "delta", ")", "{", "if", "(", "enabled", ".", "get", "(", ")", "&&", "delta", ">", "0", ")", "{", "totalCreationTime", ".", "addAndGet", "(", "delta", ")", ";", "if", "(", "delta", ">", "maxCreat...
Add delta to total creation time @param delta The value
[ "Add", "delta", "to", "total", "creation", "time" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java#L1008-L1017
135,433
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java
PoolStatisticsImpl.deltaTotalGetTime
public void deltaTotalGetTime(long delta) { if (enabled.get() && delta > 0) { totalGetTime.addAndGet(delta); totalGetTimeInvocations.incrementAndGet(); if (delta > maxGetTime.get()) maxGetTime.set(delta); } }
java
public void deltaTotalGetTime(long delta) { if (enabled.get() && delta > 0) { totalGetTime.addAndGet(delta); totalGetTimeInvocations.incrementAndGet(); if (delta > maxGetTime.get()) maxGetTime.set(delta); } }
[ "public", "void", "deltaTotalGetTime", "(", "long", "delta", ")", "{", "if", "(", "enabled", ".", "get", "(", ")", "&&", "delta", ">", "0", ")", "{", "totalGetTime", ".", "addAndGet", "(", "delta", ")", ";", "totalGetTimeInvocations", ".", "incrementAndGet...
Add delta to total get time @param delta The value
[ "Add", "delta", "to", "total", "get", "time" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java#L1034-L1044
135,434
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java
PoolStatisticsImpl.deltaTotalPoolTime
public void deltaTotalPoolTime(long delta) { if (enabled.get() && delta > 0) { totalPoolTime.addAndGet(delta); totalPoolTimeInvocations.incrementAndGet(); if (delta > maxPoolTime.get()) maxPoolTime.set(delta); } }
java
public void deltaTotalPoolTime(long delta) { if (enabled.get() && delta > 0) { totalPoolTime.addAndGet(delta); totalPoolTimeInvocations.incrementAndGet(); if (delta > maxPoolTime.get()) maxPoolTime.set(delta); } }
[ "public", "void", "deltaTotalPoolTime", "(", "long", "delta", ")", "{", "if", "(", "enabled", ".", "get", "(", ")", "&&", "delta", ">", "0", ")", "{", "totalPoolTime", ".", "addAndGet", "(", "delta", ")", ";", "totalPoolTimeInvocations", ".", "incrementAnd...
Add delta to total pool time @param delta The value
[ "Add", "delta", "to", "total", "pool", "time" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java#L1061-L1071
135,435
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java
PoolStatisticsImpl.deltaTotalUsageTime
public void deltaTotalUsageTime(long delta) { if (enabled.get() && delta > 0) { totalUsageTime.addAndGet(delta); totalUsageTimeInvocations.incrementAndGet(); if (delta > maxUsageTime.get()) maxUsageTime.set(delta); } }
java
public void deltaTotalUsageTime(long delta) { if (enabled.get() && delta > 0) { totalUsageTime.addAndGet(delta); totalUsageTimeInvocations.incrementAndGet(); if (delta > maxUsageTime.get()) maxUsageTime.set(delta); } }
[ "public", "void", "deltaTotalUsageTime", "(", "long", "delta", ")", "{", "if", "(", "enabled", ".", "get", "(", ")", "&&", "delta", ">", "0", ")", "{", "totalUsageTime", ".", "addAndGet", "(", "delta", ")", ";", "totalUsageTimeInvocations", ".", "increment...
Add delta to total usage time @param delta The value
[ "Add", "delta", "to", "total", "usage", "time" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/PoolStatisticsImpl.java#L1088-L1098
135,436
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/deploymentrepository/ResourceAdapterImpl.java
ResourceAdapterImpl.verifyBeanValidation
@SuppressWarnings("unchecked") private void verifyBeanValidation(Object as) throws Exception { if (beanValidation != null) { ValidatorFactory vf = null; try { vf = beanValidation.getValidatorFactory(); Validator v = vf.getValidator(); Collection<String> l = bvGroups; if (l == null || l.isEmpty()) l = Arrays.asList(javax.validation.groups.Default.class.getName()); Collection<Class<?>> groups = new ArrayList<>(); for (String clz : l) { groups.add(Class.forName(clz, true, resourceAdapter.getClass().getClassLoader())); } Set failures = v.validate(as, groups.toArray(new Class<?>[groups.size()])); if (!failures.isEmpty()) { throw new ConstraintViolationException("Violation for " + as, failures); } } finally { if (vf != null) vf.close(); } } }
java
@SuppressWarnings("unchecked") private void verifyBeanValidation(Object as) throws Exception { if (beanValidation != null) { ValidatorFactory vf = null; try { vf = beanValidation.getValidatorFactory(); Validator v = vf.getValidator(); Collection<String> l = bvGroups; if (l == null || l.isEmpty()) l = Arrays.asList(javax.validation.groups.Default.class.getName()); Collection<Class<?>> groups = new ArrayList<>(); for (String clz : l) { groups.add(Class.forName(clz, true, resourceAdapter.getClass().getClassLoader())); } Set failures = v.validate(as, groups.toArray(new Class<?>[groups.size()])); if (!failures.isEmpty()) { throw new ConstraintViolationException("Violation for " + as, failures); } } finally { if (vf != null) vf.close(); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "verifyBeanValidation", "(", "Object", "as", ")", "throws", "Exception", "{", "if", "(", "beanValidation", "!=", "null", ")", "{", "ValidatorFactory", "vf", "=", "null", ";", "try", "{", ...
Verify activation spec against bean validation @param as The activation spec @exception Exception Thrown in case of a violation
[ "Verify", "activation", "spec", "against", "bean", "validation" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/deploymentrepository/ResourceAdapterImpl.java#L316-L351
135,437
ironjacamar/ironjacamar
tracer/src/main/java/org/ironjacamar/tracer/HTMLReport.java
HTMLReport.generateToCManagedConnection
private static void generateToCManagedConnection(Map<String, TraceEvent> events, FileWriter fw) throws Exception { writeString(fw, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""); writeEOL(fw); writeString(fw, " \"http://www.w3.org/TR/html4/loose.dtd\">"); writeEOL(fw); writeString(fw, "<html>"); writeEOL(fw); writeString(fw, "<head>"); writeEOL(fw); writeString(fw, "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">"); writeEOL(fw); writeString(fw, "<title>Reference: ManagedConnection</title>"); writeEOL(fw); writeString(fw, "</head>"); writeEOL(fw); writeString(fw, "<body style=\"background: #D7D7D7;\">"); writeEOL(fw); writeString(fw, "<h1>Reference: ManagedConnection</h1>"); writeEOL(fw); writeString(fw, "<table>"); writeEOL(fw); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><b>ManagedConnection</b></td>"); writeEOL(fw); writeString(fw, "<td><b>ConnectionListener</b></td>"); writeEOL(fw); writeString(fw, "<td><b>ManagedConnectionPool</b></td>"); writeEOL(fw); writeString(fw, "<td><b>Pool</b></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); for (Map.Entry<String, TraceEvent> entry : events.entrySet()) { TraceEvent te = entry.getValue(); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" + te.getPayload1() + "</a></td>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" + te.getConnectionListener() + "</a></td>"); writeEOL(fw); writeString(fw, "<td>" + te.getManagedConnectionPool() + "</td>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/index.html\">" + te.getPool() + "</a></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); } writeString(fw, "</table>"); writeEOL(fw); writeString(fw, "<p>"); writeEOL(fw); writeString(fw, "<a href=\"index.html\">Back</a>"); writeEOL(fw); writeString(fw, "</body>"); writeEOL(fw); writeString(fw, "</html>"); writeEOL(fw); }
java
private static void generateToCManagedConnection(Map<String, TraceEvent> events, FileWriter fw) throws Exception { writeString(fw, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""); writeEOL(fw); writeString(fw, " \"http://www.w3.org/TR/html4/loose.dtd\">"); writeEOL(fw); writeString(fw, "<html>"); writeEOL(fw); writeString(fw, "<head>"); writeEOL(fw); writeString(fw, "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">"); writeEOL(fw); writeString(fw, "<title>Reference: ManagedConnection</title>"); writeEOL(fw); writeString(fw, "</head>"); writeEOL(fw); writeString(fw, "<body style=\"background: #D7D7D7;\">"); writeEOL(fw); writeString(fw, "<h1>Reference: ManagedConnection</h1>"); writeEOL(fw); writeString(fw, "<table>"); writeEOL(fw); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><b>ManagedConnection</b></td>"); writeEOL(fw); writeString(fw, "<td><b>ConnectionListener</b></td>"); writeEOL(fw); writeString(fw, "<td><b>ManagedConnectionPool</b></td>"); writeEOL(fw); writeString(fw, "<td><b>Pool</b></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); for (Map.Entry<String, TraceEvent> entry : events.entrySet()) { TraceEvent te = entry.getValue(); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" + te.getPayload1() + "</a></td>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" + te.getConnectionListener() + "</a></td>"); writeEOL(fw); writeString(fw, "<td>" + te.getManagedConnectionPool() + "</td>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/index.html\">" + te.getPool() + "</a></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); } writeString(fw, "</table>"); writeEOL(fw); writeString(fw, "<p>"); writeEOL(fw); writeString(fw, "<a href=\"index.html\">Back</a>"); writeEOL(fw); writeString(fw, "</body>"); writeEOL(fw); writeString(fw, "</html>"); writeEOL(fw); }
[ "private", "static", "void", "generateToCManagedConnection", "(", "Map", "<", "String", ",", "TraceEvent", ">", "events", ",", "FileWriter", "fw", ")", "throws", "Exception", "{", "writeString", "(", "fw", ",", "\"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Transiti...
Write toc-mc.html for managed connections @param events The events @param fw The file writer @exception Exception If an error occurs
[ "Write", "toc", "-", "mc", ".", "html", "for", "managed", "connections" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/tracer/src/main/java/org/ironjacamar/tracer/HTMLReport.java#L1707-L1796
135,438
ironjacamar/ironjacamar
tracer/src/main/java/org/ironjacamar/tracer/HTMLReport.java
HTMLReport.generateToCConnectionListener
private static void generateToCConnectionListener(Map<String, List<TraceEvent>> events, FileWriter fw) throws Exception { writeString(fw, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""); writeEOL(fw); writeString(fw, " \"http://www.w3.org/TR/html4/loose.dtd\">"); writeEOL(fw); writeString(fw, "<html>"); writeEOL(fw); writeString(fw, "<head>"); writeEOL(fw); writeString(fw, "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">"); writeEOL(fw); writeString(fw, "<title>Reference: ConnectionListener</title>"); writeEOL(fw); writeString(fw, "</head>"); writeEOL(fw); writeString(fw, "<body style=\"background: #D7D7D7;\">"); writeEOL(fw); writeString(fw, "<h1>Reference: ConnectionListener</h1>"); writeEOL(fw); writeString(fw, "<table>"); writeEOL(fw); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><b>ConnectionListener</b></td>"); writeEOL(fw); writeString(fw, "<td><b>ManagedConnectionPool</b></td>"); writeEOL(fw); writeString(fw, "<td><b>Pool</b></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); for (Map.Entry<String, List<TraceEvent>> entry : events.entrySet()) { TraceEvent te = entry.getValue().get(0); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" + te.getConnectionListener() + "</a></td>"); writeEOL(fw); writeString(fw, "<td>" + te.getManagedConnectionPool() + "</td>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/index.html\">" + te.getPool() + "</a></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); } writeString(fw, "</table>"); writeEOL(fw); writeString(fw, "<p>"); writeEOL(fw); writeString(fw, "<a href=\"index.html\">Back</a>"); writeEOL(fw); writeString(fw, "</body>"); writeEOL(fw); writeString(fw, "</html>"); writeEOL(fw); }
java
private static void generateToCConnectionListener(Map<String, List<TraceEvent>> events, FileWriter fw) throws Exception { writeString(fw, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""); writeEOL(fw); writeString(fw, " \"http://www.w3.org/TR/html4/loose.dtd\">"); writeEOL(fw); writeString(fw, "<html>"); writeEOL(fw); writeString(fw, "<head>"); writeEOL(fw); writeString(fw, "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">"); writeEOL(fw); writeString(fw, "<title>Reference: ConnectionListener</title>"); writeEOL(fw); writeString(fw, "</head>"); writeEOL(fw); writeString(fw, "<body style=\"background: #D7D7D7;\">"); writeEOL(fw); writeString(fw, "<h1>Reference: ConnectionListener</h1>"); writeEOL(fw); writeString(fw, "<table>"); writeEOL(fw); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><b>ConnectionListener</b></td>"); writeEOL(fw); writeString(fw, "<td><b>ManagedConnectionPool</b></td>"); writeEOL(fw); writeString(fw, "<td><b>Pool</b></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); for (Map.Entry<String, List<TraceEvent>> entry : events.entrySet()) { TraceEvent te = entry.getValue().get(0); writeString(fw, "<tr>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/" + te.getConnectionListener() + "/index.html\">" + te.getConnectionListener() + "</a></td>"); writeEOL(fw); writeString(fw, "<td>" + te.getManagedConnectionPool() + "</td>"); writeEOL(fw); writeString(fw, "<td><a href=\"" + te.getPool() + "/index.html\">" + te.getPool() + "</a></td>"); writeEOL(fw); writeString(fw, "</tr>"); writeEOL(fw); } writeString(fw, "</table>"); writeEOL(fw); writeString(fw, "<p>"); writeEOL(fw); writeString(fw, "<a href=\"index.html\">Back</a>"); writeEOL(fw); writeString(fw, "</body>"); writeEOL(fw); writeString(fw, "</html>"); writeEOL(fw); }
[ "private", "static", "void", "generateToCConnectionListener", "(", "Map", "<", "String", ",", "List", "<", "TraceEvent", ">", ">", "events", ",", "FileWriter", "fw", ")", "throws", "Exception", "{", "writeString", "(", "fw", ",", "\"<!DOCTYPE HTML PUBLIC \\\"-//W3...
Write toc-cl.html for connection listeners @param events The events @param fw The file writer @exception Exception If an error occurs
[ "Write", "toc", "-", "cl", ".", "html", "for", "connection", "listeners" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/tracer/src/main/java/org/ironjacamar/tracer/HTMLReport.java#L1804-L1886
135,439
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/ironjacamar/IronJacamarParser.java
IronJacamarParser.store
public void store(Activation metadata, XMLStreamWriter writer) throws Exception { if (metadata != null && writer != null) { writer.writeStartElement(XML.ELEMENT_IRONJACAMAR); storeCommon(metadata, writer); writer.writeEndElement(); } }
java
public void store(Activation metadata, XMLStreamWriter writer) throws Exception { if (metadata != null && writer != null) { writer.writeStartElement(XML.ELEMENT_IRONJACAMAR); storeCommon(metadata, writer); writer.writeEndElement(); } }
[ "public", "void", "store", "(", "Activation", "metadata", ",", "XMLStreamWriter", "writer", ")", "throws", "Exception", "{", "if", "(", "metadata", "!=", "null", "&&", "writer", "!=", "null", ")", "{", "writer", ".", "writeStartElement", "(", "XML", ".", "...
Store an ironjacamar.xml file @param metadata The IronJacamar definition @param writer The writer @exception Exception Thrown if an error occurs
[ "Store", "an", "ironjacamar", ".", "xml", "file" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/ironjacamar/IronJacamarParser.java#L118-L126
135,440
ironjacamar/ironjacamar
validator/src/main/java/org/ironjacamar/validator/Validation.java
Validation.extract
private static File extract(File file, File directory) throws IOException { if (file == null) throw new IllegalArgumentException("File is null"); if (directory == null) throw new IllegalArgumentException("Directory is null"); File target = new File(directory, file.getName()); if (target.exists()) recursiveDelete(target); if (!target.mkdirs()) throw new IOException("Could not create " + target); JarFile jar = null; try { jar = new JarFile(file); Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry je = entries.nextElement(); File copy = new File(target, je.getName()); if (!je.isDirectory()) { InputStream in = null; OutputStream out = null; // Make sure that the directory is _really_ there if (copy.getParentFile() != null && !copy.getParentFile().exists()) { if (!copy.getParentFile().mkdirs()) throw new IOException("Could not create " + copy.getParentFile()); } try { in = new BufferedInputStream(jar.getInputStream(je)); out = new BufferedOutputStream(new FileOutputStream(copy)); byte[] buffer = new byte[4096]; for (;;) { int nBytes = in.read(buffer); if (nBytes <= 0) break; out.write(buffer, 0, nBytes); } out.flush(); } finally { try { if (out != null) out.close(); } catch (IOException ignore) { // Ignore } try { if (in != null) in.close(); } catch (IOException ignore) { // Ignore } } } else { if (!copy.exists()) { if (!copy.mkdirs()) throw new IOException("Could not create " + copy); } else { if (!copy.isDirectory()) throw new IOException(copy + " isn't a directory"); } } } } finally { try { if (jar != null) jar.close(); } catch (IOException ignore) { // Ignore } } return target; }
java
private static File extract(File file, File directory) throws IOException { if (file == null) throw new IllegalArgumentException("File is null"); if (directory == null) throw new IllegalArgumentException("Directory is null"); File target = new File(directory, file.getName()); if (target.exists()) recursiveDelete(target); if (!target.mkdirs()) throw new IOException("Could not create " + target); JarFile jar = null; try { jar = new JarFile(file); Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry je = entries.nextElement(); File copy = new File(target, je.getName()); if (!je.isDirectory()) { InputStream in = null; OutputStream out = null; // Make sure that the directory is _really_ there if (copy.getParentFile() != null && !copy.getParentFile().exists()) { if (!copy.getParentFile().mkdirs()) throw new IOException("Could not create " + copy.getParentFile()); } try { in = new BufferedInputStream(jar.getInputStream(je)); out = new BufferedOutputStream(new FileOutputStream(copy)); byte[] buffer = new byte[4096]; for (;;) { int nBytes = in.read(buffer); if (nBytes <= 0) break; out.write(buffer, 0, nBytes); } out.flush(); } finally { try { if (out != null) out.close(); } catch (IOException ignore) { // Ignore } try { if (in != null) in.close(); } catch (IOException ignore) { // Ignore } } } else { if (!copy.exists()) { if (!copy.mkdirs()) throw new IOException("Could not create " + copy); } else { if (!copy.isDirectory()) throw new IOException(copy + " isn't a directory"); } } } } finally { try { if (jar != null) jar.close(); } catch (IOException ignore) { // Ignore } } return target; }
[ "private", "static", "File", "extract", "(", "File", "file", ",", "File", "directory", ")", "throws", "IOException", "{", "if", "(", "file", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"File is null\"", ")", ";", "if", "(", "directo...
Extract a JAR type file @param file The file @param directory The directory where the file should be extracted @return The root of the extracted JAR file @exception IOException Thrown if an error occurs
[ "Extract", "a", "JAR", "type", "file" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/validator/src/main/java/org/ironjacamar/validator/Validation.java#L492-L599
135,441
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/ExpressionTemplate.java
ExpressionTemplate.parse
private void parse() { template = text; if (StringUtils.isEmptyTrimmed(template)) return; int index = 0; while (template.indexOf("${") != -1) { int from = template.lastIndexOf("${"); int to = template.indexOf("}", from + 2); if (to == -1) { template = text; complex = false; entities.clear(); return; } int dv = template.indexOf(":", from + 2); if (dv != -1 && dv > to) { dv = -1; } String systemProperty = null; String defaultValue = null; String s = template.substring(from + 2, to); if ("/".equals(s)) { systemProperty = File.separator; } else if (":".equals(s)) { systemProperty = File.pathSeparator; dv = -1; } else { systemProperty = SecurityActions.getSystemProperty(s); } if (dv != -1) { s = template.substring(from + 2, dv); systemProperty = SecurityActions.getSystemProperty(s); defaultValue = template.substring(dv + 1, to); } String prefix = ""; String postfix = ""; String key = StringUtils.createKey(index++); updateComplex(defaultValue); entities.put(key, new Expression(s, defaultValue, systemProperty)); if (from != 0) { prefix = template.substring(0, from); } if (to + 1 < template.length()) { postfix = template.substring(to + 1); } template = prefix + key + postfix; } updateComplex(template); }
java
private void parse() { template = text; if (StringUtils.isEmptyTrimmed(template)) return; int index = 0; while (template.indexOf("${") != -1) { int from = template.lastIndexOf("${"); int to = template.indexOf("}", from + 2); if (to == -1) { template = text; complex = false; entities.clear(); return; } int dv = template.indexOf(":", from + 2); if (dv != -1 && dv > to) { dv = -1; } String systemProperty = null; String defaultValue = null; String s = template.substring(from + 2, to); if ("/".equals(s)) { systemProperty = File.separator; } else if (":".equals(s)) { systemProperty = File.pathSeparator; dv = -1; } else { systemProperty = SecurityActions.getSystemProperty(s); } if (dv != -1) { s = template.substring(from + 2, dv); systemProperty = SecurityActions.getSystemProperty(s); defaultValue = template.substring(dv + 1, to); } String prefix = ""; String postfix = ""; String key = StringUtils.createKey(index++); updateComplex(defaultValue); entities.put(key, new Expression(s, defaultValue, systemProperty)); if (from != 0) { prefix = template.substring(0, from); } if (to + 1 < template.length()) { postfix = template.substring(to + 1); } template = prefix + key + postfix; } updateComplex(template); }
[ "private", "void", "parse", "(", ")", "{", "template", "=", "text", ";", "if", "(", "StringUtils", ".", "isEmptyTrimmed", "(", "template", ")", ")", "return", ";", "int", "index", "=", "0", ";", "while", "(", "template", ".", "indexOf", "(", "\"${\"", ...
Parse a text and get a template and expression entities
[ "Parse", "a", "text", "and", "get", "a", "template", "and", "expression", "entities" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/ExpressionTemplate.java#L60-L123
135,442
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/ExpressionTemplate.java
ExpressionTemplate.updateComplex
private void updateComplex(String string) { if (string != null && StringUtils.getExpressionKey(string) != null && !string.equals(StringUtils.getExpressionKey(string))) { complex = true; } }
java
private void updateComplex(String string) { if (string != null && StringUtils.getExpressionKey(string) != null && !string.equals(StringUtils.getExpressionKey(string))) { complex = true; } }
[ "private", "void", "updateComplex", "(", "String", "string", ")", "{", "if", "(", "string", "!=", "null", "&&", "StringUtils", ".", "getExpressionKey", "(", "string", ")", "!=", "null", "&&", "!", "string", ".", "equals", "(", "StringUtils", ".", "getExpre...
Updates the complexness of the expression based on a String value @param string value
[ "Updates", "the", "complexness", "of", "the", "expression", "based", "on", "a", "String", "value" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/ExpressionTemplate.java#L129-L136
135,443
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/ExpressionTemplate.java
ExpressionTemplate.resolveTemplate
private String resolveTemplate(boolean toValue) { String result = template; if (StringUtils.isEmptyTrimmed(result)) return result; String key; while ((key = StringUtils.getExpressionKey(result)) != null) { String subs; Expression ex = entities.get(key); String nKey = StringUtils.getExpressionKey(ex.getDefaultValue()); if (toValue) subs = ex.getValue(); else if (nKey != null && ex.getResolvedValue() != null && ex.getDefaultValue().equals(nKey)) { entities.get(nKey).setResolvedValue(ex.getResolvedValue()); subs = ex.toString(); } else subs = ex.toSubstitution(); result = result.replace(key, subs); } return result; }
java
private String resolveTemplate(boolean toValue) { String result = template; if (StringUtils.isEmptyTrimmed(result)) return result; String key; while ((key = StringUtils.getExpressionKey(result)) != null) { String subs; Expression ex = entities.get(key); String nKey = StringUtils.getExpressionKey(ex.getDefaultValue()); if (toValue) subs = ex.getValue(); else if (nKey != null && ex.getResolvedValue() != null && ex.getDefaultValue().equals(nKey)) { entities.get(nKey).setResolvedValue(ex.getResolvedValue()); subs = ex.toString(); } else subs = ex.toSubstitution(); result = result.replace(key, subs); } return result; }
[ "private", "String", "resolveTemplate", "(", "boolean", "toValue", ")", "{", "String", "result", "=", "template", ";", "if", "(", "StringUtils", ".", "isEmptyTrimmed", "(", "result", ")", ")", "return", "result", ";", "String", "key", ";", "while", "(", "(...
Resolves the template to the String value depending on boolean switch @param toValue if equals true - all Expression entities within the template will be presented by their values, otherwise - by their substitutions @return resulting String
[ "Resolves", "the", "template", "to", "the", "String", "value", "depending", "on", "boolean", "switch" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/ExpressionTemplate.java#L184-L211
135,444
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/annotations/Annotations.java
Annotations.merge
public Connector merge(Connector connector, AnnotationRepository annotationRepository, ClassLoader classLoader) throws Exception { // Process annotations if (connector == null || (connector.getVersion() == Version.V_16 || connector.getVersion() == Version.V_17)) { boolean isMetadataComplete = false; if (connector != null) { isMetadataComplete = connector.isMetadataComplete(); } if (connector == null || !isMetadataComplete) { if (connector == null) { Connector annotationsConnector = process(annotationRepository, null, classLoader); connector = annotationsConnector; } else { Connector annotationsConnector = process(annotationRepository, ((ResourceAdapter) connector.getResourceadapter()).getResourceadapterClass(), classLoader); connector = connector.merge(annotationsConnector); } } } return connector; }
java
public Connector merge(Connector connector, AnnotationRepository annotationRepository, ClassLoader classLoader) throws Exception { // Process annotations if (connector == null || (connector.getVersion() == Version.V_16 || connector.getVersion() == Version.V_17)) { boolean isMetadataComplete = false; if (connector != null) { isMetadataComplete = connector.isMetadataComplete(); } if (connector == null || !isMetadataComplete) { if (connector == null) { Connector annotationsConnector = process(annotationRepository, null, classLoader); connector = annotationsConnector; } else { Connector annotationsConnector = process(annotationRepository, ((ResourceAdapter) connector.getResourceadapter()).getResourceadapterClass(), classLoader); connector = connector.merge(annotationsConnector); } } } return connector; }
[ "public", "Connector", "merge", "(", "Connector", "connector", ",", "AnnotationRepository", "annotationRepository", ",", "ClassLoader", "classLoader", ")", "throws", "Exception", "{", "// Process annotations", "if", "(", "connector", "==", "null", "||", "(", "connecto...
Scan for annotations in the URLs specified @param connector The connector adapter metadata @param annotationRepository annotationRepository to use @param classLoader The class loader used to generate the repository @return The updated metadata @exception Exception Thrown if an error occurs
[ "Scan", "for", "annotations", "in", "the", "URLs", "specified" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L119-L149
135,445
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/annotations/Annotations.java
Annotations.hasAnnotation
private boolean hasAnnotation(Class c, Class targetClass, AnnotationRepository annotationRepository) { Collection<Annotation> values = annotationRepository.getAnnotation(targetClass); if (values == null) return false; for (Annotation annotation : values) { if (annotation.getClassName() != null && annotation.getClassName().equals(c.getName())) return true; } return false; }
java
private boolean hasAnnotation(Class c, Class targetClass, AnnotationRepository annotationRepository) { Collection<Annotation> values = annotationRepository.getAnnotation(targetClass); if (values == null) return false; for (Annotation annotation : values) { if (annotation.getClassName() != null && annotation.getClassName().equals(c.getName())) return true; } return false; }
[ "private", "boolean", "hasAnnotation", "(", "Class", "c", ",", "Class", "targetClass", ",", "AnnotationRepository", "annotationRepository", ")", "{", "Collection", "<", "Annotation", ">", "values", "=", "annotationRepository", ".", "getAnnotation", "(", "targetClass",...
hasAnnotation, if class c contains annotation targetClass @param c @param targetClass @param annotationRepository @return
[ "hasAnnotation", "if", "class", "c", "contains", "annotation", "targetClass" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L915-L927
135,446
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/annotations/Annotations.java
Annotations.getConfigPropertyName
private String getConfigPropertyName(Annotation annotation) throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException { if (annotation.isOnField()) { return annotation.getMemberName(); } else if (annotation.isOnMethod()) { String name = annotation.getMemberName(); if (name.startsWith("set")) { name = name.substring(3); } else if (name.startsWith("get")) { name = name.substring(3); } else if (name.startsWith("is")) { name = name.substring(2); } if (name.length() > 1) { return Character.toLowerCase(name.charAt(0)) + name.substring(1); } else { return Character.toString(Character.toLowerCase(name.charAt(0))); } } throw new IllegalArgumentException(bundle.unknownAnnotation(annotation)); }
java
private String getConfigPropertyName(Annotation annotation) throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException { if (annotation.isOnField()) { return annotation.getMemberName(); } else if (annotation.isOnMethod()) { String name = annotation.getMemberName(); if (name.startsWith("set")) { name = name.substring(3); } else if (name.startsWith("get")) { name = name.substring(3); } else if (name.startsWith("is")) { name = name.substring(2); } if (name.length() > 1) { return Character.toLowerCase(name.charAt(0)) + name.substring(1); } else { return Character.toString(Character.toLowerCase(name.charAt(0))); } } throw new IllegalArgumentException(bundle.unknownAnnotation(annotation)); }
[ "private", "String", "getConfigPropertyName", "(", "Annotation", "annotation", ")", "throws", "ClassNotFoundException", ",", "NoSuchFieldException", ",", "NoSuchMethodException", "{", "if", "(", "annotation", ".", "isOnField", "(", ")", ")", "{", "return", "annotation...
Get the config-property-name for an annotation @param annotation The annotation @return The name @exception ClassNotFoundException Thrown if a class cannot be found @exception NoSuchFieldException Thrown if a field cannot be found @exception NoSuchMethodException Thrown if a method cannot be found
[ "Get", "the", "config", "-", "property", "-", "name", "for", "an", "annotation" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L1143-L1178
135,447
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/annotations/Annotations.java
Annotations.getConfigPropertyType
@SuppressWarnings("unchecked") private String getConfigPropertyType(Annotation annotation, Class<?> type, ClassLoader classLoader) throws ClassNotFoundException, ValidateException { if (annotation.isOnField()) { Class clz = Class.forName(annotation.getClassName(), true, classLoader); while (!Object.class.equals(clz)) { try { Field field = SecurityActions.getDeclaredField(clz, annotation.getMemberName()); if (type == null || type.equals(Object.class) || type.equals(field.getType())) { return field.getType().getName(); } else { throw new ValidateException(bundle.wrongAnnotationType(annotation)); } } catch (NoSuchFieldException nsfe) { clz = clz.getSuperclass(); } } } else if (annotation.isOnMethod()) { Class clz = Class.forName(annotation.getClassName(), true, classLoader); Class[] parameters = null; if (annotation.getParameterTypes() != null) { parameters = new Class[annotation.getParameterTypes().size()]; for (int i = 0; i < annotation.getParameterTypes().size(); i++) { String parameter = annotation.getParameterTypes().get(i); parameters[i] = Class.forName(parameter, true, classLoader); } } while (!Object.class.equals(clz)) { try { Method method = SecurityActions.getDeclaredMethod(clz, annotation.getMemberName(), parameters); if (void.class.equals(method.getReturnType())) { if (parameters != null && parameters.length > 0) { if (type == null || type.equals(Object.class) || type.equals(parameters[0])) { return parameters[0].getName(); } else { throw new ValidateException(bundle.wrongAnnotationType(annotation)); } } } else { if (type == null || type.equals(Object.class) || type.equals(method.getReturnType())) { return method.getReturnType().getName(); } else { throw new ValidateException(bundle.wrongAnnotationType(annotation)); } } } catch (NoSuchMethodException nsme) { clz = clz.getSuperclass(); } } } throw new IllegalArgumentException(bundle.unknownAnnotation(annotation)); }
java
@SuppressWarnings("unchecked") private String getConfigPropertyType(Annotation annotation, Class<?> type, ClassLoader classLoader) throws ClassNotFoundException, ValidateException { if (annotation.isOnField()) { Class clz = Class.forName(annotation.getClassName(), true, classLoader); while (!Object.class.equals(clz)) { try { Field field = SecurityActions.getDeclaredField(clz, annotation.getMemberName()); if (type == null || type.equals(Object.class) || type.equals(field.getType())) { return field.getType().getName(); } else { throw new ValidateException(bundle.wrongAnnotationType(annotation)); } } catch (NoSuchFieldException nsfe) { clz = clz.getSuperclass(); } } } else if (annotation.isOnMethod()) { Class clz = Class.forName(annotation.getClassName(), true, classLoader); Class[] parameters = null; if (annotation.getParameterTypes() != null) { parameters = new Class[annotation.getParameterTypes().size()]; for (int i = 0; i < annotation.getParameterTypes().size(); i++) { String parameter = annotation.getParameterTypes().get(i); parameters[i] = Class.forName(parameter, true, classLoader); } } while (!Object.class.equals(clz)) { try { Method method = SecurityActions.getDeclaredMethod(clz, annotation.getMemberName(), parameters); if (void.class.equals(method.getReturnType())) { if (parameters != null && parameters.length > 0) { if (type == null || type.equals(Object.class) || type.equals(parameters[0])) { return parameters[0].getName(); } else { throw new ValidateException(bundle.wrongAnnotationType(annotation)); } } } else { if (type == null || type.equals(Object.class) || type.equals(method.getReturnType())) { return method.getReturnType().getName(); } else { throw new ValidateException(bundle.wrongAnnotationType(annotation)); } } } catch (NoSuchMethodException nsme) { clz = clz.getSuperclass(); } } } throw new IllegalArgumentException(bundle.unknownAnnotation(annotation)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "String", "getConfigPropertyType", "(", "Annotation", "annotation", ",", "Class", "<", "?", ">", "type", ",", "ClassLoader", "classLoader", ")", "throws", "ClassNotFoundException", ",", "ValidateException"...
Get the config-property-type for an annotation @param annotation The annotation @param type An optional declared type @param classLoader The class loader to use @return The fully qualified classname @exception ClassNotFoundException Thrown if a class cannot be found @exception ValidateException Thrown if a ConfigProperty type isn't correct
[ "Get", "the", "config", "-", "property", "-", "type", "for", "an", "annotation" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L1189-L1277
135,448
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/annotations/Annotations.java
Annotations.getClasses
private Set<String> getClasses(String name, ClassLoader cl) { Set<String> result = new HashSet<String>(); try { Class<?> clz = Class.forName(name, true, cl); while (!Object.class.equals(clz)) { result.add(clz.getName()); clz = clz.getSuperclass(); } } catch (Throwable t) { log.debugf("Couldn't load: %s", name); } return result; }
java
private Set<String> getClasses(String name, ClassLoader cl) { Set<String> result = new HashSet<String>(); try { Class<?> clz = Class.forName(name, true, cl); while (!Object.class.equals(clz)) { result.add(clz.getName()); clz = clz.getSuperclass(); } } catch (Throwable t) { log.debugf("Couldn't load: %s", name); } return result; }
[ "private", "Set", "<", "String", ">", "getClasses", "(", "String", "name", ",", "ClassLoader", "cl", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "try", "{", "Class", "<", "?", ">", "clz",...
Get the class names for a class and all of its super classes @param name The name of the class @param cl The class loader @return The set of class names
[ "Get", "the", "class", "names", "for", "a", "class", "and", "all", "of", "its", "super", "classes" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L1285-L1304
135,449
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/annotations/Annotations.java
Annotations.hasNotNull
private boolean hasNotNull(AnnotationRepository annotationRepository, Annotation annotation) { Collection<Annotation> values = annotationRepository.getAnnotation(javax.validation.constraints.NotNull.class); if (values == null || values.isEmpty()) return false; for (Annotation notNullAnnotation : values) { if (notNullAnnotation.getClassName().equals(annotation.getClassName()) && notNullAnnotation.getMemberName().equals(annotation.getMemberName())) return true; } return false; }
java
private boolean hasNotNull(AnnotationRepository annotationRepository, Annotation annotation) { Collection<Annotation> values = annotationRepository.getAnnotation(javax.validation.constraints.NotNull.class); if (values == null || values.isEmpty()) return false; for (Annotation notNullAnnotation : values) { if (notNullAnnotation.getClassName().equals(annotation.getClassName()) && notNullAnnotation.getMemberName().equals(annotation.getMemberName())) return true; } return false; }
[ "private", "boolean", "hasNotNull", "(", "AnnotationRepository", "annotationRepository", ",", "Annotation", "annotation", ")", "{", "Collection", "<", "Annotation", ">", "values", "=", "annotationRepository", ".", "getAnnotation", "(", "javax", ".", "validation", ".",...
Has a NotNull annotation attached @param annotationRepository The annotation repository @param annotation The annotation being checked @return True of the method/field contains the NotNull annotation; otherwise false
[ "Has", "a", "NotNull", "annotation", "attached" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L1312-L1327
135,450
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java
AbstractManagedConnectionPool.validateConnectionListener
protected ConnectionListener validateConnectionListener(Collection<ConnectionListener> listeners, ConnectionListener cl, int newState) { ManagedConnectionFactory mcf = pool.getConnectionManager().getManagedConnectionFactory(); if (mcf instanceof ValidatingManagedConnectionFactory) { ValidatingManagedConnectionFactory vcf = (ValidatingManagedConnectionFactory)mcf; try { Set candidateSet = Collections.singleton(cl.getManagedConnection()); candidateSet = vcf.getInvalidConnections(candidateSet); if (candidateSet != null && !candidateSet.isEmpty()) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } else { cl.validated(); if (cl.changeState(VALIDATION, newState)) { return cl; } else { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } } } catch (ResourceException re) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } } else { log.debug("mcf is not instance of ValidatingManagedConnectionFactory"); if (cl.changeState(VALIDATION, newState)) { return cl; } else { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } } return null; }
java
protected ConnectionListener validateConnectionListener(Collection<ConnectionListener> listeners, ConnectionListener cl, int newState) { ManagedConnectionFactory mcf = pool.getConnectionManager().getManagedConnectionFactory(); if (mcf instanceof ValidatingManagedConnectionFactory) { ValidatingManagedConnectionFactory vcf = (ValidatingManagedConnectionFactory)mcf; try { Set candidateSet = Collections.singleton(cl.getManagedConnection()); candidateSet = vcf.getInvalidConnections(candidateSet); if (candidateSet != null && !candidateSet.isEmpty()) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } else { cl.validated(); if (cl.changeState(VALIDATION, newState)) { return cl; } else { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } } } catch (ResourceException re) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } } else { log.debug("mcf is not instance of ValidatingManagedConnectionFactory"); if (cl.changeState(VALIDATION, newState)) { return cl; } else { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, false, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); destroyAndRemoveConnectionListener(cl, listeners); } } return null; }
[ "protected", "ConnectionListener", "validateConnectionListener", "(", "Collection", "<", "ConnectionListener", ">", "listeners", ",", "ConnectionListener", "cl", ",", "int", "newState", ")", "{", "ManagedConnectionFactory", "mcf", "=", "pool", ".", "getConnectionManager",...
Validate a connection listener @param listeners The listeners @param cl The connection listener @param newState The new state @return The validated connection listener, or <code>null</code> if validation failed
[ "Validate", "a", "connection", "listener" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java#L93-L158
135,451
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java
AbstractManagedConnectionPool.destroyAndRemoveConnectionListener
protected void destroyAndRemoveConnectionListener(ConnectionListener cl, Collection<ConnectionListener> listeners) { try { pool.destroyConnectionListener(cl); } catch (ResourceException e) { // TODO: cl.setState(ZOMBIE); } finally { listeners.remove(cl); } }
java
protected void destroyAndRemoveConnectionListener(ConnectionListener cl, Collection<ConnectionListener> listeners) { try { pool.destroyConnectionListener(cl); } catch (ResourceException e) { // TODO: cl.setState(ZOMBIE); } finally { listeners.remove(cl); } }
[ "protected", "void", "destroyAndRemoveConnectionListener", "(", "ConnectionListener", "cl", ",", "Collection", "<", "ConnectionListener", ">", "listeners", ")", "{", "try", "{", "pool", ".", "destroyConnectionListener", "(", "cl", ")", ";", "}", "catch", "(", "Res...
Destroy and remove a connection listener @param cl The connection listener @param listeners The listeners
[ "Destroy", "and", "remove", "a", "connection", "listener" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java#L165-L180
135,452
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java
AbstractManagedConnectionPool.findConnectionListener
protected ConnectionListener findConnectionListener(ManagedConnection mc, Object c, Collection<ConnectionListener> listeners) { for (ConnectionListener cl : listeners) { if (cl.getManagedConnection().equals(mc) && (c == null || cl.getConnections().contains(c))) return cl; } return null; }
java
protected ConnectionListener findConnectionListener(ManagedConnection mc, Object c, Collection<ConnectionListener> listeners) { for (ConnectionListener cl : listeners) { if (cl.getManagedConnection().equals(mc) && (c == null || cl.getConnections().contains(c))) return cl; } return null; }
[ "protected", "ConnectionListener", "findConnectionListener", "(", "ManagedConnection", "mc", ",", "Object", "c", ",", "Collection", "<", "ConnectionListener", ">", "listeners", ")", "{", "for", "(", "ConnectionListener", "cl", ":", "listeners", ")", "{", "if", "("...
Find a ConnectionListener instance @param mc The associated ManagedConnection @param c The connection (optional) @param listeners The listeners @return The ConnectionListener, or <code>null</code>
[ "Find", "a", "ConnectionListener", "instance" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java#L189-L199
135,453
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java
AbstractManagedConnectionPool.removeConnectionListener
protected ConnectionListener removeConnectionListener(boolean free, Collection<ConnectionListener> listeners) { if (free) { for (ConnectionListener cl : listeners) { if (cl.changeState(FREE, IN_USE)) return cl; } } else { for (ConnectionListener cl : listeners) { if (cl.getState() == IN_USE) return cl; } } return null; }
java
protected ConnectionListener removeConnectionListener(boolean free, Collection<ConnectionListener> listeners) { if (free) { for (ConnectionListener cl : listeners) { if (cl.changeState(FREE, IN_USE)) return cl; } } else { for (ConnectionListener cl : listeners) { if (cl.getState() == IN_USE) return cl; } } return null; }
[ "protected", "ConnectionListener", "removeConnectionListener", "(", "boolean", "free", ",", "Collection", "<", "ConnectionListener", ">", "listeners", ")", "{", "if", "(", "free", ")", "{", "for", "(", "ConnectionListener", "cl", ":", "listeners", ")", "{", "if"...
Remove a free ConnectionListener instance @param free True if FREE, false if IN_USE @param listeners The listeners @return The ConnectionListener, or <code>null</code>
[ "Remove", "a", "free", "ConnectionListener", "instance" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java#L207-L227
135,454
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/MetadataFactory.java
MetadataFactory.getStandardMetaData
public Connector getStandardMetaData(File root) throws Exception { Connector result = null; File metadataFile = new File(root, "/META-INF/ra.xml"); if (metadataFile.exists()) { InputStream input = null; String url = metadataFile.getAbsolutePath(); try { long start = System.currentTimeMillis(); input = new FileInputStream(metadataFile); XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(input); result = (new RaParser()).parse(xsr); log.debugf("Total parse for %s took %d ms", url, (System.currentTimeMillis() - start)); } catch (Exception e) { log.parsingErrorRaXml(url, e); throw e; } finally { if (input != null) input.close(); } } else { log.tracef("metadata file %s does not exist", metadataFile.toString()); } return result; }
java
public Connector getStandardMetaData(File root) throws Exception { Connector result = null; File metadataFile = new File(root, "/META-INF/ra.xml"); if (metadataFile.exists()) { InputStream input = null; String url = metadataFile.getAbsolutePath(); try { long start = System.currentTimeMillis(); input = new FileInputStream(metadataFile); XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(input); result = (new RaParser()).parse(xsr); log.debugf("Total parse for %s took %d ms", url, (System.currentTimeMillis() - start)); } catch (Exception e) { log.parsingErrorRaXml(url, e); throw e; } finally { if (input != null) input.close(); } } else { log.tracef("metadata file %s does not exist", metadataFile.toString()); } return result; }
[ "public", "Connector", "getStandardMetaData", "(", "File", "root", ")", "throws", "Exception", "{", "Connector", "result", "=", "null", ";", "File", "metadataFile", "=", "new", "File", "(", "root", ",", "\"/META-INF/ra.xml\"", ")", ";", "if", "(", "metadataFil...
Get the JCA standard metadata @param root The root of the deployment @return The metadata @exception Exception Thrown if an error occurs
[ "Get", "the", "JCA", "standard", "metadata" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/MetadataFactory.java#L62-L100
135,455
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/MetadataFactory.java
MetadataFactory.getIronJacamarMetaData
public Activation getIronJacamarMetaData(File root) throws Exception { Activation result = null; File metadataFile = new File(root, "/META-INF/ironjacamar.xml"); if (metadataFile.exists()) { InputStream input = null; String url = metadataFile.getAbsolutePath(); try { long start = System.currentTimeMillis(); input = new FileInputStream(metadataFile); XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(input); result = (new IronJacamarParser()).parse(xsr); log.debugf("Total parse for %s took %d ms", url, (System.currentTimeMillis() - start)); } catch (Exception e) { log.parsingErrorIronJacamarXml(url, e); throw e; } finally { if (input != null) input.close(); } } return result; }
java
public Activation getIronJacamarMetaData(File root) throws Exception { Activation result = null; File metadataFile = new File(root, "/META-INF/ironjacamar.xml"); if (metadataFile.exists()) { InputStream input = null; String url = metadataFile.getAbsolutePath(); try { long start = System.currentTimeMillis(); input = new FileInputStream(metadataFile); XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(input); result = (new IronJacamarParser()).parse(xsr); log.debugf("Total parse for %s took %d ms", url, (System.currentTimeMillis() - start)); } catch (Exception e) { log.parsingErrorIronJacamarXml(url, e); throw e; } finally { if (input != null) input.close(); } } return result; }
[ "public", "Activation", "getIronJacamarMetaData", "(", "File", "root", ")", "throws", "Exception", "{", "Activation", "result", "=", "null", ";", "File", "metadataFile", "=", "new", "File", "(", "root", ",", "\"/META-INF/ironjacamar.xml\"", ")", ";", "if", "(", ...
Get the IronJacamar specific metadata @param root The root of the deployment @return The metadata @exception Exception Thrown if an error occurs
[ "Get", "the", "IronJacamar", "specific", "metadata" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/MetadataFactory.java#L108-L143
135,456
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/spec/OutboundResourceAdapterImpl.java
OutboundResourceAdapterImpl.forceConnectionDefinitions
public synchronized void forceConnectionDefinitions(List<ConnectionDefinition> newContent) { if (newContent != null) { this.connectionDefinition = new ArrayList<ConnectionDefinition>(newContent); } else { this.connectionDefinition = new ArrayList<ConnectionDefinition>(0); } }
java
public synchronized void forceConnectionDefinitions(List<ConnectionDefinition> newContent) { if (newContent != null) { this.connectionDefinition = new ArrayList<ConnectionDefinition>(newContent); } else { this.connectionDefinition = new ArrayList<ConnectionDefinition>(0); } }
[ "public", "synchronized", "void", "forceConnectionDefinitions", "(", "List", "<", "ConnectionDefinition", ">", "newContent", ")", "{", "if", "(", "newContent", "!=", "null", ")", "{", "this", ".", "connectionDefinition", "=", "new", "ArrayList", "<", "ConnectionDe...
Force connectionDefinition with new content. This method is thread safe @param newContent the list of new properties
[ "Force", "connectionDefinition", "with", "new", "content", ".", "This", "method", "is", "thread", "safe" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/spec/OutboundResourceAdapterImpl.java#L113-L123
135,457
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/security/SecurityActions.java
SecurityActions.getResourceAsStream
static InputStream getResourceAsStream(final String name) { if (System.getSecurityManager() == null) return Thread.currentThread().getContextClassLoader().getResourceAsStream(name); return AccessController.doPrivileged(new PrivilegedAction<InputStream>() { public InputStream run() { return Thread.currentThread().getContextClassLoader().getResourceAsStream(name); } }); }
java
static InputStream getResourceAsStream(final String name) { if (System.getSecurityManager() == null) return Thread.currentThread().getContextClassLoader().getResourceAsStream(name); return AccessController.doPrivileged(new PrivilegedAction<InputStream>() { public InputStream run() { return Thread.currentThread().getContextClassLoader().getResourceAsStream(name); } }); }
[ "static", "InputStream", "getResourceAsStream", "(", "final", "String", "name", ")", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "return", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ...
Get the input stream for a resource in the context class loader @param name The name of the resource @return The input stream
[ "Get", "the", "input", "stream", "for", "a", "resource", "in", "the", "context", "class", "loader" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/security/SecurityActions.java#L46-L58
135,458
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/jgroups/SecurityActions.java
SecurityActions.createWorkClassLoader
static WorkClassLoader createWorkClassLoader(final ClassBundle cb) { return AccessController.doPrivileged(new PrivilegedAction<WorkClassLoader>() { public WorkClassLoader run() { return new WorkClassLoader(cb); } }); }
java
static WorkClassLoader createWorkClassLoader(final ClassBundle cb) { return AccessController.doPrivileged(new PrivilegedAction<WorkClassLoader>() { public WorkClassLoader run() { return new WorkClassLoader(cb); } }); }
[ "static", "WorkClassLoader", "createWorkClassLoader", "(", "final", "ClassBundle", "cb", ")", "{", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "WorkClassLoader", ">", "(", ")", "{", "public", "WorkClassLoader", "run", "(",...
Create a WorkClassLoader @param cb The class bundle @return The class loader
[ "Create", "a", "WorkClassLoader" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/jgroups/SecurityActions.java#L65-L74
135,459
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tracer/TraceEvent.java
TraceEvent.parse
public static TraceEvent parse(String data) { String[] raw = data.split("-"); String header = raw[0]; String p = raw[1]; String m = raw[2]; long tid = Long.parseLong(raw[3]); int t = Integer.parseInt(raw[4]); long ts = Long.parseLong(raw[5]); String c = raw[6]; String pyl = ""; String py2 = ""; if (raw.length >= 8) pyl = raw[7]; if (raw.length >= 9) py2 = raw[8]; return new TraceEvent(p, m, tid, t, ts, c, pyl, py2); }
java
public static TraceEvent parse(String data) { String[] raw = data.split("-"); String header = raw[0]; String p = raw[1]; String m = raw[2]; long tid = Long.parseLong(raw[3]); int t = Integer.parseInt(raw[4]); long ts = Long.parseLong(raw[5]); String c = raw[6]; String pyl = ""; String py2 = ""; if (raw.length >= 8) pyl = raw[7]; if (raw.length >= 9) py2 = raw[8]; return new TraceEvent(p, m, tid, t, ts, c, pyl, py2); }
[ "public", "static", "TraceEvent", "parse", "(", "String", "data", ")", "{", "String", "[", "]", "raw", "=", "data", ".", "split", "(", "\"-\"", ")", ";", "String", "header", "=", "raw", "[", "0", "]", ";", "String", "p", "=", "raw", "[", "1", "]"...
Parse a trace event @param data The data string @return The event
[ "Parse", "a", "trace", "event" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/TraceEvent.java#L453-L473
135,460
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnMetaCodeGen.java
ConnMetaCodeGen.writeEIS
private void writeEIS(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product name of the underlying EIS instance connected\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product name of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductName() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product version of the underlying EIS instance.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product version of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductVersion() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeEIS(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product name of the underlying EIS instance connected\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product name of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductName() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product version of the underlying EIS instance.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product version of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductVersion() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeEIS", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ...
Output eis info method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "eis", "info", "method" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnMetaCodeGen.java#L94-L123
135,461
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/bv/BeanValidationImpl.java
BeanValidationImpl.createValidatorFactory
static ValidatorFactory createValidatorFactory() { Configuration configuration = Validation.byDefaultProvider().configure(); Configuration<?> conf = configuration.traversableResolver(new IronJacamarTraversableResolver()); return conf.buildValidatorFactory(); }
java
static ValidatorFactory createValidatorFactory() { Configuration configuration = Validation.byDefaultProvider().configure(); Configuration<?> conf = configuration.traversableResolver(new IronJacamarTraversableResolver()); return conf.buildValidatorFactory(); }
[ "static", "ValidatorFactory", "createValidatorFactory", "(", ")", "{", "Configuration", "configuration", "=", "Validation", ".", "byDefaultProvider", "(", ")", ".", "configure", "(", ")", ";", "Configuration", "<", "?", ">", "conf", "=", "configuration", ".", "t...
Create a validator factory @return The factory
[ "Create", "a", "validator", "factory" ]
f0389ee7e62aa8b40ba09b251edad76d220ea796
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/bv/BeanValidationImpl.java#L81-L87
135,462
Backendless/Android-SDK
src/com/backendless/persistence/PagedQueryBuilder.java
PagedQueryBuilder.prepareNextPage
Builder prepareNextPage() { int offset = this.offset + pageSize; validateOffset( offset ); this.offset = offset; return builder; }
java
Builder prepareNextPage() { int offset = this.offset + pageSize; validateOffset( offset ); this.offset = offset; return builder; }
[ "Builder", "prepareNextPage", "(", ")", "{", "int", "offset", "=", "this", ".", "offset", "+", "pageSize", ";", "validateOffset", "(", "offset", ")", ";", "this", ".", "offset", "=", "offset", ";", "return", "builder", ";", "}" ]
Updates offset to point at next data page by adding pageSize.
[ "Updates", "offset", "to", "point", "at", "next", "data", "page", "by", "adding", "pageSize", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/PagedQueryBuilder.java#L36-L43
135,463
Backendless/Android-SDK
src/com/backendless/persistence/PagedQueryBuilder.java
PagedQueryBuilder.preparePreviousPage
Builder preparePreviousPage() { int offset = this.offset - pageSize; validateOffset( offset ); this.offset = offset; return builder; }
java
Builder preparePreviousPage() { int offset = this.offset - pageSize; validateOffset( offset ); this.offset = offset; return builder; }
[ "Builder", "preparePreviousPage", "(", ")", "{", "int", "offset", "=", "this", ".", "offset", "-", "pageSize", ";", "validateOffset", "(", "offset", ")", ";", "this", ".", "offset", "=", "offset", ";", "return", "builder", ";", "}" ]
Updates offset to point at previous data page by subtracting pageSize.
[ "Updates", "offset", "to", "point", "at", "previous", "data", "page", "by", "subtracting", "pageSize", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/PagedQueryBuilder.java#L48-L55
135,464
Backendless/Android-SDK
samples/UserService/userservicedemo/src/com/backendless/examples/userservice/demo/DefaultCallback.java
DefaultCallback.handleFault
@Override public void handleFault( BackendlessFault fault ) { progressDialog.cancel(); Toast.makeText( context, fault.getMessage(), Toast.LENGTH_SHORT ).show(); }
java
@Override public void handleFault( BackendlessFault fault ) { progressDialog.cancel(); Toast.makeText( context, fault.getMessage(), Toast.LENGTH_SHORT ).show(); }
[ "@", "Override", "public", "void", "handleFault", "(", "BackendlessFault", "fault", ")", "{", "progressDialog", ".", "cancel", "(", ")", ";", "Toast", ".", "makeText", "(", "context", ",", "fault", ".", "getMessage", "(", ")", ",", "Toast", ".", "LENGTH_SH...
This override is optional
[ "This", "override", "is", "optional" ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/samples/UserService/userservicedemo/src/com/backendless/examples/userservice/demo/DefaultCallback.java#L45-L50
135,465
Backendless/Android-SDK
src/com/backendless/persistence/BackendlessSerializer.java
BackendlessSerializer.serializeToMap
public static Map<String, Object> serializeToMap( Object entity ) { IObjectSerializer serializer = getSerializer( entity.getClass() ); return (Map<String, Object>) serializer.serializeToMap( entity, new HashMap<Object, Map<String, Object>>() ); }
java
public static Map<String, Object> serializeToMap( Object entity ) { IObjectSerializer serializer = getSerializer( entity.getClass() ); return (Map<String, Object>) serializer.serializeToMap( entity, new HashMap<Object, Map<String, Object>>() ); }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "serializeToMap", "(", "Object", "entity", ")", "{", "IObjectSerializer", "serializer", "=", "getSerializer", "(", "entity", ".", "getClass", "(", ")", ")", ";", "return", "(", "Map", "<", "Stri...
Serializes Object to Map using WebOrb's serializer. @param entity object to be serialized @return Map corresponding to given Object
[ "Serializes", "Object", "to", "Map", "using", "WebOrb", "s", "serializer", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/BackendlessSerializer.java#L53-L57
135,466
Backendless/Android-SDK
src/com/backendless/persistence/BackendlessSerializer.java
BackendlessSerializer.getSimpleName
public static String getSimpleName( Class clazz ) { IObjectSerializer serializer = getSerializer( clazz ); return serializer.getClassName( clazz ); }
java
public static String getSimpleName( Class clazz ) { IObjectSerializer serializer = getSerializer( clazz ); return serializer.getClassName( clazz ); }
[ "public", "static", "String", "getSimpleName", "(", "Class", "clazz", ")", "{", "IObjectSerializer", "serializer", "=", "getSerializer", "(", "clazz", ")", ";", "return", "serializer", ".", "getClassName", "(", "clazz", ")", ";", "}" ]
Uses pluggable serializers to locate one for the class and get the name which should be used for serialization. The name must match the table name where instance of clazz are persisted @param clazz @return Backendless-friendly class/table name
[ "Uses", "pluggable", "serializers", "to", "locate", "one", "for", "the", "class", "and", "get", "the", "name", "which", "should", "be", "used", "for", "serialization", ".", "The", "name", "must", "match", "the", "table", "name", "where", "instance", "of", ...
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/BackendlessSerializer.java#L66-L70
135,467
Backendless/Android-SDK
src/com/backendless/persistence/BackendlessSerializer.java
BackendlessSerializer.getOrMakeSerializedObject
private Object getOrMakeSerializedObject( Object entityEntryValue, Map<Object, Map<String, Object>> serializedCache ) { if( serializedCache.containsKey( entityEntryValue ) ) //cyclic relation { //take from cache and substitute return serializedCache.get( entityEntryValue ); } else //not cyclic relation { //serialize and put into result return serializeToMap( entityEntryValue, serializedCache ); } }
java
private Object getOrMakeSerializedObject( Object entityEntryValue, Map<Object, Map<String, Object>> serializedCache ) { if( serializedCache.containsKey( entityEntryValue ) ) //cyclic relation { //take from cache and substitute return serializedCache.get( entityEntryValue ); } else //not cyclic relation { //serialize and put into result return serializeToMap( entityEntryValue, serializedCache ); } }
[ "private", "Object", "getOrMakeSerializedObject", "(", "Object", "entityEntryValue", ",", "Map", "<", "Object", ",", "Map", "<", "String", ",", "Object", ">", ">", "serializedCache", ")", "{", "if", "(", "serializedCache", ".", "containsKey", "(", "entityEntryVa...
Returns serialized object from cache or serializes object if it's not present in cache. @param entityEntryValue object to be serialized @return Map formed from given object
[ "Returns", "serialized", "object", "from", "cache", "or", "serializes", "object", "if", "it", "s", "not", "present", "in", "cache", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/BackendlessSerializer.java#L214-L227
135,468
Backendless/Android-SDK
src/com/backendless/persistence/BackendlessSerializer.java
BackendlessSerializer.serializeUserProperties
public static void serializeUserProperties( BackendlessUser user ) { Map<String, Object> serializedProperties = user.getProperties(); Set<Map.Entry<String, Object>> properties = serializedProperties.entrySet(); for( Map.Entry<String, Object> property : properties ) { Object propertyValue = property.getValue(); if( propertyValue != null && !propertyValue.getClass().isArray() && !propertyValue.getClass().isEnum() && !isBelongsJdk( propertyValue.getClass() ) ) { property.setValue( serializeToMap( propertyValue ) ); } } user.setProperties( serializedProperties ); }
java
public static void serializeUserProperties( BackendlessUser user ) { Map<String, Object> serializedProperties = user.getProperties(); Set<Map.Entry<String, Object>> properties = serializedProperties.entrySet(); for( Map.Entry<String, Object> property : properties ) { Object propertyValue = property.getValue(); if( propertyValue != null && !propertyValue.getClass().isArray() && !propertyValue.getClass().isEnum() && !isBelongsJdk( propertyValue.getClass() ) ) { property.setValue( serializeToMap( propertyValue ) ); } } user.setProperties( serializedProperties ); }
[ "public", "static", "void", "serializeUserProperties", "(", "BackendlessUser", "user", ")", "{", "Map", "<", "String", ",", "Object", ">", "serializedProperties", "=", "user", ".", "getProperties", "(", ")", ";", "Set", "<", "Map", ".", "Entry", "<", "String...
Serializes entities inside BackendlessUser properties. @param user BackendlessUser whose properties need to be serialized
[ "Serializes", "entities", "inside", "BackendlessUser", "properties", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/BackendlessSerializer.java#L234-L249
135,469
Backendless/Android-SDK
src/com/backendless/persistence/BackendlessSerializer.java
BackendlessSerializer.getSerializer
private static IObjectSerializer getSerializer( Class clazz ) { Iterator<Map.Entry<Class, IObjectSerializer>> iterator = serializers.entrySet().iterator(); IObjectSerializer serializer = DEFAULT_SERIALIZER; while( iterator.hasNext() ) { Map.Entry<Class, IObjectSerializer> entry = iterator.next(); if( entry.getKey().isAssignableFrom( clazz ) ) { serializer = entry.getValue(); break; } } return serializer; }
java
private static IObjectSerializer getSerializer( Class clazz ) { Iterator<Map.Entry<Class, IObjectSerializer>> iterator = serializers.entrySet().iterator(); IObjectSerializer serializer = DEFAULT_SERIALIZER; while( iterator.hasNext() ) { Map.Entry<Class, IObjectSerializer> entry = iterator.next(); if( entry.getKey().isAssignableFrom( clazz ) ) { serializer = entry.getValue(); break; } } return serializer; }
[ "private", "static", "IObjectSerializer", "getSerializer", "(", "Class", "clazz", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "Class", ",", "IObjectSerializer", ">", ">", "iterator", "=", "serializers", ".", "entrySet", "(", ")", ".", "iterator", "(...
Returns a serializer for the class @param clazz @return
[ "Returns", "a", "serializer", "for", "the", "class" ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/persistence/BackendlessSerializer.java#L268-L285
135,470
Backendless/Android-SDK
src/com/backendless/UserService.java
UserService.setCurrentUser
public void setCurrentUser( BackendlessUser user ) { if( currentUser == null ) currentUser = user; else currentUser.setProperties( user.getProperties() ); }
java
public void setCurrentUser( BackendlessUser user ) { if( currentUser == null ) currentUser = user; else currentUser.setProperties( user.getProperties() ); }
[ "public", "void", "setCurrentUser", "(", "BackendlessUser", "user", ")", "{", "if", "(", "currentUser", "==", "null", ")", "currentUser", "=", "user", ";", "else", "currentUser", ".", "setProperties", "(", "user", ".", "getProperties", "(", ")", ")", ";", ...
Sets the properties of the given user to current one. @param user a user from which properties should be taken
[ "Sets", "the", "properties", "of", "the", "given", "user", "to", "current", "one", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/UserService.java#L803-L809
135,471
Backendless/Android-SDK
src/com/backendless/Messaging.java
Messaging.publish
public MessageStatus publish( String channelName, Object message ) { return publish( channelName, message, new PublishOptions() ); }
java
public MessageStatus publish( String channelName, Object message ) { return publish( channelName, message, new PublishOptions() ); }
[ "public", "MessageStatus", "publish", "(", "String", "channelName", ",", "Object", "message", ")", "{", "return", "publish", "(", "channelName", ",", "message", ",", "new", "PublishOptions", "(", ")", ")", ";", "}" ]
Publishes message to specified channel. The message is not a push notification, it does not have any headers and does not go into any subtopics. @param channelName name of a channel to publish the message to. If the channel does not exist, Backendless automatically creates it. @param message object to publish. The object can be of any data type - a primitive value, String, Date, a user-defined complex type, a collection or an array of these types. @return ${@link com.backendless.messaging.MessageStatus} - a data structure which contains ID of the published message and the status of the publish operation. @throws BackendlessException
[ "Publishes", "message", "to", "specified", "channel", ".", "The", "message", "is", "not", "a", "push", "notification", "it", "does", "not", "have", "any", "headers", "and", "does", "not", "go", "into", "any", "subtopics", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/Messaging.java#L288-L291
135,472
Backendless/Android-SDK
src/com/backendless/utils/ReflectionUtil.java
ReflectionUtil.getFieldValue
public static Object getFieldValue( Object object, String lowerKey, String upperKey ) //throws NoSuchFieldException { if( object == null ) return null; Method getMethod = getMethod( object, "get" + lowerKey ); if( getMethod == null ) getMethod = getMethod( object, "get" + upperKey ); if( getMethod == null ) getMethod = getMethod( object, "is" + lowerKey ); if( getMethod == null ) getMethod = getMethod( object, "is" + upperKey ); if( getMethod != null ) try { return getMethod.invoke( object, new Object[ 0 ] ); } catch( Throwable t ) { // ignore, see if can get it from the field } try { Field field = getField( object.getClass(), lowerKey ); field.setAccessible( true ); return field.get( object ); } catch( IllegalAccessException e ) { // shouldn't ever be thrown, because setAccessible(true) was called before return null; } catch( NoSuchFieldException e1 ) { try { Field field = getField( object.getClass(), upperKey ); field.setAccessible( true ); return field.get( object ); } catch( Throwable throwable ) { // ignore, the rest of the method will do other checks } //throw new BackendlessException( "Unable to retrieve value for field/property '" + lowerKey ); return null; } }
java
public static Object getFieldValue( Object object, String lowerKey, String upperKey ) //throws NoSuchFieldException { if( object == null ) return null; Method getMethod = getMethod( object, "get" + lowerKey ); if( getMethod == null ) getMethod = getMethod( object, "get" + upperKey ); if( getMethod == null ) getMethod = getMethod( object, "is" + lowerKey ); if( getMethod == null ) getMethod = getMethod( object, "is" + upperKey ); if( getMethod != null ) try { return getMethod.invoke( object, new Object[ 0 ] ); } catch( Throwable t ) { // ignore, see if can get it from the field } try { Field field = getField( object.getClass(), lowerKey ); field.setAccessible( true ); return field.get( object ); } catch( IllegalAccessException e ) { // shouldn't ever be thrown, because setAccessible(true) was called before return null; } catch( NoSuchFieldException e1 ) { try { Field field = getField( object.getClass(), upperKey ); field.setAccessible( true ); return field.get( object ); } catch( Throwable throwable ) { // ignore, the rest of the method will do other checks } //throw new BackendlessException( "Unable to retrieve value for field/property '" + lowerKey ); return null; } }
[ "public", "static", "Object", "getFieldValue", "(", "Object", "object", ",", "String", "lowerKey", ",", "String", "upperKey", ")", "//throws NoSuchFieldException", "{", "if", "(", "object", "==", "null", ")", "return", "null", ";", "Method", "getMethod", "=", ...
Retrieves the value of the field with given name from the given object. @param object object containing the field @param lowerKey name of the field starting with lower case letter @param upperKey name of the field starting with the upper case letter @return Object, which is the value of the given field in the given object; null, if for some reason setAccessible(true) didn't work @throws NoSuchFieldException if object doesn't have a field with such name
[ "Retrieves", "the", "value", "of", "the", "field", "with", "given", "name", "from", "the", "given", "object", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/utils/ReflectionUtil.java#L40-L93
135,473
Backendless/Android-SDK
src/com/backendless/utils/ReflectionUtil.java
ReflectionUtil.hasField
public static boolean hasField( Class clazz, String fieldName ) { try { clazz.getDeclaredField( fieldName ); return true; } catch( NoSuchFieldException nfe ) { if( clazz.getSuperclass() != null ) { return hasField( clazz.getSuperclass(), fieldName ); } else { return false; } } }
java
public static boolean hasField( Class clazz, String fieldName ) { try { clazz.getDeclaredField( fieldName ); return true; } catch( NoSuchFieldException nfe ) { if( clazz.getSuperclass() != null ) { return hasField( clazz.getSuperclass(), fieldName ); } else { return false; } } }
[ "public", "static", "boolean", "hasField", "(", "Class", "clazz", ",", "String", "fieldName", ")", "{", "try", "{", "clazz", ".", "getDeclaredField", "(", "fieldName", ")", ";", "return", "true", ";", "}", "catch", "(", "NoSuchFieldException", "nfe", ")", ...
Checks whether given class contains a field with given name. Recursively checks superclasses. @param clazz Class in which to search for a field @param fieldName name of the field @return {@code true} if given class or one of its superclasses contains field with given name, else {@code false}
[ "Checks", "whether", "given", "class", "contains", "a", "field", "with", "given", "name", ".", "Recursively", "checks", "superclasses", "." ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/utils/ReflectionUtil.java#L142-L160
135,474
Backendless/Android-SDK
src/com/backendless/servercode/extension/FilesExtender.java
FilesExtender.afterMoveToRepository
@Deprecated public void afterMoveToRepository( RunnerContext context, String fileUrlLocation, ExecutionResult<String> result ) throws Exception { }
java
@Deprecated public void afterMoveToRepository( RunnerContext context, String fileUrlLocation, ExecutionResult<String> result ) throws Exception { }
[ "@", "Deprecated", "public", "void", "afterMoveToRepository", "(", "RunnerContext", "context", ",", "String", "fileUrlLocation", ",", "ExecutionResult", "<", "String", ">", "result", ")", "throws", "Exception", "{", "}" ]
Use afterUpload method @param context @param fileUrlLocation @param result @throws Exception
[ "Use", "afterUpload", "method" ]
3af1e9a378f19d890db28a833f7fc8595b924cc3
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/servercode/extension/FilesExtender.java#L54-L57
135,475
shapesecurity/shape-functional-java
src/main/java/com/shapesecurity/functional/data/ImmutableSet.java
ImmutableSet.toList
@Nonnull public ImmutableList<T> toList() { return this.foldAbelian((v, acc) -> acc.cons(v), ImmutableList.empty()); }
java
@Nonnull public ImmutableList<T> toList() { return this.foldAbelian((v, acc) -> acc.cons(v), ImmutableList.empty()); }
[ "@", "Nonnull", "public", "ImmutableList", "<", "T", ">", "toList", "(", ")", "{", "return", "this", ".", "foldAbelian", "(", "(", "v", ",", "acc", ")", "->", "acc", ".", "cons", "(", "v", ")", ",", "ImmutableList", ".", "empty", "(", ")", ")", "...
Does not guarantee ordering of elements in resulting list.
[ "Does", "not", "guarantee", "ordering", "of", "elements", "in", "resulting", "list", "." ]
02edea5a901b8603f6a852478ec009857fa012d6
https://github.com/shapesecurity/shape-functional-java/blob/02edea5a901b8603f6a852478ec009857fa012d6/src/main/java/com/shapesecurity/functional/data/ImmutableSet.java#L146-L149
135,476
eclecticlogic/pedal-dialect
src/main/java/com/eclecticlogic/pedal/provider/hibernate/ArrayType.java
ArrayType.setArrayValue
protected void setArrayValue(final PreparedStatement statement, final int i, Connection connection, Object[] array) throws SQLException { if (array == null || (isEmptyStoredAsNull() && array.length == 0)) { statement.setNull(i, Types.ARRAY); } else { statement.setArray(i, connection.createArrayOf(getDialectPrimitiveName(), array)); } }
java
protected void setArrayValue(final PreparedStatement statement, final int i, Connection connection, Object[] array) throws SQLException { if (array == null || (isEmptyStoredAsNull() && array.length == 0)) { statement.setNull(i, Types.ARRAY); } else { statement.setArray(i, connection.createArrayOf(getDialectPrimitiveName(), array)); } }
[ "protected", "void", "setArrayValue", "(", "final", "PreparedStatement", "statement", ",", "final", "int", "i", ",", "Connection", "connection", ",", "Object", "[", "]", "array", ")", "throws", "SQLException", "{", "if", "(", "array", "==", "null", "||", "("...
Stores the array conforming to the EMPTY_IS_NULL directive. @see org.hibernate.usertype.UserType#nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int, org.hibernate.engine.spi.SessionImplementor)
[ "Stores", "the", "array", "conforming", "to", "the", "EMPTY_IS_NULL", "directive", "." ]
d92ccff34ef2363ce0db7ae4976302833182115b
https://github.com/eclecticlogic/pedal-dialect/blob/d92ccff34ef2363ce0db7ae4976302833182115b/src/main/java/com/eclecticlogic/pedal/provider/hibernate/ArrayType.java#L64-L71
135,477
shapesecurity/shape-functional-java
src/main/java/com/shapesecurity/functional/data/ImmutableList.java
ImmutableList.toArrayList
@Nonnull public final ArrayList<A> toArrayList() { ArrayList<A> list = new ArrayList<>(this.length); ImmutableList<A> l = this; for (int i = 0; i < length; i++) { list.add(((NonEmptyImmutableList<A>) l).head); l = ((NonEmptyImmutableList<A>) l).tail; } return list; }
java
@Nonnull public final ArrayList<A> toArrayList() { ArrayList<A> list = new ArrayList<>(this.length); ImmutableList<A> l = this; for (int i = 0; i < length; i++) { list.add(((NonEmptyImmutableList<A>) l).head); l = ((NonEmptyImmutableList<A>) l).tail; } return list; }
[ "@", "Nonnull", "public", "final", "ArrayList", "<", "A", ">", "toArrayList", "(", ")", "{", "ArrayList", "<", "A", ">", "list", "=", "new", "ArrayList", "<>", "(", "this", ".", "length", ")", ";", "ImmutableList", "<", "A", ">", "l", "=", "this", ...
Converts this list into a java.util.ArrayList. @return The list that contains the elements.
[ "Converts", "this", "list", "into", "a", "java", ".", "util", ".", "ArrayList", "." ]
02edea5a901b8603f6a852478ec009857fa012d6
https://github.com/shapesecurity/shape-functional-java/blob/02edea5a901b8603f6a852478ec009857fa012d6/src/main/java/com/shapesecurity/functional/data/ImmutableList.java#L487-L496
135,478
shapesecurity/shape-functional-java
src/main/java/com/shapesecurity/functional/data/ImmutableList.java
ImmutableList.toLinkedList
@Nonnull public final LinkedList<A> toLinkedList() { LinkedList<A> list = new LinkedList<>(); ImmutableList<A> l = this; for (int i = 0; i < length; i++) { list.add(((NonEmptyImmutableList<A>) l).head); l = ((NonEmptyImmutableList<A>) l).tail; } return list; }
java
@Nonnull public final LinkedList<A> toLinkedList() { LinkedList<A> list = new LinkedList<>(); ImmutableList<A> l = this; for (int i = 0; i < length; i++) { list.add(((NonEmptyImmutableList<A>) l).head); l = ((NonEmptyImmutableList<A>) l).tail; } return list; }
[ "@", "Nonnull", "public", "final", "LinkedList", "<", "A", ">", "toLinkedList", "(", ")", "{", "LinkedList", "<", "A", ">", "list", "=", "new", "LinkedList", "<>", "(", ")", ";", "ImmutableList", "<", "A", ">", "l", "=", "this", ";", "for", "(", "i...
Converts this list into a java.util.LinkedList. @return The list that contains the elements.
[ "Converts", "this", "list", "into", "a", "java", ".", "util", ".", "LinkedList", "." ]
02edea5a901b8603f6a852478ec009857fa012d6
https://github.com/shapesecurity/shape-functional-java/blob/02edea5a901b8603f6a852478ec009857fa012d6/src/main/java/com/shapesecurity/functional/data/ImmutableList.java#L503-L512
135,479
att/AAF
cadi/client/src/main/java/com/att/cadi/client/AAFClient.java
AAFClient.read
public<T> Get<T> read(Class<T> cls) throws APIException { return new Get<T>(this,getDF(cls)); }
java
public<T> Get<T> read(Class<T> cls) throws APIException { return new Get<T>(this,getDF(cls)); }
[ "public", "<", "T", ">", "Get", "<", "T", ">", "read", "(", "Class", "<", "T", ">", "cls", ")", "throws", "APIException", "{", "return", "new", "Get", "<", "T", ">", "(", "this", ",", "getDF", "(", "cls", ")", ")", ";", "}" ]
Returns a Get Object... same as "get" @param cls @return @throws APIException
[ "Returns", "a", "Get", "Object", "...", "same", "as", "get" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/AAFClient.java#L93-L95
135,480
att/AAF
cadi/client/src/main/java/com/att/cadi/client/AAFClient.java
AAFClient.get
public<T> Get<T> get(Class<T> cls) throws APIException { return new Get<T>(this,getDF(cls)); }
java
public<T> Get<T> get(Class<T> cls) throws APIException { return new Get<T>(this,getDF(cls)); }
[ "public", "<", "T", ">", "Get", "<", "T", ">", "get", "(", "Class", "<", "T", ">", "cls", ")", "throws", "APIException", "{", "return", "new", "Get", "<", "T", ">", "(", "this", ",", "getDF", "(", "cls", ")", ")", ";", "}" ]
Returns a Get Object... same as "read" @param cls @return @throws APIException
[ "Returns", "a", "Get", "Object", "...", "same", "as", "read" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/AAFClient.java#L104-L106
135,481
att/AAF
cadi/client/src/main/java/com/att/cadi/client/AAFClient.java
AAFClient.post
public<T> Post<T> post(Class<T> cls) throws APIException { return new Post<T>(this,getDF(cls)); }
java
public<T> Post<T> post(Class<T> cls) throws APIException { return new Post<T>(this,getDF(cls)); }
[ "public", "<", "T", ">", "Post", "<", "T", ">", "post", "(", "Class", "<", "T", ">", "cls", ")", "throws", "APIException", "{", "return", "new", "Post", "<", "T", ">", "(", "this", ",", "getDF", "(", "cls", ")", ")", ";", "}" ]
Returns a Post Object... same as "create" @param cls @return @throws APIException
[ "Returns", "a", "Post", "Object", "...", "same", "as", "create" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/AAFClient.java#L115-L117
135,482
att/AAF
cadi/client/src/main/java/com/att/cadi/client/AAFClient.java
AAFClient.create
public<T> Post<T> create(Class<T> cls) throws APIException { return new Post<T>(this,getDF(cls)); }
java
public<T> Post<T> create(Class<T> cls) throws APIException { return new Post<T>(this,getDF(cls)); }
[ "public", "<", "T", ">", "Post", "<", "T", ">", "create", "(", "Class", "<", "T", ">", "cls", ")", "throws", "APIException", "{", "return", "new", "Post", "<", "T", ">", "(", "this", ",", "getDF", "(", "cls", ")", ")", ";", "}" ]
Returns a Post Object... same as "post" @param cls @return @throws APIException
[ "Returns", "a", "Post", "Object", "...", "same", "as", "post" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/AAFClient.java#L126-L128
135,483
att/AAF
cadi/client/src/main/java/com/att/cadi/client/AAFClient.java
AAFClient.put
public<T> Put<T> put(Class<T> cls) throws APIException { return new Put<T>(this,getDF(cls)); }
java
public<T> Put<T> put(Class<T> cls) throws APIException { return new Put<T>(this,getDF(cls)); }
[ "public", "<", "T", ">", "Put", "<", "T", ">", "put", "(", "Class", "<", "T", ">", "cls", ")", "throws", "APIException", "{", "return", "new", "Put", "<", "T", ">", "(", "this", ",", "getDF", "(", "cls", ")", ")", ";", "}" ]
Returns a Put Object... same as "update" @param cls @return @throws APIException
[ "Returns", "a", "Put", "Object", "...", "same", "as", "update" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/AAFClient.java#L137-L139
135,484
att/AAF
cadi/client/src/main/java/com/att/cadi/client/AAFClient.java
AAFClient.update
public<T> Put<T> update(Class<T> cls) throws APIException { return new Put<T>(this,getDF(cls)); }
java
public<T> Put<T> update(Class<T> cls) throws APIException { return new Put<T>(this,getDF(cls)); }
[ "public", "<", "T", ">", "Put", "<", "T", ">", "update", "(", "Class", "<", "T", ">", "cls", ")", "throws", "APIException", "{", "return", "new", "Put", "<", "T", ">", "(", "this", ",", "getDF", "(", "cls", ")", ")", ";", "}" ]
Returns a Put Object... same as "put" @param cls @return @throws APIException
[ "Returns", "a", "Put", "Object", "...", "same", "as", "put" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/AAFClient.java#L148-L150
135,485
att/AAF
cadi/client/src/main/java/com/att/cadi/client/AAFClient.java
AAFClient.delete
public<T> Delete<T> delete(Class<T> cls) throws APIException { return new Delete<T>(this,getDF(cls)); }
java
public<T> Delete<T> delete(Class<T> cls) throws APIException { return new Delete<T>(this,getDF(cls)); }
[ "public", "<", "T", ">", "Delete", "<", "T", ">", "delete", "(", "Class", "<", "T", ">", "cls", ")", "throws", "APIException", "{", "return", "new", "Delete", "<", "T", ">", "(", "this", ",", "getDF", "(", "cls", ")", ")", ";", "}" ]
Returns a Delete Object @param cls @return @throws APIException
[ "Returns", "a", "Delete", "Object" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/client/AAFClient.java#L159-L161
135,486
att/AAF
cadi/core/src/main/java/com/att/cadi/CadiWrap.java
CadiWrap.set
public void set(TafResp tafResp, Lur lur) { principal = tafResp.getPrincipal(); access = tafResp.getAccess(); this.lur = lur; }
java
public void set(TafResp tafResp, Lur lur) { principal = tafResp.getPrincipal(); access = tafResp.getAccess(); this.lur = lur; }
[ "public", "void", "set", "(", "TafResp", "tafResp", ",", "Lur", "lur", ")", "{", "principal", "=", "tafResp", ".", "getPrincipal", "(", ")", ";", "access", "=", "tafResp", ".", "getAccess", "(", ")", ";", "this", ".", "lur", "=", "lur", ";", "}" ]
Allow setting of tafResp and lur after construction This can happen if the CadiWrap is constructed in a Valve other than CadiValve
[ "Allow", "setting", "of", "tafResp", "and", "lur", "after", "construction" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/CadiWrap.java#L132-L136
135,487
att/AAF
cadi/core/src/main/java/com/att/cadi/CadiWrap.java
CadiWrap.invalidate
public void invalidate(String id) { if(lur instanceof EpiLur) { ((EpiLur)lur).remove(id); } else if(lur instanceof CachingLur) { ((CachingLur<?>)lur).remove(id); } }
java
public void invalidate(String id) { if(lur instanceof EpiLur) { ((EpiLur)lur).remove(id); } else if(lur instanceof CachingLur) { ((CachingLur<?>)lur).remove(id); } }
[ "public", "void", "invalidate", "(", "String", "id", ")", "{", "if", "(", "lur", "instanceof", "EpiLur", ")", "{", "(", "(", "EpiLur", ")", "lur", ")", ".", "remove", "(", "id", ")", ";", "}", "else", "if", "(", "lur", "instanceof", "CachingLur", "...
Add a feature
[ "Add", "a", "feature" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/CadiWrap.java#L163-L169
135,488
att/AAF
cadi/client/src/main/java/com/att/cadi/http/HMangr.java
HMangr.same
public<RET> RET same(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws APIException, CadiException, LocatorException { RET ret = null; boolean retry = true; int retries = 0; Rcli<HttpURLConnection> client = retryable.lastClient(); try { do { // if no previous state, get the best if(retryable.item()==null) { retryable.item(loc.best()); retryable.lastClient = null; } if(client==null) { Item item = retryable.item(); URI uri=loc.get(item); if(uri==null) { loc.invalidate(retryable.item()); if(loc.hasItems()) { retryable.item(loc.next(retryable.item())); continue; } else { throw new LocatorException("No clients available for " + loc.toString()); } } client = new HRcli(this, uri,item,ss) .connectionTimeout(connectionTimeout) .readTimeout(readTimeout) .apiVersion(apiVersion); } else { client.setSecuritySetter(ss); } retry = false; try { ret = retryable.code(client); } catch (APIException | CadiException e) { Item item = retryable.item(); loc.invalidate(item); retryable.item(loc.next(item)); try { Throwable ec = e.getCause(); if(ec instanceof java.net.ConnectException) { if(client!=null && ++retries<2) { access.log(Level.WARN,"Connection refused, trying next available service"); retry = true; } else { throw new CadiException("Connection refused, no more available connections to try"); } } else if(ec instanceof SSLHandshakeException) { retryable.item(null); throw e; } else if(ec instanceof SocketException) { if("java.net.SocketException: Connection reset".equals(ec.getMessage())) { access.log(Level.ERROR, ec.getMessage(), " can mean Certificate Expiration or TLS Protocol issues"); } retryable.item(null); throw e; } else { retryable.item(null); throw e; } } finally { client = null; } } catch (ConnectException e) { Item item = retryable.item(); loc.invalidate(item); retryable.item(loc.next(item)); } } while(retry); } finally { retryable.lastClient = client; } return ret; }
java
public<RET> RET same(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws APIException, CadiException, LocatorException { RET ret = null; boolean retry = true; int retries = 0; Rcli<HttpURLConnection> client = retryable.lastClient(); try { do { // if no previous state, get the best if(retryable.item()==null) { retryable.item(loc.best()); retryable.lastClient = null; } if(client==null) { Item item = retryable.item(); URI uri=loc.get(item); if(uri==null) { loc.invalidate(retryable.item()); if(loc.hasItems()) { retryable.item(loc.next(retryable.item())); continue; } else { throw new LocatorException("No clients available for " + loc.toString()); } } client = new HRcli(this, uri,item,ss) .connectionTimeout(connectionTimeout) .readTimeout(readTimeout) .apiVersion(apiVersion); } else { client.setSecuritySetter(ss); } retry = false; try { ret = retryable.code(client); } catch (APIException | CadiException e) { Item item = retryable.item(); loc.invalidate(item); retryable.item(loc.next(item)); try { Throwable ec = e.getCause(); if(ec instanceof java.net.ConnectException) { if(client!=null && ++retries<2) { access.log(Level.WARN,"Connection refused, trying next available service"); retry = true; } else { throw new CadiException("Connection refused, no more available connections to try"); } } else if(ec instanceof SSLHandshakeException) { retryable.item(null); throw e; } else if(ec instanceof SocketException) { if("java.net.SocketException: Connection reset".equals(ec.getMessage())) { access.log(Level.ERROR, ec.getMessage(), " can mean Certificate Expiration or TLS Protocol issues"); } retryable.item(null); throw e; } else { retryable.item(null); throw e; } } finally { client = null; } } catch (ConnectException e) { Item item = retryable.item(); loc.invalidate(item); retryable.item(loc.next(item)); } } while(retry); } finally { retryable.lastClient = client; } return ret; }
[ "public", "<", "RET", ">", "RET", "same", "(", "SecuritySetter", "<", "HttpURLConnection", ">", "ss", ",", "Retryable", "<", "RET", ">", "retryable", ")", "throws", "APIException", ",", "CadiException", ",", "LocatorException", "{", "RET", "ret", "=", "null"...
Reuse the same service. This is helpful for multiple calls that change service side cached data so that there is not a speed issue. If the service goes down, another service will be substituted, if available. @param access @param loc @param ss @param item @param retryable @return @throws URISyntaxException @throws Exception
[ "Reuse", "the", "same", "service", ".", "This", "is", "helpful", "for", "multiple", "calls", "that", "change", "service", "side", "cached", "data", "so", "that", "there", "is", "not", "a", "speed", "issue", "." ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/client/src/main/java/com/att/cadi/http/HMangr.java#L53-L127
135,489
att/AAF
authz/authz-cass/src/main/java/com/att/dao/aaf/cass/CacheableData.java
CacheableData.seg
protected int seg(Cached<?,?> cache, Object ... fields) { return cache==null?0:cache.invalidate(CachedDAO.keyFromObjs(fields)); }
java
protected int seg(Cached<?,?> cache, Object ... fields) { return cache==null?0:cache.invalidate(CachedDAO.keyFromObjs(fields)); }
[ "protected", "int", "seg", "(", "Cached", "<", "?", ",", "?", ">", "cache", ",", "Object", "...", "fields", ")", "{", "return", "cache", "==", "null", "?", "0", ":", "cache", ".", "invalidate", "(", "CachedDAO", ".", "keyFromObjs", "(", "fields", ")"...
be treated by system as fields expected in Tables
[ "be", "treated", "by", "system", "as", "fields", "expected", "in", "Tables" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cass/CacheableData.java#L13-L15
135,490
att/AAF
authz/authz-cass/src/main/java/com/att/dao/CassDAOImpl.java
CassDAOImpl.create
public Result<DATA> create(TRANS trans, DATA data) { if(createPS==null) { Result.err(Result.ERR_NotImplemented,"Create is disabled for %s",getClass().getSimpleName()); } if(async) /*ResultSetFuture */ { Result<ResultSetFuture> rs = createPS.execAsync(trans, C_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } else { Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } wasModified(trans, CRUD.create, data); return Result.ok(data); }
java
public Result<DATA> create(TRANS trans, DATA data) { if(createPS==null) { Result.err(Result.ERR_NotImplemented,"Create is disabled for %s",getClass().getSimpleName()); } if(async) /*ResultSetFuture */ { Result<ResultSetFuture> rs = createPS.execAsync(trans, C_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } else { Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } wasModified(trans, CRUD.create, data); return Result.ok(data); }
[ "public", "Result", "<", "DATA", ">", "create", "(", "TRANS", "trans", ",", "DATA", "data", ")", "{", "if", "(", "createPS", "==", "null", ")", "{", "Result", ".", "err", "(", "Result", ".", "ERR_NotImplemented", ",", "\"Create is disabled for %s\"", ",", ...
Given a DATA object, extract the individual elements from the Data into an Object Array for the execute element.
[ "Given", "a", "DATA", "object", "extract", "the", "individual", "elements", "from", "the", "Data", "into", "an", "Object", "Array", "for", "the", "execute", "element", "." ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/CassDAOImpl.java#L166-L183
135,491
att/AAF
authz/authz-cass/src/main/java/com/att/dao/CassDAOImpl.java
CassDAOImpl.read
public Result<List<DATA>> read(TRANS trans, DATA data) { if(readPS==null) { Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName()); } return readPS.read(trans, R_TEXT, data); }
java
public Result<List<DATA>> read(TRANS trans, DATA data) { if(readPS==null) { Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName()); } return readPS.read(trans, R_TEXT, data); }
[ "public", "Result", "<", "List", "<", "DATA", ">", ">", "read", "(", "TRANS", "trans", ",", "DATA", "data", ")", "{", "if", "(", "readPS", "==", "null", ")", "{", "Result", ".", "err", "(", "Result", ".", "ERR_NotImplemented", ",", "\"Read is disabled ...
Read the Unique Row associated with Full Keys
[ "Read", "the", "Unique", "Row", "associated", "with", "Full", "Keys" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/CassDAOImpl.java#L188-L193
135,492
att/AAF
authz/authz-cass/src/main/java/com/att/dao/CassDAOImpl.java
CassDAOImpl.delete
public Result<Void> delete(TRANS trans, DATA data, boolean reread) { if(deletePS==null) { Result.err(Result.ERR_NotImplemented,"Delete is disabled for %s",getClass().getSimpleName()); } // Since Deleting will be stored off, for possible re-constitution, need the whole thing if(reread) { Result<List<DATA>> rd = read(trans,data); if(rd.notOK()) { return Result.err(rd); } if(rd.isEmpty()) { return Result.err(Status.ERR_NotFound,"Not Found"); } for(DATA d : rd.value) { if(async) { Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, d); if(rs.notOK()) { return Result.err(rs); } } else { Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, d); if(rs.notOK()) { return Result.err(rs); } } wasModified(trans, CRUD.delete, d); } } else { if(async)/* ResultSet rs =*/ { Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } else { Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } wasModified(trans, CRUD.delete, data); } return Result.ok(); }
java
public Result<Void> delete(TRANS trans, DATA data, boolean reread) { if(deletePS==null) { Result.err(Result.ERR_NotImplemented,"Delete is disabled for %s",getClass().getSimpleName()); } // Since Deleting will be stored off, for possible re-constitution, need the whole thing if(reread) { Result<List<DATA>> rd = read(trans,data); if(rd.notOK()) { return Result.err(rd); } if(rd.isEmpty()) { return Result.err(Status.ERR_NotFound,"Not Found"); } for(DATA d : rd.value) { if(async) { Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, d); if(rs.notOK()) { return Result.err(rs); } } else { Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, d); if(rs.notOK()) { return Result.err(rs); } } wasModified(trans, CRUD.delete, d); } } else { if(async)/* ResultSet rs =*/ { Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } else { Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, data); if(rs.notOK()) { return Result.err(rs); } } wasModified(trans, CRUD.delete, data); } return Result.ok(); }
[ "public", "Result", "<", "Void", ">", "delete", "(", "TRANS", "trans", ",", "DATA", "data", ",", "boolean", "reread", ")", "{", "if", "(", "deletePS", "==", "null", ")", "{", "Result", ".", "err", "(", "Result", ".", "ERR_NotImplemented", ",", "\"Delet...
This method Sig for Cached...
[ "This", "method", "Sig", "for", "Cached", "..." ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/CassDAOImpl.java#L223-L265
135,493
att/AAF
authz/authz-batch/src/main/java/com/att/authz/helpers/Notification.java
Notification.update
private String update() { // If this has been done before, there is no change in checkSum and the last time notified is within GracePeriod if(checksum!=0 && checksum()==checksum && now < last.getTime()+graceEnds && now > last.getTime()+lastdays) { return null; } else { return "UPDATE authz.notify SET last = '" + Chrono.dateOnlyStamp(last) + "', checksum=" + current + " WHERE user='" + user + "' AND type=" + type.getValue() + ";"; } }
java
private String update() { // If this has been done before, there is no change in checkSum and the last time notified is within GracePeriod if(checksum!=0 && checksum()==checksum && now < last.getTime()+graceEnds && now > last.getTime()+lastdays) { return null; } else { return "UPDATE authz.notify SET last = '" + Chrono.dateOnlyStamp(last) + "', checksum=" + current + " WHERE user='" + user + "' AND type=" + type.getValue() + ";"; } }
[ "private", "String", "update", "(", ")", "{", "// If this has been done before, there is no change in checkSum and the last time notified is within GracePeriod", "if", "(", "checksum", "!=", "0", "&&", "checksum", "(", ")", "==", "checksum", "&&", "now", "<", "last", ".",...
Returns an Update String for CQL if there is data. Returns null if nothing to update @return
[ "Returns", "an", "Update", "String", "for", "CQL", "if", "there", "is", "data", "." ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-batch/src/main/java/com/att/authz/helpers/Notification.java#L247-L262
135,494
att/AAF
cadi/core/src/main/java/com/att/cadi/AbsUserCache.java
AbsUserCache.addUser
protected void addUser(String key, User<PERM> user) { userMap.put(key, user); }
java
protected void addUser(String key, User<PERM> user) { userMap.put(key, user); }
[ "protected", "void", "addUser", "(", "String", "key", ",", "User", "<", "PERM", ">", "user", ")", "{", "userMap", ".", "put", "(", "key", ",", "user", ")", ";", "}" ]
Useful for looking up by WebToken, etc.
[ "Useful", "for", "looking", "up", "by", "WebToken", "etc", "." ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/AbsUserCache.java#L78-L80
135,495
att/AAF
cadi/core/src/main/java/com/att/cadi/AbsUserCache.java
AbsUserCache.addMiss
protected boolean addMiss(String key, byte[] bs) { Miss miss = missMap.get(key); if(miss==null) { synchronized(missMap) { missMap.put(key, new Miss(bs,clean==null?MIN_INTERVAL:clean.timeInterval)); } return true; } return miss.add(bs); }
java
protected boolean addMiss(String key, byte[] bs) { Miss miss = missMap.get(key); if(miss==null) { synchronized(missMap) { missMap.put(key, new Miss(bs,clean==null?MIN_INTERVAL:clean.timeInterval)); } return true; } return miss.add(bs); }
[ "protected", "boolean", "addMiss", "(", "String", "key", ",", "byte", "[", "]", "bs", ")", "{", "Miss", "miss", "=", "missMap", ".", "get", "(", "key", ")", ";", "if", "(", "miss", "==", "null", ")", "{", "synchronized", "(", "missMap", ")", "{", ...
Add miss to missMap. If Miss exists, or too many tries, returns false. otherwise, returns true to allow another attempt. @param key @param bs @return
[ "Add", "miss", "to", "missMap", ".", "If", "Miss", "exists", "or", "too", "many", "tries", "returns", "false", "." ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/AbsUserCache.java#L91-L100
135,496
att/AAF
cadi/core/src/main/java/com/att/cadi/AbsUserCache.java
AbsUserCache.remove
public void remove(String user) { Object o = userMap.remove(user); if(o!=null) { access.log(Level.INFO, user,"removed from Client Cache by Request"); } }
java
public void remove(String user) { Object o = userMap.remove(user); if(o!=null) { access.log(Level.INFO, user,"removed from Client Cache by Request"); } }
[ "public", "void", "remove", "(", "String", "user", ")", "{", "Object", "o", "=", "userMap", ".", "remove", "(", "user", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "access", ".", "log", "(", "Level", ".", "INFO", ",", "user", ",", "\"remove...
Removes user from the Cache @param user
[ "Removes", "user", "from", "the", "Cache" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/AbsUserCache.java#L131-L136
135,497
att/AAF
authz/authz-cass/src/main/java/com/att/dao/CachedDAO.java
CachedDAO.read
public Result<List<DATA>> read(final String key, final TRANS trans, final Object ... objs) { DAOGetter getter = new DAOGetter(trans,dao,objs); return get(trans, key, getter); // if(ld!=null) { // return Result.ok(ld);//.emptyList(ld.isEmpty()); // } // // Result Result if exists // if(getter.result==null) { // return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table()); // } // return getter.result; }
java
public Result<List<DATA>> read(final String key, final TRANS trans, final Object ... objs) { DAOGetter getter = new DAOGetter(trans,dao,objs); return get(trans, key, getter); // if(ld!=null) { // return Result.ok(ld);//.emptyList(ld.isEmpty()); // } // // Result Result if exists // if(getter.result==null) { // return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table()); // } // return getter.result; }
[ "public", "Result", "<", "List", "<", "DATA", ">", ">", "read", "(", "final", "String", "key", ",", "final", "TRANS", "trans", ",", "final", "Object", "...", "objs", ")", "{", "DAOGetter", "getter", "=", "new", "DAOGetter", "(", "trans", ",", "dao", ...
Slight Improved performance available when String and Obj versions are known.
[ "Slight", "Improved", "performance", "available", "when", "String", "and", "Obj", "versions", "are", "known", "." ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/CachedDAO.java#L141-L152
135,498
att/AAF
cadi/core/src/main/java/com/att/cadi/principal/TGuardPrincipal.java
TGuardPrincipal.get
public String get(String key) { if(key==null)return null; int idx=0,equal=0,amp=0; while(idx>=0 && (equal = tresp.indexOf('=',idx))>=0) { amp = tresp.indexOf('&',equal); if(key.regionMatches(0, tresp, idx, equal-idx)) { return amp>=0?tresp.substring(equal+1, amp):tresp.substring(equal+1); } idx=amp+(amp>0?1:0); } return null; }
java
public String get(String key) { if(key==null)return null; int idx=0,equal=0,amp=0; while(idx>=0 && (equal = tresp.indexOf('=',idx))>=0) { amp = tresp.indexOf('&',equal); if(key.regionMatches(0, tresp, idx, equal-idx)) { return amp>=0?tresp.substring(equal+1, amp):tresp.substring(equal+1); } idx=amp+(amp>0?1:0); } return null; }
[ "public", "String", "get", "(", "String", "key", ")", "{", "if", "(", "key", "==", "null", ")", "return", "null", ";", "int", "idx", "=", "0", ",", "equal", "=", "0", ",", "amp", "=", "0", ";", "while", "(", "idx", ">=", "0", "&&", "(", "equa...
Get a value from a named TGuard Property TGuard response info is very dynamic. They can add new properties at any time, so we dare not code field names for these values. @param key @return
[ "Get", "a", "value", "from", "a", "named", "TGuard", "Property" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/principal/TGuardPrincipal.java#L45-L56
135,499
att/AAF
authz/authz-service/src/main/java/com/att/authz/service/api/API_Creds.java
API_Creds.timeSensitiveInit
public static void timeSensitiveInit(Env env, AuthAPI authzAPI, AuthzFacade facade, final DirectAAFUserPass directAAFUserPass) throws Exception { /** * Basic Auth, quick Validation * * Responds OK or NotAuthorized */ authzAPI.route(env, HttpMethods.GET, "/authn/basicAuth", new Code(facade,"Is given BasicAuth valid?",true) { @Override public void handle( AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Principal p = trans.getUserPrincipal(); if (p instanceof BasicPrincipal) { // the idea is that if call is made with this credential, and it's a BasicPrincipal, it's ok // otherwise, it wouldn't have gotten here. resp.setStatus(HttpStatus.OK_200); } else if (p instanceof X509Principal) { // have to check Basic Auth here, because it might be CSP. String ba = req.getHeader("Authorization"); if(ba.startsWith("Basic ")) { String decoded = Symm.base64noSplit.decode(ba.substring(6)); int colon = decoded.indexOf(':'); if(directAAFUserPass.validate( decoded.substring(0,colon), CredVal.Type.PASSWORD , decoded.substring(colon+1).getBytes())) { resp.setStatus(HttpStatus.OK_200); } else { resp.setStatus(HttpStatus.FORBIDDEN_403); } } } else if(p == null) { trans.error().log("Transaction not Authenticated... no Principal"); resp.setStatus(HttpStatus.FORBIDDEN_403); } else { trans.checkpoint("Basic Auth Check Failed: This wasn't a Basic Auth Trans"); // For Auth Security questions, we don't give any info to client on why failed resp.setStatus(HttpStatus.FORBIDDEN_403); } } },"text/plain"); /** * returns whether a given Credential is valid */ authzAPI.route(POST, "/authn/validate", API.CRED_REQ, new Code(facade,"Is given Credential valid?",true) { @Override public void handle( AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result<Date> r = context.doesCredentialMatch(trans, req, resp); if(r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { // For Security, we don't give any info out on why failed, other than forbidden resp.setStatus(HttpStatus.FORBIDDEN_403); } } }); /** * returns whether a given Credential is valid */ authzAPI.route(GET, "/authn/cert/id/:id", API.CERTS, new Code(facade,"Get Cert Info by ID",true) { @Override public void handle( AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result<Void> r = context.getCertInfoByID(trans, req, resp, pathParam(req,":id") ); if(r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { // For Security, we don't give any info out on why failed, other than forbidden resp.setStatus(HttpStatus.FORBIDDEN_403); } } }); }
java
public static void timeSensitiveInit(Env env, AuthAPI authzAPI, AuthzFacade facade, final DirectAAFUserPass directAAFUserPass) throws Exception { /** * Basic Auth, quick Validation * * Responds OK or NotAuthorized */ authzAPI.route(env, HttpMethods.GET, "/authn/basicAuth", new Code(facade,"Is given BasicAuth valid?",true) { @Override public void handle( AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Principal p = trans.getUserPrincipal(); if (p instanceof BasicPrincipal) { // the idea is that if call is made with this credential, and it's a BasicPrincipal, it's ok // otherwise, it wouldn't have gotten here. resp.setStatus(HttpStatus.OK_200); } else if (p instanceof X509Principal) { // have to check Basic Auth here, because it might be CSP. String ba = req.getHeader("Authorization"); if(ba.startsWith("Basic ")) { String decoded = Symm.base64noSplit.decode(ba.substring(6)); int colon = decoded.indexOf(':'); if(directAAFUserPass.validate( decoded.substring(0,colon), CredVal.Type.PASSWORD , decoded.substring(colon+1).getBytes())) { resp.setStatus(HttpStatus.OK_200); } else { resp.setStatus(HttpStatus.FORBIDDEN_403); } } } else if(p == null) { trans.error().log("Transaction not Authenticated... no Principal"); resp.setStatus(HttpStatus.FORBIDDEN_403); } else { trans.checkpoint("Basic Auth Check Failed: This wasn't a Basic Auth Trans"); // For Auth Security questions, we don't give any info to client on why failed resp.setStatus(HttpStatus.FORBIDDEN_403); } } },"text/plain"); /** * returns whether a given Credential is valid */ authzAPI.route(POST, "/authn/validate", API.CRED_REQ, new Code(facade,"Is given Credential valid?",true) { @Override public void handle( AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result<Date> r = context.doesCredentialMatch(trans, req, resp); if(r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { // For Security, we don't give any info out on why failed, other than forbidden resp.setStatus(HttpStatus.FORBIDDEN_403); } } }); /** * returns whether a given Credential is valid */ authzAPI.route(GET, "/authn/cert/id/:id", API.CERTS, new Code(facade,"Get Cert Info by ID",true) { @Override public void handle( AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result<Void> r = context.getCertInfoByID(trans, req, resp, pathParam(req,":id") ); if(r.isOK()) { resp.setStatus(HttpStatus.OK_200); } else { // For Security, we don't give any info out on why failed, other than forbidden resp.setStatus(HttpStatus.FORBIDDEN_403); } } }); }
[ "public", "static", "void", "timeSensitiveInit", "(", "Env", "env", ",", "AuthAPI", "authzAPI", ",", "AuthzFacade", "facade", ",", "final", "DirectAAFUserPass", "directAAFUserPass", ")", "throws", "Exception", "{", "/**\n\t\t * Basic Auth, quick Validation\n\t\t * \n\t\t * ...
TIME SENSITIVE APIs These will be first in the list @param env @param authzAPI @param facade @param directAAFUserPass @throws Exception
[ "TIME", "SENSITIVE", "APIs" ]
090562e956c0035db972aafba844dc6d3fc948ee
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-service/src/main/java/com/att/authz/service/api/API_Creds.java#L51-L139