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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/servicefactory/ServiceFactory.java | ServiceFactory.getInstance | public synchronized static ServiceFactory getInstance(Class<?> aClass, String configurationPath)
{
if(configurationPath == null)
{
configurationPath = "";
}
if (instances.get(configurationPath) == null)
{
instances.put(con... | java | public synchronized static ServiceFactory getInstance(Class<?> aClass, String configurationPath)
{
if(configurationPath == null)
{
configurationPath = "";
}
if (instances.get(configurationPath) == null)
{
instances.put(con... | [
"public",
"synchronized",
"static",
"ServiceFactory",
"getInstance",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"String",
"configurationPath",
")",
"{",
"if",
"(",
"configurationPath",
"==",
"null",
")",
"{",
"configurationPath",
"=",
"\"\"",
";",
"}",
"if",
... | Singleton factory method
@param aClass the class implements
@param configurationPath the path to the configuration details
@return a single instance of the ServiceFactory object
for the JVM | [
"Singleton",
"factory",
"method"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/servicefactory/ServiceFactory.java#L107-L120 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/decorator/MappedTextFormatDecorator.java | MappedTextFormatDecorator.getText | public String getText()
{
//convert textable to map of text
Object key = null;
try
{
//read bindTemplate
String bindTemplate = getTemplate();
Map<Object,String> textMap = new Hashtable<Object,String>();
for(Map.Entry<String, Textable> en... | java | public String getText()
{
//convert textable to map of text
Object key = null;
try
{
//read bindTemplate
String bindTemplate = getTemplate();
Map<Object,String> textMap = new Hashtable<Object,String>();
for(Map.Entry<String, Textable> en... | [
"public",
"String",
"getText",
"(",
")",
"{",
"//convert textable to map of text\r",
"Object",
"key",
"=",
"null",
";",
"try",
"{",
"//read bindTemplate\r",
"String",
"bindTemplate",
"=",
"getTemplate",
"(",
")",
";",
"Map",
"<",
"Object",
",",
"String",
">",
... | Convert get text output from each Textable in map.
Return the format output using Text.format.
Note the bind template is retrieved from
the URL provided in templateUrl.
@see nyla.solutions.core.data.Textable#getText() | [
"Convert",
"get",
"text",
"output",
"from",
"each",
"Textable",
"in",
"map",
".",
"Return",
"the",
"format",
"output",
"using",
"Text",
".",
"format",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/decorator/MappedTextFormatDecorator.java#L79-L118 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/workthread/ExecutorBoss.java | ExecutorBoss.startWorking | public <T> Collection<T> startWorking(Callable<T>[] callables)
{
List<Future<T>> list = new ArrayList<Future<T>>();
for (int i = 0; i < callables.length; i++)
{
list.add(executor.submit(callables[i]));
}
ArrayList<T> resultList = new ArrayList<T>(ca... | java | public <T> Collection<T> startWorking(Callable<T>[] callables)
{
List<Future<T>> list = new ArrayList<Future<T>>();
for (int i = 0; i < callables.length; i++)
{
list.add(executor.submit(callables[i]));
}
ArrayList<T> resultList = new ArrayList<T>(ca... | [
"public",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"startWorking",
"(",
"Callable",
"<",
"T",
">",
"[",
"]",
"callables",
")",
"{",
"List",
"<",
"Future",
"<",
"T",
">>",
"list",
"=",
"new",
"ArrayList",
"<",
"Future",
"<",
"T",
">",
">",
"(",... | Start the array of the callables
@param <T> the type class
@param callables of callables
@return the collection of returned object from the callables | [
"Start",
"the",
"array",
"of",
"the",
"callables"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/workthread/ExecutorBoss.java#L110-L144 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/workthread/ExecutorBoss.java | ExecutorBoss.startWorking | public Collection<Future<?>> startWorking(WorkQueue queue, boolean background)
{
ArrayList<Future<?>> futures = new ArrayList<Future<?>>(queue.size());
while(queue.hasMoreTasks())
{
futures.add(executor.submit(queue.nextTask()));
}
if(background)
ret... | java | public Collection<Future<?>> startWorking(WorkQueue queue, boolean background)
{
ArrayList<Future<?>> futures = new ArrayList<Future<?>>(queue.size());
while(queue.hasMoreTasks())
{
futures.add(executor.submit(queue.nextTask()));
}
if(background)
ret... | [
"public",
"Collection",
"<",
"Future",
"<",
"?",
">",
">",
"startWorking",
"(",
"WorkQueue",
"queue",
",",
"boolean",
"background",
")",
"{",
"ArrayList",
"<",
"Future",
"<",
"?",
">",
">",
"futures",
"=",
"new",
"ArrayList",
"<",
"Future",
"<",
"?",
"... | The start the work threads
@param queue the queue
@param background determine to while for futures to complete
@return the collection of futures | [
"The",
"start",
"the",
"work",
"threads"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/workthread/ExecutorBoss.java#L205-L236 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/reflection/Mirror.java | Mirror.newInstanceForClassName | public static Mirror newInstanceForClassName(String className)
throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
className = className.trim();
Class<?> objClass = Class.forName(className);
return new Mirror(ClassPath.newInstance(objClass));
} | java | public static Mirror newInstanceForClassName(String className)
throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
className = className.trim();
Class<?> objClass = Class.forName(className);
return new Mirror(ClassPath.newInstance(objClass));
} | [
"public",
"static",
"Mirror",
"newInstanceForClassName",
"(",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
",",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"className",
"=",
"className",
".",
"trim",
"(",
")",
";",
"Class",
"<",
... | Create an instance of the given object
@param className the class name
@return the object reflector instance
@throws ClassNotFoundException
@throws InstantiationException
@throws IllegalAccessException | [
"Create",
"an",
"instance",
"of",
"the",
"given",
"object"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/reflection/Mirror.java#L84-L92 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/io/FileMonitor.java | FileMonitor.waitFor | public static void waitFor(File aFile)
{
if(aFile == null)
return;
String path =aFile.getAbsolutePath();
long previousSize = IO.getFileSize(path);
long currentSize = previousSize;
long sleepTime = Config.getPropertyLong("file.monitor.file.wait.t... | java | public static void waitFor(File aFile)
{
if(aFile == null)
return;
String path =aFile.getAbsolutePath();
long previousSize = IO.getFileSize(path);
long currentSize = previousSize;
long sleepTime = Config.getPropertyLong("file.monitor.file.wait.t... | [
"public",
"static",
"void",
"waitFor",
"(",
"File",
"aFile",
")",
"{",
"if",
"(",
"aFile",
"==",
"null",
")",
"return",
";",
"String",
"path",
"=",
"aFile",
".",
"getAbsolutePath",
"(",
")",
";",
"long",
"previousSize",
"=",
"IO",
".",
"getFileSize",
"... | Used to wait for transferred file's content length to stop changes for
5 seconds
@param aFile the file | [
"Used",
"to",
"wait",
"for",
"transferred",
"file",
"s",
"content",
"length",
"to",
"stop",
"changes",
"for",
"5",
"seconds"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/FileMonitor.java#L57-L85 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/io/FileMonitor.java | FileMonitor.notifyChange | protected synchronized void notifyChange(File file)
{
System.out.println("Notify change file="+file.getAbsolutePath());
this.notify(FileEvent.createChangedEvent(file));
} | java | protected synchronized void notifyChange(File file)
{
System.out.println("Notify change file="+file.getAbsolutePath());
this.notify(FileEvent.createChangedEvent(file));
} | [
"protected",
"synchronized",
"void",
"notifyChange",
"(",
"File",
"file",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Notify change file=\"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"this",
".",
"notify",
"(",
"FileEvent",
".",
... | Notify observers that the file has changed
@param file
the file that changes | [
"Notify",
"observers",
"that",
"the",
"file",
"has",
"changed"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/FileMonitor.java#L113-L121 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/security/user/conversion/VcfFileToUserProfileConverter.java | VcfFileToUserProfileConverter.convert | @Override
public UserProfile convert(File file)
{
if(file == null)
return null;
try
{
String text = IO.readFile(file);
if(text == null || text.length() == 0)
return null;
return converter.convert(text);
}
catch (IOException e)
{
throw new SystemException("Unable to convert f... | java | @Override
public UserProfile convert(File file)
{
if(file == null)
return null;
try
{
String text = IO.readFile(file);
if(text == null || text.length() == 0)
return null;
return converter.convert(text);
}
catch (IOException e)
{
throw new SystemException("Unable to convert f... | [
"@",
"Override",
"public",
"UserProfile",
"convert",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"String",
"text",
"=",
"IO",
".",
"readFile",
"(",
"file",
")",
";",
"if",
"(",
"text",
"==... | Convert the user profile | [
"Convert",
"the",
"user",
"profile"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/security/user/conversion/VcfFileToUserProfileConverter.java#L31-L51 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java | SubjectRegistry.register | public <T> void register(String subjectName,
SubjectObserver<T> subjectObserver,
Subject<T> subject)
{
subject.add(subjectObserver);
this.registry.put(subjectName, subject);
} | java | public <T> void register(String subjectName,
SubjectObserver<T> subjectObserver,
Subject<T> subject)
{
subject.add(subjectObserver);
this.registry.put(subjectName, subject);
} | [
"public",
"<",
"T",
">",
"void",
"register",
"(",
"String",
"subjectName",
",",
"SubjectObserver",
"<",
"T",
">",
"subjectObserver",
",",
"Subject",
"<",
"T",
">",
"subject",
")",
"{",
"subject",
".",
"add",
"(",
"subjectObserver",
")",
";",
"this",
".",... | Add subject observer to a subject
@param <T> the class type
@param subjectName the subject name
@param subjectObserver the subject observer
@param subject the subject to add the observer | [
"Add",
"subject",
"observer",
"to",
"a",
"subject"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java#L67-L74 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java | SubjectRegistry.removeRegistraion | @SuppressWarnings({ "unchecked", "rawtypes" })
public <T> void removeRegistraion(String subjectName, SubjectObserver<T> subjectObserver)
{
Subject subject = (Subject)this.registry.get(subjectName);
if(subject == null)
return;
subject.remove(subjectObserver);
... | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public <T> void removeRegistraion(String subjectName, SubjectObserver<T> subjectObserver)
{
Subject subject = (Subject)this.registry.get(subjectName);
if(subject == null)
return;
subject.remove(subjectObserver);
... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"<",
"T",
">",
"void",
"removeRegistraion",
"(",
"String",
"subjectName",
",",
"SubjectObserver",
"<",
"T",
">",
"subjectObserver",
")",
"{",
"Subject",
"subject",
"="... | Remove an observer for a registered observer
@param <T> the class type
@param subjectName the subject name to remove
@param subjectObserver the subject observer | [
"Remove",
"an",
"observer",
"for",
"a",
"registered",
"observer"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java#L81-L91 | train |
jinahya/bit-io | src/main/java/com/github/jinahya/bit/io/BufferByteOutput.java | BufferByteOutput.of | @SuppressWarnings({"Duplicates"})
public static BufferByteOutput<ByteBuffer> of(final int capacity, final WritableByteChannel channel) {
if (capacity <= 0) {
throw new IllegalArgumentException("capacity(" + capacity + ") <= 0");
}
if (channel == null) {
throw new Null... | java | @SuppressWarnings({"Duplicates"})
public static BufferByteOutput<ByteBuffer> of(final int capacity, final WritableByteChannel channel) {
if (capacity <= 0) {
throw new IllegalArgumentException("capacity(" + capacity + ") <= 0");
}
if (channel == null) {
throw new Null... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"Duplicates\"",
"}",
")",
"public",
"static",
"BufferByteOutput",
"<",
"ByteBuffer",
">",
"of",
"(",
"final",
"int",
"capacity",
",",
"final",
"WritableByteChannel",
"channel",
")",
"{",
"if",
"(",
"capacity",
"<=",
"0",
... | Creates a new instance which writes bytes to specified channel using a byte buffer of given capacity.
@param capacity the capacity for the byte buffer.
@param channel the channel to which bytes are written.
@return a new instance of byte buffer.
@see #flush(BufferByteOutput, WritableByteChannel) | [
"Creates",
"a",
"new",
"instance",
"which",
"writes",
"bytes",
"to",
"specified",
"channel",
"using",
"a",
"byte",
"buffer",
"of",
"given",
"capacity",
"."
] | f3b49bbec80047c0cc3ea2424def98eb2d08352a | https://github.com/jinahya/bit-io/blob/f3b49bbec80047c0cc3ea2424def98eb2d08352a/src/main/java/com/github/jinahya/bit/io/BufferByteOutput.java#L46-L76 | train |
jinahya/bit-io | src/main/java/com/github/jinahya/bit/io/BufferByteOutput.java | BufferByteOutput.flush | public static int flush(final BufferByteOutput<?> output, final WritableByteChannel channel) throws IOException {
final ByteBuffer buffer = output.getTarget();
if (buffer == null) {
return 0;
}
int written = 0;
for (buffer.flip(); buffer.hasRemaining(); ) {
... | java | public static int flush(final BufferByteOutput<?> output, final WritableByteChannel channel) throws IOException {
final ByteBuffer buffer = output.getTarget();
if (buffer == null) {
return 0;
}
int written = 0;
for (buffer.flip(); buffer.hasRemaining(); ) {
... | [
"public",
"static",
"int",
"flush",
"(",
"final",
"BufferByteOutput",
"<",
"?",
">",
"output",
",",
"final",
"WritableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"final",
"ByteBuffer",
"buffer",
"=",
"output",
".",
"getTarget",
"(",
")",
";",
... | Flushes the internal byte buffer of given byte output to specified channel and returns the number of bytes
written.
@param output the output whose buffer is flushed.
@param channel the channel to which the buffer is flushed.
@return the number of bytes written while flushing; {@code 0} if there is no inter buffer.
@t... | [
"Flushes",
"the",
"internal",
"byte",
"buffer",
"of",
"given",
"byte",
"output",
"to",
"specified",
"channel",
"and",
"returns",
"the",
"number",
"of",
"bytes",
"written",
"."
] | f3b49bbec80047c0cc3ea2424def98eb2d08352a | https://github.com/jinahya/bit-io/blob/f3b49bbec80047c0cc3ea2424def98eb2d08352a/src/main/java/com/github/jinahya/bit/io/BufferByteOutput.java#L89-L100 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java | Scheduler.durationMS | public static long durationMS(LocalDateTime start,LocalDateTime end)
{
if(start == null || end == null)
{
return 0;
}
return Duration.between(start, end).toMillis();
} | java | public static long durationMS(LocalDateTime start,LocalDateTime end)
{
if(start == null || end == null)
{
return 0;
}
return Duration.between(start, end).toMillis();
} | [
"public",
"static",
"long",
"durationMS",
"(",
"LocalDateTime",
"start",
",",
"LocalDateTime",
"end",
")",
"{",
"if",
"(",
"start",
"==",
"null",
"||",
"end",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"Duration",
".",
"between",
"(",
"... | The time between two dates
@param start the begin time
@param end the finish time
@return duration in milliseconds | [
"The",
"time",
"between",
"two",
"dates"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L85-L93 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java | Scheduler.durationSeconds | public static double durationSeconds(LocalDateTime start, LocalDateTime end)
{
return Duration.between(start, end).getSeconds();
} | java | public static double durationSeconds(LocalDateTime start, LocalDateTime end)
{
return Duration.between(start, end).getSeconds();
} | [
"public",
"static",
"double",
"durationSeconds",
"(",
"LocalDateTime",
"start",
",",
"LocalDateTime",
"end",
")",
"{",
"return",
"Duration",
".",
"between",
"(",
"start",
",",
"end",
")",
".",
"getSeconds",
"(",
")",
";",
"}"
] | 1 millisecond = 0.001 seconds
@param start between time
@param end finish time
@return duration in seconds | [
"1",
"millisecond",
"=",
"0",
".",
"001",
"seconds"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L100-L103 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java | Scheduler.durationHours | public static long durationHours(LocalDateTime start,LocalDateTime end)
{
if(start == null || end == null)
return ZERO;
return Duration.between(start, end).toHours();
} | java | public static long durationHours(LocalDateTime start,LocalDateTime end)
{
if(start == null || end == null)
return ZERO;
return Duration.between(start, end).toHours();
} | [
"public",
"static",
"long",
"durationHours",
"(",
"LocalDateTime",
"start",
",",
"LocalDateTime",
"end",
")",
"{",
"if",
"(",
"start",
"==",
"null",
"||",
"end",
"==",
"null",
")",
"return",
"ZERO",
";",
"return",
"Duration",
".",
"between",
"(",
"start",
... | 1 Hours = 60 minutes
@param start between time
@param end finish time
@return duration in hours | [
"1",
"Hours",
"=",
"60",
"minutes"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L121-L127 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java | Scheduler.scheduleRecurring | public void scheduleRecurring(Runnable runnable, Date firstTime, long period)
{
timer.scheduleAtFixedRate(toTimerTask(runnable), firstTime, period);
} | java | public void scheduleRecurring(Runnable runnable, Date firstTime, long period)
{
timer.scheduleAtFixedRate(toTimerTask(runnable), firstTime, period);
} | [
"public",
"void",
"scheduleRecurring",
"(",
"Runnable",
"runnable",
",",
"Date",
"firstTime",
",",
"long",
"period",
")",
"{",
"timer",
".",
"scheduleAtFixedRate",
"(",
"toTimerTask",
"(",
"runnable",
")",
",",
"firstTime",
",",
"period",
")",
";",
"}"
] | Schedule runnable to run a given interval
@param runnable the runnable to
@param firstTime
@param period | [
"Schedule",
"runnable",
"to",
"run",
"a",
"given",
"interval"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L188-L192 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java | Scheduler.toTimerTask | public static TimerTask toTimerTask(Runnable runnable)
{
if(runnable instanceof TimerTask)
return (TimerTask) runnable;
return new TimerTaskRunnerAdapter(runnable);
} | java | public static TimerTask toTimerTask(Runnable runnable)
{
if(runnable instanceof TimerTask)
return (TimerTask) runnable;
return new TimerTaskRunnerAdapter(runnable);
} | [
"public",
"static",
"TimerTask",
"toTimerTask",
"(",
"Runnable",
"runnable",
")",
"{",
"if",
"(",
"runnable",
"instanceof",
"TimerTask",
")",
"return",
"(",
"TimerTask",
")",
"runnable",
";",
"return",
"new",
"TimerTaskRunnerAdapter",
"(",
"runnable",
")",
";",
... | Convert timer task to a runnable
@param runnable
@return timer task for the runnable | [
"Convert",
"timer",
"task",
"to",
"a",
"runnable"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L207-L213 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/decorator/ReplaceRegExpTextDecorator.java | ReplaceRegExpTextDecorator.getText | public String getText()
{
if(this.target == null)
throw new RequiredException("this.target in ReplaceTextDecorator");
return Text.replaceForRegExprWith(this.target.getText(), regExp, replacement);
} | java | public String getText()
{
if(this.target == null)
throw new RequiredException("this.target in ReplaceTextDecorator");
return Text.replaceForRegExprWith(this.target.getText(), regExp, replacement);
} | [
"public",
"String",
"getText",
"(",
")",
"{",
"if",
"(",
"this",
".",
"target",
"==",
"null",
")",
"throw",
"new",
"RequiredException",
"(",
"\"this.target in ReplaceTextDecorator\"",
")",
";",
"return",
"Text",
".",
"replaceForRegExprWith",
"(",
"this",
".",
... | replace the text based on a RegExpr
@return Text.replaceForRegExprWith(this.target.getText(), regExp, replacement) | [
"replace",
"the",
"text",
"based",
"on",
"a",
"RegExpr"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/decorator/ReplaceRegExpTextDecorator.java#L21-L27 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java | SettingsInMemory.getInteger | public Integer getInteger(Class<?> aClass, String key, int defaultValue)
{
return getInteger(aClass.getName()+".key",defaultValue);
} | java | public Integer getInteger(Class<?> aClass, String key, int defaultValue)
{
return getInteger(aClass.getName()+".key",defaultValue);
} | [
"public",
"Integer",
"getInteger",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"return",
"getInteger",
"(",
"aClass",
".",
"getName",
"(",
")",
"+",
"\".key\"",
",",
"defaultValue",
")",
";",
"}"
] | Get a Setting property as an Integer object.
@param aClass calling class
@param key the key name of the numeric property to be returned.
@param defaultValue the default value
@return Value of the property as an Integer or null if no property found. | [
"Get",
"a",
"Setting",
"property",
"as",
"an",
"Integer",
"object",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java#L171-L174 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java | SettingsInMemory.getCharacter | public Character getCharacter(Class<?> aClass,String key,char defaultValue)
{
String results = getText(aClass,key, "");
if(results.length() == 0)
return Character.valueOf(defaultValue);
else return Character.valueOf(results.charAt(0));//return first character
} | java | public Character getCharacter(Class<?> aClass,String key,char defaultValue)
{
String results = getText(aClass,key, "");
if(results.length() == 0)
return Character.valueOf(defaultValue);
else return Character.valueOf(results.charAt(0));//return first character
} | [
"public",
"Character",
"getCharacter",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"String",
"key",
",",
"char",
"defaultValue",
")",
"{",
"String",
"results",
"=",
"getText",
"(",
"aClass",
",",
"key",
",",
"\"\"",
")",
";",
"if",
"(",
"results",
".",... | Get a Settings property as an c object.
@param aClass the class the property is related to
@param key the Settings name
@param defaultValue the default value to return if the property does not exist
@return the Settings character | [
"Get",
"a",
"Settings",
"property",
"as",
"an",
"c",
"object",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java#L182-L190 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java | SettingsInMemory.getInteger | public Integer getInteger(String key)
{
Integer iVal = null;
String sVal = getText(key);
if ((sVal != null) && (sVal.length() > 0))
{
iVal = Integer.valueOf(sVal);
}
return iVal;
} | java | public Integer getInteger(String key)
{
Integer iVal = null;
String sVal = getText(key);
if ((sVal != null) && (sVal.length() > 0))
{
iVal = Integer.valueOf(sVal);
}
return iVal;
} | [
"public",
"Integer",
"getInteger",
"(",
"String",
"key",
")",
"{",
"Integer",
"iVal",
"=",
"null",
";",
"String",
"sVal",
"=",
"getText",
"(",
"key",
")",
";",
"if",
"(",
"(",
"sVal",
"!=",
"null",
")",
"&&",
"(",
"sVal",
".",
"length",
"(",
")",
... | Get a Settings property as an Integer object.
@param key the Key Name of the numeric property to be returned.
@return Value of the property as an Integer or null if no property found. | [
"Get",
"a",
"Settings",
"property",
"as",
"an",
"Integer",
"object",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java#L198-L211 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java | SettingsInMemory.getBoolean | public Boolean getBoolean(String key)
{
Boolean bVal = null;
String sVal = getText(key);
if ((sVal != null) && (sVal.length() > 0))
{
bVal = Boolean.valueOf(sVal);
}
return bVal;
} | java | public Boolean getBoolean(String key)
{
Boolean bVal = null;
String sVal = getText(key);
if ((sVal != null) && (sVal.length() > 0))
{
bVal = Boolean.valueOf(sVal);
}
return bVal;
} | [
"public",
"Boolean",
"getBoolean",
"(",
"String",
"key",
")",
"{",
"Boolean",
"bVal",
"=",
"null",
";",
"String",
"sVal",
"=",
"getText",
"(",
"key",
")",
";",
"if",
"(",
"(",
"sVal",
"!=",
"null",
")",
"&&",
"(",
"sVal",
".",
"length",
"(",
")",
... | Get a Setting property as a Boolean object.
@param key the key name of the numeric property to be returned.
@return Value of the property as an Boolean or null if no property found.
Note that the value of the returned Boolean will be
false if the <p/>property sought after exists but is not equal to
"true" (ignoring c... | [
"Get",
"a",
"Setting",
"property",
"as",
"a",
"Boolean",
"object",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/SettingsInMemory.java#L263-L272 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/memento/MethodCallSavePointPlayer.java | MethodCallSavePointPlayer.playMethodCalls | public synchronized void playMethodCalls(Memento memento, String [] savePoints)
{
String savePoint = null;
MethodCallFact methodCallFact = null;
SummaryException exceptions = new SummaryException();
//loop thru savepoints
for (int i = 0; i < savePoints.length; i++)
{
savePoint = savePoints[i]... | java | public synchronized void playMethodCalls(Memento memento, String [] savePoints)
{
String savePoint = null;
MethodCallFact methodCallFact = null;
SummaryException exceptions = new SummaryException();
//loop thru savepoints
for (int i = 0; i < savePoints.length; i++)
{
savePoint = savePoints[i]... | [
"public",
"synchronized",
"void",
"playMethodCalls",
"(",
"Memento",
"memento",
",",
"String",
"[",
"]",
"savePoints",
")",
"{",
"String",
"savePoint",
"=",
"null",
";",
"MethodCallFact",
"methodCallFact",
"=",
"null",
";",
"SummaryException",
"exceptions",
"=",
... | Redo the method calls of a target object
@param memento the memento to restore MethodCallFact
@param savePoints the list of the MethodCallFact save points
@throws SummaryException | [
"Redo",
"the",
"method",
"calls",
"of",
"a",
"target",
"object"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/memento/MethodCallSavePointPlayer.java#L38-L70 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printError | public static void printError(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).error(text.append(stackTrace((Throwable)message)));
else
getLog(c).error(text.append(message));
... | java | public static void printError(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).error(text.append(stackTrace((Throwable)message)));
else
getLog(c).error(text.append(message));
... | [
"public",
"static",
"void",
"printError",
"(",
"Object",
"caller",
",",
"Object",
"message",
")",
"{",
"StringBuilder",
"text",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"callerBuilder",
"(",
"caller",
",",
"text",
")"... | Print a error message.
The stack trace will be printed if
the given message is an exception.
@param caller the calling object
@param message the message/object to print | [
"Print",
"a",
"error",
"message",
".",
"The",
"stack",
"trace",
"will",
"be",
"printed",
"if",
"the",
"given",
"message",
"is",
"an",
"exception",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L411-L423 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printError | public static void printError(Object errorMessage)
{
if (errorMessage instanceof Throwable)
{
Throwable e = (Throwable) errorMessage;
getLog(Debugger.class).error(stackTrace(e));
}
else
getLog(Debugger.class).error(errorMessage);
} | java | public static void printError(Object errorMessage)
{
if (errorMessage instanceof Throwable)
{
Throwable e = (Throwable) errorMessage;
getLog(Debugger.class).error(stackTrace(e));
}
else
getLog(Debugger.class).error(errorMessage);
} | [
"public",
"static",
"void",
"printError",
"(",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"errorMessage",
"instanceof",
"Throwable",
")",
"{",
"Throwable",
"e",
"=",
"(",
"Throwable",
")",
"errorMessage",
";",
"getLog",
"(",
"Debugger",
".",
"class",
")"... | Print error message using the configured log.
The stack trace will be printed if
the given message is an exception.
@param errorMessage the error/object message | [
"Print",
"error",
"message",
"using",
"the",
"configured",
"log",
".",
"The",
"stack",
"trace",
"will",
"be",
"printed",
"if",
"the",
"given",
"message",
"is",
"an",
"exception",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L430-L444 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printFatal | public static void printFatal(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
e.printStackTrace();
}
Log log = getLog(Debugger.class);
if(log != null)
log.fatal(message);
else
System.err.println(message);
} | java | public static void printFatal(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
e.printStackTrace();
}
Log log = getLog(Debugger.class);
if(log != null)
log.fatal(message);
else
System.err.println(message);
} | [
"public",
"static",
"void",
"printFatal",
"(",
"Object",
"message",
")",
"{",
"if",
"(",
"message",
"instanceof",
"Throwable",
")",
"{",
"Throwable",
"e",
"=",
"(",
"Throwable",
")",
"message",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"Log",... | Print a fatal level message.
The stack trace will be printed if
the given message is an exception.
@param message the fatal message | [
"Print",
"a",
"fatal",
"level",
"message",
".",
"The",
"stack",
"trace",
"will",
"be",
"printed",
"if",
"the",
"given",
"message",
"is",
"an",
"exception",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L451-L466 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printFatal | public static void printFatal(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).fatal(text.append(stackTrace((Throwable)message)));
else
getLog(c).fatal(text.append(message));
... | java | public static void printFatal(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).fatal(text.append(stackTrace((Throwable)message)));
else
getLog(c).fatal(text.append(message));
... | [
"public",
"static",
"void",
"printFatal",
"(",
"Object",
"caller",
",",
"Object",
"message",
")",
"{",
"StringBuilder",
"text",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"callerBuilder",
"(",
"caller",
",",
"text",
")"... | Print a fatal message.
The stack trace will be printed if
the given message is an exception.
@param caller the calling object
@param message the fatal message | [
"Print",
"a",
"fatal",
"message",
".",
"The",
"stack",
"trace",
"will",
"be",
"printed",
"if",
"the",
"given",
"message",
"is",
"an",
"exception",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L474-L486 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printInfo | public static void printInfo(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).info(text.append(stackTrace((Throwable)message)));
else
getLog(c).info(text.append(message));
} | java | public static void printInfo(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).info(text.append(stackTrace((Throwable)message)));
else
getLog(c).info(text.append(message));
} | [
"public",
"static",
"void",
"printInfo",
"(",
"Object",
"caller",
",",
"Object",
"message",
")",
"{",
"StringBuilder",
"text",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"callerBuilder",
"(",
"caller",
",",
"text",
")",... | Print an INFO message
@param caller the calling object
@param message the INFO message | [
"Print",
"an",
"INFO",
"message"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L492-L504 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printInfo | public static void printInfo(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
getLog(Debugger.class).info(stackTrace(e));
}
else
getLog(Debugger.class).info(message);
} | java | public static void printInfo(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
getLog(Debugger.class).info(stackTrace(e));
}
else
getLog(Debugger.class).info(message);
} | [
"public",
"static",
"void",
"printInfo",
"(",
"Object",
"message",
")",
"{",
"if",
"(",
"message",
"instanceof",
"Throwable",
")",
"{",
"Throwable",
"e",
"=",
"(",
"Throwable",
")",
"message",
";",
"getLog",
"(",
"Debugger",
".",
"class",
")",
".",
"info... | Print a INFO level message
@param message | [
"Print",
"a",
"INFO",
"level",
"message"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L509-L523 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printWarn | public static void printWarn(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).warn(text.append(stackTrace((Throwable)message)));
else
getLog(c).warn(text.append(message));
} | java | public static void printWarn(Object caller, Object message)
{
StringBuilder text = new StringBuilder();
Class<?> c = callerBuilder(caller, text);
if(message instanceof Throwable)
getLog(c).warn(text.append(stackTrace((Throwable)message)));
else
getLog(c).warn(text.append(message));
} | [
"public",
"static",
"void",
"printWarn",
"(",
"Object",
"caller",
",",
"Object",
"message",
")",
"{",
"StringBuilder",
"text",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"callerBuilder",
"(",
"caller",
",",
"text",
")",... | Print a warning level message.
The stack trace will be printed if
the given message is an exception.
@param caller the calling object
@param message the message to print | [
"Print",
"a",
"warning",
"level",
"message",
".",
"The",
"stack",
"trace",
"will",
"be",
"printed",
"if",
"the",
"given",
"message",
"is",
"an",
"exception",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L531-L543 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java | Debugger.printWarn | public static void printWarn(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
getLog(Debugger.class).warn(stackTrace(e));
}
else
getLog(Debugger.class).warn(message);
} | java | public static void printWarn(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
getLog(Debugger.class).warn(stackTrace(e));
}
else
getLog(Debugger.class).warn(message);
} | [
"public",
"static",
"void",
"printWarn",
"(",
"Object",
"message",
")",
"{",
"if",
"(",
"message",
"instanceof",
"Throwable",
")",
"{",
"Throwable",
"e",
"=",
"(",
"Throwable",
")",
"message",
";",
"getLog",
"(",
"Debugger",
".",
"class",
")",
".",
"warn... | Print A WARN message. The stack trace will be printed if
the given message is an exception.
@param message the message to stack | [
"Print",
"A",
"WARN",
"message",
".",
"The",
"stack",
"trace",
"will",
"be",
"printed",
"if",
"the",
"given",
"message",
"is",
"an",
"exception",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Debugger.java#L575-L591 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JMX.java | JMX.registerMemoryNotifications | public void registerMemoryNotifications(NotificationListener notificationListener, Object handback)
{
NotificationEmitter emitter = (NotificationEmitter) this.getMemory();
emitter.addNotificationListener(notificationListener, null, handback);
} | java | public void registerMemoryNotifications(NotificationListener notificationListener, Object handback)
{
NotificationEmitter emitter = (NotificationEmitter) this.getMemory();
emitter.addNotificationListener(notificationListener, null, handback);
} | [
"public",
"void",
"registerMemoryNotifications",
"(",
"NotificationListener",
"notificationListener",
",",
"Object",
"handback",
")",
"{",
"NotificationEmitter",
"emitter",
"=",
"(",
"NotificationEmitter",
")",
"this",
".",
"getMemory",
"(",
")",
";",
"emitter",
".",
... | Allows a listener to be registered within the MemoryMXBean as a notification listener
usage threshold exceeded notification - for notifying that the memory usage of a memory pool is increased
and has reached or exceeded its usage threshold value.
collection usage threshold exceeded notification - for notifying that th... | [
"Allows",
"a",
"listener",
"to",
"be",
"registered",
"within",
"the",
"MemoryMXBean",
"as",
"a",
"notification",
"listener",
"usage",
"threshold",
"exceeded",
"notification",
"-",
"for",
"notifying",
"that",
"the",
"memory",
"usage",
"of",
"a",
"memory",
"pool",... | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JMX.java#L530-L535 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/operations/Shell.java | Shell.execute | public ProcessInfo execute(boolean background,String... command)
{
ProcessBuilder pb = new ProcessBuilder(command);
return executeProcess(background,pb);
} | java | public ProcessInfo execute(boolean background,String... command)
{
ProcessBuilder pb = new ProcessBuilder(command);
return executeProcess(background,pb);
} | [
"public",
"ProcessInfo",
"execute",
"(",
"boolean",
"background",
",",
"String",
"...",
"command",
")",
"{",
"ProcessBuilder",
"pb",
"=",
"new",
"ProcessBuilder",
"(",
"command",
")",
";",
"return",
"executeProcess",
"(",
"background",
",",
"pb",
")",
";",
"... | Executes a giving shell command
@param command the commands to execute
@param background execute in background
@return process information handle | [
"Executes",
"a",
"giving",
"shell",
"command"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/Shell.java#L100-L107 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/operations/Shell.java | Shell.executeProcess | private ProcessInfo executeProcess(boolean background,ProcessBuilder pb)
{
try
{
pb.directory(workingDirectory);
pb.redirectErrorStream(false);
if(log != null)
pb.redirectOutput(Redirect.appendTo(log));
pb.environment().putAll(envMap);
Process p = pb.start();
String out = null... | java | private ProcessInfo executeProcess(boolean background,ProcessBuilder pb)
{
try
{
pb.directory(workingDirectory);
pb.redirectErrorStream(false);
if(log != null)
pb.redirectOutput(Redirect.appendTo(log));
pb.environment().putAll(envMap);
Process p = pb.start();
String out = null... | [
"private",
"ProcessInfo",
"executeProcess",
"(",
"boolean",
"background",
",",
"ProcessBuilder",
"pb",
")",
"{",
"try",
"{",
"pb",
".",
"directory",
"(",
"workingDirectory",
")",
";",
"pb",
".",
"redirectErrorStream",
"(",
"false",
")",
";",
"if",
"(",
"log"... | Executes a process
@param background if starting as background process
@param pb the process builder
@return the process information
@throws IOException | [
"Executes",
"a",
"process"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/Shell.java#L116-L157 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/io/csv/formulas/SumStatsByMillisecondsFormular.java | SumStatsByMillisecondsFormular.main | public static void main(String[] args)
{
if(args.length != 4)
{
System.err.println("Usage java "+SumStatsByMillisecondsFormular.class.getName()+" file msSecColumn calculateCol sumByMillisec");
System.exit(-1);
}
File file = Paths.get(args[0]).toFile();
try
{
if(!file.exists())
{
thro... | java | public static void main(String[] args)
{
if(args.length != 4)
{
System.err.println("Usage java "+SumStatsByMillisecondsFormular.class.getName()+" file msSecColumn calculateCol sumByMillisec");
System.exit(-1);
}
File file = Paths.get(args[0]).toFile();
try
{
if(!file.exists())
{
thro... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"4",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Usage java \"",
"+",
"SumStatsByMillisecondsFormular",
".",
"class",
".",
... | Usages file msSecColumn calculateCol sumByMillisec
@param args | [
"Usages",
"file",
"msSecColumn",
"calculateCol",
"sumByMillisec"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/csv/formulas/SumStatsByMillisecondsFormular.java#L158-L199 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JmxSecurity.java | JmxSecurity.decorateEncryption | public static String decorateEncryption(char[] password)
{
if(password == null || password.length == 0)
return null;
return new StringBuilder(ENCRYPTED_PASSWORD_PREFIX)
.append(encrypt(password)).append(ENCRYPTED_PASSWORD_SUFFIX)
.toString();
} | java | public static String decorateEncryption(char[] password)
{
if(password == null || password.length == 0)
return null;
return new StringBuilder(ENCRYPTED_PASSWORD_PREFIX)
.append(encrypt(password)).append(ENCRYPTED_PASSWORD_SUFFIX)
.toString();
} | [
"public",
"static",
"String",
"decorateEncryption",
"(",
"char",
"[",
"]",
"password",
")",
"{",
"if",
"(",
"password",
"==",
"null",
"||",
"password",
".",
"length",
"==",
"0",
")",
"return",
"null",
";",
"return",
"new",
"StringBuilder",
"(",
"ENCRYPTED_... | Surround encrypted password with a prefix and suffix to indicate it has been encrypted
@param password the password string
@return encrypted password surrounded by the prefix and suffix | [
"Surround",
"encrypted",
"password",
"with",
"a",
"prefix",
"and",
"suffix",
"to",
"indicate",
"it",
"has",
"been",
"encrypted"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JmxSecurity.java#L89-L98 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JmxSecurity.java | JmxSecurity.decrypt | public static char[] decrypt(char[] password)
{
if(password == null || password.length == 0)
return null;
String passwordString = String.valueOf(password);
try
{
byte[] decrypted = null;
if (passwordString.startsWith("encrypted(")
&& passwordString.endsWith(")"))
{
passwordString = pas... | java | public static char[] decrypt(char[] password)
{
if(password == null || password.length == 0)
return null;
String passwordString = String.valueOf(password);
try
{
byte[] decrypted = null;
if (passwordString.startsWith("encrypted(")
&& passwordString.endsWith(")"))
{
passwordString = pas... | [
"public",
"static",
"char",
"[",
"]",
"decrypt",
"(",
"char",
"[",
"]",
"password",
")",
"{",
"if",
"(",
"password",
"==",
"null",
"||",
"password",
".",
"length",
"==",
"0",
")",
"return",
"null",
";",
"String",
"passwordString",
"=",
"String",
".",
... | decrypt an encrypted password string.
@param password String to be decrypted
@return String decrypted String | [
"decrypt",
"an",
"encrypted",
"password",
"string",
"."
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/jmx/JmxSecurity.java#L133-L164 | train |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/media/Graphics.java | Graphics.rotateImage | public static void rotateImage(File input, File output, String format, int degrees)
throws IOException
{
BufferedImage inputImage = ImageIO.read(input);
Graphics2D g = (Graphics2D) inputImage.getGraphics();
g.drawImage(inputImage, 0, 0, null);
AffineTransform at = n... | java | public static void rotateImage(File input, File output, String format, int degrees)
throws IOException
{
BufferedImage inputImage = ImageIO.read(input);
Graphics2D g = (Graphics2D) inputImage.getGraphics();
g.drawImage(inputImage, 0, 0, null);
AffineTransform at = n... | [
"public",
"static",
"void",
"rotateImage",
"(",
"File",
"input",
",",
"File",
"output",
",",
"String",
"format",
",",
"int",
"degrees",
")",
"throws",
"IOException",
"{",
"BufferedImage",
"inputImage",
"=",
"ImageIO",
".",
"read",
"(",
"input",
")",
";",
"... | Rotate a file a given number of degrees
@param input input image file
@param output the output image fiel
@param format the format (png, jpg, gif, etc.)
@param degrees angle to rotote
@throws IOException | [
"Rotate",
"a",
"file",
"a",
"given",
"number",
"of",
"degrees"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/media/Graphics.java#L36-L70 | train |
wnameless/workbook-accessor | src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java | WorkbookReader.close | public void close() {
try {
if (is != null) is.close();
} catch (IOException e) {
log.error(null, e);
throw new RuntimeException(e);
}
isClosed = true;
} | java | public void close() {
try {
if (is != null) is.close();
} catch (IOException e) {
log.error(null, e);
throw new RuntimeException(e);
}
isClosed = true;
} | [
"public",
"void",
"close",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"is",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"null",
",",
"e",
")",
";",
"throw",
"new"... | Closes the Workbook manually. | [
"Closes",
"the",
"Workbook",
"manually",
"."
] | b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983 | https://github.com/wnameless/workbook-accessor/blob/b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983/src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java#L231-L239 | train |
wnameless/workbook-accessor | src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java | WorkbookReader.toCSV | public Iterable<String> toCSV() {
checkState(!isClosed, WORKBOOK_CLOSED);
Joiner joiner = Joiner.on(",").useForNull("");
Iterable<String> CSVIterable =
Iterables.transform(sheet, item -> joiner.join(rowToList(item, true)));
return hasHeader ? Iterables.skip(CSVIterable, 1) : CSVIterable;
} | java | public Iterable<String> toCSV() {
checkState(!isClosed, WORKBOOK_CLOSED);
Joiner joiner = Joiner.on(",").useForNull("");
Iterable<String> CSVIterable =
Iterables.transform(sheet, item -> joiner.join(rowToList(item, true)));
return hasHeader ? Iterables.skip(CSVIterable, 1) : CSVIterable;
} | [
"public",
"Iterable",
"<",
"String",
">",
"toCSV",
"(",
")",
"{",
"checkState",
"(",
"!",
"isClosed",
",",
"WORKBOOK_CLOSED",
")",
";",
"Joiner",
"joiner",
"=",
"Joiner",
".",
"on",
"(",
"\",\"",
")",
".",
"useForNull",
"(",
"\"\"",
")",
";",
"Iterable... | Converts the spreadsheet to CSV by a String Iterable.
@return String Iterable | [
"Converts",
"the",
"spreadsheet",
"to",
"CSV",
"by",
"a",
"String",
"Iterable",
"."
] | b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983 | https://github.com/wnameless/workbook-accessor/blob/b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983/src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java#L340-L346 | train |
wnameless/workbook-accessor | src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java | WorkbookReader.toLists | public Iterable<List<String>> toLists() {
checkState(!isClosed, WORKBOOK_CLOSED);
Iterable<List<String>> listsIterable = Iterables.transform(sheet, item -> {
return rowToList(item);
});
return hasHeader ? Iterables.skip(listsIterable, 1) : listsIterable;
} | java | public Iterable<List<String>> toLists() {
checkState(!isClosed, WORKBOOK_CLOSED);
Iterable<List<String>> listsIterable = Iterables.transform(sheet, item -> {
return rowToList(item);
});
return hasHeader ? Iterables.skip(listsIterable, 1) : listsIterable;
} | [
"public",
"Iterable",
"<",
"List",
"<",
"String",
">",
">",
"toLists",
"(",
")",
"{",
"checkState",
"(",
"!",
"isClosed",
",",
"WORKBOOK_CLOSED",
")",
";",
"Iterable",
"<",
"List",
"<",
"String",
">",
">",
"listsIterable",
"=",
"Iterables",
".",
"transfo... | Converts the spreadsheet to String Lists by a List Iterable.
@return List of String Iterable | [
"Converts",
"the",
"spreadsheet",
"to",
"String",
"Lists",
"by",
"a",
"List",
"Iterable",
"."
] | b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983 | https://github.com/wnameless/workbook-accessor/blob/b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983/src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java#L353-L359 | train |
wnameless/workbook-accessor | src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java | WorkbookReader.toArrays | public Iterable<String[]> toArrays() {
checkState(!isClosed, WORKBOOK_CLOSED);
Iterable<String[]> arraysIterable = Iterables.transform(sheet, item -> {
List<String> list = rowToList(item);
return list.toArray(new String[list.size()]);
});
return hasHeader ? Iterables.skip(arraysIterable, 1) ... | java | public Iterable<String[]> toArrays() {
checkState(!isClosed, WORKBOOK_CLOSED);
Iterable<String[]> arraysIterable = Iterables.transform(sheet, item -> {
List<String> list = rowToList(item);
return list.toArray(new String[list.size()]);
});
return hasHeader ? Iterables.skip(arraysIterable, 1) ... | [
"public",
"Iterable",
"<",
"String",
"[",
"]",
">",
"toArrays",
"(",
")",
"{",
"checkState",
"(",
"!",
"isClosed",
",",
"WORKBOOK_CLOSED",
")",
";",
"Iterable",
"<",
"String",
"[",
"]",
">",
"arraysIterable",
"=",
"Iterables",
".",
"transform",
"(",
"she... | Converts the spreadsheet to String Arrays by an Array Iterable.
@return String array Iterable | [
"Converts",
"the",
"spreadsheet",
"to",
"String",
"Arrays",
"by",
"an",
"Array",
"Iterable",
"."
] | b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983 | https://github.com/wnameless/workbook-accessor/blob/b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983/src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java#L366-L373 | train |
wnameless/workbook-accessor | src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java | WorkbookReader.toMaps | public Iterable<Map<String, String>> toMaps() {
checkState(!isClosed, WORKBOOK_CLOSED);
checkState(hasHeader, NO_HEADER);
return Iterables.skip(Iterables.transform(sheet, item -> {
Map<String, String> map = newLinkedHashMap();
List<String> row = rowToList(item);
for (int i = 0; i < getHead... | java | public Iterable<Map<String, String>> toMaps() {
checkState(!isClosed, WORKBOOK_CLOSED);
checkState(hasHeader, NO_HEADER);
return Iterables.skip(Iterables.transform(sheet, item -> {
Map<String, String> map = newLinkedHashMap();
List<String> row = rowToList(item);
for (int i = 0; i < getHead... | [
"public",
"Iterable",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"toMaps",
"(",
")",
"{",
"checkState",
"(",
"!",
"isClosed",
",",
"WORKBOOK_CLOSED",
")",
";",
"checkState",
"(",
"hasHeader",
",",
"NO_HEADER",
")",
";",
"return",
"Iterables",
".... | Converts the spreadsheet to Maps by a Map Iterable. All Maps are
implemented by LinkedHashMap which implies the order of all fields is kept.
@return Map{@literal <String, String>} Iterable | [
"Converts",
"the",
"spreadsheet",
"to",
"Maps",
"by",
"a",
"Map",
"Iterable",
".",
"All",
"Maps",
"are",
"implemented",
"by",
"LinkedHashMap",
"which",
"implies",
"the",
"order",
"of",
"all",
"fields",
"is",
"kept",
"."
] | b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983 | https://github.com/wnameless/workbook-accessor/blob/b6bfda4a1d1e99b1ab736a8a8c0aeae608f5e983/src/main/java/com/github/wnameless/workbookaccessor/WorkbookReader.java#L381-L392 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/transport/passthrough/PassthroughReceiver.java | PassthroughReceiver.start | @SuppressWarnings("unchecked")
@Override
public void start(final Listener<?> listener, final Infrastructure infra) throws MessageTransportException {
this.listener = (Listener<Object>) listener;
} | java | @SuppressWarnings("unchecked")
@Override
public void start(final Listener<?> listener, final Infrastructure infra) throws MessageTransportException {
this.listener = (Listener<Object>) listener;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"void",
"start",
"(",
"final",
"Listener",
"<",
"?",
">",
"listener",
",",
"final",
"Infrastructure",
"infra",
")",
"throws",
"MessageTransportException",
"{",
"this",
".",
"listener"... | A receiver is started with a Listener and a threading model. | [
"A",
"receiver",
"is",
"started",
"with",
"a",
"Listener",
"and",
"a",
"threading",
"model",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/transport/passthrough/PassthroughReceiver.java#L34-L38 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/transport/blockingqueue/BlockingQueueReceiver.java | BlockingQueueReceiver.start | @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public synchronized void start(final Listener listener, final Infrastructure infra) {
if (listener == null)
throw new IllegalArgumentException("Cannot pass null to " + BlockingQueueReceiver.class.getSimpleName() + ".setListener");
... | java | @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public synchronized void start(final Listener listener, final Infrastructure infra) {
if (listener == null)
throw new IllegalArgumentException("Cannot pass null to " + BlockingQueueReceiver.class.getSimpleName() + ".setListener");
... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"@",
"Override",
"public",
"synchronized",
"void",
"start",
"(",
"final",
"Listener",
"listener",
",",
"final",
"Infrastructure",
"infra",
")",
"{",
"if",
"(",
"listener",
"==",... | A BlockingQueueAdaptor requires a MessageTransportListener to be set in order to adapt a client side.
@param listener
is the MessageTransportListener to push messages to when they come in. | [
"A",
"BlockingQueueAdaptor",
"requires",
"a",
"MessageTransportListener",
"to",
"be",
"set",
"in",
"order",
"to",
"adapt",
"a",
"client",
"side",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/transport/blockingqueue/BlockingQueueReceiver.java#L120-L131 | train |
Dempsy/dempsy | dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/internal/MessageUtils.java | MessageUtils.unwindMessages | public static void unwindMessages(final Object message, final List<Object> messages) {
if (message instanceof Iterable) {
@SuppressWarnings("rawtypes")
final Iterator it = ((Iterable) message).iterator();
while (it.hasNext())
unwindMessages(it.next(), messages... | java | public static void unwindMessages(final Object message, final List<Object> messages) {
if (message instanceof Iterable) {
@SuppressWarnings("rawtypes")
final Iterator it = ((Iterable) message).iterator();
while (it.hasNext())
unwindMessages(it.next(), messages... | [
"public",
"static",
"void",
"unwindMessages",
"(",
"final",
"Object",
"message",
",",
"final",
"List",
"<",
"Object",
">",
"messages",
")",
"{",
"if",
"(",
"message",
"instanceof",
"Iterable",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"fin... | Return values from invoke's may be Iterables in which case there are many messages to be sent out. | [
"Return",
"values",
"from",
"invoke",
"s",
"may",
"be",
"Iterables",
"in",
"which",
"case",
"there",
"are",
"many",
"messages",
"to",
"be",
"sent",
"out",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/internal/MessageUtils.java#L25-L33 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/router/shardutils/Leader.java | Leader.perNodeRelease | private Set<Integer> perNodeRelease(final C thisNodeAddress, final C[] currentState, final int nodeCount, final int nodeRank) {
final int numberIShouldHave = howManyShouldIHave(totalNumShards, nodeCount, minNodes, nodeRank);
// destinationsAcquired reflects what we already have according to the current... | java | private Set<Integer> perNodeRelease(final C thisNodeAddress, final C[] currentState, final int nodeCount, final int nodeRank) {
final int numberIShouldHave = howManyShouldIHave(totalNumShards, nodeCount, minNodes, nodeRank);
// destinationsAcquired reflects what we already have according to the current... | [
"private",
"Set",
"<",
"Integer",
">",
"perNodeRelease",
"(",
"final",
"C",
"thisNodeAddress",
",",
"final",
"C",
"[",
"]",
"currentState",
",",
"final",
"int",
"nodeCount",
",",
"final",
"int",
"nodeRank",
")",
"{",
"final",
"int",
"numberIShouldHave",
"=",... | go through and determine which nodes to give up ... if any | [
"go",
"through",
"and",
"determine",
"which",
"nodes",
"to",
"give",
"up",
"...",
"if",
"any"
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/router/shardutils/Leader.java#L206-L228 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/router/shardutils/Leader.java | Leader.registerAndConfirmIfImIt | private boolean registerAndConfirmIfImIt() throws ClusterInfoException {
// reset the subdir watcher
final Collection<String> imItSubdirs = utils.persistentGetSubdir(utils.leaderDir, this);
// "there can be only one"
if (imItSubdirs.size() > 1)
throw new ClusterInfoException... | java | private boolean registerAndConfirmIfImIt() throws ClusterInfoException {
// reset the subdir watcher
final Collection<String> imItSubdirs = utils.persistentGetSubdir(utils.leaderDir, this);
// "there can be only one"
if (imItSubdirs.size() > 1)
throw new ClusterInfoException... | [
"private",
"boolean",
"registerAndConfirmIfImIt",
"(",
")",
"throws",
"ClusterInfoException",
"{",
"// reset the subdir watcher",
"final",
"Collection",
"<",
"String",
">",
"imItSubdirs",
"=",
"utils",
".",
"persistentGetSubdir",
"(",
"utils",
".",
"leaderDir",
",",
"... | whether or not imIt and return that. | [
"whether",
"or",
"not",
"imIt",
"and",
"return",
"that",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/router/shardutils/Leader.java#L271-L285 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/transport/blockingqueue/BlockingQueueSender.java | BlockingQueueSender.send | @Override
public void send(final Object message) throws MessageTransportException {
if (shutdown.get())
throw new MessageTransportException("send called on shutdown queue.");
if (blocking) {
while (true) {
try {
queue.put(message);
... | java | @Override
public void send(final Object message) throws MessageTransportException {
if (shutdown.get())
throw new MessageTransportException("send called on shutdown queue.");
if (blocking) {
while (true) {
try {
queue.put(message);
... | [
"@",
"Override",
"public",
"void",
"send",
"(",
"final",
"Object",
"message",
")",
"throws",
"MessageTransportException",
"{",
"if",
"(",
"shutdown",
".",
"get",
"(",
")",
")",
"throw",
"new",
"MessageTransportException",
"(",
"\"send called on shutdown queue.\"",
... | Send a message into the BlockingQueueAdaptor. | [
"Send",
"a",
"message",
"into",
"the",
"BlockingQueueAdaptor",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/transport/blockingqueue/BlockingQueueSender.java#L71-L96 | train |
Dempsy/dempsy | dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/internal/AnnotatedMethodInvoker.java | AnnotatedMethodInvoker.allTypeAnnotations | public static <A extends Annotation> List<AnnotatedClass<A>> allTypeAnnotations(final Class<?> clazz, final Class<A> annotation,
final boolean recurse) {
final List<AnnotatedClass<A>> ret = new ArrayList<>();
final A curClassAnnotation = clazz.getAnnotation(annotation);
if (curClassA... | java | public static <A extends Annotation> List<AnnotatedClass<A>> allTypeAnnotations(final Class<?> clazz, final Class<A> annotation,
final boolean recurse) {
final List<AnnotatedClass<A>> ret = new ArrayList<>();
final A curClassAnnotation = clazz.getAnnotation(annotation);
if (curClassA... | [
"public",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"List",
"<",
"AnnotatedClass",
"<",
"A",
">",
">",
"allTypeAnnotations",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Class",
"<",
"A",
">",
"annotation",
",",
"final",
"boolean... | Get all annotation on the given class, plus all annotations on the parent classes
@param clazz
@param annotation
@return | [
"Get",
"all",
"annotation",
"on",
"the",
"given",
"class",
"plus",
"all",
"annotations",
"on",
"the",
"parent",
"classes"
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/internal/AnnotatedMethodInvoker.java#L240-L259 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/router/shardutils/Subscriber.java | Subscriber.cleanupAfterExceptionDuringNodeDirCheck | private final void cleanupAfterExceptionDuringNodeDirCheck() {
if (nodeDirectory != null) {
// attempt to remove the node directory
try {
if (session.exists(nodeDirectory, this)) {
session.rmdir(nodeDirectory);
}
nodeDir... | java | private final void cleanupAfterExceptionDuringNodeDirCheck() {
if (nodeDirectory != null) {
// attempt to remove the node directory
try {
if (session.exists(nodeDirectory, this)) {
session.rmdir(nodeDirectory);
}
nodeDir... | [
"private",
"final",
"void",
"cleanupAfterExceptionDuringNodeDirCheck",
"(",
")",
"{",
"if",
"(",
"nodeDirectory",
"!=",
"null",
")",
"{",
"// attempt to remove the node directory",
"try",
"{",
"if",
"(",
"session",
".",
"exists",
"(",
"nodeDirectory",
",",
"this",
... | called from the catch clauses in checkNodeDirectory | [
"called",
"from",
"the",
"catch",
"clauses",
"in",
"checkNodeDirectory"
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/router/shardutils/Subscriber.java#L169-L179 | train |
Dempsy/dempsy | dempsy-framework.api/src/main/java/net/dempsy/config/Cluster.java | Cluster.destination | public Cluster destination(final String... destinations) {
final String applicationName = clusterId.applicationName;
return destination(Arrays.stream(destinations).map(d -> new ClusterId(applicationName, d)).toArray(ClusterId[]::new));
} | java | public Cluster destination(final String... destinations) {
final String applicationName = clusterId.applicationName;
return destination(Arrays.stream(destinations).map(d -> new ClusterId(applicationName, d)).toArray(ClusterId[]::new));
} | [
"public",
"Cluster",
"destination",
"(",
"final",
"String",
"...",
"destinations",
")",
"{",
"final",
"String",
"applicationName",
"=",
"clusterId",
".",
"applicationName",
";",
"return",
"destination",
"(",
"Arrays",
".",
"stream",
"(",
"destinations",
")",
"."... | Set the list of explicit destination that outgoing messages should be limited to. | [
"Set",
"the",
"list",
"of",
"explicit",
"destination",
"that",
"outgoing",
"messages",
"should",
"be",
"limited",
"to",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/config/Cluster.java#L79-L82 | train |
Dempsy/dempsy | dempsy-framework.api/src/main/java/net/dempsy/config/Cluster.java | Cluster.setAppName | void setAppName(final String appName) {
if (clusterId.applicationName != null && !clusterId.applicationName.equals(appName))
throw new IllegalStateException("Restting the application name on a cluster is not allowed.");
clusterId = new ClusterId(appName, clusterId.clusterName);
} | java | void setAppName(final String appName) {
if (clusterId.applicationName != null && !clusterId.applicationName.equals(appName))
throw new IllegalStateException("Restting the application name on a cluster is not allowed.");
clusterId = new ClusterId(appName, clusterId.clusterName);
} | [
"void",
"setAppName",
"(",
"final",
"String",
"appName",
")",
"{",
"if",
"(",
"clusterId",
".",
"applicationName",
"!=",
"null",
"&&",
"!",
"clusterId",
".",
"applicationName",
".",
"equals",
"(",
"appName",
")",
")",
"throw",
"new",
"IllegalStateException",
... | This is called from Node | [
"This",
"is",
"called",
"from",
"Node"
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/config/Cluster.java#L221-L225 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/monitoring/dropwizard/DropwizardClusterStatsCollector.java | DropwizardClusterStatsCollector.getName | protected String getName(final String key) {
return MetricRegistry.name(DropwizardClusterStatsCollector.class, "cluster", clusterId.applicationName, clusterId.clusterName, key);
} | java | protected String getName(final String key) {
return MetricRegistry.name(DropwizardClusterStatsCollector.class, "cluster", clusterId.applicationName, clusterId.clusterName, key);
} | [
"protected",
"String",
"getName",
"(",
"final",
"String",
"key",
")",
"{",
"return",
"MetricRegistry",
".",
"name",
"(",
"DropwizardClusterStatsCollector",
".",
"class",
",",
"\"cluster\"",
",",
"clusterId",
".",
"applicationName",
",",
"clusterId",
".",
"clusterN... | protected access for testing purposes | [
"protected",
"access",
"for",
"testing",
"purposes"
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/monitoring/dropwizard/DropwizardClusterStatsCollector.java#L129-L131 | train |
Dempsy/dempsy | dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/MessageProcessor.java | MessageProcessor.newInstance | @SuppressWarnings("unchecked")
@Override
public T newInstance() throws DempsyException {
return wrap(() -> (T) cloneMethod.invoke(prototype));
} | java | @SuppressWarnings("unchecked")
@Override
public T newInstance() throws DempsyException {
return wrap(() -> (T) cloneMethod.invoke(prototype));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"T",
"newInstance",
"(",
")",
"throws",
"DempsyException",
"{",
"return",
"wrap",
"(",
"(",
")",
"->",
"(",
"T",
")",
"cloneMethod",
".",
"invoke",
"(",
"prototype",
")",
")",
... | Creates a new instance from the prototype. | [
"Creates",
"a",
"new",
"instance",
"from",
"the",
"prototype",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/MessageProcessor.java#L95-L99 | train |
Dempsy/dempsy | dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/MessageProcessor.java | MessageProcessor.activate | @Override
public void activate(final T instance, final Object key) throws DempsyException {
wrap(() -> activationMethod.invoke(instance, key));
} | java | @Override
public void activate(final T instance, final Object key) throws DempsyException {
wrap(() -> activationMethod.invoke(instance, key));
} | [
"@",
"Override",
"public",
"void",
"activate",
"(",
"final",
"T",
"instance",
",",
"final",
"Object",
"key",
")",
"throws",
"DempsyException",
"{",
"wrap",
"(",
"(",
")",
"->",
"activationMethod",
".",
"invoke",
"(",
"instance",
",",
"key",
")",
")",
";"... | Invokes the activation method of the passed instance. | [
"Invokes",
"the",
"activation",
"method",
"of",
"the",
"passed",
"instance",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/MessageProcessor.java#L104-L107 | train |
Dempsy/dempsy | dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/MessageProcessor.java | MessageProcessor.invokeEvictable | @Override
public boolean invokeEvictable(final T instance) throws DempsyException {
return isEvictionSupported() ? (Boolean) wrap(() -> evictableMethod.invoke(instance)) : false;
} | java | @Override
public boolean invokeEvictable(final T instance) throws DempsyException {
return isEvictionSupported() ? (Boolean) wrap(() -> evictableMethod.invoke(instance)) : false;
} | [
"@",
"Override",
"public",
"boolean",
"invokeEvictable",
"(",
"final",
"T",
"instance",
")",
"throws",
"DempsyException",
"{",
"return",
"isEvictionSupported",
"(",
")",
"?",
"(",
"Boolean",
")",
"wrap",
"(",
"(",
")",
"->",
"evictableMethod",
".",
"invoke",
... | Invokes the evictable method on the provided instance. If the evictable is not implemented, returns false. | [
"Invokes",
"the",
"evictable",
"method",
"on",
"the",
"provided",
"instance",
".",
"If",
"the",
"evictable",
"is",
"not",
"implemented",
"returns",
"false",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/annotation/MessageProcessor.java#L165-L168 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java | OutputQuartzHelper.getJobDetail | public JobDetail getJobDetail(OutputInvoker outputInvoker) {
JobBuilder jobBuilder = JobBuilder.newJob(OutputJob.class);
JobDetail jobDetail = jobBuilder.build();
jobDetail.getJobDataMap().put(OUTPUT_JOB_NAME, outputInvoker);
return jobDetail;
} | java | public JobDetail getJobDetail(OutputInvoker outputInvoker) {
JobBuilder jobBuilder = JobBuilder.newJob(OutputJob.class);
JobDetail jobDetail = jobBuilder.build();
jobDetail.getJobDataMap().put(OUTPUT_JOB_NAME, outputInvoker);
return jobDetail;
} | [
"public",
"JobDetail",
"getJobDetail",
"(",
"OutputInvoker",
"outputInvoker",
")",
"{",
"JobBuilder",
"jobBuilder",
"=",
"JobBuilder",
".",
"newJob",
"(",
"OutputJob",
".",
"class",
")",
";",
"JobDetail",
"jobDetail",
"=",
"jobBuilder",
".",
"build",
"(",
")",
... | Gets the job detail.
@param outputInvoker the output invoker
@return the job detail | [
"Gets",
"the",
"job",
"detail",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java#L48-L53 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java | OutputQuartzHelper.getSimpleTrigger | public Trigger getSimpleTrigger(TimeUnit timeUnit, int timeInterval) {
SimpleScheduleBuilder simpleScheduleBuilder = null;
simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule();
switch (timeUnit) {
case MILLISECONDS:
simpleScheduleBuilder.withIntervalInMilliseconds(timeInterval).repeatFo... | java | public Trigger getSimpleTrigger(TimeUnit timeUnit, int timeInterval) {
SimpleScheduleBuilder simpleScheduleBuilder = null;
simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule();
switch (timeUnit) {
case MILLISECONDS:
simpleScheduleBuilder.withIntervalInMilliseconds(timeInterval).repeatFo... | [
"public",
"Trigger",
"getSimpleTrigger",
"(",
"TimeUnit",
"timeUnit",
",",
"int",
"timeInterval",
")",
"{",
"SimpleScheduleBuilder",
"simpleScheduleBuilder",
"=",
"null",
";",
"simpleScheduleBuilder",
"=",
"SimpleScheduleBuilder",
".",
"simpleSchedule",
"(",
")",
";",
... | Gets the simple trigger.
@param timeUnit the time unit
@param timeInterval the time interval
@return the simple trigger | [
"Gets",
"the",
"simple",
"trigger",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java#L62-L87 | train |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java | OutputQuartzHelper.getCronTrigger | public Trigger getCronTrigger(String cronExpression) {
CronScheduleBuilder cronScheduleBuilder = null;
Trigger cronTrigger = null;
try {
cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);
cronScheduleBuilder.withMisfireHandlingInstructionFireAndProceed();
TriggerBuilde... | java | public Trigger getCronTrigger(String cronExpression) {
CronScheduleBuilder cronScheduleBuilder = null;
Trigger cronTrigger = null;
try {
cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);
cronScheduleBuilder.withMisfireHandlingInstructionFireAndProceed();
TriggerBuilde... | [
"public",
"Trigger",
"getCronTrigger",
"(",
"String",
"cronExpression",
")",
"{",
"CronScheduleBuilder",
"cronScheduleBuilder",
"=",
"null",
";",
"Trigger",
"cronTrigger",
"=",
"null",
";",
"try",
"{",
"cronScheduleBuilder",
"=",
"CronScheduleBuilder",
".",
"cronSched... | Gets the cron trigger.
@param cronExpression the cron expression
@return the cron trigger | [
"Gets",
"the",
"cron",
"trigger",
"."
] | cd3415b51b6787a6a9d9589b15f00ce674b6f113 | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java#L95-L108 | train |
lukas-krecan/future-converter | guava-common/src/main/java/net/javacrumbs/futureconverter/guavacommon/GuavaFutureUtils.java | GuavaFutureUtils.createListenableFuture | public static <T> ListenableFuture<T> createListenableFuture(ValueSourceFuture<T> valueSourceFuture) {
if (valueSourceFuture instanceof ListenableFutureBackedValueSourceFuture) {
return ((ListenableFutureBackedValueSourceFuture<T>) valueSourceFuture).getWrappedFuture();
} else {
... | java | public static <T> ListenableFuture<T> createListenableFuture(ValueSourceFuture<T> valueSourceFuture) {
if (valueSourceFuture instanceof ListenableFutureBackedValueSourceFuture) {
return ((ListenableFutureBackedValueSourceFuture<T>) valueSourceFuture).getWrappedFuture();
} else {
... | [
"public",
"static",
"<",
"T",
">",
"ListenableFuture",
"<",
"T",
">",
"createListenableFuture",
"(",
"ValueSourceFuture",
"<",
"T",
">",
"valueSourceFuture",
")",
"{",
"if",
"(",
"valueSourceFuture",
"instanceof",
"ListenableFutureBackedValueSourceFuture",
")",
"{",
... | Creates listenable future from ValueSourceFuture. We have to send all Future API calls to ValueSourceFuture. | [
"Creates",
"listenable",
"future",
"from",
"ValueSourceFuture",
".",
"We",
"have",
"to",
"send",
"all",
"Future",
"API",
"calls",
"to",
"ValueSourceFuture",
"."
] | 652b845824de90b075cf5ddbbda6fdf440f3ed0a | https://github.com/lukas-krecan/future-converter/blob/652b845824de90b075cf5ddbbda6fdf440f3ed0a/guava-common/src/main/java/net/javacrumbs/futureconverter/guavacommon/GuavaFutureUtils.java#L36-L42 | train |
lukas-krecan/future-converter | apifuture-common/src/main/java/net/javacrumbs/futureconverter/apifuturecommon/ApiFutureUtils.java | ApiFutureUtils.createApiFuture | public static <T> ApiFuture<T> createApiFuture(ValueSourceFuture<T> valueSourceFuture) {
if (valueSourceFuture instanceof ApiFutureBackedValueSourceFuture) {
return ((ApiFutureBackedValueSourceFuture<T>) valueSourceFuture).getWrappedFuture();
} else {
return new ValueSourceFuture... | java | public static <T> ApiFuture<T> createApiFuture(ValueSourceFuture<T> valueSourceFuture) {
if (valueSourceFuture instanceof ApiFutureBackedValueSourceFuture) {
return ((ApiFutureBackedValueSourceFuture<T>) valueSourceFuture).getWrappedFuture();
} else {
return new ValueSourceFuture... | [
"public",
"static",
"<",
"T",
">",
"ApiFuture",
"<",
"T",
">",
"createApiFuture",
"(",
"ValueSourceFuture",
"<",
"T",
">",
"valueSourceFuture",
")",
"{",
"if",
"(",
"valueSourceFuture",
"instanceof",
"ApiFutureBackedValueSourceFuture",
")",
"{",
"return",
"(",
"... | Creates api future from ValueSourceFuture. We have to send all Future API calls to ValueSourceFuture. | [
"Creates",
"api",
"future",
"from",
"ValueSourceFuture",
".",
"We",
"have",
"to",
"send",
"all",
"Future",
"API",
"calls",
"to",
"ValueSourceFuture",
"."
] | 652b845824de90b075cf5ddbbda6fdf440f3ed0a | https://github.com/lukas-krecan/future-converter/blob/652b845824de90b075cf5ddbbda6fdf440f3ed0a/apifuture-common/src/main/java/net/javacrumbs/futureconverter/apifuturecommon/ApiFutureUtils.java#L36-L42 | train |
sebastiangraf/treetank | coremodules/node/src/main/java/org/treetank/axis/PrecedingAxis.java | PrecedingAxis.getLastChild | private void getLastChild() {
// nodekey of the root of the current subtree
final long parent = getNode().getDataKey();
// traverse tree in pre order to the leftmost leaf of the subtree and
// push
// all nodes to the stack
if (((ITreeStructData)getNode()).hasFirstChild... | java | private void getLastChild() {
// nodekey of the root of the current subtree
final long parent = getNode().getDataKey();
// traverse tree in pre order to the leftmost leaf of the subtree and
// push
// all nodes to the stack
if (((ITreeStructData)getNode()).hasFirstChild... | [
"private",
"void",
"getLastChild",
"(",
")",
"{",
"// nodekey of the root of the current subtree",
"final",
"long",
"parent",
"=",
"getNode",
"(",
")",
".",
"getDataKey",
"(",
")",
";",
"// traverse tree in pre order to the leftmost leaf of the subtree and",
"// push",
"// ... | Moves the transaction to the node in the current subtree, that is last in
document order and pushes all other node key on a stack. At the end the
stack contains all node keys except for the last one in reverse document
order. | [
"Moves",
"the",
"transaction",
"to",
"the",
"node",
"in",
"the",
"current",
"subtree",
"that",
"is",
"last",
"in",
"document",
"order",
"and",
"pushes",
"all",
"other",
"node",
"key",
"on",
"a",
"stack",
".",
"At",
"the",
"end",
"the",
"stack",
"contains... | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/node/src/main/java/org/treetank/axis/PrecedingAxis.java#L134-L183 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/core/Systems.java | Systems.getInstance | public static JaxRx getInstance(final String impl) {
final String path = Systems.getSystems().get(impl);
if (path == null) {
throw new JaxRxException(404, "Unknown implementation: " + impl);
}
JaxRx jaxrx = INSTANCES.get(path);
if (jaxrx == null) {
try {
... | java | public static JaxRx getInstance(final String impl) {
final String path = Systems.getSystems().get(impl);
if (path == null) {
throw new JaxRxException(404, "Unknown implementation: " + impl);
}
JaxRx jaxrx = INSTANCES.get(path);
if (jaxrx == null) {
try {
... | [
"public",
"static",
"JaxRx",
"getInstance",
"(",
"final",
"String",
"impl",
")",
"{",
"final",
"String",
"path",
"=",
"Systems",
".",
"getSystems",
"(",
")",
".",
"get",
"(",
"impl",
")",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"throw",
"new"... | Returns the instance for the specified implementation. If the system is
unknown, throws an exception.
@param impl
implementation to be checked.
@return instances | [
"Returns",
"the",
"instance",
"for",
"the",
"specified",
"implementation",
".",
"If",
"the",
"system",
"is",
"unknown",
"throws",
"an",
"exception",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/core/Systems.java#L134-L150 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/NsContext.java | NsContext.add | public void add(final String prefix, final String uri) {
if (prefix == null) {
defaultNS = uri;
}
addToMap(prefix, uri);
} | java | public void add(final String prefix, final String uri) {
if (prefix == null) {
defaultNS = uri;
}
addToMap(prefix, uri);
} | [
"public",
"void",
"add",
"(",
"final",
"String",
"prefix",
",",
"final",
"String",
"uri",
")",
"{",
"if",
"(",
"prefix",
"==",
"null",
")",
"{",
"defaultNS",
"=",
"uri",
";",
"}",
"addToMap",
"(",
"prefix",
",",
"uri",
")",
";",
"}"
] | Add a namespace to the maps
@param prefix the prefix for generated xml
@param uri the namespace uri | [
"Add",
"a",
"namespace",
"to",
"the",
"maps"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/NsContext.java#L123-L129 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/NsContext.java | NsContext.appendNsName | public void appendNsName(final StringBuilder sb,
final QName nm) {
String uri = nm.getNamespaceURI();
String abbr;
if ((defaultNS != null) && uri.equals(defaultNS)) {
abbr = null;
} else {
abbr = keyUri.get(uri);
if (abbr == null) {
abbr = uri;
... | java | public void appendNsName(final StringBuilder sb,
final QName nm) {
String uri = nm.getNamespaceURI();
String abbr;
if ((defaultNS != null) && uri.equals(defaultNS)) {
abbr = null;
} else {
abbr = keyUri.get(uri);
if (abbr == null) {
abbr = uri;
... | [
"public",
"void",
"appendNsName",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"QName",
"nm",
")",
"{",
"String",
"uri",
"=",
"nm",
".",
"getNamespaceURI",
"(",
")",
";",
"String",
"abbr",
";",
"if",
"(",
"(",
"defaultNS",
"!=",
"null",
")",
"&&"... | Append the name with abbreviated namespace.
@param sb for result
@param nm QName object | [
"Append",
"the",
"name",
"with",
"abbreviated",
"namespace",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/NsContext.java#L144-L164 | train |
Bedework/bw-util | bw-util-security/src/main/java/org/bedework/util/security/PasswordGenerator.java | PasswordGenerator.generate | public static String generate(final int length) {
final StringBuilder password = new StringBuilder(length);
double pik = random.nextDouble(); // random number [0,1]
long ranno = (long) (pik * sigma); // weight by sum of frequencies
long sum = 0;
outer:
for (int c1 = 0; c1 < 26; c1++) {
f... | java | public static String generate(final int length) {
final StringBuilder password = new StringBuilder(length);
double pik = random.nextDouble(); // random number [0,1]
long ranno = (long) (pik * sigma); // weight by sum of frequencies
long sum = 0;
outer:
for (int c1 = 0; c1 < 26; c1++) {
f... | [
"public",
"static",
"String",
"generate",
"(",
"final",
"int",
"length",
")",
"{",
"final",
"StringBuilder",
"password",
"=",
"new",
"StringBuilder",
"(",
"length",
")",
";",
"double",
"pik",
"=",
"random",
".",
"nextDouble",
"(",
")",
";",
"// random number... | Generates a new password.
@param length Length the password should have
@return The new password | [
"Generates",
"a",
"new",
"password",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-security/src/main/java/org/bedework/util/security/PasswordGenerator.java#L49-L98 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.parseQuery | public void parseQuery() throws TTXPathException {
// get first token, ignore all white spaces
do {
mToken = mScanner.nextToken();
} while (mToken.getType() == TokenType.SPACE);
// parse the query according to the rules specified in the XPath 2.0 REC
parseExpression... | java | public void parseQuery() throws TTXPathException {
// get first token, ignore all white spaces
do {
mToken = mScanner.nextToken();
} while (mToken.getType() == TokenType.SPACE);
// parse the query according to the rules specified in the XPath 2.0 REC
parseExpression... | [
"public",
"void",
"parseQuery",
"(",
")",
"throws",
"TTXPathException",
"{",
"// get first token, ignore all white spaces",
"do",
"{",
"mToken",
"=",
"mScanner",
".",
"nextToken",
"(",
")",
";",
"}",
"while",
"(",
"mToken",
".",
"getType",
"(",
")",
"==",
"Tok... | Starts parsing the query.
@throws TTXPathException | [
"Starts",
"parsing",
"the",
"query",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L118-L132 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.isReservedKeyword | private boolean isReservedKeyword() {
final String content = mToken.getContent();
return isKindTest() || "item".equals(content) || "if".equals(content)
|| "empty-sequence".equals(content) || "typeswitch".equals(content);
} | java | private boolean isReservedKeyword() {
final String content = mToken.getContent();
return isKindTest() || "item".equals(content) || "if".equals(content)
|| "empty-sequence".equals(content) || "typeswitch".equals(content);
} | [
"private",
"boolean",
"isReservedKeyword",
"(",
")",
"{",
"final",
"String",
"content",
"=",
"mToken",
".",
"getContent",
"(",
")",
";",
"return",
"isKindTest",
"(",
")",
"||",
"\"item\"",
".",
"equals",
"(",
"content",
")",
"||",
"\"if\"",
".",
"equals",
... | Although XPath is supposed to have no reserved words, some keywords are
not allowed as function names in an unprefixed form because expression
syntax takes precedence.
@return true if the token is one of the reserved words of XPath 2.0 | [
"Although",
"XPath",
"is",
"supposed",
"to",
"have",
"no",
"reserved",
"words",
"some",
"keywords",
"are",
"not",
"allowed",
"as",
"function",
"names",
"in",
"an",
"unprefixed",
"form",
"because",
"expression",
"syntax",
"takes",
"precedence",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L791-L796 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.isForwardAxis | private boolean isForwardAxis() {
final String content = mToken.getContent();
return (mToken.getType() == TokenType.TEXT && ("child".equals(content) || ("descendant"
.equals(content)
|| "descendant-or-self".equals(content)
|| "attribute".equals(content)
|... | java | private boolean isForwardAxis() {
final String content = mToken.getContent();
return (mToken.getType() == TokenType.TEXT && ("child".equals(content) || ("descendant"
.equals(content)
|| "descendant-or-self".equals(content)
|| "attribute".equals(content)
|... | [
"private",
"boolean",
"isForwardAxis",
"(",
")",
"{",
"final",
"String",
"content",
"=",
"mToken",
".",
"getContent",
"(",
")",
";",
"return",
"(",
"mToken",
".",
"getType",
"(",
")",
"==",
"TokenType",
".",
"TEXT",
"&&",
"(",
"\"child\"",
".",
"equals",... | Checks if a given token represents a ForwardAxis.
@return true if the token is a ForwardAxis | [
"Checks",
"if",
"a",
"given",
"token",
"represents",
"a",
"ForwardAxis",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L900-L910 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.consume | private void consume(final TokenType mType, final boolean mIgnoreWhitespace) {
if (!is(mType, mIgnoreWhitespace)) {
// error found by parser - stopping
throw new IllegalStateException("Wrong token after " + mScanner.begin() + " at position "
+ mScanner.getPos() + " found... | java | private void consume(final TokenType mType, final boolean mIgnoreWhitespace) {
if (!is(mType, mIgnoreWhitespace)) {
// error found by parser - stopping
throw new IllegalStateException("Wrong token after " + mScanner.begin() + " at position "
+ mScanner.getPos() + " found... | [
"private",
"void",
"consume",
"(",
"final",
"TokenType",
"mType",
",",
"final",
"boolean",
"mIgnoreWhitespace",
")",
"{",
"if",
"(",
"!",
"is",
"(",
"mType",
",",
"mIgnoreWhitespace",
")",
")",
"{",
"// error found by parser - stopping",
"throw",
"new",
"Illegal... | Consumes a token. Tests if it really has the expected type and if not
returns an error message. Otherwise gets a new token from the scanner. If
that new token is of type whitespace and the ignoreWhitespace parameter
is true, a new token is retrieved, until the current token is not of type
whitespace.
@param mType
the ... | [
"Consumes",
"a",
"token",
".",
"Tests",
"if",
"it",
"really",
"has",
"the",
"expected",
"type",
"and",
"if",
"not",
"returns",
"an",
"error",
"message",
".",
"Otherwise",
"gets",
"a",
"new",
"token",
"from",
"the",
"scanner",
".",
"If",
"that",
"new",
... | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L2097-L2104 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.consume | private void consume(final String mName, final boolean mIgnoreWhitespace) {
if (!is(mName, mIgnoreWhitespace)) {
// error found by parser - stopping
throw new IllegalStateException("Wrong token after " + mScanner.begin() + " found "
+ mToken.getContent() + ". Expected " ... | java | private void consume(final String mName, final boolean mIgnoreWhitespace) {
if (!is(mName, mIgnoreWhitespace)) {
// error found by parser - stopping
throw new IllegalStateException("Wrong token after " + mScanner.begin() + " found "
+ mToken.getContent() + ". Expected " ... | [
"private",
"void",
"consume",
"(",
"final",
"String",
"mName",
",",
"final",
"boolean",
"mIgnoreWhitespace",
")",
"{",
"if",
"(",
"!",
"is",
"(",
"mName",
",",
"mIgnoreWhitespace",
")",
")",
"{",
"// error found by parser - stopping",
"throw",
"new",
"IllegalSta... | Consumes a token. Tests if it really has the expected name and if not
returns an error message. Otherwise gets a new token from the scanner. If
that new token is of type whitespace and the ignoreWhitespace parameter
is true, a new token is retrieved, until the current token is not of type
whitespace.
@param mName
the ... | [
"Consumes",
"a",
"token",
".",
"Tests",
"if",
"it",
"really",
"has",
"the",
"expected",
"name",
"and",
"if",
"not",
"returns",
"an",
"error",
"message",
".",
"Otherwise",
"gets",
"a",
"new",
"token",
"from",
"the",
"scanner",
".",
"If",
"that",
"new",
... | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L2119-L2126 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.is | private boolean is(final String mName, final boolean mIgnoreWhitespace) {
if (!mName.equals(mToken.getContent())) {
return false;
}
if (mToken.getType() == TokenType.COMP || mToken.getType() == TokenType.EQ
|| mToken.getType() == TokenType.N_EQ || mToken.getType() == To... | java | private boolean is(final String mName, final boolean mIgnoreWhitespace) {
if (!mName.equals(mToken.getContent())) {
return false;
}
if (mToken.getType() == TokenType.COMP || mToken.getType() == TokenType.EQ
|| mToken.getType() == TokenType.N_EQ || mToken.getType() == To... | [
"private",
"boolean",
"is",
"(",
"final",
"String",
"mName",
",",
"final",
"boolean",
"mIgnoreWhitespace",
")",
"{",
"if",
"(",
"!",
"mName",
".",
"equals",
"(",
"mToken",
".",
"getContent",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | Returns true or false if a token has the expected name. If the token has
the given name, it gets a new token from the scanner. If that new token
is of type whitespace and the ignoreWhitespace parameter is true, a new
token is retrieved, until the current token is not of type whitespace.
@param mName
the specified toke... | [
"Returns",
"true",
"or",
"false",
"if",
"a",
"token",
"has",
"the",
"expected",
"name",
".",
"If",
"the",
"token",
"has",
"the",
"given",
"name",
"it",
"gets",
"a",
"new",
"token",
"from",
"the",
"scanner",
".",
"If",
"that",
"new",
"token",
"is",
"o... | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L2141-L2154 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.is | private boolean is(final TokenType mType, final boolean mIgnoreWhitespace) {
if (mType != mToken.getType()) {
return false;
}
do {
// scan next token
mToken = mScanner.nextToken();
} while (mIgnoreWhitespace && mToken.getType() == TokenType.SPACE);
... | java | private boolean is(final TokenType mType, final boolean mIgnoreWhitespace) {
if (mType != mToken.getType()) {
return false;
}
do {
// scan next token
mToken = mScanner.nextToken();
} while (mIgnoreWhitespace && mToken.getType() == TokenType.SPACE);
... | [
"private",
"boolean",
"is",
"(",
"final",
"TokenType",
"mType",
",",
"final",
"boolean",
"mIgnoreWhitespace",
")",
"{",
"if",
"(",
"mType",
"!=",
"mToken",
".",
"getType",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"do",
"{",
"// scan next token",
... | Returns true or false if a token has the expected type. If so, a new
token is retrieved from the scanner. If that new token is of type
whitespace and the ignoreWhitespace parameter is true, a new token is
retrieved, until the current token is not of type whitespace.
@param mType
the specified token content
@param mIgn... | [
"Returns",
"true",
"or",
"false",
"if",
"a",
"token",
"has",
"the",
"expected",
"type",
".",
"If",
"so",
"a",
"new",
"token",
"is",
"retrieved",
"from",
"the",
"scanner",
".",
"If",
"that",
"new",
"token",
"is",
"of",
"type",
"whitespace",
"and",
"the"... | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L2169-L2182 | train |
Bedework/bw-util | bw-util-elasticsearch/src/main/java/org/bedework/util/elasticsearch/EsUtil.java | EsUtil.newIndex | public String newIndex(final String name,
final String mappingPath) throws IndexException {
try {
final String newName = name + newIndexSuffix();
final IndicesAdminClient idx = getAdminIdx();
final CreateIndexRequestBuilder cirb = idx.prepareCreate(newName);
final... | java | public String newIndex(final String name,
final String mappingPath) throws IndexException {
try {
final String newName = name + newIndexSuffix();
final IndicesAdminClient idx = getAdminIdx();
final CreateIndexRequestBuilder cirb = idx.prepareCreate(newName);
final... | [
"public",
"String",
"newIndex",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"mappingPath",
")",
"throws",
"IndexException",
"{",
"try",
"{",
"final",
"String",
"newName",
"=",
"name",
"+",
"newIndexSuffix",
"(",
")",
";",
"final",
"IndicesAdminClie... | create a new index and return its name. No alias will point to
the new index.
@param name basis for new name
@param mappingPath path to mapping file.
@return name of created index.
@throws IndexException for errors | [
"create",
"a",
"new",
"index",
"and",
"return",
"its",
"name",
".",
"No",
"alias",
"will",
"point",
"to",
"the",
"new",
"index",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-elasticsearch/src/main/java/org/bedework/util/elasticsearch/EsUtil.java#L315-L351 | train |
Bedework/bw-util | bw-util-elasticsearch/src/main/java/org/bedework/util/elasticsearch/EsUtil.java | EsUtil.purgeIndexes | public List<String> purgeIndexes(final Set<String> prefixes)
throws IndexException {
final Set<IndexInfo> indexes = getIndexInfo();
final List<String> purged = new ArrayList<>();
if (Util.isEmpty(indexes)) {
return purged;
}
purge:
for (final IndexInfo ii: indexes) {
fin... | java | public List<String> purgeIndexes(final Set<String> prefixes)
throws IndexException {
final Set<IndexInfo> indexes = getIndexInfo();
final List<String> purged = new ArrayList<>();
if (Util.isEmpty(indexes)) {
return purged;
}
purge:
for (final IndexInfo ii: indexes) {
fin... | [
"public",
"List",
"<",
"String",
">",
"purgeIndexes",
"(",
"final",
"Set",
"<",
"String",
">",
"prefixes",
")",
"throws",
"IndexException",
"{",
"final",
"Set",
"<",
"IndexInfo",
">",
"indexes",
"=",
"getIndexInfo",
"(",
")",
";",
"final",
"List",
"<",
"... | Remove any index that doesn't have an alias and starts with
the given prefix
@param prefixes Ignore indexes that have names that don't start
with any of these
@return list of purged indexes
@throws IndexException | [
"Remove",
"any",
"index",
"that",
"doesn",
"t",
"have",
"an",
"alias",
"and",
"starts",
"with",
"the",
"given",
"prefix"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-elasticsearch/src/main/java/org/bedework/util/elasticsearch/EsUtil.java#L398-L427 | train |
Bedework/bw-util | bw-util-elasticsearch/src/main/java/org/bedework/util/elasticsearch/EsUtil.java | EsUtil.swapIndex | public int swapIndex(final String index,
final String alias) throws IndexException {
//IndicesAliasesResponse resp = null;
try {
/* index is the index we were just indexing into
*/
final IndicesAdminClient idx = getAdminIdx();
final GetAliasesRequestBuilder igar... | java | public int swapIndex(final String index,
final String alias) throws IndexException {
//IndicesAliasesResponse resp = null;
try {
/* index is the index we were just indexing into
*/
final IndicesAdminClient idx = getAdminIdx();
final GetAliasesRequestBuilder igar... | [
"public",
"int",
"swapIndex",
"(",
"final",
"String",
"index",
",",
"final",
"String",
"alias",
")",
"throws",
"IndexException",
"{",
"//IndicesAliasesResponse resp = null;",
"try",
"{",
"/* index is the index we were just indexing into\n */",
"final",
"IndicesAdminClie... | Changes the givenm alias to refer tot eh supplied index name
@param index the index we were building
@param alias to refer to this index
@return 0 fir ok <0 for not ok
@throws IndexException | [
"Changes",
"the",
"givenm",
"alias",
"to",
"refer",
"tot",
"eh",
"supplied",
"index",
"name"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-elasticsearch/src/main/java/org/bedework/util/elasticsearch/EsUtil.java#L436-L486 | train |
Bedework/bw-util | bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java | DavUtil.syncReport | public Collection<DavChild> syncReport(final BasicHttpClient cl,
final String path,
final String syncToken,
final Collection<QName> props) throws Throwable {
final StringWriter sw = new StringW... | java | public Collection<DavChild> syncReport(final BasicHttpClient cl,
final String path,
final String syncToken,
final Collection<QName> props) throws Throwable {
final StringWriter sw = new StringW... | [
"public",
"Collection",
"<",
"DavChild",
">",
"syncReport",
"(",
"final",
"BasicHttpClient",
"cl",
",",
"final",
"String",
"path",
",",
"final",
"String",
"syncToken",
",",
"final",
"Collection",
"<",
"QName",
">",
"props",
")",
"throws",
"Throwable",
"{",
"... | Do a synch report on the targeted collection.
@param cl http client
@param path of collection
@param syncToken from last report or null
@param props null for a default set
@return Collection of DavChild or null for not found
@throws Throwable | [
"Do",
"a",
"synch",
"report",
"on",
"the",
"targeted",
"collection",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java#L320-L396 | train |
Bedework/bw-util | bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java | DavUtil.addNs | protected void addNs(final XmlEmit xml,
final String val) throws Throwable {
if (xml.getNameSpace(val) == null) {
xml.addNs(new NameSpace(val, null), false);
}
} | java | protected void addNs(final XmlEmit xml,
final String val) throws Throwable {
if (xml.getNameSpace(val) == null) {
xml.addNs(new NameSpace(val, null), false);
}
} | [
"protected",
"void",
"addNs",
"(",
"final",
"XmlEmit",
"xml",
",",
"final",
"String",
"val",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"xml",
".",
"getNameSpace",
"(",
"val",
")",
"==",
"null",
")",
"{",
"xml",
".",
"addNs",
"(",
"new",
"NameSpace",
... | Add a namespace
@param val
@throws Throwable | [
"Add",
"a",
"namespace"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java#L571-L576 | train |
Bedework/bw-util | bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java | DavUtil.parseContent | protected Document parseContent(final InputStream in) throws Throwable {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse(new InputSource(new InputStreamReader(in)));
} | java | protected Document parseContent(final InputStream in) throws Throwable {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse(new InputSource(new InputStreamReader(in)));
} | [
"protected",
"Document",
"parseContent",
"(",
"final",
"InputStream",
"in",
")",
"throws",
"Throwable",
"{",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setNamespaceAware",
"(",
"true",
")",... | Parse the content, and return the DOM representation.
@param in content as stream
@return Document Parsed body or null for no body
@exception Throwable Some error occurred. | [
"Parse",
"the",
"content",
"and",
"return",
"the",
"DOM",
"representation",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java#L584-L591 | train |
Bedework/bw-util | bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java | DavUtil.parseError | public Element parseError(final InputStream in) {
try {
final Document doc = parseContent(in);
final Element root = doc.getDocumentElement();
expect(root, WebdavTags.error);
final List<Element> els = getChildren(root);
if (els.size() != 1) {
return null;
}
retu... | java | public Element parseError(final InputStream in) {
try {
final Document doc = parseContent(in);
final Element root = doc.getDocumentElement();
expect(root, WebdavTags.error);
final List<Element> els = getChildren(root);
if (els.size() != 1) {
return null;
}
retu... | [
"public",
"Element",
"parseError",
"(",
"final",
"InputStream",
"in",
")",
"{",
"try",
"{",
"final",
"Document",
"doc",
"=",
"parseContent",
"(",
"in",
")",
";",
"final",
"Element",
"root",
"=",
"doc",
".",
"getDocumentElement",
"(",
")",
";",
"expect",
... | Parse a DAV error response
@param in response
@return a single error element or null | [
"Parse",
"a",
"DAV",
"error",
"response"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-dav/src/main/java/org/bedework/util/dav/DavUtil.java#L598-L616 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RESTResponseHelper.java | RESTResponseHelper.createResultElement | private static Element createResultElement(final Document document) {
final Element ttResponse = document.createElementNS("http://jaxrx.org/", "result");
ttResponse.setPrefix("jaxrx");
return ttResponse;
} | java | private static Element createResultElement(final Document document) {
final Element ttResponse = document.createElementNS("http://jaxrx.org/", "result");
ttResponse.setPrefix("jaxrx");
return ttResponse;
} | [
"private",
"static",
"Element",
"createResultElement",
"(",
"final",
"Document",
"document",
")",
"{",
"final",
"Element",
"ttResponse",
"=",
"document",
".",
"createElementNS",
"(",
"\"http://jaxrx.org/\"",
",",
"\"result\"",
")",
";",
"ttResponse",
".",
"setPrefix... | This method creates the TreeTank response XML element.
@param document
The {@link Document} instance for the response.
@return The created XML {@link Element}. | [
"This",
"method",
"creates",
"the",
"TreeTank",
"response",
"XML",
"element",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RESTResponseHelper.java#L92-L96 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RESTResponseHelper.java | RESTResponseHelper.buildResponseOfDomLR | public static StreamingOutput buildResponseOfDomLR(final IStorage pDatabase,
final IBackendFactory pStorageFac, final IRevisioning pRevision) {
final StreamingOutput sOutput = new StreamingOutput() {
@Override
public void write(final OutputStream output) throws IOException, Web... | java | public static StreamingOutput buildResponseOfDomLR(final IStorage pDatabase,
final IBackendFactory pStorageFac, final IRevisioning pRevision) {
final StreamingOutput sOutput = new StreamingOutput() {
@Override
public void write(final OutputStream output) throws IOException, Web... | [
"public",
"static",
"StreamingOutput",
"buildResponseOfDomLR",
"(",
"final",
"IStorage",
"pDatabase",
",",
"final",
"IBackendFactory",
"pStorageFac",
",",
"final",
"IRevisioning",
"pRevision",
")",
"{",
"final",
"StreamingOutput",
"sOutput",
"=",
"new",
"StreamingOutput... | This method builds the overview for the resources and collection we offer
in our implementation.
@param pDatabase
path to the storage
@param pStorageFac
factory for creating backends
@param pRevision
revision algorithm utilized
@return The streaming output for the HTTP response body. | [
"This",
"method",
"builds",
"the",
"overview",
"for",
"the",
"resources",
"and",
"collection",
"we",
"offer",
"in",
"our",
"implementation",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RESTResponseHelper.java#L145-L187 | train |
Bedework/bw-util | bw-util-http/src/main/java/org/bedework/util/http/HttpUtil.java | HttpUtil.getUrl | public static String getUrl(final HttpServletRequest request) {
try {
final StringBuffer sb = request.getRequestURL();
if (sb != null) {
return sb.toString();
}
// Presumably portlet - see what happens with uri
return request.getRequestURI();
} catch (Throwable t) {
... | java | public static String getUrl(final HttpServletRequest request) {
try {
final StringBuffer sb = request.getRequestURL();
if (sb != null) {
return sb.toString();
}
// Presumably portlet - see what happens with uri
return request.getRequestURI();
} catch (Throwable t) {
... | [
"public",
"static",
"String",
"getUrl",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"try",
"{",
"final",
"StringBuffer",
"sb",
"=",
"request",
".",
"getRequestURL",
"(",
")",
";",
"if",
"(",
"sb",
"!=",
"null",
")",
"{",
"return",
"sb",
".",... | Returns the String url from the request.
@param request incoming request
@return String url from the request | [
"Returns",
"the",
"String",
"url",
"from",
"the",
"request",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-http/src/main/java/org/bedework/util/http/HttpUtil.java#L304-L316 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/SessionListener.java | SessionListener.logSessionCounts | protected void logSessionCounts(final HttpSession sess,
final boolean start) {
StringBuffer sb;
String appname = getAppName(sess);
Counts ct = getCounts(appname);
if (start) {
sb = new StringBuffer("SESSION-START:");
} else {
sb = new StringBuffer("SESS... | java | protected void logSessionCounts(final HttpSession sess,
final boolean start) {
StringBuffer sb;
String appname = getAppName(sess);
Counts ct = getCounts(appname);
if (start) {
sb = new StringBuffer("SESSION-START:");
} else {
sb = new StringBuffer("SESS... | [
"protected",
"void",
"logSessionCounts",
"(",
"final",
"HttpSession",
"sess",
",",
"final",
"boolean",
"start",
")",
"{",
"StringBuffer",
"sb",
";",
"String",
"appname",
"=",
"getAppName",
"(",
"sess",
")",
";",
"Counts",
"ct",
"=",
"getCounts",
"(",
"appnam... | Log the session counters for applications that maintain them.
@param sess HttpSession for the session id
@param start true for session start | [
"Log",
"the",
"session",
"counters",
"for",
"applications",
"that",
"maintain",
"them",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/SessionListener.java#L116-L142 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/SessionListener.java | SessionListener.getSessionId | private String getSessionId(final HttpSession sess) {
try {
if (sess == null) {
return "NO-SESSIONID";
} else {
return sess.getId();
}
} catch (Throwable t) {
return "SESSION-ID-EXCEPTION";
}
} | java | private String getSessionId(final HttpSession sess) {
try {
if (sess == null) {
return "NO-SESSIONID";
} else {
return sess.getId();
}
} catch (Throwable t) {
return "SESSION-ID-EXCEPTION";
}
} | [
"private",
"String",
"getSessionId",
"(",
"final",
"HttpSession",
"sess",
")",
"{",
"try",
"{",
"if",
"(",
"sess",
"==",
"null",
")",
"{",
"return",
"\"NO-SESSIONID\"",
";",
"}",
"else",
"{",
"return",
"sess",
".",
"getId",
"(",
")",
";",
"}",
"}",
"... | Get the session id for the loggers.
@param sess
@return String session id | [
"Get",
"the",
"session",
"id",
"for",
"the",
"loggers",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/SessionListener.java#L177-L187 | train |
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java | PresentationState.checkBrowserType | public void checkBrowserType(final HttpServletRequest request) {
String reqpar = request.getParameter(getBrowserTypeRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky browser type
setBrowserTypeSticky(false);
} else {
setBrowserType(reqpar... | java | public void checkBrowserType(final HttpServletRequest request) {
String reqpar = request.getParameter(getBrowserTypeRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky browser type
setBrowserTypeSticky(false);
} else {
setBrowserType(reqpar... | [
"public",
"void",
"checkBrowserType",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"String",
"reqpar",
"=",
"request",
".",
"getParameter",
"(",
"getBrowserTypeRequestName",
"(",
")",
")",
";",
"if",
"(",
"reqpar",
"!=",
"null",
")",
"{",
"if",
"... | Allow user to explicitly set the browser type.
@param request Needed to locate parameters | [
"Allow",
"user",
"to",
"explicitly",
"set",
"the",
"browser",
"type",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java#L251-L274 | train |
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java | PresentationState.checkContentType | public void checkContentType(final HttpServletRequest request) {
String reqpar = request.getParameter(getContentTypeRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky content type
setContentTypeSticky(false);
} else {
setContentType(reqpar... | java | public void checkContentType(final HttpServletRequest request) {
String reqpar = request.getParameter(getContentTypeRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky content type
setContentTypeSticky(false);
} else {
setContentType(reqpar... | [
"public",
"void",
"checkContentType",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"String",
"reqpar",
"=",
"request",
".",
"getParameter",
"(",
"getContentTypeRequestName",
"(",
")",
")",
";",
"if",
"(",
"reqpar",
"!=",
"null",
")",
"{",
"if",
"... | Allow user to explicitly set the content type.
@param request Needed to locate session | [
"Allow",
"user",
"to",
"explicitly",
"set",
"the",
"content",
"type",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java#L344-L367 | train |
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java | PresentationState.checkContentName | public void checkContentName(final HttpServletRequest request) {
String reqpar = request.getParameter(getContentNameRequestName());
// Set to null if not found.
setContentName(reqpar);
} | java | public void checkContentName(final HttpServletRequest request) {
String reqpar = request.getParameter(getContentNameRequestName());
// Set to null if not found.
setContentName(reqpar);
} | [
"public",
"void",
"checkContentName",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"String",
"reqpar",
"=",
"request",
".",
"getParameter",
"(",
"getContentNameRequestName",
"(",
")",
")",
";",
"// Set to null if not found.",
"setContentName",
"(",
"reqpar... | Allow user to explicitly set the filename of the content.
@param request Needed to locate session | [
"Allow",
"user",
"to",
"explicitly",
"set",
"the",
"filename",
"of",
"the",
"content",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java#L407-L412 | train |
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java | PresentationState.checkSkinName | public void checkSkinName(final HttpServletRequest request) {
String reqpar = request.getParameter(getSkinNameRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky SkinName
setSkinNameSticky(false);
} else {
setSkinName(reqpar);
setSk... | java | public void checkSkinName(final HttpServletRequest request) {
String reqpar = request.getParameter(getSkinNameRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky SkinName
setSkinNameSticky(false);
} else {
setSkinName(reqpar);
setSk... | [
"public",
"void",
"checkSkinName",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"String",
"reqpar",
"=",
"request",
".",
"getParameter",
"(",
"getSkinNameRequestName",
"(",
")",
")",
";",
"if",
"(",
"reqpar",
"!=",
"null",
")",
"{",
"if",
"(",
... | Allow user to explicitly set the skin name.
@param request Needed to locate session | [
"Allow",
"user",
"to",
"explicitly",
"set",
"the",
"skin",
"name",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java#L482-L505 | train |
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java | PresentationState.checkRefreshXslt | public void checkRefreshXslt(final HttpServletRequest request) {
String reqpar = request.getParameter(getRefreshXSLTRequestName());
if (reqpar == null) {
return;
}
if (reqpar.equals("yes")) {
setForceXSLTRefresh(true);
}
if (reqpar.equals("always")) {
setForceXSLTRefreshAlwa... | java | public void checkRefreshXslt(final HttpServletRequest request) {
String reqpar = request.getParameter(getRefreshXSLTRequestName());
if (reqpar == null) {
return;
}
if (reqpar.equals("yes")) {
setForceXSLTRefresh(true);
}
if (reqpar.equals("always")) {
setForceXSLTRefreshAlwa... | [
"public",
"void",
"checkRefreshXslt",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"String",
"reqpar",
"=",
"request",
".",
"getParameter",
"(",
"getRefreshXSLTRequestName",
"(",
")",
")",
";",
"if",
"(",
"reqpar",
"==",
"null",
")",
"{",
"return",... | Allow user to indicate how we should refresh the xslt.
@param request Needed to locate session | [
"Allow",
"user",
"to",
"indicate",
"how",
"we",
"should",
"refresh",
"the",
"xslt",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java#L561-L579 | train |
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java | PresentationState.checkNoXSLT | public void checkNoXSLT(final HttpServletRequest request) {
String reqpar = request.getParameter(getNoXSLTRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky noXslt
setNoXSLTSticky(false);
} else {
setNoXSLT(true);
}
}
reqpar... | java | public void checkNoXSLT(final HttpServletRequest request) {
String reqpar = request.getParameter(getNoXSLTRequestName());
if (reqpar != null) {
if (reqpar.equals("!")) {
// Go back to unsticky noXslt
setNoXSLTSticky(false);
} else {
setNoXSLT(true);
}
}
reqpar... | [
"public",
"void",
"checkNoXSLT",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"String",
"reqpar",
"=",
"request",
".",
"getParameter",
"(",
"getNoXSLTRequestName",
"(",
")",
")",
";",
"if",
"(",
"reqpar",
"!=",
"null",
")",
"{",
"if",
"(",
"req... | Allow user to suppress XSLT transform for one request.
Used for debugging - provides the raw xml.
@param request Needed to locate session | [
"Allow",
"user",
"to",
"suppress",
"XSLT",
"transform",
"for",
"one",
"request",
".",
"Used",
"for",
"debugging",
"-",
"provides",
"the",
"raw",
"xml",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/PresentationState.java#L650-L672 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.getBranchLog | public static Map<Long, LogEntry> getBranchLog(String[] branches, long startRevision, long endRevision, String baseUrl, String user, String pwd) throws IOException, SAXException {
try (InputStream inStr = getBranchLogStream(branches, startRevision, endRevision, baseUrl, user, pwd)) {
return new SVNL... | java | public static Map<Long, LogEntry> getBranchLog(String[] branches, long startRevision, long endRevision, String baseUrl, String user, String pwd) throws IOException, SAXException {
try (InputStream inStr = getBranchLogStream(branches, startRevision, endRevision, baseUrl, user, pwd)) {
return new SVNL... | [
"public",
"static",
"Map",
"<",
"Long",
",",
"LogEntry",
">",
"getBranchLog",
"(",
"String",
"[",
"]",
"branches",
",",
"long",
"startRevision",
",",
"long",
"endRevision",
",",
"String",
"baseUrl",
",",
"String",
"user",
",",
"String",
"pwd",
")",
"throws... | Retrieve the XML-log of changes on the given branch, in a specified range of revisions.
@param branches The list of branches to fetch logs for, currently only the first entry is used!
@param startRevision The SVN revision to use as starting point for the log-entries.
@param endRevision The SVN revision to use as end... | [
"Retrieve",
"the",
"XML",
"-",
"log",
"of",
"changes",
"on",
"the",
"given",
"branch",
"in",
"a",
"specified",
"range",
"of",
"revisions",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L97-L103 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.getRemoteFileContent | public static InputStream getRemoteFileContent(String file, long revision, String baseUrl, String user, String pwd) throws IOException {
// svn cat -r 666 file
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_CAT);
addDefaultArguments(cmdLine, user, pwd);
c... | java | public static InputStream getRemoteFileContent(String file, long revision, String baseUrl, String user, String pwd) throws IOException {
// svn cat -r 666 file
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_CAT);
addDefaultArguments(cmdLine, user, pwd);
c... | [
"public",
"static",
"InputStream",
"getRemoteFileContent",
"(",
"String",
"file",
",",
"long",
"revision",
",",
"String",
"baseUrl",
",",
"String",
"user",
",",
"String",
"pwd",
")",
"throws",
"IOException",
"{",
"// svn cat -r 666 file",
"CommandLine",
"cmdLine",
... | Retrieve the contents of a file from the web-interface of the SVN server.
@param file The file to fetch from the SVN server via
@param revision The SVN revision to use
@param baseUrl The SVN url to connect to
@param user The SVN user or null if the default user from the machine should be used
@param pwd Th... | [
"Retrieve",
"the",
"contents",
"of",
"a",
"file",
"from",
"the",
"web",
"-",
"interface",
"of",
"the",
"SVN",
"server",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L229-L239 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.branchExists | public static boolean branchExists(String branch, String baseUrl) {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_LOG);
cmdLine.addArgument(OPT_XML);
addDefaultArguments(cmdLine, null, null);
cmdLine.addArgument("-r");
cmdLine.addArgument("HEAD:H... | java | public static boolean branchExists(String branch, String baseUrl) {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_LOG);
cmdLine.addArgument(OPT_XML);
addDefaultArguments(cmdLine, null, null);
cmdLine.addArgument("-r");
cmdLine.addArgument("HEAD:H... | [
"public",
"static",
"boolean",
"branchExists",
"(",
"String",
"branch",
",",
"String",
"baseUrl",
")",
"{",
"CommandLine",
"cmdLine",
"=",
"new",
"CommandLine",
"(",
"SVN_CMD",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"CMD_LOG",
")",
";",
"cmdLine",
"."... | Check if the given branch already exists
@param branch The name of the branch including the path to the branch, e.g. branches/4.2.x
@param baseUrl The SVN url to connect to
@return true if the branch already exists, false otherwise. | [
"Check",
"if",
"the",
"given",
"branch",
"already",
"exists"
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L248-L263 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.getBranchRevision | public static long getBranchRevision(String branch, String baseUrl) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_LOG);
cmdLine.addArgument(OPT_XML);
addDefaultArguments(cmdLine, null, null);
cmdLine.addArgument("-v");
cmdLin... | java | public static long getBranchRevision(String branch, String baseUrl) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_LOG);
cmdLine.addArgument(OPT_XML);
addDefaultArguments(cmdLine, null, null);
cmdLine.addArgument("-v");
cmdLin... | [
"public",
"static",
"long",
"getBranchRevision",
"(",
"String",
"branch",
",",
"String",
"baseUrl",
")",
"throws",
"IOException",
"{",
"CommandLine",
"cmdLine",
"=",
"new",
"CommandLine",
"(",
"SVN_CMD",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"CMD_LOG",
... | Return the revision from which the branch was branched off.
@param branch The name of the branch including the path to the branch, e.g. branches/4.2.x
@param baseUrl The SVN url to connect to
@return The revision where the branch was branched off from it's parent branch.
@throws IOException Execution of the SVN ... | [
"Return",
"the",
"revision",
"from",
"which",
"the",
"branch",
"was",
"branched",
"off",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L274-L299 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.getLastRevision | public static long getLastRevision(String branch, String baseUrl, String user, String pwd) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument("info");
addDefaultArguments(cmdLine, user, pwd);
cmdLine.addArgument(baseUrl + branch);
try (Input... | java | public static long getLastRevision(String branch, String baseUrl, String user, String pwd) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument("info");
addDefaultArguments(cmdLine, user, pwd);
cmdLine.addArgument(baseUrl + branch);
try (Input... | [
"public",
"static",
"long",
"getLastRevision",
"(",
"String",
"branch",
",",
"String",
"baseUrl",
",",
"String",
"user",
",",
"String",
"pwd",
")",
"throws",
"IOException",
"{",
"CommandLine",
"cmdLine",
"=",
"new",
"CommandLine",
"(",
"SVN_CMD",
")",
";",
"... | Return the last revision of the given branch. Uses the full svn repository if branch is ""
@param branch The name of the branch including the path to the branch, e.g. branches/4.2.x
@param baseUrl The SVN url to connect to
@param user The SVN user or null if the default user from the machine should be used
@para... | [
"Return",
"the",
"last",
"revision",
"of",
"the",
"given",
"branch",
".",
"Uses",
"the",
"full",
"svn",
"repository",
"if",
"branch",
"is"
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L312-L339 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.getPendingCheckins | public static InputStream getPendingCheckins(File directory) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_STATUS);
addDefaultArguments(cmdLine, null, null);
return ExecutionHelper.getCommandResult(cmdLine, directory, -1, 120000);
} | java | public static InputStream getPendingCheckins(File directory) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_STATUS);
addDefaultArguments(cmdLine, null, null);
return ExecutionHelper.getCommandResult(cmdLine, directory, -1, 120000);
} | [
"public",
"static",
"InputStream",
"getPendingCheckins",
"(",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"CommandLine",
"cmdLine",
"=",
"new",
"CommandLine",
"(",
"SVN_CMD",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"CMD_STATUS",
")",
";",
"addD... | Performs a "svn status" and returns the list of changes in the svn tree at the given directory
in the format that the svn command provides them.
@param directory The local working directory
@return A stream which returns a textual list of changes as reported by "svn status", should be closed by the caller
@throws IOEx... | [
"Performs",
"a",
"svn",
"status",
"and",
"returns",
"the",
"list",
"of",
"changes",
"in",
"the",
"svn",
"tree",
"at",
"the",
"given",
"directory",
"in",
"the",
"format",
"that",
"the",
"svn",
"command",
"provides",
"them",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L363-L369 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.recordMerge | public static InputStream recordMerge(File directory, String branchName, long... revisions) throws IOException {
// svn merge -c 3328 --record-only ^/calc/trunk
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_MERGE);
addDefaultArguments(cmdLine, null, null);
... | java | public static InputStream recordMerge(File directory, String branchName, long... revisions) throws IOException {
// svn merge -c 3328 --record-only ^/calc/trunk
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_MERGE);
addDefaultArguments(cmdLine, null, null);
... | [
"public",
"static",
"InputStream",
"recordMerge",
"(",
"File",
"directory",
",",
"String",
"branchName",
",",
"long",
"...",
"revisions",
")",
"throws",
"IOException",
"{",
"// \t\t\t\tsvn merge -c 3328 --record-only ^/calc/trunk",
"CommandLine",
"cmdLine",
"=",
"new",
... | Record a manual merge from one branch to the local working directory.
@param directory The local working directory
@param branchName The branch that was merged in manually
@param revisions The list of merged revisions.
@return A stream which provides the output of the "svn merge" command, should be closed by the calle... | [
"Record",
"a",
"manual",
"merge",
"from",
"one",
"branch",
"to",
"the",
"local",
"working",
"directory",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L491-L510 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.verifyNoPendingChanges | public static boolean verifyNoPendingChanges(File directory) throws IOException {
log.info("Checking that there are no pending changes on trunk-working copy");
try (InputStream inStr = getPendingCheckins(directory)) {
List<String> lines = IOUtils.readLines(inStr, "UTF-8");
if (li... | java | public static boolean verifyNoPendingChanges(File directory) throws IOException {
log.info("Checking that there are no pending changes on trunk-working copy");
try (InputStream inStr = getPendingCheckins(directory)) {
List<String> lines = IOUtils.readLines(inStr, "UTF-8");
if (li... | [
"public",
"static",
"boolean",
"verifyNoPendingChanges",
"(",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"log",
".",
"info",
"(",
"\"Checking that there are no pending changes on trunk-working copy\"",
")",
";",
"try",
"(",
"InputStream",
"inStr",
"=",
"get... | Check if there are pending changes on the branch, returns true if changes are found.
@param directory The local working directory
@return True if there are pending changes, false otherwise
@throws IOException Execution of the SVN sub-process failed or the
sub-process returned a exit value indicating a failure | [
"Check",
"if",
"there",
"are",
"pending",
"changes",
"on",
"the",
"branch",
"returns",
"true",
"if",
"changes",
"are",
"found",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L520-L531 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.