id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
158,800
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
IdentityPatchContext.writePatch
static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath()); } } try { try (final OutputStream os = new FileOutputStream(file)){ PatchXml.marshal(os, rollbackPatch); } } catch (XMLStreamException e) { throw new IOException(e); } }
java
static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath()); } } try { try (final OutputStream os = new FileOutputStream(file)){ PatchXml.marshal(os, rollbackPatch); } } catch (XMLStreamException e) { throw new IOException(e); } }
[ "static", "void", "writePatch", "(", "final", "Patch", "rollbackPatch", ",", "final", "File", "file", ")", "throws", "IOException", "{", "final", "File", "parent", "=", "file", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "parent", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "!", "parent", ".", "mkdirs", "(", ")", "&&", "!", "parent", ".", "exists", "(", ")", ")", "{", "throw", "PatchLogger", ".", "ROOT_LOGGER", ".", "cannotCreateDirectory", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "}", "try", "{", "try", "(", "final", "OutputStream", "os", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "PatchXml", ".", "marshal", "(", "os", ",", "rollbackPatch", ")", ";", "}", "}", "catch", "(", "XMLStreamException", "e", ")", "{", "throw", "new", "IOException", "(", "e", ")", ";", "}", "}" ]
Write the patch.xml @param rollbackPatch the patch @param file the target file @throws IOException
[ "Write", "the", "patch", ".", "xml" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L1073-L1087
158,801
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java
CliCommandBuilder.setController
public CliCommandBuilder setController(final String hostname, final int port) { setController(formatAddress(null, hostname, port)); return this; }
java
public CliCommandBuilder setController(final String hostname, final int port) { setController(formatAddress(null, hostname, port)); return this; }
[ "public", "CliCommandBuilder", "setController", "(", "final", "String", "hostname", ",", "final", "int", "port", ")", "{", "setController", "(", "formatAddress", "(", "null", ",", "hostname", ",", "port", ")", ")", ";", "return", "this", ";", "}" ]
Sets the hostname and port to connect to. @param hostname the host name @param port the port @return the builder
[ "Sets", "the", "hostname", "and", "port", "to", "connect", "to", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java#L199-L202
158,802
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java
CliCommandBuilder.setController
public CliCommandBuilder setController(final String protocol, final String hostname, final int port) { setController(formatAddress(protocol, hostname, port)); return this; }
java
public CliCommandBuilder setController(final String protocol, final String hostname, final int port) { setController(formatAddress(protocol, hostname, port)); return this; }
[ "public", "CliCommandBuilder", "setController", "(", "final", "String", "protocol", ",", "final", "String", "hostname", ",", "final", "int", "port", ")", "{", "setController", "(", "formatAddress", "(", "protocol", ",", "hostname", ",", "port", ")", ")", ";", "return", "this", ";", "}" ]
Sets the protocol, hostname and port to connect to. @param protocol the protocol to use @param hostname the host name @param port the port @return the builder
[ "Sets", "the", "protocol", "hostname", "and", "port", "to", "connect", "to", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java#L213-L216
158,803
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java
CliCommandBuilder.setTimeout
public CliCommandBuilder setTimeout(final int timeout) { if (timeout > 0) { addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout)); } else { addCliArgument(CliArgument.TIMEOUT, null); } return this; }
java
public CliCommandBuilder setTimeout(final int timeout) { if (timeout > 0) { addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout)); } else { addCliArgument(CliArgument.TIMEOUT, null); } return this; }
[ "public", "CliCommandBuilder", "setTimeout", "(", "final", "int", "timeout", ")", "{", "if", "(", "timeout", ">", "0", ")", "{", "addCliArgument", "(", "CliArgument", ".", "TIMEOUT", ",", "Integer", ".", "toString", "(", "timeout", ")", ")", ";", "}", "else", "{", "addCliArgument", "(", "CliArgument", ".", "TIMEOUT", ",", "null", ")", ";", "}", "return", "this", ";", "}" ]
Sets the timeout used when connecting to the server. @param timeout the time out to use @return the builder
[ "Sets", "the", "timeout", "used", "when", "connecting", "to", "the", "server", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java#L332-L339
158,804
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/Services.java
Services.addServerExecutorDependency
@Deprecated public static <T> ServiceBuilder<T> addServerExecutorDependency(ServiceBuilder<T> builder, Injector<ExecutorService> injector) { return builder.addDependency(ServerService.MANAGEMENT_EXECUTOR, ExecutorService.class, injector); }
java
@Deprecated public static <T> ServiceBuilder<T> addServerExecutorDependency(ServiceBuilder<T> builder, Injector<ExecutorService> injector) { return builder.addDependency(ServerService.MANAGEMENT_EXECUTOR, ExecutorService.class, injector); }
[ "@", "Deprecated", "public", "static", "<", "T", ">", "ServiceBuilder", "<", "T", ">", "addServerExecutorDependency", "(", "ServiceBuilder", "<", "T", ">", "builder", ",", "Injector", "<", "ExecutorService", ">", "injector", ")", "{", "return", "builder", ".", "addDependency", "(", "ServerService", ".", "MANAGEMENT_EXECUTOR", ",", "ExecutorService", ".", "class", ",", "injector", ")", ";", "}" ]
Creates dependency on management executor. @param builder the builder @param injector the injector @param <T> the parameter type @return service builder instance @deprecated Use {@link #requireServerExecutor(ServiceBuilder)} instead. This method will be removed in the future.
[ "Creates", "dependency", "on", "management", "executor", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/Services.java#L84-L87
158,805
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.handleChannelClosed
public void handleChannelClosed(final Channel closed, final IOException e) { for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { if (activeOperation.getChannel() == closed) { // Only call cancel, to also interrupt still active threads activeOperation.getResultHandler().cancel(); } } }
java
public void handleChannelClosed(final Channel closed, final IOException e) { for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { if (activeOperation.getChannel() == closed) { // Only call cancel, to also interrupt still active threads activeOperation.getResultHandler().cancel(); } } }
[ "public", "void", "handleChannelClosed", "(", "final", "Channel", "closed", ",", "final", "IOException", "e", ")", "{", "for", "(", "final", "ActiveOperationImpl", "<", "?", ",", "?", ">", "activeOperation", ":", "activeRequests", ".", "values", "(", ")", ")", "{", "if", "(", "activeOperation", ".", "getChannel", "(", ")", "==", "closed", ")", "{", "// Only call cancel, to also interrupt still active threads", "activeOperation", ".", "getResultHandler", "(", ")", ".", "cancel", "(", ")", ";", "}", "}", "}" ]
Receive a notification that the channel was closed. This is used for the {@link ManagementClientChannelStrategy.Establishing} since it might use multiple channels. @param closed the closed resource @param e the exception which occurred during close, if any
[ "Receive", "a", "notification", "that", "the", "channel", "was", "closed", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L114-L121
158,806
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.awaitCompletion
@Override public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException { long deadline = unit.toMillis(timeout) + System.currentTimeMillis(); lock.lock(); try { assert shutdown; while(activeCount != 0) { long remaining = deadline - System.currentTimeMillis(); if (remaining <= 0) { break; } condition.await(remaining, TimeUnit.MILLISECONDS); } boolean allComplete = activeCount == 0; if (!allComplete) { ProtocolLogger.ROOT_LOGGER.debugf("ActiveOperation(s) %s have not completed within %d %s", activeRequests.keySet(), timeout, unit); } return allComplete; } finally { lock.unlock(); } }
java
@Override public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException { long deadline = unit.toMillis(timeout) + System.currentTimeMillis(); lock.lock(); try { assert shutdown; while(activeCount != 0) { long remaining = deadline - System.currentTimeMillis(); if (remaining <= 0) { break; } condition.await(remaining, TimeUnit.MILLISECONDS); } boolean allComplete = activeCount == 0; if (!allComplete) { ProtocolLogger.ROOT_LOGGER.debugf("ActiveOperation(s) %s have not completed within %d %s", activeRequests.keySet(), timeout, unit); } return allComplete; } finally { lock.unlock(); } }
[ "@", "Override", "public", "boolean", "awaitCompletion", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "long", "deadline", "=", "unit", ".", "toMillis", "(", "timeout", ")", "+", "System", ".", "currentTimeMillis", "(", ")", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "assert", "shutdown", ";", "while", "(", "activeCount", "!=", "0", ")", "{", "long", "remaining", "=", "deadline", "-", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "remaining", "<=", "0", ")", "{", "break", ";", "}", "condition", ".", "await", "(", "remaining", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "boolean", "allComplete", "=", "activeCount", "==", "0", ";", "if", "(", "!", "allComplete", ")", "{", "ProtocolLogger", ".", "ROOT_LOGGER", ".", "debugf", "(", "\"ActiveOperation(s) %s have not completed within %d %s\"", ",", "activeRequests", ".", "keySet", "(", ")", ",", "timeout", ",", "unit", ")", ";", "}", "return", "allComplete", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Await the completion of all currently active operations. @param timeout the timeout @param unit the time unit @return {@code } false if the timeout was reached and there were still active operations @throws InterruptedException
[ "Await", "the", "completion", "of", "all", "currently", "active", "operations", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L161-L181
158,807
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.registerActiveOperation
protected <T, A> ActiveOperation<T, A> registerActiveOperation(final Integer id, A attachment, ActiveOperation.CompletedCallback<T> callback) { lock.lock(); try { // Check that we still allow registration // TODO WFCORE-199 distinguish client uses from server uses and limit this check to server uses // Using id==null may be one way to do this, but we need to consider ops that involve multiple requests // TODO WFCORE-845 consider using an IllegalStateException for this //assert ! shutdown; final Integer operationId; if(id == null) { // If we did not get an operationId, create a new one operationId = operationIdManager.createBatchId(); } else { // Check that the operationId is not already taken if(! operationIdManager.lockBatchId(id)) { throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(id); } operationId = id; } final ActiveOperationImpl<T, A> request = new ActiveOperationImpl<T, A>(operationId, attachment, getCheckedCallback(callback), this); final ActiveOperation<?, ?> existing = activeRequests.putIfAbsent(operationId, request); if(existing != null) { throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(operationId); } ProtocolLogger.ROOT_LOGGER.tracef("Registered active operation %d", operationId); activeCount++; // condition.signalAll(); return request; } finally { lock.unlock(); } }
java
protected <T, A> ActiveOperation<T, A> registerActiveOperation(final Integer id, A attachment, ActiveOperation.CompletedCallback<T> callback) { lock.lock(); try { // Check that we still allow registration // TODO WFCORE-199 distinguish client uses from server uses and limit this check to server uses // Using id==null may be one way to do this, but we need to consider ops that involve multiple requests // TODO WFCORE-845 consider using an IllegalStateException for this //assert ! shutdown; final Integer operationId; if(id == null) { // If we did not get an operationId, create a new one operationId = operationIdManager.createBatchId(); } else { // Check that the operationId is not already taken if(! operationIdManager.lockBatchId(id)) { throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(id); } operationId = id; } final ActiveOperationImpl<T, A> request = new ActiveOperationImpl<T, A>(operationId, attachment, getCheckedCallback(callback), this); final ActiveOperation<?, ?> existing = activeRequests.putIfAbsent(operationId, request); if(existing != null) { throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(operationId); } ProtocolLogger.ROOT_LOGGER.tracef("Registered active operation %d", operationId); activeCount++; // condition.signalAll(); return request; } finally { lock.unlock(); } }
[ "protected", "<", "T", ",", "A", ">", "ActiveOperation", "<", "T", ",", "A", ">", "registerActiveOperation", "(", "final", "Integer", "id", ",", "A", "attachment", ",", "ActiveOperation", ".", "CompletedCallback", "<", "T", ">", "callback", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "// Check that we still allow registration", "// TODO WFCORE-199 distinguish client uses from server uses and limit this check to server uses", "// Using id==null may be one way to do this, but we need to consider ops that involve multiple requests", "// TODO WFCORE-845 consider using an IllegalStateException for this", "//assert ! shutdown;", "final", "Integer", "operationId", ";", "if", "(", "id", "==", "null", ")", "{", "// If we did not get an operationId, create a new one", "operationId", "=", "operationIdManager", ".", "createBatchId", "(", ")", ";", "}", "else", "{", "// Check that the operationId is not already taken", "if", "(", "!", "operationIdManager", ".", "lockBatchId", "(", "id", ")", ")", "{", "throw", "ProtocolLogger", ".", "ROOT_LOGGER", ".", "operationIdAlreadyExists", "(", "id", ")", ";", "}", "operationId", "=", "id", ";", "}", "final", "ActiveOperationImpl", "<", "T", ",", "A", ">", "request", "=", "new", "ActiveOperationImpl", "<", "T", ",", "A", ">", "(", "operationId", ",", "attachment", ",", "getCheckedCallback", "(", "callback", ")", ",", "this", ")", ";", "final", "ActiveOperation", "<", "?", ",", "?", ">", "existing", "=", "activeRequests", ".", "putIfAbsent", "(", "operationId", ",", "request", ")", ";", "if", "(", "existing", "!=", "null", ")", "{", "throw", "ProtocolLogger", ".", "ROOT_LOGGER", ".", "operationIdAlreadyExists", "(", "operationId", ")", ";", "}", "ProtocolLogger", ".", "ROOT_LOGGER", ".", "tracef", "(", "\"Registered active operation %d\"", ",", "operationId", ")", ";", "activeCount", "++", ";", "// condition.signalAll();", "return", "request", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Register an active operation with a specific operation id. @param id the operation id @param attachment the shared attachment @param callback the completed callback @return the created active operation @throws java.lang.IllegalStateException if an operation with the same id is already registered
[ "Register", "an", "active", "operation", "with", "a", "specific", "operation", "id", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L380-L410
158,808
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.getActiveOperation
protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) { return getActiveOperation(header.getBatchId()); }
java
protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) { return getActiveOperation(header.getBatchId()); }
[ "protected", "<", "T", ",", "A", ">", "ActiveOperation", "<", "T", ",", "A", ">", "getActiveOperation", "(", "final", "ManagementRequestHeader", "header", ")", "{", "return", "getActiveOperation", "(", "header", ".", "getBatchId", "(", ")", ")", ";", "}" ]
Get an active operation. @param header the request header @return the active operation, {@code null} if if there is no registered operation
[ "Get", "an", "active", "operation", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L418-L420
158,809
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.getActiveOperation
protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) { //noinspection unchecked return (ActiveOperation<T, A>) activeRequests.get(id); }
java
protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) { //noinspection unchecked return (ActiveOperation<T, A>) activeRequests.get(id); }
[ "protected", "<", "T", ",", "A", ">", "ActiveOperation", "<", "T", ",", "A", ">", "getActiveOperation", "(", "final", "Integer", "id", ")", "{", "//noinspection unchecked", "return", "(", "ActiveOperation", "<", "T", ",", "A", ">", ")", "activeRequests", ".", "get", "(", "id", ")", ";", "}" ]
Get the active operation. @param id the active operation id @return the active operation, {@code null} if if there is no registered operation
[ "Get", "the", "active", "operation", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L428-L431
158,810
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.cancelAllActiveOperations
protected List<Integer> cancelAllActiveOperations() { final List<Integer> operations = new ArrayList<Integer>(); for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { activeOperation.asyncCancel(false); operations.add(activeOperation.getOperationId()); } return operations; }
java
protected List<Integer> cancelAllActiveOperations() { final List<Integer> operations = new ArrayList<Integer>(); for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { activeOperation.asyncCancel(false); operations.add(activeOperation.getOperationId()); } return operations; }
[ "protected", "List", "<", "Integer", ">", "cancelAllActiveOperations", "(", ")", "{", "final", "List", "<", "Integer", ">", "operations", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "final", "ActiveOperationImpl", "<", "?", ",", "?", ">", "activeOperation", ":", "activeRequests", ".", "values", "(", ")", ")", "{", "activeOperation", ".", "asyncCancel", "(", "false", ")", ";", "operations", ".", "add", "(", "activeOperation", ".", "getOperationId", "(", ")", ")", ";", "}", "return", "operations", ";", "}" ]
Cancel all currently active operations. @return a list of cancelled operations
[ "Cancel", "all", "currently", "active", "operations", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L438-L445
158,811
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.removeActiveOperation
protected <T, A> ActiveOperation<T, A> removeActiveOperation(Integer id) { final ActiveOperation<T, A> removed = removeUnderLock(id); if(removed != null) { for(final Map.Entry<Integer, ActiveRequest<?, ?>> requestEntry : requests.entrySet()) { final ActiveRequest<?, ?> request = requestEntry.getValue(); if(request.context == removed) { requests.remove(requestEntry.getKey()); } } } return removed; }
java
protected <T, A> ActiveOperation<T, A> removeActiveOperation(Integer id) { final ActiveOperation<T, A> removed = removeUnderLock(id); if(removed != null) { for(final Map.Entry<Integer, ActiveRequest<?, ?>> requestEntry : requests.entrySet()) { final ActiveRequest<?, ?> request = requestEntry.getValue(); if(request.context == removed) { requests.remove(requestEntry.getKey()); } } } return removed; }
[ "protected", "<", "T", ",", "A", ">", "ActiveOperation", "<", "T", ",", "A", ">", "removeActiveOperation", "(", "Integer", "id", ")", "{", "final", "ActiveOperation", "<", "T", ",", "A", ">", "removed", "=", "removeUnderLock", "(", "id", ")", ";", "if", "(", "removed", "!=", "null", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "Integer", ",", "ActiveRequest", "<", "?", ",", "?", ">", ">", "requestEntry", ":", "requests", ".", "entrySet", "(", ")", ")", "{", "final", "ActiveRequest", "<", "?", ",", "?", ">", "request", "=", "requestEntry", ".", "getValue", "(", ")", ";", "if", "(", "request", ".", "context", "==", "removed", ")", "{", "requests", ".", "remove", "(", "requestEntry", ".", "getKey", "(", ")", ")", ";", "}", "}", "}", "return", "removed", ";", "}" ]
Remove an active operation. @param id the operation id @return the removed active operation, {@code null} if there was no registered operation
[ "Remove", "an", "active", "operation", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L453-L464
158,812
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.safeWriteErrorResponse
protected static void safeWriteErrorResponse(final Channel channel, final ManagementProtocolHeader header, final Throwable error) { if(header.getType() == ManagementProtocol.TYPE_REQUEST) { try { writeErrorResponse(channel, (ManagementRequestHeader) header, error); } catch(IOException ioe) { ProtocolLogger.ROOT_LOGGER.tracef(ioe, "failed to write error response for %s on channel: %s", header, channel); } } }
java
protected static void safeWriteErrorResponse(final Channel channel, final ManagementProtocolHeader header, final Throwable error) { if(header.getType() == ManagementProtocol.TYPE_REQUEST) { try { writeErrorResponse(channel, (ManagementRequestHeader) header, error); } catch(IOException ioe) { ProtocolLogger.ROOT_LOGGER.tracef(ioe, "failed to write error response for %s on channel: %s", header, channel); } } }
[ "protected", "static", "void", "safeWriteErrorResponse", "(", "final", "Channel", "channel", ",", "final", "ManagementProtocolHeader", "header", ",", "final", "Throwable", "error", ")", "{", "if", "(", "header", ".", "getType", "(", ")", "==", "ManagementProtocol", ".", "TYPE_REQUEST", ")", "{", "try", "{", "writeErrorResponse", "(", "channel", ",", "(", "ManagementRequestHeader", ")", "header", ",", "error", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "ProtocolLogger", ".", "ROOT_LOGGER", ".", "tracef", "(", "ioe", ",", "\"failed to write error response for %s on channel: %s\"", ",", "header", ",", "channel", ")", ";", "}", "}", "}" ]
Safe write error response. @param channel the channel @param header the request header @param error the exception
[ "Safe", "write", "error", "response", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L489-L497
158,813
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.writeErrorResponse
protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(header, error); final MessageOutputStream output = channel.writeMessage(); try { writeHeader(response, output); output.close(); } finally { StreamUtils.safeClose(output); } }
java
protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(header, error); final MessageOutputStream output = channel.writeMessage(); try { writeHeader(response, output); output.close(); } finally { StreamUtils.safeClose(output); } }
[ "protected", "static", "void", "writeErrorResponse", "(", "final", "Channel", "channel", ",", "final", "ManagementRequestHeader", "header", ",", "final", "Throwable", "error", ")", "throws", "IOException", "{", "final", "ManagementResponseHeader", "response", "=", "ManagementResponseHeader", ".", "create", "(", "header", ",", "error", ")", ";", "final", "MessageOutputStream", "output", "=", "channel", ".", "writeMessage", "(", ")", ";", "try", "{", "writeHeader", "(", "response", ",", "output", ")", ";", "output", ".", "close", "(", ")", ";", "}", "finally", "{", "StreamUtils", ".", "safeClose", "(", "output", ")", ";", "}", "}" ]
Write an error response. @param channel the channel @param header the request @param error the error @throws IOException
[ "Write", "an", "error", "response", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L507-L516
158,814
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.writeHeader
protected static FlushableDataOutput writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException { final FlushableDataOutput output = FlushableDataOutputImpl.create(os); header.write(output); return output; }
java
protected static FlushableDataOutput writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException { final FlushableDataOutput output = FlushableDataOutputImpl.create(os); header.write(output); return output; }
[ "protected", "static", "FlushableDataOutput", "writeHeader", "(", "final", "ManagementProtocolHeader", "header", ",", "final", "OutputStream", "os", ")", "throws", "IOException", "{", "final", "FlushableDataOutput", "output", "=", "FlushableDataOutputImpl", ".", "create", "(", "os", ")", ";", "header", ".", "write", "(", "output", ")", ";", "return", "output", ";", "}" ]
Write the management protocol header. @param header the mgmt protocol header @param os the output stream @throws IOException
[ "Write", "the", "management", "protocol", "header", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L525-L529
158,815
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.getFallbackHandler
protected static <T, A> ManagementRequestHandler<T, A> getFallbackHandler(final ManagementRequestHeader header) { return new ManagementRequestHandler<T, A>() { @Override public void handleRequest(final DataInput input, ActiveOperation.ResultHandler<T> resultHandler, ManagementRequestContext<A> context) throws IOException { final Exception error = ProtocolLogger.ROOT_LOGGER.noSuchResponseHandler(Integer.toHexString(header.getRequestId())); if(resultHandler.failed(error)) { safeWriteErrorResponse(context.getChannel(), context.getRequestHeader(), error); } } }; }
java
protected static <T, A> ManagementRequestHandler<T, A> getFallbackHandler(final ManagementRequestHeader header) { return new ManagementRequestHandler<T, A>() { @Override public void handleRequest(final DataInput input, ActiveOperation.ResultHandler<T> resultHandler, ManagementRequestContext<A> context) throws IOException { final Exception error = ProtocolLogger.ROOT_LOGGER.noSuchResponseHandler(Integer.toHexString(header.getRequestId())); if(resultHandler.failed(error)) { safeWriteErrorResponse(context.getChannel(), context.getRequestHeader(), error); } } }; }
[ "protected", "static", "<", "T", ",", "A", ">", "ManagementRequestHandler", "<", "T", ",", "A", ">", "getFallbackHandler", "(", "final", "ManagementRequestHeader", "header", ")", "{", "return", "new", "ManagementRequestHandler", "<", "T", ",", "A", ">", "(", ")", "{", "@", "Override", "public", "void", "handleRequest", "(", "final", "DataInput", "input", ",", "ActiveOperation", ".", "ResultHandler", "<", "T", ">", "resultHandler", ",", "ManagementRequestContext", "<", "A", ">", "context", ")", "throws", "IOException", "{", "final", "Exception", "error", "=", "ProtocolLogger", ".", "ROOT_LOGGER", ".", "noSuchResponseHandler", "(", "Integer", ".", "toHexString", "(", "header", ".", "getRequestId", "(", ")", ")", ")", ";", "if", "(", "resultHandler", ".", "failed", "(", "error", ")", ")", "{", "safeWriteErrorResponse", "(", "context", ".", "getChannel", "(", ")", ",", "context", ".", "getRequestHeader", "(", ")", ",", "error", ")", ";", "}", "}", "}", ";", "}" ]
Get a fallback handler. @param header the protocol header @return the fallback handler
[ "Get", "a", "fallback", "handler", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L537-L547
158,816
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.processFile
static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException { if (mode == PatchingTaskContext.Mode.APPLY) { if (ENABLE_INVALIDATION) { updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG); backup(context, file); } } else if (mode == PatchingTaskContext.Mode.ROLLBACK) { updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG); restore(context, file); } else { throw new IllegalStateException(); } }
java
static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException { if (mode == PatchingTaskContext.Mode.APPLY) { if (ENABLE_INVALIDATION) { updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG); backup(context, file); } } else if (mode == PatchingTaskContext.Mode.ROLLBACK) { updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG); restore(context, file); } else { throw new IllegalStateException(); } }
[ "static", "void", "processFile", "(", "final", "IdentityPatchContext", "context", ",", "final", "File", "file", ",", "final", "PatchingTaskContext", ".", "Mode", "mode", ")", "throws", "IOException", "{", "if", "(", "mode", "==", "PatchingTaskContext", ".", "Mode", ".", "APPLY", ")", "{", "if", "(", "ENABLE_INVALIDATION", ")", "{", "updateJar", "(", "file", ",", "GOOD_ENDSIG_PATTERN", ",", "BAD_BYTE_SKIP", ",", "CRIPPLED_ENDSIG", ",", "GOOD_ENDSIG", ")", ";", "backup", "(", "context", ",", "file", ")", ";", "}", "}", "else", "if", "(", "mode", "==", "PatchingTaskContext", ".", "Mode", ".", "ROLLBACK", ")", "{", "updateJar", "(", "file", ",", "CRIPPLED_ENDSIG_PATTERN", ",", "BAD_BYTE_SKIP", ",", "GOOD_ENDSIG", ",", "CRIPPLED_ENDSIG", ")", ";", "restore", "(", "context", ",", "file", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "}" ]
Process a file. @param file the file to be processed @param mode the patching mode @throws IOException
[ "Process", "a", "file", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L150-L162
158,817
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.updateJar
private static void updateJar(final File file, final byte[] searchPattern, final int[] badSkipBytes, final int newSig, final int endSig) throws IOException { final RandomAccessFile raf = new RandomAccessFile(file, "rw"); try { final FileChannel channel = raf.getChannel(); try { long pos = channel.size() - ENDLEN; final ScanContext context; if (newSig == CRIPPLED_ENDSIG) { context = new ScanContext(GOOD_ENDSIG_PATTERN, CRIPPLED_ENDSIG_PATTERN); } else if (newSig == GOOD_ENDSIG) { context = new ScanContext(CRIPPLED_ENDSIG_PATTERN, GOOD_ENDSIG_PATTERN); } else { context = null; } if (!validateEndRecord(file, channel, pos, endSig)) { pos = scanForEndSig(file, channel, context); } if (pos == -1) { if (context.state == State.NOT_FOUND) { // Don't fail patching if we cannot validate a valid zip PatchLogger.ROOT_LOGGER.cannotInvalidateZip(file.getAbsolutePath()); } return; } // Update the central directory record channel.position(pos); final ByteBuffer buffer = ByteBuffer.allocate(4); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.putInt(newSig); buffer.flip(); while (buffer.hasRemaining()) { channel.write(buffer); } } finally { safeClose(channel); } } finally { safeClose(raf); } }
java
private static void updateJar(final File file, final byte[] searchPattern, final int[] badSkipBytes, final int newSig, final int endSig) throws IOException { final RandomAccessFile raf = new RandomAccessFile(file, "rw"); try { final FileChannel channel = raf.getChannel(); try { long pos = channel.size() - ENDLEN; final ScanContext context; if (newSig == CRIPPLED_ENDSIG) { context = new ScanContext(GOOD_ENDSIG_PATTERN, CRIPPLED_ENDSIG_PATTERN); } else if (newSig == GOOD_ENDSIG) { context = new ScanContext(CRIPPLED_ENDSIG_PATTERN, GOOD_ENDSIG_PATTERN); } else { context = null; } if (!validateEndRecord(file, channel, pos, endSig)) { pos = scanForEndSig(file, channel, context); } if (pos == -1) { if (context.state == State.NOT_FOUND) { // Don't fail patching if we cannot validate a valid zip PatchLogger.ROOT_LOGGER.cannotInvalidateZip(file.getAbsolutePath()); } return; } // Update the central directory record channel.position(pos); final ByteBuffer buffer = ByteBuffer.allocate(4); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.putInt(newSig); buffer.flip(); while (buffer.hasRemaining()) { channel.write(buffer); } } finally { safeClose(channel); } } finally { safeClose(raf); } }
[ "private", "static", "void", "updateJar", "(", "final", "File", "file", ",", "final", "byte", "[", "]", "searchPattern", ",", "final", "int", "[", "]", "badSkipBytes", ",", "final", "int", "newSig", ",", "final", "int", "endSig", ")", "throws", "IOException", "{", "final", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"rw\"", ")", ";", "try", "{", "final", "FileChannel", "channel", "=", "raf", ".", "getChannel", "(", ")", ";", "try", "{", "long", "pos", "=", "channel", ".", "size", "(", ")", "-", "ENDLEN", ";", "final", "ScanContext", "context", ";", "if", "(", "newSig", "==", "CRIPPLED_ENDSIG", ")", "{", "context", "=", "new", "ScanContext", "(", "GOOD_ENDSIG_PATTERN", ",", "CRIPPLED_ENDSIG_PATTERN", ")", ";", "}", "else", "if", "(", "newSig", "==", "GOOD_ENDSIG", ")", "{", "context", "=", "new", "ScanContext", "(", "CRIPPLED_ENDSIG_PATTERN", ",", "GOOD_ENDSIG_PATTERN", ")", ";", "}", "else", "{", "context", "=", "null", ";", "}", "if", "(", "!", "validateEndRecord", "(", "file", ",", "channel", ",", "pos", ",", "endSig", ")", ")", "{", "pos", "=", "scanForEndSig", "(", "file", ",", "channel", ",", "context", ")", ";", "}", "if", "(", "pos", "==", "-", "1", ")", "{", "if", "(", "context", ".", "state", "==", "State", ".", "NOT_FOUND", ")", "{", "// Don't fail patching if we cannot validate a valid zip", "PatchLogger", ".", "ROOT_LOGGER", ".", "cannotInvalidateZip", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "return", ";", "}", "// Update the central directory record", "channel", ".", "position", "(", "pos", ")", ";", "final", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "allocate", "(", "4", ")", ";", "buffer", ".", "order", "(", "ByteOrder", ".", "LITTLE_ENDIAN", ")", ";", "buffer", ".", "putInt", "(", "newSig", ")", ";", "buffer", ".", "flip", "(", ")", ";", "while", "(", "buffer", ".", "hasRemaining", "(", ")", ")", "{", "channel", ".", "write", "(", "buffer", ")", ";", "}", "}", "finally", "{", "safeClose", "(", "channel", ")", ";", "}", "}", "finally", "{", "safeClose", "(", "raf", ")", ";", "}", "}" ]
Update the central directory signature of a .jar. @param file the file to process @param searchPattern the search patter to use @param badSkipBytes the bad bytes skip table @param newSig the new signature @param endSig the expected signature @throws IOException
[ "Update", "the", "central", "directory", "signature", "of", "a", ".", "jar", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L174-L214
158,818
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.validateEndRecord
private static boolean validateEndRecord(File file, FileChannel channel, long startEndRecord, long endSig) throws IOException { try { channel.position(startEndRecord); final ByteBuffer endDirHeader = getByteBuffer(ENDLEN); read(endDirHeader, channel); if (endDirHeader.limit() < ENDLEN) { // Couldn't read the full end of central directory record header return false; } else if (getUnsignedInt(endDirHeader, 0) != endSig) { return false; } long pos = getUnsignedInt(endDirHeader, END_CENSTART); // TODO deal with Zip64 if (pos == ZIP64_MARKER) { return false; } ByteBuffer cdfhBuffer = getByteBuffer(CENLEN); read(cdfhBuffer, channel, pos); long header = getUnsignedInt(cdfhBuffer, 0); if (header == CENSIG) { long firstLoc = getUnsignedInt(cdfhBuffer, CEN_LOC_OFFSET); long firstSize = getUnsignedInt(cdfhBuffer, CENSIZ); if (firstLoc == 0) { // normal case -- first bytes are the first local file if (!validateLocalFileRecord(channel, 0, firstSize)) { return false; } } else { // confirm that firstLoc is indeed the first local file long fileFirstLoc = scanForLocSig(channel); if (firstLoc != fileFirstLoc) { if (fileFirstLoc == 0) { return false; } else { // scanForLocSig() found a LOCSIG, but not at position zero and not // at the expected position. // With a file like this, we can't tell if we're in a nested zip // or we're in an outer zip and had the bad luck to find random bytes // that look like LOCSIG. return false; } } } // At this point, endDirHeader points to the correct end of central dir record. // Just need to validate the record is complete, including any comment int commentLen = getUnsignedShort(endDirHeader, END_COMMENTLEN); long commentEnd = startEndRecord + ENDLEN + commentLen; return commentEnd <= channel.size(); } return false; } catch (EOFException eof) { // pos or firstLoc weren't really positions and moved us to an invalid location return false; } }
java
private static boolean validateEndRecord(File file, FileChannel channel, long startEndRecord, long endSig) throws IOException { try { channel.position(startEndRecord); final ByteBuffer endDirHeader = getByteBuffer(ENDLEN); read(endDirHeader, channel); if (endDirHeader.limit() < ENDLEN) { // Couldn't read the full end of central directory record header return false; } else if (getUnsignedInt(endDirHeader, 0) != endSig) { return false; } long pos = getUnsignedInt(endDirHeader, END_CENSTART); // TODO deal with Zip64 if (pos == ZIP64_MARKER) { return false; } ByteBuffer cdfhBuffer = getByteBuffer(CENLEN); read(cdfhBuffer, channel, pos); long header = getUnsignedInt(cdfhBuffer, 0); if (header == CENSIG) { long firstLoc = getUnsignedInt(cdfhBuffer, CEN_LOC_OFFSET); long firstSize = getUnsignedInt(cdfhBuffer, CENSIZ); if (firstLoc == 0) { // normal case -- first bytes are the first local file if (!validateLocalFileRecord(channel, 0, firstSize)) { return false; } } else { // confirm that firstLoc is indeed the first local file long fileFirstLoc = scanForLocSig(channel); if (firstLoc != fileFirstLoc) { if (fileFirstLoc == 0) { return false; } else { // scanForLocSig() found a LOCSIG, but not at position zero and not // at the expected position. // With a file like this, we can't tell if we're in a nested zip // or we're in an outer zip and had the bad luck to find random bytes // that look like LOCSIG. return false; } } } // At this point, endDirHeader points to the correct end of central dir record. // Just need to validate the record is complete, including any comment int commentLen = getUnsignedShort(endDirHeader, END_COMMENTLEN); long commentEnd = startEndRecord + ENDLEN + commentLen; return commentEnd <= channel.size(); } return false; } catch (EOFException eof) { // pos or firstLoc weren't really positions and moved us to an invalid location return false; } }
[ "private", "static", "boolean", "validateEndRecord", "(", "File", "file", ",", "FileChannel", "channel", ",", "long", "startEndRecord", ",", "long", "endSig", ")", "throws", "IOException", "{", "try", "{", "channel", ".", "position", "(", "startEndRecord", ")", ";", "final", "ByteBuffer", "endDirHeader", "=", "getByteBuffer", "(", "ENDLEN", ")", ";", "read", "(", "endDirHeader", ",", "channel", ")", ";", "if", "(", "endDirHeader", ".", "limit", "(", ")", "<", "ENDLEN", ")", "{", "// Couldn't read the full end of central directory record header", "return", "false", ";", "}", "else", "if", "(", "getUnsignedInt", "(", "endDirHeader", ",", "0", ")", "!=", "endSig", ")", "{", "return", "false", ";", "}", "long", "pos", "=", "getUnsignedInt", "(", "endDirHeader", ",", "END_CENSTART", ")", ";", "// TODO deal with Zip64", "if", "(", "pos", "==", "ZIP64_MARKER", ")", "{", "return", "false", ";", "}", "ByteBuffer", "cdfhBuffer", "=", "getByteBuffer", "(", "CENLEN", ")", ";", "read", "(", "cdfhBuffer", ",", "channel", ",", "pos", ")", ";", "long", "header", "=", "getUnsignedInt", "(", "cdfhBuffer", ",", "0", ")", ";", "if", "(", "header", "==", "CENSIG", ")", "{", "long", "firstLoc", "=", "getUnsignedInt", "(", "cdfhBuffer", ",", "CEN_LOC_OFFSET", ")", ";", "long", "firstSize", "=", "getUnsignedInt", "(", "cdfhBuffer", ",", "CENSIZ", ")", ";", "if", "(", "firstLoc", "==", "0", ")", "{", "// normal case -- first bytes are the first local file", "if", "(", "!", "validateLocalFileRecord", "(", "channel", ",", "0", ",", "firstSize", ")", ")", "{", "return", "false", ";", "}", "}", "else", "{", "// confirm that firstLoc is indeed the first local file", "long", "fileFirstLoc", "=", "scanForLocSig", "(", "channel", ")", ";", "if", "(", "firstLoc", "!=", "fileFirstLoc", ")", "{", "if", "(", "fileFirstLoc", "==", "0", ")", "{", "return", "false", ";", "}", "else", "{", "// scanForLocSig() found a LOCSIG, but not at position zero and not", "// at the expected position.", "// With a file like this, we can't tell if we're in a nested zip", "// or we're in an outer zip and had the bad luck to find random bytes", "// that look like LOCSIG.", "return", "false", ";", "}", "}", "}", "// At this point, endDirHeader points to the correct end of central dir record.", "// Just need to validate the record is complete, including any comment", "int", "commentLen", "=", "getUnsignedShort", "(", "endDirHeader", ",", "END_COMMENTLEN", ")", ";", "long", "commentEnd", "=", "startEndRecord", "+", "ENDLEN", "+", "commentLen", ";", "return", "commentEnd", "<=", "channel", ".", "size", "(", ")", ";", "}", "return", "false", ";", "}", "catch", "(", "EOFException", "eof", ")", "{", "// pos or firstLoc weren't really positions and moved us to an invalid location", "return", "false", ";", "}", "}" ]
Validates that the data structure at position startEndRecord has a field in the expected position that points to the start of the first central directory file, and, if so, that the file has a complete end of central directory record comment at the end. @param file the file being checked @param channel the channel @param startEndRecord the start of the end of central directory record @param endSig the end of central dir signature @return true if it can be confirmed that the end of directory record points to a central directory file and a complete comment is present, false otherwise @throws java.io.IOException
[ "Validates", "that", "the", "data", "structure", "at", "position", "startEndRecord", "has", "a", "field", "in", "the", "expected", "position", "that", "points", "to", "the", "start", "of", "the", "first", "central", "directory", "file", "and", "if", "so", "that", "the", "file", "has", "a", "complete", "end", "of", "central", "directory", "record", "comment", "at", "the", "end", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L257-L317
158,819
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.scanForEndSig
private static long scanForEndSig(final File file, final FileChannel channel, final ScanContext context) throws IOException { // TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex ByteBuffer bb = getByteBuffer(CHUNK_SIZE); long start = channel.size(); long end = Math.max(0, start - MAX_REVERSE_SCAN); long channelPos = Math.max(0, start - CHUNK_SIZE); long lastChannelPos = channelPos; while (lastChannelPos >= end) { read(bb, channel, channelPos); int actualRead = bb.limit(); int bufferPos = actualRead - 1; while (bufferPos >= SIG_PATTERN_LENGTH) { // Following is based on the Boyer Moore algorithm but simplified to reflect // a) the pattern is static // b) the pattern has no repeating bytes int patternPos; for (patternPos = SIG_PATTERN_LENGTH - 1; patternPos >= 0 && context.matches(patternPos, bb.get(bufferPos - patternPos)); --patternPos) { // empty loop while bytes match } // Switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm switch (patternPos) { case -1: { final State state = context.state; // Pattern matched. Confirm is this is the start of a valid end of central dir record long startEndRecord = channelPos + bufferPos - SIG_PATTERN_LENGTH + 1; if (validateEndRecord(file, channel, startEndRecord, context.getSig())) { if (state == State.FOUND) { return startEndRecord; } else { return -1; } } // wasn't a valid end record; continue scan bufferPos -= 4; break; } case 3: { // No bytes matched; the common case. // With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may // produce a shift greater than the "good suffix array" (which would shift 1 byte) int idx = bb.get(bufferPos - patternPos) - Byte.MIN_VALUE; bufferPos -= BAD_BYTE_SKIP[idx]; break; } default: // 1 or more bytes matched bufferPos -= 4; } } // Move back a full chunk. If we didn't read a full chunk, that's ok, // it means we read all data and the outer while loop will terminate if (channelPos <= bufferPos) { break; } lastChannelPos = channelPos; channelPos -= Math.min(channelPos - bufferPos, CHUNK_SIZE - bufferPos); } return -1; }
java
private static long scanForEndSig(final File file, final FileChannel channel, final ScanContext context) throws IOException { // TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex ByteBuffer bb = getByteBuffer(CHUNK_SIZE); long start = channel.size(); long end = Math.max(0, start - MAX_REVERSE_SCAN); long channelPos = Math.max(0, start - CHUNK_SIZE); long lastChannelPos = channelPos; while (lastChannelPos >= end) { read(bb, channel, channelPos); int actualRead = bb.limit(); int bufferPos = actualRead - 1; while (bufferPos >= SIG_PATTERN_LENGTH) { // Following is based on the Boyer Moore algorithm but simplified to reflect // a) the pattern is static // b) the pattern has no repeating bytes int patternPos; for (patternPos = SIG_PATTERN_LENGTH - 1; patternPos >= 0 && context.matches(patternPos, bb.get(bufferPos - patternPos)); --patternPos) { // empty loop while bytes match } // Switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm switch (patternPos) { case -1: { final State state = context.state; // Pattern matched. Confirm is this is the start of a valid end of central dir record long startEndRecord = channelPos + bufferPos - SIG_PATTERN_LENGTH + 1; if (validateEndRecord(file, channel, startEndRecord, context.getSig())) { if (state == State.FOUND) { return startEndRecord; } else { return -1; } } // wasn't a valid end record; continue scan bufferPos -= 4; break; } case 3: { // No bytes matched; the common case. // With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may // produce a shift greater than the "good suffix array" (which would shift 1 byte) int idx = bb.get(bufferPos - patternPos) - Byte.MIN_VALUE; bufferPos -= BAD_BYTE_SKIP[idx]; break; } default: // 1 or more bytes matched bufferPos -= 4; } } // Move back a full chunk. If we didn't read a full chunk, that's ok, // it means we read all data and the outer while loop will terminate if (channelPos <= bufferPos) { break; } lastChannelPos = channelPos; channelPos -= Math.min(channelPos - bufferPos, CHUNK_SIZE - bufferPos); } return -1; }
[ "private", "static", "long", "scanForEndSig", "(", "final", "File", "file", ",", "final", "FileChannel", "channel", ",", "final", "ScanContext", "context", ")", "throws", "IOException", "{", "// TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex", "ByteBuffer", "bb", "=", "getByteBuffer", "(", "CHUNK_SIZE", ")", ";", "long", "start", "=", "channel", ".", "size", "(", ")", ";", "long", "end", "=", "Math", ".", "max", "(", "0", ",", "start", "-", "MAX_REVERSE_SCAN", ")", ";", "long", "channelPos", "=", "Math", ".", "max", "(", "0", ",", "start", "-", "CHUNK_SIZE", ")", ";", "long", "lastChannelPos", "=", "channelPos", ";", "while", "(", "lastChannelPos", ">=", "end", ")", "{", "read", "(", "bb", ",", "channel", ",", "channelPos", ")", ";", "int", "actualRead", "=", "bb", ".", "limit", "(", ")", ";", "int", "bufferPos", "=", "actualRead", "-", "1", ";", "while", "(", "bufferPos", ">=", "SIG_PATTERN_LENGTH", ")", "{", "// Following is based on the Boyer Moore algorithm but simplified to reflect", "// a) the pattern is static", "// b) the pattern has no repeating bytes", "int", "patternPos", ";", "for", "(", "patternPos", "=", "SIG_PATTERN_LENGTH", "-", "1", ";", "patternPos", ">=", "0", "&&", "context", ".", "matches", "(", "patternPos", ",", "bb", ".", "get", "(", "bufferPos", "-", "patternPos", ")", ")", ";", "--", "patternPos", ")", "{", "// empty loop while bytes match", "}", "// Switch gives same results as checking the \"good suffix array\" in the Boyer Moore algorithm", "switch", "(", "patternPos", ")", "{", "case", "-", "1", ":", "{", "final", "State", "state", "=", "context", ".", "state", ";", "// Pattern matched. Confirm is this is the start of a valid end of central dir record", "long", "startEndRecord", "=", "channelPos", "+", "bufferPos", "-", "SIG_PATTERN_LENGTH", "+", "1", ";", "if", "(", "validateEndRecord", "(", "file", ",", "channel", ",", "startEndRecord", ",", "context", ".", "getSig", "(", ")", ")", ")", "{", "if", "(", "state", "==", "State", ".", "FOUND", ")", "{", "return", "startEndRecord", ";", "}", "else", "{", "return", "-", "1", ";", "}", "}", "// wasn't a valid end record; continue scan", "bufferPos", "-=", "4", ";", "break", ";", "}", "case", "3", ":", "{", "// No bytes matched; the common case.", "// With our pattern, this is the only case where the Boyer Moore algorithm's \"bad char array\" may", "// produce a shift greater than the \"good suffix array\" (which would shift 1 byte)", "int", "idx", "=", "bb", ".", "get", "(", "bufferPos", "-", "patternPos", ")", "-", "Byte", ".", "MIN_VALUE", ";", "bufferPos", "-=", "BAD_BYTE_SKIP", "[", "idx", "]", ";", "break", ";", "}", "default", ":", "// 1 or more bytes matched", "bufferPos", "-=", "4", ";", "}", "}", "// Move back a full chunk. If we didn't read a full chunk, that's ok,", "// it means we read all data and the outer while loop will terminate", "if", "(", "channelPos", "<=", "bufferPos", ")", "{", "break", ";", "}", "lastChannelPos", "=", "channelPos", ";", "channelPos", "-=", "Math", ".", "min", "(", "channelPos", "-", "bufferPos", ",", "CHUNK_SIZE", "-", "bufferPos", ")", ";", "}", "return", "-", "1", ";", "}" ]
Boyer Moore scan that proceeds backwards from the end of the file looking for endsig @param file the file being checked @param channel the channel @param context the scan context @return @throws IOException
[ "Boyer", "Moore", "scan", "that", "proceeds", "backwards", "from", "the", "end", "of", "the", "file", "looking", "for", "endsig" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L328-L399
158,820
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.scanForLocSig
private static long scanForLocSig(FileChannel channel) throws IOException { channel.position(0); ByteBuffer bb = getByteBuffer(CHUNK_SIZE); long end = channel.size(); while (channel.position() <= end) { read(bb, channel); int bufferPos = 0; while (bufferPos <= bb.limit() - SIG_PATTERN_LENGTH) { // Following is based on the Boyer Moore algorithm but simplified to reflect // a) the size of the pattern is static // b) the pattern is static and has no repeating bytes int patternPos; for (patternPos = SIG_PATTERN_LENGTH - 1; patternPos >= 0 && LOCSIG_PATTERN[patternPos] == bb.get(bufferPos + patternPos); --patternPos) { // empty loop while bytes match } // Outer switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm switch (patternPos) { case -1: { // Pattern matched. Confirm is this is the start of a valid local file record long startLocRecord = channel.position() - bb.limit() + bufferPos; long currentPos = channel.position(); if (validateLocalFileRecord(channel, startLocRecord, -1)) { return startLocRecord; } // Restore position in case it shifted channel.position(currentPos); // wasn't a valid local file record; continue scan bufferPos += 4; break; } case 3: { // No bytes matched; the common case. // With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may // produce a shift greater than the "good suffix array" (which would shift 1 byte) int idx = bb.get(bufferPos + patternPos) - Byte.MIN_VALUE; bufferPos += LOC_BAD_BYTE_SKIP[idx]; break; } default: // 1 or more bytes matched bufferPos += 4; } } } return -1; }
java
private static long scanForLocSig(FileChannel channel) throws IOException { channel.position(0); ByteBuffer bb = getByteBuffer(CHUNK_SIZE); long end = channel.size(); while (channel.position() <= end) { read(bb, channel); int bufferPos = 0; while (bufferPos <= bb.limit() - SIG_PATTERN_LENGTH) { // Following is based on the Boyer Moore algorithm but simplified to reflect // a) the size of the pattern is static // b) the pattern is static and has no repeating bytes int patternPos; for (patternPos = SIG_PATTERN_LENGTH - 1; patternPos >= 0 && LOCSIG_PATTERN[patternPos] == bb.get(bufferPos + patternPos); --patternPos) { // empty loop while bytes match } // Outer switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm switch (patternPos) { case -1: { // Pattern matched. Confirm is this is the start of a valid local file record long startLocRecord = channel.position() - bb.limit() + bufferPos; long currentPos = channel.position(); if (validateLocalFileRecord(channel, startLocRecord, -1)) { return startLocRecord; } // Restore position in case it shifted channel.position(currentPos); // wasn't a valid local file record; continue scan bufferPos += 4; break; } case 3: { // No bytes matched; the common case. // With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may // produce a shift greater than the "good suffix array" (which would shift 1 byte) int idx = bb.get(bufferPos + patternPos) - Byte.MIN_VALUE; bufferPos += LOC_BAD_BYTE_SKIP[idx]; break; } default: // 1 or more bytes matched bufferPos += 4; } } } return -1; }
[ "private", "static", "long", "scanForLocSig", "(", "FileChannel", "channel", ")", "throws", "IOException", "{", "channel", ".", "position", "(", "0", ")", ";", "ByteBuffer", "bb", "=", "getByteBuffer", "(", "CHUNK_SIZE", ")", ";", "long", "end", "=", "channel", ".", "size", "(", ")", ";", "while", "(", "channel", ".", "position", "(", ")", "<=", "end", ")", "{", "read", "(", "bb", ",", "channel", ")", ";", "int", "bufferPos", "=", "0", ";", "while", "(", "bufferPos", "<=", "bb", ".", "limit", "(", ")", "-", "SIG_PATTERN_LENGTH", ")", "{", "// Following is based on the Boyer Moore algorithm but simplified to reflect", "// a) the size of the pattern is static", "// b) the pattern is static and has no repeating bytes", "int", "patternPos", ";", "for", "(", "patternPos", "=", "SIG_PATTERN_LENGTH", "-", "1", ";", "patternPos", ">=", "0", "&&", "LOCSIG_PATTERN", "[", "patternPos", "]", "==", "bb", ".", "get", "(", "bufferPos", "+", "patternPos", ")", ";", "--", "patternPos", ")", "{", "// empty loop while bytes match", "}", "// Outer switch gives same results as checking the \"good suffix array\" in the Boyer Moore algorithm", "switch", "(", "patternPos", ")", "{", "case", "-", "1", ":", "{", "// Pattern matched. Confirm is this is the start of a valid local file record", "long", "startLocRecord", "=", "channel", ".", "position", "(", ")", "-", "bb", ".", "limit", "(", ")", "+", "bufferPos", ";", "long", "currentPos", "=", "channel", ".", "position", "(", ")", ";", "if", "(", "validateLocalFileRecord", "(", "channel", ",", "startLocRecord", ",", "-", "1", ")", ")", "{", "return", "startLocRecord", ";", "}", "// Restore position in case it shifted", "channel", ".", "position", "(", "currentPos", ")", ";", "// wasn't a valid local file record; continue scan", "bufferPos", "+=", "4", ";", "break", ";", "}", "case", "3", ":", "{", "// No bytes matched; the common case.", "// With our pattern, this is the only case where the Boyer Moore algorithm's \"bad char array\" may", "// produce a shift greater than the \"good suffix array\" (which would shift 1 byte)", "int", "idx", "=", "bb", ".", "get", "(", "bufferPos", "+", "patternPos", ")", "-", "Byte", ".", "MIN_VALUE", ";", "bufferPos", "+=", "LOC_BAD_BYTE_SKIP", "[", "idx", "]", ";", "break", ";", "}", "default", ":", "// 1 or more bytes matched", "bufferPos", "+=", "4", ";", "}", "}", "}", "return", "-", "1", ";", "}" ]
Boyer Moore scan that proceeds forwards from the end of the file looking for the first LOCSIG
[ "Boyer", "Moore", "scan", "that", "proceeds", "forwards", "from", "the", "end", "of", "the", "file", "looking", "for", "the", "first", "LOCSIG" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L404-L460
158,821
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.validateLocalFileRecord
private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException { ByteBuffer lfhBuffer = getByteBuffer(LOCLEN); read(lfhBuffer, channel, startLocRecord); if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) { return false; } if (compressedSize == -1) { // We can't further evaluate return true; } int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN); int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN); long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen; read(lfhBuffer, channel, nextSigPos); long header = getUnsignedInt(lfhBuffer, 0); return header == LOCSIG || header == EXTSIG || header == CENSIG; }
java
private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException { ByteBuffer lfhBuffer = getByteBuffer(LOCLEN); read(lfhBuffer, channel, startLocRecord); if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) { return false; } if (compressedSize == -1) { // We can't further evaluate return true; } int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN); int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN); long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen; read(lfhBuffer, channel, nextSigPos); long header = getUnsignedInt(lfhBuffer, 0); return header == LOCSIG || header == EXTSIG || header == CENSIG; }
[ "private", "static", "boolean", "validateLocalFileRecord", "(", "FileChannel", "channel", ",", "long", "startLocRecord", ",", "long", "compressedSize", ")", "throws", "IOException", "{", "ByteBuffer", "lfhBuffer", "=", "getByteBuffer", "(", "LOCLEN", ")", ";", "read", "(", "lfhBuffer", ",", "channel", ",", "startLocRecord", ")", ";", "if", "(", "lfhBuffer", ".", "limit", "(", ")", "<", "LOCLEN", "||", "getUnsignedInt", "(", "lfhBuffer", ",", "0", ")", "!=", "LOCSIG", ")", "{", "return", "false", ";", "}", "if", "(", "compressedSize", "==", "-", "1", ")", "{", "// We can't further evaluate", "return", "true", ";", "}", "int", "fnLen", "=", "getUnsignedShort", "(", "lfhBuffer", ",", "LOC_FILENAMELEN", ")", ";", "int", "extFieldLen", "=", "getUnsignedShort", "(", "lfhBuffer", ",", "LOC_EXTFLDLEN", ")", ";", "long", "nextSigPos", "=", "startLocRecord", "+", "LOCLEN", "+", "compressedSize", "+", "fnLen", "+", "extFieldLen", ";", "read", "(", "lfhBuffer", ",", "channel", ",", "nextSigPos", ")", ";", "long", "header", "=", "getUnsignedInt", "(", "lfhBuffer", ",", "0", ")", ";", "return", "header", "==", "LOCSIG", "||", "header", "==", "EXTSIG", "||", "header", "==", "CENSIG", ";", "}" ]
Checks that the data starting at startLocRecord looks like a local file record header. @param channel the channel @param startLocRecord offset into channel of the start of the local record @param compressedSize expected compressed size of the file, or -1 to indicate this isn't known
[ "Checks", "that", "the", "data", "starting", "at", "startLocRecord", "looks", "like", "a", "local", "file", "record", "header", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L469-L489
158,822
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.computeBadByteSkipArray
private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) { for (int a = 0; a < ALPHABET_SIZE; a++) { badByteArray[a] = pattern.length; } for (int j = 0; j < pattern.length - 1; j++) { badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1; } }
java
private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) { for (int a = 0; a < ALPHABET_SIZE; a++) { badByteArray[a] = pattern.length; } for (int j = 0; j < pattern.length - 1; j++) { badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1; } }
[ "private", "static", "void", "computeBadByteSkipArray", "(", "byte", "[", "]", "pattern", ",", "int", "[", "]", "badByteArray", ")", "{", "for", "(", "int", "a", "=", "0", ";", "a", "<", "ALPHABET_SIZE", ";", "a", "++", ")", "{", "badByteArray", "[", "a", "]", "=", "pattern", ".", "length", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "pattern", ".", "length", "-", "1", ";", "j", "++", ")", "{", "badByteArray", "[", "pattern", "[", "j", "]", "-", "Byte", ".", "MIN_VALUE", "]", "=", "pattern", ".", "length", "-", "j", "-", "1", ";", "}", "}" ]
Fills the Boyer Moore "bad character array" for the given pattern
[ "Fills", "the", "Boyer", "Moore", "bad", "character", "array", "for", "the", "given", "pattern" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L520-L528
158,823
wildfly/wildfly-core
embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java
EmbeddedProcessFactory.createHostController
public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) { if (jbossHomePath == null || jbossHomePath.isEmpty()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } File jbossHomeDir = new File(jbossHomePath); if (!jbossHomeDir.isDirectory()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } return createHostController( Configuration.Builder.of(jbossHomeDir) .setModulePath(modulePath) .setSystemPackages(systemPackages) .setCommandArguments(cmdargs) .build() ); }
java
public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) { if (jbossHomePath == null || jbossHomePath.isEmpty()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } File jbossHomeDir = new File(jbossHomePath); if (!jbossHomeDir.isDirectory()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } return createHostController( Configuration.Builder.of(jbossHomeDir) .setModulePath(modulePath) .setSystemPackages(systemPackages) .setCommandArguments(cmdargs) .build() ); }
[ "public", "static", "HostController", "createHostController", "(", "String", "jbossHomePath", ",", "String", "modulePath", ",", "String", "[", "]", "systemPackages", ",", "String", "[", "]", "cmdargs", ")", "{", "if", "(", "jbossHomePath", "==", "null", "||", "jbossHomePath", ".", "isEmpty", "(", ")", ")", "{", "throw", "EmbeddedLogger", ".", "ROOT_LOGGER", ".", "invalidJBossHome", "(", "jbossHomePath", ")", ";", "}", "File", "jbossHomeDir", "=", "new", "File", "(", "jbossHomePath", ")", ";", "if", "(", "!", "jbossHomeDir", ".", "isDirectory", "(", ")", ")", "{", "throw", "EmbeddedLogger", ".", "ROOT_LOGGER", ".", "invalidJBossHome", "(", "jbossHomePath", ")", ";", "}", "return", "createHostController", "(", "Configuration", ".", "Builder", ".", "of", "(", "jbossHomeDir", ")", ".", "setModulePath", "(", "modulePath", ")", ".", "setSystemPackages", "(", "systemPackages", ")", ".", "setCommandArguments", "(", "cmdargs", ")", ".", "build", "(", ")", ")", ";", "}" ]
Create an embedded host controller. @param jbossHomePath the location of the root of the host controller installation. Cannot be {@code null} or empty. @param modulePath the location of the root of the module repository. May be {@code null} if the standard location under {@code jbossHomePath} should be used @param systemPackages names of any packages that must be treated as system packages, with the same classes visible to the caller's classloader visible to host-controller-side classes loaded from the server's modular classloader @param cmdargs any additional arguments to pass to the embedded host controller (e.g. -b=192.168.100.10) @return the server. Will not be {@code null}
[ "Create", "an", "embedded", "host", "controller", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java#L206-L221
158,824
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorDependencyProcessor.java
ServiceActivatorDependencyProcessor.deploy
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment( Attachments.MODULE_SPECIFICATION); if(deploymentRoot == null) return; final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES); if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { moduleSpecification.addSystemDependency(MSC_DEP); } }
java
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment( Attachments.MODULE_SPECIFICATION); if(deploymentRoot == null) return; final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES); if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { moduleSpecification.addSystemDependency(MSC_DEP); } }
[ "public", "void", "deploy", "(", "DeploymentPhaseContext", "phaseContext", ")", "throws", "DeploymentUnitProcessingException", "{", "final", "ResourceRoot", "deploymentRoot", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ".", "getAttachment", "(", "Attachments", ".", "DEPLOYMENT_ROOT", ")", ";", "final", "ModuleSpecification", "moduleSpecification", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ".", "getAttachment", "(", "Attachments", ".", "MODULE_SPECIFICATION", ")", ";", "if", "(", "deploymentRoot", "==", "null", ")", "return", ";", "final", "ServicesAttachment", "servicesAttachments", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ".", "getAttachment", "(", "Attachments", ".", "SERVICES", ")", ";", "if", "(", "servicesAttachments", "!=", "null", "&&", "!", "servicesAttachments", ".", "getServiceImplementations", "(", "ServiceActivator", ".", "class", ".", "getName", "(", ")", ")", ".", "isEmpty", "(", ")", ")", "{", "moduleSpecification", ".", "addSystemDependency", "(", "MSC_DEP", ")", ";", "}", "}" ]
Add the dependencies if the deployment contains a service activator loader entry. @param phaseContext the deployment unit context @throws DeploymentUnitProcessingException
[ "Add", "the", "dependencies", "if", "the", "deployment", "contains", "a", "service", "activator", "loader", "entry", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorDependencyProcessor.java#L52-L62
158,825
wildfly/wildfly-core
request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java
ControlPoint.pause
public void pause(ServerActivityCallback requestCountListener) { if (paused) { throw ServerLogger.ROOT_LOGGER.serverAlreadyPaused(); } this.paused = true; listenerUpdater.set(this, requestCountListener); if (activeRequestCountUpdater.get(this) == 0) { if (listenerUpdater.compareAndSet(this, requestCountListener, null)) { requestCountListener.done(); } } }
java
public void pause(ServerActivityCallback requestCountListener) { if (paused) { throw ServerLogger.ROOT_LOGGER.serverAlreadyPaused(); } this.paused = true; listenerUpdater.set(this, requestCountListener); if (activeRequestCountUpdater.get(this) == 0) { if (listenerUpdater.compareAndSet(this, requestCountListener, null)) { requestCountListener.done(); } } }
[ "public", "void", "pause", "(", "ServerActivityCallback", "requestCountListener", ")", "{", "if", "(", "paused", ")", "{", "throw", "ServerLogger", ".", "ROOT_LOGGER", ".", "serverAlreadyPaused", "(", ")", ";", "}", "this", ".", "paused", "=", "true", ";", "listenerUpdater", ".", "set", "(", "this", ",", "requestCountListener", ")", ";", "if", "(", "activeRequestCountUpdater", ".", "get", "(", "this", ")", "==", "0", ")", "{", "if", "(", "listenerUpdater", ".", "compareAndSet", "(", "this", ",", "requestCountListener", ",", "null", ")", ")", "{", "requestCountListener", ".", "done", "(", ")", ";", "}", "}", "}" ]
Pause the current entry point, and invoke the provided listener when all current requests have finished. If individual control point tracking is not enabled then the listener will be invoked straight away @param requestCountListener The listener to invoke
[ "Pause", "the", "current", "entry", "point", "and", "invoke", "the", "provided", "listener", "when", "all", "current", "requests", "have", "finished", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java#L95-L106
158,826
wildfly/wildfly-core
request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java
ControlPoint.resume
public void resume() { this.paused = false; ServerActivityCallback listener = listenerUpdater.get(this); if (listener != null) { listenerUpdater.compareAndSet(this, listener, null); } }
java
public void resume() { this.paused = false; ServerActivityCallback listener = listenerUpdater.get(this); if (listener != null) { listenerUpdater.compareAndSet(this, listener, null); } }
[ "public", "void", "resume", "(", ")", "{", "this", ".", "paused", "=", "false", ";", "ServerActivityCallback", "listener", "=", "listenerUpdater", ".", "get", "(", "this", ")", ";", "if", "(", "listener", "!=", "null", ")", "{", "listenerUpdater", ".", "compareAndSet", "(", "this", ",", "listener", ",", "null", ")", ";", "}", "}" ]
Cancel the pause operation
[ "Cancel", "the", "pause", "operation" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java#L111-L117
158,827
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/mgmt/HostInfo.java
HostInfo.createLocalHostHostInfo
public static ModelNode createLocalHostHostInfo(final LocalHostControllerInfo hostInfo, final ProductConfig productConfig, final IgnoredDomainResourceRegistry ignoredResourceRegistry, final Resource hostModelResource) { final ModelNode info = new ModelNode(); info.get(NAME).set(hostInfo.getLocalHostName()); info.get(RELEASE_VERSION).set(Version.AS_VERSION); info.get(RELEASE_CODENAME).set(Version.AS_RELEASE_CODENAME); info.get(MANAGEMENT_MAJOR_VERSION).set(Version.MANAGEMENT_MAJOR_VERSION); info.get(MANAGEMENT_MINOR_VERSION).set(Version.MANAGEMENT_MINOR_VERSION); info.get(MANAGEMENT_MICRO_VERSION).set(Version.MANAGEMENT_MICRO_VERSION); final String productName = productConfig.getProductName(); final String productVersion = productConfig.getProductVersion(); if(productName != null) { info.get(PRODUCT_NAME).set(productName); } if(productVersion != null) { info.get(PRODUCT_VERSION).set(productVersion); } ModelNode ignoredModel = ignoredResourceRegistry.getIgnoredResourcesAsModel(); if (ignoredModel.hasDefined(IGNORED_RESOURCE_TYPE)) { info.get(IGNORED_RESOURCES).set(ignoredModel.require(IGNORED_RESOURCE_TYPE)); } boolean ignoreUnaffectedServerGroups = hostInfo.isRemoteDomainControllerIgnoreUnaffectedConfiguration(); IgnoredNonAffectedServerGroupsUtil.addCurrentServerGroupsToHostInfoModel(ignoreUnaffectedServerGroups, hostModelResource, info); return info; }
java
public static ModelNode createLocalHostHostInfo(final LocalHostControllerInfo hostInfo, final ProductConfig productConfig, final IgnoredDomainResourceRegistry ignoredResourceRegistry, final Resource hostModelResource) { final ModelNode info = new ModelNode(); info.get(NAME).set(hostInfo.getLocalHostName()); info.get(RELEASE_VERSION).set(Version.AS_VERSION); info.get(RELEASE_CODENAME).set(Version.AS_RELEASE_CODENAME); info.get(MANAGEMENT_MAJOR_VERSION).set(Version.MANAGEMENT_MAJOR_VERSION); info.get(MANAGEMENT_MINOR_VERSION).set(Version.MANAGEMENT_MINOR_VERSION); info.get(MANAGEMENT_MICRO_VERSION).set(Version.MANAGEMENT_MICRO_VERSION); final String productName = productConfig.getProductName(); final String productVersion = productConfig.getProductVersion(); if(productName != null) { info.get(PRODUCT_NAME).set(productName); } if(productVersion != null) { info.get(PRODUCT_VERSION).set(productVersion); } ModelNode ignoredModel = ignoredResourceRegistry.getIgnoredResourcesAsModel(); if (ignoredModel.hasDefined(IGNORED_RESOURCE_TYPE)) { info.get(IGNORED_RESOURCES).set(ignoredModel.require(IGNORED_RESOURCE_TYPE)); } boolean ignoreUnaffectedServerGroups = hostInfo.isRemoteDomainControllerIgnoreUnaffectedConfiguration(); IgnoredNonAffectedServerGroupsUtil.addCurrentServerGroupsToHostInfoModel(ignoreUnaffectedServerGroups, hostModelResource, info); return info; }
[ "public", "static", "ModelNode", "createLocalHostHostInfo", "(", "final", "LocalHostControllerInfo", "hostInfo", ",", "final", "ProductConfig", "productConfig", ",", "final", "IgnoredDomainResourceRegistry", "ignoredResourceRegistry", ",", "final", "Resource", "hostModelResource", ")", "{", "final", "ModelNode", "info", "=", "new", "ModelNode", "(", ")", ";", "info", ".", "get", "(", "NAME", ")", ".", "set", "(", "hostInfo", ".", "getLocalHostName", "(", ")", ")", ";", "info", ".", "get", "(", "RELEASE_VERSION", ")", ".", "set", "(", "Version", ".", "AS_VERSION", ")", ";", "info", ".", "get", "(", "RELEASE_CODENAME", ")", ".", "set", "(", "Version", ".", "AS_RELEASE_CODENAME", ")", ";", "info", ".", "get", "(", "MANAGEMENT_MAJOR_VERSION", ")", ".", "set", "(", "Version", ".", "MANAGEMENT_MAJOR_VERSION", ")", ";", "info", ".", "get", "(", "MANAGEMENT_MINOR_VERSION", ")", ".", "set", "(", "Version", ".", "MANAGEMENT_MINOR_VERSION", ")", ";", "info", ".", "get", "(", "MANAGEMENT_MICRO_VERSION", ")", ".", "set", "(", "Version", ".", "MANAGEMENT_MICRO_VERSION", ")", ";", "final", "String", "productName", "=", "productConfig", ".", "getProductName", "(", ")", ";", "final", "String", "productVersion", "=", "productConfig", ".", "getProductVersion", "(", ")", ";", "if", "(", "productName", "!=", "null", ")", "{", "info", ".", "get", "(", "PRODUCT_NAME", ")", ".", "set", "(", "productName", ")", ";", "}", "if", "(", "productVersion", "!=", "null", ")", "{", "info", ".", "get", "(", "PRODUCT_VERSION", ")", ".", "set", "(", "productVersion", ")", ";", "}", "ModelNode", "ignoredModel", "=", "ignoredResourceRegistry", ".", "getIgnoredResourcesAsModel", "(", ")", ";", "if", "(", "ignoredModel", ".", "hasDefined", "(", "IGNORED_RESOURCE_TYPE", ")", ")", "{", "info", ".", "get", "(", "IGNORED_RESOURCES", ")", ".", "set", "(", "ignoredModel", ".", "require", "(", "IGNORED_RESOURCE_TYPE", ")", ")", ";", "}", "boolean", "ignoreUnaffectedServerGroups", "=", "hostInfo", ".", "isRemoteDomainControllerIgnoreUnaffectedConfiguration", "(", ")", ";", "IgnoredNonAffectedServerGroupsUtil", ".", "addCurrentServerGroupsToHostInfoModel", "(", "ignoreUnaffectedServerGroups", ",", "hostModelResource", ",", "info", ")", ";", "return", "info", ";", "}" ]
Create the metadata which gets send to the DC when registering. @param hostInfo the local host info @param productConfig the product config @param ignoredResourceRegistry registry of ignored resources @return the host info
[ "Create", "the", "metadata", "which", "gets", "send", "to", "the", "DC", "when", "registering", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/mgmt/HostInfo.java#L85-L109
158,828
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/Environment.java
Environment.addModuleDir
public void addModuleDir(final String moduleDir) { if (moduleDir == null) { throw LauncherMessages.MESSAGES.nullParam("moduleDir"); } // Validate the path final Path path = Paths.get(moduleDir).normalize(); modulesDirs.add(path.toString()); }
java
public void addModuleDir(final String moduleDir) { if (moduleDir == null) { throw LauncherMessages.MESSAGES.nullParam("moduleDir"); } // Validate the path final Path path = Paths.get(moduleDir).normalize(); modulesDirs.add(path.toString()); }
[ "public", "void", "addModuleDir", "(", "final", "String", "moduleDir", ")", "{", "if", "(", "moduleDir", "==", "null", ")", "{", "throw", "LauncherMessages", ".", "MESSAGES", ".", "nullParam", "(", "\"moduleDir\"", ")", ";", "}", "// Validate the path", "final", "Path", "path", "=", "Paths", ".", "get", "(", "moduleDir", ")", ".", "normalize", "(", ")", ";", "modulesDirs", ".", "add", "(", "path", ".", "toString", "(", ")", ")", ";", "}" ]
Adds a directory to the collection of module paths. @param moduleDir the module directory to add @throws java.lang.IllegalArgumentException if the path is {@code null}
[ "Adds", "a", "directory", "to", "the", "collection", "of", "module", "paths", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Environment.java#L93-L100
158,829
wildfly/wildfly-core
launcher/src/main/java/org/wildfly/core/launcher/Environment.java
Environment.getModulePaths
public String getModulePaths() { final StringBuilder result = new StringBuilder(); if (addDefaultModuleDir) { result.append(wildflyHome.resolve("modules").toString()); } if (!modulesDirs.isEmpty()) { if (addDefaultModuleDir) result.append(File.pathSeparator); for (Iterator<String> iterator = modulesDirs.iterator(); iterator.hasNext(); ) { result.append(iterator.next()); if (iterator.hasNext()) { result.append(File.pathSeparator); } } } return result.toString(); }
java
public String getModulePaths() { final StringBuilder result = new StringBuilder(); if (addDefaultModuleDir) { result.append(wildflyHome.resolve("modules").toString()); } if (!modulesDirs.isEmpty()) { if (addDefaultModuleDir) result.append(File.pathSeparator); for (Iterator<String> iterator = modulesDirs.iterator(); iterator.hasNext(); ) { result.append(iterator.next()); if (iterator.hasNext()) { result.append(File.pathSeparator); } } } return result.toString(); }
[ "public", "String", "getModulePaths", "(", ")", "{", "final", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "addDefaultModuleDir", ")", "{", "result", ".", "append", "(", "wildflyHome", ".", "resolve", "(", "\"modules\"", ")", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "!", "modulesDirs", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "addDefaultModuleDir", ")", "result", ".", "append", "(", "File", ".", "pathSeparator", ")", ";", "for", "(", "Iterator", "<", "String", ">", "iterator", "=", "modulesDirs", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "result", ".", "append", "(", "iterator", ".", "next", "(", ")", ")", ";", "if", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "result", ".", "append", "(", "File", ".", "pathSeparator", ")", ";", "}", "}", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Returns the modules paths used on the command line. @return the paths separated by the {@link File#pathSeparator path separator}
[ "Returns", "the", "modules", "paths", "used", "on", "the", "command", "line", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Environment.java#L171-L186
158,830
wildfly/wildfly-core
controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java
ExistingChannelModelControllerClient.createAndAdd
public static ModelControllerClient createAndAdd(final ManagementChannelHandler handler) { final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler); handler.addHandlerFactory(client); return client; }
java
public static ModelControllerClient createAndAdd(final ManagementChannelHandler handler) { final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler); handler.addHandlerFactory(client); return client; }
[ "public", "static", "ModelControllerClient", "createAndAdd", "(", "final", "ManagementChannelHandler", "handler", ")", "{", "final", "ExistingChannelModelControllerClient", "client", "=", "new", "ExistingChannelModelControllerClient", "(", "handler", ")", ";", "handler", ".", "addHandlerFactory", "(", "client", ")", ";", "return", "client", ";", "}" ]
Create and add model controller handler to an existing management channel handler. @param handler the channel handler @return the created client
[ "Create", "and", "add", "model", "controller", "handler", "to", "an", "existing", "management", "channel", "handler", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java#L63-L67
158,831
wildfly/wildfly-core
controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java
ExistingChannelModelControllerClient.createReceiving
public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) { final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel); final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService); final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler); handler.addHandlerFactory(client); channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(Channel closed, IOException exception) { handler.shutdown(); try { handler.awaitCompletion(1, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { handler.shutdownNow(); } } }); channel.receiveMessage(handler.getReceiver()); return client; }
java
public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) { final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel); final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService); final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler); handler.addHandlerFactory(client); channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(Channel closed, IOException exception) { handler.shutdown(); try { handler.awaitCompletion(1, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { handler.shutdownNow(); } } }); channel.receiveMessage(handler.getReceiver()); return client; }
[ "public", "static", "ModelControllerClient", "createReceiving", "(", "final", "Channel", "channel", ",", "final", "ExecutorService", "executorService", ")", "{", "final", "ManagementClientChannelStrategy", "strategy", "=", "ManagementClientChannelStrategy", ".", "create", "(", "channel", ")", ";", "final", "ManagementChannelHandler", "handler", "=", "new", "ManagementChannelHandler", "(", "strategy", ",", "executorService", ")", ";", "final", "ExistingChannelModelControllerClient", "client", "=", "new", "ExistingChannelModelControllerClient", "(", "handler", ")", ";", "handler", ".", "addHandlerFactory", "(", "client", ")", ";", "channel", ".", "addCloseHandler", "(", "new", "CloseHandler", "<", "Channel", ">", "(", ")", "{", "@", "Override", "public", "void", "handleClose", "(", "Channel", "closed", ",", "IOException", "exception", ")", "{", "handler", ".", "shutdown", "(", ")", ";", "try", "{", "handler", ".", "awaitCompletion", "(", "1", ",", "TimeUnit", ".", "SECONDS", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "}", "finally", "{", "handler", ".", "shutdownNow", "(", ")", ";", "}", "}", "}", ")", ";", "channel", ".", "receiveMessage", "(", "handler", ".", "getReceiver", "(", ")", ")", ";", "return", "client", ";", "}" ]
Create a model controller client which is exclusively receiving messages on an existing channel. @param channel the channel @param executorService an executor @return the created client
[ "Create", "a", "model", "controller", "client", "which", "is", "exclusively", "receiving", "messages", "on", "an", "existing", "channel", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java#L76-L96
158,832
wildfly/wildfly-core
domain-management/src/main/java/org/jboss/as/domain/management/security/UserPropertiesFileLoader.java
UserPropertiesFileLoader.addLineContent
@Override protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException { // Is the line an empty comment "#" ? if (line.startsWith(COMMENT_PREFIX) && line.length() == 1) { String nextLine = bufferedFileReader.readLine(); if (nextLine != null) { // Is the next line the realm name "#$REALM_NAME=" ? if (nextLine.startsWith(COMMENT_PREFIX) && nextLine.contains(REALM_COMMENT_PREFIX)) { // Realm name block detected! // The next line must be and empty comment "#" bufferedFileReader.readLine(); // Avoid adding the realm block } else { // It's a user comment... content.add(line); content.add(nextLine); } } else { super.addLineContent(bufferedFileReader, content, line); } } else { super.addLineContent(bufferedFileReader, content, line); } }
java
@Override protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException { // Is the line an empty comment "#" ? if (line.startsWith(COMMENT_PREFIX) && line.length() == 1) { String nextLine = bufferedFileReader.readLine(); if (nextLine != null) { // Is the next line the realm name "#$REALM_NAME=" ? if (nextLine.startsWith(COMMENT_PREFIX) && nextLine.contains(REALM_COMMENT_PREFIX)) { // Realm name block detected! // The next line must be and empty comment "#" bufferedFileReader.readLine(); // Avoid adding the realm block } else { // It's a user comment... content.add(line); content.add(nextLine); } } else { super.addLineContent(bufferedFileReader, content, line); } } else { super.addLineContent(bufferedFileReader, content, line); } }
[ "@", "Override", "protected", "void", "addLineContent", "(", "BufferedReader", "bufferedFileReader", ",", "List", "<", "String", ">", "content", ",", "String", "line", ")", "throws", "IOException", "{", "// Is the line an empty comment \"#\" ?", "if", "(", "line", ".", "startsWith", "(", "COMMENT_PREFIX", ")", "&&", "line", ".", "length", "(", ")", "==", "1", ")", "{", "String", "nextLine", "=", "bufferedFileReader", ".", "readLine", "(", ")", ";", "if", "(", "nextLine", "!=", "null", ")", "{", "// Is the next line the realm name \"#$REALM_NAME=\" ?", "if", "(", "nextLine", ".", "startsWith", "(", "COMMENT_PREFIX", ")", "&&", "nextLine", ".", "contains", "(", "REALM_COMMENT_PREFIX", ")", ")", "{", "// Realm name block detected!", "// The next line must be and empty comment \"#\"", "bufferedFileReader", ".", "readLine", "(", ")", ";", "// Avoid adding the realm block", "}", "else", "{", "// It's a user comment...", "content", ".", "add", "(", "line", ")", ";", "content", ".", "add", "(", "nextLine", ")", ";", "}", "}", "else", "{", "super", ".", "addLineContent", "(", "bufferedFileReader", ",", "content", ",", "line", ")", ";", "}", "}", "else", "{", "super", ".", "addLineContent", "(", "bufferedFileReader", ",", "content", ",", "line", ")", ";", "}", "}" ]
Remove the realm name block. @see PropertiesFileLoader#addLineContent(java.io.BufferedReader, java.util.List, String)
[ "Remove", "the", "realm", "name", "block", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/UserPropertiesFileLoader.java#L170-L193
158,833
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/OperationDefinition.java
OperationDefinition.validateOperation
@Deprecated public void validateOperation(final ModelNode operation) throws OperationFailedException { if (operation.hasDefined(ModelDescriptionConstants.OPERATION_NAME) && deprecationData != null && deprecationData.isNotificationUseful()) { ControllerLogger.DEPRECATED_LOGGER.operationDeprecated(getName(), PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } for (AttributeDefinition ad : this.parameters) { ad.validateOperation(operation); } }
java
@Deprecated public void validateOperation(final ModelNode operation) throws OperationFailedException { if (operation.hasDefined(ModelDescriptionConstants.OPERATION_NAME) && deprecationData != null && deprecationData.isNotificationUseful()) { ControllerLogger.DEPRECATED_LOGGER.operationDeprecated(getName(), PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } for (AttributeDefinition ad : this.parameters) { ad.validateOperation(operation); } }
[ "@", "Deprecated", "public", "void", "validateOperation", "(", "final", "ModelNode", "operation", ")", "throws", "OperationFailedException", "{", "if", "(", "operation", ".", "hasDefined", "(", "ModelDescriptionConstants", ".", "OPERATION_NAME", ")", "&&", "deprecationData", "!=", "null", "&&", "deprecationData", ".", "isNotificationUseful", "(", ")", ")", "{", "ControllerLogger", ".", "DEPRECATED_LOGGER", ".", "operationDeprecated", "(", "getName", "(", ")", ",", "PathAddress", ".", "pathAddress", "(", "operation", ".", "get", "(", "ModelDescriptionConstants", ".", "OP_ADDR", ")", ")", ".", "toCLIStyleString", "(", ")", ")", ";", "}", "for", "(", "AttributeDefinition", "ad", ":", "this", ".", "parameters", ")", "{", "ad", ".", "validateOperation", "(", "operation", ")", ";", "}", "}" ]
Validates operation model against the definition and its parameters @param operation model node of type {@link ModelType#OBJECT}, representing an operation request @throws OperationFailedException if the value is not valid @deprecated Not used by the WildFly management kernel; will be removed in a future release
[ "Validates", "operation", "model", "against", "the", "definition", "and", "its", "parameters" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/OperationDefinition.java#L172-L181
158,834
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/OperationDefinition.java
OperationDefinition.validateAndSet
@SuppressWarnings("deprecation") @Deprecated public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException { validateOperation(operationObject); for (AttributeDefinition ad : this.parameters) { ad.validateAndSet(operationObject, model); } }
java
@SuppressWarnings("deprecation") @Deprecated public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException { validateOperation(operationObject); for (AttributeDefinition ad : this.parameters) { ad.validateAndSet(operationObject, model); } }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "@", "Deprecated", "public", "final", "void", "validateAndSet", "(", "ModelNode", "operationObject", ",", "final", "ModelNode", "model", ")", "throws", "OperationFailedException", "{", "validateOperation", "(", "operationObject", ")", ";", "for", "(", "AttributeDefinition", "ad", ":", "this", ".", "parameters", ")", "{", "ad", ".", "validateAndSet", "(", "operationObject", ",", "model", ")", ";", "}", "}" ]
validates operation against the definition and sets model for the parameters passed. @param operationObject model node of type {@link ModelType#OBJECT}, typically representing an operation request @param model model node in which the value should be stored @throws OperationFailedException if the value is not valid @deprecated Not used by the WildFly management kernel; will be removed in a future release
[ "validates", "operation", "against", "the", "definition", "and", "sets", "model", "for", "the", "parameters", "passed", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/OperationDefinition.java#L192-L199
158,835
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/validation/BasicArtifactProcessor.java
BasicArtifactProcessor.getHandlerForArtifact
<P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> PatchingArtifactStateHandler<S> getHandlerForArtifact(PatchingArtifact<P, S> artifact) { return handlers.get(artifact); }
java
<P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> PatchingArtifactStateHandler<S> getHandlerForArtifact(PatchingArtifact<P, S> artifact) { return handlers.get(artifact); }
[ "<", "P", "extends", "PatchingArtifact", ".", "ArtifactState", ",", "S", "extends", "PatchingArtifact", ".", "ArtifactState", ">", "PatchingArtifactStateHandler", "<", "S", ">", "getHandlerForArtifact", "(", "PatchingArtifact", "<", "P", ",", "S", ">", "artifact", ")", "{", "return", "handlers", ".", "get", "(", "artifact", ")", ";", "}" ]
Get a state handler for a given patching artifact. @param artifact the patching artifact @param <P> @param <S> @return the state handler, {@code null} if there is no handler registered for the given artifact
[ "Get", "a", "state", "handler", "for", "a", "given", "patching", "artifact", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/BasicArtifactProcessor.java#L123-L125
158,836
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java
CapabilityResolutionContext.getAttachment
public <V> V getAttachment(final AttachmentKey<V> key) { assert key != null; return key.cast(contextAttachments.get(key)); }
java
public <V> V getAttachment(final AttachmentKey<V> key) { assert key != null; return key.cast(contextAttachments.get(key)); }
[ "public", "<", "V", ">", "V", "getAttachment", "(", "final", "AttachmentKey", "<", "V", ">", "key", ")", "{", "assert", "key", "!=", "null", ";", "return", "key", ".", "cast", "(", "contextAttachments", ".", "get", "(", "key", ")", ")", ";", "}" ]
Retrieves an object that has been attached to this context. @param key the key to the attachment. @param <V> the value type of the attachment. @return the attachment if found otherwise {@code null}.
[ "Retrieves", "an", "object", "that", "has", "been", "attached", "to", "this", "context", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L54-L57
158,837
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java
CapabilityResolutionContext.attach
public <V> V attach(final AttachmentKey<V> key, final V value) { assert key != null; return key.cast(contextAttachments.put(key, value)); }
java
public <V> V attach(final AttachmentKey<V> key, final V value) { assert key != null; return key.cast(contextAttachments.put(key, value)); }
[ "public", "<", "V", ">", "V", "attach", "(", "final", "AttachmentKey", "<", "V", ">", "key", ",", "final", "V", "value", ")", "{", "assert", "key", "!=", "null", ";", "return", "key", ".", "cast", "(", "contextAttachments", ".", "put", "(", "key", ",", "value", ")", ")", ";", "}" ]
Attaches an arbitrary object to this context. @param key they attachment key used to ensure uniqueness and used for retrieval of the value. @param value the value to store. @param <V> the value type of the attachment. @return the previous value associated with the key or {@code null} if there was no previous value.
[ "Attaches", "an", "arbitrary", "object", "to", "this", "context", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L68-L71
158,838
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java
CapabilityResolutionContext.attachIfAbsent
public <V> V attachIfAbsent(final AttachmentKey<V> key, final V value) { assert key != null; return key.cast(contextAttachments.putIfAbsent(key, value)); }
java
public <V> V attachIfAbsent(final AttachmentKey<V> key, final V value) { assert key != null; return key.cast(contextAttachments.putIfAbsent(key, value)); }
[ "public", "<", "V", ">", "V", "attachIfAbsent", "(", "final", "AttachmentKey", "<", "V", ">", "key", ",", "final", "V", "value", ")", "{", "assert", "key", "!=", "null", ";", "return", "key", ".", "cast", "(", "contextAttachments", ".", "putIfAbsent", "(", "key", ",", "value", ")", ")", ";", "}" ]
Attaches an arbitrary object to this context only if the object was not already attached. If a value has already been attached with the key provided, the current value associated with the key is returned. @param key they attachment key used to ensure uniqueness and used for retrieval of the value. @param value the value to store. @param <V> the value type of the attachment. @return the previous value associated with the key or {@code null} if there was no previous value.
[ "Attaches", "an", "arbitrary", "object", "to", "this", "context", "only", "if", "the", "object", "was", "not", "already", "attached", ".", "If", "a", "value", "has", "already", "been", "attached", "with", "the", "key", "provided", "the", "current", "value", "associated", "with", "the", "key", "is", "returned", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L83-L86
158,839
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java
CapabilityResolutionContext.detach
public <V> V detach(final AttachmentKey<V> key) { assert key != null; return key.cast(contextAttachments.remove(key)); }
java
public <V> V detach(final AttachmentKey<V> key) { assert key != null; return key.cast(contextAttachments.remove(key)); }
[ "public", "<", "V", ">", "V", "detach", "(", "final", "AttachmentKey", "<", "V", ">", "key", ")", "{", "assert", "key", "!=", "null", ";", "return", "key", ".", "cast", "(", "contextAttachments", ".", "remove", "(", "key", ")", ")", ";", "}" ]
Detaches or removes the value from this context. @param key the key to the attachment. @param <V> the value type of the attachment. @return the attachment if found otherwise {@code null}.
[ "Detaches", "or", "removes", "the", "value", "from", "this", "context", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L96-L99
158,840
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/parsing/InterfacesXml.java
InterfacesXml.writeInterfaceCriteria
private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException { for (final Property property : subModel.asPropertyList()) { if (property.getValue().isDefined()) { writeInterfaceCriteria(writer, property, nested); } } }
java
private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException { for (final Property property : subModel.asPropertyList()) { if (property.getValue().isDefined()) { writeInterfaceCriteria(writer, property, nested); } } }
[ "private", "void", "writeInterfaceCriteria", "(", "final", "XMLExtendedStreamWriter", "writer", ",", "final", "ModelNode", "subModel", ",", "final", "boolean", "nested", ")", "throws", "XMLStreamException", "{", "for", "(", "final", "Property", "property", ":", "subModel", ".", "asPropertyList", "(", ")", ")", "{", "if", "(", "property", ".", "getValue", "(", ")", ".", "isDefined", "(", ")", ")", "{", "writeInterfaceCriteria", "(", "writer", ",", "property", ",", "nested", ")", ";", "}", "}", "}" ]
Write the criteria elements, extracting the information of the sub-model. @param writer the xml stream writer @param subModel the interface model @param nested whether it the criteria elements are nested as part of <not /> or <any /> @throws XMLStreamException
[ "Write", "the", "criteria", "elements", "extracting", "the", "information", "of", "the", "sub", "-", "model", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/parsing/InterfacesXml.java#L280-L286
158,841
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java
ConfigurationPersisterFactory.createHostXmlConfigurationPersister
public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment, final ExecutorService executorService, final ExtensionRegistry hostExtensionRegistry, final LocalHostControllerInfo localHostControllerInfo) { String defaultHostname = localHostControllerInfo.getLocalHostName(); if (environment.getRunningModeControl().isReloaded()) { if (environment.getRunningModeControl().getReloadHostName() != null) { defaultHostname = environment.getRunningModeControl().getReloadHostName(); } } HostXml hostXml = new HostXml(defaultHostname, environment.getRunningModeControl().getRunningMode(), environment.isUseCachedDc(), Module.getBootModuleLoader(), executorService, hostExtensionRegistry); BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "host"), hostXml, hostXml, false); for (Namespace namespace : Namespace.domainValues()) { if (!namespace.equals(Namespace.CURRENT)) { persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "host"), hostXml); } } hostExtensionRegistry.setWriterRegistry(persister); return persister; }
java
public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment, final ExecutorService executorService, final ExtensionRegistry hostExtensionRegistry, final LocalHostControllerInfo localHostControllerInfo) { String defaultHostname = localHostControllerInfo.getLocalHostName(); if (environment.getRunningModeControl().isReloaded()) { if (environment.getRunningModeControl().getReloadHostName() != null) { defaultHostname = environment.getRunningModeControl().getReloadHostName(); } } HostXml hostXml = new HostXml(defaultHostname, environment.getRunningModeControl().getRunningMode(), environment.isUseCachedDc(), Module.getBootModuleLoader(), executorService, hostExtensionRegistry); BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "host"), hostXml, hostXml, false); for (Namespace namespace : Namespace.domainValues()) { if (!namespace.equals(Namespace.CURRENT)) { persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "host"), hostXml); } } hostExtensionRegistry.setWriterRegistry(persister); return persister; }
[ "public", "static", "ExtensibleConfigurationPersister", "createHostXmlConfigurationPersister", "(", "final", "ConfigurationFile", "file", ",", "final", "HostControllerEnvironment", "environment", ",", "final", "ExecutorService", "executorService", ",", "final", "ExtensionRegistry", "hostExtensionRegistry", ",", "final", "LocalHostControllerInfo", "localHostControllerInfo", ")", "{", "String", "defaultHostname", "=", "localHostControllerInfo", ".", "getLocalHostName", "(", ")", ";", "if", "(", "environment", ".", "getRunningModeControl", "(", ")", ".", "isReloaded", "(", ")", ")", "{", "if", "(", "environment", ".", "getRunningModeControl", "(", ")", ".", "getReloadHostName", "(", ")", "!=", "null", ")", "{", "defaultHostname", "=", "environment", ".", "getRunningModeControl", "(", ")", ".", "getReloadHostName", "(", ")", ";", "}", "}", "HostXml", "hostXml", "=", "new", "HostXml", "(", "defaultHostname", ",", "environment", ".", "getRunningModeControl", "(", ")", ".", "getRunningMode", "(", ")", ",", "environment", ".", "isUseCachedDc", "(", ")", ",", "Module", ".", "getBootModuleLoader", "(", ")", ",", "executorService", ",", "hostExtensionRegistry", ")", ";", "BackupXmlConfigurationPersister", "persister", "=", "new", "BackupXmlConfigurationPersister", "(", "file", ",", "new", "QName", "(", "Namespace", ".", "CURRENT", ".", "getUriString", "(", ")", ",", "\"host\"", ")", ",", "hostXml", ",", "hostXml", ",", "false", ")", ";", "for", "(", "Namespace", "namespace", ":", "Namespace", ".", "domainValues", "(", ")", ")", "{", "if", "(", "!", "namespace", ".", "equals", "(", "Namespace", ".", "CURRENT", ")", ")", "{", "persister", ".", "registerAdditionalRootElement", "(", "new", "QName", "(", "namespace", ".", "getUriString", "(", ")", ",", "\"host\"", ")", ",", "hostXml", ")", ";", "}", "}", "hostExtensionRegistry", ".", "setWriterRegistry", "(", "persister", ")", ";", "return", "persister", ";", "}" ]
host.xml
[ "host", ".", "xml" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java#L67-L86
158,842
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java
ConfigurationPersisterFactory.createDomainXmlConfigurationPersister
public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister(final ConfigurationFile file, ExecutorService executorService, ExtensionRegistry extensionRegistry, final HostControllerEnvironment environment) { DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry); boolean suppressLoad = false; ConfigurationFile.InteractionPolicy policy = file.getInteractionPolicy(); final boolean isReloaded = environment.getRunningModeControl().isReloaded(); if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW && (file.getBootFile().exists() && file.getBootFile().length() != 0))) { throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteDomainXmlWithEmpty(file.getBootFile().getName()); } if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD)) { suppressLoad = true; } BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "domain"), domainXml, domainXml, suppressLoad); for (Namespace namespace : Namespace.domainValues()) { if (!namespace.equals(Namespace.CURRENT)) { persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "domain"), domainXml); } } extensionRegistry.setWriterRegistry(persister); return persister; }
java
public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister(final ConfigurationFile file, ExecutorService executorService, ExtensionRegistry extensionRegistry, final HostControllerEnvironment environment) { DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry); boolean suppressLoad = false; ConfigurationFile.InteractionPolicy policy = file.getInteractionPolicy(); final boolean isReloaded = environment.getRunningModeControl().isReloaded(); if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW && (file.getBootFile().exists() && file.getBootFile().length() != 0))) { throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteDomainXmlWithEmpty(file.getBootFile().getName()); } if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD)) { suppressLoad = true; } BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "domain"), domainXml, domainXml, suppressLoad); for (Namespace namespace : Namespace.domainValues()) { if (!namespace.equals(Namespace.CURRENT)) { persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "domain"), domainXml); } } extensionRegistry.setWriterRegistry(persister); return persister; }
[ "public", "static", "ExtensibleConfigurationPersister", "createDomainXmlConfigurationPersister", "(", "final", "ConfigurationFile", "file", ",", "ExecutorService", "executorService", ",", "ExtensionRegistry", "extensionRegistry", ",", "final", "HostControllerEnvironment", "environment", ")", "{", "DomainXml", "domainXml", "=", "new", "DomainXml", "(", "Module", ".", "getBootModuleLoader", "(", ")", ",", "executorService", ",", "extensionRegistry", ")", ";", "boolean", "suppressLoad", "=", "false", ";", "ConfigurationFile", ".", "InteractionPolicy", "policy", "=", "file", ".", "getInteractionPolicy", "(", ")", ";", "final", "boolean", "isReloaded", "=", "environment", ".", "getRunningModeControl", "(", ")", ".", "isReloaded", "(", ")", ";", "if", "(", "!", "isReloaded", "&&", "(", "policy", "==", "ConfigurationFile", ".", "InteractionPolicy", ".", "NEW", "&&", "(", "file", ".", "getBootFile", "(", ")", ".", "exists", "(", ")", "&&", "file", ".", "getBootFile", "(", ")", ".", "length", "(", ")", "!=", "0", ")", ")", ")", "{", "throw", "HostControllerLogger", ".", "ROOT_LOGGER", ".", "cannotOverwriteDomainXmlWithEmpty", "(", "file", ".", "getBootFile", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "!", "isReloaded", "&&", "(", "policy", "==", "ConfigurationFile", ".", "InteractionPolicy", ".", "NEW", "||", "policy", "==", "ConfigurationFile", ".", "InteractionPolicy", ".", "DISCARD", ")", ")", "{", "suppressLoad", "=", "true", ";", "}", "BackupXmlConfigurationPersister", "persister", "=", "new", "BackupXmlConfigurationPersister", "(", "file", ",", "new", "QName", "(", "Namespace", ".", "CURRENT", ".", "getUriString", "(", ")", ",", "\"domain\"", ")", ",", "domainXml", ",", "domainXml", ",", "suppressLoad", ")", ";", "for", "(", "Namespace", "namespace", ":", "Namespace", ".", "domainValues", "(", ")", ")", "{", "if", "(", "!", "namespace", ".", "equals", "(", "Namespace", ".", "CURRENT", ")", ")", "{", "persister", ".", "registerAdditionalRootElement", "(", "new", "QName", "(", "namespace", ".", "getUriString", "(", ")", ",", "\"domain\"", ")", ",", "domainXml", ")", ";", "}", "}", "extensionRegistry", ".", "setWriterRegistry", "(", "persister", ")", ";", "return", "persister", ";", "}" ]
domain.xml
[ "domain", ".", "xml" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java#L89-L112
158,843
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java
ConfigurationPersisterFactory.createTransientDomainXmlConfigurationPersister
public static ExtensibleConfigurationPersister createTransientDomainXmlConfigurationPersister(ExecutorService executorService, ExtensionRegistry extensionRegistry) { DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry); ExtensibleConfigurationPersister persister = new NullConfigurationPersister(domainXml); extensionRegistry.setWriterRegistry(persister); return persister; }
java
public static ExtensibleConfigurationPersister createTransientDomainXmlConfigurationPersister(ExecutorService executorService, ExtensionRegistry extensionRegistry) { DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry); ExtensibleConfigurationPersister persister = new NullConfigurationPersister(domainXml); extensionRegistry.setWriterRegistry(persister); return persister; }
[ "public", "static", "ExtensibleConfigurationPersister", "createTransientDomainXmlConfigurationPersister", "(", "ExecutorService", "executorService", ",", "ExtensionRegistry", "extensionRegistry", ")", "{", "DomainXml", "domainXml", "=", "new", "DomainXml", "(", "Module", ".", "getBootModuleLoader", "(", ")", ",", "executorService", ",", "extensionRegistry", ")", ";", "ExtensibleConfigurationPersister", "persister", "=", "new", "NullConfigurationPersister", "(", "domainXml", ")", ";", "extensionRegistry", ".", "setWriterRegistry", "(", "persister", ")", ";", "return", "persister", ";", "}" ]
slave=true
[ "slave", "=", "true" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java#L135-L140
158,844
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchingTasks.java
PatchingTasks.apply
static void apply(final String patchId, final Collection<ContentModification> modifications, final PatchEntry patchEntry, final ContentItemFilter filter) { for (final ContentModification modification : modifications) { final ContentItem item = modification.getItem(); // Check if we accept the item if (!filter.accepts(item)) { continue; } final Location location = new Location(item); final ContentEntry contentEntry = new ContentEntry(patchId, modification); ContentTaskDefinition definition = patchEntry.get(location); if (definition == null) { definition = new ContentTaskDefinition(location, contentEntry, false); patchEntry.put(location, definition); } else { definition.setTarget(contentEntry); } } }
java
static void apply(final String patchId, final Collection<ContentModification> modifications, final PatchEntry patchEntry, final ContentItemFilter filter) { for (final ContentModification modification : modifications) { final ContentItem item = modification.getItem(); // Check if we accept the item if (!filter.accepts(item)) { continue; } final Location location = new Location(item); final ContentEntry contentEntry = new ContentEntry(patchId, modification); ContentTaskDefinition definition = patchEntry.get(location); if (definition == null) { definition = new ContentTaskDefinition(location, contentEntry, false); patchEntry.put(location, definition); } else { definition.setTarget(contentEntry); } } }
[ "static", "void", "apply", "(", "final", "String", "patchId", ",", "final", "Collection", "<", "ContentModification", ">", "modifications", ",", "final", "PatchEntry", "patchEntry", ",", "final", "ContentItemFilter", "filter", ")", "{", "for", "(", "final", "ContentModification", "modification", ":", "modifications", ")", "{", "final", "ContentItem", "item", "=", "modification", ".", "getItem", "(", ")", ";", "// Check if we accept the item", "if", "(", "!", "filter", ".", "accepts", "(", "item", ")", ")", "{", "continue", ";", "}", "final", "Location", "location", "=", "new", "Location", "(", "item", ")", ";", "final", "ContentEntry", "contentEntry", "=", "new", "ContentEntry", "(", "patchId", ",", "modification", ")", ";", "ContentTaskDefinition", "definition", "=", "patchEntry", ".", "get", "(", "location", ")", ";", "if", "(", "definition", "==", "null", ")", "{", "definition", "=", "new", "ContentTaskDefinition", "(", "location", ",", "contentEntry", ",", "false", ")", ";", "patchEntry", ".", "put", "(", "location", ",", "definition", ")", ";", "}", "else", "{", "definition", ".", "setTarget", "(", "contentEntry", ")", ";", "}", "}", "}" ]
Apply modifications to a content task definition. @param patchId the patch id @param modifications the modifications @param definitions the task definitions @param filter the content item filter
[ "Apply", "modifications", "to", "a", "content", "task", "definition", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchingTasks.java#L165-L184
158,845
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java
ServiceRemoveStepHandler.serviceName
protected ServiceName serviceName(final String name) { return baseServiceName != null ? baseServiceName.append(name) : null; }
java
protected ServiceName serviceName(final String name) { return baseServiceName != null ? baseServiceName.append(name) : null; }
[ "protected", "ServiceName", "serviceName", "(", "final", "String", "name", ")", "{", "return", "baseServiceName", "!=", "null", "?", "baseServiceName", ".", "append", "(", "name", ")", ":", "null", ";", "}" ]
The service name to be removed. Can be overridden for unusual service naming patterns @param name The name of the resource being removed @return The service name to remove. May return {@code null} if only removal based on {@code unavailableCapabilities} passed to the constructor are to be performed
[ "The", "service", "name", "to", "be", "removed", ".", "Can", "be", "overridden", "for", "unusual", "service", "naming", "patterns" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java#L152-L154
158,846
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java
ModuleNameTabCompleter.subModuleExists
private boolean subModuleExists(File dir) { if (isSlotDirectory(dir)) { return true; } else { File[] children = dir.listFiles(File::isDirectory); for (File child : children) { if (subModuleExists(child)) { return true; } } } return false; }
java
private boolean subModuleExists(File dir) { if (isSlotDirectory(dir)) { return true; } else { File[] children = dir.listFiles(File::isDirectory); for (File child : children) { if (subModuleExists(child)) { return true; } } } return false; }
[ "private", "boolean", "subModuleExists", "(", "File", "dir", ")", "{", "if", "(", "isSlotDirectory", "(", "dir", ")", ")", "{", "return", "true", ";", "}", "else", "{", "File", "[", "]", "children", "=", "dir", ".", "listFiles", "(", "File", "::", "isDirectory", ")", ";", "for", "(", "File", "child", ":", "children", ")", "{", "if", "(", "subModuleExists", "(", "child", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
depth- first search for any module - just to check that the suggestion has any chance of delivering correct result
[ "depth", "-", "first", "search", "for", "any", "module", "-", "just", "to", "check", "that", "the", "suggestion", "has", "any", "chance", "of", "delivering", "correct", "result" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java#L169-L182
158,847
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java
ModuleNameTabCompleter.tail
private String tail(String moduleName) { if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) { return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1); } else { return ""; } }
java
private String tail(String moduleName) { if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) { return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1); } else { return ""; } }
[ "private", "String", "tail", "(", "String", "moduleName", ")", "{", "if", "(", "moduleName", ".", "indexOf", "(", "MODULE_NAME_SEPARATOR", ")", ">", "0", ")", "{", "return", "moduleName", ".", "substring", "(", "moduleName", ".", "indexOf", "(", "MODULE_NAME_SEPARATOR", ")", "+", "1", ")", ";", "}", "else", "{", "return", "\"\"", ";", "}", "}" ]
get all parts of module name apart from first
[ "get", "all", "parts", "of", "module", "name", "apart", "from", "first" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java#L210-L216
158,848
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerClient.java
HostControllerClient.resolveBootUpdates
void resolveBootUpdates(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { connection.openConnection(controller, callback); // Keep a reference to the the controller this.controller = controller; }
java
void resolveBootUpdates(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { connection.openConnection(controller, callback); // Keep a reference to the the controller this.controller = controller; }
[ "void", "resolveBootUpdates", "(", "final", "ModelController", "controller", ",", "final", "ActiveOperation", ".", "CompletedCallback", "<", "ModelNode", ">", "callback", ")", "throws", "Exception", "{", "connection", ".", "openConnection", "(", "controller", ",", "callback", ")", ";", "// Keep a reference to the the controller", "this", ".", "controller", "=", "controller", ";", "}" ]
Resolve the boot updates and register at the local HC. @param controller the model controller @param callback the completed callback @throws Exception for any error
[ "Resolve", "the", "boot", "updates", "and", "register", "at", "the", "local", "HC", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerClient.java#L111-L115
158,849
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java
VaultConfig.loadExternalFile
static VaultConfig loadExternalFile(File f) throws XMLStreamException { if(f == null) { throw new IllegalArgumentException("File is null"); } if(!f.exists()) { throw new XMLStreamException("Failed to locate vault file " + f.getAbsolutePath()); } final VaultConfig config = new VaultConfig(); BufferedInputStream input = null; try { final XMLMapper mapper = XMLMapper.Factory.create(); final XMLElementReader<VaultConfig> reader = new ExternalVaultConfigReader(); mapper.registerRootElement(new QName(VAULT), reader); FileInputStream is = new FileInputStream(f); input = new BufferedInputStream(is); XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(input); mapper.parseDocument(config, streamReader); streamReader.close(); } catch(FileNotFoundException e) { throw new XMLStreamException("Vault file not found", e); } catch(XMLStreamException t) { throw t; } finally { StreamUtils.safeClose(input); } return config; }
java
static VaultConfig loadExternalFile(File f) throws XMLStreamException { if(f == null) { throw new IllegalArgumentException("File is null"); } if(!f.exists()) { throw new XMLStreamException("Failed to locate vault file " + f.getAbsolutePath()); } final VaultConfig config = new VaultConfig(); BufferedInputStream input = null; try { final XMLMapper mapper = XMLMapper.Factory.create(); final XMLElementReader<VaultConfig> reader = new ExternalVaultConfigReader(); mapper.registerRootElement(new QName(VAULT), reader); FileInputStream is = new FileInputStream(f); input = new BufferedInputStream(is); XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(input); mapper.parseDocument(config, streamReader); streamReader.close(); } catch(FileNotFoundException e) { throw new XMLStreamException("Vault file not found", e); } catch(XMLStreamException t) { throw t; } finally { StreamUtils.safeClose(input); } return config; }
[ "static", "VaultConfig", "loadExternalFile", "(", "File", "f", ")", "throws", "XMLStreamException", "{", "if", "(", "f", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"File is null\"", ")", ";", "}", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "{", "throw", "new", "XMLStreamException", "(", "\"Failed to locate vault file \"", "+", "f", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "final", "VaultConfig", "config", "=", "new", "VaultConfig", "(", ")", ";", "BufferedInputStream", "input", "=", "null", ";", "try", "{", "final", "XMLMapper", "mapper", "=", "XMLMapper", ".", "Factory", ".", "create", "(", ")", ";", "final", "XMLElementReader", "<", "VaultConfig", ">", "reader", "=", "new", "ExternalVaultConfigReader", "(", ")", ";", "mapper", ".", "registerRootElement", "(", "new", "QName", "(", "VAULT", ")", ",", "reader", ")", ";", "FileInputStream", "is", "=", "new", "FileInputStream", "(", "f", ")", ";", "input", "=", "new", "BufferedInputStream", "(", "is", ")", ";", "XMLStreamReader", "streamReader", "=", "XMLInputFactory", ".", "newInstance", "(", ")", ".", "createXMLStreamReader", "(", "input", ")", ";", "mapper", ".", "parseDocument", "(", "config", ",", "streamReader", ")", ";", "streamReader", ".", "close", "(", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "XMLStreamException", "(", "\"Vault file not found\"", ",", "e", ")", ";", "}", "catch", "(", "XMLStreamException", "t", ")", "{", "throw", "t", ";", "}", "finally", "{", "StreamUtils", ".", "safeClose", "(", "input", ")", ";", "}", "return", "config", ";", "}" ]
In the 2.0 xsd the vault is in an external file, which has no namespace, using the output of the vault tool. @param f the file containing the external vault configuration as generated by the vault tool @return the vault config
[ "In", "the", "2", ".", "0", "xsd", "the", "vault", "is", "in", "an", "external", "file", "which", "has", "no", "namespace", "using", "the", "output", "of", "the", "vault", "tool", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java#L68-L95
158,850
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java
VaultConfig.readVaultElement_3_0
static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException { final VaultConfig config = new VaultConfig(); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); String name = reader.getAttributeLocalName(i); if (name.equals(CODE)){ config.code = value; } else if (name.equals(MODULE)){ config.module = value; } else { unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader); } } if (config.code == null && config.module != null){ throw new XMLStreamException("Attribute 'module' was specified without an attribute" + " 'code' for element '" + VAULT + "' at " + reader.getLocation()); } readVaultOptions(reader, config); return config; }
java
static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException { final VaultConfig config = new VaultConfig(); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); String name = reader.getAttributeLocalName(i); if (name.equals(CODE)){ config.code = value; } else if (name.equals(MODULE)){ config.module = value; } else { unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader); } } if (config.code == null && config.module != null){ throw new XMLStreamException("Attribute 'module' was specified without an attribute" + " 'code' for element '" + VAULT + "' at " + reader.getLocation()); } readVaultOptions(reader, config); return config; }
[ "static", "VaultConfig", "readVaultElement_3_0", "(", "XMLExtendedStreamReader", "reader", ",", "Namespace", "expectedNs", ")", "throws", "XMLStreamException", "{", "final", "VaultConfig", "config", "=", "new", "VaultConfig", "(", ")", ";", "final", "int", "count", "=", "reader", ".", "getAttributeCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "final", "String", "value", "=", "reader", ".", "getAttributeValue", "(", "i", ")", ";", "String", "name", "=", "reader", ".", "getAttributeLocalName", "(", "i", ")", ";", "if", "(", "name", ".", "equals", "(", "CODE", ")", ")", "{", "config", ".", "code", "=", "value", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "MODULE", ")", ")", "{", "config", ".", "module", "=", "value", ";", "}", "else", "{", "unexpectedVaultAttribute", "(", "reader", ".", "getAttributeLocalName", "(", "i", ")", ",", "reader", ")", ";", "}", "}", "if", "(", "config", ".", "code", "==", "null", "&&", "config", ".", "module", "!=", "null", ")", "{", "throw", "new", "XMLStreamException", "(", "\"Attribute 'module' was specified without an attribute\"", "+", "\" 'code' for element '\"", "+", "VAULT", "+", "\"' at \"", "+", "reader", ".", "getLocation", "(", ")", ")", ";", "}", "readVaultOptions", "(", "reader", ",", "config", ")", ";", "return", "config", ";", "}" ]
In the 3.0 xsd the vault configuration and its options are part of the vault xsd. @param reader the reader at the vault element @param expectedNs the namespace @return the vault configuration
[ "In", "the", "3", ".", "0", "xsd", "the", "vault", "configuration", "and", "its", "options", "are", "part", "of", "the", "vault", "xsd", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java#L104-L125
158,851
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/transform/RejectExpressionValuesTransformer.java
RejectExpressionValuesTransformer.checkModel
private Set<String> checkModel(final ModelNode model, TransformationContext context) throws OperationFailedException { final Set<String> attributes = new HashSet<String>(); AttributeTransformationRequirementChecker checker; for (final String attribute : attributeNames) { if (model.hasDefined(attribute)) { if (attributeCheckers != null && (checker = attributeCheckers.get(attribute)) != null) { if (checker.isAttributeTransformationRequired(attribute, model.get(attribute), context)) { attributes.add(attribute); } } else if (SIMPLE_EXPRESSIONS.isAttributeTransformationRequired(attribute, model.get(attribute), context)) { attributes.add(attribute); } } } return attributes; }
java
private Set<String> checkModel(final ModelNode model, TransformationContext context) throws OperationFailedException { final Set<String> attributes = new HashSet<String>(); AttributeTransformationRequirementChecker checker; for (final String attribute : attributeNames) { if (model.hasDefined(attribute)) { if (attributeCheckers != null && (checker = attributeCheckers.get(attribute)) != null) { if (checker.isAttributeTransformationRequired(attribute, model.get(attribute), context)) { attributes.add(attribute); } } else if (SIMPLE_EXPRESSIONS.isAttributeTransformationRequired(attribute, model.get(attribute), context)) { attributes.add(attribute); } } } return attributes; }
[ "private", "Set", "<", "String", ">", "checkModel", "(", "final", "ModelNode", "model", ",", "TransformationContext", "context", ")", "throws", "OperationFailedException", "{", "final", "Set", "<", "String", ">", "attributes", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "AttributeTransformationRequirementChecker", "checker", ";", "for", "(", "final", "String", "attribute", ":", "attributeNames", ")", "{", "if", "(", "model", ".", "hasDefined", "(", "attribute", ")", ")", "{", "if", "(", "attributeCheckers", "!=", "null", "&&", "(", "checker", "=", "attributeCheckers", ".", "get", "(", "attribute", ")", ")", "!=", "null", ")", "{", "if", "(", "checker", ".", "isAttributeTransformationRequired", "(", "attribute", ",", "model", ".", "get", "(", "attribute", ")", ",", "context", ")", ")", "{", "attributes", ".", "add", "(", "attribute", ")", ";", "}", "}", "else", "if", "(", "SIMPLE_EXPRESSIONS", ".", "isAttributeTransformationRequired", "(", "attribute", ",", "model", ".", "get", "(", "attribute", ")", ",", "context", ")", ")", "{", "attributes", ".", "add", "(", "attribute", ")", ";", "}", "}", "}", "return", "attributes", ";", "}" ]
Check the model for expression values. @param model the model @return the attribute containing an expression
[ "Check", "the", "model", "for", "expression", "values", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/RejectExpressionValuesTransformer.java#L173-L188
158,852
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/gui/OperationDialog.java
OperationDialog.setValue
public void setValue(String propName, Object value) { for (RequestProp prop : props) { if (prop.getName().equals(propName)) { JComponent valComp = prop.getValueComponent(); if (valComp instanceof JTextComponent) { ((JTextComponent)valComp).setText(value.toString()); } if (valComp instanceof AbstractButton) { ((AbstractButton)valComp).setSelected((Boolean)value); } if (valComp instanceof JComboBox) { ((JComboBox)valComp).setSelectedItem(value); } return; } } }
java
public void setValue(String propName, Object value) { for (RequestProp prop : props) { if (prop.getName().equals(propName)) { JComponent valComp = prop.getValueComponent(); if (valComp instanceof JTextComponent) { ((JTextComponent)valComp).setText(value.toString()); } if (valComp instanceof AbstractButton) { ((AbstractButton)valComp).setSelected((Boolean)value); } if (valComp instanceof JComboBox) { ((JComboBox)valComp).setSelectedItem(value); } return; } } }
[ "public", "void", "setValue", "(", "String", "propName", ",", "Object", "value", ")", "{", "for", "(", "RequestProp", "prop", ":", "props", ")", "{", "if", "(", "prop", ".", "getName", "(", ")", ".", "equals", "(", "propName", ")", ")", "{", "JComponent", "valComp", "=", "prop", ".", "getValueComponent", "(", ")", ";", "if", "(", "valComp", "instanceof", "JTextComponent", ")", "{", "(", "(", "JTextComponent", ")", "valComp", ")", ".", "setText", "(", "value", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "valComp", "instanceof", "AbstractButton", ")", "{", "(", "(", "AbstractButton", ")", "valComp", ")", ".", "setSelected", "(", "(", "Boolean", ")", "value", ")", ";", "}", "if", "(", "valComp", "instanceof", "JComboBox", ")", "{", "(", "(", "JComboBox", ")", "valComp", ")", ".", "setSelectedItem", "(", "value", ")", ";", "}", "return", ";", "}", "}", "}" ]
Set the value of the underlying component. Note that this will not work for ListEditor components. Also, note that for a JComboBox, The value object must have the same identity as an object in the drop-down. @param propName The DMR property name to set. @param value The value.
[ "Set", "the", "value", "of", "the", "underlying", "component", ".", "Note", "that", "this", "will", "not", "work", "for", "ListEditor", "components", ".", "Also", "note", "that", "for", "a", "JComboBox", "The", "value", "object", "must", "have", "the", "same", "identity", "as", "an", "object", "in", "the", "drop", "-", "down", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/OperationDialog.java#L120-L136
158,853
wildfly/wildfly-core
elytron/src/main/java/org/wildfly/extension/elytron/SecurityPropertiesWriteHandler.java
SecurityPropertiesWriteHandler.doDifference
static void doDifference( Map<String, String> left, Map<String, String> right, Map<String, String> onlyOnLeft, Map<String, String> onlyOnRight, Map<String, String> updated ) { onlyOnRight.clear(); onlyOnRight.putAll(right); for (Map.Entry<String, String> entry : left.entrySet()) { String leftKey = entry.getKey(); String leftValue = entry.getValue(); if (right.containsKey(leftKey)) { String rightValue = onlyOnRight.remove(leftKey); if (!leftValue.equals(rightValue)) { updated.put(leftKey, leftValue); } } else { onlyOnLeft.put(leftKey, leftValue); } } }
java
static void doDifference( Map<String, String> left, Map<String, String> right, Map<String, String> onlyOnLeft, Map<String, String> onlyOnRight, Map<String, String> updated ) { onlyOnRight.clear(); onlyOnRight.putAll(right); for (Map.Entry<String, String> entry : left.entrySet()) { String leftKey = entry.getKey(); String leftValue = entry.getValue(); if (right.containsKey(leftKey)) { String rightValue = onlyOnRight.remove(leftKey); if (!leftValue.equals(rightValue)) { updated.put(leftKey, leftValue); } } else { onlyOnLeft.put(leftKey, leftValue); } } }
[ "static", "void", "doDifference", "(", "Map", "<", "String", ",", "String", ">", "left", ",", "Map", "<", "String", ",", "String", ">", "right", ",", "Map", "<", "String", ",", "String", ">", "onlyOnLeft", ",", "Map", "<", "String", ",", "String", ">", "onlyOnRight", ",", "Map", "<", "String", ",", "String", ">", "updated", ")", "{", "onlyOnRight", ".", "clear", "(", ")", ";", "onlyOnRight", ".", "putAll", "(", "right", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "left", ".", "entrySet", "(", ")", ")", "{", "String", "leftKey", "=", "entry", ".", "getKey", "(", ")", ";", "String", "leftValue", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "right", ".", "containsKey", "(", "leftKey", ")", ")", "{", "String", "rightValue", "=", "onlyOnRight", ".", "remove", "(", "leftKey", ")", ";", "if", "(", "!", "leftValue", ".", "equals", "(", "rightValue", ")", ")", "{", "updated", ".", "put", "(", "leftKey", ",", "leftValue", ")", ";", "}", "}", "else", "{", "onlyOnLeft", ".", "put", "(", "leftKey", ",", "leftValue", ")", ";", "}", "}", "}" ]
calculate the difference of the two maps, so we know what was added, removed & updated @param left @param right @param onlyOnLeft @param onlyOnRight @param updated
[ "calculate", "the", "difference", "of", "the", "two", "maps", "so", "we", "know", "what", "was", "added", "removed", "&", "updated" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/SecurityPropertiesWriteHandler.java#L109-L130
158,854
wildfly/wildfly-core
network/src/main/java/org/jboss/as/network/OutboundSocketBinding.java
OutboundSocketBinding.close
public void close() throws IOException { final ManagedBinding binding = this.socketBindingManager.getNamedRegistry().getManagedBinding(this.name); if (binding == null) { return; } binding.close(); }
java
public void close() throws IOException { final ManagedBinding binding = this.socketBindingManager.getNamedRegistry().getManagedBinding(this.name); if (binding == null) { return; } binding.close(); }
[ "public", "void", "close", "(", ")", "throws", "IOException", "{", "final", "ManagedBinding", "binding", "=", "this", ".", "socketBindingManager", ".", "getNamedRegistry", "(", ")", ".", "getManagedBinding", "(", "this", ".", "name", ")", ";", "if", "(", "binding", "==", "null", ")", "{", "return", ";", "}", "binding", ".", "close", "(", ")", ";", "}" ]
Closes the outbound socket binding connection. @throws IOException
[ "Closes", "the", "outbound", "socket", "binding", "connection", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/OutboundSocketBinding.java#L247-L253
158,855
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/Logging.java
Logging.requiresReload
public static boolean requiresReload(final Set<Flag> flags) { return flags.contains(Flag.RESTART_ALL_SERVICES) || flags.contains(Flag.RESTART_RESOURCE_SERVICES); }
java
public static boolean requiresReload(final Set<Flag> flags) { return flags.contains(Flag.RESTART_ALL_SERVICES) || flags.contains(Flag.RESTART_RESOURCE_SERVICES); }
[ "public", "static", "boolean", "requiresReload", "(", "final", "Set", "<", "Flag", ">", "flags", ")", "{", "return", "flags", ".", "contains", "(", "Flag", ".", "RESTART_ALL_SERVICES", ")", "||", "flags", ".", "contains", "(", "Flag", ".", "RESTART_RESOURCE_SERVICES", ")", ";", "}" ]
Checks to see within the flags if a reload, i.e. not a full restart, is required. @param flags the flags to check @return {@code true} if a reload is required, otherwise {@code false}
[ "Checks", "to", "see", "within", "the", "flags", "if", "a", "reload", "i", ".", "e", ".", "not", "a", "full", "restart", "is", "required", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/Logging.java#L61-L63
158,856
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentityImpl.java
InstalledIdentityImpl.updateState
@Override protected void updateState(final String name, final InstallationModificationImpl modification, final InstallationModificationImpl.InstallationState state) { final PatchableTarget.TargetInfo identityInfo = modification.getModifiedState(); this.identity = new Identity() { @Override public String getVersion() { return modification.getVersion(); } @Override public String getName() { return name; } @Override public TargetInfo loadTargetInfo() throws IOException { return identityInfo; } @Override public DirectoryStructure getDirectoryStructure() { return modification.getDirectoryStructure(); } }; this.allPatches = Collections.unmodifiableList(modification.getAllPatches()); this.layers.clear(); for (final Map.Entry<String, MutableTargetImpl> entry : state.getLayers().entrySet()) { final String layerName = entry.getKey(); final MutableTargetImpl target = entry.getValue(); putLayer(layerName, new LayerInfo(layerName, target.getModifiedState(), target.getDirectoryStructure())); } this.addOns.clear(); for (final Map.Entry<String, MutableTargetImpl> entry : state.getAddOns().entrySet()) { final String addOnName = entry.getKey(); final MutableTargetImpl target = entry.getValue(); putAddOn(addOnName, new LayerInfo(addOnName, target.getModifiedState(), target.getDirectoryStructure())); } }
java
@Override protected void updateState(final String name, final InstallationModificationImpl modification, final InstallationModificationImpl.InstallationState state) { final PatchableTarget.TargetInfo identityInfo = modification.getModifiedState(); this.identity = new Identity() { @Override public String getVersion() { return modification.getVersion(); } @Override public String getName() { return name; } @Override public TargetInfo loadTargetInfo() throws IOException { return identityInfo; } @Override public DirectoryStructure getDirectoryStructure() { return modification.getDirectoryStructure(); } }; this.allPatches = Collections.unmodifiableList(modification.getAllPatches()); this.layers.clear(); for (final Map.Entry<String, MutableTargetImpl> entry : state.getLayers().entrySet()) { final String layerName = entry.getKey(); final MutableTargetImpl target = entry.getValue(); putLayer(layerName, new LayerInfo(layerName, target.getModifiedState(), target.getDirectoryStructure())); } this.addOns.clear(); for (final Map.Entry<String, MutableTargetImpl> entry : state.getAddOns().entrySet()) { final String addOnName = entry.getKey(); final MutableTargetImpl target = entry.getValue(); putAddOn(addOnName, new LayerInfo(addOnName, target.getModifiedState(), target.getDirectoryStructure())); } }
[ "@", "Override", "protected", "void", "updateState", "(", "final", "String", "name", ",", "final", "InstallationModificationImpl", "modification", ",", "final", "InstallationModificationImpl", ".", "InstallationState", "state", ")", "{", "final", "PatchableTarget", ".", "TargetInfo", "identityInfo", "=", "modification", ".", "getModifiedState", "(", ")", ";", "this", ".", "identity", "=", "new", "Identity", "(", ")", "{", "@", "Override", "public", "String", "getVersion", "(", ")", "{", "return", "modification", ".", "getVersion", "(", ")", ";", "}", "@", "Override", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "@", "Override", "public", "TargetInfo", "loadTargetInfo", "(", ")", "throws", "IOException", "{", "return", "identityInfo", ";", "}", "@", "Override", "public", "DirectoryStructure", "getDirectoryStructure", "(", ")", "{", "return", "modification", ".", "getDirectoryStructure", "(", ")", ";", "}", "}", ";", "this", ".", "allPatches", "=", "Collections", ".", "unmodifiableList", "(", "modification", ".", "getAllPatches", "(", ")", ")", ";", "this", ".", "layers", ".", "clear", "(", ")", ";", "for", "(", "final", "Map", ".", "Entry", "<", "String", ",", "MutableTargetImpl", ">", "entry", ":", "state", ".", "getLayers", "(", ")", ".", "entrySet", "(", ")", ")", "{", "final", "String", "layerName", "=", "entry", ".", "getKey", "(", ")", ";", "final", "MutableTargetImpl", "target", "=", "entry", ".", "getValue", "(", ")", ";", "putLayer", "(", "layerName", ",", "new", "LayerInfo", "(", "layerName", ",", "target", ".", "getModifiedState", "(", ")", ",", "target", ".", "getDirectoryStructure", "(", ")", ")", ")", ";", "}", "this", ".", "addOns", ".", "clear", "(", ")", ";", "for", "(", "final", "Map", ".", "Entry", "<", "String", ",", "MutableTargetImpl", ">", "entry", ":", "state", ".", "getAddOns", "(", ")", ".", "entrySet", "(", ")", ")", "{", "final", "String", "addOnName", "=", "entry", ".", "getKey", "(", ")", ";", "final", "MutableTargetImpl", "target", "=", "entry", ".", "getValue", "(", ")", ";", "putAddOn", "(", "addOnName", ",", "new", "LayerInfo", "(", "addOnName", ",", "target", ".", "getModifiedState", "(", ")", ",", "target", ".", "getDirectoryStructure", "(", ")", ")", ")", ";", "}", "}" ]
Update the installed identity using the modified state from the modification. @param name the identity name @param modification the modification @param state the installation state @return the installed identity
[ "Update", "the", "installed", "identity", "using", "the", "modified", "state", "from", "the", "modification", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentityImpl.java#L115-L153
158,857
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java
AffectedDeploymentOverlay.listAllLinks
public static Set<String> listAllLinks(OperationContext context, String overlay) { Set<String> serverGoupNames = listServerGroupsReferencingOverlay(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS), overlay); Set<String> links = new HashSet<>(); for (String serverGoupName : serverGoupNames) { links.addAll(listLinks(context, PathAddress.pathAddress( PathElement.pathElement(SERVER_GROUP, serverGoupName), PathElement.pathElement(DEPLOYMENT_OVERLAY, overlay)))); } return links; }
java
public static Set<String> listAllLinks(OperationContext context, String overlay) { Set<String> serverGoupNames = listServerGroupsReferencingOverlay(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS), overlay); Set<String> links = new HashSet<>(); for (String serverGoupName : serverGoupNames) { links.addAll(listLinks(context, PathAddress.pathAddress( PathElement.pathElement(SERVER_GROUP, serverGoupName), PathElement.pathElement(DEPLOYMENT_OVERLAY, overlay)))); } return links; }
[ "public", "static", "Set", "<", "String", ">", "listAllLinks", "(", "OperationContext", "context", ",", "String", "overlay", ")", "{", "Set", "<", "String", ">", "serverGoupNames", "=", "listServerGroupsReferencingOverlay", "(", "context", ".", "readResourceFromRoot", "(", "PathAddress", ".", "EMPTY_ADDRESS", ")", ",", "overlay", ")", ";", "Set", "<", "String", ">", "links", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "serverGoupName", ":", "serverGoupNames", ")", "{", "links", ".", "addAll", "(", "listLinks", "(", "context", ",", "PathAddress", ".", "pathAddress", "(", "PathElement", ".", "pathElement", "(", "SERVER_GROUP", ",", "serverGoupName", ")", ",", "PathElement", ".", "pathElement", "(", "DEPLOYMENT_OVERLAY", ",", "overlay", ")", ")", ")", ")", ";", "}", "return", "links", ";", "}" ]
Returns all the deployment runtime names associated with an overlay accross all server groups. @param context the current OperationContext. @param overlay the name of the overlay. @return all the deployment runtime names associated with an overlay accross all server groups.
[ "Returns", "all", "the", "deployment", "runtime", "names", "associated", "with", "an", "overlay", "accross", "all", "server", "groups", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L73-L82
158,858
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java
AffectedDeploymentOverlay.listLinks
public static Set<String> listLinks(OperationContext context, PathAddress overlayAddress) { Resource overlayResource = context.readResourceFromRoot(overlayAddress); if (overlayResource.hasChildren(DEPLOYMENT)) { return overlayResource.getChildrenNames(DEPLOYMENT); } return Collections.emptySet(); }
java
public static Set<String> listLinks(OperationContext context, PathAddress overlayAddress) { Resource overlayResource = context.readResourceFromRoot(overlayAddress); if (overlayResource.hasChildren(DEPLOYMENT)) { return overlayResource.getChildrenNames(DEPLOYMENT); } return Collections.emptySet(); }
[ "public", "static", "Set", "<", "String", ">", "listLinks", "(", "OperationContext", "context", ",", "PathAddress", "overlayAddress", ")", "{", "Resource", "overlayResource", "=", "context", ".", "readResourceFromRoot", "(", "overlayAddress", ")", ";", "if", "(", "overlayResource", ".", "hasChildren", "(", "DEPLOYMENT", ")", ")", "{", "return", "overlayResource", ".", "getChildrenNames", "(", "DEPLOYMENT", ")", ";", "}", "return", "Collections", ".", "emptySet", "(", ")", ";", "}" ]
Returns all the deployment runtime names associated with an overlay. @param context the current OperationContext. @param overlayAddress the address for the averlay. @return all the deployment runtime names associated with an overlay.
[ "Returns", "all", "the", "deployment", "runtime", "names", "associated", "with", "an", "overlay", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L91-L97
158,859
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java
AffectedDeploymentOverlay.redeployDeployments
public static void redeployDeployments(OperationContext context, PathAddress deploymentsRootAddress, Set<String> deploymentNames) throws OperationFailedException { for (String deploymentName : deploymentNames) { PathAddress address = deploymentsRootAddress.append(DEPLOYMENT, deploymentName); OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(address, REDEPLOY); ModelNode operation = addRedeployStep(address); ServerLogger.AS_ROOT_LOGGER.debugf("Redeploying %s at address %s with handler %s", deploymentName, address, handler); assert handler != null; assert operation.isDefined(); context.addStep(operation, handler, OperationContext.Stage.MODEL); } }
java
public static void redeployDeployments(OperationContext context, PathAddress deploymentsRootAddress, Set<String> deploymentNames) throws OperationFailedException { for (String deploymentName : deploymentNames) { PathAddress address = deploymentsRootAddress.append(DEPLOYMENT, deploymentName); OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(address, REDEPLOY); ModelNode operation = addRedeployStep(address); ServerLogger.AS_ROOT_LOGGER.debugf("Redeploying %s at address %s with handler %s", deploymentName, address, handler); assert handler != null; assert operation.isDefined(); context.addStep(operation, handler, OperationContext.Stage.MODEL); } }
[ "public", "static", "void", "redeployDeployments", "(", "OperationContext", "context", ",", "PathAddress", "deploymentsRootAddress", ",", "Set", "<", "String", ">", "deploymentNames", ")", "throws", "OperationFailedException", "{", "for", "(", "String", "deploymentName", ":", "deploymentNames", ")", "{", "PathAddress", "address", "=", "deploymentsRootAddress", ".", "append", "(", "DEPLOYMENT", ",", "deploymentName", ")", ";", "OperationStepHandler", "handler", "=", "context", ".", "getRootResourceRegistration", "(", ")", ".", "getOperationHandler", "(", "address", ",", "REDEPLOY", ")", ";", "ModelNode", "operation", "=", "addRedeployStep", "(", "address", ")", ";", "ServerLogger", ".", "AS_ROOT_LOGGER", ".", "debugf", "(", "\"Redeploying %s at address %s with handler %s\"", ",", "deploymentName", ",", "address", ",", "handler", ")", ";", "assert", "handler", "!=", "null", ";", "assert", "operation", ".", "isDefined", "(", ")", ";", "context", ".", "addStep", "(", "operation", ",", "handler", ",", "OperationContext", ".", "Stage", ".", "MODEL", ")", ";", "}", "}" ]
We are adding a redeploy operation step for each specified deployment runtime name. @param context @param deploymentsRootAddress @param deploymentNames @throws OperationFailedException
[ "We", "are", "adding", "a", "redeploy", "operation", "step", "for", "each", "specified", "deployment", "runtime", "name", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L128-L138
158,860
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java
AffectedDeploymentOverlay.redeployLinksAndTransformOperation
public static void redeployLinksAndTransformOperation(OperationContext context, ModelNode removeOperation, PathAddress deploymentsRootAddress, Set<String> runtimeNames) throws OperationFailedException { Set<String> deploymentNames = listDeployments(context.readResourceFromRoot(deploymentsRootAddress), runtimeNames); Operations.CompositeOperationBuilder opBuilder = Operations.CompositeOperationBuilder.create(); if (deploymentNames.isEmpty()) { for (String s : runtimeNames) { ServerLogger.ROOT_LOGGER.debugf("We haven't found any deployment for %s in server-group %s", s, deploymentsRootAddress.getLastElement().getValue()); } } if(removeOperation != null) { opBuilder.addStep(removeOperation); } for (String deploymentName : deploymentNames) { opBuilder.addStep(addRedeployStep(deploymentsRootAddress.append(DEPLOYMENT, deploymentName))); } List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS); if (transformers == null) { context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>()); } final ModelNode slave = opBuilder.build().getOperation(); transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress())); }
java
public static void redeployLinksAndTransformOperation(OperationContext context, ModelNode removeOperation, PathAddress deploymentsRootAddress, Set<String> runtimeNames) throws OperationFailedException { Set<String> deploymentNames = listDeployments(context.readResourceFromRoot(deploymentsRootAddress), runtimeNames); Operations.CompositeOperationBuilder opBuilder = Operations.CompositeOperationBuilder.create(); if (deploymentNames.isEmpty()) { for (String s : runtimeNames) { ServerLogger.ROOT_LOGGER.debugf("We haven't found any deployment for %s in server-group %s", s, deploymentsRootAddress.getLastElement().getValue()); } } if(removeOperation != null) { opBuilder.addStep(removeOperation); } for (String deploymentName : deploymentNames) { opBuilder.addStep(addRedeployStep(deploymentsRootAddress.append(DEPLOYMENT, deploymentName))); } List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS); if (transformers == null) { context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>()); } final ModelNode slave = opBuilder.build().getOperation(); transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress())); }
[ "public", "static", "void", "redeployLinksAndTransformOperation", "(", "OperationContext", "context", ",", "ModelNode", "removeOperation", ",", "PathAddress", "deploymentsRootAddress", ",", "Set", "<", "String", ">", "runtimeNames", ")", "throws", "OperationFailedException", "{", "Set", "<", "String", ">", "deploymentNames", "=", "listDeployments", "(", "context", ".", "readResourceFromRoot", "(", "deploymentsRootAddress", ")", ",", "runtimeNames", ")", ";", "Operations", ".", "CompositeOperationBuilder", "opBuilder", "=", "Operations", ".", "CompositeOperationBuilder", ".", "create", "(", ")", ";", "if", "(", "deploymentNames", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "String", "s", ":", "runtimeNames", ")", "{", "ServerLogger", ".", "ROOT_LOGGER", ".", "debugf", "(", "\"We haven't found any deployment for %s in server-group %s\"", ",", "s", ",", "deploymentsRootAddress", ".", "getLastElement", "(", ")", ".", "getValue", "(", ")", ")", ";", "}", "}", "if", "(", "removeOperation", "!=", "null", ")", "{", "opBuilder", ".", "addStep", "(", "removeOperation", ")", ";", "}", "for", "(", "String", "deploymentName", ":", "deploymentNames", ")", "{", "opBuilder", ".", "addStep", "(", "addRedeployStep", "(", "deploymentsRootAddress", ".", "append", "(", "DEPLOYMENT", ",", "deploymentName", ")", ")", ")", ";", "}", "List", "<", "DomainOperationTransmuter", ">", "transformers", "=", "context", ".", "getAttachment", "(", "OperationAttachments", ".", "SLAVE_SERVER_OPERATION_TRANSMUTERS", ")", ";", "if", "(", "transformers", "==", "null", ")", "{", "context", ".", "attach", "(", "OperationAttachments", ".", "SLAVE_SERVER_OPERATION_TRANSMUTERS", ",", "transformers", "=", "new", "ArrayList", "<>", "(", ")", ")", ";", "}", "final", "ModelNode", "slave", "=", "opBuilder", ".", "build", "(", ")", ".", "getOperation", "(", ")", ";", "transformers", ".", "add", "(", "new", "OverlayOperationTransmuter", "(", "slave", ",", "context", ".", "getCurrentAddress", "(", ")", ")", ")", ";", "}" ]
It will look for all the deployments under the deploymentsRootAddress with a runtimeName in the specified list of runtime names and then transform the operation so that every server having those deployments will redeploy the affected deployments. @see #transformOperation @param removeOperation @param context @param deploymentsRootAddress @param runtimeNames @throws OperationFailedException
[ "It", "will", "look", "for", "all", "the", "deployments", "under", "the", "deploymentsRootAddress", "with", "a", "runtimeName", "in", "the", "specified", "list", "of", "runtime", "names", "and", "then", "transform", "the", "operation", "so", "that", "every", "server", "having", "those", "deployments", "will", "redeploy", "the", "affected", "deployments", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L196-L216
158,861
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java
AffectedDeploymentOverlay.listDeployments
public static Set<String> listDeployments(Resource deploymentRootResource, Set<String> runtimeNames) { Set<Pattern> set = new HashSet<>(); for (String wildcardExpr : runtimeNames) { Pattern pattern = DeploymentOverlayIndex.getPattern(wildcardExpr); set.add(pattern); } return listDeploymentNames(deploymentRootResource, set); }
java
public static Set<String> listDeployments(Resource deploymentRootResource, Set<String> runtimeNames) { Set<Pattern> set = new HashSet<>(); for (String wildcardExpr : runtimeNames) { Pattern pattern = DeploymentOverlayIndex.getPattern(wildcardExpr); set.add(pattern); } return listDeploymentNames(deploymentRootResource, set); }
[ "public", "static", "Set", "<", "String", ">", "listDeployments", "(", "Resource", "deploymentRootResource", ",", "Set", "<", "String", ">", "runtimeNames", ")", "{", "Set", "<", "Pattern", ">", "set", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "wildcardExpr", ":", "runtimeNames", ")", "{", "Pattern", "pattern", "=", "DeploymentOverlayIndex", ".", "getPattern", "(", "wildcardExpr", ")", ";", "set", ".", "add", "(", "pattern", ")", ";", "}", "return", "listDeploymentNames", "(", "deploymentRootResource", ",", "set", ")", ";", "}" ]
Returns the deployment names with the specified runtime names at the specified deploymentRootAddress. @param deploymentRootResource @param runtimeNames @return the deployment names with the specified runtime names at the specified deploymentRootAddress.
[ "Returns", "the", "deployment", "names", "with", "the", "specified", "runtime", "names", "at", "the", "specified", "deploymentRootAddress", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L225-L232
158,862
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java
CommandExecutor.execute
public void execute(CommandHandler handler, int timeout, TimeUnit unit) throws CommandLineException, InterruptedException, ExecutionException, TimeoutException { ExecutableBuilder builder = new ExecutableBuilder() { CommandContext c = newTimeoutCommandContext(ctx); @Override public Executable build() { return () -> { handler.handle(c); }; } @Override public CommandContext getCommandContext() { return c; } }; execute(builder, timeout, unit); }
java
public void execute(CommandHandler handler, int timeout, TimeUnit unit) throws CommandLineException, InterruptedException, ExecutionException, TimeoutException { ExecutableBuilder builder = new ExecutableBuilder() { CommandContext c = newTimeoutCommandContext(ctx); @Override public Executable build() { return () -> { handler.handle(c); }; } @Override public CommandContext getCommandContext() { return c; } }; execute(builder, timeout, unit); }
[ "public", "void", "execute", "(", "CommandHandler", "handler", ",", "int", "timeout", ",", "TimeUnit", "unit", ")", "throws", "CommandLineException", ",", "InterruptedException", ",", "ExecutionException", ",", "TimeoutException", "{", "ExecutableBuilder", "builder", "=", "new", "ExecutableBuilder", "(", ")", "{", "CommandContext", "c", "=", "newTimeoutCommandContext", "(", "ctx", ")", ";", "@", "Override", "public", "Executable", "build", "(", ")", "{", "return", "(", ")", "->", "{", "handler", ".", "handle", "(", "c", ")", ";", "}", ";", "}", "@", "Override", "public", "CommandContext", "getCommandContext", "(", ")", "{", "return", "c", ";", "}", "}", ";", "execute", "(", "builder", ",", "timeout", ",", "unit", ")", ";", "}" ]
public for testing purpose
[ "public", "for", "testing", "purpose" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java#L675-L695
158,863
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java
CommandExecutor.execute
void execute(ExecutableBuilder builder, int timeout, TimeUnit unit) throws CommandLineException, InterruptedException, ExecutionException, TimeoutException { Future<Void> task = executorService.submit(() -> { builder.build().execute(); return null; }); try { if (timeout <= 0) { //Synchronous task.get(); } else { // Guarded execution try { task.get(timeout, unit); } catch (TimeoutException ex) { // First make the context unusable CommandContext c = builder.getCommandContext(); if (c instanceof TimeoutCommandContext) { ((TimeoutCommandContext) c).timeout(); } // Then cancel the task. task.cancel(true); throw ex; } } } catch (InterruptedException ex) { // Could have been interrupted by user (Ctrl-C) Thread.currentThread().interrupt(); cancelTask(task, builder.getCommandContext(), null); // Interrupt running operation. CommandContext c = builder.getCommandContext(); if (c instanceof TimeoutCommandContext) { ((TimeoutCommandContext) c).interrupted(); } throw ex; } }
java
void execute(ExecutableBuilder builder, int timeout, TimeUnit unit) throws CommandLineException, InterruptedException, ExecutionException, TimeoutException { Future<Void> task = executorService.submit(() -> { builder.build().execute(); return null; }); try { if (timeout <= 0) { //Synchronous task.get(); } else { // Guarded execution try { task.get(timeout, unit); } catch (TimeoutException ex) { // First make the context unusable CommandContext c = builder.getCommandContext(); if (c instanceof TimeoutCommandContext) { ((TimeoutCommandContext) c).timeout(); } // Then cancel the task. task.cancel(true); throw ex; } } } catch (InterruptedException ex) { // Could have been interrupted by user (Ctrl-C) Thread.currentThread().interrupt(); cancelTask(task, builder.getCommandContext(), null); // Interrupt running operation. CommandContext c = builder.getCommandContext(); if (c instanceof TimeoutCommandContext) { ((TimeoutCommandContext) c).interrupted(); } throw ex; } }
[ "void", "execute", "(", "ExecutableBuilder", "builder", ",", "int", "timeout", ",", "TimeUnit", "unit", ")", "throws", "CommandLineException", ",", "InterruptedException", ",", "ExecutionException", ",", "TimeoutException", "{", "Future", "<", "Void", ">", "task", "=", "executorService", ".", "submit", "(", "(", ")", "->", "{", "builder", ".", "build", "(", ")", ".", "execute", "(", ")", ";", "return", "null", ";", "}", ")", ";", "try", "{", "if", "(", "timeout", "<=", "0", ")", "{", "//Synchronous", "task", ".", "get", "(", ")", ";", "}", "else", "{", "// Guarded execution", "try", "{", "task", ".", "get", "(", "timeout", ",", "unit", ")", ";", "}", "catch", "(", "TimeoutException", "ex", ")", "{", "// First make the context unusable", "CommandContext", "c", "=", "builder", ".", "getCommandContext", "(", ")", ";", "if", "(", "c", "instanceof", "TimeoutCommandContext", ")", "{", "(", "(", "TimeoutCommandContext", ")", "c", ")", ".", "timeout", "(", ")", ";", "}", "// Then cancel the task.", "task", ".", "cancel", "(", "true", ")", ";", "throw", "ex", ";", "}", "}", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "// Could have been interrupted by user (Ctrl-C)", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "cancelTask", "(", "task", ",", "builder", ".", "getCommandContext", "(", ")", ",", "null", ")", ";", "// Interrupt running operation.", "CommandContext", "c", "=", "builder", ".", "getCommandContext", "(", ")", ";", "if", "(", "c", "instanceof", "TimeoutCommandContext", ")", "{", "(", "(", "TimeoutCommandContext", ")", "c", ")", ".", "interrupted", "(", ")", ";", "}", "throw", "ex", ";", "}", "}" ]
The CommandContext can be retrieved thatnks to the ExecutableBuilder.
[ "The", "CommandContext", "can", "be", "retrieved", "thatnks", "to", "the", "ExecutableBuilder", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java#L702-L739
158,864
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/impl/ArgumentWithValue.java
ArgumentWithValue.getOriginalValue
public String getOriginalValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException { String value = null; if(parsedLine.hasProperties()) { if(index >= 0) { List<String> others = parsedLine.getOtherProperties(); if(others.size() > index) { return others.get(index); } } value = parsedLine.getPropertyValue(fullName); if(value == null && shortName != null) { value = parsedLine.getPropertyValue(shortName); } } if(required && value == null && !isPresent(parsedLine)) { StringBuilder buf = new StringBuilder(); buf.append("Required argument "); buf.append('\'').append(fullName).append('\''); buf.append(" is missing."); throw new CommandFormatException(buf.toString()); } return value; }
java
public String getOriginalValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException { String value = null; if(parsedLine.hasProperties()) { if(index >= 0) { List<String> others = parsedLine.getOtherProperties(); if(others.size() > index) { return others.get(index); } } value = parsedLine.getPropertyValue(fullName); if(value == null && shortName != null) { value = parsedLine.getPropertyValue(shortName); } } if(required && value == null && !isPresent(parsedLine)) { StringBuilder buf = new StringBuilder(); buf.append("Required argument "); buf.append('\'').append(fullName).append('\''); buf.append(" is missing."); throw new CommandFormatException(buf.toString()); } return value; }
[ "public", "String", "getOriginalValue", "(", "ParsedCommandLine", "parsedLine", ",", "boolean", "required", ")", "throws", "CommandFormatException", "{", "String", "value", "=", "null", ";", "if", "(", "parsedLine", ".", "hasProperties", "(", ")", ")", "{", "if", "(", "index", ">=", "0", ")", "{", "List", "<", "String", ">", "others", "=", "parsedLine", ".", "getOtherProperties", "(", ")", ";", "if", "(", "others", ".", "size", "(", ")", ">", "index", ")", "{", "return", "others", ".", "get", "(", "index", ")", ";", "}", "}", "value", "=", "parsedLine", ".", "getPropertyValue", "(", "fullName", ")", ";", "if", "(", "value", "==", "null", "&&", "shortName", "!=", "null", ")", "{", "value", "=", "parsedLine", ".", "getPropertyValue", "(", "shortName", ")", ";", "}", "}", "if", "(", "required", "&&", "value", "==", "null", "&&", "!", "isPresent", "(", "parsedLine", ")", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\"Required argument \"", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "fullName", ")", ".", "append", "(", "'", "'", ")", ";", "buf", ".", "append", "(", "\" is missing.\"", ")", ";", "throw", "new", "CommandFormatException", "(", "buf", ".", "toString", "(", ")", ")", ";", "}", "return", "value", ";", "}" ]
Returns value as it appeared on the command line with escape sequences and system properties not resolved. The variables, though, are resolved during the initial parsing of the command line. @param parsedLine parsed command line @param required whether the argument is required @return argument value as it appears on the command line @throws CommandFormatException in case the required argument is missing
[ "Returns", "value", "as", "it", "appeared", "on", "the", "command", "line", "with", "escape", "sequences", "and", "system", "properties", "not", "resolved", ".", "The", "variables", "though", "are", "resolved", "during", "the", "initial", "parsing", "of", "the", "command", "line", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/ArgumentWithValue.java#L159-L183
158,865
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/SystemExiter.java
SystemExiter.logBeforeExit
public static void logBeforeExit(ExitLogger logger) { try { if (logged.compareAndSet(false, true)) { logger.logExit(); } } catch (Throwable ignored){ // ignored } }
java
public static void logBeforeExit(ExitLogger logger) { try { if (logged.compareAndSet(false, true)) { logger.logExit(); } } catch (Throwable ignored){ // ignored } }
[ "public", "static", "void", "logBeforeExit", "(", "ExitLogger", "logger", ")", "{", "try", "{", "if", "(", "logged", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "logger", ".", "logExit", "(", ")", ";", "}", "}", "catch", "(", "Throwable", "ignored", ")", "{", "// ignored", "}", "}" ]
Invokes the exit logger if and only if no ExitLogger was previously invoked. @param logger the logger. Cannot be {@code null}
[ "Invokes", "the", "exit", "logger", "if", "and", "only", "if", "no", "ExitLogger", "was", "previously", "invoked", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/SystemExiter.java#L81-L89
158,866
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java
DeploymentOverlayHandler.getName
private String getName(CommandContext ctx, boolean failInBatch) throws CommandLineException { final ParsedCommandLine args = ctx.getParsedCommandLine(); final String name = this.name.getValue(args, true); if (name == null) { throw new CommandFormatException(this.name + " is missing value."); } if (!ctx.isBatchMode() || failInBatch) { if (!Util.isValidPath(ctx.getModelControllerClient(), Util.DEPLOYMENT_OVERLAY, name)) { throw new CommandFormatException("Deployment overlay " + name + " does not exist."); } } return name; }
java
private String getName(CommandContext ctx, boolean failInBatch) throws CommandLineException { final ParsedCommandLine args = ctx.getParsedCommandLine(); final String name = this.name.getValue(args, true); if (name == null) { throw new CommandFormatException(this.name + " is missing value."); } if (!ctx.isBatchMode() || failInBatch) { if (!Util.isValidPath(ctx.getModelControllerClient(), Util.DEPLOYMENT_OVERLAY, name)) { throw new CommandFormatException("Deployment overlay " + name + " does not exist."); } } return name; }
[ "private", "String", "getName", "(", "CommandContext", "ctx", ",", "boolean", "failInBatch", ")", "throws", "CommandLineException", "{", "final", "ParsedCommandLine", "args", "=", "ctx", ".", "getParsedCommandLine", "(", ")", ";", "final", "String", "name", "=", "this", ".", "name", ".", "getValue", "(", "args", ",", "true", ")", ";", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "CommandFormatException", "(", "this", ".", "name", "+", "\" is missing value.\"", ")", ";", "}", "if", "(", "!", "ctx", ".", "isBatchMode", "(", ")", "||", "failInBatch", ")", "{", "if", "(", "!", "Util", ".", "isValidPath", "(", "ctx", ".", "getModelControllerClient", "(", ")", ",", "Util", ".", "DEPLOYMENT_OVERLAY", ",", "name", ")", ")", "{", "throw", "new", "CommandFormatException", "(", "\"Deployment overlay \"", "+", "name", "+", "\" does not exist.\"", ")", ";", "}", "}", "return", "name", ";", "}" ]
Validate that the overlay exists. If it doesn't exist, throws an exception if not in batch mode or if failInBatch is true. In batch mode, we could be in the case that the overlay doesn't exist yet.
[ "Validate", "that", "the", "overlay", "exists", ".", "If", "it", "doesn", "t", "exist", "throws", "an", "exception", "if", "not", "in", "batch", "mode", "or", "if", "failInBatch", "is", "true", ".", "In", "batch", "mode", "we", "could", "be", "in", "the", "case", "that", "the", "overlay", "doesn", "t", "exist", "yet", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java#L545-L557
158,867
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java
ServiceModuleLoader.moduleSpecServiceName
public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier) { if (!isDynamicModule(identifier)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } return MODULE_SPEC_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); }
java
public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier) { if (!isDynamicModule(identifier)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } return MODULE_SPEC_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); }
[ "public", "static", "ServiceName", "moduleSpecServiceName", "(", "ModuleIdentifier", "identifier", ")", "{", "if", "(", "!", "isDynamicModule", "(", "identifier", ")", ")", "{", "throw", "ServerLogger", ".", "ROOT_LOGGER", ".", "missingModulePrefix", "(", "identifier", ",", "MODULE_PREFIX", ")", ";", "}", "return", "MODULE_SPEC_SERVICE_PREFIX", ".", "append", "(", "identifier", ".", "getName", "(", ")", ")", ".", "append", "(", "identifier", ".", "getSlot", "(", ")", ")", ";", "}" ]
Returns the corresponding ModuleSpec service name for the given module. @param identifier The module identifier @return The service name of the ModuleSpec service
[ "Returns", "the", "corresponding", "ModuleSpec", "service", "name", "for", "the", "given", "module", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java#L214-L219
158,868
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java
ServiceModuleLoader.moduleResolvedServiceName
public static ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) { if (!isDynamicModule(identifier)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); }
java
public static ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) { if (!isDynamicModule(identifier)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); }
[ "public", "static", "ServiceName", "moduleResolvedServiceName", "(", "ModuleIdentifier", "identifier", ")", "{", "if", "(", "!", "isDynamicModule", "(", "identifier", ")", ")", "{", "throw", "ServerLogger", ".", "ROOT_LOGGER", ".", "missingModulePrefix", "(", "identifier", ",", "MODULE_PREFIX", ")", ";", "}", "return", "MODULE_RESOLVED_SERVICE_PREFIX", ".", "append", "(", "identifier", ".", "getName", "(", ")", ")", ".", "append", "(", "identifier", ".", "getSlot", "(", ")", ")", ";", "}" ]
Returns the corresponding module resolved service name for the given module. The module resolved service is basically a latch that prevents the module from being loaded until all the transitive dependencies that it depends upon have have their module spec services come up. @param identifier The module identifier @return The service name of the ModuleSpec service
[ "Returns", "the", "corresponding", "module", "resolved", "service", "name", "for", "the", "given", "module", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java#L238-L243
158,869
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java
ServiceModuleLoader.moduleServiceName
public static ServiceName moduleServiceName(ModuleIdentifier identifier) { if (!identifier.getName().startsWith(MODULE_PREFIX)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } return MODULE_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); }
java
public static ServiceName moduleServiceName(ModuleIdentifier identifier) { if (!identifier.getName().startsWith(MODULE_PREFIX)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } return MODULE_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); }
[ "public", "static", "ServiceName", "moduleServiceName", "(", "ModuleIdentifier", "identifier", ")", "{", "if", "(", "!", "identifier", ".", "getName", "(", ")", ".", "startsWith", "(", "MODULE_PREFIX", ")", ")", "{", "throw", "ServerLogger", ".", "ROOT_LOGGER", ".", "missingModulePrefix", "(", "identifier", ",", "MODULE_PREFIX", ")", ";", "}", "return", "MODULE_SERVICE_PREFIX", ".", "append", "(", "identifier", ".", "getName", "(", ")", ")", ".", "append", "(", "identifier", ".", "getSlot", "(", ")", ")", ";", "}" ]
Returns the corresponding ModuleLoadService service name for the given module. @param identifier The module identifier @return The service name of the ModuleLoadService service
[ "Returns", "the", "corresponding", "ModuleLoadService", "service", "name", "for", "the", "given", "module", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java#L258-L263
158,870
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorProcessor.java
ServiceActivatorProcessor.deploy
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES); if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { return; // Skip it if it has not been marked } final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { return; // Skip deployments with no module } AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS); List<String> serviceAcitvatorList = new ArrayList<String>(); if (duList!=null && !duList.isEmpty()) { for (DeploymentUnit du : duList) { ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES); for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { serviceAcitvatorList.add(serv); } } } ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry(); if (WildFlySecurityManager.isChecking()) { //service registry allows you to modify internal server state across all deployments //if a security manager is present we use a version that has permission checks serviceRegistry = new SecuredServiceRegistry(serviceRegistry); } final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry); final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader()); for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) { try { for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) { serviceActivator.activate(serviceActivatorContext); break; } } } catch (ServiceRegistryException e) { throw new DeploymentUnitProcessingException(e); } } } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }
java
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES); if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { return; // Skip it if it has not been marked } final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { return; // Skip deployments with no module } AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS); List<String> serviceAcitvatorList = new ArrayList<String>(); if (duList!=null && !duList.isEmpty()) { for (DeploymentUnit du : duList) { ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES); for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { serviceAcitvatorList.add(serv); } } } ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry(); if (WildFlySecurityManager.isChecking()) { //service registry allows you to modify internal server state across all deployments //if a security manager is present we use a version that has permission checks serviceRegistry = new SecuredServiceRegistry(serviceRegistry); } final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry); final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader()); for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) { try { for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) { serviceActivator.activate(serviceActivatorContext); break; } } } catch (ServiceRegistryException e) { throw new DeploymentUnitProcessingException(e); } } } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }
[ "public", "void", "deploy", "(", "DeploymentPhaseContext", "phaseContext", ")", "throws", "DeploymentUnitProcessingException", "{", "final", "DeploymentUnit", "deploymentUnit", "=", "phaseContext", ".", "getDeploymentUnit", "(", ")", ";", "final", "ServicesAttachment", "servicesAttachment", "=", "deploymentUnit", ".", "getAttachment", "(", "Attachments", ".", "SERVICES", ")", ";", "if", "(", "servicesAttachment", "==", "null", "||", "servicesAttachment", ".", "getServiceImplementations", "(", "ServiceActivator", ".", "class", ".", "getName", "(", ")", ")", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "// Skip it if it has not been marked", "}", "final", "Module", "module", "=", "deploymentUnit", ".", "getAttachment", "(", "Attachments", ".", "MODULE", ")", ";", "if", "(", "module", "==", "null", ")", "{", "return", ";", "// Skip deployments with no module", "}", "AttachmentList", "<", "DeploymentUnit", ">", "duList", "=", "deploymentUnit", ".", "getAttachment", "(", "Attachments", ".", "SUB_DEPLOYMENTS", ")", ";", "List", "<", "String", ">", "serviceAcitvatorList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "duList", "!=", "null", "&&", "!", "duList", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "DeploymentUnit", "du", ":", "duList", ")", "{", "ServicesAttachment", "duServicesAttachment", "=", "du", ".", "getAttachment", "(", "Attachments", ".", "SERVICES", ")", ";", "for", "(", "String", "serv", ":", "duServicesAttachment", ".", "getServiceImplementations", "(", "ServiceActivator", ".", "class", ".", "getName", "(", ")", ")", ")", "{", "serviceAcitvatorList", ".", "add", "(", "serv", ")", ";", "}", "}", "}", "ServiceRegistry", "serviceRegistry", "=", "phaseContext", ".", "getServiceRegistry", "(", ")", ";", "if", "(", "WildFlySecurityManager", ".", "isChecking", "(", ")", ")", "{", "//service registry allows you to modify internal server state across all deployments", "//if a security manager is present we use a version that has permission checks", "serviceRegistry", "=", "new", "SecuredServiceRegistry", "(", "serviceRegistry", ")", ";", "}", "final", "ServiceActivatorContext", "serviceActivatorContext", "=", "new", "ServiceActivatorContextImpl", "(", "phaseContext", ".", "getServiceTarget", "(", ")", ",", "serviceRegistry", ")", ";", "final", "ClassLoader", "current", "=", "WildFlySecurityManager", ".", "getCurrentContextClassLoaderPrivileged", "(", ")", ";", "try", "{", "WildFlySecurityManager", ".", "setCurrentContextClassLoaderPrivileged", "(", "module", ".", "getClassLoader", "(", ")", ")", ";", "for", "(", "ServiceActivator", "serviceActivator", ":", "module", ".", "loadService", "(", "ServiceActivator", ".", "class", ")", ")", "{", "try", "{", "for", "(", "String", "serv", ":", "servicesAttachment", ".", "getServiceImplementations", "(", "ServiceActivator", ".", "class", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "serv", ".", "compareTo", "(", "serviceActivator", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", "==", "0", "&&", "!", "serviceAcitvatorList", ".", "contains", "(", "serv", ")", ")", "{", "serviceActivator", ".", "activate", "(", "serviceActivatorContext", ")", ";", "break", ";", "}", "}", "}", "catch", "(", "ServiceRegistryException", "e", ")", "{", "throw", "new", "DeploymentUnitProcessingException", "(", "e", ")", ";", "}", "}", "}", "finally", "{", "WildFlySecurityManager", ".", "setCurrentContextClassLoaderPrivileged", "(", "current", ")", ";", "}", "}" ]
If the deployment has a module attached it will ask the module to load the ServiceActivator services. @param phaseContext the deployment unit context
[ "If", "the", "deployment", "has", "a", "module", "attached", "it", "will", "ask", "the", "module", "to", "load", "the", "ServiceActivator", "services", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorProcessor.java#L53-L102
158,871
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java
HostControllerConnection.openConnection
synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }
java
synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }
[ "synchronized", "void", "openConnection", "(", "final", "ModelController", "controller", ",", "final", "ActiveOperation", ".", "CompletedCallback", "<", "ModelNode", ">", "callback", ")", "throws", "Exception", "{", "boolean", "ok", "=", "false", ";", "final", "Connection", "connection", "=", "connectionManager", ".", "connect", "(", ")", ";", "try", "{", "channelHandler", ".", "executeRequest", "(", "new", "ServerRegisterRequest", "(", ")", ",", "null", ",", "callback", ")", ";", "// HC is the same version, so it will support sending the subject", "channelHandler", ".", "getAttachments", "(", ")", ".", "attach", "(", "TransactionalProtocolClient", ".", "SEND_IDENTITY", ",", "Boolean", ".", "TRUE", ")", ";", "channelHandler", ".", "getAttachments", "(", ")", ".", "attach", "(", "TransactionalProtocolClient", ".", "SEND_IN_VM", ",", "Boolean", ".", "TRUE", ")", ";", "channelHandler", ".", "addHandlerFactory", "(", "new", "TransactionalProtocolOperationHandler", "(", "controller", ",", "channelHandler", ",", "responseAttachmentSupport", ")", ")", ";", "ok", "=", "true", ";", "}", "finally", "{", "if", "(", "!", "ok", ")", "{", "connection", ".", "close", "(", ")", ";", "}", "}", "}" ]
Connect to the HC and retrieve the current model updates. @param controller the server controller @param callback the operation completed callback @throws IOException for any error
[ "Connect", "to", "the", "HC", "and", "retrieve", "the", "current", "model", "updates", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L126-L141
158,872
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java
HostControllerConnection.asyncReconnect
synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) { if (getState() != State.OPEN) { return; } // Update the configuration with the new credentials final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(createClientCallbackHandler(userName, authKey)); config.setUri(reconnectUri); this.configuration = config; final ReconnectRunner reconnectTask = this.reconnectRunner; if (reconnectTask == null) { final ReconnectRunner task = new ReconnectRunner(); task.callback = callback; task.future = executorService.submit(task); } else { reconnectTask.callback = callback; } }
java
synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) { if (getState() != State.OPEN) { return; } // Update the configuration with the new credentials final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(createClientCallbackHandler(userName, authKey)); config.setUri(reconnectUri); this.configuration = config; final ReconnectRunner reconnectTask = this.reconnectRunner; if (reconnectTask == null) { final ReconnectRunner task = new ReconnectRunner(); task.callback = callback; task.future = executorService.submit(task); } else { reconnectTask.callback = callback; } }
[ "synchronized", "void", "asyncReconnect", "(", "final", "URI", "reconnectUri", ",", "String", "authKey", ",", "final", "ReconnectCallback", "callback", ")", "{", "if", "(", "getState", "(", ")", "!=", "State", ".", "OPEN", ")", "{", "return", ";", "}", "// Update the configuration with the new credentials", "final", "ProtocolConnectionConfiguration", "config", "=", "ProtocolConnectionConfiguration", ".", "copy", "(", "configuration", ")", ";", "config", ".", "setCallbackHandler", "(", "createClientCallbackHandler", "(", "userName", ",", "authKey", ")", ")", ";", "config", ".", "setUri", "(", "reconnectUri", ")", ";", "this", ".", "configuration", "=", "config", ";", "final", "ReconnectRunner", "reconnectTask", "=", "this", ".", "reconnectRunner", ";", "if", "(", "reconnectTask", "==", "null", ")", "{", "final", "ReconnectRunner", "task", "=", "new", "ReconnectRunner", "(", ")", ";", "task", ".", "callback", "=", "callback", ";", "task", ".", "future", "=", "executorService", ".", "submit", "(", "task", ")", ";", "}", "else", "{", "reconnectTask", ".", "callback", "=", "callback", ";", "}", "}" ]
This continuously tries to reconnect in a separate thread and will only stop if the connection was established successfully or the server gets shutdown. If there is currently a reconnect task active the connection paramaters and callback will get updated. @param reconnectUri the updated connection uri @param authKey the updated authentication key @param callback the current callback
[ "This", "continuously", "tries", "to", "reconnect", "in", "a", "separate", "thread", "and", "will", "only", "stop", "if", "the", "connection", "was", "established", "successfully", "or", "the", "server", "gets", "shutdown", ".", "If", "there", "is", "currently", "a", "reconnect", "task", "active", "the", "connection", "paramaters", "and", "callback", "will", "get", "updated", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L152-L170
158,873
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java
HostControllerConnection.doReConnect
synchronized boolean doReConnect() throws IOException { // In case we are still connected, test the connection and see if we can reuse it if(connectionManager.isConnected()) { try { final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much return true; } catch (Exception e) { ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to ping the host-controller, going to reconnect"); } // Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect final Connection connection = connectionManager.getConnection(); StreamUtils.safeClose(connection); if(connection != null) { try { // Wait for the connection to be closed connection.awaitClosed(); } catch (InterruptedException e) { throw new InterruptedIOException(); } } } boolean ok = false; final Connection connection = connectionManager.connect(); try { // Reconnect to the host-controller final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null); try { boolean inSync = result.getResult().get(); ok = true; reconnectRunner = null; return inSync; } catch (ExecutionException e) { throw new IOException(e); } catch (InterruptedException e) { throw new InterruptedIOException(); } } finally { if(!ok) { StreamUtils.safeClose(connection); } } }
java
synchronized boolean doReConnect() throws IOException { // In case we are still connected, test the connection and see if we can reuse it if(connectionManager.isConnected()) { try { final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much return true; } catch (Exception e) { ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to ping the host-controller, going to reconnect"); } // Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect final Connection connection = connectionManager.getConnection(); StreamUtils.safeClose(connection); if(connection != null) { try { // Wait for the connection to be closed connection.awaitClosed(); } catch (InterruptedException e) { throw new InterruptedIOException(); } } } boolean ok = false; final Connection connection = connectionManager.connect(); try { // Reconnect to the host-controller final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null); try { boolean inSync = result.getResult().get(); ok = true; reconnectRunner = null; return inSync; } catch (ExecutionException e) { throw new IOException(e); } catch (InterruptedException e) { throw new InterruptedIOException(); } } finally { if(!ok) { StreamUtils.safeClose(connection); } } }
[ "synchronized", "boolean", "doReConnect", "(", ")", "throws", "IOException", "{", "// In case we are still connected, test the connection and see if we can reuse it", "if", "(", "connectionManager", ".", "isConnected", "(", ")", ")", "{", "try", "{", "final", "Future", "<", "Long", ">", "result", "=", "channelHandler", ".", "executeRequest", "(", "ManagementPingRequest", ".", "INSTANCE", ",", "null", ")", ".", "getResult", "(", ")", ";", "result", ".", "get", "(", "15", ",", "TimeUnit", ".", "SECONDS", ")", ";", "// Hmm, perhaps 15 is already too much", "return", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ServerLogger", ".", "AS_ROOT_LOGGER", ".", "debugf", "(", "e", ",", "\"failed to ping the host-controller, going to reconnect\"", ")", ";", "}", "// Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect", "final", "Connection", "connection", "=", "connectionManager", ".", "getConnection", "(", ")", ";", "StreamUtils", ".", "safeClose", "(", "connection", ")", ";", "if", "(", "connection", "!=", "null", ")", "{", "try", "{", "// Wait for the connection to be closed", "connection", ".", "awaitClosed", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "InterruptedIOException", "(", ")", ";", "}", "}", "}", "boolean", "ok", "=", "false", ";", "final", "Connection", "connection", "=", "connectionManager", ".", "connect", "(", ")", ";", "try", "{", "// Reconnect to the host-controller", "final", "ActiveOperation", "<", "Boolean", ",", "Void", ">", "result", "=", "channelHandler", ".", "executeRequest", "(", "new", "ServerReconnectRequest", "(", ")", ",", "null", ")", ";", "try", "{", "boolean", "inSync", "=", "result", ".", "getResult", "(", ")", ".", "get", "(", ")", ";", "ok", "=", "true", ";", "reconnectRunner", "=", "null", ";", "return", "inSync", ";", "}", "catch", "(", "ExecutionException", "e", ")", "{", "throw", "new", "IOException", "(", "e", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "InterruptedIOException", "(", ")", ";", "}", "}", "finally", "{", "if", "(", "!", "ok", ")", "{", "StreamUtils", ".", "safeClose", "(", "connection", ")", ";", "}", "}", "}" ]
Reconnect to the HC. @return whether the server is still in sync @throws IOException
[ "Reconnect", "to", "the", "HC", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L178-L222
158,874
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java
HostControllerConnection.started
synchronized void started() { try { if(isConnected()) { channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await(); } } catch (Exception e) { ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification"); } }
java
synchronized void started() { try { if(isConnected()) { channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await(); } } catch (Exception e) { ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification"); } }
[ "synchronized", "void", "started", "(", ")", "{", "try", "{", "if", "(", "isConnected", "(", ")", ")", "{", "channelHandler", ".", "executeRequest", "(", "new", "ServerStartedRequest", "(", ")", ",", "null", ")", ".", "getResult", "(", ")", ".", "await", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "ServerLogger", ".", "AS_ROOT_LOGGER", ".", "debugf", "(", "e", ",", "\"failed to send started notification\"", ")", ";", "}", "}" ]
Send the started notification
[ "Send", "the", "started", "notification" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L227-L235
158,875
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java
ServerTaskExecutor.executeTask
public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) { try { return execute(listener, task.getServerIdentity(), task.getOperation()); } catch (OperationFailedException e) { // Handle failures operation transformation failures final ServerIdentity identity = task.getServerIdentity(); final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT); final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT)); return 1; // 1 ms timeout since there is no reason to wait for the locally stored result } }
java
public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) { try { return execute(listener, task.getServerIdentity(), task.getOperation()); } catch (OperationFailedException e) { // Handle failures operation transformation failures final ServerIdentity identity = task.getServerIdentity(); final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT); final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT)); return 1; // 1 ms timeout since there is no reason to wait for the locally stored result } }
[ "public", "int", "executeTask", "(", "final", "TransactionalProtocolClient", ".", "TransactionalOperationListener", "<", "ServerOperation", ">", "listener", ",", "final", "ServerUpdateTask", "task", ")", "{", "try", "{", "return", "execute", "(", "listener", ",", "task", ".", "getServerIdentity", "(", ")", ",", "task", ".", "getOperation", "(", ")", ")", ";", "}", "catch", "(", "OperationFailedException", "e", ")", "{", "// Handle failures operation transformation failures", "final", "ServerIdentity", "identity", "=", "task", ".", "getServerIdentity", "(", ")", ";", "final", "ServerOperation", "serverOperation", "=", "new", "ServerOperation", "(", "identity", ",", "task", ".", "getOperation", "(", ")", ",", "null", ",", "null", ",", "OperationResultTransformer", ".", "ORIGINAL_RESULT", ")", ";", "final", "TransactionalProtocolClient", ".", "PreparedOperation", "<", "ServerOperation", ">", "result", "=", "BlockingQueueOperationListener", ".", "FailedOperation", ".", "create", "(", "serverOperation", ",", "e", ")", ";", "listener", ".", "operationPrepared", "(", "result", ")", ";", "recordExecutedRequest", "(", "new", "ExecutedServerRequest", "(", "identity", ",", "result", ".", "getFinalResult", "(", ")", ",", "OperationResultTransformer", ".", "ORIGINAL_RESULT", ")", ")", ";", "return", "1", ";", "// 1 ms timeout since there is no reason to wait for the locally stored result", "}", "}" ]
Execute a server task. @param listener the transactional server listener @param task the server task @return time to wait in ms for a response from the server, or {@code -1} if the task execution failed locally
[ "Execute", "a", "server", "task", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L81-L94
158,876
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java
ServerTaskExecutor.executeOperation
protected boolean executeOperation(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, TransactionalProtocolClient client, final ServerIdentity identity, final ModelNode operation, final OperationResultTransformer transformer) { if(client == null) { return false; } final OperationMessageHandler messageHandler = new DelegatingMessageHandler(context); final OperationAttachments operationAttachments = new DelegatingOperationAttachments(context); final ServerOperation serverOperation = new ServerOperation(identity, operation, messageHandler, operationAttachments, transformer); try { DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Sending %s to %s", operation, identity); final Future<OperationResponse> result = client.execute(listener, serverOperation); recordExecutedRequest(new ExecutedServerRequest(identity, result, transformer)); } catch (IOException e) { final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), transformer)); } return true; }
java
protected boolean executeOperation(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, TransactionalProtocolClient client, final ServerIdentity identity, final ModelNode operation, final OperationResultTransformer transformer) { if(client == null) { return false; } final OperationMessageHandler messageHandler = new DelegatingMessageHandler(context); final OperationAttachments operationAttachments = new DelegatingOperationAttachments(context); final ServerOperation serverOperation = new ServerOperation(identity, operation, messageHandler, operationAttachments, transformer); try { DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Sending %s to %s", operation, identity); final Future<OperationResponse> result = client.execute(listener, serverOperation); recordExecutedRequest(new ExecutedServerRequest(identity, result, transformer)); } catch (IOException e) { final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), transformer)); } return true; }
[ "protected", "boolean", "executeOperation", "(", "final", "TransactionalProtocolClient", ".", "TransactionalOperationListener", "<", "ServerOperation", ">", "listener", ",", "TransactionalProtocolClient", "client", ",", "final", "ServerIdentity", "identity", ",", "final", "ModelNode", "operation", ",", "final", "OperationResultTransformer", "transformer", ")", "{", "if", "(", "client", "==", "null", ")", "{", "return", "false", ";", "}", "final", "OperationMessageHandler", "messageHandler", "=", "new", "DelegatingMessageHandler", "(", "context", ")", ";", "final", "OperationAttachments", "operationAttachments", "=", "new", "DelegatingOperationAttachments", "(", "context", ")", ";", "final", "ServerOperation", "serverOperation", "=", "new", "ServerOperation", "(", "identity", ",", "operation", ",", "messageHandler", ",", "operationAttachments", ",", "transformer", ")", ";", "try", "{", "DomainControllerLogger", ".", "HOST_CONTROLLER_LOGGER", ".", "tracef", "(", "\"Sending %s to %s\"", ",", "operation", ",", "identity", ")", ";", "final", "Future", "<", "OperationResponse", ">", "result", "=", "client", ".", "execute", "(", "listener", ",", "serverOperation", ")", ";", "recordExecutedRequest", "(", "new", "ExecutedServerRequest", "(", "identity", ",", "result", ",", "transformer", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "final", "TransactionalProtocolClient", ".", "PreparedOperation", "<", "ServerOperation", ">", "result", "=", "BlockingQueueOperationListener", ".", "FailedOperation", ".", "create", "(", "serverOperation", ",", "e", ")", ";", "listener", ".", "operationPrepared", "(", "result", ")", ";", "recordExecutedRequest", "(", "new", "ExecutedServerRequest", "(", "identity", ",", "result", ".", "getFinalResult", "(", ")", ",", "transformer", ")", ")", ";", "}", "return", "true", ";", "}" ]
Execute the operation. @param listener the transactional operation listener @param client the transactional protocol client @param identity the server identity @param operation the operation @param transformer the operation result transformer @return whether the operation was executed
[ "Execute", "the", "operation", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L113-L130
158,877
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java
ServerTaskExecutor.recordPreparedOperation
void recordPreparedOperation(final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> preparedOperation) { recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(preparedOperation)); }
java
void recordPreparedOperation(final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> preparedOperation) { recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(preparedOperation)); }
[ "void", "recordPreparedOperation", "(", "final", "TransactionalProtocolClient", ".", "PreparedOperation", "<", "ServerTaskExecutor", ".", "ServerOperation", ">", "preparedOperation", ")", "{", "recordPreparedTask", "(", "new", "ServerTaskExecutor", ".", "ServerPreparedResponse", "(", "preparedOperation", ")", ")", ";", "}" ]
Record a prepare operation. @param preparedOperation the prepared operation
[ "Record", "a", "prepare", "operation", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L148-L150
158,878
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java
ServerTaskExecutor.recordOperationPrepareTimeout
void recordOperationPrepareTimeout(final BlockingQueueOperationListener.FailedOperation<ServerOperation> failedOperation) { recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(failedOperation)); // Swap out the submitted task so we don't wait for the final result. Use a future the returns // prepared response ServerIdentity identity = failedOperation.getOperation().getIdentity(); AsyncFuture<OperationResponse> finalResult = failedOperation.getFinalResult(); synchronized (submittedTasks) { submittedTasks.put(identity, new ServerTaskExecutor.ExecutedServerRequest(identity, finalResult)); } }
java
void recordOperationPrepareTimeout(final BlockingQueueOperationListener.FailedOperation<ServerOperation> failedOperation) { recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(failedOperation)); // Swap out the submitted task so we don't wait for the final result. Use a future the returns // prepared response ServerIdentity identity = failedOperation.getOperation().getIdentity(); AsyncFuture<OperationResponse> finalResult = failedOperation.getFinalResult(); synchronized (submittedTasks) { submittedTasks.put(identity, new ServerTaskExecutor.ExecutedServerRequest(identity, finalResult)); } }
[ "void", "recordOperationPrepareTimeout", "(", "final", "BlockingQueueOperationListener", ".", "FailedOperation", "<", "ServerOperation", ">", "failedOperation", ")", "{", "recordPreparedTask", "(", "new", "ServerTaskExecutor", ".", "ServerPreparedResponse", "(", "failedOperation", ")", ")", ";", "// Swap out the submitted task so we don't wait for the final result. Use a future the returns", "// prepared response", "ServerIdentity", "identity", "=", "failedOperation", ".", "getOperation", "(", ")", ".", "getIdentity", "(", ")", ";", "AsyncFuture", "<", "OperationResponse", ">", "finalResult", "=", "failedOperation", ".", "getFinalResult", "(", ")", ";", "synchronized", "(", "submittedTasks", ")", "{", "submittedTasks", ".", "put", "(", "identity", ",", "new", "ServerTaskExecutor", ".", "ExecutedServerRequest", "(", "identity", ",", "finalResult", ")", ")", ";", "}", "}" ]
Record a prepare operation timeout. @param failedOperation the prepared operation
[ "Record", "a", "prepare", "operation", "timeout", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L157-L166
158,879
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/installation/InstallationManagerService.java
InstallationManagerService.installService
public static ServiceController<InstallationManager> installService(ServiceTarget serviceTarget) { final InstallationManagerService service = new InstallationManagerService(); return serviceTarget.addService(InstallationManagerService.NAME, service) .addDependency(JBOSS_PRODUCT_CONFIG_SERVICE, ProductConfig.class, service.productConfig) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); }
java
public static ServiceController<InstallationManager> installService(ServiceTarget serviceTarget) { final InstallationManagerService service = new InstallationManagerService(); return serviceTarget.addService(InstallationManagerService.NAME, service) .addDependency(JBOSS_PRODUCT_CONFIG_SERVICE, ProductConfig.class, service.productConfig) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); }
[ "public", "static", "ServiceController", "<", "InstallationManager", ">", "installService", "(", "ServiceTarget", "serviceTarget", ")", "{", "final", "InstallationManagerService", "service", "=", "new", "InstallationManagerService", "(", ")", ";", "return", "serviceTarget", ".", "addService", "(", "InstallationManagerService", ".", "NAME", ",", "service", ")", ".", "addDependency", "(", "JBOSS_PRODUCT_CONFIG_SERVICE", ",", "ProductConfig", ".", "class", ",", "service", ".", "productConfig", ")", ".", "setInitialMode", "(", "ServiceController", ".", "Mode", ".", "ACTIVE", ")", ".", "install", "(", ")", ";", "}" ]
Install the installation manager service. @param serviceTarget @return the service controller for the installed installation manager
[ "Install", "the", "installation", "manager", "service", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/InstallationManagerService.java#L48-L54
158,880
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java
ClassReflectionIndex.getMethod
public Method getMethod(Method method) { return getMethod(method.getReturnType(), method.getName(), method.getParameterTypes()); }
java
public Method getMethod(Method method) { return getMethod(method.getReturnType(), method.getName(), method.getParameterTypes()); }
[ "public", "Method", "getMethod", "(", "Method", "method", ")", "{", "return", "getMethod", "(", "method", ".", "getReturnType", "(", ")", ",", "method", ".", "getName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ")", ";", "}" ]
Get the canonical method declared on this object. @param method the method to look up @return the canonical method object, or {@code null} if no matching method exists
[ "Get", "the", "canonical", "method", "declared", "on", "this", "object", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java#L223-L225
158,881
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java
ClassReflectionIndex.getAllMethods
public Collection<Method> getAllMethods(String name) { final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name); if (nameMap == null) { return Collections.emptySet(); } final Collection<Method> methods = new ArrayList<Method>(); for (Map<Class<?>, Method> map : nameMap.values()) { methods.addAll(map.values()); } return methods; }
java
public Collection<Method> getAllMethods(String name) { final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name); if (nameMap == null) { return Collections.emptySet(); } final Collection<Method> methods = new ArrayList<Method>(); for (Map<Class<?>, Method> map : nameMap.values()) { methods.addAll(map.values()); } return methods; }
[ "public", "Collection", "<", "Method", ">", "getAllMethods", "(", "String", "name", ")", "{", "final", "Map", "<", "ParamList", ",", "Map", "<", "Class", "<", "?", ">", ",", "Method", ">", ">", "nameMap", "=", "methods", ".", "get", "(", "name", ")", ";", "if", "(", "nameMap", "==", "null", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "final", "Collection", "<", "Method", ">", "methods", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "for", "(", "Map", "<", "Class", "<", "?", ">", ",", "Method", ">", "map", ":", "nameMap", ".", "values", "(", ")", ")", "{", "methods", ".", "addAll", "(", "map", ".", "values", "(", ")", ")", ";", "}", "return", "methods", ";", "}" ]
Get a collection of methods declared on this object by method name. @param name the name of the method @return the (possibly empty) collection of methods with the given name
[ "Get", "a", "collection", "of", "methods", "declared", "on", "this", "object", "by", "method", "name", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java#L309-L319
158,882
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java
ClassReflectionIndex.getAllMethods
public Collection<Method> getAllMethods(String name, int paramCount) { final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name); if (nameMap == null) { return Collections.emptySet(); } final Collection<Method> methods = new ArrayList<Method>(); for (Map<Class<?>, Method> map : nameMap.values()) { for (Method method : map.values()) { if (method.getParameterTypes().length == paramCount) { methods.add(method); } } } return methods; }
java
public Collection<Method> getAllMethods(String name, int paramCount) { final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name); if (nameMap == null) { return Collections.emptySet(); } final Collection<Method> methods = new ArrayList<Method>(); for (Map<Class<?>, Method> map : nameMap.values()) { for (Method method : map.values()) { if (method.getParameterTypes().length == paramCount) { methods.add(method); } } } return methods; }
[ "public", "Collection", "<", "Method", ">", "getAllMethods", "(", "String", "name", ",", "int", "paramCount", ")", "{", "final", "Map", "<", "ParamList", ",", "Map", "<", "Class", "<", "?", ">", ",", "Method", ">", ">", "nameMap", "=", "methods", ".", "get", "(", "name", ")", ";", "if", "(", "nameMap", "==", "null", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "final", "Collection", "<", "Method", ">", "methods", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "for", "(", "Map", "<", "Class", "<", "?", ">", ",", "Method", ">", "map", ":", "nameMap", ".", "values", "(", ")", ")", "{", "for", "(", "Method", "method", ":", "map", ".", "values", "(", ")", ")", "{", "if", "(", "method", ".", "getParameterTypes", "(", ")", ".", "length", "==", "paramCount", ")", "{", "methods", ".", "add", "(", "method", ")", ";", "}", "}", "}", "return", "methods", ";", "}" ]
Get a collection of methods declared on this object by method name and parameter count. @param name the name of the method @param paramCount the number of parameters @return the (possibly empty) collection of methods with the given name and parameter count
[ "Get", "a", "collection", "of", "methods", "declared", "on", "this", "object", "by", "method", "name", "and", "parameter", "count", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java#L328-L342
158,883
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/DomainServerCommunicationServices.java
DomainServerCommunicationServices.create
public static ServiceActivator create(final ModelNode endpointConfig, final URI managementURI, final String serverName, final String serverProcessName, final String authKey, final boolean managementSubsystemEndpoint, final Supplier<SSLContext> sslContextSupplier) { return new DomainServerCommunicationServices(endpointConfig, managementURI, serverName, serverProcessName, authKey, managementSubsystemEndpoint, sslContextSupplier); }
java
public static ServiceActivator create(final ModelNode endpointConfig, final URI managementURI, final String serverName, final String serverProcessName, final String authKey, final boolean managementSubsystemEndpoint, final Supplier<SSLContext> sslContextSupplier) { return new DomainServerCommunicationServices(endpointConfig, managementURI, serverName, serverProcessName, authKey, managementSubsystemEndpoint, sslContextSupplier); }
[ "public", "static", "ServiceActivator", "create", "(", "final", "ModelNode", "endpointConfig", ",", "final", "URI", "managementURI", ",", "final", "String", "serverName", ",", "final", "String", "serverProcessName", ",", "final", "String", "authKey", ",", "final", "boolean", "managementSubsystemEndpoint", ",", "final", "Supplier", "<", "SSLContext", ">", "sslContextSupplier", ")", "{", "return", "new", "DomainServerCommunicationServices", "(", "endpointConfig", ",", "managementURI", ",", "serverName", ",", "serverProcessName", ",", "authKey", ",", "managementSubsystemEndpoint", ",", "sslContextSupplier", ")", ";", "}" ]
Create a new service activator for the domain server communication services. @param endpointConfig the endpoint configuration @param managementURI the management connection URI @param serverName the server name @param serverProcessName the server process name @param authKey the authentication key @param managementSubsystemEndpoint whether to use the mgmt subsystem endpoint or not @return the service activator
[ "Create", "a", "new", "service", "activator", "for", "the", "domain", "server", "communication", "services", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/DomainServerCommunicationServices.java#L127-L131
158,884
wildfly/wildfly-core
network/src/main/java/org/jboss/as/network/SocketBinding.java
SocketBinding.getMulticastSocketAddress
public InetSocketAddress getMulticastSocketAddress() { if (multicastAddress == null) { throw MESSAGES.noMulticastBinding(name); } return new InetSocketAddress(multicastAddress, multicastPort); }
java
public InetSocketAddress getMulticastSocketAddress() { if (multicastAddress == null) { throw MESSAGES.noMulticastBinding(name); } return new InetSocketAddress(multicastAddress, multicastPort); }
[ "public", "InetSocketAddress", "getMulticastSocketAddress", "(", ")", "{", "if", "(", "multicastAddress", "==", "null", ")", "{", "throw", "MESSAGES", ".", "noMulticastBinding", "(", "name", ")", ";", "}", "return", "new", "InetSocketAddress", "(", "multicastAddress", ",", "multicastPort", ")", ";", "}" ]
Get the multicast socket address. @return the multicast address
[ "Get", "the", "multicast", "socket", "address", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/SocketBinding.java#L139-L144
158,885
wildfly/wildfly-core
network/src/main/java/org/jboss/as/network/SocketBinding.java
SocketBinding.createServerSocket
public ServerSocket createServerSocket() throws IOException { final ServerSocket socket = getServerSocketFactory().createServerSocket(name); socket.bind(getSocketAddress()); return socket; }
java
public ServerSocket createServerSocket() throws IOException { final ServerSocket socket = getServerSocketFactory().createServerSocket(name); socket.bind(getSocketAddress()); return socket; }
[ "public", "ServerSocket", "createServerSocket", "(", ")", "throws", "IOException", "{", "final", "ServerSocket", "socket", "=", "getServerSocketFactory", "(", ")", ".", "createServerSocket", "(", "name", ")", ";", "socket", ".", "bind", "(", "getSocketAddress", "(", ")", ")", ";", "return", "socket", ";", "}" ]
Create and bind a server socket @return the server socket @throws IOException
[ "Create", "and", "bind", "a", "server", "socket" ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/SocketBinding.java#L152-L156
158,886
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingDeploymentResources.java
LoggingDeploymentResources.registerDeploymentResource
public static void registerDeploymentResource(final DeploymentResourceSupport deploymentResourceSupport, final LoggingConfigurationService service) { final PathElement base = PathElement.pathElement("configuration", service.getConfiguration()); deploymentResourceSupport.getDeploymentSubModel(LoggingExtension.SUBSYSTEM_NAME, base); final LogContextConfiguration configuration = service.getValue(); // Register the child resources if the configuration is not null in cases where a log4j configuration was used if (configuration != null) { registerDeploymentResource(deploymentResourceSupport, base, HANDLER, configuration.getHandlerNames()); registerDeploymentResource(deploymentResourceSupport, base, LOGGER, configuration.getLoggerNames()); registerDeploymentResource(deploymentResourceSupport, base, FORMATTER, configuration.getFormatterNames()); registerDeploymentResource(deploymentResourceSupport, base, FILTER, configuration.getFilterNames()); registerDeploymentResource(deploymentResourceSupport, base, POJO, configuration.getPojoNames()); registerDeploymentResource(deploymentResourceSupport, base, ERROR_MANAGER, configuration.getErrorManagerNames()); } }
java
public static void registerDeploymentResource(final DeploymentResourceSupport deploymentResourceSupport, final LoggingConfigurationService service) { final PathElement base = PathElement.pathElement("configuration", service.getConfiguration()); deploymentResourceSupport.getDeploymentSubModel(LoggingExtension.SUBSYSTEM_NAME, base); final LogContextConfiguration configuration = service.getValue(); // Register the child resources if the configuration is not null in cases where a log4j configuration was used if (configuration != null) { registerDeploymentResource(deploymentResourceSupport, base, HANDLER, configuration.getHandlerNames()); registerDeploymentResource(deploymentResourceSupport, base, LOGGER, configuration.getLoggerNames()); registerDeploymentResource(deploymentResourceSupport, base, FORMATTER, configuration.getFormatterNames()); registerDeploymentResource(deploymentResourceSupport, base, FILTER, configuration.getFilterNames()); registerDeploymentResource(deploymentResourceSupport, base, POJO, configuration.getPojoNames()); registerDeploymentResource(deploymentResourceSupport, base, ERROR_MANAGER, configuration.getErrorManagerNames()); } }
[ "public", "static", "void", "registerDeploymentResource", "(", "final", "DeploymentResourceSupport", "deploymentResourceSupport", ",", "final", "LoggingConfigurationService", "service", ")", "{", "final", "PathElement", "base", "=", "PathElement", ".", "pathElement", "(", "\"configuration\"", ",", "service", ".", "getConfiguration", "(", ")", ")", ";", "deploymentResourceSupport", ".", "getDeploymentSubModel", "(", "LoggingExtension", ".", "SUBSYSTEM_NAME", ",", "base", ")", ";", "final", "LogContextConfiguration", "configuration", "=", "service", ".", "getValue", "(", ")", ";", "// Register the child resources if the configuration is not null in cases where a log4j configuration was used", "if", "(", "configuration", "!=", "null", ")", "{", "registerDeploymentResource", "(", "deploymentResourceSupport", ",", "base", ",", "HANDLER", ",", "configuration", ".", "getHandlerNames", "(", ")", ")", ";", "registerDeploymentResource", "(", "deploymentResourceSupport", ",", "base", ",", "LOGGER", ",", "configuration", ".", "getLoggerNames", "(", ")", ")", ";", "registerDeploymentResource", "(", "deploymentResourceSupport", ",", "base", ",", "FORMATTER", ",", "configuration", ".", "getFormatterNames", "(", ")", ")", ";", "registerDeploymentResource", "(", "deploymentResourceSupport", ",", "base", ",", "FILTER", ",", "configuration", ".", "getFilterNames", "(", ")", ")", ";", "registerDeploymentResource", "(", "deploymentResourceSupport", ",", "base", ",", "POJO", ",", "configuration", ".", "getPojoNames", "(", ")", ")", ";", "registerDeploymentResource", "(", "deploymentResourceSupport", ",", "base", ",", "ERROR_MANAGER", ",", "configuration", ".", "getErrorManagerNames", "(", ")", ")", ";", "}", "}" ]
Registers the deployment resources needed. @param deploymentResourceSupport the deployment resource support @param service the service, which may be {@code null}, used to find the resource names that need to be registered
[ "Registers", "the", "deployment", "resources", "needed", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingDeploymentResources.java#L110-L123
158,887
wildfly/wildfly-core
domain-http/interface/src/main/java/org/jboss/as/domain/http/server/DomainUtil.java
DomainUtil.constructUrl
public static String constructUrl(final HttpServerExchange exchange, final String path) { final HeaderMap headers = exchange.getRequestHeaders(); String host = headers.getFirst(HOST); String protocol = exchange.getConnection().getSslSessionInfo() != null ? "https" : "http"; return protocol + "://" + host + path; }
java
public static String constructUrl(final HttpServerExchange exchange, final String path) { final HeaderMap headers = exchange.getRequestHeaders(); String host = headers.getFirst(HOST); String protocol = exchange.getConnection().getSslSessionInfo() != null ? "https" : "http"; return protocol + "://" + host + path; }
[ "public", "static", "String", "constructUrl", "(", "final", "HttpServerExchange", "exchange", ",", "final", "String", "path", ")", "{", "final", "HeaderMap", "headers", "=", "exchange", ".", "getRequestHeaders", "(", ")", ";", "String", "host", "=", "headers", ".", "getFirst", "(", "HOST", ")", ";", "String", "protocol", "=", "exchange", ".", "getConnection", "(", ")", ".", "getSslSessionInfo", "(", ")", "!=", "null", "?", "\"https\"", ":", "\"http\"", ";", "return", "protocol", "+", "\"://\"", "+", "host", "+", "path", ";", "}" ]
Based on the current request represented by the HttpExchange construct a complete URL for the supplied path. @param exchange - The current HttpExchange @param path - The path to include in the constructed URL @return The constructed URL
[ "Based", "on", "the", "current", "request", "represented", "by", "the", "HttpExchange", "construct", "a", "complete", "URL", "for", "the", "supplied", "path", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/DomainUtil.java#L205-L211
158,888
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/PathElement.java
PathElement.matches
public boolean matches(Property property) { return property.getName().equals(key) && (value == WILDCARD_VALUE || property.getValue().asString().equals(value)); }
java
public boolean matches(Property property) { return property.getName().equals(key) && (value == WILDCARD_VALUE || property.getValue().asString().equals(value)); }
[ "public", "boolean", "matches", "(", "Property", "property", ")", "{", "return", "property", ".", "getName", "(", ")", ".", "equals", "(", "key", ")", "&&", "(", "value", "==", "WILDCARD_VALUE", "||", "property", ".", "getValue", "(", ")", ".", "asString", "(", ")", ".", "equals", "(", "value", ")", ")", ";", "}" ]
Determine whether the given property matches this element. A property matches this element when property name and this key are equal, values are equal or this element value is a wildcard. @param property the property to check @return {@code true} if the property matches
[ "Determine", "whether", "the", "given", "property", "matches", "this", "element", ".", "A", "property", "matches", "this", "element", "when", "property", "name", "and", "this", "key", "are", "equal", "values", "are", "equal", "or", "this", "element", "value", "is", "a", "wildcard", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathElement.java#L177-L179
158,889
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/PathElement.java
PathElement.matches
public boolean matches(PathElement pe) { return pe.key.equals(key) && (isWildcard() || pe.value.equals(value)); }
java
public boolean matches(PathElement pe) { return pe.key.equals(key) && (isWildcard() || pe.value.equals(value)); }
[ "public", "boolean", "matches", "(", "PathElement", "pe", ")", "{", "return", "pe", ".", "key", ".", "equals", "(", "key", ")", "&&", "(", "isWildcard", "(", ")", "||", "pe", ".", "value", ".", "equals", "(", "value", ")", ")", ";", "}" ]
Determine whether the given element matches this element. An element matches this element when keys are equal, values are equal or this element value is a wildcard. @param pe the element to check @return {@code true} if the element matches
[ "Determine", "whether", "the", "given", "element", "matches", "this", "element", ".", "An", "element", "matches", "this", "element", "when", "keys", "are", "equal", "values", "are", "equal", "or", "this", "element", "value", "is", "a", "wildcard", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathElement.java#L188-L190
158,890
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/logmanager/Log4jAppenderHandler.java
Log4jAppenderHandler.setAppender
public void setAppender(final Appender appender) { if (this.appender != null) { close(); } checkAccess(this); if (applyLayout && appender != null) { final Formatter formatter = getFormatter(); appender.setLayout(formatter == null ? null : new FormatterLayout(formatter)); } appenderUpdater.set(this, appender); }
java
public void setAppender(final Appender appender) { if (this.appender != null) { close(); } checkAccess(this); if (applyLayout && appender != null) { final Formatter formatter = getFormatter(); appender.setLayout(formatter == null ? null : new FormatterLayout(formatter)); } appenderUpdater.set(this, appender); }
[ "public", "void", "setAppender", "(", "final", "Appender", "appender", ")", "{", "if", "(", "this", ".", "appender", "!=", "null", ")", "{", "close", "(", ")", ";", "}", "checkAccess", "(", "this", ")", ";", "if", "(", "applyLayout", "&&", "appender", "!=", "null", ")", "{", "final", "Formatter", "formatter", "=", "getFormatter", "(", ")", ";", "appender", ".", "setLayout", "(", "formatter", "==", "null", "?", "null", ":", "new", "FormatterLayout", "(", "formatter", ")", ")", ";", "}", "appenderUpdater", ".", "set", "(", "this", ",", "appender", ")", ";", "}" ]
Set the Log4j appender. @param appender the log4j appender
[ "Set", "the", "Log4j", "appender", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/logmanager/Log4jAppenderHandler.java#L114-L124
158,891
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java
AbstractInstallationReporter.createOSNode
private ModelNode createOSNode() throws OperationFailedException { String osName = getProperty("os.name"); final ModelNode os = new ModelNode(); if (osName != null && osName.toLowerCase().contains("linux")) { try { os.set(GnuLinuxDistribution.discover()); } catch (IOException ex) { throw new OperationFailedException(ex); } } else { os.set(osName); } return os; }
java
private ModelNode createOSNode() throws OperationFailedException { String osName = getProperty("os.name"); final ModelNode os = new ModelNode(); if (osName != null && osName.toLowerCase().contains("linux")) { try { os.set(GnuLinuxDistribution.discover()); } catch (IOException ex) { throw new OperationFailedException(ex); } } else { os.set(osName); } return os; }
[ "private", "ModelNode", "createOSNode", "(", ")", "throws", "OperationFailedException", "{", "String", "osName", "=", "getProperty", "(", "\"os.name\"", ")", ";", "final", "ModelNode", "os", "=", "new", "ModelNode", "(", ")", ";", "if", "(", "osName", "!=", "null", "&&", "osName", ".", "toLowerCase", "(", ")", ".", "contains", "(", "\"linux\"", ")", ")", "{", "try", "{", "os", ".", "set", "(", "GnuLinuxDistribution", ".", "discover", "(", ")", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "OperationFailedException", "(", "ex", ")", ";", "}", "}", "else", "{", "os", ".", "set", "(", "osName", ")", ";", "}", "return", "os", ";", "}" ]
Create a ModelNode representing the operating system the instance is running on. @return a ModelNode representing the operating system the instance is running on. @throws OperationFailedException
[ "Create", "a", "ModelNode", "representing", "the", "operating", "system", "the", "instance", "is", "running", "on", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L87-L100
158,892
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java
AbstractInstallationReporter.createJVMNode
private ModelNode createJVMNode() throws OperationFailedException { ModelNode jvm = new ModelNode().setEmptyObject(); jvm.get(NAME).set(getProperty("java.vm.name")); jvm.get(JAVA_VERSION).set(getProperty("java.vm.specification.version")); jvm.get(JVM_VERSION).set(getProperty("java.version")); jvm.get(JVM_VENDOR).set(getProperty("java.vm.vendor")); jvm.get(JVM_HOME).set(getProperty("java.home")); return jvm; }
java
private ModelNode createJVMNode() throws OperationFailedException { ModelNode jvm = new ModelNode().setEmptyObject(); jvm.get(NAME).set(getProperty("java.vm.name")); jvm.get(JAVA_VERSION).set(getProperty("java.vm.specification.version")); jvm.get(JVM_VERSION).set(getProperty("java.version")); jvm.get(JVM_VENDOR).set(getProperty("java.vm.vendor")); jvm.get(JVM_HOME).set(getProperty("java.home")); return jvm; }
[ "private", "ModelNode", "createJVMNode", "(", ")", "throws", "OperationFailedException", "{", "ModelNode", "jvm", "=", "new", "ModelNode", "(", ")", ".", "setEmptyObject", "(", ")", ";", "jvm", ".", "get", "(", "NAME", ")", ".", "set", "(", "getProperty", "(", "\"java.vm.name\"", ")", ")", ";", "jvm", ".", "get", "(", "JAVA_VERSION", ")", ".", "set", "(", "getProperty", "(", "\"java.vm.specification.version\"", ")", ")", ";", "jvm", ".", "get", "(", "JVM_VERSION", ")", ".", "set", "(", "getProperty", "(", "\"java.version\"", ")", ")", ";", "jvm", ".", "get", "(", "JVM_VENDOR", ")", ".", "set", "(", "getProperty", "(", "\"java.vm.vendor\"", ")", ")", ";", "jvm", ".", "get", "(", "JVM_HOME", ")", ".", "set", "(", "getProperty", "(", "\"java.home\"", ")", ")", ";", "return", "jvm", ";", "}" ]
Create a ModelNode representing the JVM the instance is running on. @return a ModelNode representing the JVM the instance is running on. @throws OperationFailedException
[ "Create", "a", "ModelNode", "representing", "the", "JVM", "the", "instance", "is", "running", "on", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L108-L116
158,893
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java
AbstractInstallationReporter.createCPUNode
private ModelNode createCPUNode() throws OperationFailedException { ModelNode cpu = new ModelNode().setEmptyObject(); cpu.get(ARCH).set(getProperty("os.arch")); cpu.get(AVAILABLE_PROCESSORS).set(ProcessorInfo.availableProcessors()); return cpu; }
java
private ModelNode createCPUNode() throws OperationFailedException { ModelNode cpu = new ModelNode().setEmptyObject(); cpu.get(ARCH).set(getProperty("os.arch")); cpu.get(AVAILABLE_PROCESSORS).set(ProcessorInfo.availableProcessors()); return cpu; }
[ "private", "ModelNode", "createCPUNode", "(", ")", "throws", "OperationFailedException", "{", "ModelNode", "cpu", "=", "new", "ModelNode", "(", ")", ".", "setEmptyObject", "(", ")", ";", "cpu", ".", "get", "(", "ARCH", ")", ".", "set", "(", "getProperty", "(", "\"os.arch\"", ")", ")", ";", "cpu", ".", "get", "(", "AVAILABLE_PROCESSORS", ")", ".", "set", "(", "ProcessorInfo", ".", "availableProcessors", "(", ")", ")", ";", "return", "cpu", ";", "}" ]
Create a ModelNode representing the CPU the instance is running on. @return a ModelNode representing the CPU the instance is running on. @throws OperationFailedException
[ "Create", "a", "ModelNode", "representing", "the", "CPU", "the", "instance", "is", "running", "on", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L124-L129
158,894
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java
AbstractInstallationReporter.getProperty
private String getProperty(String name) { return System.getSecurityManager() == null ? System.getProperty(name) : doPrivileged(new ReadPropertyAction(name)); }
java
private String getProperty(String name) { return System.getSecurityManager() == null ? System.getProperty(name) : doPrivileged(new ReadPropertyAction(name)); }
[ "private", "String", "getProperty", "(", "String", "name", ")", "{", "return", "System", ".", "getSecurityManager", "(", ")", "==", "null", "?", "System", ".", "getProperty", "(", "name", ")", ":", "doPrivileged", "(", "new", "ReadPropertyAction", "(", "name", ")", ")", ";", "}" ]
Get a System property by its name. @param name the name of the wanted System property. @return the System property value - null if it is not defined.
[ "Get", "a", "System", "property", "by", "its", "name", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L201-L203
158,895
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java
ManagementModelNode.explore
public void explore() { if (isLeaf) return; if (isGeneric) return; removeAllChildren(); try { String addressPath = addressPath(); ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description"); resourceDesc = resourceDesc.get("result"); ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)"); ModelNode result = response.get("result"); if (!result.isDefined()) return; List<String> childrenTypes = getChildrenTypes(addressPath); for (ModelNode node : result.asList()) { Property prop = node.asProperty(); if (childrenTypes.contains(prop.getName())) { // resource node if (hasGenericOperations(addressPath, prop.getName())) { add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName()))); } if (prop.getValue().isDefined()) { for (ModelNode innerNode : prop.getValue().asList()) { UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName()); add(new ManagementModelNode(cliGuiCtx, usrObj)); } } } else { // attribute node UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString()); add(new ManagementModelNode(cliGuiCtx, usrObj)); } } } catch (Exception e) { e.printStackTrace(); } }
java
public void explore() { if (isLeaf) return; if (isGeneric) return; removeAllChildren(); try { String addressPath = addressPath(); ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description"); resourceDesc = resourceDesc.get("result"); ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)"); ModelNode result = response.get("result"); if (!result.isDefined()) return; List<String> childrenTypes = getChildrenTypes(addressPath); for (ModelNode node : result.asList()) { Property prop = node.asProperty(); if (childrenTypes.contains(prop.getName())) { // resource node if (hasGenericOperations(addressPath, prop.getName())) { add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName()))); } if (prop.getValue().isDefined()) { for (ModelNode innerNode : prop.getValue().asList()) { UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName()); add(new ManagementModelNode(cliGuiCtx, usrObj)); } } } else { // attribute node UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString()); add(new ManagementModelNode(cliGuiCtx, usrObj)); } } } catch (Exception e) { e.printStackTrace(); } }
[ "public", "void", "explore", "(", ")", "{", "if", "(", "isLeaf", ")", "return", ";", "if", "(", "isGeneric", ")", "return", ";", "removeAllChildren", "(", ")", ";", "try", "{", "String", "addressPath", "=", "addressPath", "(", ")", ";", "ModelNode", "resourceDesc", "=", "executor", ".", "doCommand", "(", "addressPath", "+", "\":read-resource-description\"", ")", ";", "resourceDesc", "=", "resourceDesc", ".", "get", "(", "\"result\"", ")", ";", "ModelNode", "response", "=", "executor", ".", "doCommand", "(", "addressPath", "+", "\":read-resource(include-runtime=true,include-defaults=true)\"", ")", ";", "ModelNode", "result", "=", "response", ".", "get", "(", "\"result\"", ")", ";", "if", "(", "!", "result", ".", "isDefined", "(", ")", ")", "return", ";", "List", "<", "String", ">", "childrenTypes", "=", "getChildrenTypes", "(", "addressPath", ")", ";", "for", "(", "ModelNode", "node", ":", "result", ".", "asList", "(", ")", ")", "{", "Property", "prop", "=", "node", ".", "asProperty", "(", ")", ";", "if", "(", "childrenTypes", ".", "contains", "(", "prop", ".", "getName", "(", ")", ")", ")", "{", "// resource node", "if", "(", "hasGenericOperations", "(", "addressPath", ",", "prop", ".", "getName", "(", ")", ")", ")", "{", "add", "(", "new", "ManagementModelNode", "(", "cliGuiCtx", ",", "new", "UserObject", "(", "node", ",", "prop", ".", "getName", "(", ")", ")", ")", ")", ";", "}", "if", "(", "prop", ".", "getValue", "(", ")", ".", "isDefined", "(", ")", ")", "{", "for", "(", "ModelNode", "innerNode", ":", "prop", ".", "getValue", "(", ")", ".", "asList", "(", ")", ")", "{", "UserObject", "usrObj", "=", "new", "UserObject", "(", "innerNode", ",", "prop", ".", "getName", "(", ")", ",", "innerNode", ".", "asProperty", "(", ")", ".", "getName", "(", ")", ")", ";", "add", "(", "new", "ManagementModelNode", "(", "cliGuiCtx", ",", "usrObj", ")", ")", ";", "}", "}", "}", "else", "{", "// attribute node", "UserObject", "usrObj", "=", "new", "UserObject", "(", "node", ",", "resourceDesc", ",", "prop", ".", "getName", "(", ")", ",", "prop", ".", "getValue", "(", ")", ".", "asString", "(", ")", ")", ";", "add", "(", "new", "ManagementModelNode", "(", "cliGuiCtx", ",", "usrObj", ")", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Refresh children using read-resource operation.
[ "Refresh", "children", "using", "read", "-", "resource", "operation", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java#L73-L107
158,896
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java
ManagementModelNode.addressPath
public String addressPath() { if (isLeaf) { ManagementModelNode parent = (ManagementModelNode)getParent(); return parent.addressPath(); } StringBuilder builder = new StringBuilder(); for (Object pathElement : getUserObjectPath()) { UserObject userObj = (UserObject)pathElement; if (userObj.isRoot()) { // don't want to escape root builder.append(userObj.getName()); continue; } builder.append(userObj.getName()); builder.append("="); builder.append(userObj.getEscapedValue()); builder.append("/"); } return builder.toString(); }
java
public String addressPath() { if (isLeaf) { ManagementModelNode parent = (ManagementModelNode)getParent(); return parent.addressPath(); } StringBuilder builder = new StringBuilder(); for (Object pathElement : getUserObjectPath()) { UserObject userObj = (UserObject)pathElement; if (userObj.isRoot()) { // don't want to escape root builder.append(userObj.getName()); continue; } builder.append(userObj.getName()); builder.append("="); builder.append(userObj.getEscapedValue()); builder.append("/"); } return builder.toString(); }
[ "public", "String", "addressPath", "(", ")", "{", "if", "(", "isLeaf", ")", "{", "ManagementModelNode", "parent", "=", "(", "ManagementModelNode", ")", "getParent", "(", ")", ";", "return", "parent", ".", "addressPath", "(", ")", ";", "}", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "pathElement", ":", "getUserObjectPath", "(", ")", ")", "{", "UserObject", "userObj", "=", "(", "UserObject", ")", "pathElement", ";", "if", "(", "userObj", ".", "isRoot", "(", ")", ")", "{", "// don't want to escape root", "builder", ".", "append", "(", "userObj", ".", "getName", "(", ")", ")", ";", "continue", ";", "}", "builder", ".", "append", "(", "userObj", ".", "getName", "(", ")", ")", ";", "builder", ".", "append", "(", "\"=\"", ")", ";", "builder", ".", "append", "(", "userObj", ".", "getEscapedValue", "(", ")", ")", ";", "builder", ".", "append", "(", "\"/\"", ")", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Get the DMR path for this node. For leaves, the DMR path is the path of its parent. @return The DMR path for this node.
[ "Get", "the", "DMR", "path", "for", "this", "node", ".", "For", "leaves", "the", "DMR", "path", "is", "the", "path", "of", "its", "parent", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java#L133-L154
158,897
wildfly/wildfly-core
network/src/main/java/org/jboss/as/network/NetworkUtils.java
NetworkUtils.mayBeIPv6Address
private static boolean mayBeIPv6Address(String input) { if (input == null) { return false; } boolean result = false; int colonsCounter = 0; int length = input.length(); for (int i = 0; i < length; i++) { char c = input.charAt(i); if (c == '.' || c == '%') { // IPv4 in IPv6 or Zone ID detected, end of checking. break; } if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || c == ':')) { return false; } else if (c == ':') { colonsCounter++; } } if (colonsCounter >= 2) { result = true; } return result; }
java
private static boolean mayBeIPv6Address(String input) { if (input == null) { return false; } boolean result = false; int colonsCounter = 0; int length = input.length(); for (int i = 0; i < length; i++) { char c = input.charAt(i); if (c == '.' || c == '%') { // IPv4 in IPv6 or Zone ID detected, end of checking. break; } if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || c == ':')) { return false; } else if (c == ':') { colonsCounter++; } } if (colonsCounter >= 2) { result = true; } return result; }
[ "private", "static", "boolean", "mayBeIPv6Address", "(", "String", "input", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "result", "=", "false", ";", "int", "colonsCounter", "=", "0", ";", "int", "length", "=", "input", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "c", "=", "input", ".", "charAt", "(", "i", ")", ";", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "// IPv4 in IPv6 or Zone ID detected, end of checking.", "break", ";", "}", "if", "(", "!", "(", "(", "c", ">=", "'", "'", "&&", "c", "<=", "'", "'", ")", "||", "(", "c", ">=", "'", "'", "&&", "c", "<=", "'", "'", ")", "||", "(", "c", ">=", "'", "'", "&&", "c", "<=", "'", "'", ")", "||", "c", "==", "'", "'", ")", ")", "{", "return", "false", ";", "}", "else", "if", "(", "c", "==", "'", "'", ")", "{", "colonsCounter", "++", ";", "}", "}", "if", "(", "colonsCounter", ">=", "2", ")", "{", "result", "=", "true", ";", "}", "return", "result", ";", "}" ]
Heuristic check if string might be an IPv6 address. @param input Any string or null @return true, if input string contains only hex digits and at least two colons, before '.' or '%' character.
[ "Heuristic", "check", "if", "string", "might", "be", "an", "IPv6", "address", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/NetworkUtils.java#L253-L278
158,898
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/transformers/DomainTransformers.java
DomainTransformers.initializeDomainRegistry
public static void initializeDomainRegistry(final TransformerRegistry registry) { //The chains for transforming will be as follows //For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0 registerRootTransformers(registry); registerChainedManagementTransformers(registry); registerChainedServerGroupTransformers(registry); registerProfileTransformers(registry); registerSocketBindingGroupTransformers(registry); registerDeploymentTransformers(registry); }
java
public static void initializeDomainRegistry(final TransformerRegistry registry) { //The chains for transforming will be as follows //For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0 registerRootTransformers(registry); registerChainedManagementTransformers(registry); registerChainedServerGroupTransformers(registry); registerProfileTransformers(registry); registerSocketBindingGroupTransformers(registry); registerDeploymentTransformers(registry); }
[ "public", "static", "void", "initializeDomainRegistry", "(", "final", "TransformerRegistry", "registry", ")", "{", "//The chains for transforming will be as follows", "//For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0", "registerRootTransformers", "(", "registry", ")", ";", "registerChainedManagementTransformers", "(", "registry", ")", ";", "registerChainedServerGroupTransformers", "(", "registry", ")", ";", "registerProfileTransformers", "(", "registry", ")", ";", "registerSocketBindingGroupTransformers", "(", "registry", ")", ";", "registerDeploymentTransformers", "(", "registry", ")", ";", "}" ]
Initialize the domain registry. @param registry the domain registry
[ "Initialize", "the", "domain", "registry", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/transformers/DomainTransformers.java#L77-L88
158,899
wildfly/wildfly-core
process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java
ProcessUtils.killProcess
static boolean killProcess(final String processName, int id) { int pid; try { pid = processUtils.resolveProcessId(processName, id); if(pid > 0) { try { Runtime.getRuntime().exec(processUtils.getKillCommand(pid)); return true; } catch (Throwable t) { ProcessLogger.ROOT_LOGGER.debugf(t, "failed to kill process '%s' with pid '%s'", processName, pid); } } } catch (Throwable t) { ProcessLogger.ROOT_LOGGER.debugf(t, "failed to resolve pid of process '%s'", processName); } return false; }
java
static boolean killProcess(final String processName, int id) { int pid; try { pid = processUtils.resolveProcessId(processName, id); if(pid > 0) { try { Runtime.getRuntime().exec(processUtils.getKillCommand(pid)); return true; } catch (Throwable t) { ProcessLogger.ROOT_LOGGER.debugf(t, "failed to kill process '%s' with pid '%s'", processName, pid); } } } catch (Throwable t) { ProcessLogger.ROOT_LOGGER.debugf(t, "failed to resolve pid of process '%s'", processName); } return false; }
[ "static", "boolean", "killProcess", "(", "final", "String", "processName", ",", "int", "id", ")", "{", "int", "pid", ";", "try", "{", "pid", "=", "processUtils", ".", "resolveProcessId", "(", "processName", ",", "id", ")", ";", "if", "(", "pid", ">", "0", ")", "{", "try", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "processUtils", ".", "getKillCommand", "(", "pid", ")", ")", ";", "return", "true", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "ProcessLogger", ".", "ROOT_LOGGER", ".", "debugf", "(", "t", ",", "\"failed to kill process '%s' with pid '%s'\"", ",", "processName", ",", "pid", ")", ";", "}", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "ProcessLogger", ".", "ROOT_LOGGER", ".", "debugf", "(", "t", ",", "\"failed to resolve pid of process '%s'\"", ",", "processName", ")", ";", "}", "return", "false", ";", "}" ]
Try to kill a given process. @param processName the process name @param id the process integer id, or {@code -1} if this is not relevant @return {@code true} if the command succeeded, {@code false} otherwise
[ "Try", "to", "kill", "a", "given", "process", "." ]
cfaf0479dcbb2d320a44c5374b93b944ec39fade
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java#L38-L54