repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/MapMetaReader.java
MapMetaReader.read
@Override public void read(final File filename) { filePath = filename; //clear the history on global metadata table globalMeta.clear(); super.read(filename); }
java
@Override public void read(final File filename) { filePath = filename; //clear the history on global metadata table globalMeta.clear(); super.read(filename); }
[ "@", "Override", "public", "void", "read", "(", "final", "File", "filename", ")", "{", "filePath", "=", "filename", ";", "//clear the history on global metadata table", "globalMeta", ".", "clear", "(", ")", ";", "super", ".", "read", "(", "filename", ")", ";",...
read map files. @param filename filename
[ "read", "map", "files", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/MapMetaReader.java#L124-L131
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/MapMetaReader.java
MapMetaReader.removeIndexTermRecursive
private void removeIndexTermRecursive(final Element parent) { if (parent == null) { return; } final NodeList children = parent.getChildNodes(); Element child; for (int i = children.getLength() - 1; i >= 0; i--) { if (children.item(i).getNodeType() == Node....
java
private void removeIndexTermRecursive(final Element parent) { if (parent == null) { return; } final NodeList children = parent.getChildNodes(); Element child; for (int i = children.getLength() - 1; i >= 0; i--) { if (children.item(i).getNodeType() == Node....
[ "private", "void", "removeIndexTermRecursive", "(", "final", "Element", "parent", ")", "{", "if", "(", "parent", "==", "null", ")", "{", "return", ";", "}", "final", "NodeList", "children", "=", "parent", ".", "getChildNodes", "(", ")", ";", "Element", "ch...
traverse the node tree and remove all indexterm elements with either start or end attribute. @param parent root element
[ "traverse", "the", "node", "tree", "and", "remove", "all", "indexterm", "elements", "with", "either", "start", "or", "end", "attribute", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/MapMetaReader.java#L171-L190
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/MapMetaReader.java
MapMetaReader.cloneElementMap
private Map<String, Element> cloneElementMap(final Map<String, Element> current) { final Map<String, Element> topicMetaTable = new HashMap<>(16); for (final Entry<String, Element> topicMetaItem: current.entrySet()) { topicMetaTable.put(topicMetaItem.getKey(), (Element) resultDoc.importNode(t...
java
private Map<String, Element> cloneElementMap(final Map<String, Element> current) { final Map<String, Element> topicMetaTable = new HashMap<>(16); for (final Entry<String, Element> topicMetaItem: current.entrySet()) { topicMetaTable.put(topicMetaItem.getKey(), (Element) resultDoc.importNode(t...
[ "private", "Map", "<", "String", ",", "Element", ">", "cloneElementMap", "(", "final", "Map", "<", "String", ",", "Element", ">", "current", ")", "{", "final", "Map", "<", "String", ",", "Element", ">", "topicMetaTable", "=", "new", "HashMap", "<>", "(",...
Clone metadata map. @param current metadata map to clone @return a clone of the original map
[ "Clone", "metadata", "map", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/MapMetaReader.java#L276-L282
train
dita-ot/dita-ot
src/main/java/org/dita/dost/Processor.java
Processor.setProperty
public Processor setProperty(final String name, final String value) { args.put(name, value); return this; }
java
public Processor setProperty(final String name, final String value) { args.put(name, value); return this; }
[ "public", "Processor", "setProperty", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "args", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Set property. Existing property mapping will be overridden. @param name property name @param value property value @return this Process object
[ "Set", "property", ".", "Existing", "property", "mapping", "will", "be", "overridden", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/Processor.java#L113-L116
train
dita-ot/dita-ot
src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/writer/CHMIndexWriter.java
CHMIndexWriter.findTargets
private void findTargets(final IndexTerm term) { final List<IndexTerm> subTerms = term.getSubTerms(); List<IndexTermTarget> subTargets = null; if (subTerms != null && ! subTerms.isEmpty()){ for (final IndexTerm subTerm : subTerms) { subTargets = subTerm.getTargetList(...
java
private void findTargets(final IndexTerm term) { final List<IndexTerm> subTerms = term.getSubTerms(); List<IndexTermTarget> subTargets = null; if (subTerms != null && ! subTerms.isEmpty()){ for (final IndexTerm subTerm : subTerms) { subTargets = subTerm.getTargetList(...
[ "private", "void", "findTargets", "(", "final", "IndexTerm", "term", ")", "{", "final", "List", "<", "IndexTerm", ">", "subTerms", "=", "term", ".", "getSubTerms", "(", ")", ";", "List", "<", "IndexTermTarget", ">", "subTargets", "=", "null", ";", "if", ...
find the targets in its subterms when the current term doesn't have any target @param term The current IndexTerm instance
[ "find", "the", "targets", "in", "its", "subterms", "when", "the", "current", "term", "doesn", "t", "have", "any", "target" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/writer/CHMIndexWriter.java#L134-L154
train
dita-ot/dita-ot
src/main/java/org/dita/dost/ProcessorFactory.java
ProcessorFactory.setBaseTempDir
public void setBaseTempDir(final File tmp) { if (!tmp.isAbsolute()) { throw new IllegalArgumentException("Temporary directory must be absolute"); } args.put("base.temp.dir", tmp.getAbsolutePath()); }
java
public void setBaseTempDir(final File tmp) { if (!tmp.isAbsolute()) { throw new IllegalArgumentException("Temporary directory must be absolute"); } args.put("base.temp.dir", tmp.getAbsolutePath()); }
[ "public", "void", "setBaseTempDir", "(", "final", "File", "tmp", ")", "{", "if", "(", "!", "tmp", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Temporary directory must be absolute\"", ")", ";", "}", "args", ".", ...
Set base directory for temporary directories. @param tmp absolute directory for temporary directories
[ "Set", "base", "directory", "for", "temporary", "directories", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/ProcessorFactory.java#L40-L45
train
dita-ot/dita-ot
src/main/java/org/dita/dost/ProcessorFactory.java
ProcessorFactory.newProcessor
public Processor newProcessor(final String transtype) { if (ditaDir == null) { throw new IllegalStateException(); } if (!Configuration.transtypes.contains(transtype)) { throw new IllegalArgumentException("Transtype " + transtype + " not supported"); } retu...
java
public Processor newProcessor(final String transtype) { if (ditaDir == null) { throw new IllegalStateException(); } if (!Configuration.transtypes.contains(transtype)) { throw new IllegalArgumentException("Transtype " + transtype + " not supported"); } retu...
[ "public", "Processor", "newProcessor", "(", "final", "String", "transtype", ")", "{", "if", "(", "ditaDir", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "if", "(", "!", "Configuration", ".", "transtypes", ".", "conta...
Create new Processor to run DITA-OT @param transtype transtype for the processor @return new Processor instance
[ "Create", "new", "Processor", "to", "run", "DITA", "-", "OT" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/ProcessorFactory.java#L53-L61
train
dita-ot/dita-ot
src/main/java/org/dita/dost/platform/Plugins.java
Plugins.getInstalledPlugins
public static List<String> getInstalledPlugins() { final List<Element> plugins = toList(getPluginConfiguration().getElementsByTagName("plugin")); return plugins.stream() .map((Element elem) -> elem.getAttributeNode("id")) .filter(Objects::nonNull) .map(Att...
java
public static List<String> getInstalledPlugins() { final List<Element> plugins = toList(getPluginConfiguration().getElementsByTagName("plugin")); return plugins.stream() .map((Element elem) -> elem.getAttributeNode("id")) .filter(Objects::nonNull) .map(Att...
[ "public", "static", "List", "<", "String", ">", "getInstalledPlugins", "(", ")", "{", "final", "List", "<", "Element", ">", "plugins", "=", "toList", "(", "getPluginConfiguration", "(", ")", ".", "getElementsByTagName", "(", "\"plugin\"", ")", ")", ";", "ret...
Read the list of installed plugins
[ "Read", "the", "list", "of", "installed", "plugins" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/platform/Plugins.java#L32-L40
train
dita-ot/dita-ot
src/main/java/org/dita/dost/platform/Plugins.java
Plugins.getPluginConfiguration
public static Document getPluginConfiguration() { try (final InputStream in = Plugins.class.getClassLoader().getResourceAsStream(PLUGIN_CONF)) { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in); } catch (final ParserConfigurationException | SAXException | IOExceptio...
java
public static Document getPluginConfiguration() { try (final InputStream in = Plugins.class.getClassLoader().getResourceAsStream(PLUGIN_CONF)) { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in); } catch (final ParserConfigurationException | SAXException | IOExceptio...
[ "public", "static", "Document", "getPluginConfiguration", "(", ")", "{", "try", "(", "final", "InputStream", "in", "=", "Plugins", ".", "class", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "PLUGIN_CONF", ")", ")", "{", "return", "Document...
Read plugin configuration
[ "Read", "plugin", "configuration" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/platform/Plugins.java#L45-L51
train
dita-ot/dita-ot
src/main/java/org/dita/dost/platform/Features.java
Features.addFeature
public final void addFeature(final String id, final Element elem) { boolean isFile; String value = elem.getAttribute("file"); if (!value.isEmpty()) { isFile = true; } else { value = elem.getAttribute("value"); isFile = "file".equals(elem.getAttribute("...
java
public final void addFeature(final String id, final Element elem) { boolean isFile; String value = elem.getAttribute("file"); if (!value.isEmpty()) { isFile = true; } else { value = elem.getAttribute("value"); isFile = "file".equals(elem.getAttribute("...
[ "public", "final", "void", "addFeature", "(", "final", "String", "id", ",", "final", "Element", "elem", ")", "{", "boolean", "isFile", ";", "String", "value", "=", "elem", ".", "getAttribute", "(", "\"file\"", ")", ";", "if", "(", "!", "value", ".", "i...
Add feature to the feature table. @param id feature id @param elem configuration element
[ "Add", "feature", "to", "the", "feature", "table", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/platform/Features.java#L109-L138
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLSerializer.java
XMLSerializer.close
public void close() throws IOException { if (outStream == null && outWriter == null) { throw new IllegalStateException(); } if (outStream != null) { outStream.close(); } if (outWriter != null) { outWriter.close(); } }
java
public void close() throws IOException { if (outStream == null && outWriter == null) { throw new IllegalStateException(); } if (outStream != null) { outStream.close(); } if (outWriter != null) { outWriter.close(); } }
[ "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "outStream", "==", "null", "&&", "outWriter", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "if", "(", "outStream", "!=", "null", ")", ...
Close output. @throws IOException if closing result output failed
[ "Close", "output", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLSerializer.java#L120-L130
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLSerializer.java
XMLSerializer.writeStartElement
public void writeStartElement(final String uri, final String qName) throws SAXException { processStartElement(); final QName res = new QName(uri, qName); addNamespace(res.uri, res.prefix, res); elementStack.addFirst(res); // push openStartElement = true; }
java
public void writeStartElement(final String uri, final String qName) throws SAXException { processStartElement(); final QName res = new QName(uri, qName); addNamespace(res.uri, res.prefix, res); elementStack.addFirst(res); // push openStartElement = true; }
[ "public", "void", "writeStartElement", "(", "final", "String", "uri", ",", "final", "String", "qName", ")", "throws", "SAXException", "{", "processStartElement", "(", ")", ";", "final", "QName", "res", "=", "new", "QName", "(", "uri", ",", "qName", ")", ";...
Write start element without attributes. @param qName element QName @throws SAXException if processing the event failed
[ "Write", "start", "element", "without", "attributes", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLSerializer.java#L169-L175
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLSerializer.java
XMLSerializer.writeNamespace
public void writeNamespace(final String prefix, final String uri) { if (!openStartElement) { throw new IllegalStateException("Current state does not allow Namespace writing"); } final QName qName = elementStack.getFirst(); // peek for (final NamespaceMapping p: qName.mappings...
java
public void writeNamespace(final String prefix, final String uri) { if (!openStartElement) { throw new IllegalStateException("Current state does not allow Namespace writing"); } final QName qName = elementStack.getFirst(); // peek for (final NamespaceMapping p: qName.mappings...
[ "public", "void", "writeNamespace", "(", "final", "String", "prefix", ",", "final", "String", "uri", ")", "{", "if", "(", "!", "openStartElement", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Current state does not allow Namespace writing\"", ")", ";",...
Write namepace prefix. @param prefix namespace prefix @param uri namespace URI @throws IllegalStateException if start element is not open @throws IllegalArgumentException if prefix is already bound
[ "Write", "namepace", "prefix", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLSerializer.java#L185-L198
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLSerializer.java
XMLSerializer.writeEndElement
public void writeEndElement() throws SAXException { processStartElement(); final QName qName = elementStack.remove(); // pop transformer.endElement(qName.uri, qName.localName, qName.qName); for (final NamespaceMapping p: qName.mappings) { if (p.newMapping) { t...
java
public void writeEndElement() throws SAXException { processStartElement(); final QName qName = elementStack.remove(); // pop transformer.endElement(qName.uri, qName.localName, qName.qName); for (final NamespaceMapping p: qName.mappings) { if (p.newMapping) { t...
[ "public", "void", "writeEndElement", "(", ")", "throws", "SAXException", "{", "processStartElement", "(", ")", ";", "final", "QName", "qName", "=", "elementStack", ".", "remove", "(", ")", ";", "// pop", "transformer", ".", "endElement", "(", "qName", ".", "...
Write end element. @throws SAXException if processing the event failed
[ "Write", "end", "element", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLSerializer.java#L236-L245
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLSerializer.java
XMLSerializer.writeProcessingInstruction
public void writeProcessingInstruction(final String target, final String data) throws SAXException { processStartElement(); transformer.processingInstruction(target, data != null ? data : ""); }
java
public void writeProcessingInstruction(final String target, final String data) throws SAXException { processStartElement(); transformer.processingInstruction(target, data != null ? data : ""); }
[ "public", "void", "writeProcessingInstruction", "(", "final", "String", "target", ",", "final", "String", "data", ")", "throws", "SAXException", "{", "processStartElement", "(", ")", ";", "transformer", ".", "processingInstruction", "(", "target", ",", "data", "!=...
Write processing instruction. @param target processing instruction name @param data processing instruction data, {@code null} if no data @throws SAXException if processing the event failed
[ "Write", "processing", "instruction", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLSerializer.java#L286-L289
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLSerializer.java
XMLSerializer.writeComment
public void writeComment(final String data) throws SAXException { processStartElement(); final char[] ch = data.toCharArray(); transformer.comment(ch, 0, ch.length); }
java
public void writeComment(final String data) throws SAXException { processStartElement(); final char[] ch = data.toCharArray(); transformer.comment(ch, 0, ch.length); }
[ "public", "void", "writeComment", "(", "final", "String", "data", ")", "throws", "SAXException", "{", "processStartElement", "(", ")", ";", "final", "char", "[", "]", "ch", "=", "data", ".", "toCharArray", "(", ")", ";", "transformer", ".", "comment", "(",...
Write comment. @param data comment data @throws SAXException if processing the event failed
[ "Write", "comment", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLSerializer.java#L297-L301
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.isHTMLFile
@Deprecated public static boolean isHTMLFile(final String lcasefn) { for (final String ext: supportedHTMLExtensions) { if (lcasefn.endsWith(ext)) { return true; } } return false; }
java
@Deprecated public static boolean isHTMLFile(final String lcasefn) { for (final String ext: supportedHTMLExtensions) { if (lcasefn.endsWith(ext)) { return true; } } return false; }
[ "@", "Deprecated", "public", "static", "boolean", "isHTMLFile", "(", "final", "String", "lcasefn", ")", "{", "for", "(", "final", "String", "ext", ":", "supportedHTMLExtensions", ")", "{", "if", "(", "lcasefn", ".", "endsWith", "(", "ext", ")", ")", "{", ...
Return if the file is a html file by extension. @param lcasefn file name @return true if is html file and false otherwise
[ "Return", "if", "the", "file", "is", "a", "html", "file", "by", "extension", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L96-L104
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.isResourceFile
@Deprecated public static boolean isResourceFile(final String lcasefn) { for (final String ext: supportedResourceExtensions) { if (lcasefn.endsWith(ext)) { return true; } } return false; }
java
@Deprecated public static boolean isResourceFile(final String lcasefn) { for (final String ext: supportedResourceExtensions) { if (lcasefn.endsWith(ext)) { return true; } } return false; }
[ "@", "Deprecated", "public", "static", "boolean", "isResourceFile", "(", "final", "String", "lcasefn", ")", "{", "for", "(", "final", "String", "ext", ":", "supportedResourceExtensions", ")", "{", "if", "(", "lcasefn", ".", "endsWith", "(", "ext", ")", ")", ...
Return if the file is a resource file by its extension. @param lcasefn file name in lower case. @return {@code true} if file is a resource file, otherwise {@code false}
[ "Return", "if", "the", "file", "is", "a", "resource", "file", "by", "its", "extension", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L136-L144
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.isSupportedImageFile
@Deprecated public static boolean isSupportedImageFile(final String lcasefn) { for (final String ext: supportedImageExtensions) { if (lcasefn.endsWith(ext)) { return true; } } return false; }
java
@Deprecated public static boolean isSupportedImageFile(final String lcasefn) { for (final String ext: supportedImageExtensions) { if (lcasefn.endsWith(ext)) { return true; } } return false; }
[ "@", "Deprecated", "public", "static", "boolean", "isSupportedImageFile", "(", "final", "String", "lcasefn", ")", "{", "for", "(", "final", "String", "ext", ":", "supportedImageExtensions", ")", "{", "if", "(", "lcasefn", ".", "endsWith", "(", "ext", ")", ")...
Return if the file is a supported image file by extension. @param lcasefn filename @return true if is supported image and false otherwise
[ "Return", "if", "the", "file", "is", "a", "supported", "image", "file", "by", "extension", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L151-L159
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.normalizePath
private static String normalizePath(final String path, final String separator) { final String p = path.replace(WINDOWS_SEPARATOR, separator).replace(UNIX_SEPARATOR, separator); // remove "." from the directory. final List<String> dirs = new LinkedList<>(); final StringTokenizer tokenizer...
java
private static String normalizePath(final String path, final String separator) { final String p = path.replace(WINDOWS_SEPARATOR, separator).replace(UNIX_SEPARATOR, separator); // remove "." from the directory. final List<String> dirs = new LinkedList<>(); final StringTokenizer tokenizer...
[ "private", "static", "String", "normalizePath", "(", "final", "String", "path", ",", "final", "String", "separator", ")", "{", "final", "String", "p", "=", "path", ".", "replace", "(", "WINDOWS_SEPARATOR", ",", "separator", ")", ".", "replace", "(", "UNIX_SE...
Remove redundant names ".." and "." from the given path and replace directory separators. @param path input path @param separator directory separator @return processed path
[ "Remove", "redundant", "names", "..", "and", ".", "from", "the", "given", "path", "and", "replace", "directory", "separators", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L363-L413
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.isAbsolutePath
public static boolean isAbsolutePath (final String path) { if (path == null || path.trim().length() == 0) { return false; } if (File.separator.equals(UNIX_SEPARATOR)) { return path.startsWith(UNIX_SEPARATOR); } else if (File.separator.equals(WINDOWS_SEPA...
java
public static boolean isAbsolutePath (final String path) { if (path == null || path.trim().length() == 0) { return false; } if (File.separator.equals(UNIX_SEPARATOR)) { return path.startsWith(UNIX_SEPARATOR); } else if (File.separator.equals(WINDOWS_SEPA...
[ "public", "static", "boolean", "isAbsolutePath", "(", "final", "String", "path", ")", "{", "if", "(", "path", "==", "null", "||", "path", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "if", "(", ...
Return if the path is absolute. @param path test path @return true if path is absolute and false otherwise.
[ "Return", "if", "the", "path", "is", "absolute", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L421-L435
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.getExtension
public static String getExtension(final String file) { final int index = file.indexOf(SHARP); if (file.startsWith(SHARP)) { return null; } else if (index != -1) { final String fileName = file.substring(0, index); final int fileExtIndex = fileName.lastIndexOf(...
java
public static String getExtension(final String file) { final int index = file.indexOf(SHARP); if (file.startsWith(SHARP)) { return null; } else if (index != -1) { final String fileName = file.substring(0, index); final int fileExtIndex = fileName.lastIndexOf(...
[ "public", "static", "String", "getExtension", "(", "final", "String", "file", ")", "{", "final", "int", "index", "=", "file", ".", "indexOf", "(", "SHARP", ")", ";", "if", "(", "file", ".", "startsWith", "(", "SHARP", ")", ")", "{", "return", "null", ...
Get file extension @param file filename, may contain a URL fragment @return file extensions, {@code null} if no extension was found
[ "Get", "file", "extension" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L472-L485
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.getName
public static String getName(final String aURLString) { int pathnameEndIndex; if (isWindows()) { if (aURLString.contains(SHARP)) { pathnameEndIndex = aURLString.lastIndexOf(SHARP); } else { pathnameEndIndex = aURLString.lastIndexOf(WINDOWS_SEPARATO...
java
public static String getName(final String aURLString) { int pathnameEndIndex; if (isWindows()) { if (aURLString.contains(SHARP)) { pathnameEndIndex = aURLString.lastIndexOf(SHARP); } else { pathnameEndIndex = aURLString.lastIndexOf(WINDOWS_SEPARATO...
[ "public", "static", "String", "getName", "(", "final", "String", "aURLString", ")", "{", "int", "pathnameEndIndex", ";", "if", "(", "isWindows", "(", ")", ")", "{", "if", "(", "aURLString", ".", "contains", "(", "SHARP", ")", ")", "{", "pathnameEndIndex", ...
Get filename from a path. @param aURLString Windows, UNIX, or URI path, may contain hash fragment @return filename without path or hash fragment
[ "Get", "filename", "from", "a", "path", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L493-L519
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.getFullPathNoEndSeparator
public static String getFullPathNoEndSeparator(final String aURLString) { final int pathnameStartIndex = aURLString.indexOf(UNIX_SEPARATOR); final int pathnameEndIndex = aURLString.lastIndexOf(UNIX_SEPARATOR); String aPath = aURLString.substring(0, pathnameEndIndex); return aPath; }
java
public static String getFullPathNoEndSeparator(final String aURLString) { final int pathnameStartIndex = aURLString.indexOf(UNIX_SEPARATOR); final int pathnameEndIndex = aURLString.lastIndexOf(UNIX_SEPARATOR); String aPath = aURLString.substring(0, pathnameEndIndex); return aPath; }
[ "public", "static", "String", "getFullPathNoEndSeparator", "(", "final", "String", "aURLString", ")", "{", "final", "int", "pathnameStartIndex", "=", "aURLString", ".", "indexOf", "(", "UNIX_SEPARATOR", ")", ";", "final", "int", "pathnameEndIndex", "=", "aURLString"...
Get base path from a path. @param aURLString UNIX or URI path @return base path
[ "Get", "base", "path", "from", "a", "path", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L538-L543
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.stripFragment
@Deprecated public static String stripFragment(final String path) { final int i = path.indexOf(SHARP); if (i != -1) { return path.substring(0, i); } else { return path; } }
java
@Deprecated public static String stripFragment(final String path) { final int i = path.indexOf(SHARP); if (i != -1) { return path.substring(0, i); } else { return path; } }
[ "@", "Deprecated", "public", "static", "String", "stripFragment", "(", "final", "String", "path", ")", "{", "final", "int", "i", "=", "path", ".", "indexOf", "(", "SHARP", ")", ";", "if", "(", "i", "!=", "-", "1", ")", "{", "return", "path", ".", "...
Strip fragment part from path. @param path path @return path without path
[ "Strip", "fragment", "part", "from", "path", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L551-L559
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.getFragment
@Deprecated public static String getFragment(final String path, final String defaultValue) { final int i = path.indexOf(SHARP); if (i != -1) { return path.substring(i + 1); } else { return defaultValue; } }
java
@Deprecated public static String getFragment(final String path, final String defaultValue) { final int i = path.indexOf(SHARP); if (i != -1) { return path.substring(i + 1); } else { return defaultValue; } }
[ "@", "Deprecated", "public", "static", "String", "getFragment", "(", "final", "String", "path", ",", "final", "String", "defaultValue", ")", "{", "final", "int", "i", "=", "path", ".", "indexOf", "(", "SHARP", ")", ";", "if", "(", "i", "!=", "-", "1", ...
Get fragment part from path or return default fragment. @param path path @param defaultValue default fragment value @return fragment without {@link Constants#SHARP}, default value if no fragment exists
[ "Get", "fragment", "part", "from", "path", "or", "return", "default", "fragment", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L592-L600
train
dita-ot/dita-ot
src/main/java/org/ditang/relaxng/defaults/OxygenRelaxNGSchemaReader.java
OxygenRelaxNGSchemaReader.wrapPattern2
private static SchemaWrapper wrapPattern2(Pattern start, SchemaPatternBuilder spb, PropertyMap properties) throws SAXException, IncorrectSchemaException { if (properties.contains(RngProperty.FEASIBLE)) { //Use a feasible transform start = FeasibleTransform.transform(spb, start); } //Get...
java
private static SchemaWrapper wrapPattern2(Pattern start, SchemaPatternBuilder spb, PropertyMap properties) throws SAXException, IncorrectSchemaException { if (properties.contains(RngProperty.FEASIBLE)) { //Use a feasible transform start = FeasibleTransform.transform(spb, start); } //Get...
[ "private", "static", "SchemaWrapper", "wrapPattern2", "(", "Pattern", "start", ",", "SchemaPatternBuilder", "spb", ",", "PropertyMap", "properties", ")", "throws", "SAXException", ",", "IncorrectSchemaException", "{", "if", "(", "properties", ".", "contains", "(", "...
Make a schema wrapper. @param start Start pattern. @param spb The schema pattern builder. @param properties The properties map. @return The schema wrapper.
[ "Make", "a", "schema", "wrapper", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/ditang/relaxng/defaults/OxygenRelaxNGSchemaReader.java#L174-L205
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/XmlFilterModule.java
XmlFilterModule.execute
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { final Collection<FileInfo> fis = job.getFileInfo(fileInfoFilter); for (final FileInfo f: fis) { final URI file = job.tempDirURI.resolve(f.uri); logger.info(...
java
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { final Collection<FileInfo> fis = job.getFileInfo(fileInfoFilter); for (final FileInfo f: fis) { final URI file = job.tempDirURI.resolve(f.uri); logger.info(...
[ "@", "Override", "public", "AbstractPipelineOutput", "execute", "(", "final", "AbstractPipelineInput", "input", ")", "throws", "DITAOTException", "{", "final", "Collection", "<", "FileInfo", ">", "fis", "=", "job", ".", "getFileInfo", "(", "fileInfoFilter", ")", "...
Filter files through XML filters. @param input Input parameters and resources. @return always returns {@code null}
[ "Filter", "files", "through", "XML", "filters", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/XmlFilterModule.java#L45-L59
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/SubjectSchemeReader.java
SubjectSchemeReader.writeMapToXML
public static void writeMapToXML(final Map<URI, Set<URI>> m, final File outputFile) throws IOException { if (m == null) { return; } final Properties prop = new Properties(); for (final Map.Entry<URI, Set<URI>> entry: m.entrySet()) { final URI key = entry.getKey();...
java
public static void writeMapToXML(final Map<URI, Set<URI>> m, final File outputFile) throws IOException { if (m == null) { return; } final Properties prop = new Properties(); for (final Map.Entry<URI, Set<URI>> entry: m.entrySet()) { final URI key = entry.getKey();...
[ "public", "static", "void", "writeMapToXML", "(", "final", "Map", "<", "URI", ",", "Set", "<", "URI", ">", ">", "m", ",", "final", "File", "outputFile", ")", "throws", "IOException", "{", "if", "(", "m", "==", "null", ")", "{", "return", ";", "}", ...
Write map of sets to a file. <p>The serialization format is XML properties format where values are comma separated lists.</p> @param m map to serialize @param outputFile output filename, relative to temporary directory
[ "Write", "map", "of", "sets", "to", "a", "file", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/SubjectSchemeReader.java#L142-L157
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/SubjectSchemeReader.java
SubjectSchemeReader.loadSubjectScheme
public void loadSubjectScheme(final File scheme) { assert scheme.isAbsolute(); if (!scheme.exists()) { throw new IllegalStateException(); } logger.debug("Load subject scheme " + scheme); try { final DocumentBuilder builder = XMLUtils.getDocumentBuilder();...
java
public void loadSubjectScheme(final File scheme) { assert scheme.isAbsolute(); if (!scheme.exists()) { throw new IllegalStateException(); } logger.debug("Load subject scheme " + scheme); try { final DocumentBuilder builder = XMLUtils.getDocumentBuilder();...
[ "public", "void", "loadSubjectScheme", "(", "final", "File", "scheme", ")", "{", "assert", "scheme", ".", "isAbsolute", "(", ")", ";", "if", "(", "!", "scheme", ".", "exists", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", ...
Load schema file. @param scheme absolute path for subject scheme
[ "Load", "schema", "file", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/SubjectSchemeReader.java#L164-L184
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/SubjectSchemeReader.java
SubjectSchemeReader.putValuePairsIntoMap
private void putValuePairsIntoMap(final Element subtree, final String elementName, final QName attName, final String category) { if (subtree == null || attName == null) { return; } Map<String, Set<String>> valueMap = validValuesMap.get(attName); if (valueMap == null) { ...
java
private void putValuePairsIntoMap(final Element subtree, final String elementName, final QName attName, final String category) { if (subtree == null || attName == null) { return; } Map<String, Set<String>> valueMap = validValuesMap.get(attName); if (valueMap == null) { ...
[ "private", "void", "putValuePairsIntoMap", "(", "final", "Element", "subtree", ",", "final", "String", "elementName", ",", "final", "QName", "attName", ",", "final", "String", "category", ")", "{", "if", "(", "subtree", "==", "null", "||", "attName", "==", "...
Populate valid values map @param subtree subject scheme definition element @param elementName element name @param attName attribute name @param category enumeration category name
[ "Populate", "valid", "values", "map" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/SubjectSchemeReader.java#L285-L320
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/CopyToModule.java
CopyToModule.processMap
private void processMap() throws DITAOTException { final URI in = job.tempDirURI.resolve(job.getFileInfo(fi -> fi.isInput).iterator().next().uri); final List<XMLFilter> pipe = getProcessingPipe(in); xmlUtils.transform(in, pipe); }
java
private void processMap() throws DITAOTException { final URI in = job.tempDirURI.resolve(job.getFileInfo(fi -> fi.isInput).iterator().next().uri); final List<XMLFilter> pipe = getProcessingPipe(in); xmlUtils.transform(in, pipe); }
[ "private", "void", "processMap", "(", ")", "throws", "DITAOTException", "{", "final", "URI", "in", "=", "job", ".", "tempDirURI", ".", "resolve", "(", "job", ".", "getFileInfo", "(", "fi", "->", "fi", ".", "isInput", ")", ".", "iterator", "(", ")", "."...
Process start map to read copy-to map and write unique topic references.
[ "Process", "start", "map", "to", "read", "copy", "-", "to", "map", "and", "write", "unique", "topic", "references", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/CopyToModule.java#L94-L100
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/CopyToModule.java
CopyToModule.getProcessingPipe
private List<XMLFilter> getProcessingPipe(final URI fileToParse) { final List<XMLFilter> pipe = new ArrayList<>(); if (forceUnique) { forceUniqueFilter = new ForceUniqueFilter(); forceUniqueFilter.setLogger(logger); forceUniqueFilter.setJob(job); forceUni...
java
private List<XMLFilter> getProcessingPipe(final URI fileToParse) { final List<XMLFilter> pipe = new ArrayList<>(); if (forceUnique) { forceUniqueFilter = new ForceUniqueFilter(); forceUniqueFilter.setLogger(logger); forceUniqueFilter.setJob(job); forceUni...
[ "private", "List", "<", "XMLFilter", ">", "getProcessingPipe", "(", "final", "URI", "fileToParse", ")", "{", "final", "List", "<", "XMLFilter", ">", "pipe", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "forceUnique", ")", "{", "forceUniqueFilte...
Get processign filters
[ "Get", "processign", "filters" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/CopyToModule.java#L105-L123
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/CopyToModule.java
CopyToModule.getCopyToMap
private Map<FileInfo, FileInfo> getCopyToMap() { final Map<FileInfo, FileInfo> copyToMap = new HashMap<>(); if (forceUnique) { forceUniqueFilter.copyToMap.forEach((dstFi, srcFi) -> { job.add(dstFi); copyToMap.put(dstFi, srcFi); }); } ...
java
private Map<FileInfo, FileInfo> getCopyToMap() { final Map<FileInfo, FileInfo> copyToMap = new HashMap<>(); if (forceUnique) { forceUniqueFilter.copyToMap.forEach((dstFi, srcFi) -> { job.add(dstFi); copyToMap.put(dstFi, srcFi); }); } ...
[ "private", "Map", "<", "FileInfo", ",", "FileInfo", ">", "getCopyToMap", "(", ")", "{", "final", "Map", "<", "FileInfo", ",", "FileInfo", ">", "copyToMap", "=", "new", "HashMap", "<>", "(", ")", ";", "if", "(", "forceUnique", ")", "{", "forceUniqueFilter...
Get copy-to map based on map processing. @return target to source map of URIs relative to temporary directory
[ "Get", "copy", "-", "to", "map", "based", "on", "map", "processing", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/CopyToModule.java#L130-L155
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/CopyToModule.java
CopyToModule.performCopytoTask
private void performCopytoTask(final Map<FileInfo, FileInfo> copyToMap) { for (final Map.Entry<FileInfo, FileInfo> entry : copyToMap.entrySet()) { final URI copytoTarget = entry.getKey().uri; final URI copytoSource = entry.getValue().uri; final URI srcFile = job.tempDirURI.re...
java
private void performCopytoTask(final Map<FileInfo, FileInfo> copyToMap) { for (final Map.Entry<FileInfo, FileInfo> entry : copyToMap.entrySet()) { final URI copytoTarget = entry.getKey().uri; final URI copytoSource = entry.getValue().uri; final URI srcFile = job.tempDirURI.re...
[ "private", "void", "performCopytoTask", "(", "final", "Map", "<", "FileInfo", ",", "FileInfo", ">", "copyToMap", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "FileInfo", ",", "FileInfo", ">", "entry", ":", "copyToMap", ".", "entrySet", "(", "...
Execute copy-to task, generate copy-to targets base on sources. @param copyToMap target to source map of URIs relative to temporary directory
[ "Execute", "copy", "-", "to", "task", "generate", "copy", "-", "to", "targets", "base", "on", "sources", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/CopyToModule.java#L162-L188
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/CopyToModule.java
CopyToModule.copyFileWithPIReplaced
private void copyFileWithPIReplaced(final URI src, final URI target, final URI copytoTargetFilename, final URI inputMapInTemp) { assert src.isAbsolute(); assert target.isAbsolute(); assert !copytoTargetFilename.isAbsolute(); assert inputMapInTemp.isAbsolute(); final File workdir ...
java
private void copyFileWithPIReplaced(final URI src, final URI target, final URI copytoTargetFilename, final URI inputMapInTemp) { assert src.isAbsolute(); assert target.isAbsolute(); assert !copytoTargetFilename.isAbsolute(); assert inputMapInTemp.isAbsolute(); final File workdir ...
[ "private", "void", "copyFileWithPIReplaced", "(", "final", "URI", "src", ",", "final", "URI", "target", ",", "final", "URI", "copytoTargetFilename", ",", "final", "URI", "inputMapInTemp", ")", "{", "assert", "src", ".", "isAbsolute", "(", ")", ";", "assert", ...
Copy files and replace workdir PI contents. @param src source URI in temporary directory @param target target URI in temporary directory @param copytoTargetFilename target URI relative to temporary directory @param inputMapInTemp input map URI in temporary directory
[ "Copy", "files", "and", "replace", "workdir", "PI", "contents", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/CopyToModule.java#L198-L218
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/CopyToModule.java
CopyToModule.getPathtoRootmap
public static File getPathtoRootmap(final URI traceFilename, final URI inputMap) { assert traceFilename.isAbsolute(); assert inputMap.isAbsolute(); return toFile(getRelativePath(traceFilename, inputMap)).getParentFile(); }
java
public static File getPathtoRootmap(final URI traceFilename, final URI inputMap) { assert traceFilename.isAbsolute(); assert inputMap.isAbsolute(); return toFile(getRelativePath(traceFilename, inputMap)).getParentFile(); }
[ "public", "static", "File", "getPathtoRootmap", "(", "final", "URI", "traceFilename", ",", "final", "URI", "inputMap", ")", "{", "assert", "traceFilename", ".", "isAbsolute", "(", ")", ";", "assert", "inputMap", ".", "isAbsolute", "(", ")", ";", "return", "t...
Get path to root map @param traceFilename absolute input file @param inputMap absolute path to start file @return path to base directory, {@code null} if not available
[ "Get", "path", "to", "root", "map" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/CopyToModule.java#L351-L355
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/MergeMapParser.java
MergeMapParser.read
public void read(final File filename, final File tmpDir) { tempdir = tmpDir != null ? tmpDir : filename.getParentFile(); try { final TransformerHandler s = stf.newTransformerHandler(); s.getTransformer().setOutputProperty(OMIT_XML_DECLARATION, "yes"); s.setResult(new ...
java
public void read(final File filename, final File tmpDir) { tempdir = tmpDir != null ? tmpDir : filename.getParentFile(); try { final TransformerHandler s = stf.newTransformerHandler(); s.getTransformer().setOutputProperty(OMIT_XML_DECLARATION, "yes"); s.setResult(new ...
[ "public", "void", "read", "(", "final", "File", "filename", ",", "final", "File", "tmpDir", ")", "{", "tempdir", "=", "tmpDir", "!=", "null", "?", "tmpDir", ":", "filename", ".", "getParentFile", "(", ")", ";", "try", "{", "final", "TransformerHandler", ...
Read map. @param filename map file path @param tmpDir temporary directory path, may be {@code null}
[ "Read", "map", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/MergeMapParser.java#L130-L149
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java
AbstractReaderModule.initXMLReader
void initXMLReader(final File ditaDir, final boolean validate) throws SAXException { reader = XMLUtils.getXMLReader(); reader.setFeature(FEATURE_NAMESPACE, true); reader.setFeature(FEATURE_NAMESPACE_PREFIX, true); if (validate) { reader.setFeature(FEATURE_VALIDATION, true); ...
java
void initXMLReader(final File ditaDir, final boolean validate) throws SAXException { reader = XMLUtils.getXMLReader(); reader.setFeature(FEATURE_NAMESPACE, true); reader.setFeature(FEATURE_NAMESPACE_PREFIX, true); if (validate) { reader.setFeature(FEATURE_VALIDATION, true); ...
[ "void", "initXMLReader", "(", "final", "File", "ditaDir", ",", "final", "boolean", "validate", ")", "throws", "SAXException", "{", "reader", "=", "XMLUtils", ".", "getXMLReader", "(", ")", ";", "reader", ".", "setFeature", "(", "FEATURE_NAMESPACE", ",", "true"...
Init xml reader used for pipeline parsing. @param ditaDir absolute path to DITA-OT directory @param validate whether validate input file @throws SAXException parsing exception
[ "Init", "xml", "reader", "used", "for", "pipeline", "parsing", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java#L186-L213
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java
AbstractReaderModule.processParseResult
void processParseResult(final URI currentFile) { // Category non-copyto result for (final Reference file: listFilter.getNonCopytoResult()) { categorizeReferenceFile(file); } for (final Map.Entry<URI, URI> e : listFilter.getCopytoMap().entrySet()) { final URI sourc...
java
void processParseResult(final URI currentFile) { // Category non-copyto result for (final Reference file: listFilter.getNonCopytoResult()) { categorizeReferenceFile(file); } for (final Map.Entry<URI, URI> e : listFilter.getCopytoMap().entrySet()) { final URI sourc...
[ "void", "processParseResult", "(", "final", "URI", "currentFile", ")", "{", "// Category non-copyto result", "for", "(", "final", "Reference", "file", ":", "listFilter", ".", "getNonCopytoResult", "(", ")", ")", "{", "categorizeReferenceFile", "(", "file", ")", ";...
Process results from parsing a single topic @param currentFile absolute URI processes files
[ "Process", "results", "from", "parsing", "a", "single", "topic" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java#L445-L482
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java
AbstractReaderModule.addToWaitList
void addToWaitList(final Reference ref) { final URI file = ref.filename; assert file.isAbsolute() && file.getFragment() == null; if (doneList.contains(file) || waitList.contains(ref) || file.equals(currentFile)) { return; } waitList.add(ref); }
java
void addToWaitList(final Reference ref) { final URI file = ref.filename; assert file.isAbsolute() && file.getFragment() == null; if (doneList.contains(file) || waitList.contains(ref) || file.equals(currentFile)) { return; } waitList.add(ref); }
[ "void", "addToWaitList", "(", "final", "Reference", "ref", ")", "{", "final", "URI", "file", "=", "ref", ".", "filename", ";", "assert", "file", ".", "isAbsolute", "(", ")", "&&", "file", ".", "getFragment", "(", ")", "==", "null", ";", "if", "(", "d...
Add the given file the wait list if it has not been parsed. @param ref reference to absolute system path
[ "Add", "the", "given", "file", "the", "wait", "list", "if", "it", "has", "not", "been", "parsed", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java#L542-L550
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java
AbstractReaderModule.parseFilterFile
private FilterUtils parseFilterFile() { final FilterUtils filterUtils; if (ditavalFile != null) { final DitaValReader ditaValReader = new DitaValReader(); ditaValReader.setLogger(logger); ditaValReader.setJob(job); ditaValReader.read(ditavalFile.toURI()); ...
java
private FilterUtils parseFilterFile() { final FilterUtils filterUtils; if (ditavalFile != null) { final DitaValReader ditaValReader = new DitaValReader(); ditaValReader.setLogger(logger); ditaValReader.setJob(job); ditaValReader.read(ditavalFile.toURI()); ...
[ "private", "FilterUtils", "parseFilterFile", "(", ")", "{", "final", "FilterUtils", "filterUtils", ";", "if", "(", "ditavalFile", "!=", "null", ")", "{", "final", "DitaValReader", "ditaValReader", "=", "new", "DitaValReader", "(", ")", ";", "ditaValReader", ".",...
Parse filter file @return configured filter utility
[ "Parse", "filter", "file" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/reader/AbstractReaderModule.java#L557-L573
train
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/DitaWriterFilter.java
DitaWriterFilter.getAttributeValue
private String getAttributeValue(final String elemQName, final QName attQName, final String value) { if (StringUtils.isEmptyString(value) && !defaultValueMap.isEmpty()) { final Map<String, String> defaultMap = defaultValueMap.get(attQName); if (defaultMap != null) { final...
java
private String getAttributeValue(final String elemQName, final QName attQName, final String value) { if (StringUtils.isEmptyString(value) && !defaultValueMap.isEmpty()) { final Map<String, String> defaultMap = defaultValueMap.get(attQName); if (defaultMap != null) { final...
[ "private", "String", "getAttributeValue", "(", "final", "String", "elemQName", ",", "final", "QName", "attQName", ",", "final", "String", "value", ")", "{", "if", "(", "StringUtils", ".", "isEmptyString", "(", "value", ")", "&&", "!", "defaultValueMap", ".", ...
Get attribute value or default if attribute is not defined @param elemQName element QName @param attQName attribute QName @param value attribute value @return attribute value or default
[ "Get", "attribute", "value", "or", "default", "if", "attribute", "is", "not", "defined" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/DitaWriterFilter.java#L180-L191
train
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/DitaWriterFilter.java
DitaWriterFilter.replaceHREF
private URI replaceHREF(final QName attName, final Attributes atts) { URI attValue = toURI(atts.getValue(attName.getNamespaceURI(), attName.getLocalPart())); if (attValue != null) { final String fragment = attValue.getFragment(); if (fragment != null) { attValue =...
java
private URI replaceHREF(final QName attName, final Attributes atts) { URI attValue = toURI(atts.getValue(attName.getNamespaceURI(), attName.getLocalPart())); if (attValue != null) { final String fragment = attValue.getFragment(); if (fragment != null) { attValue =...
[ "private", "URI", "replaceHREF", "(", "final", "QName", "attName", ",", "final", "Attributes", "atts", ")", "{", "URI", "attValue", "=", "toURI", "(", "atts", ".", "getValue", "(", "attName", ".", "getNamespaceURI", "(", ")", ",", "attName", ".", "getLocal...
Relativize absolute references if possible. @param attName attribute name @param atts attributes @return attribute value, may be {@code null}
[ "Relativize", "absolute", "references", "if", "possible", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/DitaWriterFilter.java#L200-L231
train
dita-ot/dita-ot
src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/i18n/Configuration.java
Configuration.getAlphabetForChar
public Alphabet getAlphabetForChar(final char theChar) { Alphabet result = null; for (final Alphabet alphabet : this.alphabets) { if (alphabet.isContain(theChar)) { result = alphabet; break; } } return result; }
java
public Alphabet getAlphabetForChar(final char theChar) { Alphabet result = null; for (final Alphabet alphabet : this.alphabets) { if (alphabet.isContain(theChar)) { result = alphabet; break; } } return result; }
[ "public", "Alphabet", "getAlphabetForChar", "(", "final", "char", "theChar", ")", "{", "Alphabet", "result", "=", "null", ";", "for", "(", "final", "Alphabet", "alphabet", ":", "this", ".", "alphabets", ")", "{", "if", "(", "alphabet", ".", "isContain", "(...
Searches alphabets for a char @return first founded alphabet that contains given char or <code>null</code> if no alphabets contains given char.
[ "Searches", "alphabets", "for", "a", "char" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/i18n/Configuration.java#L64-L73
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.correct
public static URL correct(final File file) throws MalformedURLException { if (file == null) { throw new MalformedURLException("The url is null"); } return new URL(correct(file.toURI().toString(), true)); }
java
public static URL correct(final File file) throws MalformedURLException { if (file == null) { throw new MalformedURLException("The url is null"); } return new URL(correct(file.toURI().toString(), true)); }
[ "public", "static", "URL", "correct", "(", "final", "File", "file", ")", "throws", "MalformedURLException", "{", "if", "(", "file", "==", "null", ")", "{", "throw", "new", "MalformedURLException", "(", "\"The url is null\"", ")", ";", "}", "return", "new", "...
Corrects the file to URL. @param file The file to be corrected. If null will throw MalformedURLException. @return a corrected URL. Never null. @exception MalformedURLException when the argument is null.
[ "Corrects", "the", "file", "to", "URL", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L45-L50
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.correct
public static URL correct(final URL url) throws MalformedURLException { if (url == null) { throw new MalformedURLException("The url is null"); } return new URL(correct(url.toString(), false)); }
java
public static URL correct(final URL url) throws MalformedURLException { if (url == null) { throw new MalformedURLException("The url is null"); } return new URL(correct(url.toString(), false)); }
[ "public", "static", "URL", "correct", "(", "final", "URL", "url", ")", "throws", "MalformedURLException", "{", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "MalformedURLException", "(", "\"The url is null\"", ")", ";", "}", "return", "new", "URL...
Corrects an URL. @param url The URL to be corrected. If null will throw MalformedURLException. @return a corrected URL. Never null. @exception MalformedURLException when the argument is null.
[ "Corrects", "an", "URL", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L62-L67
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.getCanonicalFileFromFileUrl
public static File getCanonicalFileFromFileUrl(final URL url) { File file = null; if (url == null) { throw new NullPointerException("The URL cannot be null."); } if ("file".equals(url.getProtocol())) { final String fileName = url.getFile(); final Strin...
java
public static File getCanonicalFileFromFileUrl(final URL url) { File file = null; if (url == null) { throw new NullPointerException("The URL cannot be null."); } if ("file".equals(url.getProtocol())) { final String fileName = url.getFile(); final Strin...
[ "public", "static", "File", "getCanonicalFileFromFileUrl", "(", "final", "URL", "url", ")", "{", "File", "file", "=", "null", ";", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"The URL cannot be null.\"", ")", ";", ...
On Windows names of files from network neighborhood must be corrected before open. @param url The file URL. @return The canonical or absolute file, or null if the protocol is not file.
[ "On", "Windows", "names", "of", "files", "from", "network", "neighborhood", "must", "be", "corrected", "before", "open", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L179-L198
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.correct
private static String correct(String url, final boolean forceCorrection) { if (url == null) { return null; } final String initialUrl = url; // If there is a % that means the URL was already corrected. if (!forceCorrection && url.contains("%")) { return i...
java
private static String correct(String url, final boolean forceCorrection) { if (url == null) { return null; } final String initialUrl = url; // If there is a % that means the URL was already corrected. if (!forceCorrection && url.contains("%")) { return i...
[ "private", "static", "String", "correct", "(", "String", "url", ",", "final", "boolean", "forceCorrection", ")", "{", "if", "(", "url", "==", "null", ")", "{", "return", "null", ";", "}", "final", "String", "initialUrl", "=", "url", ";", "// If there is a ...
Method introduced to correct the URLs in the default machine encoding. @param url The URL to be corrected. If it contains a % char, it means it already was corrected, so it will be returned. Take care at composing URLs from a corrected part and an uncorrected part. Correcting the result will not work. Try to correct fi...
[ "Method", "introduced", "to", "correct", "the", "URLs", "in", "the", "default", "machine", "encoding", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L216-L273
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.getURL
public static String getURL(final String fileName) { if (fileName.startsWith("file:/")) { return fileName; } else { final File file = new File(fileName); return file.toURI().toString(); } }
java
public static String getURL(final String fileName) { if (fileName.startsWith("file:/")) { return fileName; } else { final File file = new File(fileName); return file.toURI().toString(); } }
[ "public", "static", "String", "getURL", "(", "final", "String", "fileName", ")", "{", "if", "(", "fileName", ".", "startsWith", "(", "\"file:/\"", ")", ")", "{", "return", "fileName", ";", "}", "else", "{", "final", "File", "file", "=", "new", "File", ...
Convert a file name to url. @param fileName - The file name string. @return string - URL
[ "Convert", "a", "file", "name", "to", "url", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L282-L291
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.isAbsolute
public static boolean isAbsolute(final URI uri) { final String p = uri.getPath(); return p != null && p.startsWith(URI_SEPARATOR); }
java
public static boolean isAbsolute(final URI uri) { final String p = uri.getPath(); return p != null && p.startsWith(URI_SEPARATOR); }
[ "public", "static", "boolean", "isAbsolute", "(", "final", "URI", "uri", ")", "{", "final", "String", "p", "=", "uri", ".", "getPath", "(", ")", ";", "return", "p", "!=", "null", "&&", "p", ".", "startsWith", "(", "URI_SEPARATOR", ")", ";", "}" ]
Test if URI path is absolute.
[ "Test", "if", "URI", "path", "is", "absolute", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L427-L430
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.toFile
public static File toFile(final URI filename) { if (filename == null) { return null; } final URI f = stripFragment(filename); if ("file".equals(f.getScheme()) && f.getPath() != null && f.isAbsolute()) { return new File(f); } else { return toFil...
java
public static File toFile(final URI filename) { if (filename == null) { return null; } final URI f = stripFragment(filename); if ("file".equals(f.getScheme()) && f.getPath() != null && f.isAbsolute()) { return new File(f); } else { return toFil...
[ "public", "static", "File", "toFile", "(", "final", "URI", "filename", ")", "{", "if", "(", "filename", "==", "null", ")", "{", "return", "null", ";", "}", "final", "URI", "f", "=", "stripFragment", "(", "filename", ")", ";", "if", "(", "\"file\"", "...
Convert URI reference to system file path. @param filename URI to convert to system file path, may be relative or absolute @return file path, {@code null} if input was {@code null}
[ "Convert", "URI", "reference", "to", "system", "file", "path", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L438-L448
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.toFile
public static File toFile(final String filename) { if (filename == null) { return null; } String f; try { f = URLDecoder.decode(filename, UTF8); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } f...
java
public static File toFile(final String filename) { if (filename == null) { return null; } String f; try { f = URLDecoder.decode(filename, UTF8); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } f...
[ "public", "static", "File", "toFile", "(", "final", "String", "filename", ")", "{", "if", "(", "filename", "==", "null", ")", "{", "return", "null", ";", "}", "String", "f", ";", "try", "{", "f", "=", "URLDecoder", ".", "decode", "(", "filename", ","...
Convert URI or chimera references to file paths. @param filename file reference @return file path, {@code null} if input was {@code null}
[ "Convert", "URI", "or", "chimera", "references", "to", "file", "paths", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L456-L468
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.toURI
public static URI toURI(final String file) { if (file == null) { return null; } if (File.separatorChar == '\\' && file.indexOf('\\') != -1) { return toURI(new File(file)); } try { return new URI(file); } catch (final URISyntaxException ...
java
public static URI toURI(final String file) { if (file == null) { return null; } if (File.separatorChar == '\\' && file.indexOf('\\') != -1) { return toURI(new File(file)); } try { return new URI(file); } catch (final URISyntaxException ...
[ "public", "static", "URI", "toURI", "(", "final", "String", "file", ")", "{", "if", "(", "file", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "File", ".", "separatorChar", "==", "'", "'", "&&", "file", ".", "indexOf", "(", "'", ...
Covert file reference to URI. Fixes directory separators and escapes characters. @param file The string to be parsed into a URI, may be {@code null} @return URI from parsing the given string, {@code null} if input was {@code null}
[ "Covert", "file", "reference", "to", "URI", ".", "Fixes", "directory", "separators", "and", "escapes", "characters", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L499-L515
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.setFragment
public static URI setFragment(final URI path, final String fragment) { try { if (path.getPath() != null) { return new URI(path.getScheme(), path.getUserInfo(), path.getHost(), path.getPort(), path.getPath(), path.getQuery(), fragment); } else { return new ...
java
public static URI setFragment(final URI path, final String fragment) { try { if (path.getPath() != null) { return new URI(path.getScheme(), path.getUserInfo(), path.getHost(), path.getPort(), path.getPath(), path.getQuery(), fragment); } else { return new ...
[ "public", "static", "URI", "setFragment", "(", "final", "URI", "path", ",", "final", "String", "fragment", ")", "{", "try", "{", "if", "(", "path", ".", "getPath", "(", ")", "!=", "null", ")", "{", "return", "new", "URI", "(", "path", ".", "getScheme...
Create new URI with a given fragment. @param path URI to set fragment on @param fragment new fragment, {@code null} for no fragment @return new URI instance with given fragment
[ "Create", "new", "URI", "with", "a", "given", "fragment", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L551-L561
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.setPath
public static URI setPath(final URI orig, final String path) { try { return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), path, orig.getQuery(), orig.getFragment()); } catch (final URISyntaxException e) { throw new RuntimeException(e.getMessage(), ...
java
public static URI setPath(final URI orig, final String path) { try { return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), path, orig.getQuery(), orig.getFragment()); } catch (final URISyntaxException e) { throw new RuntimeException(e.getMessage(), ...
[ "public", "static", "URI", "setPath", "(", "final", "URI", "orig", ",", "final", "String", "path", ")", "{", "try", "{", "return", "new", "URI", "(", "orig", ".", "getScheme", "(", ")", ",", "orig", ".", "getUserInfo", "(", ")", ",", "orig", ".", "...
Create new URI with a given path. @param orig URI to set path on @param path new path, {@code null} for no path @return new URI instance with given path
[ "Create", "new", "URI", "with", "a", "given", "path", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L570-L576
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.setScheme
public static URI setScheme(final URI orig, final String scheme) { try { return new URI(scheme, orig.getUserInfo(), orig.getHost(), orig.getPort(), orig.getPath(), orig.getQuery(), orig.getFragment()); } catch (final URISyntaxException e) { throw new RuntimeException(e.getMessage...
java
public static URI setScheme(final URI orig, final String scheme) { try { return new URI(scheme, orig.getUserInfo(), orig.getHost(), orig.getPort(), orig.getPath(), orig.getQuery(), orig.getFragment()); } catch (final URISyntaxException e) { throw new RuntimeException(e.getMessage...
[ "public", "static", "URI", "setScheme", "(", "final", "URI", "orig", ",", "final", "String", "scheme", ")", "{", "try", "{", "return", "new", "URI", "(", "scheme", ",", "orig", ".", "getUserInfo", "(", ")", ",", "orig", ".", "getHost", "(", ")", ",",...
Create new URI with a given scheme. @param orig URI to set scheme on @param scheme new scheme, {@code null} for no scheme @return new URI instance with given path
[ "Create", "new", "URI", "with", "a", "given", "scheme", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L585-L591
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.getRelativePath
public static URI getRelativePath(final URI base, final URI ref) { final String baseScheme = base.getScheme(); final String refScheme = ref.getScheme(); final String baseAuth = base.getAuthority(); final String refAuth = ref.getAuthority(); if (!(((baseScheme == null && refScheme...
java
public static URI getRelativePath(final URI base, final URI ref) { final String baseScheme = base.getScheme(); final String refScheme = ref.getScheme(); final String baseAuth = base.getAuthority(); final String refAuth = ref.getAuthority(); if (!(((baseScheme == null && refScheme...
[ "public", "static", "URI", "getRelativePath", "(", "final", "URI", "base", ",", "final", "URI", "ref", ")", "{", "final", "String", "baseScheme", "=", "base", ".", "getScheme", "(", ")", ";", "final", "String", "refScheme", "=", "ref", ".", "getScheme", ...
Resolves absolute URI against another absolute URI. @param base absolute base file URI @param ref absolute reference file URI @return relative URI if possible, otherwise original reference file URI argument
[ "Resolves", "absolute", "URI", "against", "another", "absolute", "URI", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L600-L666
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.setElementID
public static URI setElementID(final URI relativePath, final String id) { String topic = getTopicID(relativePath); if (topic != null) { return setFragment(relativePath, topic + (id != null ? SLASH + id : "")); } else if (id == null) { return stripFragment(relativePath); ...
java
public static URI setElementID(final URI relativePath, final String id) { String topic = getTopicID(relativePath); if (topic != null) { return setFragment(relativePath, topic + (id != null ? SLASH + id : "")); } else if (id == null) { return stripFragment(relativePath); ...
[ "public", "static", "URI", "setElementID", "(", "final", "URI", "relativePath", ",", "final", "String", "id", ")", "{", "String", "topic", "=", "getTopicID", "(", "relativePath", ")", ";", "if", "(", "topic", "!=", "null", ")", "{", "return", "setFragment"...
Set the element ID from the path @param relativePath path @param id element ID @return element ID, may be {@code null}
[ "Set", "the", "element", "ID", "from", "the", "path" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L722-L731
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.getElementID
public static String getElementID(final String relativePath) { final String fragment = FileUtils.getFragment(relativePath); if (fragment != null) { if (fragment.lastIndexOf(SLASH) != -1) { final String id = fragment.substring(fragment.lastIndexOf(SLASH) + 1); ...
java
public static String getElementID(final String relativePath) { final String fragment = FileUtils.getFragment(relativePath); if (fragment != null) { if (fragment.lastIndexOf(SLASH) != -1) { final String id = fragment.substring(fragment.lastIndexOf(SLASH) + 1); ...
[ "public", "static", "String", "getElementID", "(", "final", "String", "relativePath", ")", "{", "final", "String", "fragment", "=", "FileUtils", ".", "getFragment", "(", "relativePath", ")", ";", "if", "(", "fragment", "!=", "null", ")", "{", "if", "(", "f...
Retrieve the element ID from the path @param relativePath path @return element ID, may be {@code null}
[ "Retrieve", "the", "element", "ID", "from", "the", "path" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L739-L748
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/URLUtils.java
URLUtils.getTopicID
public static String getTopicID(final URI relativePath) { final String fragment = relativePath.getFragment(); if (fragment != null) { final String id = fragment.lastIndexOf(SLASH) != -1 ? fragment.substring(0, fragment.lastIndexOf(SLASH)) ...
java
public static String getTopicID(final URI relativePath) { final String fragment = relativePath.getFragment(); if (fragment != null) { final String id = fragment.lastIndexOf(SLASH) != -1 ? fragment.substring(0, fragment.lastIndexOf(SLASH)) ...
[ "public", "static", "String", "getTopicID", "(", "final", "URI", "relativePath", ")", "{", "final", "String", "fragment", "=", "relativePath", ".", "getFragment", "(", ")", ";", "if", "(", "fragment", "!=", "null", ")", "{", "final", "String", "id", "=", ...
Retrieve the topic ID from the path @param relativePath path @return topic ID, may be {@code null}
[ "Retrieve", "the", "topic", "ID", "from", "the", "path" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L756-L765
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.join
@SuppressWarnings("rawtypes") public static String join(final Collection coll, final String delim) { final StringBuilder buff = new StringBuilder(256); Iterator iter; if ((coll == null) || coll.isEmpty()) { return ""; } iter = coll.iterator(); while (ite...
java
@SuppressWarnings("rawtypes") public static String join(final Collection coll, final String delim) { final StringBuilder buff = new StringBuilder(256); Iterator iter; if ((coll == null) || coll.isEmpty()) { return ""; } iter = coll.iterator(); while (ite...
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "String", "join", "(", "final", "Collection", "coll", ",", "final", "String", "delim", ")", "{", "final", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", "256", ")", ";", "Iter...
Assemble all elements in collection to a string. @param coll - java.util.List @param delim - Description of the Parameter @return java.lang.String
[ "Assemble", "all", "elements", "in", "collection", "to", "a", "string", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L42-L61
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.join
@SuppressWarnings({ "rawtypes", "unchecked" }) public static String join(final Map value, final String delim) { if (value == null || value.isEmpty()) { return ""; } final StringBuilder buf = new StringBuilder(); for (final Iterator<Map.Entry<String, String>> i = value.ent...
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static String join(final Map value, final String delim) { if (value == null || value.isEmpty()) { return ""; } final StringBuilder buf = new StringBuilder(); for (final Iterator<Map.Entry<String, String>> i = value.ent...
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "String", "join", "(", "final", "Map", "value", ",", "final", "String", "delim", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "isEmp...
Assemble all elements in map to a string. @param value map to serializer @param delim entry delimiter @return concatenated map
[ "Assemble", "all", "elements", "in", "map", "to", "a", "string", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L70-L84
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.replaceAll
public static String replaceAll(final String input, final String pattern, final String replacement) { final StringBuilder result = new StringBuilder(); int startIndex = 0; int newIndex; while ((newIndex = input.indexOf(pattern, startIndex)) >= 0) { result.append(...
java
public static String replaceAll(final String input, final String pattern, final String replacement) { final StringBuilder result = new StringBuilder(); int startIndex = 0; int newIndex; while ((newIndex = input.indexOf(pattern, startIndex)) >= 0) { result.append(...
[ "public", "static", "String", "replaceAll", "(", "final", "String", "input", ",", "final", "String", "pattern", ",", "final", "String", "replacement", ")", "{", "final", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "int", "startIndex"...
Replaces each substring of this string that matches the given string with the given replacement. Differ from the JDK String.replaceAll function, this method does not support regular expression based replacement on purpose. @param input input string @param pattern This pattern is recognized as it is. It will not solve ...
[ "Replaces", "each", "substring", "of", "this", "string", "that", "matches", "the", "given", "string", "with", "the", "given", "replacement", ".", "Differ", "from", "the", "JDK", "String", ".", "replaceAll", "function", "this", "method", "does", "not", "support...
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L98-L113
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.setOrAppend
public static String setOrAppend(final String target, final String value, final boolean withSpace) { if (target == null) { return value; }if(value == null) { return target; } else { if (withSpace && !target.endsWith(STRING_BLANK)) { return targ...
java
public static String setOrAppend(final String target, final String value, final boolean withSpace) { if (target == null) { return value; }if(value == null) { return target; } else { if (withSpace && !target.endsWith(STRING_BLANK)) { return targ...
[ "public", "static", "String", "setOrAppend", "(", "final", "String", "target", ",", "final", "String", "value", ",", "final", "boolean", "withSpace", ")", "{", "if", "(", "target", "==", "null", ")", "{", "return", "value", ";", "}", "if", "(", "value", ...
If target is null, return the value; else append value to target. If withSpace is true, insert a blank between them. @param target target to be appended @param value value to append @param withSpace whether insert a blank @return processed string
[ "If", "target", "is", "null", "return", "the", "value", ";", "else", "append", "value", "to", "target", ".", "If", "withSpace", "is", "true", "insert", "a", "blank", "between", "them", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L179-L191
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.getLocale
public static Locale getLocale(final String anEncoding) { Locale aLocale = null; String country = null; String language = null; String variant; //Tokenize the string using "-" as the token string as per IETF RFC4646 (superceeds RFC3066). final StringTokenizer tokenizer ...
java
public static Locale getLocale(final String anEncoding) { Locale aLocale = null; String country = null; String language = null; String variant; //Tokenize the string using "-" as the token string as per IETF RFC4646 (superceeds RFC3066). final StringTokenizer tokenizer ...
[ "public", "static", "Locale", "getLocale", "(", "final", "String", "anEncoding", ")", "{", "Locale", "aLocale", "=", "null", ";", "String", "country", "=", "null", ";", "String", "language", "=", "null", ";", "String", "variant", ";", "//Tokenize the string us...
Return a Java Locale object. @param anEncoding encoding @return locale @throws NullPointerException when anEncoding parameter is {@code null}
[ "Return", "a", "Java", "Locale", "object", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L200-L275
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.escapeRegExp
public static String escapeRegExp(final String value) { final StringBuilder buff = new StringBuilder(); if (value == null || value.length() == 0) { return ""; } int index = 0; // $( )+.[^{\ while (index < value.length()) { final char current = valu...
java
public static String escapeRegExp(final String value) { final StringBuilder buff = new StringBuilder(); if (value == null || value.length() == 0) { return ""; } int index = 0; // $( )+.[^{\ while (index < value.length()) { final char current = valu...
[ "public", "static", "String", "escapeRegExp", "(", "final", "String", "value", ")", "{", "final", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "value", "==", "null", "||", "value", ".", "length", "(", ")", "==", "0", ...
Escape regular expression special characters. @param value input @return input with regular expression special characters escaped
[ "Escape", "regular", "expression", "special", "characters", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L283-L334
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.normalizeAndCollapseWhitespace
public static void normalizeAndCollapseWhitespace(final StringBuilder strBuffer) { WhiteSpaceState currentState = WhiteSpaceState.WORD; for (int i = strBuffer.length() - 1; i >= 0; i--) { final char currentChar = strBuffer.charAt(i); if (Character.isWhitespace(currentChar)) { ...
java
public static void normalizeAndCollapseWhitespace(final StringBuilder strBuffer) { WhiteSpaceState currentState = WhiteSpaceState.WORD; for (int i = strBuffer.length() - 1; i >= 0; i--) { final char currentChar = strBuffer.charAt(i); if (Character.isWhitespace(currentChar)) { ...
[ "public", "static", "void", "normalizeAndCollapseWhitespace", "(", "final", "StringBuilder", "strBuffer", ")", "{", "WhiteSpaceState", "currentState", "=", "WhiteSpaceState", ".", "WORD", ";", "for", "(", "int", "i", "=", "strBuffer", ".", "length", "(", ")", "-...
Normalize and collapse whitespaces from string buffer. @param strBuffer The string buffer.
[ "Normalize", "and", "collapse", "whitespaces", "from", "string", "buffer", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L344-L359
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/StringUtils.java
StringUtils.split
public static Collection<String> split(final String value) { if (value == null) { return Collections.emptyList(); } final String[] tokens = value.trim().split("\\s+"); return asList(tokens); }
java
public static Collection<String> split(final String value) { if (value == null) { return Collections.emptyList(); } final String[] tokens = value.trim().split("\\s+"); return asList(tokens); }
[ "public", "static", "Collection", "<", "String", ">", "split", "(", "final", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "final", "String", "[", "]", "tokens", ...
Split string by whitespace. @param value string to split @return list of tokens
[ "Split", "string", "by", "whitespace", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L367-L373
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/ImageMetadataModule.java
ImageMetadataModule.execute
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { if (logger == null) { throw new IllegalStateException("Logger not set"); } final Collection<FileInfo> images = job.getFileInfo(f -> ATTR_FORMAT_VALUE_IMAGE.equa...
java
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { if (logger == null) { throw new IllegalStateException("Logger not set"); } final Collection<FileInfo> images = job.getFileInfo(f -> ATTR_FORMAT_VALUE_IMAGE.equa...
[ "@", "Override", "public", "AbstractPipelineOutput", "execute", "(", "final", "AbstractPipelineInput", "input", ")", "throws", "DITAOTException", "{", "if", "(", "logger", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Logger not set\"", ")...
Entry point of image metadata ModuleElem. @param input Input parameters and resources. @return null @throws DITAOTException exception
[ "Entry", "point", "of", "image", "metadata", "ModuleElem", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/ImageMetadataModule.java#L43-L72
train
apiman/apiman
manager/api/beans/src/main/java/io/apiman/manager/api/beans/BeanUtils.java
BeanUtils.idFromName
public static final String idFromName(String name) { Transliterator tr = Transliterator.getInstance("Any-Latin; Latin-ASCII"); //$NON-NLS-1$ return removeNonWord(tr.transliterate(name)); }
java
public static final String idFromName(String name) { Transliterator tr = Transliterator.getInstance("Any-Latin; Latin-ASCII"); //$NON-NLS-1$ return removeNonWord(tr.transliterate(name)); }
[ "public", "static", "final", "String", "idFromName", "(", "String", "name", ")", "{", "Transliterator", "tr", "=", "Transliterator", ".", "getInstance", "(", "\"Any-Latin; Latin-ASCII\"", ")", ";", "//$NON-NLS-1$", "return", "removeNonWord", "(", "tr", ".", "trans...
Creates a bean id from the given bean name. @param name the name @return the id
[ "Creates", "a", "bean", "id", "from", "the", "given", "bean", "name", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/beans/src/main/java/io/apiman/manager/api/beans/BeanUtils.java#L35-L38
train
apiman/apiman
gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/HttpURLConnectionImpl.java
HttpURLConnectionImpl.getResponse
private HttpEngine getResponse() throws IOException { initHttpEngine(); if (httpEngine.hasResponse()) { return httpEngine; } while (true) { if (!execute(true)) { continue; } Response response = httpEngine.getResponse(); Request followUp = httpEngine.followUpReque...
java
private HttpEngine getResponse() throws IOException { initHttpEngine(); if (httpEngine.hasResponse()) { return httpEngine; } while (true) { if (!execute(true)) { continue; } Response response = httpEngine.getResponse(); Request followUp = httpEngine.followUpReque...
[ "private", "HttpEngine", "getResponse", "(", ")", "throws", "IOException", "{", "initHttpEngine", "(", ")", ";", "if", "(", "httpEngine", ".", "hasResponse", "(", ")", ")", "{", "return", "httpEngine", ";", "}", "while", "(", "true", ")", "{", "if", "(",...
Aggressively tries to get the final HTTP response, potentially making many HTTP requests in the process in order to cope with redirects and authentication.
[ "Aggressively", "tries", "to", "get", "the", "final", "HTTP", "response", "potentially", "making", "many", "HTTP", "requests", "in", "the", "process", "in", "order", "to", "cope", "with", "redirects", "and", "authentication", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/HttpURLConnectionImpl.java#L378-L426
train
apiman/apiman
gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/HttpURLConnectionImpl.java
HttpURLConnectionImpl.execute
private boolean execute(boolean readResponse) throws IOException { try { httpEngine.sendRequest(); route = httpEngine.getRoute(); handshake = httpEngine.getConnection() != null ? httpEngine.getConnection().getHandshake() : null; if (readResponse) { httpEngine.read...
java
private boolean execute(boolean readResponse) throws IOException { try { httpEngine.sendRequest(); route = httpEngine.getRoute(); handshake = httpEngine.getConnection() != null ? httpEngine.getConnection().getHandshake() : null; if (readResponse) { httpEngine.read...
[ "private", "boolean", "execute", "(", "boolean", "readResponse", ")", "throws", "IOException", "{", "try", "{", "httpEngine", ".", "sendRequest", "(", ")", ";", "route", "=", "httpEngine", ".", "getRoute", "(", ")", ";", "handshake", "=", "httpEngine", ".", ...
Sends a request and optionally reads a response. Returns true if the request was successfully executed, and false if the request can be retried. Throws an exception if the request failed permanently.
[ "Sends", "a", "request", "and", "optionally", "reads", "a", "response", ".", "Returns", "true", "if", "the", "request", "was", "successfully", "executed", "and", "false", "if", "the", "request", "can", "be", "retried", ".", "Throws", "an", "exception", "if",...
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/HttpURLConnectionImpl.java#L433-L474
train
apiman/apiman
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/components/ldap/LdapClientConnectionImpl.java
LdapClientConnectionImpl.close
@Override public void close(IAsyncResultHandler<Void> result) { vertx.executeBlocking(blocking -> { super.close(result); }, res -> { if (res.failed()) result.handle(AsyncResultImpl.create(res.cause())); }); }
java
@Override public void close(IAsyncResultHandler<Void> result) { vertx.executeBlocking(blocking -> { super.close(result); }, res -> { if (res.failed()) result.handle(AsyncResultImpl.create(res.cause())); }); }
[ "@", "Override", "public", "void", "close", "(", "IAsyncResultHandler", "<", "Void", ">", "result", ")", "{", "vertx", ".", "executeBlocking", "(", "blocking", "->", "{", "super", ".", "close", "(", "result", ")", ";", "}", ",", "res", "->", "{", "if",...
Indicates whether connection was successfully closed. @param result the result
[ "Indicates", "whether", "connection", "was", "successfully", "closed", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/components/ldap/LdapClientConnectionImpl.java#L51-L59
train
apiman/apiman
gateway/engine/vertx-polling/src/main/java/io/apiman/gateway/engine/vertx/polling/URILoadingRegistry.java
URILoadingRegistry.reloadData
public static void reloadData(IAsyncHandler<Void> doneHandler) { synchronized(URILoadingRegistry.class) { if (instance == null) { doneHandler.handle((Void) null); return; } Map<URILoadingRegistry, IAsyncResultHandler<Void>> regs = instance.hand...
java
public static void reloadData(IAsyncHandler<Void> doneHandler) { synchronized(URILoadingRegistry.class) { if (instance == null) { doneHandler.handle((Void) null); return; } Map<URILoadingRegistry, IAsyncResultHandler<Void>> regs = instance.hand...
[ "public", "static", "void", "reloadData", "(", "IAsyncHandler", "<", "Void", ">", "doneHandler", ")", "{", "synchronized", "(", "URILoadingRegistry", ".", "class", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "doneHandler", ".", "handle", "(", ...
For testing only. Reloads rather than full restart.
[ "For", "testing", "only", ".", "Reloads", "rather", "than", "full", "restart", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/vertx-polling/src/main/java/io/apiman/gateway/engine/vertx/polling/URILoadingRegistry.java#L103-L127
train
apiman/apiman
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TransferQuotaPolicy.java
TransferQuotaPolicy.doQuotaExceededFailure
protected void doQuotaExceededFailure(final IPolicyContext context, final TransferQuotaConfig config, final IPolicyChain<?> chain, RateLimitResponse rtr) { Map<String, String> responseHeaders = RateLimitingPolicy.responseHeaders(config, rtr, defaultLimitHeader(), defaultRemainingHead...
java
protected void doQuotaExceededFailure(final IPolicyContext context, final TransferQuotaConfig config, final IPolicyChain<?> chain, RateLimitResponse rtr) { Map<String, String> responseHeaders = RateLimitingPolicy.responseHeaders(config, rtr, defaultLimitHeader(), defaultRemainingHead...
[ "protected", "void", "doQuotaExceededFailure", "(", "final", "IPolicyContext", "context", ",", "final", "TransferQuotaConfig", "config", ",", "final", "IPolicyChain", "<", "?", ">", "chain", ",", "RateLimitResponse", "rtr", ")", "{", "Map", "<", "String", ",", "...
Called to send a 'quota exceeded' failure. @param context @param config @param chain @param rtr
[ "Called", "to", "send", "a", "quota", "exceeded", "failure", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TransferQuotaPolicy.java#L268-L277
train
apiman/apiman
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaUtil.java
JpaUtil.isConstraintViolation
public static boolean isConstraintViolation(Exception e) { Throwable cause = e; while (cause != cause.getCause() && cause.getCause() != null) { if (cause.getClass().getSimpleName().equals("ConstraintViolationException")) //$NON-NLS-1$ return true; cause = cause.ge...
java
public static boolean isConstraintViolation(Exception e) { Throwable cause = e; while (cause != cause.getCause() && cause.getCause() != null) { if (cause.getClass().getSimpleName().equals("ConstraintViolationException")) //$NON-NLS-1$ return true; cause = cause.ge...
[ "public", "static", "boolean", "isConstraintViolation", "(", "Exception", "e", ")", "{", "Throwable", "cause", "=", "e", ";", "while", "(", "cause", "!=", "cause", ".", "getCause", "(", ")", "&&", "cause", ".", "getCause", "(", ")", "!=", "null", ")", ...
Returns true if the given exception is a unique constraint violation. This is useful to detect whether someone is trying to persist an entity that already exists. It allows us to simply assume that persisting a new entity will work, without first querying the DB for the existence of that entity. Note that my underst...
[ "Returns", "true", "if", "the", "given", "exception", "is", "a", "unique", "constraint", "violation", ".", "This", "is", "useful", "to", "detect", "whether", "someone", "is", "trying", "to", "persist", "an", "entity", "that", "already", "exists", ".", "It", ...
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaUtil.java#L49-L57
train
apiman/apiman
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaUtil.java
JpaUtil.rollbackQuietly
public static void rollbackQuietly(EntityManager entityManager) { if (entityManager.getTransaction().isActive()/* && entityManager.getTransaction().getRollbackOnly()*/) { try { entityManager.getTransaction().rollback(); } catch (Exception e) { logger.error...
java
public static void rollbackQuietly(EntityManager entityManager) { if (entityManager.getTransaction().isActive()/* && entityManager.getTransaction().getRollbackOnly()*/) { try { entityManager.getTransaction().rollback(); } catch (Exception e) { logger.error...
[ "public", "static", "void", "rollbackQuietly", "(", "EntityManager", "entityManager", ")", "{", "if", "(", "entityManager", ".", "getTransaction", "(", ")", ".", "isActive", "(", ")", "/* && entityManager.getTransaction().getRollbackOnly()*/", ")", "{", "try", "{", ...
Rolls back a transaction. Tries to be smart and quiet about it. @param entityManager the entity manager
[ "Rolls", "back", "a", "transaction", ".", "Tries", "to", "be", "smart", "and", "quiet", "about", "it", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaUtil.java#L63-L71
train
apiman/apiman
gateway/platforms/war/src/main/java/io/apiman/gateway/platforms/war/WarEngineConfig.java
WarEngineConfig.getConfigProperty
public String getConfigProperty(String propertyName, String defaultValue) { return getConfig().getString(propertyName, defaultValue); }
java
public String getConfigProperty(String propertyName, String defaultValue) { return getConfig().getString(propertyName, defaultValue); }
[ "public", "String", "getConfigProperty", "(", "String", "propertyName", ",", "String", "defaultValue", ")", "{", "return", "getConfig", "(", ")", ".", "getString", "(", "propertyName", ",", "defaultValue", ")", ";", "}" ]
Returns the given configuration property name or the provided default value if not found. @param propertyName the property name @param defaultValue the default value @return the config property
[ "Returns", "the", "given", "configuration", "property", "name", "or", "the", "provided", "default", "value", "if", "not", "found", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/war/src/main/java/io/apiman/gateway/platforms/war/WarEngineConfig.java#L86-L88
train
apiman/apiman
manager/api/security/src/main/java/io/apiman/manager/api/security/impl/AbstractSecurityContext.java
AbstractSecurityContext.loadPermissions
private IndexedPermissions loadPermissions() { String userId = getCurrentUser(); try { return new IndexedPermissions(getQuery().getPermissions(userId)); } catch (StorageException e) { logger.error(Messages.getString("AbstractSecurityContext.ErrorLoadingPermissions") + use...
java
private IndexedPermissions loadPermissions() { String userId = getCurrentUser(); try { return new IndexedPermissions(getQuery().getPermissions(userId)); } catch (StorageException e) { logger.error(Messages.getString("AbstractSecurityContext.ErrorLoadingPermissions") + use...
[ "private", "IndexedPermissions", "loadPermissions", "(", ")", "{", "String", "userId", "=", "getCurrentUser", "(", ")", ";", "try", "{", "return", "new", "IndexedPermissions", "(", "getQuery", "(", ")", ".", "getPermissions", "(", "userId", ")", ")", ";", "}...
Loads the current user's permissions into a thread local variable.
[ "Loads", "the", "current", "user", "s", "permissions", "into", "a", "thread", "local", "variable", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/security/src/main/java/io/apiman/manager/api/security/impl/AbstractSecurityContext.java#L97-L105
train
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultJdbcComponent.java
DefaultJdbcComponent.datasourceFromConfig
@SuppressWarnings("nls") protected DataSource datasourceFromConfig(JdbcOptionsBean config) { Properties props = new Properties(); props.putAll(config.getDsProperties()); setConfigProperty(props, "jdbcUrl", config.getJdbcUrl()); setConfigProperty(props, "username", config.getUsername(...
java
@SuppressWarnings("nls") protected DataSource datasourceFromConfig(JdbcOptionsBean config) { Properties props = new Properties(); props.putAll(config.getDsProperties()); setConfigProperty(props, "jdbcUrl", config.getJdbcUrl()); setConfigProperty(props, "username", config.getUsername(...
[ "@", "SuppressWarnings", "(", "\"nls\"", ")", "protected", "DataSource", "datasourceFromConfig", "(", "JdbcOptionsBean", "config", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "props", ".", "putAll", "(", "config", ".", "getDsPropert...
Creates a datasource from the given jdbc config info.
[ "Creates", "a", "datasource", "from", "the", "given", "jdbc", "config", "info", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultJdbcComponent.java#L84-L102
train
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultJdbcComponent.java
DefaultJdbcComponent.setConfigProperty
private void setConfigProperty(Properties props, String propName, Object value) { if (value != null) { props.setProperty(propName, String.valueOf(value)); } }
java
private void setConfigProperty(Properties props, String propName, Object value) { if (value != null) { props.setProperty(propName, String.valueOf(value)); } }
[ "private", "void", "setConfigProperty", "(", "Properties", "props", ",", "String", "propName", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "props", ".", "setProperty", "(", "propName", ",", "String", ".", "valueOf", "(", ...
Sets a configuration property, but only if it's not null.
[ "Sets", "a", "configuration", "property", "but", "only", "if", "it", "s", "not", "null", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultJdbcComponent.java#L107-L111
train
apiman/apiman
common/util/src/main/java/io/apiman/common/util/AbstractMessages.java
AbstractMessages.getBundle
private ResourceBundle getBundle() { String bundleKey = getBundleKey(); if (bundles.containsKey(bundleKey)) { return bundles.get(bundleKey); } else { ResourceBundle bundle = loadBundle(); bundles.put(bundleKey, bundle); return bundle; } ...
java
private ResourceBundle getBundle() { String bundleKey = getBundleKey(); if (bundles.containsKey(bundleKey)) { return bundles.get(bundleKey); } else { ResourceBundle bundle = loadBundle(); bundles.put(bundleKey, bundle); return bundle; } ...
[ "private", "ResourceBundle", "getBundle", "(", ")", "{", "String", "bundleKey", "=", "getBundleKey", "(", ")", ";", "if", "(", "bundles", ".", "containsKey", "(", "bundleKey", ")", ")", "{", "return", "bundles", ".", "get", "(", "bundleKey", ")", ";", "}...
Gets a bundle. First tries to find one in the cache, then loads it if it can't find one.
[ "Gets", "a", "bundle", ".", "First", "tries", "to", "find", "one", "in", "the", "cache", "then", "loads", "it", "if", "it", "can", "t", "find", "one", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/util/src/main/java/io/apiman/common/util/AbstractMessages.java#L61-L70
train
apiman/apiman
common/util/src/main/java/io/apiman/common/util/AbstractMessages.java
AbstractMessages.loadBundle
private ResourceBundle loadBundle() { String pkg = clazz.getPackage().getName(); Locale locale = getLocale(); return PropertyResourceBundle.getBundle(pkg + ".messages", locale, clazz.getClassLoader(), new ResourceBundle.Control() { //$NON-NLS-1$ @Override public List<Stri...
java
private ResourceBundle loadBundle() { String pkg = clazz.getPackage().getName(); Locale locale = getLocale(); return PropertyResourceBundle.getBundle(pkg + ".messages", locale, clazz.getClassLoader(), new ResourceBundle.Control() { //$NON-NLS-1$ @Override public List<Stri...
[ "private", "ResourceBundle", "loadBundle", "(", ")", "{", "String", "pkg", "=", "clazz", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ";", "Locale", "locale", "=", "getLocale", "(", ")", ";", "return", "PropertyResourceBundle", ".", "getBundle", ...
Loads the resource bundle. @param c
[ "Loads", "the", "resource", "bundle", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/util/src/main/java/io/apiman/common/util/AbstractMessages.java#L85-L94
train
apiman/apiman
common/util/src/main/java/io/apiman/common/util/AbstractMessages.java
AbstractMessages.format
public String format(String key, Object ... params) { ResourceBundle bundle = getBundle(); if (bundle.containsKey(key)) { String msg = bundle.getString(key); return MessageFormat.format(msg, params); } else { return MessageFormat.format("!!{0}!!", key); //$NON...
java
public String format(String key, Object ... params) { ResourceBundle bundle = getBundle(); if (bundle.containsKey(key)) { String msg = bundle.getString(key); return MessageFormat.format(msg, params); } else { return MessageFormat.format("!!{0}!!", key); //$NON...
[ "public", "String", "format", "(", "String", "key", ",", "Object", "...", "params", ")", "{", "ResourceBundle", "bundle", "=", "getBundle", "(", ")", ";", "if", "(", "bundle", ".", "containsKey", "(", "key", ")", ")", "{", "String", "msg", "=", "bundle...
Look up a message in the i18n resource message bundle by key, then format the message with the given params and return the result. @param key the key @param params the parameters @return formatted string
[ "Look", "up", "a", "message", "in", "the", "i18n", "resource", "message", "bundle", "by", "key", "then", "format", "the", "message", "with", "the", "given", "params", "and", "return", "the", "result", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/util/src/main/java/io/apiman/common/util/AbstractMessages.java#L116-L124
train
apiman/apiman
gateway/engine/influxdb/src/main/java/io/apiman/gateway/engine/influxdb/InfluxDb09Driver.java
InfluxDb09Driver.listDatabases
@SuppressWarnings("nls") public void listDatabases(final IAsyncResultHandler<List<String>> handler) { IHttpClientRequest request = httpClient.request(queryUrl.toString(), HttpMethod.GET, result -> { try { if (result.isError() || result.getResult()...
java
@SuppressWarnings("nls") public void listDatabases(final IAsyncResultHandler<List<String>> handler) { IHttpClientRequest request = httpClient.request(queryUrl.toString(), HttpMethod.GET, result -> { try { if (result.isError() || result.getResult()...
[ "@", "SuppressWarnings", "(", "\"nls\"", ")", "public", "void", "listDatabases", "(", "final", "IAsyncResultHandler", "<", "List", "<", "String", ">", ">", "handler", ")", "{", "IHttpClientRequest", "request", "=", "httpClient", ".", "request", "(", "queryUrl", ...
List all databases @param handler the result handler
[ "List", "all", "databases" ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/influxdb/src/main/java/io/apiman/gateway/engine/influxdb/InfluxDb09Driver.java#L111-L141
train
apiman/apiman
manager/api/war/src/main/java/io/apiman/manager/api/war/WarCdiFactory.java
WarCdiFactory.createCustomComponent
@SuppressWarnings("unchecked") private static <T> T createCustomComponent(Class<T> componentType, Class<?> componentClass, Map<String, String> configProperties) throws Exception { if (componentClass == null) { throw new IllegalArgumentException("Invalid component spec (class not foun...
java
@SuppressWarnings("unchecked") private static <T> T createCustomComponent(Class<T> componentType, Class<?> componentClass, Map<String, String> configProperties) throws Exception { if (componentClass == null) { throw new IllegalArgumentException("Invalid component spec (class not foun...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "<", "T", ">", "T", "createCustomComponent", "(", "Class", "<", "T", ">", "componentType", ",", "Class", "<", "?", ">", "componentClass", ",", "Map", "<", "String", ",", "String", ">"...
Creates a custom component from a loaded class. @param componentType @param componentClass @param configProperties
[ "Creates", "a", "custom", "component", "from", "a", "loaded", "class", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/war/src/main/java/io/apiman/manager/api/war/WarCdiFactory.java#L370-L382
train
apiman/apiman
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaStorageInitializer.java
JpaStorageInitializer.lookupDS
private static DataSource lookupDS(String dsJndiLocation) { DataSource ds; try { InitialContext ctx = new InitialContext(); ds = (DataSource) ctx.lookup(dsJndiLocation); } catch (Exception e) { throw new RuntimeException(e); } if (ds == null) ...
java
private static DataSource lookupDS(String dsJndiLocation) { DataSource ds; try { InitialContext ctx = new InitialContext(); ds = (DataSource) ctx.lookup(dsJndiLocation); } catch (Exception e) { throw new RuntimeException(e); } if (ds == null) ...
[ "private", "static", "DataSource", "lookupDS", "(", "String", "dsJndiLocation", ")", "{", "DataSource", "ds", ";", "try", "{", "InitialContext", "ctx", "=", "new", "InitialContext", "(", ")", ";", "ds", "=", "(", "DataSource", ")", "ctx", ".", "lookup", "(...
Lookup the datasource in JNDI. @param dsJndiLocation
[ "Lookup", "the", "datasource", "in", "JNDI", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaStorageInitializer.java#L102-L115
train
apiman/apiman
common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java
PluginClassLoader.createWorkDir
protected File createWorkDir(File pluginArtifactFile) throws IOException { File tempDir = File.createTempFile(pluginArtifactFile.getName(), ""); tempDir.delete(); tempDir.mkdirs(); return tempDir; }
java
protected File createWorkDir(File pluginArtifactFile) throws IOException { File tempDir = File.createTempFile(pluginArtifactFile.getName(), ""); tempDir.delete(); tempDir.mkdirs(); return tempDir; }
[ "protected", "File", "createWorkDir", "(", "File", "pluginArtifactFile", ")", "throws", "IOException", "{", "File", "tempDir", "=", "File", ".", "createTempFile", "(", "pluginArtifactFile", ".", "getName", "(", ")", ",", "\"\"", ")", ";", "tempDir", ".", "dele...
Creates a work directory into which various resources discovered in the plugin artifact can be extracted. @param pluginArtifactFile plugin artifact @throws IOException if an I/O error has occurred
[ "Creates", "a", "work", "directory", "into", "which", "various", "resources", "discovered", "in", "the", "plugin", "artifact", "can", "be", "extracted", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java#L81-L86
train
apiman/apiman
common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java
PluginClassLoader.indexPluginArtifact
private void indexPluginArtifact() throws IOException { dependencyZips = new ArrayList<>(); Enumeration<? extends ZipEntry> entries = this.pluginArtifactZip.entries(); while (entries.hasMoreElements()) { ZipEntry zipEntry = entries.nextElement(); if (zipEntry.getName().st...
java
private void indexPluginArtifact() throws IOException { dependencyZips = new ArrayList<>(); Enumeration<? extends ZipEntry> entries = this.pluginArtifactZip.entries(); while (entries.hasMoreElements()) { ZipEntry zipEntry = entries.nextElement(); if (zipEntry.getName().st...
[ "private", "void", "indexPluginArtifact", "(", ")", "throws", "IOException", "{", "dependencyZips", "=", "new", "ArrayList", "<>", "(", ")", ";", "Enumeration", "<", "?", "extends", "ZipEntry", ">", "entries", "=", "this", ".", "pluginArtifactZip", ".", "entri...
Indexes the content of the plugin artifact. This includes discovering all of the dependency JARs as well as any configuration resources such as plugin definitions. @throws IOException if an I/O error has occurred
[ "Indexes", "the", "content", "of", "the", "plugin", "artifact", ".", "This", "includes", "discovering", "all", "of", "the", "dependency", "JARs", "as", "well", "as", "any", "configuration", "resources", "such", "as", "plugin", "definitions", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java#L93-L105
train
apiman/apiman
common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java
PluginClassLoader.findClassContent
protected InputStream findClassContent(String className) throws IOException { String primaryArtifactEntryName = "WEB-INF/classes/" + className.replace('.', '/') + ".class"; String dependencyEntryName = className.replace('.', '/') + ".class"; ZipEntry entry = this.pluginArtifactZip.getEntry(prima...
java
protected InputStream findClassContent(String className) throws IOException { String primaryArtifactEntryName = "WEB-INF/classes/" + className.replace('.', '/') + ".class"; String dependencyEntryName = className.replace('.', '/') + ".class"; ZipEntry entry = this.pluginArtifactZip.getEntry(prima...
[ "protected", "InputStream", "findClassContent", "(", "String", "className", ")", "throws", "IOException", "{", "String", "primaryArtifactEntryName", "=", "\"WEB-INF/classes/\"", "+", "className", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".class\""...
Searches the plugin artifact ZIP and all dependency ZIPs for a zip entry for the given fully qualified class name. @param className name of class @throws IOException if an I/O error has occurred
[ "Searches", "the", "plugin", "artifact", "ZIP", "and", "all", "dependency", "ZIPs", "for", "a", "zip", "entry", "for", "the", "given", "fully", "qualified", "class", "name", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java#L206-L220
train
apiman/apiman
common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java
PluginClassLoader.close
public void close() throws IOException { if (closed) { return; } this.pluginArtifactZip.close(); for (ZipFile zipFile : this.dependencyZips) { zipFile.close(); } closed = true; }
java
public void close() throws IOException { if (closed) { return; } this.pluginArtifactZip.close(); for (ZipFile zipFile : this.dependencyZips) { zipFile.close(); } closed = true; }
[ "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "closed", ")", "{", "return", ";", "}", "this", ".", "pluginArtifactZip", ".", "close", "(", ")", ";", "for", "(", "ZipFile", "zipFile", ":", "this", ".", "dependencyZips", "...
Closes any resources the plugin classloader is holding open. @throws IOException if an I/O error has occurred
[ "Closes", "any", "resources", "the", "plugin", "classloader", "is", "holding", "open", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/plugin/src/main/java/io/apiman/common/plugin/PluginClassLoader.java#L322-L329
train
apiman/apiman
manager/api/core/src/main/java/io/apiman/manager/api/core/plugin/AbstractPluginRegistry.java
AbstractPluginRegistry.createPluginClassLoader
protected PluginClassLoader createPluginClassLoader(final File pluginFile) throws IOException { return new PluginClassLoader(pluginFile, Thread.currentThread().getContextClassLoader()) { @Override protected File createWorkDir(File pluginArtifactFile) throws IOException { ...
java
protected PluginClassLoader createPluginClassLoader(final File pluginFile) throws IOException { return new PluginClassLoader(pluginFile, Thread.currentThread().getContextClassLoader()) { @Override protected File createWorkDir(File pluginArtifactFile) throws IOException { ...
[ "protected", "PluginClassLoader", "createPluginClassLoader", "(", "final", "File", "pluginFile", ")", "throws", "IOException", "{", "return", "new", "PluginClassLoader", "(", "pluginFile", ",", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(...
Creates a plugin classloader for the given plugin file.
[ "Creates", "a", "plugin", "classloader", "for", "the", "given", "plugin", "file", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/core/src/main/java/io/apiman/manager/api/core/plugin/AbstractPluginRegistry.java#L133-L142
train
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java
InMemoryRegistry.getClientInternal
protected Client getClientInternal(String idx) { Client client; synchronized (mutex) { client = (Client) getMap().get(idx); } return client; }
java
protected Client getClientInternal(String idx) { Client client; synchronized (mutex) { client = (Client) getMap().get(idx); } return client; }
[ "protected", "Client", "getClientInternal", "(", "String", "idx", ")", "{", "Client", "client", ";", "synchronized", "(", "mutex", ")", "{", "client", "=", "(", "Client", ")", "getMap", "(", ")", ".", "get", "(", "idx", ")", ";", "}", "return", "client...
Gets the client and returns it. @param apiKey
[ "Gets", "the", "client", "and", "returns", "it", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java#L169-L175
train
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java
InMemoryRegistry.getClientIndex
private String getClientIndex(Client client) { return getClientIndex(client.getOrganizationId(), client.getClientId(), client.getVersion()); }
java
private String getClientIndex(Client client) { return getClientIndex(client.getOrganizationId(), client.getClientId(), client.getVersion()); }
[ "private", "String", "getClientIndex", "(", "Client", "client", ")", "{", "return", "getClientIndex", "(", "client", ".", "getOrganizationId", "(", ")", ",", "client", ".", "getClientId", "(", ")", ",", "client", ".", "getVersion", "(", ")", ")", ";", "}" ...
Generates an in-memory key for an client, used to index the client for later quick retrieval. @param client an client @return a client key
[ "Generates", "an", "in", "-", "memory", "key", "for", "an", "client", "used", "to", "index", "the", "client", "for", "later", "quick", "retrieval", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java#L349-L351
train
apiman/apiman
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaStorage.java
JpaStorage.getClientContractsInternal
protected List<ContractSummaryBean> getClientContractsInternal(String organizationId, String clientId, String version) throws StorageException { List<ContractSummaryBean> rval = new ArrayList<>(); EntityManager entityManager = getActiveEntityManager(); String jpql = "...
java
protected List<ContractSummaryBean> getClientContractsInternal(String organizationId, String clientId, String version) throws StorageException { List<ContractSummaryBean> rval = new ArrayList<>(); EntityManager entityManager = getActiveEntityManager(); String jpql = "...
[ "protected", "List", "<", "ContractSummaryBean", ">", "getClientContractsInternal", "(", "String", "organizationId", ",", "String", "clientId", ",", "String", "version", ")", "throws", "StorageException", "{", "List", "<", "ContractSummaryBean", ">", "rval", "=", "n...
Returns a list of all contracts for the given client. @param organizationId @param clientId @param version @throws StorageException
[ "Returns", "a", "list", "of", "all", "contracts", "for", "the", "given", "client", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/JpaStorage.java#L1382-L1429
train
apiman/apiman
manager/api/migrator/src/main/java/io/apiman/manager/api/migrator/DataMigrator.java
DataMigrator.main
public static void main(String[] args) { File from; File to; if (args.length < 2) { System.out.println("Usage: DataMigrator <pathToSourceFile> <pathToDestFile>"); //$NON-NLS-1$ return; } String frompath = args[0]; String topath =...
java
public static void main(String[] args) { File from; File to; if (args.length < 2) { System.out.println("Usage: DataMigrator <pathToSourceFile> <pathToDestFile>"); //$NON-NLS-1$ return; } String frompath = args[0]; String topath =...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "File", "from", ";", "File", "to", ";", "if", "(", "args", ".", "length", "<", "2", ")", "{", "System", ".", "out", ".", "println", "(", "\"Usage: DataMigrator <pathToSourc...
Main method - used when running the data migrator in standalone mode. @param args
[ "Main", "method", "-", "used", "when", "running", "the", "data", "migrator", "in", "standalone", "mode", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/migrator/src/main/java/io/apiman/manager/api/migrator/DataMigrator.java#L102-L126
train
apiman/apiman
gateway/engine/storage-common/src/main/java/io/apiman/gateway/engine/storage/util/BackingStoreUtil.java
BackingStoreUtil.readPrimitive
public static Object readPrimitive(Class<?> clazz, String value) throws Exception { if (clazz == String.class) { return value; } else if (clazz == Long.class) { return Long.parseLong(value); } else if (clazz == Integer.class) { return Integer.parseInt(value); ...
java
public static Object readPrimitive(Class<?> clazz, String value) throws Exception { if (clazz == String.class) { return value; } else if (clazz == Long.class) { return Long.parseLong(value); } else if (clazz == Integer.class) { return Integer.parseInt(value); ...
[ "public", "static", "Object", "readPrimitive", "(", "Class", "<", "?", ">", "clazz", ",", "String", "value", ")", "throws", "Exception", "{", "if", "(", "clazz", "==", "String", ".", "class", ")", "{", "return", "value", ";", "}", "else", "if", "(", ...
Parses the String value as a primitive or a String, depending on its type. @param clazz the destination type @param value the value to parse @return the parsed value @throws Exception
[ "Parses", "the", "String", "value", "as", "a", "primitive", "or", "a", "String", "depending", "on", "its", "type", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/storage-common/src/main/java/io/apiman/gateway/engine/storage/util/BackingStoreUtil.java#L41-L61
train
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/ESSharedStateComponent.java
ESSharedStateComponent.readPrimitive
protected Object readPrimitive(JestResult result) throws Exception { PrimitiveBean pb = result.getSourceAsObject(PrimitiveBean.class); String value = pb.getValue(); Class<?> c = Class.forName(pb.getType()); return BackingStoreUtil.readPrimitive(c, value); }
java
protected Object readPrimitive(JestResult result) throws Exception { PrimitiveBean pb = result.getSourceAsObject(PrimitiveBean.class); String value = pb.getValue(); Class<?> c = Class.forName(pb.getType()); return BackingStoreUtil.readPrimitive(c, value); }
[ "protected", "Object", "readPrimitive", "(", "JestResult", "result", ")", "throws", "Exception", "{", "PrimitiveBean", "pb", "=", "result", ".", "getSourceAsObject", "(", "PrimitiveBean", ".", "class", ")", ";", "String", "value", "=", "pb", ".", "getValue", "...
Reads a stored primitive. @param result
[ "Reads", "a", "stored", "primitive", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/ESSharedStateComponent.java#L150-L155
train
apiman/apiman
gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/components/HttpClientRequestImpl.java
HttpClientRequestImpl.connect
private void connect() { try { URL url = new URL(this.endpoint); connection = (HttpURLConnection) url.openConnection(); connection.setReadTimeout(this.readTimeoutMs); connection.setConnectTimeout(this.connectTimeoutMs); connection.setRequestMethod(this...
java
private void connect() { try { URL url = new URL(this.endpoint); connection = (HttpURLConnection) url.openConnection(); connection.setReadTimeout(this.readTimeoutMs); connection.setConnectTimeout(this.connectTimeoutMs); connection.setRequestMethod(this...
[ "private", "void", "connect", "(", ")", "{", "try", "{", "URL", "url", "=", "new", "URL", "(", "this", ".", "endpoint", ")", ";", "connection", "=", "(", "HttpURLConnection", ")", "url", ".", "openConnection", "(", ")", ";", "connection", ".", "setRead...
Connect to the remote server.
[ "Connect", "to", "the", "remote", "server", "." ]
8c049c2a2f2e4a69bbb6125686a15edd26f29c21
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/components/HttpClientRequestImpl.java#L151-L173
train