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
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java
EventListenerSupport.createProxy
private void createProxy(final Class<L> listenerInterface, final ClassLoader classLoader) { proxy = listenerInterface.cast(Proxy.newProxyInstance(classLoader, new Class[] { listenerInterface }, createInvocationHandler())); }
java
private void createProxy(final Class<L> listenerInterface, final ClassLoader classLoader) { proxy = listenerInterface.cast(Proxy.newProxyInstance(classLoader, new Class[] { listenerInterface }, createInvocationHandler())); }
[ "private", "void", "createProxy", "(", "final", "Class", "<", "L", ">", "listenerInterface", ",", "final", "ClassLoader", "classLoader", ")", "{", "proxy", "=", "listenerInterface", ".", "cast", "(", "Proxy", ".", "newProxyInstance", "(", "classLoader", ",", "...
Create the proxy object. @param listenerInterface the class of the listener interface @param classLoader the class loader to be used
[ "Create", "the", "proxy", "object", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java#L304-L307
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java
CharSequenceTranslator.translate
@GwtIncompatible("incompatible method") public final String translate(final CharSequence input) { if (input == null) { return null; } try { final StringWriter writer = new StringWriter(input.length() * 2); translate(input, writer); return writer.toString(); } catch (final IOException ioe) { // this should never ever happen while writing to a StringWriter throw new RuntimeException(ioe); } }
java
@GwtIncompatible("incompatible method") public final String translate(final CharSequence input) { if (input == null) { return null; } try { final StringWriter writer = new StringWriter(input.length() * 2); translate(input, writer); return writer.toString(); } catch (final IOException ioe) { // this should never ever happen while writing to a StringWriter throw new RuntimeException(ioe); } }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "final", "String", "translate", "(", "final", "CharSequence", "input", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "final", "StringWriter...
Helper for non-Writer usage. @param input CharSequence to be translated @return String output of translation
[ "Helper", "for", "non", "-", "Writer", "usage", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/translate/CharSequenceTranslator.java#L61-L74
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/AnnotationUtils.java
AnnotationUtils.memberEquals
@GwtIncompatible("incompatible method") private static boolean memberEquals(final Class<?> type, final Object o1, final Object o2) { if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } if (type.isArray()) { return arrayMemberEquals(type.getComponentType(), o1, o2); } if (type.isAnnotation()) { return equals((Annotation) o1, (Annotation) o2); } return o1.equals(o2); }
java
@GwtIncompatible("incompatible method") private static boolean memberEquals(final Class<?> type, final Object o1, final Object o2) { if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } if (type.isArray()) { return arrayMemberEquals(type.getComponentType(), o1, o2); } if (type.isAnnotation()) { return equals((Annotation) o1, (Annotation) o2); } return o1.equals(o2); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "private", "static", "boolean", "memberEquals", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "o1", ",", "final", "Object", "o2", ")", "{", "if", "(", "o1", "==", "o2", ...
Helper method for checking whether two objects of the given type are equal. This method is used to compare the parameters of two annotation instances. @param type the type of the objects to be compared @param o1 the first object @param o2 the second object @return a flag whether these objects are equal
[ "Helper", "method", "for", "checking", "whether", "two", "objects", "of", "the", "given", "type", "are", "equal", ".", "This", "method", "is", "used", "to", "compare", "the", "parameters", "of", "two", "annotation", "instances", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/AnnotationUtils.java#L269-L284
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/AnnotationUtils.java
AnnotationUtils.arrayMemberEquals
@GwtIncompatible("incompatible method") private static boolean arrayMemberEquals(final Class<?> componentType, final Object o1, final Object o2) { if (componentType.isAnnotation()) { return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2); } if (componentType.equals(Byte.TYPE)) { return Arrays.equals((byte[]) o1, (byte[]) o2); } if (componentType.equals(Short.TYPE)) { return Arrays.equals((short[]) o1, (short[]) o2); } if (componentType.equals(Integer.TYPE)) { return Arrays.equals((int[]) o1, (int[]) o2); } if (componentType.equals(Character.TYPE)) { return Arrays.equals((char[]) o1, (char[]) o2); } if (componentType.equals(Long.TYPE)) { return Arrays.equals((long[]) o1, (long[]) o2); } if (componentType.equals(Float.TYPE)) { return Arrays.equals((float[]) o1, (float[]) o2); } if (componentType.equals(Double.TYPE)) { return Arrays.equals((double[]) o1, (double[]) o2); } if (componentType.equals(Boolean.TYPE)) { return Arrays.equals((boolean[]) o1, (boolean[]) o2); } return Arrays.equals((Object[]) o1, (Object[]) o2); }
java
@GwtIncompatible("incompatible method") private static boolean arrayMemberEquals(final Class<?> componentType, final Object o1, final Object o2) { if (componentType.isAnnotation()) { return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2); } if (componentType.equals(Byte.TYPE)) { return Arrays.equals((byte[]) o1, (byte[]) o2); } if (componentType.equals(Short.TYPE)) { return Arrays.equals((short[]) o1, (short[]) o2); } if (componentType.equals(Integer.TYPE)) { return Arrays.equals((int[]) o1, (int[]) o2); } if (componentType.equals(Character.TYPE)) { return Arrays.equals((char[]) o1, (char[]) o2); } if (componentType.equals(Long.TYPE)) { return Arrays.equals((long[]) o1, (long[]) o2); } if (componentType.equals(Float.TYPE)) { return Arrays.equals((float[]) o1, (float[]) o2); } if (componentType.equals(Double.TYPE)) { return Arrays.equals((double[]) o1, (double[]) o2); } if (componentType.equals(Boolean.TYPE)) { return Arrays.equals((boolean[]) o1, (boolean[]) o2); } return Arrays.equals((Object[]) o1, (Object[]) o2); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "private", "static", "boolean", "arrayMemberEquals", "(", "final", "Class", "<", "?", ">", "componentType", ",", "final", "Object", "o1", ",", "final", "Object", "o2", ")", "{", "if", "(", "component...
Helper method for comparing two objects of an array type. @param componentType the component type of the array @param o1 the first object @param o2 the second object @return a flag whether these objects are equal
[ "Helper", "method", "for", "comparing", "two", "objects", "of", "an", "array", "type", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/AnnotationUtils.java#L294-L324
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/AnnotationUtils.java
AnnotationUtils.annotationArrayMemberEquals
@GwtIncompatible("incompatible method") private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) { if (a1.length != a2.length) { return false; } for (int i = 0; i < a1.length; i++) { if (!equals(a1[i], a2[i])) { return false; } } return true; }
java
@GwtIncompatible("incompatible method") private static boolean annotationArrayMemberEquals(final Annotation[] a1, final Annotation[] a2) { if (a1.length != a2.length) { return false; } for (int i = 0; i < a1.length; i++) { if (!equals(a1[i], a2[i])) { return false; } } return true; }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "private", "static", "boolean", "annotationArrayMemberEquals", "(", "final", "Annotation", "[", "]", "a1", ",", "final", "Annotation", "[", "]", "a2", ")", "{", "if", "(", "a1", ".", "length", "!=", ...
Helper method for comparing two arrays of annotations. @param a1 the first array @param a2 the second array @return a flag whether these arrays are equal
[ "Helper", "method", "for", "comparing", "two", "arrays", "of", "annotations", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/AnnotationUtils.java#L333-L344
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/AnnotationUtils.java
AnnotationUtils.arrayMemberHash
private static int arrayMemberHash(final Class<?> componentType, final Object o) { if (componentType.equals(Byte.TYPE)) { return Arrays.hashCode((byte[]) o); } if (componentType.equals(Short.TYPE)) { return Arrays.hashCode((short[]) o); } if (componentType.equals(Integer.TYPE)) { return Arrays.hashCode((int[]) o); } if (componentType.equals(Character.TYPE)) { return Arrays.hashCode((char[]) o); } if (componentType.equals(Long.TYPE)) { return Arrays.hashCode((long[]) o); } if (componentType.equals(Float.TYPE)) { return Arrays.hashCode((float[]) o); } if (componentType.equals(Double.TYPE)) { return Arrays.hashCode((double[]) o); } if (componentType.equals(Boolean.TYPE)) { return Arrays.hashCode((boolean[]) o); } return Arrays.hashCode((Object[]) o); }
java
private static int arrayMemberHash(final Class<?> componentType, final Object o) { if (componentType.equals(Byte.TYPE)) { return Arrays.hashCode((byte[]) o); } if (componentType.equals(Short.TYPE)) { return Arrays.hashCode((short[]) o); } if (componentType.equals(Integer.TYPE)) { return Arrays.hashCode((int[]) o); } if (componentType.equals(Character.TYPE)) { return Arrays.hashCode((char[]) o); } if (componentType.equals(Long.TYPE)) { return Arrays.hashCode((long[]) o); } if (componentType.equals(Float.TYPE)) { return Arrays.hashCode((float[]) o); } if (componentType.equals(Double.TYPE)) { return Arrays.hashCode((double[]) o); } if (componentType.equals(Boolean.TYPE)) { return Arrays.hashCode((boolean[]) o); } return Arrays.hashCode((Object[]) o); }
[ "private", "static", "int", "arrayMemberHash", "(", "final", "Class", "<", "?", ">", "componentType", ",", "final", "Object", "o", ")", "{", "if", "(", "componentType", ".", "equals", "(", "Byte", ".", "TYPE", ")", ")", "{", "return", "Arrays", ".", "h...
Helper method for generating a hash code for an array. @param componentType the component type of the array @param o the array @return a hash code for the specified array
[ "Helper", "method", "for", "generating", "a", "hash", "code", "for", "an", "array", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/AnnotationUtils.java#L353-L379
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrMatcher.java
StrMatcher.charSetMatcher
public static StrMatcher charSetMatcher(final char... chars) { if (chars == null || chars.length == 0) { return NONE_MATCHER; } if (chars.length == 1) { return new CharMatcher(chars[0]); } return new CharSetMatcher(chars); }
java
public static StrMatcher charSetMatcher(final char... chars) { if (chars == null || chars.length == 0) { return NONE_MATCHER; } if (chars.length == 1) { return new CharMatcher(chars[0]); } return new CharSetMatcher(chars); }
[ "public", "static", "StrMatcher", "charSetMatcher", "(", "final", "char", "...", "chars", ")", "{", "if", "(", "chars", "==", "null", "||", "chars", ".", "length", "==", "0", ")", "{", "return", "NONE_MATCHER", ";", "}", "if", "(", "chars", ".", "lengt...
Constructor that creates a matcher from a set of characters. @param chars the characters to match, null or empty matches nothing @return a new matcher for the given char[]
[ "Constructor", "that", "creates", "a", "matcher", "from", "a", "set", "of", "characters", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrMatcher.java#L176-L184
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrMatcher.java
StrMatcher.charSetMatcher
public static StrMatcher charSetMatcher(final String chars) { if (StringUtils.isEmpty(chars)) { return NONE_MATCHER; } if (chars.length() == 1) { return new CharMatcher(chars.charAt(0)); } return new CharSetMatcher(chars.toCharArray()); }
java
public static StrMatcher charSetMatcher(final String chars) { if (StringUtils.isEmpty(chars)) { return NONE_MATCHER; } if (chars.length() == 1) { return new CharMatcher(chars.charAt(0)); } return new CharSetMatcher(chars.toCharArray()); }
[ "public", "static", "StrMatcher", "charSetMatcher", "(", "final", "String", "chars", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "chars", ")", ")", "{", "return", "NONE_MATCHER", ";", "}", "if", "(", "chars", ".", "length", "(", ")", "==", ...
Constructor that creates a matcher from a string representing a set of characters. @param chars the characters to match, null or empty matches nothing @return a new Matcher for the given characters
[ "Constructor", "that", "creates", "a", "matcher", "from", "a", "string", "representing", "a", "set", "of", "characters", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrMatcher.java#L192-L200
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrMatcher.java
StrMatcher.stringMatcher
public static StrMatcher stringMatcher(final String str) { if (StringUtils.isEmpty(str)) { return NONE_MATCHER; } return new StringMatcher(str); }
java
public static StrMatcher stringMatcher(final String str) { if (StringUtils.isEmpty(str)) { return NONE_MATCHER; } return new StringMatcher(str); }
[ "public", "static", "StrMatcher", "stringMatcher", "(", "final", "String", "str", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "str", ")", ")", "{", "return", "NONE_MATCHER", ";", "}", "return", "new", "StringMatcher", "(", "str", ")", ";", "...
Constructor that creates a matcher from a string. @param str the string to match, null or empty matches nothing @return a new Matcher for the given String
[ "Constructor", "that", "creates", "a", "matcher", "from", "a", "string", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrMatcher.java#L208-L213
train
ixa-ehu/ixa-pipe-pos
src/main/java/eus/ixa/ixa/pipe/lemma/eval/LemmaEvaluate.java
LemmaEvaluate.evaluate
public final void evaluate() { final LemmatizerEvaluator evaluator = new LemmatizerEvaluator(this.lemmatizer); try { evaluator.evaluate(this.testSamples); } catch (IOException e) { e.printStackTrace(); } System.out.println(evaluator.getWordAccuracy()); }
java
public final void evaluate() { final LemmatizerEvaluator evaluator = new LemmatizerEvaluator(this.lemmatizer); try { evaluator.evaluate(this.testSamples); } catch (IOException e) { e.printStackTrace(); } System.out.println(evaluator.getWordAccuracy()); }
[ "public", "final", "void", "evaluate", "(", ")", "{", "final", "LemmatizerEvaluator", "evaluator", "=", "new", "LemmatizerEvaluator", "(", "this", ".", "lemmatizer", ")", ";", "try", "{", "evaluator", ".", "evaluate", "(", "this", ".", "testSamples", ")", ";...
Evaluate and print word accuracy.
[ "Evaluate", "and", "print", "word", "accuracy", "." ]
083c986103f95ae8063b8ddc89a2caa8047d29b9
https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/lemma/eval/LemmaEvaluate.java#L91-L99
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/CharSetUtils.java
CharSetUtils.modify
private static String modify(final String str, final String[] set, final boolean expect) { final CharSet chars = CharSet.getInstance(set); final StringBuilder buffer = new StringBuilder(str.length()); final char[] chrs = str.toCharArray(); for (final char chr : chrs) { if (chars.contains(chr) == expect) { buffer.append(chr); } } return buffer.toString(); }
java
private static String modify(final String str, final String[] set, final boolean expect) { final CharSet chars = CharSet.getInstance(set); final StringBuilder buffer = new StringBuilder(str.length()); final char[] chrs = str.toCharArray(); for (final char chr : chrs) { if (chars.contains(chr) == expect) { buffer.append(chr); } } return buffer.toString(); }
[ "private", "static", "String", "modify", "(", "final", "String", "str", ",", "final", "String", "[", "]", "set", ",", "final", "boolean", "expect", ")", "{", "final", "CharSet", "chars", "=", "CharSet", ".", "getInstance", "(", "set", ")", ";", "final", ...
Implementation of delete and keep @param str String to modify characters within @param set String[] set of characters to modify @param expect whether to evaluate on match, or non-match @return the modified String, not null
[ "Implementation", "of", "delete", "and", "keep" ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/CharSetUtils.java#L231-L241
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/CharSetUtils.java
CharSetUtils.deepEmpty
private static boolean deepEmpty(final String[] strings) { if (strings != null) { for (final String s : strings) { if (StringUtils.isNotEmpty(s)) { return false; } } } return true; }
java
private static boolean deepEmpty(final String[] strings) { if (strings != null) { for (final String s : strings) { if (StringUtils.isNotEmpty(s)) { return false; } } } return true; }
[ "private", "static", "boolean", "deepEmpty", "(", "final", "String", "[", "]", "strings", ")", "{", "if", "(", "strings", "!=", "null", ")", "{", "for", "(", "final", "String", "s", ":", "strings", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty",...
Determines whether or not all the Strings in an array are empty or not. @param strings String[] whose elements are being checked for emptiness @return whether or not the String is empty
[ "Determines", "whether", "or", "not", "all", "the", "Strings", "in", "an", "array", "are", "empty", "or", "not", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/CharSetUtils.java#L250-L259
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
ExtendedMessageFormat.readArgumentIndex
private int readArgumentIndex(final String pattern, final ParsePosition pos) { final int start = pos.getIndex(); seekNonWs(pattern, pos); final StringBuilder result = new StringBuilder(); boolean error = false; for (; !error && pos.getIndex() < pattern.length(); next(pos)) { char c = pattern.charAt(pos.getIndex()); if (Character.isWhitespace(c)) { seekNonWs(pattern, pos); c = pattern.charAt(pos.getIndex()); if (c != START_FMT && c != END_FE) { error = true; continue; } } if ((c == START_FMT || c == END_FE) && result.length() > 0) { try { return Integer.parseInt(result.toString()); } catch (final NumberFormatException e) { // NOPMD // we've already ensured only digits, so unless something // outlandishly large was specified we should be okay. } } error = !Character.isDigit(c); result.append(c); } if (error) { throw new IllegalArgumentException( "Invalid format argument index at position " + start + ": " + pattern.substring(start, pos.getIndex())); } throw new IllegalArgumentException( "Unterminated format element at position " + start); }
java
private int readArgumentIndex(final String pattern, final ParsePosition pos) { final int start = pos.getIndex(); seekNonWs(pattern, pos); final StringBuilder result = new StringBuilder(); boolean error = false; for (; !error && pos.getIndex() < pattern.length(); next(pos)) { char c = pattern.charAt(pos.getIndex()); if (Character.isWhitespace(c)) { seekNonWs(pattern, pos); c = pattern.charAt(pos.getIndex()); if (c != START_FMT && c != END_FE) { error = true; continue; } } if ((c == START_FMT || c == END_FE) && result.length() > 0) { try { return Integer.parseInt(result.toString()); } catch (final NumberFormatException e) { // NOPMD // we've already ensured only digits, so unless something // outlandishly large was specified we should be okay. } } error = !Character.isDigit(c); result.append(c); } if (error) { throw new IllegalArgumentException( "Invalid format argument index at position " + start + ": " + pattern.substring(start, pos.getIndex())); } throw new IllegalArgumentException( "Unterminated format element at position " + start); }
[ "private", "int", "readArgumentIndex", "(", "final", "String", "pattern", ",", "final", "ParsePosition", "pos", ")", "{", "final", "int", "start", "=", "pos", ".", "getIndex", "(", ")", ";", "seekNonWs", "(", "pattern", ",", "pos", ")", ";", "final", "St...
Read the argument index from the current format element @param pattern pattern to parse @param pos current parse position @return argument index
[ "Read", "the", "argument", "index", "from", "the", "current", "format", "element" ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java#L330-L363
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
ExtendedMessageFormat.parseFormatDescription
private String parseFormatDescription(final String pattern, final ParsePosition pos) { final int start = pos.getIndex(); seekNonWs(pattern, pos); final int text = pos.getIndex(); int depth = 1; for (; pos.getIndex() < pattern.length(); next(pos)) { switch (pattern.charAt(pos.getIndex())) { case START_FE: depth++; break; case END_FE: depth--; if (depth == 0) { return pattern.substring(text, pos.getIndex()); } break; case QUOTE: getQuotedString(pattern, pos); break; default: break; } } throw new IllegalArgumentException( "Unterminated format element at position " + start); }
java
private String parseFormatDescription(final String pattern, final ParsePosition pos) { final int start = pos.getIndex(); seekNonWs(pattern, pos); final int text = pos.getIndex(); int depth = 1; for (; pos.getIndex() < pattern.length(); next(pos)) { switch (pattern.charAt(pos.getIndex())) { case START_FE: depth++; break; case END_FE: depth--; if (depth == 0) { return pattern.substring(text, pos.getIndex()); } break; case QUOTE: getQuotedString(pattern, pos); break; default: break; } } throw new IllegalArgumentException( "Unterminated format element at position " + start); }
[ "private", "String", "parseFormatDescription", "(", "final", "String", "pattern", ",", "final", "ParsePosition", "pos", ")", "{", "final", "int", "start", "=", "pos", ".", "getIndex", "(", ")", ";", "seekNonWs", "(", "pattern", ",", "pos", ")", ";", "final...
Parse the format component of a format element. @param pattern string to parse @param pos current parse position @return Format description String
[ "Parse", "the", "format", "component", "of", "a", "format", "element", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java#L372-L397
train
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java
ExtendedMessageFormat.containsElements
private boolean containsElements(final Collection<?> coll) { if (coll == null || coll.isEmpty()) { return false; } for (final Object name : coll) { if (name != null) { return true; } } return false; }
java
private boolean containsElements(final Collection<?> coll) { if (coll == null || coll.isEmpty()) { return false; } for (final Object name : coll) { if (name != null) { return true; } } return false; }
[ "private", "boolean", "containsElements", "(", "final", "Collection", "<", "?", ">", "coll", ")", "{", "if", "(", "coll", "==", "null", "||", "coll", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "final", "Object", "nam...
Learn whether the specified Collection contains non-null elements. @param coll to check @return <code>true</code> if some Object was found, <code>false</code> otherwise.
[ "Learn", "whether", "the", "specified", "Collection", "contains", "non", "-", "null", "elements", "." ]
9e2dfbbda3668cfa5d935fe76479d1426c294504
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java#L521-L531
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushTile
public WnsNotificationResponse pushTile(String channelUri, WnsTile tile) throws WnsException { return this.pushTile(channelUri, null, tile); }
java
public WnsNotificationResponse pushTile(String channelUri, WnsTile tile) throws WnsException { return this.pushTile(channelUri, null, tile); }
[ "public", "WnsNotificationResponse", "pushTile", "(", "String", "channelUri", ",", "WnsTile", "tile", ")", "throws", "WnsException", "{", "return", "this", ".", "pushTile", "(", "channelUri", ",", "null", ",", "tile", ")", ";", "}" ]
Pushes a tile to channelUri @param channelUri @param tile which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsTileBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response"</a> @throws WnsException when authentication fails
[ "Pushes", "a", "tile", "to", "channelUri" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L76-L78
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushTile
public WnsNotificationResponse pushTile(String channelUri, WnsNotificationRequestOptional optional, WnsTile tile) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, tile, this.retryPolicy, optional); }
java
public WnsNotificationResponse pushTile(String channelUri, WnsNotificationRequestOptional optional, WnsTile tile) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, tile, this.retryPolicy, optional); }
[ "public", "WnsNotificationResponse", "pushTile", "(", "String", "channelUri", ",", "WnsNotificationRequestOptional", "optional", ",", "WnsTile", "tile", ")", "throws", "WnsException", "{", "return", "this", ".", "client", ".", "push", "(", "xmlResourceBuilder", ",", ...
Pushes a tile to channelUri using optional headers @param channelUri @param optional @param tile which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsTileBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "tile", "to", "channelUri", "using", "optional", "headers" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L88-L90
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushTile
public List<WnsNotificationResponse> pushTile(List<String> channelUris, WnsTile tile) throws WnsException { return this.pushTile(channelUris, null, tile); }
java
public List<WnsNotificationResponse> pushTile(List<String> channelUris, WnsTile tile) throws WnsException { return this.pushTile(channelUris, null, tile); }
[ "public", "List", "<", "WnsNotificationResponse", ">", "pushTile", "(", "List", "<", "String", ">", "channelUris", ",", "WnsTile", "tile", ")", "throws", "WnsException", "{", "return", "this", ".", "pushTile", "(", "channelUris", ",", "null", ",", "tile", ")...
Pushes a tile to channelUris @param channelUris @param tile which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsTileBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "tile", "to", "channelUris" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L99-L101
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushToast
public WnsNotificationResponse pushToast(String channelUri, WnsToast toast) throws WnsException { return this.pushToast(channelUri, null, toast); }
java
public WnsNotificationResponse pushToast(String channelUri, WnsToast toast) throws WnsException { return this.pushToast(channelUri, null, toast); }
[ "public", "WnsNotificationResponse", "pushToast", "(", "String", "channelUri", ",", "WnsToast", "toast", ")", "throws", "WnsException", "{", "return", "this", ".", "pushToast", "(", "channelUri", ",", "null", ",", "toast", ")", ";", "}" ]
Pushes a toast to channelUri @param channelUri @param toast which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsToastBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "toast", "to", "channelUri" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L122-L124
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushToast
public WnsNotificationResponse pushToast(String channelUri, WnsNotificationRequestOptional optional, WnsToast toast) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, toast, this.retryPolicy, optional); }
java
public WnsNotificationResponse pushToast(String channelUri, WnsNotificationRequestOptional optional, WnsToast toast) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, toast, this.retryPolicy, optional); }
[ "public", "WnsNotificationResponse", "pushToast", "(", "String", "channelUri", ",", "WnsNotificationRequestOptional", "optional", ",", "WnsToast", "toast", ")", "throws", "WnsException", "{", "return", "this", ".", "client", ".", "push", "(", "xmlResourceBuilder", ","...
Pushes a toast to channelUri using optional headers @param channelUri @param optional @param toast which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsToastBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "toast", "to", "channelUri", "using", "optional", "headers" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L134-L136
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushToast
public List<WnsNotificationResponse> pushToast(List<String> channelUris, WnsToast toast) throws WnsException { return this.pushToast(channelUris, null, toast); }
java
public List<WnsNotificationResponse> pushToast(List<String> channelUris, WnsToast toast) throws WnsException { return this.pushToast(channelUris, null, toast); }
[ "public", "List", "<", "WnsNotificationResponse", ">", "pushToast", "(", "List", "<", "String", ">", "channelUris", ",", "WnsToast", "toast", ")", "throws", "WnsException", "{", "return", "this", ".", "pushToast", "(", "channelUris", ",", "null", ",", "toast",...
Pushes a toast to channelUris @param channelUris @param toast which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsToastBuilder} @return list of WnsNotificationResponse for each channelUri, please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "toast", "to", "channelUris" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L145-L147
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushBadge
public WnsNotificationResponse pushBadge(String channelUri, WnsNotificationRequestOptional optional, WnsBadge badge) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, badge, this.retryPolicy, optional); }
java
public WnsNotificationResponse pushBadge(String channelUri, WnsNotificationRequestOptional optional, WnsBadge badge) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, badge, this.retryPolicy, optional); }
[ "public", "WnsNotificationResponse", "pushBadge", "(", "String", "channelUri", ",", "WnsNotificationRequestOptional", "optional", ",", "WnsBadge", "badge", ")", "throws", "WnsException", "{", "return", "this", ".", "client", ".", "push", "(", "xmlResourceBuilder", ","...
Pushes a badge to channelUri using optional headers @param channelUri @param optional @param badge which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsBadgeBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "badge", "to", "channelUri", "using", "optional", "headers" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L180-L182
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushBadge
public List<WnsNotificationResponse> pushBadge(List<String> channelUris, WnsBadge badge) throws WnsException { return this.pushBadge(channelUris, null, badge); }
java
public List<WnsNotificationResponse> pushBadge(List<String> channelUris, WnsBadge badge) throws WnsException { return this.pushBadge(channelUris, null, badge); }
[ "public", "List", "<", "WnsNotificationResponse", ">", "pushBadge", "(", "List", "<", "String", ">", "channelUris", ",", "WnsBadge", "badge", ")", "throws", "WnsException", "{", "return", "this", ".", "pushBadge", "(", "channelUris", ",", "null", ",", "badge",...
Pushes a badge to channelUris @param channelUris @param badge which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsBadgeBuilder} @return list of WnsNotificationResponse for each channelUri, please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "badge", "to", "channelUris" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L191-L193
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushRaw
public WnsNotificationResponse pushRaw(String channelUri, WnsNotificationRequestOptional optional, WnsRaw raw) throws WnsException { return this.client.push(rawResourceBuilder, channelUri, raw, this.retryPolicy, optional); }
java
public WnsNotificationResponse pushRaw(String channelUri, WnsNotificationRequestOptional optional, WnsRaw raw) throws WnsException { return this.client.push(rawResourceBuilder, channelUri, raw, this.retryPolicy, optional); }
[ "public", "WnsNotificationResponse", "pushRaw", "(", "String", "channelUri", ",", "WnsNotificationRequestOptional", "optional", ",", "WnsRaw", "raw", ")", "throws", "WnsException", "{", "return", "this", ".", "client", ".", "push", "(", "rawResourceBuilder", ",", "c...
Pushes a raw message to channelUri using optional headers @param channelUri @param optional @param raw which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsRawBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "raw", "message", "to", "channelUri", "using", "optional", "headers" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L226-L228
train
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushRaw
public List<WnsNotificationResponse> pushRaw(List<String> channelUris, WnsRaw raw) throws WnsException { return this.pushRaw(channelUris, null, raw); }
java
public List<WnsNotificationResponse> pushRaw(List<String> channelUris, WnsRaw raw) throws WnsException { return this.pushRaw(channelUris, null, raw); }
[ "public", "List", "<", "WnsNotificationResponse", ">", "pushRaw", "(", "List", "<", "String", ">", "channelUris", ",", "WnsRaw", "raw", ")", "throws", "WnsException", "{", "return", "this", ".", "pushRaw", "(", "channelUris", ",", "null", ",", "raw", ")", ...
Pushes a raw message to channelUris @param channelUris @param raw which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsRawBuilder} @return list of WnsNotificationResponse for each channelUri, please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "raw", "message", "to", "channelUris" ]
cd621b9c17d1e706f6284e0913531d834904a90d
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L237-L239
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java
RenderingManager.render
public void render( File outputDirectory, ApplicationTemplate applicationTemplate, File applicationDirectory, Renderer renderer, Map<String,String> options, Map<String,String> typeAnnotations ) throws IOException { options = fixOptions( options ); buildRenderer( outputDirectory, applicationTemplate, applicationDirectory, renderer, typeAnnotations ).render( options ); }
java
public void render( File outputDirectory, ApplicationTemplate applicationTemplate, File applicationDirectory, Renderer renderer, Map<String,String> options, Map<String,String> typeAnnotations ) throws IOException { options = fixOptions( options ); buildRenderer( outputDirectory, applicationTemplate, applicationDirectory, renderer, typeAnnotations ).render( options ); }
[ "public", "void", "render", "(", "File", "outputDirectory", ",", "ApplicationTemplate", "applicationTemplate", ",", "File", "applicationDirectory", ",", "Renderer", "renderer", ",", "Map", "<", "String", ",", "String", ">", "options", ",", "Map", "<", "String", ...
Renders a Roboconf application into a given format. @param outputDirectory the directory into which the documentation must be generated @param applicationTemplate an application template @param applicationDirectory the application's directory @param renderer a renderer @param options the generation options (can be null) @param typeAnnotations the type annotations (found by the converter - can be null) @throws IOException if something went wrong
[ "Renders", "a", "Roboconf", "application", "into", "a", "given", "format", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java#L87-L98
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java
RenderingManager.buildRenderer
private IRenderer buildRenderer( File outputDirectory, ApplicationTemplate applicationTemplate, File applicationDirectory, Renderer renderer, Map<String,String> typeAnnotations ) { IRenderer result = null; switch( renderer ) { case HTML: result = new HtmlRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case MARKDOWN: result = new MarkdownRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case FOP: result = new FopRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case PDF: result = new PdfRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; default: break; } return result; }
java
private IRenderer buildRenderer( File outputDirectory, ApplicationTemplate applicationTemplate, File applicationDirectory, Renderer renderer, Map<String,String> typeAnnotations ) { IRenderer result = null; switch( renderer ) { case HTML: result = new HtmlRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case MARKDOWN: result = new MarkdownRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case FOP: result = new FopRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; case PDF: result = new PdfRenderer( outputDirectory, applicationTemplate, applicationDirectory, typeAnnotations ); break; default: break; } return result; }
[ "private", "IRenderer", "buildRenderer", "(", "File", "outputDirectory", ",", "ApplicationTemplate", "applicationTemplate", ",", "File", "applicationDirectory", ",", "Renderer", "renderer", ",", "Map", "<", "String", ",", "String", ">", "typeAnnotations", ")", "{", ...
Builds the right renderer. @param outputDirectory @param applicationTemplate @param applicationDirectory @param renderer @param typeAnnotations @return a renderer
[ "Builds", "the", "right", "renderer", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/RenderingManager.java#L178-L208
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/ApplicationDescriptor.java
ApplicationDescriptor.save
public static void save( File f, Application app ) throws IOException { Properties properties = new Properties(); if( ! Utils.isEmptyOrWhitespaces( app.getDisplayName())) properties.setProperty( APPLICATION_NAME, app.getDisplayName()); if( ! Utils.isEmptyOrWhitespaces( app.getDescription())) properties.setProperty( APPLICATION_DESCRIPTION, app.getDescription()); if( app.getTemplate() != null ) { if( ! Utils.isEmptyOrWhitespaces( app.getTemplate().getName())) properties.setProperty( APPLICATION_TPL_NAME, app.getTemplate().getName()); if( ! Utils.isEmptyOrWhitespaces( app.getTemplate().getVersion())) properties.setProperty( APPLICATION_TPL_VERSION, app.getTemplate().getVersion()); } Utils.writePropertiesFile( properties, f ); }
java
public static void save( File f, Application app ) throws IOException { Properties properties = new Properties(); if( ! Utils.isEmptyOrWhitespaces( app.getDisplayName())) properties.setProperty( APPLICATION_NAME, app.getDisplayName()); if( ! Utils.isEmptyOrWhitespaces( app.getDescription())) properties.setProperty( APPLICATION_DESCRIPTION, app.getDescription()); if( app.getTemplate() != null ) { if( ! Utils.isEmptyOrWhitespaces( app.getTemplate().getName())) properties.setProperty( APPLICATION_TPL_NAME, app.getTemplate().getName()); if( ! Utils.isEmptyOrWhitespaces( app.getTemplate().getVersion())) properties.setProperty( APPLICATION_TPL_VERSION, app.getTemplate().getVersion()); } Utils.writePropertiesFile( properties, f ); }
[ "public", "static", "void", "save", "(", "File", "f", ",", "Application", "app", ")", "throws", "IOException", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "if", "(", "!", "Utils", ".", "isEmptyOrWhitespaces", "(", "app", ".", ...
Saves an application descriptor. @param f the file where the properties will be saved @param app an application (not null) @throws IOException if the file could not be written
[ "Saves", "an", "application", "descriptor", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/ApplicationDescriptor.java#L141-L159
train
stephanrauh/AngularFaces
AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/PuiAngularTransformer.java
PuiAngularTransformer.addResourceAfterAngularJS
public static void addResourceAfterAngularJS(String library, String resource) { FacesContext ctx = FacesContext.getCurrentInstance(); UIViewRoot v = ctx.getViewRoot(); Map<String, Object> viewMap = v.getViewMap(); @SuppressWarnings("unchecked") Map<String, String> resourceMap = (Map<String, String>) viewMap.get(RESOURCE_KEY); if (null == resourceMap) { resourceMap = new HashMap<String, String>(); viewMap.put(RESOURCE_KEY, resourceMap); } String key = library + "#" + resource; if (!resourceMap.containsKey(key)) { resourceMap.put(key, resource); } }
java
public static void addResourceAfterAngularJS(String library, String resource) { FacesContext ctx = FacesContext.getCurrentInstance(); UIViewRoot v = ctx.getViewRoot(); Map<String, Object> viewMap = v.getViewMap(); @SuppressWarnings("unchecked") Map<String, String> resourceMap = (Map<String, String>) viewMap.get(RESOURCE_KEY); if (null == resourceMap) { resourceMap = new HashMap<String, String>(); viewMap.put(RESOURCE_KEY, resourceMap); } String key = library + "#" + resource; if (!resourceMap.containsKey(key)) { resourceMap.put(key, resource); } }
[ "public", "static", "void", "addResourceAfterAngularJS", "(", "String", "library", ",", "String", "resource", ")", "{", "FacesContext", "ctx", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ";", "UIViewRoot", "v", "=", "ctx", ".", "getViewRoot", "(", ...
Registers a JS file that needs to be include in the header of the HTML file, but after jQuery and AngularJS. @param library The name of the sub-folder of the resources folder. @param resource The name of the resource file within the library folder.
[ "Registers", "a", "JS", "file", "that", "needs", "to", "be", "include", "in", "the", "header", "of", "the", "HTML", "file", "but", "after", "jQuery", "and", "AngularJS", "." ]
43d915f004645b1bbbf2625214294dab0858ba01
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/PuiAngularTransformer.java#L328-L342
train
roboconf/roboconf-platform
core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/helpers/InstanceFilter.java
InstanceFilter.apply
public Collection<InstanceContextBean> apply( Collection<InstanceContextBean> instances ) { final ArrayList<InstanceContextBean> result = new ArrayList<InstanceContextBean> (); for( InstanceContextBean instance : instances ) { boolean installerMatches = this.installerName == null || this.installerName.equalsIgnoreCase( instance.getInstaller()); if( installerMatches && this.rootNode.isMatching( instance )) result.add( instance ); } result.trimToSize(); return Collections.unmodifiableCollection(result); }
java
public Collection<InstanceContextBean> apply( Collection<InstanceContextBean> instances ) { final ArrayList<InstanceContextBean> result = new ArrayList<InstanceContextBean> (); for( InstanceContextBean instance : instances ) { boolean installerMatches = this.installerName == null || this.installerName.equalsIgnoreCase( instance.getInstaller()); if( installerMatches && this.rootNode.isMatching( instance )) result.add( instance ); } result.trimToSize(); return Collections.unmodifiableCollection(result); }
[ "public", "Collection", "<", "InstanceContextBean", ">", "apply", "(", "Collection", "<", "InstanceContextBean", ">", "instances", ")", "{", "final", "ArrayList", "<", "InstanceContextBean", ">", "result", "=", "new", "ArrayList", "<", "InstanceContextBean", ">", ...
Applies this filter to the given instances. @param instances the collection of instances to which this filter has to be applied. @return the instances of the provided collection that matches this filter.
[ "Applies", "this", "filter", "to", "the", "given", "instances", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/helpers/InstanceFilter.java#L98-L109
train
roboconf/roboconf-platform
core/roboconf-target-embedded/src/main/java/net/roboconf/target/embedded/internal/EmbeddedHandler.java
EmbeddedHandler.acquireIpAddress
protected String acquireIpAddress( TargetHandlerParameters parameters, String machineId ) { // Load IP addresses on demand (that's the case if we are in this method). // This implementation is compliant with a same IP address being used in // several "target.properties" files. String result = null; String ips = parameters.getTargetProperties().get( IP_ADDRESSES ); ips = ips == null ? "" : ips; for( String ip : Utils.splitNicely( ips, "," )) { if( Utils.isEmptyOrWhitespaces( ip )) continue; if( this.usedIps.putIfAbsent( ip, 1 ) == null ) { this.machineIdToIp.put( machineId, ip ); result = ip; save( this ); break; } } return result; }
java
protected String acquireIpAddress( TargetHandlerParameters parameters, String machineId ) { // Load IP addresses on demand (that's the case if we are in this method). // This implementation is compliant with a same IP address being used in // several "target.properties" files. String result = null; String ips = parameters.getTargetProperties().get( IP_ADDRESSES ); ips = ips == null ? "" : ips; for( String ip : Utils.splitNicely( ips, "," )) { if( Utils.isEmptyOrWhitespaces( ip )) continue; if( this.usedIps.putIfAbsent( ip, 1 ) == null ) { this.machineIdToIp.put( machineId, ip ); result = ip; save( this ); break; } } return result; }
[ "protected", "String", "acquireIpAddress", "(", "TargetHandlerParameters", "parameters", ",", "String", "machineId", ")", "{", "// Load IP addresses on demand (that's the case if we are in this method).", "// This implementation is compliant with a same IP address being used in", "// sever...
Acquires an IP address among available ones. @param parameters the target parameters @param machineId the machine ID @return The acquired IP address
[ "Acquires", "an", "IP", "address", "among", "available", "ones", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-embedded/src/main/java/net/roboconf/target/embedded/internal/EmbeddedHandler.java#L208-L229
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/RandomMngrImpl.java
RandomMngrImpl.findAgentContext
private InstanceContext findAgentContext( Application application, Instance instance ) { Instance scopedInstance = InstanceHelpers.findScopedInstance( instance ); return new InstanceContext( application, scopedInstance ); }
java
private InstanceContext findAgentContext( Application application, Instance instance ) { Instance scopedInstance = InstanceHelpers.findScopedInstance( instance ); return new InstanceContext( application, scopedInstance ); }
[ "private", "InstanceContext", "findAgentContext", "(", "Application", "application", ",", "Instance", "instance", ")", "{", "Instance", "scopedInstance", "=", "InstanceHelpers", ".", "findScopedInstance", "(", "instance", ")", ";", "return", "new", "InstanceContext", ...
Builds an instance context corresponding to an agent. @param application an application @param instance an instance @return an instance context made up of the application and the right scoped instance
[ "Builds", "an", "instance", "context", "corresponding", "to", "an", "agent", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/RandomMngrImpl.java#L306-L310
train
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/utils/SerializationUtils.java
SerializationUtils.serializeObject
public static <T extends Serializable> byte[] serializeObject( T object ) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream( os ); out.writeObject( object ); return os.toByteArray(); }
java
public static <T extends Serializable> byte[] serializeObject( T object ) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream( os ); out.writeObject( object ); return os.toByteArray(); }
[ "public", "static", "<", "T", "extends", "Serializable", ">", "byte", "[", "]", "serializeObject", "(", "T", "object", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "os", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ObjectOutputStream", "ou...
Serializes an object. @param object a serializable object @return a non-null array of bytes @throws IOException
[ "Serializes", "an", "object", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/utils/SerializationUtils.java#L56-L63
train
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/utils/SerializationUtils.java
SerializationUtils.deserializeObject
public static <T extends Serializable> T deserializeObject( byte[] bytes, Class<T> clazz ) throws IOException, ClassNotFoundException { ByteArrayInputStream is = new ByteArrayInputStream( bytes ); ObjectInputStream deserializer = new ObjectInputStream( is ); return clazz.cast( deserializer.readObject()); }
java
public static <T extends Serializable> T deserializeObject( byte[] bytes, Class<T> clazz ) throws IOException, ClassNotFoundException { ByteArrayInputStream is = new ByteArrayInputStream( bytes ); ObjectInputStream deserializer = new ObjectInputStream( is ); return clazz.cast( deserializer.readObject()); }
[ "public", "static", "<", "T", "extends", "Serializable", ">", "T", "deserializeObject", "(", "byte", "[", "]", "bytes", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "ByteArrayInputStream", "is", "=", ...
Deserializes an object. @param bytes a non-null array of bytes @param clazz the class of the expected object @return the deserialized object, or null if it failed @throws IOException @throws ClassNotFoundException
[ "Deserializes", "an", "object", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/utils/SerializationUtils.java#L74-L80
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/ApplicationMngrImpl.java
ApplicationMngrImpl.checkErrors
static void checkErrors( Collection<RoboconfError> errors, Logger logger ) throws InvalidApplicationException { if( RoboconfErrorHelpers.containsCriticalErrors( errors )) throw new InvalidApplicationException( errors ); // Null language => English (right language for logs) Collection<RoboconfError> warnings = RoboconfErrorHelpers.findWarnings( errors ); for( String warningMsg : RoboconfErrorHelpers.formatErrors( warnings, null, true ).values()) logger.warning( warningMsg ); }
java
static void checkErrors( Collection<RoboconfError> errors, Logger logger ) throws InvalidApplicationException { if( RoboconfErrorHelpers.containsCriticalErrors( errors )) throw new InvalidApplicationException( errors ); // Null language => English (right language for logs) Collection<RoboconfError> warnings = RoboconfErrorHelpers.findWarnings( errors ); for( String warningMsg : RoboconfErrorHelpers.formatErrors( warnings, null, true ).values()) logger.warning( warningMsg ); }
[ "static", "void", "checkErrors", "(", "Collection", "<", "RoboconfError", ">", "errors", ",", "Logger", "logger", ")", "throws", "InvalidApplicationException", "{", "if", "(", "RoboconfErrorHelpers", ".", "containsCriticalErrors", "(", "errors", ")", ")", "throw", ...
A method to check errors. @param errors a non-null list of errors @param logger a logger @throws InvalidApplicationException if there are critical errors
[ "A", "method", "to", "check", "errors", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/ApplicationMngrImpl.java#L336-L346
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/ApplicationMngrImpl.java
ApplicationMngrImpl.createNewApplication
private ManagedApplication createNewApplication( String name, String description, ApplicationTemplate tpl, File configurationDirectory ) throws AlreadyExistingException, IOException { this.logger.info( "Creating application " + name + " from template " + tpl + "..." ); if( Utils.isEmptyOrWhitespaces( name )) throw new IOException( "An application name cannot be empty." ); Application app = new Application( name, tpl ).description( description ); if( ! app.getName().matches( ParsingConstants.PATTERN_APP_NAME )) throw new IOException( "Application names cannot contain invalid characters. Letters, digits, dots, underscores, brackets, spaces and the minus symbol are allowed." ); if( this.nameToManagedApplication.containsKey( name )) throw new AlreadyExistingException( name ); // Create the application's directory File targetDirectory = ConfigurationUtils.findApplicationDirectory( app.getName(), configurationDirectory ); Utils.createDirectory( targetDirectory ); app.setDirectory( targetDirectory ); // Create a descriptor File descFile = new File( targetDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ); Utils.createDirectory( descFile.getParentFile()); ApplicationDescriptor.save( descFile, app ); // Copy all the templates's directories, except the descriptor, graph and instances List<File> tplDirectories = Utils.listDirectories( tpl.getDirectory()); List<String> toSkip = Arrays.asList( Constants.PROJECT_DIR_DESC, Constants.PROJECT_DIR_GRAPH, Constants.PROJECT_DIR_INSTANCES ); for( File dir : tplDirectories ) { if( toSkip.contains( dir.getName().toLowerCase())) continue; File newDir = new File( targetDirectory, dir.getName()); Utils.copyDirectory( dir, newDir ); } // Update the application name in all the root instances for( Instance rootInstance : app.getRootInstances()) rootInstance.data.put( Instance.APPLICATION_NAME, app.getName()); // Read application bindings. // They are not supposed to exist for new applications, but let's be flexible about it. ConfigurationUtils.loadApplicationBindings( app ); // Register the application ManagedApplication ma = new ManagedApplication( app ); this.nameToManagedApplication.put( app.getName(), ma ); // Save the instances! ConfigurationUtils.saveInstances( ma ); this.logger.info( "Application " + name + " was successfully created from the template " + tpl + "." ); return ma; }
java
private ManagedApplication createNewApplication( String name, String description, ApplicationTemplate tpl, File configurationDirectory ) throws AlreadyExistingException, IOException { this.logger.info( "Creating application " + name + " from template " + tpl + "..." ); if( Utils.isEmptyOrWhitespaces( name )) throw new IOException( "An application name cannot be empty." ); Application app = new Application( name, tpl ).description( description ); if( ! app.getName().matches( ParsingConstants.PATTERN_APP_NAME )) throw new IOException( "Application names cannot contain invalid characters. Letters, digits, dots, underscores, brackets, spaces and the minus symbol are allowed." ); if( this.nameToManagedApplication.containsKey( name )) throw new AlreadyExistingException( name ); // Create the application's directory File targetDirectory = ConfigurationUtils.findApplicationDirectory( app.getName(), configurationDirectory ); Utils.createDirectory( targetDirectory ); app.setDirectory( targetDirectory ); // Create a descriptor File descFile = new File( targetDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ); Utils.createDirectory( descFile.getParentFile()); ApplicationDescriptor.save( descFile, app ); // Copy all the templates's directories, except the descriptor, graph and instances List<File> tplDirectories = Utils.listDirectories( tpl.getDirectory()); List<String> toSkip = Arrays.asList( Constants.PROJECT_DIR_DESC, Constants.PROJECT_DIR_GRAPH, Constants.PROJECT_DIR_INSTANCES ); for( File dir : tplDirectories ) { if( toSkip.contains( dir.getName().toLowerCase())) continue; File newDir = new File( targetDirectory, dir.getName()); Utils.copyDirectory( dir, newDir ); } // Update the application name in all the root instances for( Instance rootInstance : app.getRootInstances()) rootInstance.data.put( Instance.APPLICATION_NAME, app.getName()); // Read application bindings. // They are not supposed to exist for new applications, but let's be flexible about it. ConfigurationUtils.loadApplicationBindings( app ); // Register the application ManagedApplication ma = new ManagedApplication( app ); this.nameToManagedApplication.put( app.getName(), ma ); // Save the instances! ConfigurationUtils.saveInstances( ma ); this.logger.info( "Application " + name + " was successfully created from the template " + tpl + "." ); return ma; }
[ "private", "ManagedApplication", "createNewApplication", "(", "String", "name", ",", "String", "description", ",", "ApplicationTemplate", "tpl", ",", "File", "configurationDirectory", ")", "throws", "AlreadyExistingException", ",", "IOException", "{", "this", ".", "logg...
Creates a new application from a template. @param name the application's name @param description the application's description @param tpl the application's template @param configurationDirectory the DM's configuration directory @return a new managed application @throws AlreadyExistingException if an application with this name already exists @throws IOException if the application's directory could not be created
[ "Creates", "a", "new", "application", "from", "a", "template", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/ApplicationMngrImpl.java#L359-L415
train
roboconf/roboconf-platform
core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/internal/resources/impl/ManagementResource.java
ManagementResource.getFileExtension
private static String getFileExtension(final String filename) { String extension = ""; int i = filename.lastIndexOf('.'); int p = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\')); if (i > p) extension = filename.substring(i+1); return extension; }
java
private static String getFileExtension(final String filename) { String extension = ""; int i = filename.lastIndexOf('.'); int p = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\')); if (i > p) extension = filename.substring(i+1); return extension; }
[ "private", "static", "String", "getFileExtension", "(", "final", "String", "filename", ")", "{", "String", "extension", "=", "\"\"", ";", "int", "i", "=", "filename", ".", "lastIndexOf", "(", "'", "'", ")", ";", "int", "p", "=", "Math", ".", "max", "("...
Get the file name extension from its name. @param filename the filename. @return the file name extension.
[ "Get", "the", "file", "name", "extension", "from", "its", "name", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/internal/resources/impl/ManagementResource.java#L596-L605
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java
RuntimeModelIo.loadGraph
public static Graphs loadGraph( File graphFile, File graphDirectory, ApplicationLoadResult alr ) { FromGraphDefinition fromDef = new FromGraphDefinition( graphDirectory ); Graphs graph = fromDef.buildGraphs( graphFile ); alr.getParsedFiles().addAll( fromDef.getProcessedImports()); if( ! fromDef.getErrors().isEmpty()) { alr.loadErrors.addAll( fromDef.getErrors()); } else { Collection<ModelError> errors = RuntimeModelValidator.validate( graph ); alr.loadErrors.addAll( errors ); errors = RuntimeModelValidator.validate( graph, graphDirectory.getParentFile()); alr.loadErrors.addAll( errors ); alr.objectToSource.putAll( fromDef.getObjectToSource()); alr.typeAnnotations.putAll( fromDef.getTypeAnnotations()); } return graph; }
java
public static Graphs loadGraph( File graphFile, File graphDirectory, ApplicationLoadResult alr ) { FromGraphDefinition fromDef = new FromGraphDefinition( graphDirectory ); Graphs graph = fromDef.buildGraphs( graphFile ); alr.getParsedFiles().addAll( fromDef.getProcessedImports()); if( ! fromDef.getErrors().isEmpty()) { alr.loadErrors.addAll( fromDef.getErrors()); } else { Collection<ModelError> errors = RuntimeModelValidator.validate( graph ); alr.loadErrors.addAll( errors ); errors = RuntimeModelValidator.validate( graph, graphDirectory.getParentFile()); alr.loadErrors.addAll( errors ); alr.objectToSource.putAll( fromDef.getObjectToSource()); alr.typeAnnotations.putAll( fromDef.getTypeAnnotations()); } return graph; }
[ "public", "static", "Graphs", "loadGraph", "(", "File", "graphFile", ",", "File", "graphDirectory", ",", "ApplicationLoadResult", "alr", ")", "{", "FromGraphDefinition", "fromDef", "=", "new", "FromGraphDefinition", "(", "graphDirectory", ")", ";", "Graphs", "graph"...
Loads a graph file. @param graphFile the graph file @param graphDirectory the graph directory @param alr the application's load result to complete @return the built graph (might be null)
[ "Loads", "a", "graph", "file", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L415-L435
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java
RuntimeModelIo.loadInstances
public static InstancesLoadResult loadInstances( File instancesFile, File rootDirectory, Graphs graph, String applicationName ) { InstancesLoadResult result = new InstancesLoadResult(); INST: { if( ! instancesFile.exists()) { RoboconfError error = new RoboconfError( ErrorCode.PROJ_MISSING_INSTANCE_EP ); error.setDetails( expected( instancesFile.getAbsolutePath())); result.loadErrors.add( error ); break INST; } FromInstanceDefinition fromDef = new FromInstanceDefinition( rootDirectory ); Collection<Instance> instances = fromDef.buildInstances( graph, instancesFile ); result.getParsedFiles().addAll( fromDef.getProcessedImports()); if( ! fromDef.getErrors().isEmpty()) { result.loadErrors.addAll( fromDef.getErrors()); break INST; } Collection<ModelError> errors = RuntimeModelValidator.validate( instances ); result.loadErrors.addAll( errors ); result.objectToSource.putAll( fromDef.getObjectToSource()); result.getRootInstances().addAll( instances ); } for( Instance rootInstance : result.rootInstances ) rootInstance.data.put( Instance.APPLICATION_NAME, applicationName ); return result; }
java
public static InstancesLoadResult loadInstances( File instancesFile, File rootDirectory, Graphs graph, String applicationName ) { InstancesLoadResult result = new InstancesLoadResult(); INST: { if( ! instancesFile.exists()) { RoboconfError error = new RoboconfError( ErrorCode.PROJ_MISSING_INSTANCE_EP ); error.setDetails( expected( instancesFile.getAbsolutePath())); result.loadErrors.add( error ); break INST; } FromInstanceDefinition fromDef = new FromInstanceDefinition( rootDirectory ); Collection<Instance> instances = fromDef.buildInstances( graph, instancesFile ); result.getParsedFiles().addAll( fromDef.getProcessedImports()); if( ! fromDef.getErrors().isEmpty()) { result.loadErrors.addAll( fromDef.getErrors()); break INST; } Collection<ModelError> errors = RuntimeModelValidator.validate( instances ); result.loadErrors.addAll( errors ); result.objectToSource.putAll( fromDef.getObjectToSource()); result.getRootInstances().addAll( instances ); } for( Instance rootInstance : result.rootInstances ) rootInstance.data.put( Instance.APPLICATION_NAME, applicationName ); return result; }
[ "public", "static", "InstancesLoadResult", "loadInstances", "(", "File", "instancesFile", ",", "File", "rootDirectory", ",", "Graphs", "graph", ",", "String", "applicationName", ")", "{", "InstancesLoadResult", "result", "=", "new", "InstancesLoadResult", "(", ")", ...
Loads instances from a file. @param instancesFile the file definition of the instances (can have imports) @param rootDirectory the root directory that contains instance definitions, used to resolve imports @param graph the graph to use to resolve instances @param applicationName the application name @return a non-null result
[ "Loads", "instances", "from", "a", "file", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L446-L475
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java
RuntimeModelIo.writeInstances
public static void writeInstances( File targetFile, Collection<Instance> rootInstances ) throws IOException { FileDefinition def = new FromInstances().buildFileDefinition( rootInstances, targetFile, false, true ); ParsingModelIo.saveRelationsFile( def, false, "\n" ); }
java
public static void writeInstances( File targetFile, Collection<Instance> rootInstances ) throws IOException { FileDefinition def = new FromInstances().buildFileDefinition( rootInstances, targetFile, false, true ); ParsingModelIo.saveRelationsFile( def, false, "\n" ); }
[ "public", "static", "void", "writeInstances", "(", "File", "targetFile", ",", "Collection", "<", "Instance", ">", "rootInstances", ")", "throws", "IOException", "{", "FileDefinition", "def", "=", "new", "FromInstances", "(", ")", ".", "buildFileDefinition", "(", ...
Writes all the instances into a file. @param targetFile the file to save @param rootInstances the root instances (not null) @throws IOException if something went wrong
[ "Writes", "all", "the", "instances", "into", "a", "file", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L484-L488
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/lifecycle/AbstractLifeCycleManager.java
AbstractLifeCycleManager.build
public static AbstractLifeCycleManager build( Instance instance, String appName, IAgentClient messagingClient ) { AbstractLifeCycleManager result; switch( instance.getStatus()) { case DEPLOYED_STARTED: result = new DeployedStarted( appName, messagingClient ); break; case DEPLOYED_STOPPED: result = new DeployedStopped( appName, messagingClient ); break; case NOT_DEPLOYED: result = new NotDeployed( appName, messagingClient ); break; case UNRESOLVED: result = new Unresolved( appName, messagingClient ); break; case WAITING_FOR_ANCESTOR: result = new WaitingForAncestor( appName, messagingClient ); break; default: result = new TransitiveStates( appName, messagingClient ); break; } return result; }
java
public static AbstractLifeCycleManager build( Instance instance, String appName, IAgentClient messagingClient ) { AbstractLifeCycleManager result; switch( instance.getStatus()) { case DEPLOYED_STARTED: result = new DeployedStarted( appName, messagingClient ); break; case DEPLOYED_STOPPED: result = new DeployedStopped( appName, messagingClient ); break; case NOT_DEPLOYED: result = new NotDeployed( appName, messagingClient ); break; case UNRESOLVED: result = new Unresolved( appName, messagingClient ); break; case WAITING_FOR_ANCESTOR: result = new WaitingForAncestor( appName, messagingClient ); break; default: result = new TransitiveStates( appName, messagingClient ); break; } return result; }
[ "public", "static", "AbstractLifeCycleManager", "build", "(", "Instance", "instance", ",", "String", "appName", ",", "IAgentClient", "messagingClient", ")", "{", "AbstractLifeCycleManager", "result", ";", "switch", "(", "instance", ".", "getStatus", "(", ")", ")", ...
Builds the right handler depending on the current instance's state. @param instance an instance @param appName the application name @param messagingClient the messaging client @return a non-null manager to update the instance's life cycle
[ "Builds", "the", "right", "handler", "depending", "on", "the", "current", "instance", "s", "state", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/lifecycle/AbstractLifeCycleManager.java#L83-L113
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/lifecycle/AbstractLifeCycleManager.java
AbstractLifeCycleManager.updateStateFromImports
public void updateStateFromImports( Instance impactedInstance, PluginInterface plugin, Import importChanged, InstanceStatus statusChanged ) throws IOException, PluginException { // Do we have all the imports we need? boolean haveAllImports = ImportHelpers.hasAllRequiredImports( impactedInstance, this.logger ); // Update the life cycle of this instance if necessary // Maybe we have something to start if( haveAllImports ) { if( impactedInstance.getStatus() == InstanceStatus.UNRESOLVED || impactedInstance.data.remove( FORCE ) != null ) { InstanceStatus oldState = impactedInstance.getStatus(); impactedInstance.setStatus( InstanceStatus.STARTING ); try { this.messagingClient.sendMessageToTheDm( new MsgNotifInstanceChanged( this.appName, impactedInstance )); plugin.start( impactedInstance ); impactedInstance.setStatus( InstanceStatus.DEPLOYED_STARTED ); this.messagingClient.sendMessageToTheDm( new MsgNotifInstanceChanged( this.appName, impactedInstance )); this.messagingClient.publishExports( impactedInstance ); this.messagingClient.listenToRequestsFromOtherAgents( ListenerCommand.START, impactedInstance ); } catch( Exception e ) { this.logger.severe( "An error occured while starting " + InstanceHelpers.computeInstancePath( impactedInstance )); Utils.logException( this.logger, e ); impactedInstance.setStatus( oldState ); this.messagingClient.sendMessageToTheDm( new MsgNotifInstanceChanged( this.appName, impactedInstance )); } } else if( impactedInstance.getStatus() == InstanceStatus.DEPLOYED_STARTED ) { plugin.update( impactedInstance, importChanged, statusChanged ); } else { this.logger.fine( InstanceHelpers.computeInstancePath( impactedInstance ) + " checked import changes but has nothing to update (1)." ); } } // Or maybe we have something to stop else { if( impactedInstance.getStatus() == InstanceStatus.DEPLOYED_STARTED ) { stopInstance( impactedInstance, plugin, true ); } else { this.logger.fine( InstanceHelpers.computeInstancePath( impactedInstance ) + " checked import changes but has nothing to update (2)." ); } } }
java
public void updateStateFromImports( Instance impactedInstance, PluginInterface plugin, Import importChanged, InstanceStatus statusChanged ) throws IOException, PluginException { // Do we have all the imports we need? boolean haveAllImports = ImportHelpers.hasAllRequiredImports( impactedInstance, this.logger ); // Update the life cycle of this instance if necessary // Maybe we have something to start if( haveAllImports ) { if( impactedInstance.getStatus() == InstanceStatus.UNRESOLVED || impactedInstance.data.remove( FORCE ) != null ) { InstanceStatus oldState = impactedInstance.getStatus(); impactedInstance.setStatus( InstanceStatus.STARTING ); try { this.messagingClient.sendMessageToTheDm( new MsgNotifInstanceChanged( this.appName, impactedInstance )); plugin.start( impactedInstance ); impactedInstance.setStatus( InstanceStatus.DEPLOYED_STARTED ); this.messagingClient.sendMessageToTheDm( new MsgNotifInstanceChanged( this.appName, impactedInstance )); this.messagingClient.publishExports( impactedInstance ); this.messagingClient.listenToRequestsFromOtherAgents( ListenerCommand.START, impactedInstance ); } catch( Exception e ) { this.logger.severe( "An error occured while starting " + InstanceHelpers.computeInstancePath( impactedInstance )); Utils.logException( this.logger, e ); impactedInstance.setStatus( oldState ); this.messagingClient.sendMessageToTheDm( new MsgNotifInstanceChanged( this.appName, impactedInstance )); } } else if( impactedInstance.getStatus() == InstanceStatus.DEPLOYED_STARTED ) { plugin.update( impactedInstance, importChanged, statusChanged ); } else { this.logger.fine( InstanceHelpers.computeInstancePath( impactedInstance ) + " checked import changes but has nothing to update (1)." ); } } // Or maybe we have something to stop else { if( impactedInstance.getStatus() == InstanceStatus.DEPLOYED_STARTED ) { stopInstance( impactedInstance, plugin, true ); } else { this.logger.fine( InstanceHelpers.computeInstancePath( impactedInstance ) + " checked import changes but has nothing to update (2)." ); } } }
[ "public", "void", "updateStateFromImports", "(", "Instance", "impactedInstance", ",", "PluginInterface", "plugin", ",", "Import", "importChanged", ",", "InstanceStatus", "statusChanged", ")", "throws", "IOException", ",", "PluginException", "{", "// Do we have all the impor...
Updates the status of an instance based on the imports. @param impactedInstance the instance whose imports may have changed @param plugin the plug-in to use to apply a concrete modification @param statusChanged The changed status of the instance that changed (e.g. that provided new imports) @param importChanged The individual imports that changed
[ "Updates", "the", "status", "of", "an", "instance", "based", "on", "the", "imports", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/lifecycle/AbstractLifeCycleManager.java#L138-L185
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.copyInstanceResources
public static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent ) throws IOException { File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance ); Utils.createDirectory( dir ); if( fileNameToFileContent != null ) { for( Map.Entry<String,byte[]> entry : fileNameToFileContent.entrySet()) { File f = new File( dir, entry.getKey()); Utils.createDirectory( f.getParentFile()); ByteArrayInputStream in = new ByteArrayInputStream( entry.getValue()); Utils.copyStream( in, f ); } } }
java
public static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent ) throws IOException { File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance ); Utils.createDirectory( dir ); if( fileNameToFileContent != null ) { for( Map.Entry<String,byte[]> entry : fileNameToFileContent.entrySet()) { File f = new File( dir, entry.getKey()); Utils.createDirectory( f.getParentFile()); ByteArrayInputStream in = new ByteArrayInputStream( entry.getValue()); Utils.copyStream( in, f ); } } }
[ "public", "static", "void", "copyInstanceResources", "(", "Instance", "instance", ",", "Map", "<", "String", ",", "byte", "[", "]", ">", "fileNameToFileContent", ")", "throws", "IOException", "{", "File", "dir", "=", "InstanceHelpers", ".", "findInstanceDirectoryO...
Copies the resources of an instance on the disk. @param instance an instance @param fileNameToFileContent the files to write down (key = relative file location, value = file's content) @throws IOException if the copy encountered a problem
[ "Copies", "the", "resources", "of", "an", "instance", "on", "the", "disk", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L103-L119
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.executeScriptResources
public static void executeScriptResources( File scriptsDir ) throws IOException { if( scriptsDir.isDirectory()) { List<File> scriptFiles = Utils.listAllFiles( scriptsDir ); Logger logger = Logger.getLogger( AgentUtils.class.getName()); for( File script : scriptFiles) { if( script.getName().contains( Constants.SCOPED_SCRIPT_AT_AGENT_SUFFIX )) { script.setExecutable( true ); String[] command = { script.getAbsolutePath()}; try { ProgramUtils.executeCommand( logger, command, script.getParentFile(), null, null, null ); } catch( InterruptedException e ) { Utils.logException( logger, e ); } } } } }
java
public static void executeScriptResources( File scriptsDir ) throws IOException { if( scriptsDir.isDirectory()) { List<File> scriptFiles = Utils.listAllFiles( scriptsDir ); Logger logger = Logger.getLogger( AgentUtils.class.getName()); for( File script : scriptFiles) { if( script.getName().contains( Constants.SCOPED_SCRIPT_AT_AGENT_SUFFIX )) { script.setExecutable( true ); String[] command = { script.getAbsolutePath()}; try { ProgramUtils.executeCommand( logger, command, script.getParentFile(), null, null, null ); } catch( InterruptedException e ) { Utils.logException( logger, e ); } } } } }
[ "public", "static", "void", "executeScriptResources", "(", "File", "scriptsDir", ")", "throws", "IOException", "{", "if", "(", "scriptsDir", ".", "isDirectory", "(", ")", ")", "{", "List", "<", "File", ">", "scriptFiles", "=", "Utils", ".", "listAllFiles", "...
Executes a script resource on a given instance. @param scriptsDir the scripts directory @throws IOException
[ "Executes", "a", "script", "resource", "on", "a", "given", "instance", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L127-L146
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.deleteInstanceResources
public static void deleteInstanceResources( Instance instance ) throws IOException { File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance ); Utils.deleteFilesRecursively( dir ); }
java
public static void deleteInstanceResources( Instance instance ) throws IOException { File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance ); Utils.deleteFilesRecursively( dir ); }
[ "public", "static", "void", "deleteInstanceResources", "(", "Instance", "instance", ")", "throws", "IOException", "{", "File", "dir", "=", "InstanceHelpers", ".", "findInstanceDirectoryOnAgent", "(", "instance", ")", ";", "Utils", ".", "deleteFilesRecursively", "(", ...
Deletes the resources for a given instance. @param instance an instance @throws IOException if resources could not be deleted
[ "Deletes", "the", "resources", "for", "a", "given", "instance", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L154-L157
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.collectLogs
public static Map<String,byte[]> collectLogs( String karafData ) throws IOException { Map<String,byte[]> logFiles = new HashMap<>( 2 ); if( ! Utils.isEmptyOrWhitespaces( karafData )) { String[] names = { "karaf.log", "roboconf.log" }; for( String name : names ) { File log = new File( karafData, AgentConstants.KARAF_LOGS_DIRECTORY + "/" + name ); if( ! log.exists()) continue; String content = Utils.readFileContent( log ); logFiles.put( name, content.getBytes( StandardCharsets.UTF_8 )); } } return logFiles; }
java
public static Map<String,byte[]> collectLogs( String karafData ) throws IOException { Map<String,byte[]> logFiles = new HashMap<>( 2 ); if( ! Utils.isEmptyOrWhitespaces( karafData )) { String[] names = { "karaf.log", "roboconf.log" }; for( String name : names ) { File log = new File( karafData, AgentConstants.KARAF_LOGS_DIRECTORY + "/" + name ); if( ! log.exists()) continue; String content = Utils.readFileContent( log ); logFiles.put( name, content.getBytes( StandardCharsets.UTF_8 )); } } return logFiles; }
[ "public", "static", "Map", "<", "String", ",", "byte", "[", "]", ">", "collectLogs", "(", "String", "karafData", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "byte", "[", "]", ">", "logFiles", "=", "new", "HashMap", "<>", "(", "2", "...
Collect the main log files into a map. @param karafData the Karaf's data directory @return a non-null map
[ "Collect", "the", "main", "log", "files", "into", "a", "map", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L189-L206
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.injectConfigurations
public static void injectConfigurations( String karafEtc, String applicationName, String scopedInstancePath, String domain, String ipAddress ) { File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR ); if( injectionDir.isDirectory()) { for( File source : Utils.listAllFiles( injectionDir, ".cfg.tpl" )) { try { File target = new File( karafEtc, source.getName().replaceFirst( "\\.tpl$", "" )); // Do not overwrite the agent's configuration file (infinite configuration loop) if( Constants.KARAF_CFG_FILE_AGENT.equalsIgnoreCase( target.getName())) continue; String content = Utils.readFileContent( source ); content = content.replace( "<domain>", domain ); content = content.replace( "<application-name>", applicationName ); content = content.replace( "<scoped-instance-path>", scopedInstancePath ); content = content.replace( "<ip-address>", ipAddress ); Utils.writeStringInto( content, target ); } catch( IOException e ) { Logger logger = Logger.getLogger( AgentUtils.class.getName()); logger.severe( "A configuration file could not be injected from " + source.getName()); Utils.logException( logger, e ); } } } }
java
public static void injectConfigurations( String karafEtc, String applicationName, String scopedInstancePath, String domain, String ipAddress ) { File injectionDir = new File( karafEtc, INJECTED_CONFIGS_DIR ); if( injectionDir.isDirectory()) { for( File source : Utils.listAllFiles( injectionDir, ".cfg.tpl" )) { try { File target = new File( karafEtc, source.getName().replaceFirst( "\\.tpl$", "" )); // Do not overwrite the agent's configuration file (infinite configuration loop) if( Constants.KARAF_CFG_FILE_AGENT.equalsIgnoreCase( target.getName())) continue; String content = Utils.readFileContent( source ); content = content.replace( "<domain>", domain ); content = content.replace( "<application-name>", applicationName ); content = content.replace( "<scoped-instance-path>", scopedInstancePath ); content = content.replace( "<ip-address>", ipAddress ); Utils.writeStringInto( content, target ); } catch( IOException e ) { Logger logger = Logger.getLogger( AgentUtils.class.getName()); logger.severe( "A configuration file could not be injected from " + source.getName()); Utils.logException( logger, e ); } } } }
[ "public", "static", "void", "injectConfigurations", "(", "String", "karafEtc", ",", "String", "applicationName", ",", "String", "scopedInstancePath", ",", "String", "domain", ",", "String", "ipAddress", ")", "{", "File", "injectionDir", "=", "new", "File", "(", ...
Generates configuration files from templates. @param karafEtc Karaf's etc directory @param applicationName the application name @param scopedInstancePath the scoped instance path @param domain the domain @param ipAddress the IP address
[ "Generates", "configuration", "files", "from", "templates", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L272-L303
train
stephanrauh/AngularFaces
AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/AngularViewContextWrapper.java
AngularViewContextWrapper.cleanupAfterView
private void cleanupAfterView() { FacesContext ctx = FacesContext.getCurrentInstance(); ResponseWriter orig = (ResponseWriter) ctx.getAttributes().get(ORIGINAL_WRITER); assert(null != orig); // move aside the PartialResponseWriter ctx.setResponseWriter(orig); }
java
private void cleanupAfterView() { FacesContext ctx = FacesContext.getCurrentInstance(); ResponseWriter orig = (ResponseWriter) ctx.getAttributes().get(ORIGINAL_WRITER); assert(null != orig); // move aside the PartialResponseWriter ctx.setResponseWriter(orig); }
[ "private", "void", "cleanupAfterView", "(", ")", "{", "FacesContext", "ctx", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ";", "ResponseWriter", "orig", "=", "(", "ResponseWriter", ")", "ctx", ".", "getAttributes", "(", ")", ".", "get", "(", "OR...
Copied from com.sun.faces.context.PartialViewContextImpl.
[ "Copied", "from", "com", ".", "sun", ".", "faces", ".", "context", ".", "PartialViewContextImpl", "." ]
43d915f004645b1bbbf2625214294dab0858ba01
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/AngularViewContextWrapper.java#L230-L236
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java
ConfigurationUtils.findTemplateDirectory
public static File findTemplateDirectory( ApplicationTemplate tpl, File configurationDirectory ) { StringBuilder sb = new StringBuilder( TEMPLATES ); sb.append( "/" ); sb.append( tpl.getName()); if( ! Utils.isEmptyOrWhitespaces( tpl.getVersion())) { sb.append( " - " ); sb.append( tpl.getVersion()); } return new File( configurationDirectory, sb.toString()); }
java
public static File findTemplateDirectory( ApplicationTemplate tpl, File configurationDirectory ) { StringBuilder sb = new StringBuilder( TEMPLATES ); sb.append( "/" ); sb.append( tpl.getName()); if( ! Utils.isEmptyOrWhitespaces( tpl.getVersion())) { sb.append( " - " ); sb.append( tpl.getVersion()); } return new File( configurationDirectory, sb.toString()); }
[ "public", "static", "File", "findTemplateDirectory", "(", "ApplicationTemplate", "tpl", ",", "File", "configurationDirectory", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "TEMPLATES", ")", ";", "sb", ".", "append", "(", "\"/\"", ")", ";", ...
Finds the directory that contains the files for an application template. @param tpl an application template @param configurationDirectory the DM's configuration directory @return a non-null file that should point to a directory
[ "Finds", "the", "directory", "that", "contains", "the", "files", "for", "an", "application", "template", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java#L87-L98
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java
ConfigurationUtils.saveInstances
public static void saveInstances( Application app ) { File targetFile = new File( app.getDirectory(), Constants.PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE ); try { Utils.createDirectory( targetFile.getParentFile()); RuntimeModelIo.writeInstances( targetFile, app.getRootInstances()); } catch( IOException e ) { Logger logger = Logger.getLogger( ConfigurationUtils.class.getName()); logger.severe( "Failed to save instances. " + e.getMessage()); Utils.logException( logger, e ); } }
java
public static void saveInstances( Application app ) { File targetFile = new File( app.getDirectory(), Constants.PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE ); try { Utils.createDirectory( targetFile.getParentFile()); RuntimeModelIo.writeInstances( targetFile, app.getRootInstances()); } catch( IOException e ) { Logger logger = Logger.getLogger( ConfigurationUtils.class.getName()); logger.severe( "Failed to save instances. " + e.getMessage()); Utils.logException( logger, e ); } }
[ "public", "static", "void", "saveInstances", "(", "Application", "app", ")", "{", "File", "targetFile", "=", "new", "File", "(", "app", ".", "getDirectory", "(", ")", ",", "Constants", ".", "PROJECT_DIR_INSTANCES", "+", "\"/\"", "+", "INSTANCES_FILE", ")", "...
Saves the instances into a file. @param app the application (not null) @param configurationDirectory the configuration directory
[ "Saves", "the", "instances", "into", "a", "file", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java#L115-L127
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java
ConfigurationUtils.restoreInstances
public static InstancesLoadResult restoreInstances( ManagedApplication ma ) { File sourceFile = new File( ma.getDirectory(), Constants.PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE ); Graphs graphs = ma.getApplication().getTemplate().getGraphs(); InstancesLoadResult result; if( sourceFile.exists()) result = RuntimeModelIo.loadInstances( sourceFile, sourceFile.getParentFile(), graphs, ma.getApplication().getName()); else result = new InstancesLoadResult(); return result; }
java
public static InstancesLoadResult restoreInstances( ManagedApplication ma ) { File sourceFile = new File( ma.getDirectory(), Constants.PROJECT_DIR_INSTANCES + "/" + INSTANCES_FILE ); Graphs graphs = ma.getApplication().getTemplate().getGraphs(); InstancesLoadResult result; if( sourceFile.exists()) result = RuntimeModelIo.loadInstances( sourceFile, sourceFile.getParentFile(), graphs, ma.getApplication().getName()); else result = new InstancesLoadResult(); return result; }
[ "public", "static", "InstancesLoadResult", "restoreInstances", "(", "ManagedApplication", "ma", ")", "{", "File", "sourceFile", "=", "new", "File", "(", "ma", ".", "getDirectory", "(", ")", ",", "Constants", ".", "PROJECT_DIR_INSTANCES", "+", "\"/\"", "+", "INST...
Restores instances and set them in the application. @param ma the application @param configurationDirectory the configuration directory
[ "Restores", "instances", "and", "set", "them", "in", "the", "application", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java#L135-L146
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java
ConfigurationUtils.findIcon
public static File findIcon( String name, String qualifier, File configurationDirectory ) { // Deal with an invalid directory if( configurationDirectory == null ) return null; // Find the root directory File root; if( ! Utils.isEmptyOrWhitespaces( qualifier )) { ApplicationTemplate tpl = new ApplicationTemplate( name ).version( qualifier ); root = ConfigurationUtils.findTemplateDirectory( tpl, configurationDirectory ); } else { root = ConfigurationUtils.findApplicationDirectory( name, configurationDirectory ); } // Find an icon in the directory return IconUtils.findIcon( root ); }
java
public static File findIcon( String name, String qualifier, File configurationDirectory ) { // Deal with an invalid directory if( configurationDirectory == null ) return null; // Find the root directory File root; if( ! Utils.isEmptyOrWhitespaces( qualifier )) { ApplicationTemplate tpl = new ApplicationTemplate( name ).version( qualifier ); root = ConfigurationUtils.findTemplateDirectory( tpl, configurationDirectory ); } else { root = ConfigurationUtils.findApplicationDirectory( name, configurationDirectory ); } // Find an icon in the directory return IconUtils.findIcon( root ); }
[ "public", "static", "File", "findIcon", "(", "String", "name", ",", "String", "qualifier", ",", "File", "configurationDirectory", ")", "{", "// Deal with an invalid directory", "if", "(", "configurationDirectory", "==", "null", ")", "return", "null", ";", "// Find t...
Finds the icon associated with an application template. @param name the application or template name @param qualifier the template qualifier or <code>null</code> for an application @param configurationDirectory the DM's configuration directory @return an existing file, or null if no icon was found
[ "Finds", "the", "icon", "associated", "with", "an", "application", "template", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java#L156-L173
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java
ConfigurationUtils.loadApplicationBindings
public static void loadApplicationBindings( Application app ) { File descDir = new File( app.getDirectory(), Constants.PROJECT_DIR_DESC ); File appBindingsFile = new File( descDir, APP_BINDINGS_FILE ); Logger logger = Logger.getLogger( ConfigurationUtils.class.getName()); Properties props = Utils.readPropertiesFileQuietly( appBindingsFile, logger ); for( Map.Entry<?,?> entry : props.entrySet()) { for( String part : Utils.splitNicely((String) entry.getValue(), "," )) { if( ! Utils.isEmptyOrWhitespaces( part )) app.bindWithApplication((String) entry.getKey(), part ); } } }
java
public static void loadApplicationBindings( Application app ) { File descDir = new File( app.getDirectory(), Constants.PROJECT_DIR_DESC ); File appBindingsFile = new File( descDir, APP_BINDINGS_FILE ); Logger logger = Logger.getLogger( ConfigurationUtils.class.getName()); Properties props = Utils.readPropertiesFileQuietly( appBindingsFile, logger ); for( Map.Entry<?,?> entry : props.entrySet()) { for( String part : Utils.splitNicely((String) entry.getValue(), "," )) { if( ! Utils.isEmptyOrWhitespaces( part )) app.bindWithApplication((String) entry.getKey(), part ); } } }
[ "public", "static", "void", "loadApplicationBindings", "(", "Application", "app", ")", "{", "File", "descDir", "=", "new", "File", "(", "app", ".", "getDirectory", "(", ")", ",", "Constants", ".", "PROJECT_DIR_DESC", ")", ";", "File", "appBindingsFile", "=", ...
Loads the application bindings into an application. @param app a non-null application @param configurationDirectory the DM's configuration directory
[ "Loads", "the", "application", "bindings", "into", "an", "application", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java#L181-L194
train
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java
ConfigurationUtils.saveApplicationBindings
public static void saveApplicationBindings( Application app ) { File descDir = new File( app.getDirectory(), Constants.PROJECT_DIR_DESC ); File appBindingsFile = new File( descDir, APP_BINDINGS_FILE ); // Convert the bindings map Map<String,String> format = new HashMap<> (); for( Map.Entry<String,Set<String>> entry : app.getApplicationBindings().entrySet()) { String s = Utils.format( entry.getValue(), ", " ); format.put( entry.getKey(), s ); } // Save it Properties props = new Properties(); props.putAll( format ); try { Utils.createDirectory( descDir ); Utils.writePropertiesFile( props, appBindingsFile ); } catch( IOException e ) { Logger logger = Logger.getLogger( ConfigurationUtils.class.getName()); logger.severe( "Failed to save application bindings for " + app + ". " + e.getMessage()); Utils.logException( logger, e ); } }
java
public static void saveApplicationBindings( Application app ) { File descDir = new File( app.getDirectory(), Constants.PROJECT_DIR_DESC ); File appBindingsFile = new File( descDir, APP_BINDINGS_FILE ); // Convert the bindings map Map<String,String> format = new HashMap<> (); for( Map.Entry<String,Set<String>> entry : app.getApplicationBindings().entrySet()) { String s = Utils.format( entry.getValue(), ", " ); format.put( entry.getKey(), s ); } // Save it Properties props = new Properties(); props.putAll( format ); try { Utils.createDirectory( descDir ); Utils.writePropertiesFile( props, appBindingsFile ); } catch( IOException e ) { Logger logger = Logger.getLogger( ConfigurationUtils.class.getName()); logger.severe( "Failed to save application bindings for " + app + ". " + e.getMessage()); Utils.logException( logger, e ); } }
[ "public", "static", "void", "saveApplicationBindings", "(", "Application", "app", ")", "{", "File", "descDir", "=", "new", "File", "(", "app", ".", "getDirectory", "(", ")", ",", "Constants", ".", "PROJECT_DIR_DESC", ")", ";", "File", "appBindingsFile", "=", ...
Saves the application bindings into the DM's directory. @param app a non-null application @param configurationDirectory the DM's configuration directory
[ "Saves", "the", "application", "bindings", "into", "the", "DM", "s", "directory", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/utils/ConfigurationUtils.java#L202-L227
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/commands/AbstractCommandInstruction.java
AbstractCommandInstruction.error
protected ParsingError error( ErrorCode errorCode, ErrorDetails... details ) { return new ParsingError( errorCode, this.context.getCommandFile(), this.line, details ); }
java
protected ParsingError error( ErrorCode errorCode, ErrorDetails... details ) { return new ParsingError( errorCode, this.context.getCommandFile(), this.line, details ); }
[ "protected", "ParsingError", "error", "(", "ErrorCode", "errorCode", ",", "ErrorDetails", "...", "details", ")", "{", "return", "new", "ParsingError", "(", "errorCode", ",", "this", ".", "context", ".", "getCommandFile", "(", ")", ",", "this", ".", "line", "...
A shortcut method to create a parsing error with relevant information. @param errorCode an error code @param details (can be null) @return a new parsing error
[ "A", "shortcut", "method", "to", "create", "a", "parsing", "error", "with", "relevant", "information", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/commands/AbstractCommandInstruction.java#L162-L168
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/ModelUtils.java
ModelUtils.getPropertyValues
public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) { List<String> result = new ArrayList<> (); for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) { result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR )); } return result; }
java
public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) { List<String> result = new ArrayList<> (); for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) { result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR )); } return result; }
[ "public", "static", "List", "<", "String", ">", "getPropertyValues", "(", "AbstractBlockHolder", "holder", ",", "String", "propertyName", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "BlockProperty...
Gets and splits property values separated by a comma. @param holder a property holder (not null) @return a non-null list of non-null values
[ "Gets", "and", "splits", "property", "values", "separated", "by", "a", "comma", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/ModelUtils.java#L74-L82
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/ModelUtils.java
ModelUtils.getData
public static Map<String,String> getData( AbstractBlockHolder holder ) { BlockProperty p = holder.findPropertyBlockByName( ParsingConstants.PROPERTY_INSTANCE_DATA ); Map<String,String> result = new HashMap<> (); String propertyValue = p == null ? null : p.getValue(); for( String s : Utils.splitNicely( propertyValue, ParsingConstants.PROPERTY_SEPARATOR )) { Map.Entry<String,String> entry = VariableHelpers.parseExportedVariable( s ); result.put( entry.getKey(), entry.getValue()); } return result; }
java
public static Map<String,String> getData( AbstractBlockHolder holder ) { BlockProperty p = holder.findPropertyBlockByName( ParsingConstants.PROPERTY_INSTANCE_DATA ); Map<String,String> result = new HashMap<> (); String propertyValue = p == null ? null : p.getValue(); for( String s : Utils.splitNicely( propertyValue, ParsingConstants.PROPERTY_SEPARATOR )) { Map.Entry<String,String> entry = VariableHelpers.parseExportedVariable( s ); result.put( entry.getKey(), entry.getValue()); } return result; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "getData", "(", "AbstractBlockHolder", "holder", ")", "{", "BlockProperty", "p", "=", "holder", ".", "findPropertyBlockByName", "(", "ParsingConstants", ".", "PROPERTY_INSTANCE_DATA", ")", ";", "Map", ...
Gets and splits data separated by a comma. @param holder a property holder (not null) @return a non-null map (key = data name, value = data value, which can be null)
[ "Gets", "and", "splits", "data", "separated", "by", "a", "comma", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/ModelUtils.java#L90-L102
train
roboconf/roboconf-platform
core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/HttpClientFactory.java
HttpClientFactory.setHttpServerIp
public synchronized void setHttpServerIp( final String serverIp ) { this.httpServerIp = serverIp; this.dmClient.setHttpServerIp( serverIp ); this.logger.finer( "Server IP set to " + this.httpServerIp ); }
java
public synchronized void setHttpServerIp( final String serverIp ) { this.httpServerIp = serverIp; this.dmClient.setHttpServerIp( serverIp ); this.logger.finer( "Server IP set to " + this.httpServerIp ); }
[ "public", "synchronized", "void", "setHttpServerIp", "(", "final", "String", "serverIp", ")", "{", "this", ".", "httpServerIp", "=", "serverIp", ";", "this", ".", "dmClient", ".", "setHttpServerIp", "(", "serverIp", ")", ";", "this", ".", "logger", ".", "fin...
Getters and Setters
[ "Getters", "and", "Setters" ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/HttpClientFactory.java#L120-L124
train
roboconf/roboconf-platform
core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/HttpClientFactory.java
HttpClientFactory.resetClients
private void resetClients( boolean shutdown ) { // Only agent clients need to be reconfigured. // Make fresh snapshots of the CLIENTS, as we don't want to reconfigure them while holding the lock. final List<HttpAgentClient> clients; synchronized( this ) { // Get the snapshot. clients = new ArrayList<>( this.agentClients ); // Remove the clients, new ones will be created if necessary. this.agentClients.clear(); } // Now reconfigure all the CLIENTS. for( HttpAgentClient client : clients ) { try { final ReconfigurableClient<?> reconfigurable = client.getReconfigurableClient(); if (shutdown) reconfigurable.closeConnection(); else reconfigurable.switchMessagingType( HttpConstants.FACTORY_HTTP ); } catch( Throwable t ) { // Warn but continue to reconfigure the next CLIENTS! this.logger.warning( "A client has thrown an exception on reconfiguration: " + client ); Utils.logException( this.logger, new RuntimeException( t )); } } }
java
private void resetClients( boolean shutdown ) { // Only agent clients need to be reconfigured. // Make fresh snapshots of the CLIENTS, as we don't want to reconfigure them while holding the lock. final List<HttpAgentClient> clients; synchronized( this ) { // Get the snapshot. clients = new ArrayList<>( this.agentClients ); // Remove the clients, new ones will be created if necessary. this.agentClients.clear(); } // Now reconfigure all the CLIENTS. for( HttpAgentClient client : clients ) { try { final ReconfigurableClient<?> reconfigurable = client.getReconfigurableClient(); if (shutdown) reconfigurable.closeConnection(); else reconfigurable.switchMessagingType( HttpConstants.FACTORY_HTTP ); } catch( Throwable t ) { // Warn but continue to reconfigure the next CLIENTS! this.logger.warning( "A client has thrown an exception on reconfiguration: " + client ); Utils.logException( this.logger, new RuntimeException( t )); } } }
[ "private", "void", "resetClients", "(", "boolean", "shutdown", ")", "{", "// Only agent clients need to be reconfigured.", "// Make fresh snapshots of the CLIENTS, as we don't want to reconfigure them while holding the lock.", "final", "List", "<", "HttpAgentClient", ">", "clients", ...
Closes messaging clients or requests a replacement to the reconfigurable client. @param shutdown true to close, false to request...
[ "Closes", "messaging", "clients", "or", "requests", "a", "replacement", "to", "the", "reconfigurable", "client", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/HttpClientFactory.java#L284-L313
train
roboconf/roboconf-platform
core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/AgentMonitoring.java
AgentMonitoring.handlerAppears
public void handlerAppears( IMonitoringHandler handler ) { if( handler != null ) { this.logger.info( "Monitoring handler '" + handler.getName() + "' is now available." ); this.handlers.add( handler ); listHandlers( this.handlers, this.logger ); } }
java
public void handlerAppears( IMonitoringHandler handler ) { if( handler != null ) { this.logger.info( "Monitoring handler '" + handler.getName() + "' is now available." ); this.handlers.add( handler ); listHandlers( this.handlers, this.logger ); } }
[ "public", "void", "handlerAppears", "(", "IMonitoringHandler", "handler", ")", "{", "if", "(", "handler", "!=", "null", ")", "{", "this", ".", "logger", ".", "info", "(", "\"Monitoring handler '\"", "+", "handler", ".", "getName", "(", ")", "+", "\"' is now ...
This method is invoked by iPojo every time a new monitoring handler appears. @param handler the appearing monitoring handler
[ "This", "method", "is", "invoked", "by", "iPojo", "every", "time", "a", "new", "monitoring", "handler", "appears", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/AgentMonitoring.java#L102-L109
train
roboconf/roboconf-platform
core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/AgentMonitoring.java
AgentMonitoring.handlerDisappears
public void handlerDisappears( IMonitoringHandler handler ) { // May happen if a target could not be instantiated // (iPojo uses proxies). In this case, it results in a NPE here. if( handler == null ) { this.logger.info( "An invalid monitoring handler is removed." ); } else { this.handlers.remove( handler ); this.logger.info( "Monitoring handler '" + handler.getName() + "' is not available anymore." ); } listHandlers( this.handlers, this.logger ); }
java
public void handlerDisappears( IMonitoringHandler handler ) { // May happen if a target could not be instantiated // (iPojo uses proxies). In this case, it results in a NPE here. if( handler == null ) { this.logger.info( "An invalid monitoring handler is removed." ); } else { this.handlers.remove( handler ); this.logger.info( "Monitoring handler '" + handler.getName() + "' is not available anymore." ); } listHandlers( this.handlers, this.logger ); }
[ "public", "void", "handlerDisappears", "(", "IMonitoringHandler", "handler", ")", "{", "// May happen if a target could not be instantiated", "// (iPojo uses proxies). In this case, it results in a NPE here.", "if", "(", "handler", "==", "null", ")", "{", "this", ".", "logger",...
This method is invoked by iPojo every time a monitoring handler disappears. @param handler the disappearing monitoring handler
[ "This", "method", "is", "invoked", "by", "iPojo", "every", "time", "a", "monitoring", "handler", "disappears", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/AgentMonitoring.java#L116-L128
train
roboconf/roboconf-platform
core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/AgentMonitoring.java
AgentMonitoring.listHandlers
public static void listHandlers( List<IMonitoringHandler> handlers, Logger logger ) { if( handlers.isEmpty()) { logger.info( "No monitoring handler was found." ); } else { StringBuilder sb = new StringBuilder( "Available monitoring handlers: " ); for( Iterator<IMonitoringHandler> it = handlers.iterator(); it.hasNext(); ) { sb.append( it.next().getName()); if( it.hasNext()) sb.append( ", " ); } sb.append( "." ); logger.info( sb.toString()); } }
java
public static void listHandlers( List<IMonitoringHandler> handlers, Logger logger ) { if( handlers.isEmpty()) { logger.info( "No monitoring handler was found." ); } else { StringBuilder sb = new StringBuilder( "Available monitoring handlers: " ); for( Iterator<IMonitoringHandler> it = handlers.iterator(); it.hasNext(); ) { sb.append( it.next().getName()); if( it.hasNext()) sb.append( ", " ); } sb.append( "." ); logger.info( sb.toString()); } }
[ "public", "static", "void", "listHandlers", "(", "List", "<", "IMonitoringHandler", ">", "handlers", ",", "Logger", "logger", ")", "{", "if", "(", "handlers", ".", "isEmpty", "(", ")", ")", "{", "logger", ".", "info", "(", "\"No monitoring handler was found.\"...
This method lists the available handlers and logs them.
[ "This", "method", "lists", "the", "available", "handlers", "and", "logs", "them", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/AgentMonitoring.java#L143-L159
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java
AgentProperties.validate
public String validate() { String result = null; if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty()) result = "The message configuration cannot be null or empty."; else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null) result = "The message configuration does not contain the messaging type."; else if( Utils.isEmptyOrWhitespaces( this.applicationName )) result = "The application name cannot be null or empty."; else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath )) result = "The scoped instance's path cannot be null or empty."; return result; }
java
public String validate() { String result = null; if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty()) result = "The message configuration cannot be null or empty."; else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null) result = "The message configuration does not contain the messaging type."; else if( Utils.isEmptyOrWhitespaces( this.applicationName )) result = "The application name cannot be null or empty."; else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath )) result = "The scoped instance's path cannot be null or empty."; return result; }
[ "public", "String", "validate", "(", ")", "{", "String", "result", "=", "null", ";", "if", "(", "this", ".", "messagingConfiguration", "==", "null", "||", "this", ".", "messagingConfiguration", ".", "isEmpty", "(", ")", ")", "result", "=", "\"The message con...
Validates this bean. @return null if no error was found, false otherwise
[ "Validates", "this", "bean", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java#L143-L156
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java
AgentProperties.readIaasProperties
public static AgentProperties readIaasProperties( String rawProperties, Logger logger ) throws IOException { Properties props = Utils.readPropertiesQuietly( rawProperties, logger ); return readIaasProperties( props ); }
java
public static AgentProperties readIaasProperties( String rawProperties, Logger logger ) throws IOException { Properties props = Utils.readPropertiesQuietly( rawProperties, logger ); return readIaasProperties( props ); }
[ "public", "static", "AgentProperties", "readIaasProperties", "(", "String", "rawProperties", ",", "Logger", "logger", ")", "throws", "IOException", "{", "Properties", "props", "=", "Utils", ".", "readPropertiesQuietly", "(", "rawProperties", ",", "logger", ")", ";",...
Creates a new bean from raw properties that will be parsed. @param rawProperties a non-null string @param logger a logger (not null) @return a non-null bean @throws IOException if there were files that failed to be written
[ "Creates", "a", "new", "bean", "from", "raw", "properties", "that", "will", "be", "parsed", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java#L166-L170
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java
AgentProperties.readIaasProperties
public static AgentProperties readIaasProperties( Properties props ) throws IOException { // Deal with files transferred through user data. // Store files in the system's temporary directory. // In Karaf, this will point to the "data/tmp" directory. File msgResourcesDirectory = new File( System.getProperty( "java.io.tmpdir" ), "roboconf-messaging" ); props = UserDataHelpers.processUserData( props, msgResourcesDirectory ); // Given #213, we have to replace some characters escaped by AWS (and probably Openstack too). AgentProperties result = new AgentProperties(); result.setApplicationName( updatedField( props, UserDataHelpers.APPLICATION_NAME )); result.setScopedInstancePath( updatedField( props, UserDataHelpers.SCOPED_INSTANCE_PATH )); result.setDomain( updatedField( props, UserDataHelpers.DOMAIN )); final Map<String, String> messagingConfiguration = new LinkedHashMap<> (); List<String> toSkip = Arrays.asList( UserDataHelpers.APPLICATION_NAME, UserDataHelpers.DOMAIN, UserDataHelpers.SCOPED_INSTANCE_PATH ); for( String k : props.stringPropertyNames()) { if( ! toSkip.contains( k )) { // All other properties are considered messaging-specific. messagingConfiguration.put(k, updatedField( props, k )); } } result.setMessagingConfiguration( Collections.unmodifiableMap( messagingConfiguration )); return result; }
java
public static AgentProperties readIaasProperties( Properties props ) throws IOException { // Deal with files transferred through user data. // Store files in the system's temporary directory. // In Karaf, this will point to the "data/tmp" directory. File msgResourcesDirectory = new File( System.getProperty( "java.io.tmpdir" ), "roboconf-messaging" ); props = UserDataHelpers.processUserData( props, msgResourcesDirectory ); // Given #213, we have to replace some characters escaped by AWS (and probably Openstack too). AgentProperties result = new AgentProperties(); result.setApplicationName( updatedField( props, UserDataHelpers.APPLICATION_NAME )); result.setScopedInstancePath( updatedField( props, UserDataHelpers.SCOPED_INSTANCE_PATH )); result.setDomain( updatedField( props, UserDataHelpers.DOMAIN )); final Map<String, String> messagingConfiguration = new LinkedHashMap<> (); List<String> toSkip = Arrays.asList( UserDataHelpers.APPLICATION_NAME, UserDataHelpers.DOMAIN, UserDataHelpers.SCOPED_INSTANCE_PATH ); for( String k : props.stringPropertyNames()) { if( ! toSkip.contains( k )) { // All other properties are considered messaging-specific. messagingConfiguration.put(k, updatedField( props, k )); } } result.setMessagingConfiguration( Collections.unmodifiableMap( messagingConfiguration )); return result; }
[ "public", "static", "AgentProperties", "readIaasProperties", "(", "Properties", "props", ")", "throws", "IOException", "{", "// Deal with files transferred through user data.", "// Store files in the system's temporary directory.", "// In Karaf, this will point to the \"data/tmp\" director...
Creates a new bean from properties. @param props non-null properties @return a non-null bean @throws IOException if there were files that failed to be written
[ "Creates", "a", "new", "bean", "from", "properties", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java#L179-L204
train
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java
AgentProperties.updatedField
private static String updatedField( Properties props, String fieldName ) { String property = props.getProperty( fieldName ); if( property != null ) property = property.replace( "\\:", ":" ); return property; }
java
private static String updatedField( Properties props, String fieldName ) { String property = props.getProperty( fieldName ); if( property != null ) property = property.replace( "\\:", ":" ); return property; }
[ "private", "static", "String", "updatedField", "(", "Properties", "props", ",", "String", "fieldName", ")", "{", "String", "property", "=", "props", ".", "getProperty", "(", "fieldName", ")", ";", "if", "(", "property", "!=", "null", ")", "property", "=", ...
Gets a property and updates it to prevent escaped characters. @param props the IAAS properties. @param fieldName the name of the field to read. @return an updated string
[ "Gets", "a", "property", "and", "updates", "it", "to", "prevent", "escaped", "characters", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java#L213-L220
train
roboconf/roboconf-platform
core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/messages/HttpSerializationUtils.java
HttpSerializationUtils.deserializeObject
public static Message deserializeObject( byte[] bytes ) throws IOException, ClassNotFoundException { ByteArrayInputStream is = new ByteArrayInputStream( bytes ); ObjectInputStream deserializer = new ObjectInputStream( is ); return (Message) deserializer.readObject(); }
java
public static Message deserializeObject( byte[] bytes ) throws IOException, ClassNotFoundException { ByteArrayInputStream is = new ByteArrayInputStream( bytes ); ObjectInputStream deserializer = new ObjectInputStream( is ); return (Message) deserializer.readObject(); }
[ "public", "static", "Message", "deserializeObject", "(", "byte", "[", "]", "bytes", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "ByteArrayInputStream", "is", "=", "new", "ByteArrayInputStream", "(", "bytes", ")", ";", "ObjectInputStream", "dese...
Deserializes a message. @param bytes a non-null array of bytes @return the deserialized message, or null if it failed @throws ClassNotFoundException @throws IOException
[ "Deserializes", "a", "message", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-http/src/main/java/net/roboconf/messaging/http/internal/messages/HttpSerializationUtils.java#L68-L74
train
roboconf/roboconf-platform
core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/cors/ResponseCorsFilter.java
ResponseCorsFilter.buildHeaders
public static Map<String,String> buildHeaders( String reqCorsHeader, String requestUri ) { Map<String,String> result = new LinkedHashMap<> (); result.put( CORS_ALLOW_ORIGIN, requestUri ); result.put( CORS_ALLOW_METHODS, VALUE_ALLOWED_METHODS ); result.put( CORS_ALLOW_CREDENTIALS, VALUE_ALLOW_CREDENTIALS ); if( ! Utils.isEmptyOrWhitespaces( reqCorsHeader )) result.put( CORS_ALLOW_HEADERS, reqCorsHeader ); return result; }
java
public static Map<String,String> buildHeaders( String reqCorsHeader, String requestUri ) { Map<String,String> result = new LinkedHashMap<> (); result.put( CORS_ALLOW_ORIGIN, requestUri ); result.put( CORS_ALLOW_METHODS, VALUE_ALLOWED_METHODS ); result.put( CORS_ALLOW_CREDENTIALS, VALUE_ALLOW_CREDENTIALS ); if( ! Utils.isEmptyOrWhitespaces( reqCorsHeader )) result.put( CORS_ALLOW_HEADERS, reqCorsHeader ); return result; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "buildHeaders", "(", "String", "reqCorsHeader", ",", "String", "requestUri", ")", "{", "Map", "<", "String", ",", "String", ">", "result", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "re...
Finds the right headers to set on the response to prevent CORS issues. @param reqCorsHeader the headers related to CORS @return a non-null map
[ "Finds", "the", "right", "headers", "to", "set", "on", "the", "response", "to", "prevent", "CORS", "issues", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/cors/ResponseCorsFilter.java#L89-L100
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/Version.java
Version.parseVersion
public static Version parseVersion( String rawVersion ) { Version result = null; Matcher m = Pattern.compile( "^(\\d+)\\.(\\d+)(\\.\\d+)?([.-].+)?$" ).matcher( rawVersion ); if( m.find()) { result = new Version( Integer.parseInt( m.group( 1 )), Integer.parseInt( m.group( 2 )), m.group( 3 ) == null ? 0 : Integer.parseInt( m.group( 3 ).substring( 1 )), m.group( 4 ) == null ? null : m.group( 4 ).substring( 1 )); } return result; }
java
public static Version parseVersion( String rawVersion ) { Version result = null; Matcher m = Pattern.compile( "^(\\d+)\\.(\\d+)(\\.\\d+)?([.-].+)?$" ).matcher( rawVersion ); if( m.find()) { result = new Version( Integer.parseInt( m.group( 1 )), Integer.parseInt( m.group( 2 )), m.group( 3 ) == null ? 0 : Integer.parseInt( m.group( 3 ).substring( 1 )), m.group( 4 ) == null ? null : m.group( 4 ).substring( 1 )); } return result; }
[ "public", "static", "Version", "parseVersion", "(", "String", "rawVersion", ")", "{", "Version", "result", "=", "null", ";", "Matcher", "m", "=", "Pattern", ".", "compile", "(", "\"^(\\\\d+)\\\\.(\\\\d+)(\\\\.\\\\d+)?([.-].+)?$\"", ")", ".", "matcher", "(", "rawVe...
Creates a version object from a string. @param rawVersion a version as a string @return null if the version is invalid, or an object otherwise
[ "Creates", "a", "version", "object", "from", "a", "string", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/Version.java#L92-L105
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java
RoboconfErrorHelpers.containsCriticalErrors
public static boolean containsCriticalErrors( Collection<? extends RoboconfError> errors ) { boolean result = false; for( RoboconfError error : errors ) { if(( result = error.getErrorCode().getLevel() == ErrorLevel.SEVERE )) break; } return result; }
java
public static boolean containsCriticalErrors( Collection<? extends RoboconfError> errors ) { boolean result = false; for( RoboconfError error : errors ) { if(( result = error.getErrorCode().getLevel() == ErrorLevel.SEVERE )) break; } return result; }
[ "public", "static", "boolean", "containsCriticalErrors", "(", "Collection", "<", "?", "extends", "RoboconfError", ">", "errors", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "RoboconfError", "error", ":", "errors", ")", "{", "if", "(", "(", ...
Determines whether a collection of errors contains at least one critical error. @param errors a non-null collection of errors @return true if at least one critical error, false otherwise
[ "Determines", "whether", "a", "collection", "of", "errors", "contains", "at", "least", "one", "critical", "error", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java#L63-L72
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java
RoboconfErrorHelpers.findWarnings
public static Collection<RoboconfError> findWarnings( Collection<? extends RoboconfError> errors ) { Collection<RoboconfError> result = new ArrayList<> (); for( RoboconfError error : errors ) { if( error.getErrorCode().getLevel() == ErrorLevel.WARNING ) result.add( error ); } return result; }
java
public static Collection<RoboconfError> findWarnings( Collection<? extends RoboconfError> errors ) { Collection<RoboconfError> result = new ArrayList<> (); for( RoboconfError error : errors ) { if( error.getErrorCode().getLevel() == ErrorLevel.WARNING ) result.add( error ); } return result; }
[ "public", "static", "Collection", "<", "RoboconfError", ">", "findWarnings", "(", "Collection", "<", "?", "extends", "RoboconfError", ">", "errors", ")", "{", "Collection", "<", "RoboconfError", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "f...
Finds all the warnings among a collection of Roboconf errors. @param errors a non-null collection of errors @return a non-null collection of warnings
[ "Finds", "all", "the", "warnings", "among", "a", "collection", "of", "Roboconf", "errors", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java#L80-L89
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java
RoboconfErrorHelpers.filterErrors
public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) { // No error code to filter? => errorCodes is an empty array (not null) List<ErrorCode> codesToSkip = new ArrayList<> (); codesToSkip.addAll( Arrays.asList( errorCodes )); Collection<RoboconfError> toRemove = new ArrayList<> (); for( RoboconfError error : errors ) { if( codesToSkip.contains( error.getErrorCode())) toRemove.add( error ); } errors.removeAll( toRemove ); }
java
public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) { // No error code to filter? => errorCodes is an empty array (not null) List<ErrorCode> codesToSkip = new ArrayList<> (); codesToSkip.addAll( Arrays.asList( errorCodes )); Collection<RoboconfError> toRemove = new ArrayList<> (); for( RoboconfError error : errors ) { if( codesToSkip.contains( error.getErrorCode())) toRemove.add( error ); } errors.removeAll( toRemove ); }
[ "public", "static", "void", "filterErrors", "(", "Collection", "<", "?", "extends", "RoboconfError", ">", "errors", ",", "ErrorCode", "...", "errorCodes", ")", "{", "// No error code to filter? => errorCodes is an empty array (not null)", "List", "<", "ErrorCode", ">", ...
Filters errors by removing those associated with specific error codes. @param errors a non-null list of errors @param errorCodes error codes
[ "Filters", "errors", "by", "removing", "those", "associated", "with", "specific", "error", "codes", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/errors/RoboconfErrorHelpers.java#L171-L184
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.renderApplication
private void renderApplication() throws IOException { StringBuilder sb = new StringBuilder(); // First pages sb.append( renderDocumentTitle()); sb.append( renderPageBreak()); sb.append( renderParagraph( this.messages.get( "intro" ))); //$NON-NLS-1$ sb.append( renderPageBreak()); sb.append( renderDocumentIndex()); sb.append( renderPageBreak()); sb.append( startTable()); sb.append( addTableLine( this.messages.get( "app.name" ), this.applicationTemplate.getName())); //$NON-NLS-1$ sb.append( addTableLine( this.messages.get( "app.qualifier" ), this.applicationTemplate.getVersion())); //$NON-NLS-1$ sb.append( endTable()); sb.append( renderApplicationDescription()); sb.append( renderPageBreak()); sb.append( renderSections( new ArrayList<String>( 0 ))); // Render information about components sb.append( renderComponents()); // Render information about initial instances sb.append( renderInstances()); writeFileContent( sb.toString()); }
java
private void renderApplication() throws IOException { StringBuilder sb = new StringBuilder(); // First pages sb.append( renderDocumentTitle()); sb.append( renderPageBreak()); sb.append( renderParagraph( this.messages.get( "intro" ))); //$NON-NLS-1$ sb.append( renderPageBreak()); sb.append( renderDocumentIndex()); sb.append( renderPageBreak()); sb.append( startTable()); sb.append( addTableLine( this.messages.get( "app.name" ), this.applicationTemplate.getName())); //$NON-NLS-1$ sb.append( addTableLine( this.messages.get( "app.qualifier" ), this.applicationTemplate.getVersion())); //$NON-NLS-1$ sb.append( endTable()); sb.append( renderApplicationDescription()); sb.append( renderPageBreak()); sb.append( renderSections( new ArrayList<String>( 0 ))); // Render information about components sb.append( renderComponents()); // Render information about initial instances sb.append( renderInstances()); writeFileContent( sb.toString()); }
[ "private", "void", "renderApplication", "(", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "// First pages", "sb", ".", "append", "(", "renderDocumentTitle", "(", ")", ")", ";", "sb", ".", "append", "("...
Renders an applicationTemplate. @throws IOException
[ "Renders", "an", "applicationTemplate", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L131-L160
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.renderRecipe
private void renderRecipe() throws IOException { StringBuilder sb = new StringBuilder(); // First pages if( ! Constants.GENERATED.equalsIgnoreCase( this.applicationTemplate.getName())) { sb.append( renderDocumentTitle()); sb.append( renderPageBreak()); sb.append( renderParagraph( this.messages.get( "intro" ))); //$NON-NLS-1$ sb.append( renderPageBreak()); sb.append( renderDocumentIndex()); sb.append( renderPageBreak()); sb.append( startTable()); sb.append( addTableLine( this.messages.get( "app.name" ), this.applicationTemplate.getName())); //$NON-NLS-1$ sb.append( addTableLine( this.messages.get( "app.qualifier" ), this.applicationTemplate.getVersion())); //$NON-NLS-1$ sb.append( endTable()); sb.append( renderApplicationDescription()); sb.append( renderPageBreak()); sb.append( renderSections( new ArrayList<String>( 0 ))); } else { sb.append( renderDocumentIndex()); sb.append( renderPageBreak()); } // Render information about components sb.append( renderComponents()); // Render information about facets sb.append( renderFacets()); writeFileContent( sb.toString()); }
java
private void renderRecipe() throws IOException { StringBuilder sb = new StringBuilder(); // First pages if( ! Constants.GENERATED.equalsIgnoreCase( this.applicationTemplate.getName())) { sb.append( renderDocumentTitle()); sb.append( renderPageBreak()); sb.append( renderParagraph( this.messages.get( "intro" ))); //$NON-NLS-1$ sb.append( renderPageBreak()); sb.append( renderDocumentIndex()); sb.append( renderPageBreak()); sb.append( startTable()); sb.append( addTableLine( this.messages.get( "app.name" ), this.applicationTemplate.getName())); //$NON-NLS-1$ sb.append( addTableLine( this.messages.get( "app.qualifier" ), this.applicationTemplate.getVersion())); //$NON-NLS-1$ sb.append( endTable()); sb.append( renderApplicationDescription()); sb.append( renderPageBreak()); sb.append( renderSections( new ArrayList<String>( 0 ))); } else { sb.append( renderDocumentIndex()); sb.append( renderPageBreak()); } // Render information about components sb.append( renderComponents()); // Render information about facets sb.append( renderFacets()); writeFileContent( sb.toString()); }
[ "private", "void", "renderRecipe", "(", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "// First pages", "if", "(", "!", "Constants", ".", "GENERATED", ".", "equalsIgnoreCase", "(", "this", ".", "applicati...
Renders a recipe. @throws IOException
[ "Renders", "a", "recipe", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L167-L202
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.renderFacets
private StringBuilder renderFacets() throws IOException { StringBuilder sb = new StringBuilder(); if( ! this.applicationTemplate.getGraphs().getFacetNameToFacet().isEmpty()) { sb.append( renderTitle1( this.messages.get( "facets" ))); //$NON-NLS-1$ sb.append( renderParagraph( this.messages.get( "facets.intro" ))); //$NON-NLS-1$ List<String> sectionNames = new ArrayList<> (); List<Facet> allFacets = new ArrayList<>( this.applicationTemplate.getGraphs().getFacetNameToFacet().values()); Collections.sort( allFacets, new AbstractTypeComparator()); for( Facet facet : allFacets ) { // Start a new section final String sectionName = DocConstants.SECTION_FACETS + facet.getName(); StringBuilder section = startSection( sectionName ); // Overview section.append( renderTitle2( facet.getName())); String customInfo = readCustomInformation( this.applicationDirectory, facet.getName(), DocConstants.FACET_DETAILS ); if( Utils.isEmptyOrWhitespaces( customInfo )) customInfo = this.typeAnnotations.get( facet.getName()); if( ! Utils.isEmptyOrWhitespaces( customInfo )) { section.append( renderTitle3( this.messages.get( "overview" ))); //$NON-NLS-1$ section.append( renderParagraph( customInfo )); } // Exported variables Map<String,String> exportedVariables = ComponentHelpers.findAllExportedVariables( facet ); section.append( renderTitle3( this.messages.get( "exports" ))); //$NON-NLS-1$ if( exportedVariables.isEmpty()) { String msg = MessageFormat.format( this.messages.get( "facet.no.export" ), facet ); //$NON-NLS-1$ section.append( renderParagraph( msg )); } else { String msg = MessageFormat.format( this.messages.get( "facet.exports" ), facet ); //$NON-NLS-1$ section.append( renderParagraph( msg )); section.append( renderList( convertExports( exportedVariables ))); } // End the section section = endSection( sectionName, section ); sb.append( section ); sectionNames.add( sectionName ); } sb.append( renderSections( sectionNames )); } return sb; }
java
private StringBuilder renderFacets() throws IOException { StringBuilder sb = new StringBuilder(); if( ! this.applicationTemplate.getGraphs().getFacetNameToFacet().isEmpty()) { sb.append( renderTitle1( this.messages.get( "facets" ))); //$NON-NLS-1$ sb.append( renderParagraph( this.messages.get( "facets.intro" ))); //$NON-NLS-1$ List<String> sectionNames = new ArrayList<> (); List<Facet> allFacets = new ArrayList<>( this.applicationTemplate.getGraphs().getFacetNameToFacet().values()); Collections.sort( allFacets, new AbstractTypeComparator()); for( Facet facet : allFacets ) { // Start a new section final String sectionName = DocConstants.SECTION_FACETS + facet.getName(); StringBuilder section = startSection( sectionName ); // Overview section.append( renderTitle2( facet.getName())); String customInfo = readCustomInformation( this.applicationDirectory, facet.getName(), DocConstants.FACET_DETAILS ); if( Utils.isEmptyOrWhitespaces( customInfo )) customInfo = this.typeAnnotations.get( facet.getName()); if( ! Utils.isEmptyOrWhitespaces( customInfo )) { section.append( renderTitle3( this.messages.get( "overview" ))); //$NON-NLS-1$ section.append( renderParagraph( customInfo )); } // Exported variables Map<String,String> exportedVariables = ComponentHelpers.findAllExportedVariables( facet ); section.append( renderTitle3( this.messages.get( "exports" ))); //$NON-NLS-1$ if( exportedVariables.isEmpty()) { String msg = MessageFormat.format( this.messages.get( "facet.no.export" ), facet ); //$NON-NLS-1$ section.append( renderParagraph( msg )); } else { String msg = MessageFormat.format( this.messages.get( "facet.exports" ), facet ); //$NON-NLS-1$ section.append( renderParagraph( msg )); section.append( renderList( convertExports( exportedVariables ))); } // End the section section = endSection( sectionName, section ); sb.append( section ); sectionNames.add( sectionName ); } sb.append( renderSections( sectionNames )); } return sb; }
[ "private", "StringBuilder", "renderFacets", "(", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "!", "this", ".", "applicationTemplate", ".", "getGraphs", "(", ")", ".", "getFacetNameToFacet", "...
Renders information about the facets. @return a string builder (never null) @throws IOException
[ "Renders", "information", "about", "the", "facets", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L402-L455
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.renderApplicationDescription
private Object renderApplicationDescription() throws IOException { // No locale? => Display the application's description. // Otherwise, read app.desc_fr_FR.txt or the required file for another locale. // If it does not exist, return the empty string. String s; if( this.locale == null && ! Utils.isEmptyOrWhitespaces( this.applicationTemplate.getDescription())) s = this.applicationTemplate.getDescription(); else s = readCustomInformation( this.applicationDirectory, DocConstants.APP_DESC_PREFIX, DocConstants.FILE_SUFFIX ); String result = ""; if( ! Utils.isEmptyOrWhitespaces( s )) result = renderParagraph( s ); return result; }
java
private Object renderApplicationDescription() throws IOException { // No locale? => Display the application's description. // Otherwise, read app.desc_fr_FR.txt or the required file for another locale. // If it does not exist, return the empty string. String s; if( this.locale == null && ! Utils.isEmptyOrWhitespaces( this.applicationTemplate.getDescription())) s = this.applicationTemplate.getDescription(); else s = readCustomInformation( this.applicationDirectory, DocConstants.APP_DESC_PREFIX, DocConstants.FILE_SUFFIX ); String result = ""; if( ! Utils.isEmptyOrWhitespaces( s )) result = renderParagraph( s ); return result; }
[ "private", "Object", "renderApplicationDescription", "(", ")", "throws", "IOException", "{", "// No locale? => Display the application's description.", "// Otherwise, read app.desc_fr_FR.txt or the required file for another locale.", "// If it does not exist, return the empty string.", "String...
Renders the application's description. @return a non-null string @throws IOException if something went wrong
[ "Renders", "the", "application", "s", "description", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L547-L565
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.saveImage
private void saveImage( final Component comp, DiagramType type, AbstractRoboconfTransformer transformer, StringBuilder sb ) throws IOException { String baseName = comp.getName() + "_" + type; //$NON-NLS-1$ String relativePath = "png/" + baseName + ".png"; //$NON-NLS-1$ //$NON-NLS-2$ if( this.options.containsKey( DocConstants.OPTION_GEN_IMAGES_ONCE )) relativePath = "../" + relativePath; File pngFile = new File( this.outputDirectory, relativePath ).getCanonicalFile(); if( ! pngFile.exists()) { Utils.createDirectory( pngFile.getParentFile()); GraphUtils.writeGraph( pngFile, comp, transformer.getConfiguredLayout(), transformer.getGraph(), transformer.getEdgeShapeTransformer(), this.options ); } sb.append( renderImage( comp.getName(), type, relativePath )); }
java
private void saveImage( final Component comp, DiagramType type, AbstractRoboconfTransformer transformer, StringBuilder sb ) throws IOException { String baseName = comp.getName() + "_" + type; //$NON-NLS-1$ String relativePath = "png/" + baseName + ".png"; //$NON-NLS-1$ //$NON-NLS-2$ if( this.options.containsKey( DocConstants.OPTION_GEN_IMAGES_ONCE )) relativePath = "../" + relativePath; File pngFile = new File( this.outputDirectory, relativePath ).getCanonicalFile(); if( ! pngFile.exists()) { Utils.createDirectory( pngFile.getParentFile()); GraphUtils.writeGraph( pngFile, comp, transformer.getConfiguredLayout(), transformer.getGraph(), transformer.getEdgeShapeTransformer(), this.options ); } sb.append( renderImage( comp.getName(), type, relativePath )); }
[ "private", "void", "saveImage", "(", "final", "Component", "comp", ",", "DiagramType", "type", ",", "AbstractRoboconfTransformer", "transformer", ",", "StringBuilder", "sb", ")", "throws", "IOException", "{", "String", "baseName", "=", "comp", ".", "getName", "(",...
Generates and saves an image. @param comp the component to highlight in the image @param type the kind of relation to show in the diagram @param transformer a transformer for the graph generation @param sb the string builder to append the link to the generated image @throws IOException if something went wrong
[ "Generates", "and", "saves", "an", "image", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L576-L598
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.readCustomInformation
private String readCustomInformation( File applicationDirectory, String prefix, String suffix ) throws IOException { // Prepare the file name StringBuilder sb = new StringBuilder(); sb.append( prefix ); if( this.locale != null ) sb.append( "_" + this.locale ); sb.append( suffix ); sb.insert( 0, "/" ); //$NON-NLS-1$ sb.insert( 0, DocConstants.DOC_DIR ); // Handle usual (doc) and Maven (src/main/doc) cases File f = new File( applicationDirectory, sb.toString()); if( ! f.exists()) f = new File( f.getParentFile().getParentFile(), sb.toString()); String result = ""; //$NON-NLS-1$ if( f.exists()) result = Utils.readFileContent( f ); return result; }
java
private String readCustomInformation( File applicationDirectory, String prefix, String suffix ) throws IOException { // Prepare the file name StringBuilder sb = new StringBuilder(); sb.append( prefix ); if( this.locale != null ) sb.append( "_" + this.locale ); sb.append( suffix ); sb.insert( 0, "/" ); //$NON-NLS-1$ sb.insert( 0, DocConstants.DOC_DIR ); // Handle usual (doc) and Maven (src/main/doc) cases File f = new File( applicationDirectory, sb.toString()); if( ! f.exists()) f = new File( f.getParentFile().getParentFile(), sb.toString()); String result = ""; //$NON-NLS-1$ if( f.exists()) result = Utils.readFileContent( f ); return result; }
[ "private", "String", "readCustomInformation", "(", "File", "applicationDirectory", ",", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "// Prepare the file name", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb...
Reads user-specified information from the project. @param applicationDirectory the application's directory @param prefix the prefix name @param suffix the file's suffix (see the DocConstants interface) @return the read information, as a string (never null) @throws IOException if the file could not be read
[ "Reads", "user", "-", "specified", "information", "from", "the", "project", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L609-L632
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.convertImports
private List<String> convertImports( Collection<ImportedVariable> importedVariables ) { List<String> result = new ArrayList<> (); for( ImportedVariable var : importedVariables ) { String componentOrFacet = VariableHelpers.parseVariableName( var.getName()).getKey(); String s = applyLink( var.getName(), componentOrFacet ); s += var.isOptional() ? this.messages.get( "optional" ) : this.messages.get( "required" ); //$NON-NLS-1$ //$NON-NLS-2$ if( var.isExternal()) s += this.messages.get( "external" ); //$NON-NLS-1$ result.add( s ); } return result; }
java
private List<String> convertImports( Collection<ImportedVariable> importedVariables ) { List<String> result = new ArrayList<> (); for( ImportedVariable var : importedVariables ) { String componentOrFacet = VariableHelpers.parseVariableName( var.getName()).getKey(); String s = applyLink( var.getName(), componentOrFacet ); s += var.isOptional() ? this.messages.get( "optional" ) : this.messages.get( "required" ); //$NON-NLS-1$ //$NON-NLS-2$ if( var.isExternal()) s += this.messages.get( "external" ); //$NON-NLS-1$ result.add( s ); } return result; }
[ "private", "List", "<", "String", ">", "convertImports", "(", "Collection", "<", "ImportedVariable", ">", "importedVariables", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "ImportedVariable", "var"...
Converts imports to a human-readable text. @param importedVariables a non-null set of imported variables @return a non-null list of string, one entry per import
[ "Converts", "imports", "to", "a", "human", "-", "readable", "text", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L640-L654
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.convertExports
private List<String> convertExports( Map<String,String> exports ) { List<String> result = new ArrayList<> (); for( Map.Entry<String,String> entry : exports.entrySet()) { String componentOrFacet = VariableHelpers.parseVariableName( entry.getKey()).getKey(); String s = Utils.isEmptyOrWhitespaces( componentOrFacet ) ? entry.getKey() : applyLink( entry.getKey(), componentOrFacet ); if( ! Utils.isEmptyOrWhitespaces( entry.getValue())) s += MessageFormat.format( this.messages.get( "default" ), entry.getValue()); //$NON-NLS-1$ if( entry.getKey().toLowerCase().endsWith( ".ip" )) //$NON-NLS-1$ s += this.messages.get( "injected" ); //$NON-NLS-1$ result.add( s ); } return result; }
java
private List<String> convertExports( Map<String,String> exports ) { List<String> result = new ArrayList<> (); for( Map.Entry<String,String> entry : exports.entrySet()) { String componentOrFacet = VariableHelpers.parseVariableName( entry.getKey()).getKey(); String s = Utils.isEmptyOrWhitespaces( componentOrFacet ) ? entry.getKey() : applyLink( entry.getKey(), componentOrFacet ); if( ! Utils.isEmptyOrWhitespaces( entry.getValue())) s += MessageFormat.format( this.messages.get( "default" ), entry.getValue()); //$NON-NLS-1$ if( entry.getKey().toLowerCase().endsWith( ".ip" )) //$NON-NLS-1$ s += this.messages.get( "injected" ); //$NON-NLS-1$ result.add( s ); } return result; }
[ "private", "List", "<", "String", ">", "convertExports", "(", "Map", "<", "String", ",", "String", ">", "exports", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "...
Converts exports to a human-readable text. @param exports a non-null map of exports @return a non-null list of string, one entry per exported variable
[ "Converts", "exports", "to", "a", "human", "-", "readable", "text", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L662-L681
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.getImportComponents
private List<String> getImportComponents( Component component ) { List<String> result = new ArrayList<> (); Map<String,Boolean> map = ComponentHelpers.findComponentDependenciesFor( component ); for( Map.Entry<String,Boolean> entry : map.entrySet()) { String s = applyLink( entry.getKey(), entry.getKey()); s += entry.getValue() ? this.messages.get( "optional" ) : this.messages.get( "required" ); //$NON-NLS-1$ //$NON-NLS-2$ result.add( s ); } return result; }
java
private List<String> getImportComponents( Component component ) { List<String> result = new ArrayList<> (); Map<String,Boolean> map = ComponentHelpers.findComponentDependenciesFor( component ); for( Map.Entry<String,Boolean> entry : map.entrySet()) { String s = applyLink( entry.getKey(), entry.getKey()); s += entry.getValue() ? this.messages.get( "optional" ) : this.messages.get( "required" ); //$NON-NLS-1$ //$NON-NLS-2$ result.add( s ); } return result; }
[ "private", "List", "<", "String", ">", "getImportComponents", "(", "Component", "component", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "Map", "<", "String", ",", "Boolean", ">", "map", "=", "ComponentHe...
Converts component dependencies to a human-readable text. @param component a component @return a non-null list of component names that match those this component needs
[ "Converts", "component", "dependencies", "to", "a", "human", "-", "readable", "text", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L689-L700
train
roboconf/roboconf-platform
miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java
AbstractStructuredRenderer.renderListAsLinks
private String renderListAsLinks( List<String> names ) { List<String> newNames = new ArrayList<> (); for( String s : names ) newNames.add( applyLink( s, s )); return renderList( newNames ); }
java
private String renderListAsLinks( List<String> names ) { List<String> newNames = new ArrayList<> (); for( String s : names ) newNames.add( applyLink( s, s )); return renderList( newNames ); }
[ "private", "String", "renderListAsLinks", "(", "List", "<", "String", ">", "names", ")", "{", "List", "<", "String", ">", "newNames", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "s", ":", "names", ")", "newNames", ".", "(", "a...
Renders a list as a list of links. @param names a list of items @return a list of links that wrap the names
[ "Renders", "a", "list", "as", "a", "list", "of", "links", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L708-L715
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java
ManagementWsDelegate.uploadZippedApplicationTemplate
public void uploadZippedApplicationTemplate( File applicationFile ) throws ManagementWsException, IOException { if( applicationFile == null || ! applicationFile.exists() || ! applicationFile.isFile()) throw new IOException( "Expected an existing file as parameter." ); this.logger.finer( "Loading an application from " + applicationFile.getAbsolutePath() + "..." ); FormDataMultiPart part = new FormDataMultiPart(); part.bodyPart( new FileDataBodyPart( "file", applicationFile, MediaType.APPLICATION_OCTET_STREAM_TYPE)); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ).path( "templates" ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.MULTIPART_FORM_DATA_TYPE ) .post( ClientResponse.class, part ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new ManagementWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); }
java
public void uploadZippedApplicationTemplate( File applicationFile ) throws ManagementWsException, IOException { if( applicationFile == null || ! applicationFile.exists() || ! applicationFile.isFile()) throw new IOException( "Expected an existing file as parameter." ); this.logger.finer( "Loading an application from " + applicationFile.getAbsolutePath() + "..." ); FormDataMultiPart part = new FormDataMultiPart(); part.bodyPart( new FileDataBodyPart( "file", applicationFile, MediaType.APPLICATION_OCTET_STREAM_TYPE)); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ).path( "templates" ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.MULTIPART_FORM_DATA_TYPE ) .post( ClientResponse.class, part ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new ManagementWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); }
[ "public", "void", "uploadZippedApplicationTemplate", "(", "File", "applicationFile", ")", "throws", "ManagementWsException", ",", "IOException", "{", "if", "(", "applicationFile", "==", "null", "||", "!", "applicationFile", ".", "exists", "(", ")", "||", "!", "app...
Uploads a ZIP file and loads its application template. @param applicationFile a ZIP archive file @throws ManagementWsException if a problem occurred with the applications management @throws IOException if the file was not found or is invalid
[ "Uploads", "a", "ZIP", "file", "and", "loads", "its", "application", "template", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java#L81-L105
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java
ManagementWsDelegate.loadUnzippedApplicationTemplate
public void loadUnzippedApplicationTemplate( String localFilePath ) throws ManagementWsException { this.logger.finer( "Loading an application from a local directory: " + localFilePath ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ).path( "templates" ).path( "local" ); if( localFilePath != null ) path = path.queryParam( "local-file-path", localFilePath ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new ManagementWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); }
java
public void loadUnzippedApplicationTemplate( String localFilePath ) throws ManagementWsException { this.logger.finer( "Loading an application from a local directory: " + localFilePath ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ).path( "templates" ).path( "local" ); if( localFilePath != null ) path = path.queryParam( "local-file-path", localFilePath ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) { String value = response.getEntity( String.class ); this.logger.finer( response.getStatusInfo() + ": " + value ); throw new ManagementWsException( response.getStatusInfo().getStatusCode(), value ); } this.logger.finer( String.valueOf( response.getStatusInfo())); }
[ "public", "void", "loadUnzippedApplicationTemplate", "(", "String", "localFilePath", ")", "throws", "ManagementWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Loading an application from a local directory: \"", "+", "localFilePath", ")", ";", "WebResource", ...
Loads an application template from a directory located on the DM's file system. @param localFilePath the file path of a directory containing the application on the DM's machine @throws ManagementWsException if a problem occurred with the applications management
[ "Loads", "an", "application", "template", "from", "a", "directory", "located", "on", "the", "DM", "s", "file", "system", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java#L113-L131
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java
ManagementWsDelegate.createApplication
public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; }
java
public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; }
[ "public", "Application", "createApplication", "(", "String", "applicationName", ",", "String", "templateName", ",", "String", "templateQualifier", ")", "throws", "ManagementWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Creating application \"", "+", ...
Creates an application from a template. @param applicationName the application name @param templateName the template's name @param templateQualifier the template's qualifier @return the created application @throws ManagementWsException if a problem occurred with the applications management
[ "Creates", "an", "application", "from", "a", "template", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java#L267-L284
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java
ManagementWsDelegate.listApplications
public List<Application> listApplications( String exactName ) throws ManagementWsException { if( exactName != null ) this.logger.finer( "List/finding the application named " + exactName + "." ); else this.logger.finer( "Listing all the applications." ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); if( exactName != null ) path = path.queryParam( "name", exactName ); List<Application> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Application>> () {}); if( result != null ) this.logger.finer( result.size() + " applications were found on the DM." ); else this.logger.finer( "No application was found on the DM." ); return result != null ? result : new ArrayList<Application> (); }
java
public List<Application> listApplications( String exactName ) throws ManagementWsException { if( exactName != null ) this.logger.finer( "List/finding the application named " + exactName + "." ); else this.logger.finer( "Listing all the applications." ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); if( exactName != null ) path = path.queryParam( "name", exactName ); List<Application> result = this.wsClient.createBuilder( path ) .accept( MediaType.APPLICATION_JSON ) .get( new GenericType<List<Application>> () {}); if( result != null ) this.logger.finer( result.size() + " applications were found on the DM." ); else this.logger.finer( "No application was found on the DM." ); return result != null ? result : new ArrayList<Application> (); }
[ "public", "List", "<", "Application", ">", "listApplications", "(", "String", "exactName", ")", "throws", "ManagementWsException", "{", "if", "(", "exactName", "!=", "null", ")", "this", ".", "logger", ".", "finer", "(", "\"List/finding the application named \"", ...
Lists applications. @param exactName if not null, the result list will contain at most one application (with this name) @return a non-null list of applications @throws ManagementWsException if a problem occurred with the applications management
[ "Lists", "applications", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java#L293-L314
train
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java
ManagementWsDelegate.shutdownApplication
public void shutdownApplication( String applicationName ) throws ManagementWsException { this.logger.finer( "Removing application " + applicationName + "..." ); WebResource path = this.resource .path( UrlConstants.APPLICATIONS ) .path( applicationName ) .path( "shutdown" ); ClientResponse response = this.wsClient.createBuilder( path ).post( ClientResponse.class ); String text = response.getEntity( String.class ); this.logger.finer( text ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), text ); }
java
public void shutdownApplication( String applicationName ) throws ManagementWsException { this.logger.finer( "Removing application " + applicationName + "..." ); WebResource path = this.resource .path( UrlConstants.APPLICATIONS ) .path( applicationName ) .path( "shutdown" ); ClientResponse response = this.wsClient.createBuilder( path ).post( ClientResponse.class ); String text = response.getEntity( String.class ); this.logger.finer( text ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), text ); }
[ "public", "void", "shutdownApplication", "(", "String", "applicationName", ")", "throws", "ManagementWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Removing application \"", "+", "applicationName", "+", "\"...\"", ")", ";", "WebResource", "path", "=...
Shutdowns an application. @param applicationName the application name @throws ManagementWsException if a problem occurred with the applications management
[ "Shutdowns", "an", "application", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ManagementWsDelegate.java#L336-L349
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/dsl/parsing/FileDefinition.java
FileDefinition.fileTypeAsString
public static String fileTypeAsString( int fileType ) { String result; switch( fileType ) { case AGGREGATOR: result = "aggregator"; break; case GRAPH: result = "graph"; break; case INSTANCE: result = "intsnace"; break; case UNDETERMINED: result = "undetermined"; break; default: result = "unknown"; break; } return result; }
java
public static String fileTypeAsString( int fileType ) { String result; switch( fileType ) { case AGGREGATOR: result = "aggregator"; break; case GRAPH: result = "graph"; break; case INSTANCE: result = "intsnace"; break; case UNDETERMINED: result = "undetermined"; break; default: result = "unknown"; break; } return result; }
[ "public", "static", "String", "fileTypeAsString", "(", "int", "fileType", ")", "{", "String", "result", ";", "switch", "(", "fileType", ")", "{", "case", "AGGREGATOR", ":", "result", "=", "\"aggregator\"", ";", "break", ";", "case", "GRAPH", ":", "result", ...
Transforms a file type into a string. @param fileType a file type @return a string version of the file type (never null)
[ "Transforms", "a", "file", "type", "into", "a", "string", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/parsing/FileDefinition.java#L134-L160
train
roboconf/roboconf-platform
karaf/roboconf-karaf-commands-dm/src/main/java/net/roboconf/karaf/commands/dm/KarafDmCommandsUtils.java
KarafDmCommandsUtils.findInstances
public static RbcfInfo findInstances( Manager manager, String applicationName, String scopedInstancePath, PrintStream out ) { ManagedApplication ma = null; List<Instance> scopedInstances = new ArrayList<> (); Instance scopedInstance; if(( ma = manager.applicationMngr().findManagedApplicationByName( applicationName )) == null ) out.println( "Unknown application: " + applicationName + "." ); else if( scopedInstancePath == null ) scopedInstances.addAll( InstanceHelpers.findAllScopedInstances( ma.getApplication())); else if(( scopedInstance = InstanceHelpers.findInstanceByPath( ma.getApplication(), scopedInstancePath )) == null ) out.println( "There is no " + scopedInstancePath + " instance in " + applicationName + "." ); else if( ! InstanceHelpers.isTarget( scopedInstance )) out.println( "Instance " + scopedInstancePath + " is not a scoped instance in " + applicationName + "." ); else scopedInstances.add( scopedInstance ); return new RbcfInfo( scopedInstances, ma ); }
java
public static RbcfInfo findInstances( Manager manager, String applicationName, String scopedInstancePath, PrintStream out ) { ManagedApplication ma = null; List<Instance> scopedInstances = new ArrayList<> (); Instance scopedInstance; if(( ma = manager.applicationMngr().findManagedApplicationByName( applicationName )) == null ) out.println( "Unknown application: " + applicationName + "." ); else if( scopedInstancePath == null ) scopedInstances.addAll( InstanceHelpers.findAllScopedInstances( ma.getApplication())); else if(( scopedInstance = InstanceHelpers.findInstanceByPath( ma.getApplication(), scopedInstancePath )) == null ) out.println( "There is no " + scopedInstancePath + " instance in " + applicationName + "." ); else if( ! InstanceHelpers.isTarget( scopedInstance )) out.println( "Instance " + scopedInstancePath + " is not a scoped instance in " + applicationName + "." ); else scopedInstances.add( scopedInstance ); return new RbcfInfo( scopedInstances, ma ); }
[ "public", "static", "RbcfInfo", "findInstances", "(", "Manager", "manager", ",", "String", "applicationName", ",", "String", "scopedInstancePath", ",", "PrintStream", "out", ")", "{", "ManagedApplication", "ma", "=", "null", ";", "List", "<", "Instance", ">", "s...
Finds instances for a given application. @param manager @param applicationName @param scopedInstancePath @param out @return an object with non-null list of instances and a (nullable) managed application
[ "Finds", "instances", "for", "a", "given", "application", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/karaf/roboconf-karaf-commands-dm/src/main/java/net/roboconf/karaf/commands/dm/KarafDmCommandsUtils.java#L59-L85
train
roboconf/roboconf-platform
core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java
OpenstackIaasHandler.novaApi
static NovaApi novaApi( Map<String,String> targetProperties ) throws TargetException { validate( targetProperties ); return ContextBuilder .newBuilder( PROVIDER_NOVA ) .endpoint( targetProperties.get( API_URL )) .credentials( identity( targetProperties ), targetProperties.get( PASSWORD )) .buildApi( NovaApi.class ); }
java
static NovaApi novaApi( Map<String,String> targetProperties ) throws TargetException { validate( targetProperties ); return ContextBuilder .newBuilder( PROVIDER_NOVA ) .endpoint( targetProperties.get( API_URL )) .credentials( identity( targetProperties ), targetProperties.get( PASSWORD )) .buildApi( NovaApi.class ); }
[ "static", "NovaApi", "novaApi", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ")", "throws", "TargetException", "{", "validate", "(", "targetProperties", ")", ";", "return", "ContextBuilder", ".", "newBuilder", "(", "PROVIDER_NOVA", ")", "."...
Creates a JCloud context for Nova. @param targetProperties the target properties @return a non-null object @throws TargetException if the target properties are invalid
[ "Creates", "a", "JCloud", "context", "for", "Nova", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L357-L365
train
roboconf/roboconf-platform
core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java
OpenstackIaasHandler.swiftApi
static SwiftApi swiftApi( Map<String,String> targetProperties ) throws TargetException { validate( targetProperties ); return ContextBuilder .newBuilder( PROVIDER_SWIFT ) .endpoint( targetProperties.get( API_URL )) .credentials( identity( targetProperties ), targetProperties.get( PASSWORD )) .buildApi( SwiftApi.class ); }
java
static SwiftApi swiftApi( Map<String,String> targetProperties ) throws TargetException { validate( targetProperties ); return ContextBuilder .newBuilder( PROVIDER_SWIFT ) .endpoint( targetProperties.get( API_URL )) .credentials( identity( targetProperties ), targetProperties.get( PASSWORD )) .buildApi( SwiftApi.class ); }
[ "static", "SwiftApi", "swiftApi", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ")", "throws", "TargetException", "{", "validate", "(", "targetProperties", ")", ";", "return", "ContextBuilder", ".", "newBuilder", "(", "PROVIDER_SWIFT", ")", ...
Creates a JCloud context for Swift. @param targetProperties the target properties @return a non-null object @throws TargetException if the target properties are invalid
[ "Creates", "a", "JCloud", "context", "for", "Swift", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L374-L382
train
roboconf/roboconf-platform
core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java
OpenstackIaasHandler.validate
static void validate( Map<String,String> targetProperties ) throws TargetException { checkProperty( API_URL, targetProperties ); checkProperty( IMAGE_NAME, targetProperties ); checkProperty( TENANT_NAME, targetProperties ); checkProperty( FLAVOR_NAME, targetProperties ); checkProperty( SECURITY_GROUP, targetProperties ); checkProperty( KEY_PAIR, targetProperties ); checkProperty( USER, targetProperties ); checkProperty( PASSWORD, targetProperties ); }
java
static void validate( Map<String,String> targetProperties ) throws TargetException { checkProperty( API_URL, targetProperties ); checkProperty( IMAGE_NAME, targetProperties ); checkProperty( TENANT_NAME, targetProperties ); checkProperty( FLAVOR_NAME, targetProperties ); checkProperty( SECURITY_GROUP, targetProperties ); checkProperty( KEY_PAIR, targetProperties ); checkProperty( USER, targetProperties ); checkProperty( PASSWORD, targetProperties ); }
[ "static", "void", "validate", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ")", "throws", "TargetException", "{", "checkProperty", "(", "API_URL", ",", "targetProperties", ")", ";", "checkProperty", "(", "IMAGE_NAME", ",", "targetProperties",...
Validates the basic target properties. @param targetProperties the properties @throws TargetException if an error occurred during the validation
[ "Validates", "the", "basic", "target", "properties", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L423-L433
train
roboconf/roboconf-platform
core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java
OpenstackIaasHandler.validateAll
static void validateAll( Map<String,String> targetProperties, String appName, String instanceName ) throws TargetException { // Basic checks validate( targetProperties ); // Storage checks Set<String> mountPoints = new HashSet<> (); Set<String> volumeNames = new HashSet<> (); for( String s : findStorageIds( targetProperties )) { // Unit tests should guarantee there is a default value for the "mount point". String mountPoint = findStorageProperty( targetProperties, s, VOLUME_MOUNT_POINT_PREFIX ); if( mountPoints.contains( mountPoint )) throw new TargetException( "Mount point '" + mountPoint + "' is already used by another volume for this VM." ); mountPoints.add( mountPoint ); // Same thing for the volume name String volumeName = findStorageProperty( targetProperties, s, VOLUME_NAME_PREFIX ); volumeName = expandVolumeName( volumeName, appName, instanceName ); if( volumeNames.contains( volumeName )) throw new TargetException( "Volume name '" + volumeName + "' is already used by another volume for this VM." ); volumeNames.add( volumeName ); // Validate volume size String volumesize = findStorageProperty( targetProperties, s, VOLUME_SIZE_GB_PREFIX ); try { Integer.valueOf( volumesize ); } catch( NumberFormatException e ) { throw new TargetException( "The volume size must be a valid integer.", e ); } } }
java
static void validateAll( Map<String,String> targetProperties, String appName, String instanceName ) throws TargetException { // Basic checks validate( targetProperties ); // Storage checks Set<String> mountPoints = new HashSet<> (); Set<String> volumeNames = new HashSet<> (); for( String s : findStorageIds( targetProperties )) { // Unit tests should guarantee there is a default value for the "mount point". String mountPoint = findStorageProperty( targetProperties, s, VOLUME_MOUNT_POINT_PREFIX ); if( mountPoints.contains( mountPoint )) throw new TargetException( "Mount point '" + mountPoint + "' is already used by another volume for this VM." ); mountPoints.add( mountPoint ); // Same thing for the volume name String volumeName = findStorageProperty( targetProperties, s, VOLUME_NAME_PREFIX ); volumeName = expandVolumeName( volumeName, appName, instanceName ); if( volumeNames.contains( volumeName )) throw new TargetException( "Volume name '" + volumeName + "' is already used by another volume for this VM." ); volumeNames.add( volumeName ); // Validate volume size String volumesize = findStorageProperty( targetProperties, s, VOLUME_SIZE_GB_PREFIX ); try { Integer.valueOf( volumesize ); } catch( NumberFormatException e ) { throw new TargetException( "The volume size must be a valid integer.", e ); } } }
[ "static", "void", "validateAll", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ",", "String", "appName", ",", "String", "instanceName", ")", "throws", "TargetException", "{", "// Basic checks", "validate", "(", "targetProperties", ")", ";", ...
Validates the target properties, including storage ones. @param targetProperties @param appName @param instanceName @throws TargetException
[ "Validates", "the", "target", "properties", "including", "storage", "ones", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L443-L478
train
roboconf/roboconf-platform
core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java
OpenstackIaasHandler.findStorageProperty
static String findStorageProperty( Map<String,String> targetProperties, String storageId, String propertyPrefix ) { String property = propertyPrefix + storageId; String value = targetProperties.get( property ); return Utils.isEmptyOrWhitespaces( value ) ? DEFAULTS.get( propertyPrefix ) : value.trim(); }
java
static String findStorageProperty( Map<String,String> targetProperties, String storageId, String propertyPrefix ) { String property = propertyPrefix + storageId; String value = targetProperties.get( property ); return Utils.isEmptyOrWhitespaces( value ) ? DEFAULTS.get( propertyPrefix ) : value.trim(); }
[ "static", "String", "findStorageProperty", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ",", "String", "storageId", ",", "String", "propertyPrefix", ")", "{", "String", "property", "=", "propertyPrefix", "+", "storageId", ";", "String", "va...
Finds a storage property for a given storage ID. @param targetProperties @param storageId @param propertyPrefix one of the constants defined in this class @return the property's value, or the default value otherwise, if one exists
[ "Finds", "a", "storage", "property", "for", "a", "given", "storage", "ID", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L517-L522
train
roboconf/roboconf-platform
core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java
OpenstackIaasHandler.expandVolumeName
static String expandVolumeName( String nameTemplate, String appName, String instanceName ) { String name = nameTemplate.replace( TPL_VOLUME_NAME, instanceName ); name = name.replace( TPL_VOLUME_APP, appName ); name = name.replaceAll( "[\\W_-]", "-" ); return name; }
java
static String expandVolumeName( String nameTemplate, String appName, String instanceName ) { String name = nameTemplate.replace( TPL_VOLUME_NAME, instanceName ); name = name.replace( TPL_VOLUME_APP, appName ); name = name.replaceAll( "[\\W_-]", "-" ); return name; }
[ "static", "String", "expandVolumeName", "(", "String", "nameTemplate", ",", "String", "appName", ",", "String", "instanceName", ")", "{", "String", "name", "=", "nameTemplate", ".", "replace", "(", "TPL_VOLUME_NAME", ",", "instanceName", ")", ";", "name", "=", ...
Updates a volume name by replacing template variables. @param nameTemplate (not null) @param appName (not null) @param instanceName (not null) @return a non-null string
[ "Updates", "a", "volume", "name", "by", "replacing", "template", "variables", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L532-L539
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/dsl/parsing/AbstractBlockHolder.java
AbstractBlockHolder.findPropertyBlockByName
public BlockProperty findPropertyBlockByName( String propertyName ) { BlockProperty result = null; for( AbstractBlock region : this.innerBlocks ) { if( region.getInstructionType() == PROPERTY && propertyName.equals(((BlockProperty) region).getName())) { result = (BlockProperty) region; break; } } return result; }
java
public BlockProperty findPropertyBlockByName( String propertyName ) { BlockProperty result = null; for( AbstractBlock region : this.innerBlocks ) { if( region.getInstructionType() == PROPERTY && propertyName.equals(((BlockProperty) region).getName())) { result = (BlockProperty) region; break; } } return result; }
[ "public", "BlockProperty", "findPropertyBlockByName", "(", "String", "propertyName", ")", "{", "BlockProperty", "result", "=", "null", ";", "for", "(", "AbstractBlock", "region", ":", "this", ".", "innerBlocks", ")", "{", "if", "(", "region", ".", "getInstructio...
Finds a property by its name among the ones this instance owns. @param propertyName not null @return the property, or null if it was not found
[ "Finds", "a", "property", "by", "its", "name", "among", "the", "ones", "this", "instance", "owns", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/parsing/AbstractBlockHolder.java#L94-L107
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/dsl/parsing/AbstractBlockHolder.java
AbstractBlockHolder.findPropertiesBlockByName
public List<BlockProperty> findPropertiesBlockByName( String propertyName ) { List<BlockProperty> result = new ArrayList<> (); for( AbstractBlock region : this.innerBlocks ) { if( region.getInstructionType() == PROPERTY && propertyName.equals(((BlockProperty) region).getName())) { result.add((BlockProperty) region); } } return result; }
java
public List<BlockProperty> findPropertiesBlockByName( String propertyName ) { List<BlockProperty> result = new ArrayList<> (); for( AbstractBlock region : this.innerBlocks ) { if( region.getInstructionType() == PROPERTY && propertyName.equals(((BlockProperty) region).getName())) { result.add((BlockProperty) region); } } return result; }
[ "public", "List", "<", "BlockProperty", ">", "findPropertiesBlockByName", "(", "String", "propertyName", ")", "{", "List", "<", "BlockProperty", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "AbstractBlock", "region", ":", "this", ...
Finds properties by name among the ones this instance owns. @param propertyName not null @return a non-null list of properties associated with this property name
[ "Finds", "properties", "by", "name", "among", "the", "ones", "this", "instance", "owns", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/parsing/AbstractBlockHolder.java#L114-L126
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/IconUtils.java
IconUtils.decodeIconUrl
public static Map.Entry<String,String> decodeIconUrl( String path ) { if( path.startsWith( "/" )) path = path.substring( 1 ); String name = null, version = null; String[] parts = path.split( "/" ); switch( parts.length ) { case 2: name = parts[ 0 ]; break; case 3: name = parts[ 0 ]; version = parts[ 1 ]; break; default: break; } return new AbstractMap.SimpleEntry<>( name, version ); }
java
public static Map.Entry<String,String> decodeIconUrl( String path ) { if( path.startsWith( "/" )) path = path.substring( 1 ); String name = null, version = null; String[] parts = path.split( "/" ); switch( parts.length ) { case 2: name = parts[ 0 ]; break; case 3: name = parts[ 0 ]; version = parts[ 1 ]; break; default: break; } return new AbstractMap.SimpleEntry<>( name, version ); }
[ "public", "static", "Map", ".", "Entry", "<", "String", ",", "String", ">", "decodeIconUrl", "(", "String", "path", ")", "{", "if", "(", "path", ".", "startsWith", "(", "\"/\"", ")", ")", "path", "=", "path", ".", "substring", "(", "1", ")", ";", "...
Decodes an URL path to extract a name and a potential version. @param path an URL path @return a non-null map entry (key = name, value = version)
[ "Decodes", "an", "URL", "path", "to", "extract", "a", "name", "and", "a", "potential", "version", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/IconUtils.java#L101-L123
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/IconUtils.java
IconUtils.findIconUrl
public static String findIconUrl( AbstractApplication app ) { StringBuilder sb = new StringBuilder(); File iconFile = findIcon( app ); if( iconFile != null ) { sb.append( "/" ); sb.append( app.getName()); if( app instanceof ApplicationTemplate ) { sb.append( "/" ); sb.append(((ApplicationTemplate) app).getVersion()); } sb.append( "/" ); sb.append( iconFile.getName()); } return sb.toString(); }
java
public static String findIconUrl( AbstractApplication app ) { StringBuilder sb = new StringBuilder(); File iconFile = findIcon( app ); if( iconFile != null ) { sb.append( "/" ); sb.append( app.getName()); if( app instanceof ApplicationTemplate ) { sb.append( "/" ); sb.append(((ApplicationTemplate) app).getVersion()); } sb.append( "/" ); sb.append( iconFile.getName()); } return sb.toString(); }
[ "public", "static", "String", "findIconUrl", "(", "AbstractApplication", "app", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "File", "iconFile", "=", "findIcon", "(", "app", ")", ";", "if", "(", "iconFile", "!=", "null", ")"...
Finds the URL to access the icon of an application or templates. @param app an application or an application template @return the empty string if no icon was found, a string otherwise
[ "Finds", "the", "URL", "to", "access", "the", "icon", "of", "an", "application", "or", "templates", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/IconUtils.java#L141-L159
train
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java
ParsingModelIo.writeConfigurationFile
public static String writeConfigurationFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator ) { return new FileDefinitionSerializer( lineSeparator ).write( relationsFile, writeComments ); }
java
public static String writeConfigurationFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator ) { return new FileDefinitionSerializer( lineSeparator ).write( relationsFile, writeComments ); }
[ "public", "static", "String", "writeConfigurationFile", "(", "FileDefinition", "relationsFile", ",", "boolean", "writeComments", ",", "String", "lineSeparator", ")", "{", "return", "new", "FileDefinitionSerializer", "(", "lineSeparator", ")", ".", "write", "(", "relat...
Writes a model into a string. @param relationsFile the relations file @param writeComments true to write comments @param lineSeparator the line separator (if null, the OS' one is used) @return a string (never null)
[ "Writes", "a", "model", "into", "a", "string", "." ]
add54eead479effb138d0ff53a2d637902b82702
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java#L75-L77
train