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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
zutnop/telekom-workflow-engine | telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/el/ElUtil.java | ElUtil.isReservedVariable | public static boolean isReservedVariable( String variableName ){
return ReservedVariables.NOW.equalsIgnoreCase( variableName ) || ReservedVariables.WORKFLOW_INSTANCE_ID.equalsIgnoreCase( variableName );
} | java | public static boolean isReservedVariable( String variableName ){
return ReservedVariables.NOW.equalsIgnoreCase( variableName ) || ReservedVariables.WORKFLOW_INSTANCE_ID.equalsIgnoreCase( variableName );
} | [
"public",
"static",
"boolean",
"isReservedVariable",
"(",
"String",
"variableName",
")",
"{",
"return",
"ReservedVariables",
".",
"NOW",
".",
"equalsIgnoreCase",
"(",
"variableName",
")",
"||",
"ReservedVariables",
".",
"WORKFLOW_INSTANCE_ID",
".",
"equalsIgnoreCase",
... | Checks if the given variable name is a reserved keyword and SHOULD NOT be used as a key for an Environment attribute. | [
"Checks",
"if",
"the",
"given",
"variable",
"name",
"is",
"a",
"reserved",
"keyword",
"and",
"SHOULD",
"NOT",
"be",
"used",
"as",
"a",
"key",
"for",
"an",
"Environment",
"attribute",
"."
] | f471f1f94013b3e2d56b4c9380e86e3a92c2ee29 | https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/el/ElUtil.java#L54-L56 | train |
zutnop/telekom-workflow-engine | telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/TransitionBuilder.java | TransitionBuilder.findIf | private Tree<Row> findIf( Tree<Row> pointer ){
while( !Type.IF.equals( pointer.getContent().getType() ) ){
pointer = pointer.getPrevious();
}
return pointer;
} | java | private Tree<Row> findIf( Tree<Row> pointer ){
while( !Type.IF.equals( pointer.getContent().getType() ) ){
pointer = pointer.getPrevious();
}
return pointer;
} | [
"private",
"Tree",
"<",
"Row",
">",
"findIf",
"(",
"Tree",
"<",
"Row",
">",
"pointer",
")",
"{",
"while",
"(",
"!",
"Type",
".",
"IF",
".",
"equals",
"(",
"pointer",
".",
"getContent",
"(",
")",
".",
"getType",
"(",
")",
")",
")",
"{",
"pointer",... | Finds the associate IF for an ELSE_IF, ELSE or END_IF pointer. | [
"Finds",
"the",
"associate",
"IF",
"for",
"an",
"ELSE_IF",
"ELSE",
"or",
"END_IF",
"pointer",
"."
] | f471f1f94013b3e2d56b4c9380e86e3a92c2ee29 | https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/TransitionBuilder.java#L153-L158 | train |
zutnop/telekom-workflow-engine | telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/TransitionBuilder.java | TransitionBuilder.findEndIf | private Tree<Row> findEndIf( Tree<Row> pointer ){
while( !Type.END_IF.equals( pointer.getContent().getType() ) ){
pointer = pointer.getNext();
}
return pointer;
} | java | private Tree<Row> findEndIf( Tree<Row> pointer ){
while( !Type.END_IF.equals( pointer.getContent().getType() ) ){
pointer = pointer.getNext();
}
return pointer;
} | [
"private",
"Tree",
"<",
"Row",
">",
"findEndIf",
"(",
"Tree",
"<",
"Row",
">",
"pointer",
")",
"{",
"while",
"(",
"!",
"Type",
".",
"END_IF",
".",
"equals",
"(",
"pointer",
".",
"getContent",
"(",
")",
".",
"getType",
"(",
")",
")",
")",
"{",
"po... | Finds the associate END_IF for an IF, ELSE_IF or ELSE pointer | [
"Finds",
"the",
"associate",
"END_IF",
"for",
"an",
"IF",
"ELSE_IF",
"or",
"ELSE",
"pointer"
] | f471f1f94013b3e2d56b4c9380e86e3a92c2ee29 | https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/TransitionBuilder.java#L163-L168 | train |
zutnop/telekom-workflow-engine | telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/TransitionBuilder.java | TransitionBuilder.findNext | private Tree<Row> findNext( Tree<Row> pointer ){
if( pointer.hasNext() ){
// The given tree-node is not the last in its block.
if( Type.END.equals( pointer.getNext().getContent().getType() ) ){
return null;
}
else{
return pointer.ge... | java | private Tree<Row> findNext( Tree<Row> pointer ){
if( pointer.hasNext() ){
// The given tree-node is not the last in its block.
if( Type.END.equals( pointer.getNext().getContent().getType() ) ){
return null;
}
else{
return pointer.ge... | [
"private",
"Tree",
"<",
"Row",
">",
"findNext",
"(",
"Tree",
"<",
"Row",
">",
"pointer",
")",
"{",
"if",
"(",
"pointer",
".",
"hasNext",
"(",
")",
")",
"{",
"// The given tree-node is not the last in its block.",
"if",
"(",
"Type",
".",
"END",
".",
"equals... | Finds the following node which to create a transition to.
Supports tree-nodes that are not the last in their block and those which are last. | [
"Finds",
"the",
"following",
"node",
"which",
"to",
"create",
"a",
"transition",
"to",
".",
"Supports",
"tree",
"-",
"nodes",
"that",
"are",
"not",
"the",
"last",
"in",
"their",
"block",
"and",
"those",
"which",
"are",
"last",
"."
] | f471f1f94013b3e2d56b4c9380e86e3a92c2ee29 | https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/TransitionBuilder.java#L183-L215 | train |
seedstack/business | core/src/main/java/org/seedstack/business/internal/utils/MethodMatcher.java | MethodMatcher.findMatchingMethod | public static Method findMatchingMethod(Class<?> classToInspect, Class<?> returnType, Object... params) {
Method[] methods = classToInspect.getMethods();
Method checkedMethod = null;
for (Method method : methods) {
Type[] parameterTypes = method.getParameterTypes();
// if... | java | public static Method findMatchingMethod(Class<?> classToInspect, Class<?> returnType, Object... params) {
Method[] methods = classToInspect.getMethods();
Method checkedMethod = null;
for (Method method : methods) {
Type[] parameterTypes = method.getParameterTypes();
// if... | [
"public",
"static",
"Method",
"findMatchingMethod",
"(",
"Class",
"<",
"?",
">",
"classToInspect",
",",
"Class",
"<",
"?",
">",
"returnType",
",",
"Object",
"...",
"params",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"classToInspect",
".",
"getMethods",
... | Finds a method matching the given parameters and return type. | [
"Finds",
"a",
"method",
"matching",
"the",
"given",
"parameters",
"and",
"return",
"type",
"."
] | 55b3e861fe152e9b125ebc69daa91a682deeae8a | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/MethodMatcher.java#L27-L48 | train |
seedstack/business | core/src/main/java/org/seedstack/business/internal/utils/MethodMatcher.java | MethodMatcher.findMatchingConstructor | @SuppressWarnings("unchecked")
public static <T> Constructor<T> findMatchingConstructor(Class<T> classToInspect, Object... params) {
Constructor<T> checkedConstructors = null;
for (Constructor<?> constructor : classToInspect.getDeclaredConstructors()) {
Type[] parameterTypes = constructo... | java | @SuppressWarnings("unchecked")
public static <T> Constructor<T> findMatchingConstructor(Class<T> classToInspect, Object... params) {
Constructor<T> checkedConstructors = null;
for (Constructor<?> constructor : classToInspect.getDeclaredConstructors()) {
Type[] parameterTypes = constructo... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"findMatchingConstructor",
"(",
"Class",
"<",
"T",
">",
"classToInspect",
",",
"Object",
"...",
"params",
")",
"{",
"Constructor",
"<",
"T",
... | Finds a constructor matching the given parameters. | [
"Finds",
"a",
"constructor",
"matching",
"the",
"given",
"parameters",
"."
] | 55b3e861fe152e9b125ebc69daa91a682deeae8a | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/MethodMatcher.java#L53-L71 | train |
seedstack/business | core/src/main/java/org/seedstack/business/spi/BaseDtoInfoResolver.java | BaseDtoInfoResolver.createFromFactory | protected <A extends AggregateRoot<?>> A createFromFactory(Class<A> aggregateClass, Object... parameters) {
checkNotNull(aggregateClass);
checkNotNull(parameters);
Factory<A> factory = domainRegistry.getFactory(aggregateClass);
// Find the method in the factory which match the signatur... | java | protected <A extends AggregateRoot<?>> A createFromFactory(Class<A> aggregateClass, Object... parameters) {
checkNotNull(aggregateClass);
checkNotNull(parameters);
Factory<A> factory = domainRegistry.getFactory(aggregateClass);
// Find the method in the factory which match the signatur... | [
"protected",
"<",
"A",
"extends",
"AggregateRoot",
"<",
"?",
">",
">",
"A",
"createFromFactory",
"(",
"Class",
"<",
"A",
">",
"aggregateClass",
",",
"Object",
"...",
"parameters",
")",
"{",
"checkNotNull",
"(",
"aggregateClass",
")",
";",
"checkNotNull",
"("... | Implements the logic to create an aggregate.
@param aggregateClass the aggregate class.
@param parameters the parameters to pass to the factory if any.
@param <A> the type of the aggregate root.
@return the aggregate root. | [
"Implements",
"the",
"logic",
"to",
"create",
"an",
"aggregate",
"."
] | 55b3e861fe152e9b125ebc69daa91a682deeae8a | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/spi/BaseDtoInfoResolver.java#L75-L117 | train |
sap-production/xcode-maven-plugin | modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/DomUtils.java | DomUtils.serialize | static void serialize(final Document doc, final OutputStream os, final String encoding)
throws TransformerFactoryConfigurationError, TransformerException, IOException
{
if (doc == null)
throw new IllegalArgumentException("No document provided.");
if (os == null)
throw new IllegalArgumentE... | java | static void serialize(final Document doc, final OutputStream os, final String encoding)
throws TransformerFactoryConfigurationError, TransformerException, IOException
{
if (doc == null)
throw new IllegalArgumentException("No document provided.");
if (os == null)
throw new IllegalArgumentE... | [
"static",
"void",
"serialize",
"(",
"final",
"Document",
"doc",
",",
"final",
"OutputStream",
"os",
",",
"final",
"String",
"encoding",
")",
"throws",
"TransformerFactoryConfigurationError",
",",
"TransformerException",
",",
"IOException",
"{",
"if",
"(",
"doc",
"... | Serializes a DOM. The OutputStream handed over to this method is not closed inside this method. | [
"Serializes",
"a",
"DOM",
".",
"The",
"OutputStream",
"handed",
"over",
"to",
"this",
"method",
"is",
"not",
"closed",
"inside",
"this",
"method",
"."
] | 3f8aa380f501a1d7602f33fef2f6348354e7eb7c | https://github.com/sap-production/xcode-maven-plugin/blob/3f8aa380f501a1d7602f33fef2f6348354e7eb7c/modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/DomUtils.java#L54-L78 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Messages/TransmittableSysexMessage.java | TransmittableSysexMessage.toByteArray | @Override
public byte[] toByteArray() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16);
outputStream.write(commandByte);
outputStream.write(sysexCommandByte);
if (serialize(outputStream)) {
outputStream.write(CommandBytes.END_SYSEX.getCommandByte());... | java | @Override
public byte[] toByteArray() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16);
outputStream.write(commandByte);
outputStream.write(sysexCommandByte);
if (serialize(outputStream)) {
outputStream.write(CommandBytes.END_SYSEX.getCommandByte());... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"ByteArrayOutputStream",
"outputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
"16",
")",
";",
"outputStream",
".",
"write",
"(",
"commandByte",
")",
";",
"outputStream",
".",
"writ... | Combine the SysexCommandByte and the serialized sysex message packet together to form a Firmata supported
sysex byte packet to be sent over the SerialPort.
@return byte[] array representing the full Firmata sysex command packet to be sent to the Firmata device. | [
"Combine",
"the",
"SysexCommandByte",
"and",
"the",
"serialized",
"sysex",
"message",
"packet",
"together",
"to",
"form",
"a",
"Firmata",
"supported",
"sysex",
"byte",
"packet",
"to",
"be",
"sent",
"over",
"the",
"SerialPort",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Messages/TransmittableSysexMessage.java#L46-L59 | train |
yongjhih/SwitchPreferenceCompat | app/src/main/java/com/cgollner/unclouded/preferences/sample/SettingsActivity.java | SettingsActivity.isValidFragment | @Override
protected boolean isValidFragment(String fragmentName) {
Boolean knownFrag = false;
for (Class<?> cls : INNER_CLASSES) {
if ( cls.getName().equals(fragmentName) ){
knownFrag = true;
break;
}
}
return knownFrag;
... | java | @Override
protected boolean isValidFragment(String fragmentName) {
Boolean knownFrag = false;
for (Class<?> cls : INNER_CLASSES) {
if ( cls.getName().equals(fragmentName) ){
knownFrag = true;
break;
}
}
return knownFrag;
... | [
"@",
"Override",
"protected",
"boolean",
"isValidFragment",
"(",
"String",
"fragmentName",
")",
"{",
"Boolean",
"knownFrag",
"=",
"false",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"cls",
":",
"INNER_CLASSES",
")",
"{",
"if",
"(",
"cls",
".",
"getName",
"... | Google found a 'security vulnerability' and imposed this hack.
Have to check this fragment was actually conceived by this activity. | [
"Google",
"found",
"a",
"security",
"vulnerability",
"and",
"imposed",
"this",
"hack",
".",
"Have",
"to",
"check",
"this",
"fragment",
"was",
"actually",
"conceived",
"by",
"this",
"activity",
"."
] | e7d4ff0d51b882b88c3d537ef7428ca9e4e3d492 | https://github.com/yongjhih/SwitchPreferenceCompat/blob/e7d4ff0d51b882b88c3d537ef7428ca9e4e3d492/app/src/main/java/com/cgollner/unclouded/preferences/sample/SettingsActivity.java#L51-L67 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Messages/TransmittableMessage.java | TransmittableMessage.toByteArray | public byte[] toByteArray() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(32);
outputStream.write(commandByte);
if (serialize(outputStream)) {
return outputStream.toByteArray();
}
return null;
} | java | public byte[] toByteArray() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(32);
outputStream.write(commandByte);
if (serialize(outputStream)) {
return outputStream.toByteArray();
}
return null;
} | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"ByteArrayOutputStream",
"outputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
"32",
")",
";",
"outputStream",
".",
"write",
"(",
"commandByte",
")",
";",
"if",
"(",
"serialize",
"(",
"outputStream"... | Combine the CommandByte and the serialized message packet together to form a Firmata supported
byte packet to be sent over the SerialPort.
@return true if no errors building message | [
"Combine",
"the",
"CommandByte",
"and",
"the",
"serialized",
"message",
"packet",
"together",
"to",
"form",
"a",
"Firmata",
"supported",
"byte",
"packet",
"to",
"be",
"sent",
"over",
"the",
"SerialPort",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Messages/TransmittableMessage.java#L51-L61 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/PortAdapters/SerialPort.java | SerialPort.fireEvent | protected void fireEvent(SerialPortEventTypes eventType) {
executor.submit(new Runnable() {
@Override
public void run() {
for (SerialPortEventListener listener : eventListeners) {
listener.serialEvent(new SerialPortEvent(eventType));
}
... | java | protected void fireEvent(SerialPortEventTypes eventType) {
executor.submit(new Runnable() {
@Override
public void run() {
for (SerialPortEventListener listener : eventListeners) {
listener.serialEvent(new SerialPortEvent(eventType));
}
... | [
"protected",
"void",
"fireEvent",
"(",
"SerialPortEventTypes",
"eventType",
")",
"{",
"executor",
".",
"submit",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"for",
"(",
"SerialPortEventListener",
"listener",
... | Tell the client if there is data available, etc. | [
"Tell",
"the",
"client",
"if",
"there",
"is",
"data",
"available",
"etc",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/PortAdapters/SerialPort.java#L70-L80 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Messages/SysexCapabilityMessage.java | SysexCapabilityMessage.getPinCapabilities | public ArrayList<PinCapability> getPinCapabilities(Integer pin) {
if (pinCapabilities.size() >= pin) {
return pinCapabilities.get(pin);
}
return null;
} | java | public ArrayList<PinCapability> getPinCapabilities(Integer pin) {
if (pinCapabilities.size() >= pin) {
return pinCapabilities.get(pin);
}
return null;
} | [
"public",
"ArrayList",
"<",
"PinCapability",
">",
"getPinCapabilities",
"(",
"Integer",
"pin",
")",
"{",
"if",
"(",
"pinCapabilities",
".",
"size",
"(",
")",
">=",
"pin",
")",
"{",
"return",
"pinCapabilities",
".",
"get",
"(",
"pin",
")",
";",
"}",
"retu... | Get Pin Capabilities
Get a list of modes that a given pin supports.
@param pin Integer value representing the Firmata pin that we want to know the supported capabilities of.
@return ArrayList of PinCapability that the given pin index supports.\
Null if there is no pin at the given index. | [
"Get",
"Pin",
"Capabilities",
"Get",
"a",
"list",
"of",
"modes",
"that",
"a",
"given",
"pin",
"supports",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Messages/SysexCapabilityMessage.java#L36-L41 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.addMessageListener | public void addMessageListener(Integer channel, MessageListener<? extends Message> messageListener) {
addListener(channel, messageListener.getMessageType(), messageListener);
} | java | public void addMessageListener(Integer channel, MessageListener<? extends Message> messageListener) {
addListener(channel, messageListener.getMessageType(), messageListener);
} | [
"public",
"void",
"addMessageListener",
"(",
"Integer",
"channel",
",",
"MessageListener",
"<",
"?",
"extends",
"Message",
">",
"messageListener",
")",
"{",
"addListener",
"(",
"channel",
",",
"messageListener",
".",
"getMessageType",
"(",
")",
",",
"messageListen... | Add a messageListener to the Firmta object which will fire whenever a matching message is received
over the SerialPort that corresponds to the given channel.
@param channel Integer indicating the specific channel or pin to listen on
@param messageListener MessageListener object to handle a received Message event over ... | [
"Add",
"a",
"messageListener",
"to",
"the",
"Firmta",
"object",
"which",
"will",
"fire",
"whenever",
"a",
"matching",
"message",
"is",
"received",
"over",
"the",
"SerialPort",
"that",
"corresponds",
"to",
"the",
"given",
"channel",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L174-L176 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.addMessageListener | public void addMessageListener(DigitalChannel channel, MessageListener<? extends Message> messageListener) {
addListener(channel.getIdentifier(), messageListener.getMessageType(), messageListener);
} | java | public void addMessageListener(DigitalChannel channel, MessageListener<? extends Message> messageListener) {
addListener(channel.getIdentifier(), messageListener.getMessageType(), messageListener);
} | [
"public",
"void",
"addMessageListener",
"(",
"DigitalChannel",
"channel",
",",
"MessageListener",
"<",
"?",
"extends",
"Message",
">",
"messageListener",
")",
"{",
"addListener",
"(",
"channel",
".",
"getIdentifier",
"(",
")",
",",
"messageListener",
".",
"getMess... | Add a messageListener to the Firmata object which will fire whenever a matching message is received
over the SerialPort that corresponds to the given DigitalChannel.
@param channel DigitalChannel to listen on
@param messageListener MessageListener object to handle a received Message event over the SerialPort. | [
"Add",
"a",
"messageListener",
"to",
"the",
"Firmata",
"object",
"which",
"will",
"fire",
"whenever",
"a",
"matching",
"message",
"is",
"received",
"over",
"the",
"SerialPort",
"that",
"corresponds",
"to",
"the",
"given",
"DigitalChannel",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L185-L187 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.addMessageListener | public void addMessageListener(Class<? extends Message> messageClass, MessageListener<Message> messageListener) {
addMessageListener(messageListener.getChannelIdentifier(), messageClass, messageListener);
} | java | public void addMessageListener(Class<? extends Message> messageClass, MessageListener<Message> messageListener) {
addMessageListener(messageListener.getChannelIdentifier(), messageClass, messageListener);
} | [
"public",
"void",
"addMessageListener",
"(",
"Class",
"<",
"?",
"extends",
"Message",
">",
"messageClass",
",",
"MessageListener",
"<",
"Message",
">",
"messageListener",
")",
"{",
"addMessageListener",
"(",
"messageListener",
".",
"getChannelIdentifier",
"(",
")",
... | Add a generic message listener to listen for a specific type of message. Useful if you want to combine
several or more message handlers into one bucket.
@param messageClass Message class to listen to from the project board.
@param messageListener (Generic)Listener that will fire whenever the message type is received. | [
"Add",
"a",
"generic",
"message",
"listener",
"to",
"listen",
"for",
"a",
"specific",
"type",
"of",
"message",
".",
"Useful",
"if",
"you",
"want",
"to",
"combine",
"several",
"or",
"more",
"message",
"handlers",
"into",
"one",
"bucket",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L195-L197 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.removeMessageListener | public void removeMessageListener(Class<? extends Message> messageClass,
MessageListener<Message> messageListener) {
removeMessageListener(messageListener.getChannelIdentifier(), messageClass, messageListener);
} | java | public void removeMessageListener(Class<? extends Message> messageClass,
MessageListener<Message> messageListener) {
removeMessageListener(messageListener.getChannelIdentifier(), messageClass, messageListener);
} | [
"public",
"void",
"removeMessageListener",
"(",
"Class",
"<",
"?",
"extends",
"Message",
">",
"messageClass",
",",
"MessageListener",
"<",
"Message",
">",
"messageListener",
")",
"{",
"removeMessageListener",
"(",
"messageListener",
".",
"getChannelIdentifier",
"(",
... | Remove a generic message listener from listening to a specific type of message.
@param messageClass Message class to stop listening to.
@param messageListener (Generic)Listener to remove from the listener list for the given messageClass. | [
"Remove",
"a",
"generic",
"message",
"listener",
"from",
"listening",
"to",
"a",
"specific",
"type",
"of",
"message",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L268-L271 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.sendMessage | public synchronized Boolean sendMessage(TransmittableMessage message) {
if (!start()) {
log.error("Firmata library is not connected / started! Cannot send message {}",
message.getClass().getSimpleName());
return false;
}
try {
log.debug("T... | java | public synchronized Boolean sendMessage(TransmittableMessage message) {
if (!start()) {
log.error("Firmata library is not connected / started! Cannot send message {}",
message.getClass().getSimpleName());
return false;
}
try {
log.debug("T... | [
"public",
"synchronized",
"Boolean",
"sendMessage",
"(",
"TransmittableMessage",
"message",
")",
"{",
"if",
"(",
"!",
"start",
"(",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"Firmata library is not connected / started! Cannot send message {}\"",
",",
"message",
".",
... | Send a Message over the serial port to a Firmata supported device.
@param message TransmittableMessage object used to translate a series of bytes to the SerialPort.
@return True if the Message sent. False if the Message was not sent. | [
"Send",
"a",
"Message",
"over",
"the",
"serial",
"port",
"to",
"a",
"Firmata",
"supported",
"device",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L316-L334 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.sendRaw | public synchronized Boolean sendRaw(byte... rawBytes) {
if (!start()) {
log.error("Firmata library is not connected / started! Cannot send bytes {}",
FirmataHelper.bytesToHexString(rawBytes));
return false;
}
try {
serialPort.getOutputStre... | java | public synchronized Boolean sendRaw(byte... rawBytes) {
if (!start()) {
log.error("Firmata library is not connected / started! Cannot send bytes {}",
FirmataHelper.bytesToHexString(rawBytes));
return false;
}
try {
serialPort.getOutputStre... | [
"public",
"synchronized",
"Boolean",
"sendRaw",
"(",
"byte",
"...",
"rawBytes",
")",
"{",
"if",
"(",
"!",
"start",
"(",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"Firmata library is not connected / started! Cannot send bytes {}\"",
",",
"FirmataHelper",
".",
"byt... | Send a series of raw bytes over the serial port to a Firmata supported device.
@param rawBytes byte array to be sent over the SerialPort OutputStream.
@return True if the bytes were sent. False if the bytes were not sent. | [
"Send",
"a",
"series",
"of",
"raw",
"bytes",
"over",
"the",
"serial",
"port",
"to",
"a",
"Firmata",
"supported",
"device",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L369-L386 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.start | public synchronized Boolean start() {
if (started) {
return true;
}
createSerialPort();
serialPort.addEventListener(this);
if (!serialPort.connect()) {
log.error("Failed to start Firmata Library. Cannot connect to Serial Port.");
log.error("... | java | public synchronized Boolean start() {
if (started) {
return true;
}
createSerialPort();
serialPort.addEventListener(this);
if (!serialPort.connect()) {
log.error("Failed to start Firmata Library. Cannot connect to Serial Port.");
log.error("... | [
"public",
"synchronized",
"Boolean",
"start",
"(",
")",
"{",
"if",
"(",
"started",
")",
"{",
"return",
"true",
";",
"}",
"createSerialPort",
"(",
")",
";",
"serialPort",
".",
"addEventListener",
"(",
"this",
")",
";",
"if",
"(",
"!",
"serialPort",
".",
... | Starts the firmata library. If the library is already started this will just return true.
Starts the SerialPort and handlers, and ensures the attached device is able to communicate with our
library. This will return an UnsupportedDevice exception if the attached device does not meet the library
requirements.
@return T... | [
"Starts",
"the",
"firmata",
"library",
".",
"If",
"the",
"library",
"is",
"already",
"started",
"this",
"will",
"just",
"return",
"true",
".",
"Starts",
"the",
"SerialPort",
"and",
"handlers",
"and",
"ensures",
"the",
"attached",
"device",
"is",
"able",
"to"... | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L398-L423 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.stop | public synchronized Boolean stop() {
if (serialPort != null) {
serialPort.removeEventListener(this);
}
if (!removeSerialPort()) {
log.error("Failed to stop Firmata Library. Cannot close Serial Port.");
log.error("Configuration is {}", configuration);
... | java | public synchronized Boolean stop() {
if (serialPort != null) {
serialPort.removeEventListener(this);
}
if (!removeSerialPort()) {
log.error("Failed to stop Firmata Library. Cannot close Serial Port.");
log.error("Configuration is {}", configuration);
... | [
"public",
"synchronized",
"Boolean",
"stop",
"(",
")",
"{",
"if",
"(",
"serialPort",
"!=",
"null",
")",
"{",
"serialPort",
".",
"removeEventListener",
"(",
"this",
")",
";",
"}",
"if",
"(",
"!",
"removeSerialPort",
"(",
")",
")",
"{",
"log",
".",
"erro... | Stops the Firmata library. If the library is already stopped, this will still attempt to stop anything
that may still be lingering. Take note that many calls could eventually result in noticeable cpu usage.
@return True if the library has stopped. False if there was an error stopping the library. | [
"Stops",
"the",
"Firmata",
"library",
".",
"If",
"the",
"library",
"is",
"already",
"stopped",
"this",
"will",
"still",
"attempt",
"to",
"stop",
"anything",
"that",
"may",
"still",
"be",
"lingering",
".",
"Take",
"note",
"that",
"many",
"calls",
"could",
"... | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L431-L444 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.createSerialPort | private void createSerialPort() {
Constructor<? extends SerialPort> constructor;
try {
constructor = configuration.getSerialPortAdapterClass().getDeclaredConstructor(
String.class, Integer.class,
SerialPortDataBits.class, SerialPortStopBits.class, Ser... | java | private void createSerialPort() {
Constructor<? extends SerialPort> constructor;
try {
constructor = configuration.getSerialPortAdapterClass().getDeclaredConstructor(
String.class, Integer.class,
SerialPortDataBits.class, SerialPortStopBits.class, Ser... | [
"private",
"void",
"createSerialPort",
"(",
")",
"{",
"Constructor",
"<",
"?",
"extends",
"SerialPort",
">",
"constructor",
";",
"try",
"{",
"constructor",
"=",
"configuration",
".",
"getSerialPortAdapterClass",
"(",
")",
".",
"getDeclaredConstructor",
"(",
"Strin... | Generate the SerialPort object using the SerialPort adapter class provided in the FirmataConfiguration
If there is any issue constructing this object, toss a RuntimeException, as this is a developer error in
implementing the SerialPort adapter for this library. | [
"Generate",
"the",
"SerialPort",
"object",
"using",
"the",
"SerialPort",
"adapter",
"class",
"provided",
"in",
"the",
"FirmataConfiguration",
"If",
"there",
"is",
"any",
"issue",
"constructing",
"this",
"object",
"toss",
"a",
"RuntimeException",
"as",
"this",
"is"... | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L499-L528 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.removeSerialPort | private Boolean removeSerialPort() {
Boolean ret = true;
if (serialPort != null) {
ret = serialPort.disconnect();
serialPort = null;
}
return ret;
} | java | private Boolean removeSerialPort() {
Boolean ret = true;
if (serialPort != null) {
ret = serialPort.disconnect();
serialPort = null;
}
return ret;
} | [
"private",
"Boolean",
"removeSerialPort",
"(",
")",
"{",
"Boolean",
"ret",
"=",
"true",
";",
"if",
"(",
"serialPort",
"!=",
"null",
")",
"{",
"ret",
"=",
"serialPort",
".",
"disconnect",
"(",
")",
";",
"serialPort",
"=",
"null",
";",
"}",
"return",
"re... | Disconnect from the SerialPort object that we are communicating with over the Firmata protocol.
@return True if the SerialPort was closed. False if the port failed to close. | [
"Disconnect",
"from",
"the",
"SerialPort",
"object",
"that",
"we",
"are",
"communicating",
"with",
"over",
"the",
"Firmata",
"protocol",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L535-L544 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.handleDataAvailable | private void handleDataAvailable() {
InputStream inputStream = serialPort.getInputStream();
try {
while (inputStream.available() > 0) {
byte inputByte = (byte) inputStream.read();
if (inputByte == -1) {
log.error("Reached end of stream try... | java | private void handleDataAvailable() {
InputStream inputStream = serialPort.getInputStream();
try {
while (inputStream.available() > 0) {
byte inputByte = (byte) inputStream.read();
if (inputByte == -1) {
log.error("Reached end of stream try... | [
"private",
"void",
"handleDataAvailable",
"(",
")",
"{",
"InputStream",
"inputStream",
"=",
"serialPort",
".",
"getInputStream",
"(",
")",
";",
"try",
"{",
"while",
"(",
"inputStream",
".",
"available",
"(",
")",
">",
"0",
")",
"{",
"byte",
"inputByte",
"=... | Handles the SerialPort input stream and builds a message object if a detected CommandByte is discovered
over the communications stream. | [
"Handles",
"the",
"SerialPort",
"input",
"stream",
"and",
"builds",
"a",
"message",
"object",
"if",
"a",
"detected",
"CommandByte",
"is",
"discovered",
"over",
"the",
"communications",
"stream",
"."
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L564-L588 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.routeMessage | private void routeMessage(Message message) {
Class messageClass = message.getClass();
// Dispatch message to all specific listeners for the message class type
if (messageListenerMap.containsKey(messageClass)) {
dispatchMessage(messageListenerMap.get(messageClass), message);
... | java | private void routeMessage(Message message) {
Class messageClass = message.getClass();
// Dispatch message to all specific listeners for the message class type
if (messageListenerMap.containsKey(messageClass)) {
dispatchMessage(messageListenerMap.get(messageClass), message);
... | [
"private",
"void",
"routeMessage",
"(",
"Message",
"message",
")",
"{",
"Class",
"messageClass",
"=",
"message",
".",
"getClass",
"(",
")",
";",
"// Dispatch message to all specific listeners for the message class type",
"if",
"(",
"messageListenerMap",
".",
"containsKey"... | Route a Message object built from data over the SerialPort communication line to a corresponding
MessageListener array designed to handle and interpret the object for processing in the client code.
@param message Firmata Message to be routed to the registered listeners. | [
"Route",
"a",
"Message",
"object",
"built",
"from",
"data",
"over",
"the",
"SerialPort",
"communication",
"line",
"to",
"a",
"corresponding",
"MessageListener",
"array",
"designed",
"to",
"handle",
"and",
"interpret",
"the",
"object",
"for",
"processing",
"in",
... | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L596-L608 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.dispatchMessage | @SuppressWarnings("unchecked")
private void dispatchMessage(ArrayListMultimap<Integer, MessageListener> listenerMap, Message message) {
List<MessageListener> messageListeners;
// If the message is a Channel Message, hit the channel based listeners first.
if (message instanceof ChannelMessag... | java | @SuppressWarnings("unchecked")
private void dispatchMessage(ArrayListMultimap<Integer, MessageListener> listenerMap, Message message) {
List<MessageListener> messageListeners;
// If the message is a Channel Message, hit the channel based listeners first.
if (message instanceof ChannelMessag... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"dispatchMessage",
"(",
"ArrayListMultimap",
"<",
"Integer",
",",
"MessageListener",
">",
"listenerMap",
",",
"Message",
"message",
")",
"{",
"List",
"<",
"MessageListener",
">",
"messageListener... | Dispatch a message to the corresponding listener arrays in the listener map
@param listenerMap ArrayListMultimap of listener arrays to dispatch the message to
@param message Message to be dispatched to the listeners | [
"Dispatch",
"a",
"message",
"to",
"the",
"corresponding",
"listener",
"arrays",
"in",
"the",
"listener",
"map"
] | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L615-L637 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Parser/CommandParser.java | CommandParser.handleInputStream | public Message handleInputStream(byte commandByte, InputStream inputStream) {
// Firmata command bytes are limited to a 0xF0 mask, or bytes 0xF0-0xFF
// The extra data in the byte is for routing the command to various 'midi channels'
// or in our case Firmata device pins.
byte firmat... | java | public Message handleInputStream(byte commandByte, InputStream inputStream) {
// Firmata command bytes are limited to a 0xF0 mask, or bytes 0xF0-0xFF
// The extra data in the byte is for routing the command to various 'midi channels'
// or in our case Firmata device pins.
byte firmat... | [
"public",
"Message",
"handleInputStream",
"(",
"byte",
"commandByte",
",",
"InputStream",
"inputStream",
")",
"{",
"// Firmata command bytes are limited to a 0xF0 mask, or bytes 0xF0-0xFF",
"// The extra data in the byte is for routing the command to various 'midi channels'",
"// or in... | Attempts to identify the corresponding Firmata Message object that responds to the given commandByte
If found, it will ask for the message to be built using given inputStream. The builder will take away
any bytes necessary to build the message and then return. To attempt to identify the correct message
we must mask the... | [
"Attempts",
"to",
"identify",
"the",
"corresponding",
"Firmata",
"Message",
"object",
"that",
"responds",
"to",
"the",
"given",
"commandByte",
"If",
"found",
"it",
"will",
"ask",
"for",
"the",
"message",
"to",
"be",
"built",
"using",
"given",
"inputStream",
".... | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Parser/CommandParser.java#L126-L147 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/SynchronousMessageListener.java | SynchronousMessageListener.messageReceived | @Override
public void messageReceived(T message) {
if (responseReceived != null) {
if (responseReceived) {
log.warn("Received more than one synchronous message reply!");
}
else {
log.warn("Received response message after timeout was hit!");... | java | @Override
public void messageReceived(T message) {
if (responseReceived != null) {
if (responseReceived) {
log.warn("Received more than one synchronous message reply!");
}
else {
log.warn("Received response message after timeout was hit!");... | [
"@",
"Override",
"public",
"void",
"messageReceived",
"(",
"T",
"message",
")",
"{",
"if",
"(",
"responseReceived",
"!=",
"null",
")",
"{",
"if",
"(",
"responseReceived",
")",
"{",
"log",
".",
"warn",
"(",
"\"Received more than one synchronous message reply!\"",
... | When we get our expected message response. Save the message object, and notify the waiting thread
that the message is now available to be passed back.
This method attempts to handle and warn against cases where multiple messages came in, or a message
came in after the timeout period.
@param message Message response fro... | [
"When",
"we",
"get",
"our",
"expected",
"message",
"response",
".",
"Save",
"the",
"message",
"object",
"and",
"notify",
"the",
"waiting",
"thread",
"that",
"the",
"message",
"is",
"now",
"available",
"to",
"be",
"passed",
"back",
".",
"This",
"method",
"a... | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/SynchronousMessageListener.java#L35-L52 | train |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Parser/SysexCommandParser.java | SysexCommandParser.buildMessage | @Override
public Message buildMessage(Byte channelByte, InputStream inputStream) {
byte sysexCommandByte;
try {
sysexCommandByte = (byte) inputStream.read();
} catch (IOException e) {
log.error("Error reading Sysex command byte.");
return null;
}
... | java | @Override
public Message buildMessage(Byte channelByte, InputStream inputStream) {
byte sysexCommandByte;
try {
sysexCommandByte = (byte) inputStream.read();
} catch (IOException e) {
log.error("Error reading Sysex command byte.");
return null;
}
... | [
"@",
"Override",
"public",
"Message",
"buildMessage",
"(",
"Byte",
"channelByte",
",",
"InputStream",
"inputStream",
")",
"{",
"byte",
"sysexCommandByte",
";",
"try",
"{",
"sysexCommandByte",
"=",
"(",
"byte",
")",
"inputStream",
".",
"read",
"(",
")",
";",
... | Attempts to identify the corresponding Firmata Sysex Message object that responds to the
identified sysexCommandByte. If found, it will ask for the sysex message to be built using
the identified bytes between the sysexCommandByte and the END_SYSEX commandByte later in the input stream.
@param channelByte channelByte i... | [
"Attempts",
"to",
"identify",
"the",
"corresponding",
"Firmata",
"Sysex",
"Message",
"object",
"that",
"responds",
"to",
"the",
"identified",
"sysexCommandByte",
".",
"If",
"found",
"it",
"will",
"ask",
"for",
"the",
"sysex",
"message",
"to",
"be",
"built",
"u... | 39c26c1a577b8fff8690245e105cb62e02284f16 | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Parser/SysexCommandParser.java#L106-L148 | train |
StripesFramework/stripes-xss | src/main/java/com/samaxes/stripes/xss/SafeHtmlUtil.java | SafeHtmlUtil.sanitize | public static String sanitize(String raw) {
return (raw == null || raw.length() == 0) ? raw : HTMLEntityEncode(canonicalize(raw));
} | java | public static String sanitize(String raw) {
return (raw == null || raw.length() == 0) ? raw : HTMLEntityEncode(canonicalize(raw));
} | [
"public",
"static",
"String",
"sanitize",
"(",
"String",
"raw",
")",
"{",
"return",
"(",
"raw",
"==",
"null",
"||",
"raw",
".",
"length",
"(",
")",
"==",
"0",
")",
"?",
"raw",
":",
"HTMLEntityEncode",
"(",
"canonicalize",
"(",
"raw",
")",
")",
";",
... | Sanitize user inputs.
@param raw the input string to be sanitized
@return the sanitized string | [
"Sanitize",
"user",
"inputs",
"."
] | f78ba9eaa2a6cb4fc287dd3a250b9daaafc07ea6 | https://github.com/StripesFramework/stripes-xss/blob/f78ba9eaa2a6cb4fc287dd3a250b9daaafc07ea6/src/main/java/com/samaxes/stripes/xss/SafeHtmlUtil.java#L40-L42 | train |
StripesFramework/stripes-xss | src/main/java/com/samaxes/stripes/xss/SafeHtmlUtil.java | SafeHtmlUtil.HTMLEntityEncode | public static String HTMLEntityEncode(String input) {
String next = scriptPattern.matcher(input).replaceAll("script");
StringBuffer sb = new StringBuffer();
for (int i = 0; i < next.length(); ++i) {
char ch = next.charAt(i);
if (ch == '<') {
sb.appe... | java | public static String HTMLEntityEncode(String input) {
String next = scriptPattern.matcher(input).replaceAll("script");
StringBuffer sb = new StringBuffer();
for (int i = 0; i < next.length(); ++i) {
char ch = next.charAt(i);
if (ch == '<') {
sb.appe... | [
"public",
"static",
"String",
"HTMLEntityEncode",
"(",
"String",
"input",
")",
"{",
"String",
"next",
"=",
"scriptPattern",
".",
"matcher",
"(",
"input",
")",
".",
"replaceAll",
"(",
"\"script\"",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer"... | Encode HTML entities.
@param input the input string to be encoded
@return the encoded string | [
"Encode",
"HTML",
"entities",
"."
] | f78ba9eaa2a6cb4fc287dd3a250b9daaafc07ea6 | https://github.com/StripesFramework/stripes-xss/blob/f78ba9eaa2a6cb4fc287dd3a250b9daaafc07ea6/src/main/java/com/samaxes/stripes/xss/SafeHtmlUtil.java#L50-L67 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultConnectionOutputBatch.java | DefaultConnectionOutputBatch.checkEnd | private void checkEnd() {
if (ended && !closed && children == 0) {
closed = true;
connection.doBatchEnd(id, endArgs);
if (endHandler != null) {
endHandler.handle((Void) null);
}
}
} | java | private void checkEnd() {
if (ended && !closed && children == 0) {
closed = true;
connection.doBatchEnd(id, endArgs);
if (endHandler != null) {
endHandler.handle((Void) null);
}
}
} | [
"private",
"void",
"checkEnd",
"(",
")",
"{",
"if",
"(",
"ended",
"&&",
"!",
"closed",
"&&",
"children",
"==",
"0",
")",
"{",
"closed",
"=",
"true",
";",
"connection",
".",
"doBatchEnd",
"(",
"id",
",",
"endArgs",
")",
";",
"if",
"(",
"endHandler",
... | Checks whether the batch is complete. | [
"Checks",
"whether",
"the",
"batch",
"is",
"complete",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultConnectionOutputBatch.java#L127-L135 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultConnectionOutputBatch.java | DefaultConnectionOutputBatch.start | void start(Handler<ConnectionOutputBatch> startHandler) {
connection.doBatchStart(id, args);
this.startHandler = startHandler;
} | java | void start(Handler<ConnectionOutputBatch> startHandler) {
connection.doBatchStart(id, args);
this.startHandler = startHandler;
} | [
"void",
"start",
"(",
"Handler",
"<",
"ConnectionOutputBatch",
">",
"startHandler",
")",
"{",
"connection",
".",
"doBatchStart",
"(",
"id",
",",
"args",
")",
";",
"this",
".",
"startHandler",
"=",
"startHandler",
";",
"}"
] | Starts the output batch. | [
"Starts",
"the",
"output",
"batch",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultConnectionOutputBatch.java#L147-L150 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/ModuleFields.java | ModuleFields.getInPorts | public List<String> getInPorts() {
List<String> ports = new ArrayList<>();
JsonObject jsonPorts = config.getObject("ports");
if (jsonPorts == null) {
return ports;
}
JsonArray jsonInPorts = jsonPorts.getArray("in");
if (jsonInPorts == null) {
return ports;
}
for (Object jsonI... | java | public List<String> getInPorts() {
List<String> ports = new ArrayList<>();
JsonObject jsonPorts = config.getObject("ports");
if (jsonPorts == null) {
return ports;
}
JsonArray jsonInPorts = jsonPorts.getArray("in");
if (jsonInPorts == null) {
return ports;
}
for (Object jsonI... | [
"public",
"List",
"<",
"String",
">",
"getInPorts",
"(",
")",
"{",
"List",
"<",
"String",
">",
"ports",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"JsonObject",
"jsonPorts",
"=",
"config",
".",
"getObject",
"(",
"\"ports\"",
")",
";",
"if",
"(",
"... | Returns a list of input ports defined by the module.
@return A list of input ports defined by the module. | [
"Returns",
"a",
"list",
"of",
"input",
"ports",
"defined",
"by",
"the",
"module",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/ModuleFields.java#L52-L66 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/ModuleFields.java | ModuleFields.getOutPorts | public List<String> getOutPorts() {
List<String> ports = new ArrayList<>();
JsonObject jsonPorts = config.getObject("ports");
if (jsonPorts == null) {
return ports;
}
JsonArray jsonOutPorts = jsonPorts.getArray("out");
if (jsonOutPorts == null) {
return ports;
}
for(Object js... | java | public List<String> getOutPorts() {
List<String> ports = new ArrayList<>();
JsonObject jsonPorts = config.getObject("ports");
if (jsonPorts == null) {
return ports;
}
JsonArray jsonOutPorts = jsonPorts.getArray("out");
if (jsonOutPorts == null) {
return ports;
}
for(Object js... | [
"public",
"List",
"<",
"String",
">",
"getOutPorts",
"(",
")",
"{",
"List",
"<",
"String",
">",
"ports",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"JsonObject",
"jsonPorts",
"=",
"config",
".",
"getObject",
"(",
"\"ports\"",
")",
";",
"if",
"(",
... | Returns a list of output ports defined by the module.
@return A list of output ports defined by the module. | [
"Returns",
"a",
"list",
"of",
"output",
"ports",
"defined",
"by",
"the",
"module",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/ModuleFields.java#L73-L87 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/CountingCompletionHandler.java | CountingCompletionHandler.fail | public void fail(Throwable t) {
if (!failed) {
if (doneHandler != null) {
doneHandler.handle(new DefaultFutureResult<T>(t));
} else {
cause = t;
}
failed = true;
}
} | java | public void fail(Throwable t) {
if (!failed) {
if (doneHandler != null) {
doneHandler.handle(new DefaultFutureResult<T>(t));
} else {
cause = t;
}
failed = true;
}
} | [
"public",
"void",
"fail",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"!",
"failed",
")",
"{",
"if",
"(",
"doneHandler",
"!=",
"null",
")",
"{",
"doneHandler",
".",
"handle",
"(",
"new",
"DefaultFutureResult",
"<",
"T",
">",
"(",
"t",
")",
")",
";"... | Indicates that a call failed. This will immediately fail the handler.
@param t The cause of the failure. | [
"Indicates",
"that",
"a",
"call",
"failed",
".",
"This",
"will",
"immediately",
"fail",
"the",
"handler",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/CountingCompletionHandler.java#L61-L70 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/CountingCompletionHandler.java | CountingCompletionHandler.setHandler | public CountingCompletionHandler<T> setHandler(Handler<AsyncResult<T>> doneHandler) {
this.doneHandler = doneHandler;
checkDone();
return this;
} | java | public CountingCompletionHandler<T> setHandler(Handler<AsyncResult<T>> doneHandler) {
this.doneHandler = doneHandler;
checkDone();
return this;
} | [
"public",
"CountingCompletionHandler",
"<",
"T",
">",
"setHandler",
"(",
"Handler",
"<",
"AsyncResult",
"<",
"T",
">",
">",
"doneHandler",
")",
"{",
"this",
".",
"doneHandler",
"=",
"doneHandler",
";",
"checkDone",
"(",
")",
";",
"return",
"this",
";",
"}"... | Sets the completion handler.
@param doneHandler An asynchronous handler to be called once all calls have completed. | [
"Sets",
"the",
"completion",
"handler",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/CountingCompletionHandler.java#L77-L81 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/CountingCompletionHandler.java | CountingCompletionHandler.checkDone | private void checkDone() {
if (doneHandler != null) {
if (cause != null) {
doneHandler.handle(new DefaultFutureResult<T>(cause));
} else {
if (count == required) {
doneHandler.handle(new DefaultFutureResult<T>((T) null));
}
}
}
} | java | private void checkDone() {
if (doneHandler != null) {
if (cause != null) {
doneHandler.handle(new DefaultFutureResult<T>(cause));
} else {
if (count == required) {
doneHandler.handle(new DefaultFutureResult<T>((T) null));
}
}
}
} | [
"private",
"void",
"checkDone",
"(",
")",
"{",
"if",
"(",
"doneHandler",
"!=",
"null",
")",
"{",
"if",
"(",
"cause",
"!=",
"null",
")",
"{",
"doneHandler",
".",
"handle",
"(",
"new",
"DefaultFutureResult",
"<",
"T",
">",
"(",
"cause",
")",
")",
";",
... | Checks whether the handler should be called. | [
"Checks",
"whether",
"the",
"handler",
"should",
"be",
"called",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/CountingCompletionHandler.java#L86-L96 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/component/impl/DefaultComponent.java | DefaultComponent.setup | private void setup(final Handler<AsyncResult<Void>> doneHandler) {
// Retrieve the component context from the coordinator (the current cluster).
// If the context has changed due to a network configuration change, the
// internal context and input/output connections will be automatically updated.
log.de... | java | private void setup(final Handler<AsyncResult<Void>> doneHandler) {
// Retrieve the component context from the coordinator (the current cluster).
// If the context has changed due to a network configuration change, the
// internal context and input/output connections will be automatically updated.
log.de... | [
"private",
"void",
"setup",
"(",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"// Retrieve the component context from the coordinator (the current cluster).",
"// If the context has changed due to a network configuration change, the",
"// ... | Sets up the component. | [
"Sets",
"up",
"the",
"component",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/component/impl/DefaultComponent.java#L113-L186 | train |
kuujo/vertigo | util/src/main/java/net/kuujo/vertigo/io/Pump.java | Pump.start | public void start() {
input.messageHandler(new Handler<Object>() {
@Override
public void handle(Object message) {
output.send(message);
pumped++;
}
});
} | java | public void start() {
input.messageHandler(new Handler<Object>() {
@Override
public void handle(Object message) {
output.send(message);
pumped++;
}
});
} | [
"public",
"void",
"start",
"(",
")",
"{",
"input",
".",
"messageHandler",
"(",
"new",
"Handler",
"<",
"Object",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"Object",
"message",
")",
"{",
"output",
".",
"send",
"(",
"message",
... | Starts the pump. | [
"Starts",
"the",
"pump",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/util/src/main/java/net/kuujo/vertigo/io/Pump.java#L58-L66 | train |
kuujo/vertigo | util/src/main/java/net/kuujo/vertigo/io/Feeder.java | Feeder.createFeeder | public static <T extends Output<T>> Feeder<T> createFeeder(T output) {
return new Feeder<T>(output);
} | java | public static <T extends Output<T>> Feeder<T> createFeeder(T output) {
return new Feeder<T>(output);
} | [
"public",
"static",
"<",
"T",
"extends",
"Output",
"<",
"T",
">",
">",
"Feeder",
"<",
"T",
">",
"createFeeder",
"(",
"T",
"output",
")",
"{",
"return",
"new",
"Feeder",
"<",
"T",
">",
"(",
"output",
")",
";",
"}"
] | Creates a new feeder.
@param output The output to which to feed messages.
@return A new feeder. | [
"Creates",
"a",
"new",
"feeder",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/util/src/main/java/net/kuujo/vertigo/io/Feeder.java#L63-L65 | train |
kuujo/vertigo | util/src/main/java/net/kuujo/vertigo/io/Feeder.java | Feeder.doFeed | private void doFeed() {
if (fed && !output.sendQueueFull()) {
fed = false;
vertx.runOnContext(feedRunner);
} else {
feedTimer = vertx.setTimer(feedDelay, recursiveRunner);
}
} | java | private void doFeed() {
if (fed && !output.sendQueueFull()) {
fed = false;
vertx.runOnContext(feedRunner);
} else {
feedTimer = vertx.setTimer(feedDelay, recursiveRunner);
}
} | [
"private",
"void",
"doFeed",
"(",
")",
"{",
"if",
"(",
"fed",
"&&",
"!",
"output",
".",
"sendQueueFull",
"(",
")",
")",
"{",
"fed",
"=",
"false",
";",
"vertx",
".",
"runOnContext",
"(",
"feedRunner",
")",
";",
"}",
"else",
"{",
"feedTimer",
"=",
"v... | Feeds the next message. | [
"Feeds",
"the",
"next",
"message",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/util/src/main/java/net/kuujo/vertigo/io/Feeder.java#L115-L122 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Components.java | Components.createComponent | public static Component createComponent(Vertx vertx, Container container) {
InstanceContext context = parseContext(container.config());
return new DefaultComponentFactory().setVertx(vertx).setContainer(container).createComponent(context, new DefaultCluster(context.component().network().cluster(), vertx, contain... | java | public static Component createComponent(Vertx vertx, Container container) {
InstanceContext context = parseContext(container.config());
return new DefaultComponentFactory().setVertx(vertx).setContainer(container).createComponent(context, new DefaultCluster(context.component().network().cluster(), vertx, contain... | [
"public",
"static",
"Component",
"createComponent",
"(",
"Vertx",
"vertx",
",",
"Container",
"container",
")",
"{",
"InstanceContext",
"context",
"=",
"parseContext",
"(",
"container",
".",
"config",
"(",
")",
")",
";",
"return",
"new",
"DefaultComponentFactory",
... | Creates a component instance for the current Vert.x instance. | [
"Creates",
"a",
"component",
"instance",
"for",
"the",
"current",
"Vert",
".",
"x",
"instance",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Components.java#L74-L77 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Components.java | Components.buildConfig | public static JsonObject buildConfig(InstanceContext context, Cluster cluster) {
JsonObject config = context.component().config().copy();
return config.putObject("__context__", Contexts.serialize(context));
} | java | public static JsonObject buildConfig(InstanceContext context, Cluster cluster) {
JsonObject config = context.component().config().copy();
return config.putObject("__context__", Contexts.serialize(context));
} | [
"public",
"static",
"JsonObject",
"buildConfig",
"(",
"InstanceContext",
"context",
",",
"Cluster",
"cluster",
")",
"{",
"JsonObject",
"config",
"=",
"context",
".",
"component",
"(",
")",
".",
"config",
"(",
")",
".",
"copy",
"(",
")",
";",
"return",
"con... | Builds a verticle configuration.
@param context The verticle context.
@return A verticle configuration. | [
"Builds",
"a",
"verticle",
"configuration",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Components.java#L85-L88 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Components.java | Components.parseContext | private static InstanceContext parseContext(JsonObject config) {
JsonObject context = config.getObject("__context__");
if (context == null) {
throw new IllegalArgumentException("No component context found.");
}
config.removeField("__context__");
return Contexts.deserialize(context);
} | java | private static InstanceContext parseContext(JsonObject config) {
JsonObject context = config.getObject("__context__");
if (context == null) {
throw new IllegalArgumentException("No component context found.");
}
config.removeField("__context__");
return Contexts.deserialize(context);
} | [
"private",
"static",
"InstanceContext",
"parseContext",
"(",
"JsonObject",
"config",
")",
"{",
"JsonObject",
"context",
"=",
"config",
".",
"getObject",
"(",
"\"__context__\"",
")",
";",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArg... | Parses an instance context from configuration.
@param config The verticle configuration.
@return The verticle context. | [
"Parses",
"an",
"instance",
"context",
"from",
"configuration",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Components.java#L96-L103 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.locateModules | private List<File> locateModules() {
File[] files = modRoot.listFiles();
List<File> modFiles = new ArrayList<>();
for (File file : files) {
if (file.isDirectory()) {
// Check to determine whether the directory is a valid module directory.
boolean isValid = true;
try {
... | java | private List<File> locateModules() {
File[] files = modRoot.listFiles();
List<File> modFiles = new ArrayList<>();
for (File file : files) {
if (file.isDirectory()) {
// Check to determine whether the directory is a valid module directory.
boolean isValid = true;
try {
... | [
"private",
"List",
"<",
"File",
">",
"locateModules",
"(",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"modRoot",
".",
"listFiles",
"(",
")",
";",
"List",
"<",
"File",
">",
"modFiles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"File",... | Locates all modules in the local repository. | [
"Locates",
"all",
"modules",
"in",
"the",
"local",
"repository",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L206-L229 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.locateModule | private File locateModule(ModuleIdentifier modID) {
File modDir = new File(modRoot, modID.toString());
if (modDir.exists()) {
return modDir;
}
return null;
} | java | private File locateModule(ModuleIdentifier modID) {
File modDir = new File(modRoot, modID.toString());
if (modDir.exists()) {
return modDir;
}
return null;
} | [
"private",
"File",
"locateModule",
"(",
"ModuleIdentifier",
"modID",
")",
"{",
"File",
"modDir",
"=",
"new",
"File",
"(",
"modRoot",
",",
"modID",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"modDir",
".",
"exists",
"(",
")",
")",
"{",
"return",
... | Locates a module in the modules root directory. | [
"Locates",
"a",
"module",
"in",
"the",
"modules",
"root",
"directory",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L234-L240 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.pullInDependencies | private void pullInDependencies(ModuleIdentifier modID, File modDir) {
// Load the module configuration file.
File modJsonFile = new File(modDir, MOD_JSON_FILE);
ModuleInfo info = loadModuleInfo(modID, modJsonFile);
// Pull in all dependencies according to the "includes" and "deploys" fields.
Modul... | java | private void pullInDependencies(ModuleIdentifier modID, File modDir) {
// Load the module configuration file.
File modJsonFile = new File(modDir, MOD_JSON_FILE);
ModuleInfo info = loadModuleInfo(modID, modJsonFile);
// Pull in all dependencies according to the "includes" and "deploys" fields.
Modul... | [
"private",
"void",
"pullInDependencies",
"(",
"ModuleIdentifier",
"modID",
",",
"File",
"modDir",
")",
"{",
"// Load the module configuration file.",
"File",
"modJsonFile",
"=",
"new",
"File",
"(",
"modDir",
",",
"MOD_JSON_FILE",
")",
";",
"ModuleInfo",
"info",
"=",... | Pulls in all dependencies for a module. | [
"Pulls",
"in",
"all",
"dependencies",
"for",
"a",
"module",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L267-L319 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.zipModule | private File zipModule(ModuleIdentifier modID) {
File modDir = new File(modRoot, modID.toString());
if (!modDir.exists()) {
throw new PlatformManagerException("Cannot find module");
}
// Create a temporary directory in which to store the module and its dependencies.
File modRoot = new File(TE... | java | private File zipModule(ModuleIdentifier modID) {
File modDir = new File(modRoot, modID.toString());
if (!modDir.exists()) {
throw new PlatformManagerException("Cannot find module");
}
// Create a temporary directory in which to store the module and its dependencies.
File modRoot = new File(TE... | [
"private",
"File",
"zipModule",
"(",
"ModuleIdentifier",
"modID",
")",
"{",
"File",
"modDir",
"=",
"new",
"File",
"(",
"modRoot",
",",
"modID",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"!",
"modDir",
".",
"exists",
"(",
")",
")",
"{",
"throw",... | Creates a zip file from a module. | [
"Creates",
"a",
"zip",
"file",
"from",
"a",
"module",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L324-L359 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.zipDirectory | private void zipDirectory(String zipFile, String dirToZip) {
File directory = new File(dirToZip);
try (ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(zipFile))) {
addDirectoryToZip(directory, directory, stream);
} catch (Exception e) {
throw new PlatformManagerException("Faile... | java | private void zipDirectory(String zipFile, String dirToZip) {
File directory = new File(dirToZip);
try (ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(zipFile))) {
addDirectoryToZip(directory, directory, stream);
} catch (Exception e) {
throw new PlatformManagerException("Faile... | [
"private",
"void",
"zipDirectory",
"(",
"String",
"zipFile",
",",
"String",
"dirToZip",
")",
"{",
"File",
"directory",
"=",
"new",
"File",
"(",
"dirToZip",
")",
";",
"try",
"(",
"ZipOutputStream",
"stream",
"=",
"new",
"ZipOutputStream",
"(",
"new",
"FileOut... | Zips up a directory. | [
"Zips",
"up",
"a",
"directory",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L364-L371 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.addDirectoryToZip | private void addDirectoryToZip(File topDirectory, File directory, ZipOutputStream out) throws IOException {
Path top = Paths.get(topDirectory.getAbsolutePath());
File[] files = directory.listFiles();
byte[] buffer = new byte[BUFFER_SIZE];
for (int i = 0; i < files.length; i++) {
Path entry = Pat... | java | private void addDirectoryToZip(File topDirectory, File directory, ZipOutputStream out) throws IOException {
Path top = Paths.get(topDirectory.getAbsolutePath());
File[] files = directory.listFiles();
byte[] buffer = new byte[BUFFER_SIZE];
for (int i = 0; i < files.length; i++) {
Path entry = Pat... | [
"private",
"void",
"addDirectoryToZip",
"(",
"File",
"topDirectory",
",",
"File",
"directory",
",",
"ZipOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"Path",
"top",
"=",
"Paths",
".",
"get",
"(",
"topDirectory",
".",
"getAbsolutePath",
"(",
")",
")"... | Recursively adds directories to a zip file. | [
"Recursively",
"adds",
"directories",
"to",
"a",
"zip",
"file",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L376-L406 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.parseIncludes | private String[] parseIncludes(String sincludes) {
sincludes = sincludes.trim();
if ("".equals(sincludes)) {
return null;
}
String[] arr = sincludes.split(",");
if (arr != null) {
for (int i = 0; i < arr.length; i++) {
arr[i] = arr[i].trim();
}
}
return arr;
} | java | private String[] parseIncludes(String sincludes) {
sincludes = sincludes.trim();
if ("".equals(sincludes)) {
return null;
}
String[] arr = sincludes.split(",");
if (arr != null) {
for (int i = 0; i < arr.length; i++) {
arr[i] = arr[i].trim();
}
}
return arr;
} | [
"private",
"String",
"[",
"]",
"parseIncludes",
"(",
"String",
"sincludes",
")",
"{",
"sincludes",
"=",
"sincludes",
".",
"trim",
"(",
")",
";",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"sincludes",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
... | Parses an includes string. | [
"Parses",
"an",
"includes",
"string",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L411-L423 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java | DefaultPlatformManager.unzipModuleData | private void unzipModuleData(File directory, File zipFile, boolean deleteZip) {
try (InputStream in = new BufferedInputStream(new FileInputStream(zipFile)); ZipInputStream zin = new ZipInputStream(new BufferedInputStream(in))) {
ZipEntry entry;
while ((entry = zin.getNextEntry()) != null) {
Stri... | java | private void unzipModuleData(File directory, File zipFile, boolean deleteZip) {
try (InputStream in = new BufferedInputStream(new FileInputStream(zipFile)); ZipInputStream zin = new ZipInputStream(new BufferedInputStream(in))) {
ZipEntry entry;
while ((entry = zin.getNextEntry()) != null) {
Stri... | [
"private",
"void",
"unzipModuleData",
"(",
"File",
"directory",
",",
"File",
"zipFile",
",",
"boolean",
"deleteZip",
")",
"{",
"try",
"(",
"InputStream",
"in",
"=",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"zipFile",
")",
")",
";",
"... | Unzips a module. | [
"Unzips",
"a",
"module",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/platform/impl/DefaultPlatformManager.java#L436-L475 | train |
lordcodes/SnackbarBuilder | snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/toastbuilder/ToastBuilder.java | ToastBuilder.build | @SuppressLint("ShowToast")
public Toast build() {
Toast toast = Toast.makeText(context, message, duration);
TextView toastMessage = setupToastView(toast);
setToastMessageTextColor(toastMessage);
setToastGravity(toast);
return toast;
} | java | @SuppressLint("ShowToast")
public Toast build() {
Toast toast = Toast.makeText(context, message, duration);
TextView toastMessage = setupToastView(toast);
setToastMessageTextColor(toastMessage);
setToastGravity(toast);
return toast;
} | [
"@",
"SuppressLint",
"(",
"\"ShowToast\"",
")",
"public",
"Toast",
"build",
"(",
")",
"{",
"Toast",
"toast",
"=",
"Toast",
".",
"makeText",
"(",
"context",
",",
"message",
",",
"duration",
")",
";",
"TextView",
"toastMessage",
"=",
"setupToastView",
"(",
"... | Build a Toast using the options specified in the builder.
@return The constructed Toast. | [
"Build",
"a",
"Toast",
"using",
"the",
"options",
"specified",
"in",
"the",
"builder",
"."
] | a104a753c78ed66940c19d295e141a521cf81d73 | https://github.com/lordcodes/SnackbarBuilder/blob/a104a753c78ed66940c19d295e141a521cf81d73/snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/toastbuilder/ToastBuilder.java#L174-L183 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.handleCreate | private void handleCreate(final NetworkContext context) {
log.debug(String.format("%s - Network configuration created in cluster: %s", NetworkManager.this, cluster.address()));
log.debug(String.format("%s - Scheduling network deployment task", NetworkManager.this));
tasks.runTask(new Handler<Task>() {
... | java | private void handleCreate(final NetworkContext context) {
log.debug(String.format("%s - Network configuration created in cluster: %s", NetworkManager.this, cluster.address()));
log.debug(String.format("%s - Scheduling network deployment task", NetworkManager.this));
tasks.runTask(new Handler<Task>() {
... | [
"private",
"void",
"handleCreate",
"(",
"final",
"NetworkContext",
"context",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Network configuration created in cluster: %s\"",
",",
"NetworkManager",
".",
"this",
",",
"cluster",
".",
"address... | Handles the creation of the network. | [
"Handles",
"the",
"creation",
"of",
"the",
"network",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L255-L288 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.undeployRemovedComponents | private void undeployRemovedComponents(final NetworkContext context, final NetworkContext runningContext, final Handler<AsyncResult<Void>> doneHandler) {
// Undeploy any components that were removed from the network.
final List<ComponentContext<?>> removedComponents = new ArrayList<>();
for (ComponentContex... | java | private void undeployRemovedComponents(final NetworkContext context, final NetworkContext runningContext, final Handler<AsyncResult<Void>> doneHandler) {
// Undeploy any components that were removed from the network.
final List<ComponentContext<?>> removedComponents = new ArrayList<>();
for (ComponentContex... | [
"private",
"void",
"undeployRemovedComponents",
"(",
"final",
"NetworkContext",
"context",
",",
"final",
"NetworkContext",
"runningContext",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"// Undeploy any components that wer... | Undeploys components that were removed from the network. | [
"Undeploys",
"components",
"that",
"were",
"removed",
"from",
"the",
"network",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L375-L401 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.handleDelete | private void handleDelete() {
log.debug(String.format("%s - Network configuration removed from cluster: %s", NetworkManager.this, cluster.address()));
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
unready(new Handler<AsyncResult<Void>>() {
@Ove... | java | private void handleDelete() {
log.debug(String.format("%s - Network configuration removed from cluster: %s", NetworkManager.this, cluster.address()));
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
unready(new Handler<AsyncResult<Void>>() {
@Ove... | [
"private",
"void",
"handleDelete",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Network configuration removed from cluster: %s\"",
",",
"NetworkManager",
".",
"this",
",",
"cluster",
".",
"address",
"(",
")",
")",
")",
";",
"t... | Handles the deletion of the network. | [
"Handles",
"the",
"deletion",
"of",
"the",
"network",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L436-L480 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.unready | private void unready(final Handler<AsyncResult<Void>> doneHandler) {
if (currentContext != null && data != null) {
log.debug(String.format("%s - Pausing network", NetworkManager.this));
data.remove(currentContext.status(), new Handler<AsyncResult<String>>() {
@Override
public void handle... | java | private void unready(final Handler<AsyncResult<Void>> doneHandler) {
if (currentContext != null && data != null) {
log.debug(String.format("%s - Pausing network", NetworkManager.this));
data.remove(currentContext.status(), new Handler<AsyncResult<String>>() {
@Override
public void handle... | [
"private",
"void",
"unready",
"(",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"if",
"(",
"currentContext",
"!=",
"null",
"&&",
"data",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format... | Unreadies the network. | [
"Unreadies",
"the",
"network",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L485-L499 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.handleReady | private void handleReady(String address) {
log.debug(String.format("%s - Received ready message from %s", NetworkManager.this, address));
ready.add(address);
checkReady();
} | java | private void handleReady(String address) {
log.debug(String.format("%s - Received ready message from %s", NetworkManager.this, address));
ready.add(address);
checkReady();
} | [
"private",
"void",
"handleReady",
"(",
"String",
"address",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Received ready message from %s\"",
",",
"NetworkManager",
".",
"this",
",",
"address",
")",
")",
";",
"ready",
".",
"add",
"... | Called when a component instance is ready. | [
"Called",
"when",
"a",
"component",
"instance",
"is",
"ready",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L504-L508 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.checkReady | private void checkReady() {
if (allReady()) {
log.debug(String.format("%s - All components ready in network, starting components", NetworkManager.this));
// Set the network's status key to the current context version. This
// can be used by listeners to determine when a configuration change is com... | java | private void checkReady() {
if (allReady()) {
log.debug(String.format("%s - All components ready in network, starting components", NetworkManager.this));
// Set the network's status key to the current context version. This
// can be used by listeners to determine when a configuration change is com... | [
"private",
"void",
"checkReady",
"(",
")",
"{",
"if",
"(",
"allReady",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - All components ready in network, starting components\"",
",",
"NetworkManager",
".",
"this",
")",
")",
";... | Checks whether the network is ready. | [
"Checks",
"whether",
"the",
"network",
"is",
"ready",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L513-L527 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.handleUnready | private void handleUnready(String address) {
log.debug(String.format("%s - Received unready message from: %s", NetworkManager.this, address));
ready.remove(address);
checkUnready();
} | java | private void handleUnready(String address) {
log.debug(String.format("%s - Received unready message from: %s", NetworkManager.this, address));
ready.remove(address);
checkUnready();
} | [
"private",
"void",
"handleUnready",
"(",
"String",
"address",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Received unready message from: %s\"",
",",
"NetworkManager",
".",
"this",
",",
"address",
")",
")",
";",
"ready",
".",
"remo... | Called when a component instance is unready. | [
"Called",
"when",
"a",
"component",
"instance",
"is",
"unready",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L532-L536 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.checkUnready | private void checkUnready() {
if (!allReady()) {
log.debug(String.format("%s - Components not ready, pausing components", NetworkManager.this));
data.remove(currentContext.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
... | java | private void checkUnready() {
if (!allReady()) {
log.debug(String.format("%s - Components not ready, pausing components", NetworkManager.this));
data.remove(currentContext.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
... | [
"private",
"void",
"checkUnready",
"(",
")",
"{",
"if",
"(",
"!",
"allReady",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Components not ready, pausing components\"",
",",
"NetworkManager",
".",
"this",
")",
")",
";",
... | Checks whether the network is unready. | [
"Checks",
"whether",
"the",
"network",
"is",
"unready",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L541-L553 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.allReady | private boolean allReady() {
if (currentContext == null) return false;
List<InstanceContext> instances = new ArrayList<>();
boolean match = true;
outer: for (ComponentContext<?> component : currentContext.components()) {
instances.addAll(component.instances());
for (InstanceContext instance ... | java | private boolean allReady() {
if (currentContext == null) return false;
List<InstanceContext> instances = new ArrayList<>();
boolean match = true;
outer: for (ComponentContext<?> component : currentContext.components()) {
instances.addAll(component.instances());
for (InstanceContext instance ... | [
"private",
"boolean",
"allReady",
"(",
")",
"{",
"if",
"(",
"currentContext",
"==",
"null",
")",
"return",
"false",
";",
"List",
"<",
"InstanceContext",
">",
"instances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"boolean",
"match",
"=",
"true",
";",... | Checks whether all components are ready in the network. | [
"Checks",
"whether",
"all",
"components",
"are",
"ready",
"in",
"the",
"network",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L558-L572 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.deployNetwork | private void deployNetwork(final NetworkContext context, final Handler<AsyncResult<NetworkContext>> doneHandler) {
log.debug(String.format("%s - Deploying network", NetworkManager.this));
final CountingCompletionHandler<Void> complete = new CountingCompletionHandler<Void>(context.components().size());
compl... | java | private void deployNetwork(final NetworkContext context, final Handler<AsyncResult<NetworkContext>> doneHandler) {
log.debug(String.format("%s - Deploying network", NetworkManager.this));
final CountingCompletionHandler<Void> complete = new CountingCompletionHandler<Void>(context.components().size());
compl... | [
"private",
"void",
"deployNetwork",
"(",
"final",
"NetworkContext",
"context",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"NetworkContext",
">",
">",
"doneHandler",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Deploying networ... | Deploys a complete network. | [
"Deploys",
"a",
"complete",
"network",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L577-L591 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.deployComponents | private void deployComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> counter) {
for (final ComponentContext<?> component : components) {
deployComponent(component, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> resul... | java | private void deployComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> counter) {
for (final ComponentContext<?> component : components) {
deployComponent(component, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> resul... | [
"private",
"void",
"deployComponents",
"(",
"Collection",
"<",
"ComponentContext",
"<",
"?",
">",
">",
"components",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"for",
"(",
"final",
"ComponentContext",
"<",
"?",
">",
"comp... | Deploys all network components. | [
"Deploys",
"all",
"network",
"components",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L596-L618 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.deployInstances | private void deployInstances(List<InstanceContext> instances, final Handler<AsyncResult<Void>> doneHandler) {
final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(instances.size()).setHandler(doneHandler);
for (final InstanceContext instance : instances) {
// Before deployin... | java | private void deployInstances(List<InstanceContext> instances, final Handler<AsyncResult<Void>> doneHandler) {
final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(instances.size()).setHandler(doneHandler);
for (final InstanceContext instance : instances) {
// Before deployin... | [
"private",
"void",
"deployInstances",
"(",
"List",
"<",
"InstanceContext",
">",
"instances",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
"=",
"n... | Deploys all network component instances. | [
"Deploys",
"all",
"network",
"component",
"instances",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L700-L731 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.deployInstance | private void deployInstance(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
// First we need to select a node from the component's deployment group
// to which to deploy the component.
// If the component doesn't specify a group then deploy to any node in the cluster.
if... | java | private void deployInstance(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
// First we need to select a node from the component's deployment group
// to which to deploy the component.
// If the component doesn't specify a group then deploy to any node in the cluster.
if... | [
"private",
"void",
"deployInstance",
"(",
"final",
"InstanceContext",
"instance",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"// First we need to select a node from the component's deployment group",
"// to which to deploy the component.",
"... | Deploys a single component instance. | [
"Deploys",
"a",
"single",
"component",
"instance",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L736-L772 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.deployInstance | private void deployInstance(final Node node, final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (re... | java | private void deployInstance(final Node node, final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (re... | [
"private",
"void",
"deployInstance",
"(",
"final",
"Node",
"node",
",",
"final",
"InstanceContext",
"instance",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"data",
".",
"put",
"(",
"instance",
".",
"address",
"(",
")",
"... | Deploys an instance to a specific node. | [
"Deploys",
"an",
"instance",
"to",
"a",
"specific",
"node",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L777-L828 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.deployModule | private void deployModule(final Node node, final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
log.debug(String.format("%s - Deploying %s to %s", NetworkManager.this, instance.component().asModule().module(), node.address()));
node.deployModule(instance.component().asModule().module... | java | private void deployModule(final Node node, final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
log.debug(String.format("%s - Deploying %s to %s", NetworkManager.this, instance.component().asModule().module(), node.address()));
node.deployModule(instance.component().asModule().module... | [
"private",
"void",
"deployModule",
"(",
"final",
"Node",
"node",
",",
"final",
"InstanceContext",
"instance",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Depl... | Deploys a module component instance in the network's cluster. | [
"Deploys",
"a",
"module",
"component",
"instance",
"in",
"the",
"network",
"s",
"cluster",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L833-L850 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.installModules | private void installModules(final Node node, final NetworkContext context, final Handler<AsyncResult<Void>> doneHandler) {
List<ModuleContext> modules = new ArrayList<>();
for (ComponentContext<?> component : context.components()) {
if (component.isModule()) {
modules.add(component.asModule());
... | java | private void installModules(final Node node, final NetworkContext context, final Handler<AsyncResult<Void>> doneHandler) {
List<ModuleContext> modules = new ArrayList<>();
for (ComponentContext<?> component : context.components()) {
if (component.isModule()) {
modules.add(component.asModule());
... | [
"private",
"void",
"installModules",
"(",
"final",
"Node",
"node",
",",
"final",
"NetworkContext",
"context",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"List",
"<",
"ModuleContext",
">",
"modules",
"=",
"new... | Installs all modules on a node. | [
"Installs",
"all",
"modules",
"on",
"a",
"node",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L899-L911 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.installModule | private void installModule(final Node node, final ModuleContext module, final Handler<AsyncResult<Void>> doneHandler) {
node.installModule(module.module(), doneHandler);
} | java | private void installModule(final Node node, final ModuleContext module, final Handler<AsyncResult<Void>> doneHandler) {
node.installModule(module.module(), doneHandler);
} | [
"private",
"void",
"installModule",
"(",
"final",
"Node",
"node",
",",
"final",
"ModuleContext",
"module",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"node",
".",
"installModule",
"(",
"module",
".",
"module"... | Installs a module on a node. | [
"Installs",
"a",
"module",
"on",
"a",
"node",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L916-L918 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.undeployComponents | private void undeployComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> complete) {
for (final ComponentContext<?> component : components) {
final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(component.instances().size());
counte... | java | private void undeployComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> complete) {
for (final ComponentContext<?> component : components) {
final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(component.instances().size());
counte... | [
"private",
"void",
"undeployComponents",
"(",
"Collection",
"<",
"ComponentContext",
"<",
"?",
">",
">",
"components",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"complete",
")",
"{",
"for",
"(",
"final",
"ComponentContext",
"<",
"?",
">",
"c... | Undeploys all network components. | [
"Undeploys",
"all",
"network",
"components",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L941-L966 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.undeployInstances | private void undeployInstances(List<InstanceContext> instances, final CountingCompletionHandler<Void> counter) {
for (final InstanceContext instance : instances) {
if (instance.component().isModule()) {
undeployModule(instance, counter);
} else if (instance.component().isVerticle()) {
un... | java | private void undeployInstances(List<InstanceContext> instances, final CountingCompletionHandler<Void> counter) {
for (final InstanceContext instance : instances) {
if (instance.component().isModule()) {
undeployModule(instance, counter);
} else if (instance.component().isVerticle()) {
un... | [
"private",
"void",
"undeployInstances",
"(",
"List",
"<",
"InstanceContext",
">",
"instances",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"for",
"(",
"final",
"InstanceContext",
"instance",
":",
"instances",
")",
"{",
"if",... | Undeploys all component instances. | [
"Undeploys",
"all",
"component",
"instances",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L971-L979 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.unwatchInstance | private void unwatchInstance(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
Handler<MapEvent<String, String>> watchHandler = watchHandlers.remove(instance.address());
if (watchHandler != null) {
data.unwatch(instance.status(), watchHandler, new Handler<AsyncResult<Void>>(... | java | private void unwatchInstance(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
Handler<MapEvent<String, String>> watchHandler = watchHandlers.remove(instance.address());
if (watchHandler != null) {
data.unwatch(instance.status(), watchHandler, new Handler<AsyncResult<Void>>(... | [
"private",
"void",
"unwatchInstance",
"(",
"final",
"InstanceContext",
"instance",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"Handler",
"<",
"MapEvent",
"<",
"String",
",",
"String",
">",
">",
"watchHandler",
"=",
"watchHa... | Unwatches a component instance's status and context. | [
"Unwatches",
"a",
"component",
"instance",
"s",
"status",
"and",
"context",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L984-L1014 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.undeployModule | private void undeployModule(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
deploymentIDs.remove(instance.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(resu... | java | private void undeployModule(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
deploymentIDs.remove(instance.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(resu... | [
"private",
"void",
"undeployModule",
"(",
"final",
"InstanceContext",
"instance",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"deploymentIDs",
".",
"remove",
"(",
"instance",
".",
"address",
"(",
")",
",",
"new",
"Handler",
... | Undeploys a module component instance. | [
"Undeploys",
"a",
"module",
"component",
"instance",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L1019-L1037 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.updateNetwork | private void updateNetwork(final NetworkContext context, final Handler<AsyncResult<Void>> doneHandler) {
final CountingCompletionHandler<Void> complete = new CountingCompletionHandler<Void>(context.components().size());
complete.setHandler(new Handler<AsyncResult<Void>>() {
@Override
public void han... | java | private void updateNetwork(final NetworkContext context, final Handler<AsyncResult<Void>> doneHandler) {
final CountingCompletionHandler<Void> complete = new CountingCompletionHandler<Void>(context.components().size());
complete.setHandler(new Handler<AsyncResult<Void>>() {
@Override
public void han... | [
"private",
"void",
"updateNetwork",
"(",
"final",
"NetworkContext",
"context",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"complete",
"=",
"new",
"CountingC... | Updates a network. | [
"Updates",
"a",
"network",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L1065-L1078 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.updateComponents | private void updateComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> complete) {
for (final ComponentContext<?> component : components) {
final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(component.instances().size());
counter.... | java | private void updateComponents(Collection<ComponentContext<?>> components, final CountingCompletionHandler<Void> complete) {
for (final ComponentContext<?> component : components) {
final CountingCompletionHandler<Void> counter = new CountingCompletionHandler<Void>(component.instances().size());
counter.... | [
"private",
"void",
"updateComponents",
"(",
"Collection",
"<",
"ComponentContext",
"<",
"?",
">",
">",
"components",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"complete",
")",
"{",
"for",
"(",
"final",
"ComponentContext",
"<",
"?",
">",
"com... | Updates all network components. | [
"Updates",
"all",
"network",
"components",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L1083-L1098 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.updateInstances | private void updateInstances(List<InstanceContext> instances, final CountingCompletionHandler<Void> counter) {
for (final InstanceContext instance : instances) {
data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
@Override
public void handl... | java | private void updateInstances(List<InstanceContext> instances, final CountingCompletionHandler<Void> counter) {
for (final InstanceContext instance : instances) {
data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
@Override
public void handl... | [
"private",
"void",
"updateInstances",
"(",
"List",
"<",
"InstanceContext",
">",
"instances",
",",
"final",
"CountingCompletionHandler",
"<",
"Void",
">",
"counter",
")",
"{",
"for",
"(",
"final",
"InstanceContext",
"instance",
":",
"instances",
")",
"{",
"data",... | Updates all component instances. | [
"Updates",
"all",
"component",
"instances",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L1103-L1116 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.doNodeJoined | private void doNodeJoined(final Node node) {
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
if (currentContext != null) {
log.info(String.format("%s - %s joined the cluster. Uploading components to new node", NetworkManager.this, node.address()));
... | java | private void doNodeJoined(final Node node) {
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
if (currentContext != null) {
log.info(String.format("%s - %s joined the cluster. Uploading components to new node", NetworkManager.this, node.address()));
... | [
"private",
"void",
"doNodeJoined",
"(",
"final",
"Node",
"node",
")",
"{",
"tasks",
".",
"runTask",
"(",
"new",
"Handler",
"<",
"Task",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"Task",
"task",
")",
"{",
"if",
"("... | Handles a node joining the cluster. | [
"Handles",
"a",
"node",
"joining",
"the",
"cluster",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L1121-L1143 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java | NetworkManager.doNodeLeft | private void doNodeLeft(final Node node) {
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
if (currentContext != null) {
log.info(String.format("%s - %s left the cluster. Reassigning components", NetworkManager.this, node.address()));
deplo... | java | private void doNodeLeft(final Node node) {
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
if (currentContext != null) {
log.info(String.format("%s - %s left the cluster. Reassigning components", NetworkManager.this, node.address()));
deplo... | [
"private",
"void",
"doNodeLeft",
"(",
"final",
"Node",
"node",
")",
"{",
"tasks",
".",
"runTask",
"(",
"new",
"Handler",
"<",
"Task",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"Task",
"task",
")",
"{",
"if",
"(",
... | Handles a node leaving the cluster. | [
"Handles",
"a",
"node",
"leaving",
"the",
"cluster",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/network/manager/NetworkManager.java#L1148-L1198 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.disconnect | private void disconnect(final Handler<AsyncResult<Void>> doneHandler) {
eventBus.sendWithTimeout(inAddress, new JsonObject().putString("action", "disconnect"), 5000, new Handler<AsyncResult<Message<Boolean>>>() {
@Override
public void handle(AsyncResult<Message<Boolean>> result) {
if (result.fai... | java | private void disconnect(final Handler<AsyncResult<Void>> doneHandler) {
eventBus.sendWithTimeout(inAddress, new JsonObject().putString("action", "disconnect"), 5000, new Handler<AsyncResult<Message<Boolean>>>() {
@Override
public void handle(AsyncResult<Message<Boolean>> result) {
if (result.fai... | [
"private",
"void",
"disconnect",
"(",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"eventBus",
".",
"sendWithTimeout",
"(",
"inAddress",
",",
"new",
"JsonObject",
"(",
")",
".",
"putString",
"(",
"\"action\"",
",",
... | Disconnects from the other side of the connection. | [
"Disconnects",
"from",
"the",
"other",
"side",
"of",
"the",
"connection",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L288-L319 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.checkFull | private void checkFull() {
if (!full && messages.size() >= maxQueueSize) {
full = true;
log.debug(String.format("%s - Connection to %s is full", this, context.target()));
}
} | java | private void checkFull() {
if (!full && messages.size() >= maxQueueSize) {
full = true;
log.debug(String.format("%s - Connection to %s is full", this, context.target()));
}
} | [
"private",
"void",
"checkFull",
"(",
")",
"{",
"if",
"(",
"!",
"full",
"&&",
"messages",
".",
"size",
"(",
")",
">=",
"maxQueueSize",
")",
"{",
"full",
"=",
"true",
";",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Connection to %s i... | Checks whether the connection is full. | [
"Checks",
"whether",
"the",
"connection",
"is",
"full",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L331-L336 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.checkDrain | private void checkDrain() {
if (full && !paused && messages.size() < maxQueueSize / 2) {
full = false;
log.debug(String.format("%s - Connection to %s is drained", this, context.target()));
if (drainHandler != null) {
drainHandler.handle((Void) null);
}
}
} | java | private void checkDrain() {
if (full && !paused && messages.size() < maxQueueSize / 2) {
full = false;
log.debug(String.format("%s - Connection to %s is drained", this, context.target()));
if (drainHandler != null) {
drainHandler.handle((Void) null);
}
}
} | [
"private",
"void",
"checkDrain",
"(",
")",
"{",
"if",
"(",
"full",
"&&",
"!",
"paused",
"&&",
"messages",
".",
"size",
"(",
")",
"<",
"maxQueueSize",
"/",
"2",
")",
"{",
"full",
"=",
"false",
";",
"log",
".",
"debug",
"(",
"String",
".",
"format",
... | Checks whether the connection has been drained. | [
"Checks",
"whether",
"the",
"connection",
"has",
"been",
"drained",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L341-L349 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doAck | private void doAck(long id) {
// The other side of the connection has sent a message indicating which
// messages it has seen. We can clear any messages before the indicated ID.
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Received ack for messages up to %d, removing all previous messages... | java | private void doAck(long id) {
// The other side of the connection has sent a message indicating which
// messages it has seen. We can clear any messages before the indicated ID.
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Received ack for messages up to %d, removing all previous messages... | [
"private",
"void",
"doAck",
"(",
"long",
"id",
")",
"{",
"// The other side of the connection has sent a message indicating which",
"// messages it has seen. We can clear any messages before the indicated ID.",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",... | Handles a batch ack. | [
"Handles",
"a",
"batch",
"ack",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L373-L385 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doFail | private void doFail(long id) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Received resend request for messages starting at %d", this, id));
}
// Ack all the entries before the given ID.
doAck(id);
// Now that all the entries before the given ID have been removed,
// just i... | java | private void doFail(long id) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Received resend request for messages starting at %d", this, id));
}
// Ack all the entries before the given ID.
doAck(id);
// Now that all the entries before the given ID have been removed,
// just i... | [
"private",
"void",
"doFail",
"(",
"long",
"id",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Received resend request for messages starting at %d\"",
",",
"this",
",",
"... | Handles a batch fail. | [
"Handles",
"a",
"batch",
"fail",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L390-L404 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doPause | private void doPause(long id) {
log.debug(String.format("%s - Paused connection to %s", this, context.target()));
paused = true;
} | java | private void doPause(long id) {
log.debug(String.format("%s - Paused connection to %s", this, context.target()));
paused = true;
} | [
"private",
"void",
"doPause",
"(",
"long",
"id",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Paused connection to %s\"",
",",
"this",
",",
"context",
".",
"target",
"(",
")",
")",
")",
";",
"paused",
"=",
"true",
";",
"}"
... | Handles a connection pause. | [
"Handles",
"a",
"connection",
"pause",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L409-L412 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doResume | private void doResume(long id) {
if (paused) {
log.debug(String.format("%s - Resumed connection to %s", this, context.target()));
paused = false;
checkDrain();
}
} | java | private void doResume(long id) {
if (paused) {
log.debug(String.format("%s - Resumed connection to %s", this, context.target()));
paused = false;
checkDrain();
}
} | [
"private",
"void",
"doResume",
"(",
"long",
"id",
")",
"{",
"if",
"(",
"paused",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"%s - Resumed connection to %s\"",
",",
"this",
",",
"context",
".",
"target",
"(",
")",
")",
")",
";",... | Handles a connection resume. | [
"Handles",
"a",
"connection",
"resume",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L417-L423 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doGroupStart | void doGroupStart(String group, String name, Object args, String parent) {
checkOpen();
JsonObject message = createMessage(args)
.putString("group", group)
.putString("name", name)
.putString("parent", parent)
.putString("action", "startGroup");
if (open && !paused) {
i... | java | void doGroupStart(String group, String name, Object args, String parent) {
checkOpen();
JsonObject message = createMessage(args)
.putString("group", group)
.putString("name", name)
.putString("parent", parent)
.putString("action", "startGroup");
if (open && !paused) {
i... | [
"void",
"doGroupStart",
"(",
"String",
"group",
",",
"String",
"name",
",",
"Object",
"args",
",",
"String",
"parent",
")",
"{",
"checkOpen",
"(",
")",
";",
"JsonObject",
"message",
"=",
"createMessage",
"(",
"args",
")",
".",
"putString",
"(",
"\"group\""... | Sends a group start message. | [
"Sends",
"a",
"group",
"start",
"message",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L448-L466 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doGroupSend | void doGroupSend(String group, Object value) {
checkOpen();
JsonObject message = createMessage(value)
.putString("action", "group")
.putString("group", group);
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Group send: Group[group=%s, id=%d, me... | java | void doGroupSend(String group, Object value) {
checkOpen();
JsonObject message = createMessage(value)
.putString("action", "group")
.putString("group", group);
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Group send: Group[group=%s, id=%d, me... | [
"void",
"doGroupSend",
"(",
"String",
"group",
",",
"Object",
"value",
")",
"{",
"checkOpen",
"(",
")",
";",
"JsonObject",
"message",
"=",
"createMessage",
"(",
"value",
")",
".",
"putString",
"(",
"\"action\"",
",",
"\"group\"",
")",
".",
"putString",
"("... | Sends a group message. | [
"Sends",
"a",
"group",
"message",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L471-L486 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doGroupEnd | void doGroupEnd(String group, Object args) {
checkOpen();
JsonObject message = createMessage(args)
.putString("action", "endGroup")
.putString("group", group);
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Group end: Group[group=%s, args=%s]",... | java | void doGroupEnd(String group, Object args) {
checkOpen();
JsonObject message = createMessage(args)
.putString("action", "endGroup")
.putString("group", group);
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Group end: Group[group=%s, args=%s]",... | [
"void",
"doGroupEnd",
"(",
"String",
"group",
",",
"Object",
"args",
")",
"{",
"checkOpen",
"(",
")",
";",
"JsonObject",
"message",
"=",
"createMessage",
"(",
"args",
")",
".",
"putString",
"(",
"\"action\"",
",",
"\"endGroup\"",
")",
".",
"putString",
"("... | Sends a group end message. | [
"Sends",
"a",
"group",
"end",
"message",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L491-L503 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doBatchStart | void doBatchStart(String batch, Object args) {
checkOpen();
JsonObject message = createMessage(args)
.putString("batch", batch)
.putString("action", "startBatch");
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Batch start: Batch[batch=%s]", th... | java | void doBatchStart(String batch, Object args) {
checkOpen();
JsonObject message = createMessage(args)
.putString("batch", batch)
.putString("action", "startBatch");
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Batch start: Batch[batch=%s]", th... | [
"void",
"doBatchStart",
"(",
"String",
"batch",
",",
"Object",
"args",
")",
"{",
"checkOpen",
"(",
")",
";",
"JsonObject",
"message",
"=",
"createMessage",
"(",
"args",
")",
".",
"putString",
"(",
"\"batch\"",
",",
"batch",
")",
".",
"putString",
"(",
"\... | Sends a batch start message. | [
"Sends",
"a",
"batch",
"start",
"message",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L508-L520 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.doBatchEnd | void doBatchEnd(String batch, Object args) {
checkOpen();
JsonObject message = createMessage(args)
.putString("action", "endBatch")
.putString("batch", batch);
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Batch end: Batch[batch=%s, args=%s]",... | java | void doBatchEnd(String batch, Object args) {
checkOpen();
JsonObject message = createMessage(args)
.putString("action", "endBatch")
.putString("batch", batch);
if (open && !paused) {
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Batch end: Batch[batch=%s, args=%s]",... | [
"void",
"doBatchEnd",
"(",
"String",
"batch",
",",
"Object",
"args",
")",
"{",
"checkOpen",
"(",
")",
";",
"JsonObject",
"message",
"=",
"createMessage",
"(",
"args",
")",
".",
"putString",
"(",
"\"action\"",
",",
"\"endBatch\"",
")",
".",
"putString",
"("... | Sends a batch end message. | [
"Sends",
"a",
"batch",
"end",
"message",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L545-L559 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java | DefaultOutputConnection.createMessage | private JsonObject createMessage(Object value) {
// Tag the message with a monotonically increasing ID. The ID
// will be used by the other side of the connection to guarantee
// ordering.
JsonObject message = serializer.serialize(value);
long id = currentMessage++;
message.putNumber("id", id);
... | java | private JsonObject createMessage(Object value) {
// Tag the message with a monotonically increasing ID. The ID
// will be used by the other side of the connection to guarantee
// ordering.
JsonObject message = serializer.serialize(value);
long id = currentMessage++;
message.putNumber("id", id);
... | [
"private",
"JsonObject",
"createMessage",
"(",
"Object",
"value",
")",
"{",
"// Tag the message with a monotonically increasing ID. The ID",
"// will be used by the other side of the connection to guarantee",
"// ordering.",
"JsonObject",
"message",
"=",
"serializer",
".",
"serialize... | Creates a value message. | [
"Creates",
"a",
"value",
"message",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultOutputConnection.java#L564-L573 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Args.java | Args.checkNull | public static void checkNull(Object value, String message, Object... args) {
if (value != null) {
throw new IllegalArgumentException(String.format(message, args));
}
} | java | public static void checkNull(Object value, String message, Object... args) {
if (value != null) {
throw new IllegalArgumentException(String.format(message, args));
}
} | [
"public",
"static",
"void",
"checkNull",
"(",
"Object",
"value",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
... | Validates that an argument is null.
@param value The value to check.
@param message An exception message.
@param args Exception message arguments. | [
"Validates",
"that",
"an",
"argument",
"is",
"null",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Args.java#L46-L50 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Args.java | Args.checkNotNull | public static void checkNotNull(Object value, String message, Object... args) {
if (value == null) {
throw new NullPointerException(String.format(message, args));
}
} | java | public static void checkNotNull(Object value, String message, Object... args) {
if (value == null) {
throw new NullPointerException(String.format(message, args));
}
} | [
"public",
"static",
"void",
"checkNotNull",
"(",
"Object",
"value",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"String",
".",
"format",
"(",
"... | Validates that an argument is not null.
@param value The value to check.
@param message An exception message.
@param args Exception message arguments. | [
"Validates",
"that",
"an",
"argument",
"is",
"not",
"null",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Args.java#L70-L74 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Args.java | Args.checkPositive | public static void checkPositive(int number, String message, Object... args) {
if (number < 0) {
throw new IllegalArgumentException(String.format(message, args));
}
} | java | public static void checkPositive(int number, String message, Object... args) {
if (number < 0) {
throw new IllegalArgumentException(String.format(message, args));
}
} | [
"public",
"static",
"void",
"checkPositive",
"(",
"int",
"number",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"number",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"... | Validates that an argument is positive.
@param value The value to check.
@param message An exception message.
@param args Exception message arguments. | [
"Validates",
"that",
"an",
"argument",
"is",
"positive",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Args.java#L94-L98 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Args.java | Args.checkUri | public static void checkUri(String uri, String message, Object... args) {
try {
new URI(uri);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(String.format(message, args), e);
}
} | java | public static void checkUri(String uri, String message, Object... args) {
try {
new URI(uri);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(String.format(message, args), e);
}
} | [
"public",
"static",
"void",
"checkUri",
"(",
"String",
"uri",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"new",
"URI",
"(",
"uri",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"I... | Validates that an argument is a valid URI.
@param uri The value to check.
@param message An exception message.
@param args Exception message arguments. | [
"Validates",
"that",
"an",
"argument",
"is",
"a",
"valid",
"URI",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Args.java#L120-L126 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultConnectionOutputGroup.java | DefaultConnectionOutputGroup.start | void start(final Handler<OutputGroup> startHandler) {
connection.doGroupStart(id, name, args, parent);
this.startHandler = startHandler;
} | java | void start(final Handler<OutputGroup> startHandler) {
connection.doGroupStart(id, name, args, parent);
this.startHandler = startHandler;
} | [
"void",
"start",
"(",
"final",
"Handler",
"<",
"OutputGroup",
">",
"startHandler",
")",
"{",
"connection",
".",
"doGroupStart",
"(",
"id",
",",
"name",
",",
"args",
",",
"parent",
")",
";",
"this",
".",
"startHandler",
"=",
"startHandler",
";",
"}"
] | Starts the output group. | [
"Starts",
"the",
"output",
"group",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/connection/impl/DefaultConnectionOutputGroup.java#L103-L106 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/logging/PortLoggerFactory.java | PortLoggerFactory.getLogger | public static PortLogger getLogger(Class<?> clazz, OutputCollector output) {
return getLogger(clazz.getCanonicalName(), output);
} | java | public static PortLogger getLogger(Class<?> clazz, OutputCollector output) {
return getLogger(clazz.getCanonicalName(), output);
} | [
"public",
"static",
"PortLogger",
"getLogger",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"OutputCollector",
"output",
")",
"{",
"return",
"getLogger",
"(",
"clazz",
".",
"getCanonicalName",
"(",
")",
",",
"output",
")",
";",
"}"
] | Creates an output port logger for the given type.
@param clazz The type being logged.
@param output The output to which to log messages.
@return An output port logger. | [
"Creates",
"an",
"output",
"port",
"logger",
"for",
"the",
"given",
"type",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/logging/PortLoggerFactory.java#L41-L43 | train |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/io/logging/PortLoggerFactory.java | PortLoggerFactory.getLogger | public static PortLogger getLogger(String name, OutputCollector output) {
Args.checkNotNull(name, "logger name cannot be null");
Map<OutputCollector, PortLogger> loggers = PortLoggerFactory.loggers.get(name);
if (loggers == null) {
loggers = new HashMap<>();
PortLoggerFactory.loggers.put(name, l... | java | public static PortLogger getLogger(String name, OutputCollector output) {
Args.checkNotNull(name, "logger name cannot be null");
Map<OutputCollector, PortLogger> loggers = PortLoggerFactory.loggers.get(name);
if (loggers == null) {
loggers = new HashMap<>();
PortLoggerFactory.loggers.put(name, l... | [
"public",
"static",
"PortLogger",
"getLogger",
"(",
"String",
"name",
",",
"OutputCollector",
"output",
")",
"{",
"Args",
".",
"checkNotNull",
"(",
"name",
",",
"\"logger name cannot be null\"",
")",
";",
"Map",
"<",
"OutputCollector",
",",
"PortLogger",
">",
"l... | Creates an output port logger with the given name.
@param name The logger name.
@param output The output to which to log messages.
@return An output port logger. | [
"Creates",
"an",
"output",
"port",
"logger",
"with",
"the",
"given",
"name",
"."
] | c5869dbc5fff89eb5262e83f7a81719b01a5ba6f | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/io/logging/PortLoggerFactory.java#L52-L66 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.